public void adjustListButtons() { boolean enableState; boolean inEditState; boolean allowAdds; boolean inAddMode = false; ICFAccFeeObj selectedObj = getJavaFXFocusAsFee(); CFPane.PaneMode mode = getPaneMode(); if (mode == CFPane.PaneMode.Edit) { inEditState = true; allowAdds = false; } else { inEditState = false; if (getJavaFXContainer() != null) { if (getLeft() != null) { allowAdds = false; inAddMode = true; } else { allowAdds = true; } } else { allowAdds = false; } } if (selectedObj == null) { enableState = false; } else { if ((!inAddMode) && (!inEditState)) { enableState = true; } else { enableState = false; } } if (buttonViewSelected != null) { buttonViewSelected.setDisable(!enableState); } if (buttonEditSelected != null) { if (inEditState) { buttonEditSelected.setDisable(true); } else { buttonEditSelected.setDisable(!enableState); } } if (buttonDeleteSelected != null) { buttonDeleteSelected.setDisable(!enableState); } if (buttonAddFee != null) { buttonAddFee.setDisable(!allowAdds); } }
@Override public int compare(CFButton lhs, CFButton rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { int retval = lhs.getText().compareTo(rhs.getText()); return (retval); } }
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); buttonAddFee = new CFButton(); buttonAddFee.setMinWidth(200); buttonAddFee.setText("Add Fee"); buttonAddFee.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFAccSchemaObj schemaObj = (ICFAccSchemaObj) javafxSchema.getSchema(); ICFAccFeeObj obj = (ICFAccFeeObj) schemaObj.getFeeTableObj().newInstance(); ICFAccFeeEditObj edit = (ICFAccFeeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFAccAccountObj container = (ICFAccAccountObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerAccount(container); CFBorderPane frame = javafxSchema .getFeeFactory() .newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFAccJavaFXFeePaneCommon jpanelCommon = (ICFAccJavaFXFeePaneCommon) 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(buttonAddFee); 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 { ICFAccSchemaObj schemaObj = (ICFAccSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFAccFeeObj selectedInstance = getJavaFXFocusAsFee(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("FEE".equals(classCode)) { CFBorderPane frame = javafxSchema .getFeeFactory() .newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFAccJavaFXFeePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFAccFeeObj"); } } } 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 { ICFAccSchemaObj schemaObj = (ICFAccSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFAccFeeObj selectedInstance = getJavaFXFocusAsFee(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("FEE".equals(classCode)) { CFBorderPane frame = javafxSchema .getFeeFactory() .newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFAccJavaFXFeePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFAccFeeObj"); } } } 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 { ICFAccSchemaObj schemaObj = (ICFAccSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFAccFeeObj selectedInstance = getJavaFXFocusAsFee(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("FEE".equals(classCode)) { CFBorderPane frame = javafxSchema .getFeeFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFAccJavaFXFeePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFAccFeeObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }