use of javafx.beans.property.BooleanProperty in project SmartCity-Market by TechnionYP5777.
the class ManageCatalogProductDetailsTab method initialize.
@Override
public void initialize(URL location, ResourceBundle __) {
createManufacturerList();
createIngredientList();
filterManu.textProperty().addListener(obs -> {
String filter = filterManu.getText();
filteredDataManu.setPredicate(filter == null || filter.length() == 0 ? s -> true : s -> s.contains(filter));
});
manufacturerList.setCellFactory(CheckBoxListCell.forListView(new Callback<String, ObservableValue<Boolean>>() {
@Override
public ObservableValue<Boolean> call(String item) {
BooleanProperty observable = new SimpleBooleanProperty();
observable.set(selectedManu.contains(item));
observable.addListener((obs, wasSelected, isNowSelected) -> {
if (isNowSelected)
selectedManu.add(item);
else
selectedManu.remove(item);
enableButtons();
});
return observable;
}
}));
filterIngr.textProperty().addListener(obs -> {
String filter = filterIngr.getText();
filteredDataIngr.setPredicate(filter == null || filter.length() == 0 ? s -> true : s -> s.contains(filter));
});
ingredientsList.setCellFactory(CheckBoxListCell.forListView(new Callback<String, ObservableValue<Boolean>>() {
@Override
public ObservableValue<Boolean> call(String item) {
BooleanProperty observable = new SimpleBooleanProperty();
observable.set(selectedIngr.contains(item));
observable.addListener((obs, wasSelected, isNowSelected) -> {
if (isNowSelected)
selectedIngr.add(item);
else
selectedIngr.remove(item);
enableButtons();
});
return observable;
}
}));
Label lbl1 = new Label("Insert New Manufacturar");
newManu = new JFXTextField();
okNewManu = new JFXButton("Done!");
okNewManu.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
addManuPressed();
}
});
VBox manuContainer = new VBox();
manuContainer.getChildren().addAll(lbl1, newManu, okNewManu);
manuContainer.setPadding(new Insets(10, 50, 50, 50));
manuContainer.setSpacing(10);
JFXPopup popup1 = new JFXPopup(manuContainer);
addManuBtn.setOnMouseClicked(e -> popup1.show(addManuBtn, PopupVPosition.TOP, PopupHPosition.LEFT));
newManu.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
Label lbl2 = new Label("Insert New Ingredient");
newIngr = new JFXTextField();
okNewIngr = new JFXButton("Done!");
okNewIngr.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
addIngPressed();
}
});
VBox ingrContainer = new VBox();
ingrContainer.getChildren().addAll(lbl2, newIngr, okNewIngr);
ingrContainer.setPadding(new Insets(10, 50, 50, 50));
ingrContainer.setSpacing(10);
JFXPopup popup2 = new JFXPopup(ingrContainer);
addIngrBtn.setOnMouseClicked(e -> popup2.show(addIngrBtn, PopupVPosition.TOP, PopupHPosition.LEFT));
newIngr.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
Label lbl3 = new Label("Rename Selected Manufacturar");
renameManuLbl = new JFXTextField();
okRenameManu = new JFXButton("Done!");
okRenameManu.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
renameManuPressed();
}
});
VBox renameManuContainer = new VBox();
renameManuContainer.getChildren().addAll(lbl3, renameManuLbl, okRenameManu);
renameManuContainer.setPadding(new Insets(10, 50, 50, 50));
renameManuContainer.setSpacing(10);
JFXPopup popup3 = new JFXPopup(renameManuContainer);
renameManu.setOnMouseClicked(e -> popup3.show(renameManu, PopupVPosition.TOP, PopupHPosition.LEFT));
renameManuLbl.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
Label lbl4 = new Label("Rename Selected Ingredient");
renameIngrLbl = new JFXTextField();
okRenameIngr = new JFXButton("Done!");
okRenameIngr.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent __) {
renameIngrPressed();
}
});
VBox renameIngrContainer = new VBox();
renameIngrContainer.getChildren().addAll(lbl4, renameIngrLbl, okRenameIngr);
renameIngrContainer.setPadding(new Insets(10, 50, 50, 50));
renameIngrContainer.setSpacing(10);
JFXPopup popup4 = new JFXPopup(renameIngrContainer);
renameIngr.setOnMouseClicked(e -> popup4.show(renameIngr, PopupVPosition.TOP, PopupHPosition.LEFT));
renameIngrLbl.textProperty().addListener((observable, oldValue, newValue) -> enableAddButtons());
enableButtons();
enableAddButtons();
}
use of javafx.beans.property.BooleanProperty in project SmartCity-Market by TechnionYP5777.
the class ManageEmployeesTab method initialize.
@Override
public void initialize(URL location, ResourceBundle __) {
userTxt.textProperty().addListener((observable, oldValue, newValue) -> enableFinishBtn());
passTxt.textProperty().addListener((observable, oldValue, newValue) -> enableFinishBtn());
securityAnswerTxt.textProperty().addListener((observable, oldValue, newValue) -> enableFinishBtn());
radioBtnCont.addRadioButtons(Arrays.asList(new RadioButton[] { workerRadioBtn, managerRadioBtn }));
securityCombo.getItems().addAll(SecurityQuestions.getQuestions());
RequiredFieldValidator validator2 = new RequiredFieldValidator();
validator2.setMessage("Input Required");
validator2.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING).size("1em").styleClass("error").build());
userTxt.getValidators().add(validator2);
userTxt.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal)
userTxt.validate();
});
RequiredFieldValidator validator3 = new RequiredFieldValidator();
validator3.setMessage("Input Required");
validator3.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING).size("1em").styleClass("error").build());
passTxt.getValidators().add(validator3);
passTxt.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal)
passTxt.validate();
});
RequiredFieldValidator validator4 = new RequiredFieldValidator();
validator4.setMessage("Input Required");
validator4.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING).size("1em").styleClass("error").build());
securityAnswerTxt.getValidators().add(validator4);
securityAnswerTxt.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal)
securityAnswerTxt.validate();
});
createEmployeesList();
searchEmployee.textProperty().addListener(obs -> {
String filter = searchEmployee.getText();
filteredDataEmployees.setPredicate(filter == null || filter.length() == 0 ? s -> true : s -> s.contains(filter));
});
employeesList.setCellFactory(CheckBoxListCell.forListView(new Callback<String, ObservableValue<Boolean>>() {
@Override
public ObservableValue<Boolean> call(String item) {
BooleanProperty observable = new SimpleBooleanProperty();
observable.set(selectedEmployees.contains(item));
observable.addListener((obs, wasSelected, isNowSelected) -> {
if (isNowSelected)
selectedEmployees.add(item);
else
selectedEmployees.remove(item);
enableRemoveButton();
});
return observable;
}
}));
securityCombo.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> __, String oldValue, String newValue) {
enableFinishBtn();
}
});
enableFinishBtn();
enableRemoveButton();
}
use of javafx.beans.property.BooleanProperty in project jabref by JabRef.
the class BindingsHelper method includePseudoClassWhen.
public static void includePseudoClassWhen(Node node, PseudoClass pseudoClass, ObservableValue<? extends Boolean> condition) {
BooleanProperty pseudoClassState = new BooleanPropertyBase(false) {
@Override
protected void invalidated() {
node.pseudoClassStateChanged(pseudoClass, get());
}
@Override
public Object getBean() {
return node;
}
@Override
public String getName() {
return pseudoClass.getPseudoClassName();
}
};
pseudoClassState.bind(condition);
}
use of javafx.beans.property.BooleanProperty in project bitsquare by bitsquare.
the class TorNetworkNode method shutDownTimerTriggered.
private BooleanProperty shutDownTimerTriggered() {
final BooleanProperty done = new SimpleBooleanProperty();
shutDownTimeoutTimer = UserThread.runAfter(() -> {
log.error("A timeout occurred at shutDown");
done.set(true);
}, SHUT_DOWN_TIMEOUT_SEC);
return done;
}
use of javafx.beans.property.BooleanProperty in project Gargoyle by callakrsos.
the class CrudBaseColumnMapper method generateTableColumns.
/**
* 컬럼 제너레이터
*
* @Date 2015. 10. 8.
* @param classType
* @return
* @User KYJ
*/
@Override
public TableColumn<T, ?> generateTableColumns(Class<?> classType, String columnName, IOptions options) {
TableColumn tableColumn = null;
// 2015.11.18 커스텀 컬럼값을 정의한경우 대체.
TableColumn<T, ?> customTableColumn = options.customTableColumn(columnName);
if (customTableColumn != null) {
tableColumn = customTableColumn;
PropertyValueFactory<T, ?> value = new PropertyValueFactory<>(columnName);
tableColumn.setCellValueFactory(value);
} else // [시작] 베이스 컬럼
{
tableColumn = new TableColumn<>();
BooleanProperty editableProperty = tableColumn.editableProperty();
CommboInfo<?> comboBox = options.comboBox(columnName);
if (comboBox == null) {
tableColumn.setCellFactory(column -> {
if (classType == BooleanProperty.class && options.useCommonCheckBox()) {
return checkBox((TableColumn<T, ?>) column);
} else {
TextFieldTableCell<T, Object> textField = textField(classType, columnName, options);
textField.editableProperty().bind(editableProperty);
textField.disableProperty().bind(editableProperty.not());
return textField;
}
});
PropertyValueFactory<T, ?> value = new PropertyValueFactory<>(columnName);
tableColumn.setCellValueFactory(value);
} else {
tableColumn = commboBox(classType, columnName, options);
}
tableColumn.setResizable(true);
// 무조건 true로 지정. 대신 cell에 편집가능 수준정보 조절함.
tableColumn.setEditable(true);
}
// 헤더 텍스트
if (CommonConst.COMMONS_FILEDS_COMMONS_CLICKED.equals(columnName)) {
tableColumn.setText("");
} else {
String headerName = options.convert(columnName);
tableColumn.setText(headerName);
}
tableColumn.setStyle(options.style(columnName));
// 기타 속성지정
setColumnProperty(tableColumn, columnName, options);
tableColumn.setId(columnName);
//보임속성 추가.
tableColumn.setVisible(options.visible(columnName));
return tableColumn;
}
Aggregations