Example usage for javafx.event ActionEvent getSource

List of usage examples for javafx.event ActionEvent getSource

Introduction

In this page you can find the example usage for javafx.event ActionEvent getSource.

Prototype

public Object getSource() 

Source Link

Document

The object on which the Event initially occurred.

Usage

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXBoolDefListPane.java

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddBoolType = new CFButton();
        buttonAddBoolType.setMinWidth(200);
        buttonAddBoolType.setText("Add BoolType");
        buttonAddBoolType.setOnAction(new EventHandler<ActionEvent>() {
            @Override/*  w ww. j a v a 2  s . co m*/
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamBoolTypeObj obj = (ICFBamBoolTypeObj) schemaObj.getBoolTypeTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getBoolTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamBoolTypeEditObj edit = (ICFBamBoolTypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXBoolTypePaneCommon jpanelCommon = (ICFBamJavaFXBoolTypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddBoolType);
        }
        buttonAddBoolCol = new CFButton();
        buttonAddBoolCol.setMinWidth(200);
        buttonAddBoolCol.setText("Add BoolCol");
        buttonAddBoolCol.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamBoolColObj obj = (ICFBamBoolColObj) schemaObj.getBoolColTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getBoolColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamBoolColEditObj edit = (ICFBamBoolColEditObj) (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);
                    ICFBamJavaFXBoolColPaneCommon jpanelCommon = (ICFBamJavaFXBoolColPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamTableObj) {
            list.add(buttonAddBoolCol);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        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");
                    }
                    ICFBamBoolDefObj selectedInstance = getJavaFXFocusAsBoolDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("BOLD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getBoolDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXBoolDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("BOLT".equals(classCode)) {
                            ICFBamBoolTypeObj obj = (ICFBamBoolTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getBoolTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXBoolTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("BOLC".equals(classCode)) {
                            ICFBamBoolColObj obj = (ICFBamBoolColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getBoolColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXBoolColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamBoolDefObj, ICFBamBoolTypeObj, ICFBamBoolColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamBoolDefObj selectedInstance = getJavaFXFocusAsBoolDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("BOLD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getBoolDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXBoolDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("BOLT".equals(classCode)) {
                            ICFBamBoolTypeObj obj = (ICFBamBoolTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getBoolTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXBoolTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("BOLC".equals(classCode)) {
                            ICFBamBoolColObj obj = (ICFBamBoolColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getBoolColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXBoolColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamBoolDefObj, ICFBamBoolTypeObj, ICFBamBoolColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamBoolDefObj selectedInstance = getJavaFXFocusAsBoolDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("BOLD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getBoolDefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXBoolDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("BOLT".equals(classCode)) {
                            ICFBamBoolTypeObj obj = (ICFBamBoolTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getBoolTypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXBoolTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("BOLC".equals(classCode)) {
                            ICFBamBoolColObj obj = (ICFBamBoolColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getBoolColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXBoolColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamBoolDefObj, ICFBamBoolTypeObj, ICFBamBoolColObj");
                        }
                    }
                } 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.CFBamJavaFXDateDefListPane.java

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddDateType = new CFButton();
        buttonAddDateType.setMinWidth(200);
        buttonAddDateType.setText("Add DateType");
        buttonAddDateType.setOnAction(new EventHandler<ActionEvent>() {
            @Override//  ww w  .  ja  v  a2  s .  c o m
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamDateTypeObj obj = (ICFBamDateTypeObj) schemaObj.getDateTypeTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getDateTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamDateTypeEditObj edit = (ICFBamDateTypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXDateTypePaneCommon jpanelCommon = (ICFBamJavaFXDateTypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddDateType);
        }
        buttonAddDateCol = new CFButton();
        buttonAddDateCol.setMinWidth(200);
        buttonAddDateCol.setText("Add DateCol");
        buttonAddDateCol.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamDateColObj obj = (ICFBamDateColObj) schemaObj.getDateColTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getDateColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamDateColEditObj edit = (ICFBamDateColEditObj) (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);
                    ICFBamJavaFXDateColPaneCommon jpanelCommon = (ICFBamJavaFXDateColPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamTableObj) {
            list.add(buttonAddDateCol);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        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");
                    }
                    ICFBamDateDefObj selectedInstance = getJavaFXFocusAsDateDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("DATD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getDateDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDateDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DATT".equals(classCode)) {
                            ICFBamDateTypeObj obj = (ICFBamDateTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDateTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDateTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DATC".equals(classCode)) {
                            ICFBamDateColObj obj = (ICFBamDateColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDateColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDateColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamDateDefObj, ICFBamDateTypeObj, ICFBamDateColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamDateDefObj selectedInstance = getJavaFXFocusAsDateDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("DATD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getDateDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDateDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("DATT".equals(classCode)) {
                            ICFBamDateTypeObj obj = (ICFBamDateTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDateTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDateTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("DATC".equals(classCode)) {
                            ICFBamDateColObj obj = (ICFBamDateColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDateColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDateColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamDateDefObj, ICFBamDateTypeObj, ICFBamDateColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamDateDefObj selectedInstance = getJavaFXFocusAsDateDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("DATD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getDateDefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXDateDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DATT".equals(classCode)) {
                            ICFBamDateTypeObj obj = (ICFBamDateTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDateTypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXDateTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DATC".equals(classCode)) {
                            ICFBamDateColObj obj = (ICFBamDateColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDateColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXDateColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamDateDefObj, ICFBamDateTypeObj, ICFBamDateColObj");
                        }
                    }
                } 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.CFBamJavaFXTextDefListPane.java

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddTextType = new CFButton();
        buttonAddTextType.setMinWidth(200);
        buttonAddTextType.setText("Add TextType");
        buttonAddTextType.setOnAction(new EventHandler<ActionEvent>() {
            @Override/* w  w w .ja  va 2s .c  om*/
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamTextTypeObj obj = (ICFBamTextTypeObj) schemaObj.getTextTypeTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getTextTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamTextTypeEditObj edit = (ICFBamTextTypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXTextTypePaneCommon jpanelCommon = (ICFBamJavaFXTextTypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddTextType);
        }
        buttonAddTextCol = new CFButton();
        buttonAddTextCol.setMinWidth(200);
        buttonAddTextCol.setText("Add TextCol");
        buttonAddTextCol.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamTextColObj obj = (ICFBamTextColObj) schemaObj.getTextColTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getTextColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamTextColEditObj edit = (ICFBamTextColEditObj) (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);
                    ICFBamJavaFXTextColPaneCommon jpanelCommon = (ICFBamJavaFXTextColPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamTableObj) {
            list.add(buttonAddTextCol);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        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");
                    }
                    ICFBamTextDefObj selectedInstance = getJavaFXFocusAsTextDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TXTD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTextDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTextDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TXTT".equals(classCode)) {
                            ICFBamTextTypeObj obj = (ICFBamTextTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTextTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTextTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TXTC".equals(classCode)) {
                            ICFBamTextColObj obj = (ICFBamTextColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTextColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTextColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTextDefObj, ICFBamTextTypeObj, ICFBamTextColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamTextDefObj selectedInstance = getJavaFXFocusAsTextDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TXTD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTextDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTextDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("TXTT".equals(classCode)) {
                            ICFBamTextTypeObj obj = (ICFBamTextTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTextTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTextTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("TXTC".equals(classCode)) {
                            ICFBamTextColObj obj = (ICFBamTextColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTextColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTextColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTextDefObj, ICFBamTextTypeObj, ICFBamTextColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamTextDefObj selectedInstance = getJavaFXFocusAsTextDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TXTD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTextDefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXTextDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TXTT".equals(classCode)) {
                            ICFBamTextTypeObj obj = (ICFBamTextTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTextTypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXTextTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TXTC".equals(classCode)) {
                            ICFBamTextColObj obj = (ICFBamTextColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTextColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXTextColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTextDefObj, ICFBamTextTypeObj, ICFBamTextColObj");
                        }
                    }
                } 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.CFBamJavaFXTZTimeDefListPane.java

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddTZTimeType = new CFButton();
        buttonAddTZTimeType.setMinWidth(200);
        buttonAddTZTimeType.setText("Add TZTimeType");
        buttonAddTZTimeType.setOnAction(new EventHandler<ActionEvent>() {
            @Override//from  w w  w .ja  va2s.c  o m
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamTZTimeTypeObj obj = (ICFBamTZTimeTypeObj) schemaObj.getTZTimeTypeTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getTZTimeTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamTZTimeTypeEditObj edit = (ICFBamTZTimeTypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXTZTimeTypePaneCommon jpanelCommon = (ICFBamJavaFXTZTimeTypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddTZTimeType);
        }
        buttonAddTZTimeCol = new CFButton();
        buttonAddTZTimeCol.setMinWidth(200);
        buttonAddTZTimeCol.setText("Add TZTimeCol");
        buttonAddTZTimeCol.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamTZTimeColObj obj = (ICFBamTZTimeColObj) schemaObj.getTZTimeColTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getTZTimeColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamTZTimeColEditObj edit = (ICFBamTZTimeColEditObj) (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);
                    ICFBamJavaFXTZTimeColPaneCommon jpanelCommon = (ICFBamJavaFXTZTimeColPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamTableObj) {
            list.add(buttonAddTZTimeCol);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        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");
                    }
                    ICFBamTZTimeDefObj selectedInstance = getJavaFXFocusAsTZTimeDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TMZD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTZTimeDefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZT".equals(classCode)) {
                            ICFBamTZTimeTypeObj obj = (ICFBamTZTimeTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZC".equals(classCode)) {
                            ICFBamTZTimeColObj obj = (ICFBamTZTimeColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTZTimeDefObj, ICFBamTZTimeTypeObj, ICFBamTZTimeColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamTZTimeDefObj selectedInstance = getJavaFXFocusAsTZTimeDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TMZD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTZTimeDefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZT".equals(classCode)) {
                            ICFBamTZTimeTypeObj obj = (ICFBamTZTimeTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZC".equals(classCode)) {
                            ICFBamTZTimeColObj obj = (ICFBamTZTimeColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTZTimeDefObj, ICFBamTZTimeTypeObj, ICFBamTZTimeColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamTZTimeDefObj selectedInstance = getJavaFXFocusAsTZTimeDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TMZD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTZTimeDefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXTZTimeDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZT".equals(classCode)) {
                            ICFBamTZTimeTypeObj obj = (ICFBamTZTimeTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeTypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXTZTimeTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZC".equals(classCode)) {
                            ICFBamTZTimeColObj obj = (ICFBamTZTimeColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXTZTimeColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTZTimeDefObj, ICFBamTZTimeTypeObj, ICFBamTZTimeColObj");
                        }
                    }
                } 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.CFBamJavaFXInt16TypeListPane.java

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddInt16Type = new CFButton();
        buttonAddInt16Type.setMinWidth(200);
        buttonAddInt16Type.setText("Add Int16Type");
        buttonAddInt16Type.setOnAction(new EventHandler<ActionEvent>() {
            @Override/* w w w  . j  a va 2  s.  c o  m*/
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamInt16TypeObj obj = (ICFBamInt16TypeObj) schemaObj.getInt16TypeTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getInt16TypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamInt16TypeEditObj edit = (ICFBamInt16TypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXInt16TypePaneCommon jpanelCommon = (ICFBamJavaFXInt16TypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddInt16Type);
        }
        buttonAddId16Gen = new CFButton();
        buttonAddId16Gen.setMinWidth(200);
        buttonAddId16Gen.setText("Add Id16Gen");
        buttonAddId16Gen.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamId16GenObj obj = (ICFBamId16GenObj) schemaObj.getId16GenTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getId16GenFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamId16GenEditObj edit = (ICFBamId16GenEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXId16GenPaneCommon jpanelCommon = (ICFBamJavaFXId16GenPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddId16Gen);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        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");
                    }
                    ICFBamInt16TypeObj selectedInstance = getJavaFXFocusAsInt16Type();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I16T".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt16TypeFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt16TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IG16".equals(classCode)) {
                            ICFBamId16GenObj obj = (ICFBamId16GenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getId16GenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXId16GenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt16TypeObj, ICFBamId16GenObj");
                        }
                    }
                } 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");
                    }
                    ICFBamInt16TypeObj selectedInstance = getJavaFXFocusAsInt16Type();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I16T".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt16TypeFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt16TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("IG16".equals(classCode)) {
                            ICFBamId16GenObj obj = (ICFBamId16GenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getId16GenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXId16GenPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt16TypeObj, ICFBamId16GenObj");
                        }
                    }
                } 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");
                    }
                    ICFBamInt16TypeObj selectedInstance = getJavaFXFocusAsInt16Type();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I16T".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt16TypeFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXInt16TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IG16".equals(classCode)) {
                            ICFBamId16GenObj obj = (ICFBamId16GenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getId16GenFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXId16GenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt16TypeObj, ICFBamId16GenObj");
                        }
                    }
                } 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.CFBamJavaFXInt64TypeListPane.java

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddInt64Type = new CFButton();
        buttonAddInt64Type.setMinWidth(200);
        buttonAddInt64Type.setText("Add Int64Type");
        buttonAddInt64Type.setOnAction(new EventHandler<ActionEvent>() {
            @Override//www  . j a va2 s  .  c om
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamInt64TypeObj obj = (ICFBamInt64TypeObj) schemaObj.getInt64TypeTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getInt64TypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamInt64TypeEditObj edit = (ICFBamInt64TypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXInt64TypePaneCommon jpanelCommon = (ICFBamJavaFXInt64TypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddInt64Type);
        }
        buttonAddId64Gen = new CFButton();
        buttonAddId64Gen.setMinWidth(200);
        buttonAddId64Gen.setText("Add Id64Gen");
        buttonAddId64Gen.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamId64GenObj obj = (ICFBamId64GenObj) schemaObj.getId64GenTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getId64GenFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamId64GenEditObj edit = (ICFBamId64GenEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXId64GenPaneCommon jpanelCommon = (ICFBamJavaFXId64GenPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddId64Gen);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        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");
                    }
                    ICFBamInt64TypeObj selectedInstance = getJavaFXFocusAsInt64Type();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I64T".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt64TypeFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt64TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IG64".equals(classCode)) {
                            ICFBamId64GenObj obj = (ICFBamId64GenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getId64GenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXId64GenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt64TypeObj, ICFBamId64GenObj");
                        }
                    }
                } 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");
                    }
                    ICFBamInt64TypeObj selectedInstance = getJavaFXFocusAsInt64Type();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I64T".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt64TypeFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt64TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("IG64".equals(classCode)) {
                            ICFBamId64GenObj obj = (ICFBamId64GenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getId64GenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXId64GenPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt64TypeObj, ICFBamId64GenObj");
                        }
                    }
                } 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");
                    }
                    ICFBamInt64TypeObj selectedInstance = getJavaFXFocusAsInt64Type();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I64T".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt64TypeFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXInt64TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IG64".equals(classCode)) {
                            ICFBamId64GenObj obj = (ICFBamId64GenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getId64GenFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXId64GenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt64TypeObj, ICFBamId64GenObj");
                        }
                    }
                } 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.CFBamJavaFXInt32TypeListPane.java

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddInt32Type = new CFButton();
        buttonAddInt32Type.setMinWidth(200);
        buttonAddInt32Type.setText("Add Int32Type");
        buttonAddInt32Type.setOnAction(new EventHandler<ActionEvent>() {
            @Override//from   w  w  w. j  ava  2  s . c om
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamInt32TypeObj obj = (ICFBamInt32TypeObj) schemaObj.getInt32TypeTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getInt32TypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamInt32TypeEditObj edit = (ICFBamInt32TypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXInt32TypePaneCommon jpanelCommon = (ICFBamJavaFXInt32TypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddInt32Type);
        }
        buttonAddId32Gen = new CFButton();
        buttonAddId32Gen.setMinWidth(200);
        buttonAddId32Gen.setText("Add Id32Gen");
        buttonAddId32Gen.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamId32GenObj obj = (ICFBamId32GenObj) schemaObj.getId32GenTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getId32GenFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamId32GenEditObj edit = (ICFBamId32GenEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXId32GenPaneCommon jpanelCommon = (ICFBamJavaFXId32GenPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddId32Gen);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        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");
                    }
                    ICFBamInt32TypeObj selectedInstance = getJavaFXFocusAsInt32Type();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I32T".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt32TypeFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt32TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IG32".equals(classCode)) {
                            ICFBamId32GenObj obj = (ICFBamId32GenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getId32GenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXId32GenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt32TypeObj, ICFBamId32GenObj");
                        }
                    }
                } 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");
                    }
                    ICFBamInt32TypeObj selectedInstance = getJavaFXFocusAsInt32Type();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I32T".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt32TypeFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt32TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("IG32".equals(classCode)) {
                            ICFBamId32GenObj obj = (ICFBamId32GenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getId32GenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXId32GenPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt32TypeObj, ICFBamId32GenObj");
                        }
                    }
                } 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");
                    }
                    ICFBamInt32TypeObj selectedInstance = getJavaFXFocusAsInt32Type();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I32T".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt32TypeFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXInt32TypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IG32".equals(classCode)) {
                            ICFBamId32GenObj obj = (ICFBamId32GenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getId32GenFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXId32GenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt32TypeObj, ICFBamId32GenObj");
                        }
                    }
                } 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.CFBamJavaFXFloatDefListPane.java

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddFloatType = new CFButton();
        buttonAddFloatType.setMinWidth(200);
        buttonAddFloatType.setText("Add FloatType");
        buttonAddFloatType.setOnAction(new EventHandler<ActionEvent>() {
            @Override/*w  w w  . ja v a 2s .c o  m*/
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamFloatTypeObj obj = (ICFBamFloatTypeObj) schemaObj.getFloatTypeTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getFloatTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamFloatTypeEditObj edit = (ICFBamFloatTypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXFloatTypePaneCommon jpanelCommon = (ICFBamJavaFXFloatTypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddFloatType);
        }
        buttonAddFloatCol = new CFButton();
        buttonAddFloatCol.setMinWidth(200);
        buttonAddFloatCol.setText("Add FloatCol");
        buttonAddFloatCol.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamFloatColObj obj = (ICFBamFloatColObj) schemaObj.getFloatColTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getFloatColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamFloatColEditObj edit = (ICFBamFloatColEditObj) (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);
                    ICFBamJavaFXFloatColPaneCommon jpanelCommon = (ICFBamJavaFXFloatColPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamTableObj) {
            list.add(buttonAddFloatCol);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        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");
                    }
                    ICFBamFloatDefObj selectedInstance = getJavaFXFocusAsFloatDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("FLTD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getFloatDefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXFloatDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("FLTT".equals(classCode)) {
                            ICFBamFloatTypeObj obj = (ICFBamFloatTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getFloatTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXFloatTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("FLTC".equals(classCode)) {
                            ICFBamFloatColObj obj = (ICFBamFloatColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getFloatColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXFloatColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamFloatDefObj, ICFBamFloatTypeObj, ICFBamFloatColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamFloatDefObj selectedInstance = getJavaFXFocusAsFloatDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("FLTD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getFloatDefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXFloatDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("FLTT".equals(classCode)) {
                            ICFBamFloatTypeObj obj = (ICFBamFloatTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getFloatTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXFloatTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("FLTC".equals(classCode)) {
                            ICFBamFloatColObj obj = (ICFBamFloatColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getFloatColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXFloatColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamFloatDefObj, ICFBamFloatTypeObj, ICFBamFloatColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamFloatDefObj selectedInstance = getJavaFXFocusAsFloatDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("FLTD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getFloatDefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXFloatDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("FLTT".equals(classCode)) {
                            ICFBamFloatTypeObj obj = (ICFBamFloatTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getFloatTypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXFloatTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("FLTC".equals(classCode)) {
                            ICFBamFloatColObj obj = (ICFBamFloatColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getFloatColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXFloatColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamFloatDefObj, ICFBamFloatTypeObj, ICFBamFloatColObj");
                        }
                    }
                } 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.CFBamJavaFXTokenDefListPane.java

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddTokenType = new CFButton();
        buttonAddTokenType.setMinWidth(200);
        buttonAddTokenType.setText("Add TokenType");
        buttonAddTokenType.setOnAction(new EventHandler<ActionEvent>() {
            @Override//from   w  w w  . j a  v  a 2 s.  c  o  m
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamTokenTypeObj obj = (ICFBamTokenTypeObj) schemaObj.getTokenTypeTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getTokenTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamTokenTypeEditObj edit = (ICFBamTokenTypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXTokenTypePaneCommon jpanelCommon = (ICFBamJavaFXTokenTypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddTokenType);
        }
        buttonAddTokenCol = new CFButton();
        buttonAddTokenCol.setMinWidth(200);
        buttonAddTokenCol.setText("Add TokenCol");
        buttonAddTokenCol.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamTokenColObj obj = (ICFBamTokenColObj) schemaObj.getTokenColTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getTokenColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamTokenColEditObj edit = (ICFBamTokenColEditObj) (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);
                    ICFBamJavaFXTokenColPaneCommon jpanelCommon = (ICFBamJavaFXTokenColPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamTableObj) {
            list.add(buttonAddTokenCol);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        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");
                    }
                    ICFBamTokenDefObj selectedInstance = getJavaFXFocusAsTokenDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TKND".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTokenDefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTokenDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TKNT".equals(classCode)) {
                            ICFBamTokenTypeObj obj = (ICFBamTokenTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTokenTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTokenTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TKNC".equals(classCode)) {
                            ICFBamTokenColObj obj = (ICFBamTokenColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTokenColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTokenColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTokenDefObj, ICFBamTokenTypeObj, ICFBamTokenColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamTokenDefObj selectedInstance = getJavaFXFocusAsTokenDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TKND".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTokenDefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTokenDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("TKNT".equals(classCode)) {
                            ICFBamTokenTypeObj obj = (ICFBamTokenTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTokenTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTokenTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("TKNC".equals(classCode)) {
                            ICFBamTokenColObj obj = (ICFBamTokenColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTokenColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTokenColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTokenDefObj, ICFBamTokenTypeObj, ICFBamTokenColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamTokenDefObj selectedInstance = getJavaFXFocusAsTokenDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TKND".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTokenDefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXTokenDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TKNT".equals(classCode)) {
                            ICFBamTokenTypeObj obj = (ICFBamTokenTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTokenTypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXTokenTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TKNC".equals(classCode)) {
                            ICFBamTokenColObj obj = (ICFBamTokenColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTokenColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXTokenColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTokenDefObj, ICFBamTokenTypeObj, ICFBamTokenColObj");
                        }
                    }
                } 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.CFBamJavaFXDoubleDefListPane.java

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddDoubleType = new CFButton();
        buttonAddDoubleType.setMinWidth(200);
        buttonAddDoubleType.setText("Add DoubleType");
        buttonAddDoubleType.setOnAction(new EventHandler<ActionEvent>() {
            @Override/*  w  ww  . j a v a  2 s .c  o m*/
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamDoubleTypeObj obj = (ICFBamDoubleTypeObj) schemaObj.getDoubleTypeTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getDoubleTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamDoubleTypeEditObj edit = (ICFBamDoubleTypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXDoubleTypePaneCommon jpanelCommon = (ICFBamJavaFXDoubleTypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddDoubleType);
        }
        buttonAddDoubleCol = new CFButton();
        buttonAddDoubleCol.setMinWidth(200);
        buttonAddDoubleCol.setText("Add DoubleCol");
        buttonAddDoubleCol.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamDoubleColObj obj = (ICFBamDoubleColObj) schemaObj.getDoubleColTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getDoubleColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamDoubleColEditObj edit = (ICFBamDoubleColEditObj) (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);
                    ICFBamJavaFXDoubleColPaneCommon jpanelCommon = (ICFBamJavaFXDoubleColPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamTableObj) {
            list.add(buttonAddDoubleCol);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        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");
                    }
                    ICFBamDoubleDefObj selectedInstance = getJavaFXFocusAsDoubleDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("DBLD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getDoubleDefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDoubleDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DBLT".equals(classCode)) {
                            ICFBamDoubleTypeObj obj = (ICFBamDoubleTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDoubleTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDoubleTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DBLC".equals(classCode)) {
                            ICFBamDoubleColObj obj = (ICFBamDoubleColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDoubleColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDoubleColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamDoubleDefObj, ICFBamDoubleTypeObj, ICFBamDoubleColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamDoubleDefObj selectedInstance = getJavaFXFocusAsDoubleDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("DBLD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getDoubleDefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDoubleDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("DBLT".equals(classCode)) {
                            ICFBamDoubleTypeObj obj = (ICFBamDoubleTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDoubleTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDoubleTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("DBLC".equals(classCode)) {
                            ICFBamDoubleColObj obj = (ICFBamDoubleColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDoubleColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDoubleColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamDoubleDefObj, ICFBamDoubleTypeObj, ICFBamDoubleColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamDoubleDefObj selectedInstance = getJavaFXFocusAsDoubleDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("DBLD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getDoubleDefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXDoubleDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DBLT".equals(classCode)) {
                            ICFBamDoubleTypeObj obj = (ICFBamDoubleTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDoubleTypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXDoubleTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DBLC".equals(classCode)) {
                            ICFBamDoubleColObj obj = (ICFBamDoubleColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDoubleColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXDoubleColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamDoubleDefObj, ICFBamDoubleTypeObj, ICFBamDoubleColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonDeleteSelected);

    }
    return (hboxMenu);
}