Java Code Examples for javafx.scene.control.TreeTableColumn#setStyle()

The following examples show how to use javafx.scene.control.TreeTableColumn#setStyle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultTreeTable.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
protected void addColumnString (String heading, int width, Justification justification,
    String propertyName)
{
  TreeTableColumn<T, String> column = new TreeTableColumn<> (heading);
  column.setPrefWidth (width);
  column
      .setCellValueFactory (new TreeItemPropertyValueFactory<T, String> (propertyName));
  getColumns ().add (column);

  if (justification == Justification.CENTER)
    column.setStyle ("-fx-alignment: CENTER;");
}
 
Example 2
Source File: DefaultTreeTable.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
protected void addColumnNumber (String heading, int width, String propertyName)
{
  TreeTableColumn<T, Number> column = new TreeTableColumn<> (heading);
  column.setPrefWidth (width);
  column
      .setCellValueFactory (new TreeItemPropertyValueFactory<T, Number> (propertyName));
  getColumns ().add (column);
  column.setStyle ("-fx-alignment: CENTER-RIGHT;");
}
 
Example 3
Source File: DefaultTreeTable.java    From dm3270 with Apache License 2.0 5 votes vote down vote up
protected void addColumnString (String heading, int width, Justification justification,
    String propertyName)
{
  TreeTableColumn<T, String> column = new TreeTableColumn<> (heading);
  column.setPrefWidth (width);
  column
      .setCellValueFactory (new TreeItemPropertyValueFactory<T, String> (propertyName));
  getColumns ().add (column);

  if (justification == Justification.CENTER)
    column.setStyle ("-fx-alignment: CENTER;");
}
 
Example 4
Source File: DefaultTreeTable.java    From dm3270 with Apache License 2.0 5 votes vote down vote up
protected void addColumnNumber (String heading, int width, String propertyName)
{
  TreeTableColumn<T, Number> column = new TreeTableColumn<> (heading);
  column.setPrefWidth (width);
  column
      .setCellValueFactory (new TreeItemPropertyValueFactory<T, Number> (propertyName));
  getColumns ().add (column);
  column.setStyle ("-fx-alignment: CENTER-RIGHT;");
}
 
Example 5
Source File: CDecimalField.java    From Open-Lowcode with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public TreeTableColumn<ObjectDataElt, LockableBigDecimal> getTreeTableColumn(
		PageActionManager pageactionmanager,
		String actionkeyforupdate) {
	TreeTableColumn<
			ObjectDataElt, LockableBigDecimal> thiscolumn = new TreeTableColumn<ObjectDataElt, LockableBigDecimal>(
					this.getLabel());
	thiscolumn.setEditable(true);
	thiscolumn.setStyle("-fx-alignment: CENTER-RIGHT;");
	int length = 110;
	thiscolumn.setMinWidth(length);
	CDecimalField thisdecimalfield = this;

	BigDecimalFormatValidator validator = new BigDecimalFormatValidator(precision, scale);
	// big display disabled as hardcoded
	thiscolumn.setCellFactory(column -> {
		return new LargeTextTreeTableCell<ObjectDataElt, LockableBigDecimal>(
				new NiceLockableBigDecimalStringConverter(precision, scale), validator, this.decimalformatter,
				false, true,1) {
			@Override
			public void updateItem(LockableBigDecimal decimal, boolean empty) {
				logger.fine("Updating field for decimal = " + decimal + " empty = " + empty);
				super.updateItem(decimal, empty);

				super.setMaxHeight(12);
				super.setPrefHeight(12);
				super.setMinHeight(12);
				if (decimal != null) {
					if (decimal.isLocked()) {
						logger.fine("set to lock");

						super.setEditable(false);
					} else {
						logger.fine("set to unlock");

						super.setEditable(true);
					}
				}

			}

		};
	});

	thiscolumn.setCellValueFactory(new Callback<
			TreeTableColumn.CellDataFeatures<ObjectDataElt, LockableBigDecimal>,
			ObservableValue<LockableBigDecimal>>() {

		@Override
		public ObservableValue<LockableBigDecimal> call(
				TreeTableColumn.CellDataFeatures<ObjectDataElt, LockableBigDecimal> p) {

			SimpleDataElt lineelement = p.getValue().getValue().lookupEltByName(thisdecimalfield.getFieldname());
			if (lineelement == null)
				return new SimpleObjectProperty<LockableBigDecimal>(null);
			if (!(lineelement instanceof DecimalDataElt))
				return new SimpleObjectProperty<LockableBigDecimal>(null);
			DecimalDataElt linedataelt = (DecimalDataElt) lineelement;
			boolean locked = true;

			logger.finest("      *-*-*-* processing DecimalDataElt " + Integer.toHexString(linedataelt.hashCode())
					+ " locked = " + linedataelt.islocked() + ", payload = " + linedataelt.getPayload() + " name = "
					+ linedataelt.getName());
			return new SimpleObjectProperty<LockableBigDecimal>(
					new LockableBigDecimal(locked, linedataelt.getPayload()));

		}

	});

	return thiscolumn;
}