javafx.beans.property.SimpleListProperty Java Examples

The following examples show how to use javafx.beans.property.SimpleListProperty. 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: TrainingPane.java    From OpenLabeler with Apache License 2.0 6 votes vote down vote up
private void bindProperties() {
    // Update on any directory changes
    dirTFImage.textProperty().addListener((observable, oldValue, newValue) -> updateNumSamples());
    dirTFAnnotation.textProperty().addListener((observable, oldValue, newValue) -> updateNumSamples());
    dirTFData.textProperty().addListener((observable, oldValue, newValue) -> updateLabelMap());
    dirTFBaseModel.textProperty().addListener((observable, oldValue, newValue) -> updateTraining());

    BooleanBinding changes[] = {
            dirTFImage.textProperty().isNotEqualTo(Settings.tfImageDirProperty),
            dirTFAnnotation.textProperty().isNotEqualTo(Settings.tfAnnotationDirProperty),
            dirTFData.textProperty().isNotEqualTo(Settings.tfDataDirProperty),
            new SimpleListProperty(labelMapPane.getItems()).isNotEqualTo(
                    FXCollections.observableList(TFTrainer.getLabelMapItems(dirTFData.getText()))),
            dirTFBaseModel.textProperty().isNotEqualTo(Settings.tfBaseModelDirProperty),
            txtDockerImage.textProperty().isNotEqualTo(Settings.dockerImageProperty),
            txtContainerHostName.textProperty().isNotEqualTo(Settings.containerHostNameProperty),
            txtContainerName.textProperty().isNotEqualTo(Settings.containerNameProperty),
    };
    dirtyProperty.unbind();
    dirtyProperty.bind(EasyBind.combine(
            FXCollections.observableArrayList(changes), stream -> stream.reduce((a, b) -> a | b).orElse(false)));
}
 
Example #2
Source File: History.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
/**
 * Adds a listener to the {@code setting}, so every time the value of the {@code setting} changes,
 * a new {@link Change} will be created and added to the list of changes.
 *
 * @param setting the setting to observe for changes
 */
public void attachChangeListener(Setting setting) {
  ChangeListener changeEvent = (observable, oldValue, newValue) -> {
    if (isListenerActive() && oldValue != newValue) {
      LOGGER.trace("Change detected, old: " + oldValue + " new: " + newValue);
      addChange(new Change(setting, oldValue, newValue));
    }
  };
  ChangeListener listChangeEvent = (observable, oldValue, newValue) -> {
    if (isListenerActive()) {
      LOGGER.trace("List Change detected: " + oldValue);
      addChange(new Change(setting, (ObservableList) oldValue, (ObservableList) newValue));
    }
  };

  if (setting.valueProperty() instanceof SimpleListProperty) {
    setting.valueProperty().addListener(listChangeEvent);
  } else {
    setting.valueProperty().addListener(changeEvent);
  }
}
 
Example #3
Source File: GeneralPane.java    From OpenLabeler with Apache License 2.0 5 votes vote down vote up
public GeneralPane() {
   FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/preference/GeneralPane.fxml"), bundle);
   loader.setRoot(this);
   loader.setController(this);

   try {
      loader.load();
   }
   catch (Exception ex) {
      LOG.log(Level.SEVERE, "Unable to load FXML", ex);
   }

   // Bind Properties
   BooleanBinding changes[] = {
         chkOpenLastMedia.selectedProperty().isNotEqualTo(Settings.openLastMediaProperty),
         chkSaveEveryChange.selectedProperty().isNotEqualTo(Settings.saveEveryChangeProperty),
         textAnnotationsDir.textProperty().isNotEqualTo(Settings.annotationDirProperty),
         pickerObjectStrokeColor.valueProperty().isNotEqualTo(Settings.objectStrokeColorProperty),
         chkAutoSetName.selectedProperty().isNotEqualTo(Settings.autoSetNameProperty),
         chkAnimateOutline.selectedProperty().isNotEqualTo(Settings.animateOutlineProperty),
         new SimpleListProperty(nameTablePane.getItems()).isNotEqualTo(Settings.recentNamesProperty),
   };
   dirtyProperty.bind(EasyBind.combine(
         FXCollections.observableArrayList(changes), stream -> stream.reduce((a, b) -> a | b).orElse(false)));

   load();
}
 
Example #4
Source File: BadaboomCollector.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates an empty collector.
 */
@SuppressWarnings("CheckReturnValue")
private BadaboomCollector() {
	super();
	errors = new SimpleListProperty<>(FXCollections.observableArrayList());
	ErrorCatcher.getInstance().getErrors().subscribe(ex -> errors.add(ex));
}
 
Example #5
Source File: PreferencesService.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
PreferencesService(final @NotNull String prefsPath) {
	super();
	this.prefsPath = prefsPath;
	lang = new SimpleObjectProperty<>(readLang());
	bundle = loadResourceBundle(lang.get()).orElseThrow(
		() -> new IllegalArgumentException("Cannot read any resource bundle in this lang: " + lang.get()));
	nbRecentFiles = new SimpleIntegerProperty(5);
	gridGap = new SimpleIntegerProperty(10);
	checkVersion = new SimpleBooleanProperty(true);
	gridStyle = new SimpleObjectProperty<>(GridStyle.NONE);
	unit = new SimpleObjectProperty<>(Unit.CM);
	magneticGrid = new SimpleBooleanProperty(false);
	pathExport = new SimpleStringProperty("");
	pathOpen = new SimpleStringProperty("");
	includes = new SimpleStringProperty("");
	currentFile = Optional.empty();
	currentFolder = Optional.empty();
	recentFileNames = new SimpleListProperty<>(FXCollections.observableArrayList());
	page = new SimpleObjectProperty<>(Page.USLETTER);

	nbRecentFiles.addListener((observable, oldValue, newValue) -> {
		while(newValue.intValue() > recentFileNames.size() && !recentFileNames.isEmpty()) {
			recentFileNames.remove(recentFileNames.size() - 1);
		}
	});

	UndoCollector.getInstance().setBundle(bundle);
}
 
Example #6
Source File: DrawingImpl.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
DrawingImpl() {
	super();
	title = new SimpleStringProperty("");
	shapes = new SimpleListProperty<>(FXCollections.observableArrayList());
	selection = ShapeFactory.INST.createGroup();
	modified = false;
}
 
Example #7
Source File: LedBargraph.java    From Enzo with Apache License 2.0 5 votes vote down vote up
public LedBargraph() {
    getStyleClass().add("bargraph");
    ledColors = new SimpleListProperty(this, "ledColors", FXCollections.<Color>observableArrayList());
    value     = new SimpleDoubleProperty(this, "value", 0);

    for (int i = 0 ; i < getNoOfLeds() ; i++) {
        if (i < 11) {
            ledColors.get().add(Color.LIME);
        } else if (i > 10 && i < 13) {
            ledColors.get().add(Color.YELLOW);
        } else {
            ledColors.get().add(Color.RED);
        }
    }
}
 
Example #8
Source File: RAM.java    From CPUSim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor
 * @param name name of the ram
 * @param length a positive integer that specifies the number
 *               of cells in the RAM.
 * @param cellSize the number of bits per cell. This must be a positive
 *                 integer up to 64.
 */
public RAM(String name, int length, int cellSize) {
    super(name);
    this.cellSize = new SimpleIntegerProperty(cellSize);
    this.length = new SimpleIntegerProperty(length);
    this.data = FXCollections.observableArrayList();
    this.changedData = new SimpleListProperty<>(this,"RAM data",null);
    for (int i=0; i<length; i++){
        this.data.add(new RAMLocation(i, 0, this, false, "", null));
    }
    this.haltAtBreaks = false; //can only fromRootController RAM when not in debug mode
    cellMask = 0;
    for (int i = 0; i < cellSize; i++)
        cellMask = (cellMask << 1) + 1;
}
 
Example #9
Source File: TableController.java    From zest-writer with GNU General Public License v3.0 5 votes vote down vote up
public ZRow(int n) {
    super();
    List<String> lst = new ArrayList<>();
    for(int i=0; i<n; i++) {
        lst.add(" - ");
    }
    ObservableList<String> observableList = FXCollections.observableArrayList(lst);
    this.row = new SimpleListProperty<>(observableList);

}
 
Example #10
Source File: ObservableListTests.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Parameters
public static Collection<Object[]> data() {
	return Arrays.asList(
			new Object[][] { { new Provider<ObservableList<Integer>>() {
				@Override
				public ObservableList<Integer> get() {
					return CollectionUtils
							.observableList(new ArrayList<Integer>());

				}
			} }, { new Provider<ObservableList<Integer>>() {

				@Override
				public ObservableList<Integer> get() {
					// test JavaFX behavior
					return FXCollections.observableArrayList();
				}
			} }, { new Provider<ObservableList<Integer>>() {

				@Override
				public ObservableList<Integer> get() {
					// test SimpleListPropertyEx, which is the
					// 'default' implementation of the related
					// ObservableValue.
					return new SimpleListPropertyEx<>(CollectionUtils
							.observableList(new ArrayList<Integer>()));
				}
			} },

					{ new Provider<ObservableList<Integer>>() {

						@Override
						public ObservableList<Integer> get() {
							return new SimpleListProperty<>(FXCollections
									.<Integer> observableArrayList());
						}
					} },

					{ new Provider<ObservableList<Integer>>() {

						@Override
						public ObservableList<Integer> get() {
							// test ReadOnlyListWrapperEx, which is the
							// 'default' implementation of the related
							// read-only support.
							return new ReadOnlyListWrapperEx<>(
									CollectionUtils.observableList(
											new ArrayList<Integer>()));

						}
					} }/*
						 * , { new Provider<ObservableList<Integer>>() {
						 *
						 * @Override public ObservableList<Integer> get() {
						 * return new ReadOnlyListWrapper<>(
						 * FXCollections.<Integer> observableArrayList()); }
						 * } }
						 */ });
}
 
Example #11
Source File: AltasCanvas.java    From javafx-TKMapEditor with GNU General Public License v3.0 4 votes vote down vote up
public SimpleListProperty<Integer> NowChooseProperty() {
	return nowChooseProperty;
}
 
Example #12
Source File: MapCanvas.java    From javafx-TKMapEditor with GNU General Public License v3.0 4 votes vote down vote up
public SimpleListProperty<Integer> NowChooseProperty() {
	return nowChooseProperty;
}
 
Example #13
Source File: RadialBargraph.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final ListProperty<Stop> barGradientProperty() {
    if (null == barGradient) {
        barGradient = new SimpleListProperty<>(this, "barGradient", _barGradient);
    }
    return barGradient;
}
 
Example #14
Source File: VuMeterBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final VuMeterBuilder sections(final ObservableList<Section> SECTIONS) {
    properties.put("sections", new SimpleListProperty<>(SECTIONS));
    return this;
}
 
Example #15
Source File: GroupImpl.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
GroupImpl() {
	super();
	shapes = new SimpleListProperty<>(FXCollections.observableArrayList());
	rotationAngle = new SimpleDoubleProperty();
}
 
Example #16
Source File: WindowsMenu.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create the "Windows" menu for a MDI view
 */
public WindowsMenu() {

  super("Windows");

  closeAllMenuItem = new MenuItem("Close all windows");
  closeAllMenuItem.setOnAction(e -> closeAllWindows());

  // If the menu has <= 3 items, it means only the main MZmine window is showing
  itemsProperty = new SimpleListProperty<>(getItems());
  closeAllMenuItem.disableProperty().bind(itemsProperty.sizeProperty().lessThanOrEqualTo(3));

  getItems().addAll(closeAllMenuItem, new SeparatorMenuItem());

  this.setOnShowing(e -> fillWindowsMenu());

}
 
Example #17
Source File: ListDataType.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ListProperty<T> createProperty() {
  return new SimpleListProperty<T>(FXCollections.observableList(new ArrayList<T>()));
}
 
Example #18
Source File: Setting.java    From PreferencesFX with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a combobox with multiselection.
 * At least one element has to be selected at all times.
 *
 * @param description the title of this setting
 * @param items       the items which are possible to choose in the combobox, which are shown
 *                    in their {@link #toString()} representation
 * @param selections  the currently selected item(s) of the combobox to be bound, saved / loaded
 *                    and used for undo / redo
 * @param <P>         the type of objects which should be displayed in the combobox
 * @return the constructed setting
 */
public static <P> Setting of(
    String description, ObservableList<P> items, ListProperty<P> selections) {
  return new Setting<>(
      description,
      Field.ofMultiSelectionType(new SimpleListProperty<>(items), selections)
          .label(description)
          .render(new SimpleListViewControl<>()),
      selections);
}
 
Example #19
Source File: Setting.java    From PreferencesFX with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a combobox with single selection.
 *
 * @param description the title of this setting
 * @param items       the items which are possible to choose in the combobox, which are shown
 *                    in their {@link #toString()} representation
 * @param selection   the currently selected item of the combobox to be bound, saved / loaded and
 *                    used for undo / redo
 * @param <P>         the type of objects which should be displayed in the combobox
 * @return the constructed setting
 */
public static <P> Setting of(
    String description, ObservableList<P> items, ObjectProperty<P> selection) {
  return new Setting<>(
      description,
      Field.ofSingleSelectionType(new SimpleListProperty<>(items), selection)
          .label(description)
          .render(new SimpleComboBoxControl<>()),
      selection);
}
 
Example #20
Source File: RAM.java    From CPUSim with GNU General Public License v3.0 2 votes vote down vote up
/**
 * getter for the data simple list property object
 * @return the data simple list property object
 */
public SimpleListProperty dataProperty(){
    return changedData;
}