List of usage examples for javafx.event EventHandler EventHandler
EventHandler
From source file:FeeBooster.java
private GridPane unsignedTxGrid(Transaction tx) { // Setup Grid GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER);/* ww w.j a v a 2s . co m*/ grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); // Instructions Text Text instructions = new Text("Below is the unsiged version of the fee boosted transaction. You can sign " + "this here or copy this transaction and sign it in your wallet"); grid.add(instructions, 0, 0); // Put unsigned transaction in text area byte[] unsignedTxBytes = Transaction.serialize(tx, true); TextArea unsignedTxTxt = new TextArea(Utils.bytesToHex(unsignedTxBytes)); unsignedTxTxt.setWrapText(true); grid.add(unsignedTxTxt, 0, 1); // Radio buttons for sign here or sign elsewhere /*VBox signRadioVbox = new VBox(); ToggleGroup signRadioGroup = new ToggleGroup(); RadioButton signHereRadio = new RadioButton("Sign Here"); signHereRadio.setToggleGroup(signRadioGroup); signRadioVbox.getChildren().add(signHereRadio); RadioButton signWalletRadio = new RadioButton("Sign in my wallet"); signWalletRadio.setToggleGroup(signRadioGroup); signWalletRadio.setSelected(true); signRadioVbox.getChildren().add(signWalletRadio); grid.add(signRadioVbox, 0, 3); */ // Add Next Button Button nextBtn = new Button("Next"); nextBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { //if(signHereRadio.isSelected()) // stage.setScene(new Scene(signTxGrid(tx), 800, 500)); //else if(signWalletRadio.isSelected()) if (sceneCursor == scenes.size() - 1) { Scene scene = new Scene(broadcastTxGrid(tx), 900, 500); scenes.add(scene); sceneCursor++; stage.setScene(scene); } else { sceneCursor++; stage.setScene(scenes.get(sceneCursor)); } } }); HBox btnHbox = new HBox(10); // Back Button Button backBtn = new Button("Back"); backBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { sceneCursor--; stage.setScene(scenes.get(sceneCursor)); } }); btnHbox.getChildren().add(backBtn); btnHbox.getChildren().add(nextBtn); // Cancel Button Button cancelBtn = new Button("Cancel"); cancelBtn.setOnAction(cancelEvent); btnHbox.getChildren().add(cancelBtn); grid.add(btnHbox, 0, 2); return grid; }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXIndexColPickerPane.java
public CFBamJavaFXIndexColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamIndexColObj argFocus, ICFBamIndexObj argContainer, Collection<ICFBamIndexColObj> argDataCollection, ICFBamJavaFXIndexColChosen whenChosen) { super();//from w w w . ja va2s. 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<ICFBamIndexColObj>(); tableColumnId = new TableColumn<ICFBamIndexColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamIndexColObj, Long> p) { ICFBamIndexColObj 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<ICFBamIndexColObj, Long>, TableCell<ICFBamIndexColObj, Long>>() { @Override public TableCell<ICFBamIndexColObj, Long> call(TableColumn<ICFBamIndexColObj, Long> arg) { return new CFInt64TableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamIndexColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) { ICFBamIndexColObj 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<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() { @Override public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) { return new CFStringTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamIndexColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() { @Override public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) { return new CFStringTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamIndexColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() { @Override public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) { return new CFStringTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamIndexColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() { @Override public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) { return new CFStringTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamIndexColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() { @Override public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) { return new CFStringTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsAscending = new TableColumn<ICFBamIndexColObj, Boolean>("IsAscending"); tableColumnIsAscending.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamIndexColObj, Boolean> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsAscending(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsAscending.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, Boolean>, TableCell<ICFBamIndexColObj, Boolean>>() { @Override public TableCell<ICFBamIndexColObj, Boolean> call(TableColumn<ICFBamIndexColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnIsAscending); tableColumnDefaultVisibility = new TableColumn<ICFBamIndexColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamIndexColObj, Boolean> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, Boolean>, TableCell<ICFBamIndexColObj, Boolean>>() { @Override public TableCell<ICFBamIndexColObj, Boolean> call(TableColumn<ICFBamIndexColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnLookupDefSchema = new TableColumn<ICFBamIndexColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamIndexColObj, ICFBamSchemaDefObj> p) { ICFBamIndexColObj 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<ICFBamIndexColObj, ICFBamSchemaDefObj>, TableCell<ICFBamIndexColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamIndexColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamIndexColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamIndexColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnLookupColumn = new TableColumn<ICFBamIndexColObj, ICFBamValueObj>("Column"); tableColumnLookupColumn.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, ICFBamValueObj>, ObservableValue<ICFBamValueObj>>() { public ObservableValue<ICFBamValueObj> call( CellDataFeatures<ICFBamIndexColObj, ICFBamValueObj> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamValueObj ref = obj.getRequiredLookupColumn(); ReadOnlyObjectWrapper<ICFBamValueObj> observable = new ReadOnlyObjectWrapper<ICFBamValueObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupColumn.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, ICFBamValueObj>, TableCell<ICFBamIndexColObj, ICFBamValueObj>>() { @Override public TableCell<ICFBamIndexColObj, ICFBamValueObj> call( TableColumn<ICFBamIndexColObj, ICFBamValueObj> arg) { return new CFReferenceTableCell<ICFBamIndexColObj, ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnLookupColumn); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamIndexColObj>() { @Override public void changed(ObservableValue<? extends ICFBamIndexColObj> observable, ICFBamIndexColObj oldValue, ICFBamIndexColObj 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.choseIndexCol(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"); } ICFBamIndexColObj selectedInstance = getJavaFXFocusAsIndexCol(); invokeWhenChosen.choseIndexCol(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.QuarkLabs.BTCeClientJavaFX.MainController.java
/** * Gets Active Orders data from server, displays error message at the Log field in case of any Exception *///from w w w .j a va 2 s .c o m @FXML private void showActiveOrders() { Task<JSONObject> task = new Task<JSONObject>() { @Override protected JSONObject call() throws Exception { try { return app.getActiveOrders(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return new JSONObject(); } }; task.setOnSucceeded(new EventHandler<WorkerStateEvent>() { @Override public void handle(WorkerStateEvent workerStateEvent) { JSONObject jsonObject = (JSONObject) workerStateEvent.getSource().getValue(); if (jsonObject.optInt("success") == 1) { JSONObject data = jsonObject.getJSONObject("return"); for (Iterator iterator = data.keys(); iterator.hasNext();) { String key = (String) iterator.next(); ActiveOrder activeOrder = new ActiveOrder(); activeOrder.setId(Long.parseLong(key)); activeOrder.setAmount(data.optJSONObject(key).optDouble("amount")); activeOrder.setRate(data.optJSONObject(key).optDouble("rate")); activeOrder.setStatus(data.optJSONObject(key).optInt("status")); activeOrder.setTimestamp(data.optJSONObject(key).optLong("timestamp_created")); activeOrder.setPair(data.optJSONObject(key).optString("pair")); activeOrder.setType(data.optJSONObject(key).optString("type")); activeOrders.add(activeOrder); } activeOrdersTable.setItems(activeOrders); } 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:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXRelationColPickerPane.java
public CFBamJavaFXRelationColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamRelationColObj argFocus, ICFBamRelationObj argContainer, Collection<ICFBamRelationColObj> argDataCollection, ICFBamJavaFXRelationColChosen whenChosen) { super();/*w w w . j av a2s . 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<ICFBamRelationColObj>(); tableColumnId = new TableColumn<ICFBamRelationColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamRelationColObj, Long> p) { ICFBamRelationColObj 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<ICFBamRelationColObj, Long>, TableCell<ICFBamRelationColObj, Long>>() { @Override public TableCell<ICFBamRelationColObj, Long> call(TableColumn<ICFBamRelationColObj, Long> arg) { return new CFInt64TableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamRelationColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) { ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() { @Override public TableCell<ICFBamRelationColObj, String> call( TableColumn<ICFBamRelationColObj, String> arg) { return new CFStringTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamRelationColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() { @Override public TableCell<ICFBamRelationColObj, String> call( TableColumn<ICFBamRelationColObj, String> arg) { return new CFStringTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamRelationColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() { @Override public TableCell<ICFBamRelationColObj, String> call( TableColumn<ICFBamRelationColObj, String> arg) { return new CFStringTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamRelationColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() { @Override public TableCell<ICFBamRelationColObj, String> call( TableColumn<ICFBamRelationColObj, String> arg) { return new CFStringTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamRelationColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() { @Override public TableCell<ICFBamRelationColObj, String> call( TableColumn<ICFBamRelationColObj, String> arg) { return new CFStringTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnDefaultVisibility = new TableColumn<ICFBamRelationColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamRelationColObj, Boolean> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, Boolean>, TableCell<ICFBamRelationColObj, Boolean>>() { @Override public TableCell<ICFBamRelationColObj, Boolean> call( TableColumn<ICFBamRelationColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnLookupDefSchema = new TableColumn<ICFBamRelationColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamRelationColObj, ICFBamSchemaDefObj> p) { ICFBamRelationColObj 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<ICFBamRelationColObj, ICFBamSchemaDefObj>, TableCell<ICFBamRelationColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamRelationColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamRelationColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnLookupFromCol = new TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>("From Column"); tableColumnLookupFromCol.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj>, ObservableValue<ICFBamIndexColObj>>() { public ObservableValue<ICFBamIndexColObj> call( CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamIndexColObj ref = obj.getRequiredLookupFromCol(); ReadOnlyObjectWrapper<ICFBamIndexColObj> observable = new ReadOnlyObjectWrapper<ICFBamIndexColObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupFromCol.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>, TableCell<ICFBamRelationColObj, ICFBamIndexColObj>>() { @Override public TableCell<ICFBamRelationColObj, ICFBamIndexColObj> call( TableColumn<ICFBamRelationColObj, ICFBamIndexColObj> arg) { return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnLookupFromCol); tableColumnLookupToCol = new TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>("To Column"); tableColumnLookupToCol.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj>, ObservableValue<ICFBamIndexColObj>>() { public ObservableValue<ICFBamIndexColObj> call( CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamIndexColObj ref = obj.getRequiredLookupToCol(); ReadOnlyObjectWrapper<ICFBamIndexColObj> observable = new ReadOnlyObjectWrapper<ICFBamIndexColObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupToCol.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>, TableCell<ICFBamRelationColObj, ICFBamIndexColObj>>() { @Override public TableCell<ICFBamRelationColObj, ICFBamIndexColObj> call( TableColumn<ICFBamRelationColObj, ICFBamIndexColObj> arg) { return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnLookupToCol); dataTable.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<ICFBamRelationColObj>() { @Override public void changed(ObservableValue<? extends ICFBamRelationColObj> observable, ICFBamRelationColObj oldValue, ICFBamRelationColObj 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.choseRelationCol(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"); } ICFBamRelationColObj selectedInstance = getJavaFXFocusAsRelationCol(); invokeWhenChosen.choseRelationCol(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.CFBamJavaFXValuePickerPane.java
public CFBamJavaFXValuePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamValueObj argFocus, ICFBamScopeObj argContainer, Collection<ICFBamValueObj> argDataCollection, ICFBamJavaFXValueChosen whenChosen) { super();//w w w. j av a 2 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<ICFBamValueObj>(); tableColumnObjKind = new TableColumn<ICFBamValueObj, String>("Class Code"); tableColumnObjKind.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String classCode = obj.getClassCode(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(classCode); return (observable); } } }); tableColumnObjKind.setCellFactory( new Callback<TableColumn<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnObjKind); tableColumnId = new TableColumn<ICFBamValueObj, Long>("Id"); tableColumnId .setCellValueFactory(new Callback<CellDataFeatures<ICFBamValueObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamValueObj, Long> p) { ICFBamValueObj 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<ICFBamValueObj, Long>, TableCell<ICFBamValueObj, Long>>() { @Override public TableCell<ICFBamValueObj, Long> call(TableColumn<ICFBamValueObj, Long> arg) { return new CFInt64TableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamValueObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj 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<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamValueObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamValueObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamValueObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamValueObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamValueObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamValueObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamValueObj, Boolean>, TableCell<ICFBamValueObj, Boolean>>() { @Override public TableCell<ICFBamValueObj, Boolean> call(TableColumn<ICFBamValueObj, Boolean> arg) { return new CFBoolTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamValueObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamValueObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamValueObj, Boolean>, TableCell<ICFBamValueObj, Boolean>>() { @Override public TableCell<ICFBamValueObj, Boolean> call(TableColumn<ICFBamValueObj, Boolean> arg) { return new CFBoolTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamValueObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamValueObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamValueObj, Boolean>, TableCell<ICFBamValueObj, Boolean>>() { @Override public TableCell<ICFBamValueObj, Boolean> call(TableColumn<ICFBamValueObj, Boolean> arg) { return new CFBoolTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnLookupDefSchema = new TableColumn<ICFBamValueObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamValueObj, ICFBamSchemaDefObj> p) { ICFBamValueObj 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<ICFBamValueObj, ICFBamSchemaDefObj>, TableCell<ICFBamValueObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamValueObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamValueObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamValueObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamValueObj>() { @Override public void changed(ObservableValue<? extends ICFBamValueObj> observable, ICFBamValueObj oldValue, ICFBamValueObj 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.choseValue(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"); } ICFBamValueObj selectedInstance = getJavaFXFocusAsValue(); invokeWhenChosen.choseValue(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.CFBamJavaFXChainPickerPane.java
public CFBamJavaFXChainPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamChainObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamChainObj> argDataCollection, ICFBamJavaFXChainChosen whenChosen) { super();//from w ww.j av 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<ICFBamChainObj>(); tableColumnId = new TableColumn<ICFBamChainObj, Long>("Id"); tableColumnId .setCellValueFactory(new Callback<CellDataFeatures<ICFBamChainObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamChainObj, Long> p) { ICFBamChainObj 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<ICFBamChainObj, Long>, TableCell<ICFBamChainObj, Long>>() { @Override public TableCell<ICFBamChainObj, Long> call(TableColumn<ICFBamChainObj, Long> arg) { return new CFInt64TableCell<ICFBamChainObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamChainObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) { ICFBamChainObj 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<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() { @Override public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) { return new CFStringTableCell<ICFBamChainObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamChainObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) { ICFBamChainObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() { @Override public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) { return new CFStringTableCell<ICFBamChainObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamChainObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) { ICFBamChainObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() { @Override public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) { return new CFStringTableCell<ICFBamChainObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamChainObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) { ICFBamChainObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() { @Override public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) { return new CFStringTableCell<ICFBamChainObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamChainObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) { ICFBamChainObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() { @Override public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) { return new CFStringTableCell<ICFBamChainObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnSuffix = new TableColumn<ICFBamChainObj, String>("Suffix"); tableColumnSuffix.setCellValueFactory( new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) { ICFBamChainObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalSuffix(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnSuffix.setCellFactory( new Callback<TableColumn<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() { @Override public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) { return new CFStringTableCell<ICFBamChainObj>(); } }); dataTable.getColumns().add(tableColumnSuffix); tableColumnDefaultVisibility = new TableColumn<ICFBamChainObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamChainObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamChainObj, Boolean> p) { ICFBamChainObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamChainObj, Boolean>, TableCell<ICFBamChainObj, Boolean>>() { @Override public TableCell<ICFBamChainObj, Boolean> call(TableColumn<ICFBamChainObj, Boolean> arg) { return new CFBoolTableCell<ICFBamChainObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnLookupDefSchema = new TableColumn<ICFBamChainObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamChainObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamChainObj, ICFBamSchemaDefObj> p) { ICFBamChainObj 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<ICFBamChainObj, ICFBamSchemaDefObj>, TableCell<ICFBamChainObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamChainObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamChainObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamChainObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnLookupPrevRel = new TableColumn<ICFBamChainObj, ICFBamRelationObj>("Previous Relation"); tableColumnLookupPrevRel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamChainObj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() { public ObservableValue<ICFBamRelationObj> call( CellDataFeatures<ICFBamChainObj, ICFBamRelationObj> p) { ICFBamChainObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamRelationObj ref = obj.getRequiredLookupPrevRel(); ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupPrevRel.setCellFactory( new Callback<TableColumn<ICFBamChainObj, ICFBamRelationObj>, TableCell<ICFBamChainObj, ICFBamRelationObj>>() { @Override public TableCell<ICFBamChainObj, ICFBamRelationObj> call( TableColumn<ICFBamChainObj, ICFBamRelationObj> arg) { return new CFReferenceTableCell<ICFBamChainObj, ICFBamRelationObj>(); } }); dataTable.getColumns().add(tableColumnLookupPrevRel); tableColumnLookupNextRel = new TableColumn<ICFBamChainObj, ICFBamRelationObj>("Next Relation"); tableColumnLookupNextRel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamChainObj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() { public ObservableValue<ICFBamRelationObj> call( CellDataFeatures<ICFBamChainObj, ICFBamRelationObj> p) { ICFBamChainObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamRelationObj ref = obj.getRequiredLookupNextRel(); ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupNextRel.setCellFactory( new Callback<TableColumn<ICFBamChainObj, ICFBamRelationObj>, TableCell<ICFBamChainObj, ICFBamRelationObj>>() { @Override public TableCell<ICFBamChainObj, ICFBamRelationObj> call( TableColumn<ICFBamChainObj, ICFBamRelationObj> arg) { return new CFReferenceTableCell<ICFBamChainObj, ICFBamRelationObj>(); } }); dataTable.getColumns().add(tableColumnLookupNextRel); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamChainObj>() { @Override public void changed(ObservableValue<? extends ICFBamChainObj> observable, ICFBamChainObj oldValue, ICFBamChainObj 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.choseChain(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"); } ICFBamChainObj selectedInstance = getJavaFXFocusAsChain(); invokeWhenChosen.choseChain(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:Main.java
private VBox getTransformationControls() { xSlider.setShowTickMarks(true);/*from ww w . j a v a 2s. c o m*/ xSlider.setShowTickLabels(true); xSlider.snapToTicksProperty().set(true); ySlider.setShowTickMarks(true); ySlider.setShowTickLabels(true); ySlider.snapToTicksProperty().set(true); widthSlider.setShowTickMarks(true); widthSlider.setShowTickLabels(true); widthSlider.snapToTicksProperty().set(true); heightSlider.setShowTickMarks(true); heightSlider.setShowTickLabels(true); heightSlider.snapToTicksProperty().set(true); opacitySlider.setShowTickMarks(true); opacitySlider.setShowTickLabels(true); opacitySlider.snapToTicksProperty().set(true); opacitySlider.setMinorTickCount(5); opacitySlider.setMajorTickUnit(0.20d); strokeSlider.setShowTickMarks(true); strokeSlider.setShowTickLabels(true); strokeSlider.snapToTicksProperty().set(true); strokeSlider.setMinorTickCount(5); strokeSlider.setMajorTickUnit(1.0d); translateXSlider.setShowTickMarks(true); translateXSlider.setShowTickLabels(true); translateXSlider.snapToTicksProperty().set(true); translateYSlider.setShowTickMarks(true); translateYSlider.setShowTickLabels(true); translateYSlider.snapToTicksProperty().set(true); rotateSlider.setShowTickMarks(true); rotateSlider.setShowTickLabels(true); rotateSlider.snapToTicksProperty().set(true); rotateSlider.setMinorTickCount(5); rotateSlider.setMajorTickUnit(30.0); scaleXSlider.setShowTickMarks(true); scaleXSlider.setShowTickLabels(true); scaleXSlider.setMajorTickUnit(0.2d); scaleXSlider.setLabelFormatter(new DoubleStringConverter()); scaleXSlider.snapToTicksProperty().set(true); scaleYSlider.setShowTickMarks(true); scaleYSlider.setShowTickLabels(true); scaleYSlider.setMajorTickUnit(0.2d); scaleYSlider.setLabelFormatter(new DoubleStringConverter()); scaleYSlider.snapToTicksProperty().set(true); shearXSlider.setShowTickMarks(true); shearXSlider.setShowTickLabels(true); shearXSlider.setMajorTickUnit(0.2d); shearXSlider.setLabelFormatter(new DoubleStringConverter()); shearXSlider.snapToTicksProperty().set(true); shearYSlider.setShowTickMarks(true); shearYSlider.setShowTickLabels(true); shearYSlider.setMajorTickUnit(0.2d); shearYSlider.setLabelFormatter(new DoubleStringConverter()); shearYSlider.snapToTicksProperty().set(true); HBox xyBox = new HBox(); xyBox.setSpacing(5); xyBox.getChildren().addAll(VBoxBuilder.create().children(xLabel, xSlider).build(), VBoxBuilder.create().children(yLabel, ySlider).build()); HBox whBox = new HBox(); whBox.setSpacing(5); whBox.getChildren().addAll(VBoxBuilder.create().children(widthLabel, widthSlider).build(), VBoxBuilder.create().children(heightLabel, heightSlider).build()); HBox colorBox = new HBox(); colorBox.setSpacing(5); colorBox.getChildren().addAll(VBoxBuilder.create().children(strokeLabel, strokeSlider).build(), VBoxBuilder.create().children(new Label("Stroke Color"), rectStrokeColorChoiceBox).build()); HBox opacityBox = new HBox(); opacityBox.setSpacing(5); opacityBox.getChildren().addAll(VBoxBuilder.create().children(opacityLabel, opacitySlider).build(), VBoxBuilder.create().children(new Label("Fill Color"), rectFillColorChoiceBox).build()); HBox translateBox = new HBox(); translateBox.setSpacing(5); translateBox.getChildren().addAll(VBoxBuilder.create().children(translateXLabel, translateXSlider).build(), VBoxBuilder.create().children(translateYLabel, translateYSlider).build()); HBox rotateBox = new HBox(); rotateBox.setSpacing(5); rotateBox.getChildren().addAll(VBoxBuilder.create().children(rotateLabel, rotateSlider).build()); HBox scaleBox = new HBox(); scaleBox.setSpacing(5); scaleBox.getChildren().addAll(VBoxBuilder.create().children(scaleXLabel, scaleXSlider).build(), VBoxBuilder.create().children(scaleYLabel, scaleYSlider).build()); HBox shearBox = new HBox(); shearBox.setSpacing(5); shearBox.getChildren().addAll(VBoxBuilder.create().children(shearXLabel, shearXSlider).build(), VBoxBuilder.create().children(shearYLabel, shearYSlider).build()); VBox rectangleBox = new VBox(); rectangleBox.getChildren().addAll(xyBox, whBox, colorBox, opacityBox); TitledPane rectangleProps = new TitledPane("Rectangle", rectangleBox); VBox transformBox = new VBox(); transformBox.getChildren().addAll(translateBox, rotateBox, scaleBox, shearBox); TitledPane transformsProps = new TitledPane("Tranformations", transformBox); TitledPane showBoundsControls = getShowBoundsControls(); TitledPane effectPane = getEffectTitledPane(); Button resetAllButton = new Button("Reset All"); resetAllButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { resetAll(); } }); Button saveButton = new Button("Save Layout as Image"); saveButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { saveLayoutAsImage(); } }); Button exitButton = new Button("Exit"); exitButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { Platform.exit(); } }); /* Button printButton = new Button("Print"); printButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { String str = getDesc("layoutBounds", mainRect.getLayoutBounds()) + getDesc("\nboundsInLocal", mainRect.getBoundsInLocal()) + getDesc("\nboundsInParent", mainRect.getBoundsInParent()); //printDataTextArea.setText(str); } private String getDesc(String type, Bounds b) { String str = type + "[minX=" + b.getMinX() + ", minY=" + b.getMinY() + ", width=" + b.getWidth() + ", height=" + b.getHeight() + "]"; return str; } }); */ HBox buttonBox = new HBox(); buttonBox.setSpacing(10); buttonBox.getChildren().addAll(resetAllButton, saveButton, exitButton); VBox vBox = new VBox(); vBox.getChildren().addAll(buttonBox, showBoundsControls, rectangleProps, effectPane, transformsProps); return vBox; }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXParamListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); buttonAddParam = new CFButton(); buttonAddParam.setMinWidth(200); buttonAddParam.setText("Add Param"); buttonAddParam.setOnAction(new EventHandler<ActionEvent>() { @Override// w w w.j a v a 2 s. com public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamParamObj obj = (ICFBamParamObj) schemaObj.getParamTableObj().newInstance(); ICFBamParamEditObj edit = (ICFBamParamEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamServerMethodObj container = (ICFBamServerMethodObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerServerMeth(container); CFBorderPane frame = javafxSchema.getParamFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamJavaFXParamPaneCommon jpanelCommon = (ICFBamJavaFXParamPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAddParam); buttonMoveUpSelected = new CFButton(); buttonMoveUpSelected.setMinWidth(200); buttonMoveUpSelected.setText("Move Up Selected"); buttonMoveUpSelected.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"); } ICFBamParamObj selectedInstance = getJavaFXFocusAsParam(); if (selectedInstance != null) { if (null != selectedInstance.getOptionalLookupPrev()) { selectedInstance.moveUp(); refreshMe(); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonMoveUpSelected); buttonMoveDownSelected = new CFButton(); buttonMoveDownSelected.setMinWidth(200); buttonMoveDownSelected.setText("Move Down Selected"); buttonMoveDownSelected.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"); } ICFBamParamObj selectedInstance = getJavaFXFocusAsParam(); if (selectedInstance != null) { if (null != selectedInstance.getOptionalLookupNext()) { selectedInstance.moveDown(); refreshMe(); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonMoveDownSelected); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.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"); } ICFBamParamObj selectedInstance = getJavaFXFocusAsParam(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("SPRM".equals(classCode)) { CFBorderPane frame = javafxSchema.getParamFactory().newViewEditForm(cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXParamPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamParamObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.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"); } ICFBamParamObj selectedInstance = getJavaFXFocusAsParam(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("SPRM".equals(classCode)) { CFBorderPane frame = javafxSchema.getParamFactory().newViewEditForm(cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXParamPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamParamObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.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"); } ICFBamParamObj selectedInstance = getJavaFXFocusAsParam(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("SPRM".equals(classCode)) { CFBorderPane frame = javafxSchema.getParamFactory().newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXParamPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamParamObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXAtomPickerPane.java
public CFBamJavaFXAtomPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamAtomObj argFocus, ICFBamScopeObj argContainer, Collection<ICFBamAtomObj> argDataCollection, ICFBamJavaFXAtomChosen whenChosen) { super();/*from www. j a 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<ICFBamAtomObj>(); tableColumnObjKind = new TableColumn<ICFBamAtomObj, String>("Class Code"); tableColumnObjKind.setCellValueFactory( new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String classCode = obj.getClassCode(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(classCode); return (observable); } } }); tableColumnObjKind.setCellFactory( new Callback<TableColumn<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() { @Override public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) { return new CFStringTableCell<ICFBamAtomObj>(); } }); dataTable.getColumns().add(tableColumnObjKind); tableColumnId = new TableColumn<ICFBamAtomObj, Long>("Id"); tableColumnId .setCellValueFactory(new Callback<CellDataFeatures<ICFBamAtomObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamAtomObj, Long> p) { ICFBamValueObj 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<ICFBamAtomObj, Long>, TableCell<ICFBamAtomObj, Long>>() { @Override public TableCell<ICFBamAtomObj, Long> call(TableColumn<ICFBamAtomObj, Long> arg) { return new CFInt64TableCell<ICFBamAtomObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamAtomObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, String> p) { ICFBamValueObj 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<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() { @Override public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) { return new CFStringTableCell<ICFBamAtomObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamAtomObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() { @Override public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) { return new CFStringTableCell<ICFBamAtomObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamAtomObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() { @Override public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) { return new CFStringTableCell<ICFBamAtomObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamAtomObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() { @Override public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) { return new CFStringTableCell<ICFBamAtomObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamAtomObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() { @Override public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) { return new CFStringTableCell<ICFBamAtomObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamAtomObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamAtomObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamAtomObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamAtomObj, Boolean>, TableCell<ICFBamAtomObj, Boolean>>() { @Override public TableCell<ICFBamAtomObj, Boolean> call(TableColumn<ICFBamAtomObj, Boolean> arg) { return new CFBoolTableCell<ICFBamAtomObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamAtomObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamAtomObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamAtomObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamAtomObj, Boolean>, TableCell<ICFBamAtomObj, Boolean>>() { @Override public TableCell<ICFBamAtomObj, Boolean> call(TableColumn<ICFBamAtomObj, Boolean> arg) { return new CFBoolTableCell<ICFBamAtomObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamAtomObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamAtomObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamAtomObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamAtomObj, Boolean>, TableCell<ICFBamAtomObj, Boolean>>() { @Override public TableCell<ICFBamAtomObj, Boolean> call(TableColumn<ICFBamAtomObj, Boolean> arg) { return new CFBoolTableCell<ICFBamAtomObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamAtomObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() { @Override public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) { return new CFStringTableCell<ICFBamAtomObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnLookupDefSchema = new TableColumn<ICFBamAtomObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamAtomObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamAtomObj, ICFBamSchemaDefObj> p) { ICFBamAtomObj 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<ICFBamAtomObj, ICFBamSchemaDefObj>, TableCell<ICFBamAtomObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamAtomObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamAtomObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamAtomObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamAtomObj>() { @Override public void changed(ObservableValue<? extends ICFBamAtomObj> observable, ICFBamAtomObj oldValue, ICFBamAtomObj 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.choseAtom(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"); } ICFBamAtomObj selectedInstance = getJavaFXFocusAsAtom(); invokeWhenChosen.choseAtom(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:FeeBooster.java
private GridPane broadcastTxGrid(Transaction tx) { // Setup Grid GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER);/*w w w. j av a 2 s .c o m*/ grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); // Instructions Text Text instructions = new Text("Enter your signed transaction into the space below."); grid.add(instructions, 0, 0); // Put signed transaction in text area TextArea signedTxTxt = new TextArea(); signedTxTxt.setWrapText(true); grid.add(signedTxTxt, 0, 1); // Display some info about Transaction after sent Text txInfo = new Text(); grid.add(txInfo, 0, 4); // Add Next Button Button nextBtn = new Button("Send Transaction"); nextBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Transaction signedTx = new Transaction(); Transaction.deserializeStr(signedTxTxt.getText(), signedTx); txInfo.setText("Transaction being broadcast. TXID: " + signedTx.getHash() + "\nPlease wait a few minutes for best results, but you may now exit."); Broadcaster.broadcastTransaction(Transaction.serialize(signedTx, false)); } }); HBox btnHbox = new HBox(10); // Back Button Button backBtn = new Button("Back"); backBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { sceneCursor--; stage.setScene(scenes.get(sceneCursor)); } }); btnHbox.getChildren().add(backBtn); btnHbox.getChildren().add(nextBtn); // Cancel Button Button cancelBtn = new Button("Exit"); cancelBtn.setOnAction(cancelEvent); btnHbox.getChildren().add(cancelBtn); grid.add(btnHbox, 0, 2); return grid; }