List of usage examples for javafx.event EventHandler EventHandler
EventHandler
From source file:com.rockhoppertech.symchords.fx.SymChordsController.java
protected void setupDragonDrop() { Image image = new Image(getClass().getResourceAsStream("/images/rocky-32-trans.png")); dragImageView = new ImageView(image); dragImageView.setFitHeight(32);// w w w.java 2 s. c om dragImageView.setFitWidth(32); grandStaff.setOnDragDetected(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent me) { if (!root.getChildren().contains(dragImageView)) { root.getChildren().add(dragImageView); } // dragImageView.setOpacity(0.5); dragImageView.toFront(); dragImageView.setMouseTransparent(true); dragImageView.setVisible(true); dragImageView.relocate((int) (me.getSceneX() - dragImageView.getBoundsInLocal().getWidth() / 2), (int) (me.getSceneY() - dragImageView.getBoundsInLocal().getHeight() / 2)); Dragboard db = grandStaff.startDragAndDrop(TransferMode.ANY); // TODO remove the custom image nonsense in javafx 8 // javafx 8 // db.setDragView(dragImageView); ClipboardContent content = new ClipboardContent(); // MIDITrack track = grandStaff.getMIDITrack(); MIDITrack track = model.getMIDITrack(); content.put(midiTrackDataFormat, track); db.setContent(content); me.consume(); } }); grandStaff.setOnDragDone(new EventHandler<DragEvent>() { public void handle(DragEvent e) { dragImageView.setVisible(false); e.consume(); } }); // Parent root = grandStaff.getScene().getRoot(); // stage.getScene().getRoot(); if (root != null) { root.setOnDragOver(new EventHandler<DragEvent>() { public void handle(DragEvent e) { Point2D localPoint = grandStaff.getScene().getRoot() .sceneToLocal(new Point2D(e.getSceneX(), e.getSceneY())); dragImageView.relocate( (int) (localPoint.getX() - dragImageView.getBoundsInLocal().getWidth() / 2), (int) (localPoint.getY() - dragImageView.getBoundsInLocal().getHeight() / 2)); e.consume(); } }); } trackList.setOnDragOver(new EventHandler<DragEvent>() { public void handle(DragEvent event) { /* * data is dragged over the target; accept it only if it is not * dragged from the same node and if it has MIDITrack data */ if (event.getGestureSource() != trackList && event.getDragboard().hasContent(midiTrackDataFormat)) { logger.debug("drag over"); /* allow for both copying and moving, whatever user chooses */ event.acceptTransferModes(TransferMode.COPY_OR_MOVE); } // Don't consume the event. Let the layers below process the // DragOver event as well so that the // translucent container image will follow the cursor. // event.consume(); } }); trackList.setOnDragEntered(new EventHandler<DragEvent>() { public void handle(DragEvent event) { /* the drag-and-drop gesture entered the target */ /* show to the user that it is an actual gesture target */ logger.debug("drag entered"); if (event.getGestureSource() != trackList && event.getDragboard().hasContent(midiTrackDataFormat)) { DropShadow dropShadow = new DropShadow(); dropShadow.setRadius(5.0); dropShadow.setOffsetX(3.0); dropShadow.setOffsetY(3.0); dropShadow.setColor(Color.color(0.4, 0.5, 0.5)); trackList.setEffect(dropShadow); } event.consume(); } }); trackList.setOnDragExited(new EventHandler<DragEvent>() { public void handle(DragEvent event) { /* mouse moved away, remove the graphical cues */ trackList.setEffect(null); event.consume(); } }); trackList.setOnDragDropped(new EventHandler<DragEvent>() { public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasContent(midiTrackDataFormat)) { MIDITrack track = (MIDITrack) db.getContent(midiTrackDataFormat); trackList.getItems().add(track); success = true; } /* * let the source know whether the data was successfully * transferred and used */ event.setDropCompleted(success); event.consume(); } }); logger.debug("jvm mime {}", DataFlavor.javaJVMLocalObjectMimeType); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXServerListFuncPickerPane.java
public CFBamJavaFXServerListFuncPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamServerListFuncObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamServerListFuncObj> argDataCollection, ICFBamJavaFXServerListFuncChosen whenChosen) { super();/*from w ww .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<ICFBamServerListFuncObj>(); tableColumnId = new TableColumn<ICFBamServerListFuncObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamServerListFuncObj, 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<ICFBamServerListFuncObj, Long>, TableCell<ICFBamServerListFuncObj, Long>>() { @Override public TableCell<ICFBamServerListFuncObj, Long> call( TableColumn<ICFBamServerListFuncObj, Long> arg) { return new CFInt64TableCell<ICFBamServerListFuncObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamServerListFuncObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamServerListFuncObj, String> p) { ICFBamServerMethodObj 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<ICFBamServerListFuncObj, String>, TableCell<ICFBamServerListFuncObj, String>>() { @Override public TableCell<ICFBamServerListFuncObj, String> call( TableColumn<ICFBamServerListFuncObj, String> arg) { return new CFStringTableCell<ICFBamServerListFuncObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamServerListFuncObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamServerListFuncObj, String> p) { ICFBamServerMethodObj 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<ICFBamServerListFuncObj, String>, TableCell<ICFBamServerListFuncObj, String>>() { @Override public TableCell<ICFBamServerListFuncObj, String> call( TableColumn<ICFBamServerListFuncObj, String> arg) { return new CFStringTableCell<ICFBamServerListFuncObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamServerListFuncObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamServerListFuncObj, String> p) { ICFBamServerMethodObj 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<ICFBamServerListFuncObj, String>, TableCell<ICFBamServerListFuncObj, String>>() { @Override public TableCell<ICFBamServerListFuncObj, String> call( TableColumn<ICFBamServerListFuncObj, String> arg) { return new CFStringTableCell<ICFBamServerListFuncObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamServerListFuncObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamServerListFuncObj, String> p) { ICFBamServerMethodObj 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<ICFBamServerListFuncObj, String>, TableCell<ICFBamServerListFuncObj, String>>() { @Override public TableCell<ICFBamServerListFuncObj, String> call( TableColumn<ICFBamServerListFuncObj, String> arg) { return new CFStringTableCell<ICFBamServerListFuncObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamServerListFuncObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamServerListFuncObj, String> p) { ICFBamServerMethodObj 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<ICFBamServerListFuncObj, String>, TableCell<ICFBamServerListFuncObj, String>>() { @Override public TableCell<ICFBamServerListFuncObj, String> call( TableColumn<ICFBamServerListFuncObj, String> arg) { return new CFStringTableCell<ICFBamServerListFuncObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnSuffix = new TableColumn<ICFBamServerListFuncObj, String>("Suffix"); tableColumnSuffix.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamServerListFuncObj, String> p) { ICFBamServerMethodObj 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<ICFBamServerListFuncObj, String>, TableCell<ICFBamServerListFuncObj, String>>() { @Override public TableCell<ICFBamServerListFuncObj, String> call( TableColumn<ICFBamServerListFuncObj, String> arg) { return new CFStringTableCell<ICFBamServerListFuncObj>(); } }); dataTable.getColumns().add(tableColumnSuffix); tableColumnDefaultVisibility = new TableColumn<ICFBamServerListFuncObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamServerListFuncObj, Boolean> p) { ICFBamServerMethodObj 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<ICFBamServerListFuncObj, Boolean>, TableCell<ICFBamServerListFuncObj, Boolean>>() { @Override public TableCell<ICFBamServerListFuncObj, Boolean> call( TableColumn<ICFBamServerListFuncObj, Boolean> arg) { return new CFBoolTableCell<ICFBamServerListFuncObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnIsInstanceMethod = new TableColumn<ICFBamServerListFuncObj, Boolean>("Is Instance Method"); tableColumnIsInstanceMethod.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamServerListFuncObj, Boolean> p) { ICFBamServerMethodObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsInstanceMethod(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsInstanceMethod.setCellFactory( new Callback<TableColumn<ICFBamServerListFuncObj, Boolean>, TableCell<ICFBamServerListFuncObj, Boolean>>() { @Override public TableCell<ICFBamServerListFuncObj, Boolean> call( TableColumn<ICFBamServerListFuncObj, Boolean> arg) { return new CFBoolTableCell<ICFBamServerListFuncObj>(); } }); dataTable.getColumns().add(tableColumnIsInstanceMethod); tableColumnJMethodBody = new TableColumn<ICFBamServerListFuncObj, String>("Java Method Body"); tableColumnJMethodBody.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamServerListFuncObj, String> p) { ICFBamServerMethodObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredJMethodBody(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnJMethodBody.setCellFactory( new Callback<TableColumn<ICFBamServerListFuncObj, String>, TableCell<ICFBamServerListFuncObj, String>>() { @Override public TableCell<ICFBamServerListFuncObj, String> call( TableColumn<ICFBamServerListFuncObj, String> arg) { return new CFTextTableCell<ICFBamServerListFuncObj>(); } }); dataTable.getColumns().add(tableColumnJMethodBody); tableColumnLookupDefSchema = new TableColumn<ICFBamServerListFuncObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamServerListFuncObj, ICFBamSchemaDefObj> p) { ICFBamServerListFuncObj 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<ICFBamServerListFuncObj, ICFBamSchemaDefObj>, TableCell<ICFBamServerListFuncObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamServerListFuncObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamServerListFuncObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamServerListFuncObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnLookupRetTable = new TableColumn<ICFBamServerListFuncObj, ICFBamTableObj>("Ret Table"); tableColumnLookupRetTable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamServerListFuncObj, ICFBamTableObj>, ObservableValue<ICFBamTableObj>>() { public ObservableValue<ICFBamTableObj> call( CellDataFeatures<ICFBamServerListFuncObj, ICFBamTableObj> p) { ICFBamServerListFuncObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamTableObj ref = obj.getOptionalLookupRetTable(); ReadOnlyObjectWrapper<ICFBamTableObj> observable = new ReadOnlyObjectWrapper<ICFBamTableObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupRetTable.setCellFactory( new Callback<TableColumn<ICFBamServerListFuncObj, ICFBamTableObj>, TableCell<ICFBamServerListFuncObj, ICFBamTableObj>>() { @Override public TableCell<ICFBamServerListFuncObj, ICFBamTableObj> call( TableColumn<ICFBamServerListFuncObj, ICFBamTableObj> arg) { return new CFReferenceTableCell<ICFBamServerListFuncObj, ICFBamTableObj>(); } }); dataTable.getColumns().add(tableColumnLookupRetTable); dataTable.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<ICFBamServerListFuncObj>() { @Override public void changed(ObservableValue<? extends ICFBamServerListFuncObj> observable, ICFBamServerListFuncObj oldValue, ICFBamServerListFuncObj 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.choseServerListFunc(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"); } ICFBamServerListFuncObj selectedInstance = getJavaFXFocusAsServerListFunc(); invokeWhenChosen.choseServerListFunc(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
/** * 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) *//* w w w. j a va2 s.com*/ @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:com.rvantwisk.cnctools.controllers.CNCToolsController.java
@FXML // This method is called by the FXMLLoader when initialization is complete void initialize() { assert addMillTask != null : "fx:id=\"addMillTask\" was not injected: check your FXML file 'CNCTools.fxml'."; assert btnMoveTaskDown != null : "fx:id=\"btnMoveTaskDown\" was not injected: check your FXML file 'CNCTools.fxml'."; assert btnMoveTaskUp != null : "fx:id=\"btnMoveTaskUp\" was not injected: check your FXML file 'CNCTools.fxml'."; assert btnPostProcessor != null : "fx:id=\"btnPostProcessor\" was not injected: check your FXML file 'CNCTools.fxml'."; assert btnView != null : "fx:id=\"btnView\" was not injected: check your FXML file 'CNCTools.fxml'."; assert deleteProject != null : "fx:id=\"deleteProject\" was not injected: check your FXML file 'CNCTools.fxml'."; assert descriptionValue != null : "fx:id=\"descriptionValue\" was not injected: check your FXML file 'CNCTools.fxml'."; assert details != null : "fx:id=\"details\" was not injected: check your FXML file 'CNCTools.fxml'."; assert displayedIssueLabel != null : "fx:id=\"displayedIssueLabel\" was not injected: check your FXML file 'CNCTools.fxml'."; assert editMilltask != null : "fx:id=\"editMilltask\" was not injected: check your FXML file 'CNCTools.fxml'."; assert generateGCode != null : "fx:id=\"generateGCode\" was not injected: check your FXML file 'CNCTools.fxml'."; //assert millTaskDescription != null : "fx:id=\"millTaskDescription\" was not injected: check your FXML file 'CNCTools.fxml'."; //assert millTaskName != null : "fx:id=\"millTaskName\" was not injected: check your FXML file 'CNCTools.fxml'."; //assert millTaskOperation != null : "fx:id=\"millTaskOperation\" was not injected: check your FXML file 'CNCTools.fxml'."; assert milltaskEnabled != null : "fx:id=\"milltaskEnabled\" was not injected: check your FXML file 'CNCTools.fxml'."; assert removeMilltask != null : "fx:id=\"removeMilltask\" was not injected: check your FXML file 'CNCTools.fxml'."; assert tbl_millTasks != null : "fx:id=\"tbl_millTasks\" was not injected: check your FXML file 'CNCTools.fxml'."; assert v_projectList != null : "fx:id=\"v_projectList\" was not injected: check your FXML file 'CNCTools.fxml'."; v_projectList.setItems(projectModel.projectsProperty()); projectModel.loadPostProcessors();/* ww w.j av a 2 s.com*/ if (projectModel.postProcessorsProperty().size() == 0) { addDefaultPostprocessorSet(); projectModel.savePostProcessors(); MonologFX dialog = new MonologFX(MonologFX.Type.INFO); dialog.setTitleText("Postprocessor defaults loaded"); dialog.setMessage("No Post Processors where found, a new a new post processor set has been created."); dialog.show(); } projectModel.loadToolsFromDB(); if (projectModel.toolDBProperty().size() == 0) { addDefaultToolSet(); projectModel.saveToolDB(); MonologFX dialog = new MonologFX(MonologFX.Type.INFO); dialog.setTitleText("Tools defaults loaded"); dialog.setMessage("No tools where found, a new a new toolset has been created."); dialog.show(); } projectModel.loadProjectsFromDB(); if (projectModel.projectsProperty().size() == 0) { addProjectDefaults(); projectModel.saveProjects(); MonologFX dialog = new MonologFX(MonologFX.Type.INFO); dialog.setTitleText("Project defaults loaded"); dialog.setMessage( "No project was found, a new template project was created. Feel free to delete or modify"); dialog.show(); } deleteProject.disableProperty().bind(v_projectList.getSelectionModel().selectedItemProperty().isNull()); btnPostProcessor.disableProperty().bind(v_projectList.getSelectionModel().selectedItemProperty().isNull()); btnView.disableProperty().bind(v_projectList.getSelectionModel().selectedItemProperty().isNull()); removeMilltask.disableProperty().bind(tbl_millTasks.getSelectionModel().selectedItemProperty().isNull()); addMillTask.disableProperty().bind(v_projectList.getSelectionModel().selectedItemProperty().isNull()); editMilltask.disableProperty().bind(tbl_millTasks.getSelectionModel().selectedItemProperty().isNull()); generateGCode.disableProperty().bind(v_projectList.getSelectionModel().selectedItemProperty().isNull()); // Update description when project changes by means of databinding v_projectList.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Project>() { @Override public void changed(ObservableValue<? extends Project> observable, Project oldValue, Project newValue) { if (oldValue != null) { descriptionValue.textProperty().unbindBidirectional(oldValue.descriptionProperty()); } if (projectModel.projectsProperty().size() == 0) { tbl_millTasks.getItems().clear(); } else { tbl_millTasks.setItems(newValue.millTasksProperty()); descriptionValue.textProperty().bindBidirectional(newValue.descriptionProperty()); } } }); // Enable/Disable up/Down arrows tbl_millTasks.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TaskRunnable>() { @Override public void changed(ObservableValue<? extends TaskRunnable> observable, TaskRunnable o, TaskRunnable o2) { if (o2 != null) { final int index = tbl_millTasks.getSelectionModel().getSelectedIndex(); btnMoveTaskUp.setDisable(index == 0 ? true : false); btnMoveTaskDown.setDisable((index + 1) == tbl_millTasks.getItems().size() ? true : false); } else { btnMoveTaskUp.setDisable(true); btnMoveTaskDown.setDisable(true); } } }); btnMoveTaskUp.setDisable(true); btnMoveTaskDown.setDisable(true); // Set text in ListView v_projectList.setCellFactory(new Callback<ListView<Project>, ListCell<Project>>() { @Override public ListCell<Project> call(ListView<Project> p) { ListCell<Project> cell = new ListCell<Project>() { @Override protected void updateItem(Project t, boolean bln) { super.updateItem(t, bln); if (t != null) { setText(t.nameProperty().getValue()); } else { setText(null); } } }; return cell; } }); // checkbox renderer for milltasks milltaskEnabled.setCellFactory( new Callback<TableColumn<TaskRunnable, Boolean>, TableCell<TaskRunnable, Boolean>>() { @Override public TableCell<TaskRunnable, Boolean> call(TableColumn<TaskRunnable, Boolean> p) { CheckBoxTableCell<TaskRunnable, Boolean> cell = new CheckBoxTableCell<>(); cell.setEditable(true); cell.setAlignment(Pos.CENTER); return cell; } }); tbl_millTasks.setEditable(true); // Save DB on exit getDialog().setOnHidden(new EventHandler<WindowEvent>() { public void handle(WindowEvent we) { save(null); } }); }
From source file:ch.unibas.charmmtools.gui.step1.mdAssistant.CHARMM_GUI_InputAssistant.java
@Override protected void fillButtonBar() { button_reset = ButtonFactory.createButtonBarButton("Reset", new EventHandler<ActionEvent>() { @Override//from w w w .j a va 2 s . c o m public void handle(ActionEvent actionEvent) { logger.info("Resetting all fields."); ResetFields(actionEvent); } }); addButtonToButtonBar(button_reset); // button_save_to_file = ButtonFactory.createButtonBarButton("Click to save files ", new EventHandler<ActionEvent>() { // @Override // public void handle(ActionEvent actionEvent) { // logger.info("Saving CHARMM input script(s) to file(s)."); // SaveToFile(actionEvent); // } // }); // addButtonToButtonBar(button_save_to_file); // button_save_to_file.setDisable(true); button_run_CHARMM = ButtonFactory.createButtonBarButton("Run CHARMM ? - H - G simulations", new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { logger.info("Running CHARMM input script."); runCHARMM(actionEvent); } }); addButtonToButtonBar(button_run_CHARMM); button_run_CHARMM.setDisable(true); }
From source file:com.exalttech.trex.ui.views.PacketTableView.java
/** * Add menu item to table rightclickMenu * * @param action/*w w w .j a v a 2 s. c o m*/ */ private void addMenuItem(StreamTableAction action) { MenuItem item = new MenuItem(action.getTitle()); item.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { handleStreamTableAction(action); } }); rightClickMenu.getItems().add(item); }
From source file:org.beryx.viewreka.fxapp.Viewreka.java
public void refreshViews() { if (project == null) return;//from w w w . j a va2 s . c o m project.getProjectSettingsManager().saveSettings(); viewsTabPane.getTabs().clear(); ProjectSettings projectSettings = project.getProjectSettingsManager().getSettings(); String currentViewName = projectSettings.getCurrentView(); Tab selectedTab = null; for (FxView view : project.getViews()) { String viewName = view.getName(); final Tab tab = new Tab(viewName); viewsTabPane.getTabs().add(tab); if (viewName.equals(currentViewName)) { selectedTab = tab; } final ViewPane<?> viewPane = ViewPane.fromModel(view, projectSettings); tab.setContent(viewPane); viewPane.autosize(); tab.setOnSelectionChanged(new EventHandler<Event>() { @Override public void handle(Event event) { viewPane.autosize(); Tab selTab = viewsTabPane.getSelectionModel().getSelectedItem(); if (selTab != null) { String selectedView = selTab.getText(); projectSettings.setCurrentView(selectedView); } } }); } if (selectedTab != null) { viewsTabPane.getSelectionModel().select(selectedTab); } layout(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXChainListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); buttonAddChain = new CFButton(); buttonAddChain.setMinWidth(200); buttonAddChain.setText("Add Chain"); buttonAddChain.setOnAction(new EventHandler<ActionEvent>() { @Override/*from w ww .j a va2 s. c o m*/ public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamChainObj obj = (ICFBamChainObj) schemaObj.getChainTableObj().newInstance(); ICFBamChainEditObj edit = (ICFBamChainEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); CFBorderPane frame = javafxSchema.getChainFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamJavaFXChainPaneCommon jpanelCommon = (ICFBamJavaFXChainPaneCommon) 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(buttonAddChain); 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"); } ICFBamChainObj selectedInstance = getJavaFXFocusAsChain(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("CHN".equals(classCode)) { CFBorderPane frame = javafxSchema.getChainFactory().newViewEditForm(cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXChainPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamChainObj"); } } } 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"); } ICFBamChainObj selectedInstance = getJavaFXFocusAsChain(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("CHN".equals(classCode)) { CFBorderPane frame = javafxSchema.getChainFactory().newViewEditForm(cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXChainPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamChainObj"); } } } 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"); } ICFBamChainObj selectedInstance = getJavaFXFocusAsChain(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("CHN".equals(classCode)) { CFBorderPane frame = javafxSchema.getChainFactory().newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXChainPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamChainObj"); } } } 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.CFBamJavaFXIndexColListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); buttonAddIndexCol = new CFButton(); buttonAddIndexCol.setMinWidth(200); buttonAddIndexCol.setText("Add IndexCol"); buttonAddIndexCol.setOnAction(new EventHandler<ActionEvent>() { @Override// w w w .j av a2s .c om public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamIndexColObj obj = (ICFBamIndexColObj) schemaObj.getIndexColTableObj().newInstance(); ICFBamIndexColEditObj edit = (ICFBamIndexColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamIndexObj container = (ICFBamIndexObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerIndex(container); CFBorderPane frame = javafxSchema.getIndexColFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamJavaFXIndexColPaneCommon jpanelCommon = (ICFBamJavaFXIndexColPaneCommon) 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(buttonAddIndexCol); 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"); } ICFBamIndexColObj selectedInstance = getJavaFXFocusAsIndexCol(); 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"); } ICFBamIndexColObj selectedInstance = getJavaFXFocusAsIndexCol(); 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"); } ICFBamIndexColObj selectedInstance = getJavaFXFocusAsIndexCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("IDXC".equals(classCode)) { CFBorderPane frame = javafxSchema.getIndexColFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXIndexColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamIndexColObj"); } } } 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"); } ICFBamIndexColObj selectedInstance = getJavaFXFocusAsIndexCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("IDXC".equals(classCode)) { CFBorderPane frame = javafxSchema.getIndexColFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXIndexColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamIndexColObj"); } } } 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"); } ICFBamIndexColObj selectedInstance = getJavaFXFocusAsIndexCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("IDXC".equals(classCode)) { CFBorderPane frame = javafxSchema.getIndexColFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXIndexColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamIndexColObj"); } } } 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.CFBamJavaFXUuidColPickerPane.java
public CFBamJavaFXUuidColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamUuidColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamUuidColObj> argDataCollection, ICFBamJavaFXUuidColChosen whenChosen) { super();// www . jav a 2s . 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<ICFBamUuidColObj>(); tableColumnId = new TableColumn<ICFBamUuidColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamUuidColObj, 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<ICFBamUuidColObj, Long>, TableCell<ICFBamUuidColObj, Long>>() { @Override public TableCell<ICFBamUuidColObj, Long> call(TableColumn<ICFBamUuidColObj, Long> arg) { return new CFInt64TableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamUuidColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidColObj, 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<ICFBamUuidColObj, String>, TableCell<ICFBamUuidColObj, String>>() { @Override public TableCell<ICFBamUuidColObj, String> call(TableColumn<ICFBamUuidColObj, String> arg) { return new CFStringTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamUuidColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidColObj, 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<ICFBamUuidColObj, String>, TableCell<ICFBamUuidColObj, String>>() { @Override public TableCell<ICFBamUuidColObj, String> call(TableColumn<ICFBamUuidColObj, String> arg) { return new CFStringTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamUuidColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidColObj, 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<ICFBamUuidColObj, String>, TableCell<ICFBamUuidColObj, String>>() { @Override public TableCell<ICFBamUuidColObj, String> call(TableColumn<ICFBamUuidColObj, String> arg) { return new CFStringTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamUuidColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidColObj, 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<ICFBamUuidColObj, String>, TableCell<ICFBamUuidColObj, String>>() { @Override public TableCell<ICFBamUuidColObj, String> call(TableColumn<ICFBamUuidColObj, String> arg) { return new CFStringTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamUuidColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidColObj, 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<ICFBamUuidColObj, String>, TableCell<ICFBamUuidColObj, String>>() { @Override public TableCell<ICFBamUuidColObj, String> call(TableColumn<ICFBamUuidColObj, String> arg) { return new CFStringTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamUuidColObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUuidColObj, 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<ICFBamUuidColObj, Boolean>, TableCell<ICFBamUuidColObj, Boolean>>() { @Override public TableCell<ICFBamUuidColObj, Boolean> call(TableColumn<ICFBamUuidColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamUuidColObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUuidColObj, 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<ICFBamUuidColObj, Boolean>, TableCell<ICFBamUuidColObj, Boolean>>() { @Override public TableCell<ICFBamUuidColObj, Boolean> call(TableColumn<ICFBamUuidColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamUuidColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUuidColObj, 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<ICFBamUuidColObj, Boolean>, TableCell<ICFBamUuidColObj, Boolean>>() { @Override public TableCell<ICFBamUuidColObj, Boolean> call(TableColumn<ICFBamUuidColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamUuidColObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidColObj, 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<ICFBamUuidColObj, String>, TableCell<ICFBamUuidColObj, String>>() { @Override public TableCell<ICFBamUuidColObj, String> call(TableColumn<ICFBamUuidColObj, String> arg) { return new CFStringTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamUuidColObj, UUID>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidColObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamUuidColObj, UUID>, TableCell<ICFBamUuidColObj, UUID>>() { @Override public TableCell<ICFBamUuidColObj, UUID> call(TableColumn<ICFBamUuidColObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamUuidColObj, UUID>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidColObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamUuidColObj, UUID>, TableCell<ICFBamUuidColObj, UUID>>() { @Override public TableCell<ICFBamUuidColObj, UUID> call(TableColumn<ICFBamUuidColObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamUuidColObj, UUID>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidColObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamUuidColObj, UUID>, TableCell<ICFBamUuidColObj, UUID>>() { @Override public TableCell<ICFBamUuidColObj, UUID> call(TableColumn<ICFBamUuidColObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamUuidColObj, UUID>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidColObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamUuidColObj, UUID>, TableCell<ICFBamUuidColObj, UUID>>() { @Override public TableCell<ICFBamUuidColObj, UUID> call(TableColumn<ICFBamUuidColObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidColObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamUuidColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamUuidColObj, ICFBamSchemaDefObj> p) { ICFBamUuidColObj 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<ICFBamUuidColObj, ICFBamSchemaDefObj>, TableCell<ICFBamUuidColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamUuidColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamUuidColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamUuidColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamUuidColObj>() { @Override public void changed(ObservableValue<? extends ICFBamUuidColObj> observable, ICFBamUuidColObj oldValue, ICFBamUuidColObj 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.choseUuidCol(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"); } ICFBamUuidColObj selectedInstance = getJavaFXFocusAsUuidCol(); invokeWhenChosen.choseUuidCol(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); }