public CFHBox getHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); buttonEdit = new CFButton(); buttonEdit.setMinWidth(200); buttonEdit.setText("Edit"); buttonEdit.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { if (getJavaFXFocusAsNmTokenType() != null) { if (null == getJavaFXFocusAsNmTokenType().getEdit()) { setPaneMode(CFPane.PaneMode.Edit); } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot begin an edit of an object already edited by another window instance"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } adjustButtons(); } }); hboxMenu.getChildren().add(buttonEdit); buttonSave = new CFButton(); buttonSave.setMinWidth(200); buttonSave.setText("Save"); buttonSave.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFDbTestNmTokenTypeObj focus = getJavaFXFocusAsNmTokenType(); if (focus != null) { ICFDbTestNmTokenTypeEditObj editObj = (ICFDbTestNmTokenTypeEditObj) (focus.getEdit()); if (editObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "editObj"); } CFPane.PaneMode oldMode = getPaneMode(); try { setPaneMode(CFPane.PaneMode.Update); setPaneMode(CFPane.PaneMode.View); } catch (Throwable t) { setPaneMode(oldMode); throw t; } } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "focus"); } dataChanged = true; } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } adjustButtons(); } }); hboxMenu.getChildren().add(buttonSave); buttonClose = new CFButton(); buttonClose.setMinWidth(200); buttonClose.setText("Close"); buttonClose.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFDbTestNmTokenTypeObj focus = getJavaFXFocusAsNmTokenType(); if (focus != null) { ICFDbTestNmTokenTypeEditObj editObj = (ICFDbTestNmTokenTypeEditObj) (focus.getEdit()); if (editObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "editObj"); } CFPane.PaneMode oldMode = getPaneMode(); try { setPaneMode(CFPane.PaneMode.Update); } catch (Throwable t) { setPaneMode(oldMode); throw t; } dataChanged = true; } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "focus"); } cfFormManager.closeCurrentForm(); if (formClosedCallback != null) { focus = getJavaFXFocusAsNmTokenType(); formClosedCallback.formClosed(focus); } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonClose); 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 { ICFDbTestNmTokenTypeObj focus = getJavaFXFocusAsNmTokenType(); if (focus != null) { ICFDbTestNmTokenTypeEditObj editObj = (ICFDbTestNmTokenTypeEditObj) focus.getEdit(); if (editObj != null) { if (editObj.getIsNew()) { editObj.endEdit(); setJavaFXFocus(null); setPaneMode(CFPane.PaneMode.Unknown); } else { editObj.endEdit(); setPaneMode(CFPane.PaneMode.View); } } } cfFormManager.closeCurrentForm(); if (formClosedCallback != null) { if (dataChanged) { focus = getJavaFXFocusAsNmTokenType(); } else { focus = null; } formClosedCallback.formClosed(focus); } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); } return (hboxMenu); }
public CFHBox getHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); buttonSave = new CFButton(); buttonSave.setMinWidth(200); buttonSave.setText("Save"); buttonSave.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFDbTestBlobDefObj focus = getJavaFXFocusAsBlobDef(); if (focus != null) { ICFDbTestBlobDefEditObj editObj = (ICFDbTestBlobDefEditObj) (focus.getEdit()); if (editObj != null) { setPaneMode(CFPane.PaneMode.Update); } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot save an object that isn't being edited"); } } // If an object was added, the focus will change to the persisted instance focus = getJavaFXFocusAsBlobDef(); CFBorderPane frame = javafxSchema .getBlobDefFactory() .newViewEditForm(cfFormManager, focus, formClosedCallback, true); ((ICFDbTestJavaFXBlobDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.closeCurrentForm(); cfFormManager.pushForm(frame); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (allowSave) { hboxMenu.getChildren().add(buttonSave); } buttonClose = new CFButton(); buttonClose.setMinWidth(200); buttonClose.setText("Close"); buttonClose.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFDbTestBlobDefObj focus = getJavaFXFocusAsBlobDef(); if (focus != null) { ICFDbTestBlobDefEditObj editObj = (ICFDbTestBlobDefEditObj) (focus.getEdit()); if (editObj != null) { setPaneMode(CFPane.PaneMode.Update); } else { throw CFLib.getDefaultExceptionFactory() .newUsageException( getClass(), S_ProcName, "Cannot save an object that isn't being edited"); } } // If an object was added, the focus will change to the persisted instance focus = getJavaFXFocusAsBlobDef(); cfFormManager.closeCurrentForm(); if (formClosedCallback != null) { formClosedCallback.formClosed(focus); } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonClose); 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 { ICFDbTestBlobDefObj focus = getJavaFXFocusAsBlobDef(); if (focus != null) { ICFDbTestBlobDefEditObj editObj = (ICFDbTestBlobDefEditObj) focus.getEdit(); if (editObj != null) { if (editObj.getIsNew()) { editObj.endEdit(); setJavaFXFocus(null); setPaneMode(CFPane.PaneMode.Unknown); } else { editObj.endEdit(); setPaneMode(CFPane.PaneMode.View); } } } cfFormManager.closeCurrentForm(); if (formClosedCallback != null) { formClosedCallback.formClosed(null); } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); } return (hboxMenu); }
public CFDbTestJavaFXOptFullRangeAskDeleteForm( ICFFormManager formManager, ICFDbTestJavaFXSchema argSchema, ICFDbTestOptFullRangeObj argFocus, ICFDeleteCallback callback) { super(); 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"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; deleteCallback = callback; // Construct the various objects textAreaMessage = new CFTextArea(); textAreaMessage.setText("Are you sure you want to delete this OptFullRange?"); hboxButtons = new CFHBox(10); buttonOk = new CFButton(); buttonOk.setMinWidth(200); buttonOk.setText("Ok"); buttonOk.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "actionOkPerformed"; try { ICFDbTestOptFullRangeObj obj = getJavaFXFocusAsOptFullRange(); ICFDbTestOptFullRangeEditObj editObj = (ICFDbTestOptFullRangeEditObj) obj.beginEdit(); editObj.delete(); editObj.endEdit(); cfFormManager.closeCurrentForm(); if (deleteCallback != null) { deleteCallback.formClosed(null); deleteCallback.deleted(obj); } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "actionCancelPerformed"; try { cfFormManager.closeCurrentForm(); if (deleteCallback != null) { deleteCallback.formClosed(null); } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxButtons.getChildren().addAll(buttonOk, buttonCancel); attrPane = argSchema.getOptFullRangeFactory().newAttrPane(cfFormManager, argFocus); scrollPane = new ScrollPane(); scrollPane.setFitToWidth(true); scrollPane.setHbarPolicy(ScrollBarPolicy.NEVER); scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollPane.setContent(attrPane); setTop(textAreaMessage); setCenter(scrollPane); setBottom(hboxButtons); }
public CFDbTestJavaFXNumberTypePickerPane( ICFFormManager formManager, ICFDbTestJavaFXSchema argSchema, ICFDbTestNumberTypeObj argFocus, ICFDbTestSchemaDefObj argContainer, Collection<ICFDbTestNumberTypeObj> argDataCollection, ICFDbTestJavaFXNumberTypeChosen whenChosen) { super(); 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<ICFDbTestNumberTypeObj>(); tableColumnId = new TableColumn<ICFDbTestNumberTypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFDbTestNumberTypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFDbTestNumberTypeObj, Long> p) { ICFDbTestValueObj 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<ICFDbTestNumberTypeObj, Long>, TableCell<ICFDbTestNumberTypeObj, Long>>() { @Override public TableCell<ICFDbTestNumberTypeObj, Long> call( TableColumn<ICFDbTestNumberTypeObj, Long> arg) { return new CFInt64TableCell<ICFDbTestNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFDbTestNumberTypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFDbTestNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFDbTestNumberTypeObj, String> p) { ICFDbTestValueObj 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<ICFDbTestNumberTypeObj, String>, TableCell<ICFDbTestNumberTypeObj, String>>() { @Override public TableCell<ICFDbTestNumberTypeObj, String> call( TableColumn<ICFDbTestNumberTypeObj, String> arg) { return new CFStringTableCell<ICFDbTestNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnDefaultVisibility = new TableColumn<ICFDbTestNumberTypeObj, Boolean>("DefaultVisibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback< CellDataFeatures<ICFDbTestNumberTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call( CellDataFeatures<ICFDbTestNumberTypeObj, Boolean> p) { ICFDbTestValueObj 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<ICFDbTestNumberTypeObj, Boolean>, TableCell<ICFDbTestNumberTypeObj, Boolean>>() { @Override public TableCell<ICFDbTestNumberTypeObj, Boolean> call( TableColumn<ICFDbTestNumberTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFDbTestNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); dataTable .getSelectionModel() .selectedItemProperty() .addListener( new ChangeListener<ICFDbTestNumberTypeObj>() { @Override public void changed( ObservableValue<? extends ICFDbTestNumberTypeObj> observable, ICFDbTestNumberTypeObj oldValue, ICFDbTestNumberTypeObj 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 { ICFDbTestSchemaObj schemaObj = (ICFDbTestSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseNumberType(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 { ICFDbTestSchemaObj schemaObj = (ICFDbTestSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFDbTestNumberTypeObj selectedInstance = getJavaFXFocusAsNumberType(); invokeWhenChosen.choseNumberType(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); }
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); buttonAddStringCol = new CFButton(); buttonAddStringCol.setMinWidth(200); buttonAddStringCol.setText("Add StringCol"); buttonAddStringCol.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFDbTestSchemaObj schemaObj = (ICFDbTestSchemaObj) javafxSchema.getSchema(); ICFDbTestStringColObj obj = (ICFDbTestStringColObj) schemaObj.getStringColTableObj().newInstance(); ICFDbTestStringColEditObj edit = (ICFDbTestStringColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFDbTestTableObj container = (ICFDbTestTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); CFBorderPane frame = javafxSchema .getStringColFactory() .newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFDbTestJavaFXStringColPaneCommon jpanelCommon = (ICFDbTestJavaFXStringColPaneCommon) 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(buttonAddStringCol); 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 { ICFDbTestSchemaObj schemaObj = (ICFDbTestSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFDbTestStringColObj selectedInstance = getJavaFXFocusAsStringCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("STRC".equals(classCode)) { CFBorderPane frame = javafxSchema .getStringColFactory() .newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFDbTestJavaFXStringColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFDbTestStringColObj"); } } } 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 { ICFDbTestSchemaObj schemaObj = (ICFDbTestSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFDbTestStringColObj selectedInstance = getJavaFXFocusAsStringCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("STRC".equals(classCode)) { CFBorderPane frame = javafxSchema .getStringColFactory() .newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFDbTestJavaFXStringColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFDbTestStringColObj"); } } } 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 { ICFDbTestSchemaObj schemaObj = (ICFDbTestSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFDbTestStringColObj selectedInstance = getJavaFXFocusAsStringCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("STRC".equals(classCode)) { CFBorderPane frame = javafxSchema .getStringColFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFDbTestJavaFXStringColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFDbTestStringColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }