List of usage examples for javafx.event ActionEvent getSource
public Object getSource()
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXClearSubDep2PickerPane.java
public CFBamJavaFXClearSubDep2PickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamClearSubDep2Obj argFocus, ICFBamClearSubDep1Obj argContainer, Collection<ICFBamClearSubDep2Obj> argDataCollection, ICFBamJavaFXClearSubDep2Chosen whenChosen) { super();/*from www. j a v a 2 s.c om*/ final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamClearSubDep2Obj>(); tableColumnId = new TableColumn<ICFBamClearSubDep2Obj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamClearSubDep2Obj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamClearSubDep2Obj, Long> p) { ICFBamScopeObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamClearSubDep2Obj, Long>, TableCell<ICFBamClearSubDep2Obj, Long>>() { @Override public TableCell<ICFBamClearSubDep2Obj, Long> call( TableColumn<ICFBamClearSubDep2Obj, Long> arg) { return new CFInt64TableCell<ICFBamClearSubDep2Obj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamClearSubDep2Obj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamClearSubDep2Obj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamClearSubDep2Obj, String> p) { ICFBamClearSubDep2Obj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamClearSubDep2Obj, String>, TableCell<ICFBamClearSubDep2Obj, String>>() { @Override public TableCell<ICFBamClearSubDep2Obj, String> call( TableColumn<ICFBamClearSubDep2Obj, String> arg) { return new CFStringTableCell<ICFBamClearSubDep2Obj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnLookupRelation = new TableColumn<ICFBamClearSubDep2Obj, ICFBamRelationObj>("Relation"); tableColumnLookupRelation.setCellValueFactory( new Callback<CellDataFeatures<ICFBamClearSubDep2Obj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() { public ObservableValue<ICFBamRelationObj> call( CellDataFeatures<ICFBamClearSubDep2Obj, ICFBamRelationObj> p) { ICFBamClearSubDep2Obj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamRelationObj ref = obj.getRequiredLookupRelation(); ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupRelation.setCellFactory( new Callback<TableColumn<ICFBamClearSubDep2Obj, ICFBamRelationObj>, TableCell<ICFBamClearSubDep2Obj, ICFBamRelationObj>>() { @Override public TableCell<ICFBamClearSubDep2Obj, ICFBamRelationObj> call( TableColumn<ICFBamClearSubDep2Obj, ICFBamRelationObj> arg) { return new CFReferenceTableCell<ICFBamClearSubDep2Obj, ICFBamRelationObj>(); } }); dataTable.getColumns().add(tableColumnLookupRelation); tableColumnLookupDefSchema = new TableColumn<ICFBamClearSubDep2Obj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamClearSubDep2Obj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamClearSubDep2Obj, ICFBamSchemaDefObj> p) { ICFBamClearSubDep2Obj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamClearSubDep2Obj, ICFBamSchemaDefObj>, TableCell<ICFBamClearSubDep2Obj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamClearSubDep2Obj, ICFBamSchemaDefObj> call( TableColumn<ICFBamClearSubDep2Obj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamClearSubDep2Obj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<ICFBamClearSubDep2Obj>() { @Override public void changed(ObservableValue<? extends ICFBamClearSubDep2Obj> observable, ICFBamClearSubDep2Obj oldValue, ICFBamClearSubDep2Obj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseClearSubDep2(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamClearSubDep2Obj selectedInstance = getJavaFXFocusAsClearSubDep2(); invokeWhenChosen.choseClearSubDep2(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXClearSubDep3PickerPane.java
public CFBamJavaFXClearSubDep3PickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamClearSubDep3Obj argFocus, ICFBamClearSubDep2Obj argContainer, Collection<ICFBamClearSubDep3Obj> argDataCollection, ICFBamJavaFXClearSubDep3Chosen whenChosen) { super();/* ww w . ja v a2 s . c o m*/ final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamClearSubDep3Obj>(); tableColumnId = new TableColumn<ICFBamClearSubDep3Obj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamClearSubDep3Obj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamClearSubDep3Obj, Long> p) { ICFBamScopeObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamClearSubDep3Obj, Long>, TableCell<ICFBamClearSubDep3Obj, Long>>() { @Override public TableCell<ICFBamClearSubDep3Obj, Long> call( TableColumn<ICFBamClearSubDep3Obj, Long> arg) { return new CFInt64TableCell<ICFBamClearSubDep3Obj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamClearSubDep3Obj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamClearSubDep3Obj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamClearSubDep3Obj, String> p) { ICFBamClearSubDep3Obj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamClearSubDep3Obj, String>, TableCell<ICFBamClearSubDep3Obj, String>>() { @Override public TableCell<ICFBamClearSubDep3Obj, String> call( TableColumn<ICFBamClearSubDep3Obj, String> arg) { return new CFStringTableCell<ICFBamClearSubDep3Obj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnLookupRelation = new TableColumn<ICFBamClearSubDep3Obj, ICFBamRelationObj>("Relation"); tableColumnLookupRelation.setCellValueFactory( new Callback<CellDataFeatures<ICFBamClearSubDep3Obj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() { public ObservableValue<ICFBamRelationObj> call( CellDataFeatures<ICFBamClearSubDep3Obj, ICFBamRelationObj> p) { ICFBamClearSubDep3Obj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamRelationObj ref = obj.getRequiredLookupRelation(); ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupRelation.setCellFactory( new Callback<TableColumn<ICFBamClearSubDep3Obj, ICFBamRelationObj>, TableCell<ICFBamClearSubDep3Obj, ICFBamRelationObj>>() { @Override public TableCell<ICFBamClearSubDep3Obj, ICFBamRelationObj> call( TableColumn<ICFBamClearSubDep3Obj, ICFBamRelationObj> arg) { return new CFReferenceTableCell<ICFBamClearSubDep3Obj, ICFBamRelationObj>(); } }); dataTable.getColumns().add(tableColumnLookupRelation); tableColumnLookupDefSchema = new TableColumn<ICFBamClearSubDep3Obj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamClearSubDep3Obj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamClearSubDep3Obj, ICFBamSchemaDefObj> p) { ICFBamClearSubDep3Obj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamClearSubDep3Obj, ICFBamSchemaDefObj>, TableCell<ICFBamClearSubDep3Obj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamClearSubDep3Obj, ICFBamSchemaDefObj> call( TableColumn<ICFBamClearSubDep3Obj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamClearSubDep3Obj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<ICFBamClearSubDep3Obj>() { @Override public void changed(ObservableValue<? extends ICFBamClearSubDep3Obj> observable, ICFBamClearSubDep3Obj oldValue, ICFBamClearSubDep3Obj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseClearSubDep3(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamClearSubDep3Obj selectedInstance = getJavaFXFocusAsClearSubDep3(); invokeWhenChosen.choseClearSubDep3(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }
From source file:memoryaid.SetReminderController.java
@FXML private void handleBackButtonAction(ActionEvent event) throws IOException { System.out.println("You clicked back/cancel!"); Parent setReminder = FXMLLoader.load(getClass().getResource("Caregiver.fxml")); Scene set_reminder_back_scene = new Scene(setReminder); Stage app_stage = (Stage) ((Node) event.getSource()).getScene().getWindow(); app_stage.hide();//w w w.j a v a 2 s .co m app_stage.setScene(set_reminder_back_scene); app_stage.show(); }
From source file:com.bekwam.resignator.NewPasswordController.java
@FXML public void ok(ActionEvent evt) { if (logger.isDebugEnabled()) { logger.debug("[OK]"); }//from w w w. j a va 2 s. c o m String errMsg = validate(); if (StringUtils.isEmpty(errMsg)) { confirmedPassword = Optional.of(pfPassword.getText()); if (logger.isDebugEnabled()) { logger.debug("[OK] password is present?=" + (confirmedPassword.isPresent() && !StringUtils.isEmpty(confirmedPassword.get()))); } if (logger.isDebugEnabled()) { logger.debug("[OK] npc id={}", this.hashCode()); } synchronized (this) { notify(); } ((Button) evt.getSource()).getScene().getWindow().hide(); } else { lblError.setVisible(true); lblError.setText(errMsg); } }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXSchemaRefPickerPane.java
public CFBamJavaFXSchemaRefPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamSchemaRefObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamSchemaRefObj> argDataCollection, ICFBamJavaFXSchemaRefChosen whenChosen) { super();/*w w w . j av a 2 s . co m*/ final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamSchemaRefObj>(); tableColumnId = new TableColumn<ICFBamSchemaRefObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamSchemaRefObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamSchemaRefObj, Long> p) { ICFBamScopeObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamSchemaRefObj, Long>, TableCell<ICFBamSchemaRefObj, Long>>() { @Override public TableCell<ICFBamSchemaRefObj, Long> call(TableColumn<ICFBamSchemaRefObj, Long> arg) { return new CFInt64TableCell<ICFBamSchemaRefObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamSchemaRefObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamSchemaRefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamSchemaRefObj, String> p) { ICFBamSchemaRefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamSchemaRefObj, String>, TableCell<ICFBamSchemaRefObj, String>>() { @Override public TableCell<ICFBamSchemaRefObj, String> call(TableColumn<ICFBamSchemaRefObj, String> arg) { return new CFStringTableCell<ICFBamSchemaRefObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnRefModelName = new TableColumn<ICFBamSchemaRefObj, String>("Ref. Model Name"); tableColumnRefModelName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamSchemaRefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamSchemaRefObj, String> p) { ICFBamSchemaRefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredRefModelName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnRefModelName.setCellFactory( new Callback<TableColumn<ICFBamSchemaRefObj, String>, TableCell<ICFBamSchemaRefObj, String>>() { @Override public TableCell<ICFBamSchemaRefObj, String> call(TableColumn<ICFBamSchemaRefObj, String> arg) { return new CFStringTableCell<ICFBamSchemaRefObj>(); } }); dataTable.getColumns().add(tableColumnRefModelName); tableColumnIncludeRoot = new TableColumn<ICFBamSchemaRefObj, String>("Include Root"); tableColumnIncludeRoot.setCellValueFactory( new Callback<CellDataFeatures<ICFBamSchemaRefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamSchemaRefObj, String> p) { ICFBamSchemaRefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredIncludeRoot(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnIncludeRoot.setCellFactory( new Callback<TableColumn<ICFBamSchemaRefObj, String>, TableCell<ICFBamSchemaRefObj, String>>() { @Override public TableCell<ICFBamSchemaRefObj, String> call(TableColumn<ICFBamSchemaRefObj, String> arg) { return new CFStringTableCell<ICFBamSchemaRefObj>(); } }); dataTable.getColumns().add(tableColumnIncludeRoot); tableColumnLookupRefSchema = new TableColumn<ICFBamSchemaRefObj, ICFBamSchemaDefObj>("Referenced Schema"); tableColumnLookupRefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamSchemaRefObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamSchemaRefObj, ICFBamSchemaDefObj> p) { ICFBamSchemaRefObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupRefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupRefSchema.setCellFactory( new Callback<TableColumn<ICFBamSchemaRefObj, ICFBamSchemaDefObj>, TableCell<ICFBamSchemaRefObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamSchemaRefObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamSchemaRefObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamSchemaRefObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupRefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamSchemaRefObj>() { @Override public void changed(ObservableValue<? extends ICFBamSchemaRefObj> observable, ICFBamSchemaRefObj oldValue, ICFBamSchemaRefObj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseSchemaRef(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamSchemaRefObj selectedInstance = getJavaFXFocusAsSchemaRef(); invokeWhenChosen.choseSchemaRef(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }
From source file:com.bekwam.mavenpomupdater.MainViewController.java
@FXML public void showOrHideErrorLog(ActionEvent evt) { CheckMenuItem mi = (CheckMenuItem) evt.getSource(); if (mi.isSelected()) { menuBarDelegate.showErrorLog();/*from w w w. j av a2 s . com*/ } else { menuBarDelegate.hideErrorLog(); } }
From source file:com.QuarkLabs.BTCeClientJavaFX.MainController.java
/** * Reads data from Trading section, sends trade request to server * Displays error message at the Log field in case of any Exception * * @param event Source fired an event (either "Buy" or "Sell" button) *///from w w w . ja va 2s . c o m @FXML private void makeTradeRequest(final ActionEvent event) { Task<JSONObject> task = new Task<JSONObject>() { @Override protected JSONObject call() throws Exception { String type; String idOfSource = ((Button) event.getSource()).getId(); if (buyButton.getId().equals(idOfSource)) { type = "buy"; } else { type = "sell"; } String pair = tradeCurrencyType.getValue().toLowerCase() + "_" + tradePriceCurrencyType.getValue().toLowerCase(); String rate = tradePriceValue.getText(); String amount = tradeAmountValue.getText(); return app.trade(pair, type, rate, amount); } }; task.setOnSucceeded(new EventHandler<WorkerStateEvent>() { @Override public void handle(WorkerStateEvent workerStateEvent) { JSONObject jsonObject = (JSONObject) workerStateEvent.getSource().getValue(); if (jsonObject.optInt("success") == 1) { parseFundsObject(jsonObject.optJSONObject("return").optJSONObject("funds")); logField.appendText("Order ID = " + jsonObject.optJSONObject("return").optString("order_id") + " was registered successfully" + "\r\n"); } else { logField.appendText(ERROR_TITLE + jsonObject.optString("error", SOMETHING_WENT_WRONG) + "\r\n"); } } }); task.setOnFailed(new EventHandler<WorkerStateEvent>() { @Override public void handle(WorkerStateEvent workerStateEvent) { logField.appendText(workerStateEvent.getSource().getException().getMessage() + "\r\n"); } }); Thread thread = new Thread(task); thread.start(); }
From source file:org.noroomattheinn.visibletesla.MainController.java
@FXML void exportHandler(ActionEvent event) { MenuItem mi = (MenuItem) event.getSource(); if (mi == exportStatsMenuItem) { exportStats(statsColumns);//from ww w . j av a 2 s . c o m } else if (mi == exportLocMenuItem) { exportStats(locColumns); } else if (mi == exportAllMenuItem) { exportStats(VTData.schema.columnNames); } else if (mi == exportChargeMenuItem) { exportCycles("Charge"); } else if (mi == exportRestMenuItem) { exportCycles("Rest"); } else if (mi == this.vampireLossMenuItem) { showVampireLoss(); } }