Example usage for java.util LinkedList size

List of usage examples for java.util LinkedList size

Introduction

In this page you can find the example usage for java.util LinkedList size.

Prototype

int size

To view the source code for java.util LinkedList size.

Click Source Link

Usage

From source file:com.mirth.connect.plugins.dashboardstatus.DashboardConnectorStatusMonitor.java

public void updateStatus(String connectorId, ConnectorType type, Event event, Socket socket) {
    String stateImage = COLOR_BLACK;
    String stateText = STATE_UNKNOWN;
    boolean updateStatus = true;

    switch (event) {
    case INITIALIZED:
        switch (type) {
        case LISTENER:
            stateImage = COLOR_YELLOW;/*from w  ww . j  a va  2  s.co  m*/
            stateText = STATE_WAITING;
            break;
        case READER:
            stateImage = COLOR_YELLOW;
            stateText = STATE_IDLE;
            break;
        }
        break;
    case CONNECTED:
        switch (type) {
        case LISTENER:
            if (socket != null) {
                addConnectionToSocketSet(socket, connectorId);
                stateImage = COLOR_GREEN;
                stateText = STATE_CONNECTED + " (" + getSocketSetCount(connectorId) + ")";
            } else {
                stateImage = COLOR_GREEN;
                stateText = STATE_CONNECTED;
            }
            break;
        case READER:
            stateImage = COLOR_GREEN;
            stateText = STATE_POLLING;
            break;
        }
        break;
    case DISCONNECTED:
        switch (type) {
        case LISTENER:
            if (socket != null) {
                removeConnectionInSocketSet(socket, connectorId);
                int connectedSockets = getSocketSetCount(connectorId);
                if (connectedSockets == 0) {
                    stateImage = COLOR_YELLOW;
                    stateText = STATE_WAITING;
                } else {
                    stateImage = COLOR_GREEN;
                    stateText = STATE_CONNECTED + " (" + connectedSockets + ")";
                }
            } else {
                clearSocketSet(connectorId);
                stateImage = COLOR_RED;
                stateText = STATE_DISCONNECTED;
            }
            break;
        case READER:
            stateImage = COLOR_RED;
            stateText = STATE_NOT_POLLING;
            break;
        case WRITER:
            stateImage = COLOR_RED;
            stateText = STATE_DISCONNECTED;
            break;
        case SENDER:
            stateImage = COLOR_RED;
            stateText = STATE_DISCONNECTED;
            break;
        }
        break;
    case BUSY:
        switch (type) {
        case READER:
            stateImage = COLOR_GREEN;
            stateText = STATE_READING;
            break;
        case LISTENER:
            stateImage = COLOR_GREEN;
            stateText = STATE_RECEIVING;
            break;
        case WRITER:
            stateImage = COLOR_YELLOW;
            stateText = STATE_WRITING;
            break;
        case SENDER:
            stateImage = COLOR_YELLOW;
            stateText = STATE_SENDING;
            break;
        }
        break;
    case DONE:
        switch (type) {
        case READER:
            stateImage = COLOR_YELLOW;
            stateText = STATE_IDLE;
            break;
        case LISTENER:
            if (socket != null) {
                stateImage = COLOR_GREEN;
                stateText = STATE_CONNECTED + " (" + getSocketSetCount(connectorId) + ")";
            } else {
                stateImage = COLOR_YELLOW;
                stateText = STATE_WAITING;
            }
            break;
        }
        break;
    case ATTEMPTING:
        switch (type) {
        case WRITER:
            stateImage = COLOR_YELLOW;
            stateText = STATE_ATTEMPTING;
            break;
        case SENDER:
            stateImage = COLOR_YELLOW;
            stateText = STATE_ATTEMPTING;
            break;
        }
        break;
    default:
        updateStatus = false;
        break;
    }

    if (updateStatus) {
        Timestamp timestamp = new Timestamp(System.currentTimeMillis());
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");

        String channelName = "";
        // this will be overwritten down below. If not, something's wrong.
        String connectorType = type.toString();
        String information = "";

        /*
         * check 'connectorId' - contains destination_1_connector, etc.
         * connectorId consists of id_source_connector for sources, and
         * id_destination_x_connector for destinations. i.e. tokenCount will
         * be 3 for sources and 4 for destinations. Note that READER and
         * LISTENER are sources, and WRITER and SENDER are destinations.
         */
        StringTokenizer tokenizer = new StringTokenizer(connectorId, "_");
        String channelId = tokenizer.nextToken();
        int destinationIndex;
        LinkedList<String[]> channelLog = null;

        Channel channel = ControllerFactory.getFactory().createChannelController()
                .getDeployedChannelById(channelId);

        if (channel != null) {
            channelName = channel.getName();
            // grab the channel's log from the HashMap, if not exist, create
            // one.
            if (connectorInfoLogs.containsKey(channelName)) {
                channelLog = connectorInfoLogs.get(channelName);
            } else {
                channelLog = new LinkedList<String[]>();
            }

            Connector connector = null;

            switch (type) {
            case READER:
                connectorType = "Source: " + channel.getSourceConnector().getTransportName() + "  ("
                        + channel.getSourceConnector().getTransformer().getInboundProtocol().toString() + " -> "
                        + channel.getSourceConnector().getTransformer().getOutboundProtocol().toString() + ")";
                break;
            case LISTENER:
                connectorType = "Source: " + channel.getSourceConnector().getTransportName() + "  ("
                        + channel.getSourceConnector().getTransformer().getInboundProtocol().toString() + " -> "
                        + channel.getSourceConnector().getTransformer().getOutboundProtocol().toString() + ")";
                break;
            case WRITER:
                tokenizer.nextToken();
                // destinationId begins from 1, so subtract by 1 for the
                // arrayIndex.
                destinationIndex = Integer.valueOf(tokenizer.nextToken()) - 1;
                connector = channel.getDestinationConnectors().get(destinationIndex);
                connectorType = "Destination: " + connector.getTransportName() + " - " + connector.getName();

                if (connector.getTransportName().equals(FileWriterProperties.name)) {
                    // Destination - File Writer.
                    switch (event) {
                    case BUSY:
                        information = FileWriterProperties.getInformation(connector.getProperties());
                        break;
                    }
                } else if (connector.getTransportName().equals(DatabaseWriterProperties.name)) {
                    // Destination - Database Writer.
                    information = DatabaseWriterProperties.getInformation(connector.getProperties());
                } else if (connector.getTransportName().equals(JMSWriterProperties.name)) {
                    // Destination - JMS Writer.
                    information = JMSWriterProperties.getInformation(connector.getProperties());
                } else if (connector.getTransportName().equals(DocumentWriterProperties.name)) {
                    // Destination - Document Writer.
                    information = DocumentWriterProperties.getInformation(connector.getProperties());
                }
                break;
            case SENDER:
                tokenizer.nextToken();
                // destinationId begins from 1, so subtract by 1 for the
                // arrayIndex.
                destinationIndex = Integer.valueOf(tokenizer.nextToken()) - 1;
                connector = channel.getDestinationConnectors().get(destinationIndex);
                connectorType = "Destination: " + connector.getTransportName() + " - " + connector.getName();

                if (connector.getTransportName().equals(HttpSenderProperties.name)) {
                    // Destination - HTTP Sender.
                    information = HttpSenderProperties.getInformation(connector.getProperties());
                } else if (connector.getTransportName().equals(ChannelWriterProperties.name)) {
                    // Destination - Channel Writer.
                    Channel targetChannel = ControllerFactory.getFactory().createChannelController()
                            .getDeployedChannelById(
                                    ChannelWriterProperties.getInformation(connector.getProperties()));

                    if (targetChannel == null) {
                        information = "Target Channel: None";
                    } else {
                        information = "Target Channel: " + targetChannel.getName();
                    }
                } else if (connector.getTransportName().equals(SmtpSenderProperties.name)) {
                    // Destination - SMTP Sender.
                    information = SmtpSenderProperties.getInformation(connector.getProperties());
                } else if (connector.getTransportName().equals(TCPSenderProperties.name)) {
                    // Destination - TCP Sender.
                    // The useful info for TCP Sender - host:port will
                    // be taken care of by the socket below.
                } else if (connector.getTransportName().equals(LLPSenderProperties.name)) {
                    // Destination - LLP Sender.
                    // The useful info for LLP Sender - host:port will
                    // be taken care of by the socket below.
                } else if (connector.getTransportName().equals(WebServiceSenderProperties.name)) {
                    // Destination - Web Service Sender.
                    // information = "";
                }
                break;
            }
        }

        if (socket != null) {
            String sendingAddress = socket.getLocalAddress().toString() + ":" + socket.getLocalPort();
            String receivingAddress = socket.getInetAddress().toString() + ":" + socket.getPort();

            // If addresses begin with a slash "/", remove it.
            if (sendingAddress.startsWith("/")) {
                sendingAddress = sendingAddress.substring(1);
            }

            if (receivingAddress.startsWith("/")) {
                receivingAddress = receivingAddress.substring(1);
            }

            information += "Sender: " + sendingAddress + "  Receiver: " + receivingAddress;
        }

        if (channelLog != null) {
            synchronized (this) {
                if (channelLog.size() == MAX_LOG_SIZE) {
                    channelLog.removeLast();
                }
                channelLog.addFirst(new String[] { String.valueOf(logId), channelName,
                        dateFormat.format(timestamp), connectorType, event.toString(), information });

                if (entireConnectorInfoLogs.size() == MAX_LOG_SIZE) {
                    entireConnectorInfoLogs.removeLast();
                }
                entireConnectorInfoLogs.addFirst(new String[] { String.valueOf(logId), channelName,
                        dateFormat.format(timestamp), connectorType, event.toString(), information });

                logId++;

                // put the channel log into the HashMap.
                connectorInfoLogs.put(channelName, channelLog);
            }
        }

        connectorStateMap.put(connectorId, new String[] { stateImage, stateText });
    }
}

From source file:com.cablelabs.sim.PCSim2.java

/**
 * Main thread simply looks for notification that the
 * test is complete, informs the various protocol stacks
 * to shutdown and then terminates the test.
 *
 *//*from w  ww  .ja v  a 2  s.  c om*/
public void run() {
    mainThread = Thread.currentThread();
    // GAREY test code       int count = 0;
    while (!shutdown) {
        // First determine if there are any tests to conduct
        boolean configsToProcess = false;
        synchronized (dutConfigsToRead) {
            synchronized (dutConfigsToRemove) {
                if (dutConfigsToRead.size() > 0 || dutConfigsToRemove.size() > 0) {
                    configsToProcess = true;
                }
            }
        }

        if (!configsToProcess && closeBatchFile) {
            if (ss != null) {
                ss.closeBatch();

            }
            if (stacks != null) {
                stacks.shutdown();
            }
            closeBatchFile = false;
            platformSettingsFile = null;
            if (globalRegEnabled) {
                globalRegFile = null;
                GlobalRegistrar.setMasterFSM(null, Transport.UDP);
                globalRegEnabled = false;
            }
            if (presenceServerEnabled) {
                presenceServerFile = null;
                presenceServerEnabled = false;
            }
        }
        // Next see if we are ready to run some test pairs
        // This can only be done if there are no dutConfigs to
        // process in add or remove lists
        else if (dutConfigFiles.size() > 0 && testScriptFiles.size() > 0 && !configsToProcess
                && platformSettingsFile != null) {
            try {
                if (dutPrimary) {

                    ListIterator<String> duts = dutConfigFiles.listIterator();
                    while (duts.hasNext() && !shutdown) {
                        activeDUTFile = duts.next();
                        ListIterator<String> testScripts = testScriptFiles.listIterator();
                        while (testScripts.hasNext() && !shutdown) {
                            activeTestScriptFile = testScripts.next();
                            executeTest();
                        }
                    }
                } else {
                    ListIterator<String> testScripts = testScriptFiles.listIterator();
                    while (testScripts.hasNext() && !shutdown) {
                        activeTestScriptFile = testScripts.next();
                        ListIterator<String> duts = dutConfigFiles.listIterator();
                        while (duts.hasNext() && !shutdown) {
                            activeDUTFile = duts.next();
                            executeTest();
                        }
                    }
                }
                testsComplete();
            }
            // This most likely will happen if the user stop's the tests. When the 
            // user terminates the test, the lists are emptied so that no record is made for 
            // unattempted test pairs.
            catch (ConcurrentModificationException cme) {
                logger.debug(PC2LogCategory.PCSim2, subCat,
                        "Either DUT or Test Script list have changed during test pair execution.");
            }
        } else if (pendingPSFile != null) {
            boolean restart = false;
            // Determine if we need to restart the existing stacks and 
            // configuration parameters of the platform.
            if (platformSettingsFile == null)
                restart = true;
            else if (platformSettingsFile != null) {
                // First we need to remove any UEs that are not being simulated from the
                // table of allowable registering devices.
                Enumeration<String> keys = SystemSettings.getPlatformLabels();
                if (keys != null) {
                    while (keys.hasMoreElements()) {
                        String key = keys.nextElement();
                        if (key.startsWith("UE")) {
                            Properties p = SystemSettings.getSettings(key);
                            LinkedList<String> puis = createRegistrarLabels(p);
                            Stacks.removeSIPRegistrarClient(key, puis);
                        }
                    }
                }
                if (!pendingPSFile.equals(platformSettingsFile))
                    restart = true;
                else if (psLastModified < (new File(platformSettingsFile)).lastModified())
                    restart = true;
            }
            if (restart && stacks != null)
                stacks.restart();
            platformSettingsFile = pendingPSFile;
            pendingPSFile = null;
            File ps = new File(platformSettingsFile);
            psLastModified = ps.lastModified();
            if (!ss.loadPlatformSettings(platformSettingsFile)) {
                logger.fatal(PC2LogCategory.Parser, subCat,
                        "PCSim2 encountered error while trying to read the Platform Settings information.");
                // Clear the file information
                platformSettingsFile = null;
            } else {
                Enumeration<String> labels = SystemSettings.getPlatformLabels();
                if (labels != null) {
                    while (labels.hasMoreElements()) {
                        String ne = labels.nextElement();
                        if (!ne.startsWith(SettingConstants.UE) && !ne.startsWith(SettingConstants.PCSCF)
                                && !ne.startsWith(SettingConstants.SCSCF))
                            continue;
                        Properties p = SystemSettings.getSettings(ne);
                        logNE(ne, p);
                    }
                }

                if (restart) {
                    logger.info(PC2LogCategory.PCSim2, subCat, "Starting servers.");
                    startServers();
                }

            }

            // Next reload the provisioning test script/policy/provisioning file table
            if (platformSettingsFile != null) {
                Properties platform = SystemSettings.getSettings(SettingConstants.PLATFORM);
                String cw = platform.getProperty(SettingConstants.CW_NUMBER);
                if (provDB == null)
                    provDB = new ProvDatabase(cw);
                else
                    provDB.load(cw);
            }

            // Now add all of the real devices in the platform settings to the 
            // allowable registering devices table.
            addRegistrarClients();
        }

        else {
            try {
                if (configsToProcess) {
                    synchronized (dutConfigsToRead) {

                        synchronized (dutConfigsToRemove) {
                            if (dutConfigsToRead.size() > 0 || dutConfigsToRemove.size() > 0) {
                                ListIterator<File> rmIter = dutConfigsToRemove.listIterator();
                                // Loop through the reads 
                                File read = null;
                                if (dutConfigsToRead.size() > 0)
                                    read = dutConfigsToRead.removeFirst();
                                while (read != null) {
                                    int prevRmIndex = -1;
                                    // Make sure the read doesn't also appear in the 
                                    // remove list
                                    while (rmIter.hasNext()) {
                                        File rm = rmIter.next();
                                        if (rm.equals(read)) {
                                            prevRmIndex = rmIter.previousIndex();

                                        }
                                    }
                                    // If the file appears in the remove list at the
                                    // same time we try to read, simply don't read
                                    // and remove from the remove list
                                    if (prevRmIndex != -1) {
                                        dutConfigsToRemove.remove(prevRmIndex);
                                        logger.warn(PC2LogCategory.Parser, subCat, "Skipping reading "
                                                + read.getName()
                                                + " because file was also found in DUT Config remove list.");
                                    } else {
                                        try {
                                            // Load the read file
                                            String neLabel = ss.loadDUTSettings(read.getAbsolutePath(), true,
                                                    false);
                                            if (neLabel != null && neLabel.startsWith("UE")) {
                                                // Now obtains the DUT's IP address and the expected IP address for
                                                // it to register with
                                                Properties p = SystemSettings.getSettings(neLabel);
                                                if (p != null) {
                                                    logNE(neLabel, p);

                                                    LinkedList<String> puis = createRegistrarLabels(p);
                                                    if (puis.size() > 0) {
                                                        Stacks.addSIPRegistrarClient(neLabel, puis);
                                                        // With the new design of using Public User Identifier we will need to
                                                        // use the first entry in the puis as the key for the table
                                                        //                                             dutConfigFileToPUIIndex.put(read, puis.get(0));
                                                        if (SystemSettings.getBooleanSetting(
                                                                SettingConstants.GLOBAL_REGISTRAR)) {
                                                            logger.info(PC2LogCategory.Parser, subCat,
                                                                    "Loaded " + read.getName()
                                                                            + " for global registrar.");
                                                        } else
                                                            logger.info(PC2LogCategory.Parser, subCat, read
                                                                    .getName()
                                                                    + " not loaded for global registrar because registrar is disabled.");
                                                    } else {
                                                        logger.error(PC2LogCategory.Parser, subCat,
                                                                "The DUT configuration file appears to not contain any Public User Identitier.");
                                                    }
                                                } else {
                                                    logger.warn(PC2LogCategory.Parser, subCat, "Failed to load "
                                                            + read.getName() + " for global registrar.");
                                                }
                                            } else if (neLabel != null && neLabel.startsWith("CN")) {
                                                // Since the CN could contain the PCSCF that real UEs
                                                // need to register, temporarily load the file's 
                                                // settings, add the clients and then remove them
                                                ss.setDUTProperties(read.getAbsolutePath());
                                                addRegistrarClients();
                                                ss.reset();
                                            } else {
                                                logger.info(PC2LogCategory.Parser, subCat,
                                                        "No elements added for global register for label "
                                                                + neLabel + " from file " + read.getName()
                                                                + ".");
                                            }
                                        } catch (Exception e) {
                                            logger.error(PC2LogCategory.PCSim2, subCat,
                                                    "The DUT Configuration File defined by ("
                                                            + read.getAbsolutePath()
                                                            + ") could not be processed. File is being dropped.");
                                        }
                                    }
                                    read = null;
                                    if (dutConfigsToRead.size() > 0)
                                        read = dutConfigsToRead.removeFirst();
                                }

                                File rm = null;
                                if (dutConfigsToRemove.size() > 0)
                                    rm = dutConfigsToRemove.removeFirst();
                                while (rm != null) {
                                    try {
                                        String neLabel = ss.loadDUTSettings(rm.getAbsolutePath(), true, true);
                                        if (neLabel != null && neLabel.startsWith("UE")) {
                                            Properties p = SystemSettings.getSettings(neLabel);
                                            LinkedList<String> puis = createRegistrarLabels(p);
                                            Stacks.removeSIPRegistrarClient(neLabel, puis);
                                            logger.info(PC2LogCategory.Parser, subCat,
                                                    "removing client defined by " + rm.getName()
                                                            + " to list of accepted clients for global registrar");
                                        }
                                    } catch (Exception e) {
                                        String err = "Simulator failed to sleep. Terminating test.";
                                        logger.fatal(PC2LogCategory.Parser, subCat, err, e);
                                    }
                                    rm = null;
                                    if (dutConfigsToRemove.size() > 0)
                                        rm = dutConfigsToRemove.removeFirst();
                                }
                                dutConfigsToRead.clear();
                                dutConfigsToRemove.clear();
                            }
                        }
                    }
                } else {
                    // Since there are aren't any dut and test script
                    // files we can simply go to sleep and check again 
                    // later for any work.
                    Thread.sleep(250);
                }

            } catch (InterruptedException ie) {
                String msg = "Simulator sleep interrupted.";
                logger.info(PC2LogCategory.Parser, subCat, msg);
            } catch (Exception e) {
                String err = "Simulator failed to sleep. Terminating test.";
                logger.fatal(PC2LogCategory.Parser, subCat, err, e);
            }
        }
    }
    LogAPI.shutdown();
}

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

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

        vboxMenuAdd = new CFVBox(10);
        buttonAddUuidType = new CFButton();
        buttonAddUuidType.setMinWidth(200);
        buttonAddUuidType.setText("Add UuidType");
        buttonAddUuidType.setOnAction(new EventHandler<ActionEvent>() {
            @Override// w  w  w.j a  va  2 s  . c  om
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamUuidTypeObj obj = (ICFBamUuidTypeObj) schemaObj.getUuidTypeTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getUuidTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamUuidTypeEditObj edit = (ICFBamUuidTypeEditObj) (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);
                    ICFBamJavaFXUuidTypePaneCommon jpanelCommon = (ICFBamJavaFXUuidTypePaneCommon) 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(buttonAddUuidType);
        }
        buttonAddUuidGen = new CFButton();
        buttonAddUuidGen.setMinWidth(200);
        buttonAddUuidGen.setText("Add UuidGen");
        buttonAddUuidGen.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamUuidGenObj obj = (ICFBamUuidGenObj) schemaObj.getUuidGenTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getUuidGenFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamUuidGenEditObj edit = (ICFBamUuidGenEditObj) (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);
                    ICFBamJavaFXUuidGenPaneCommon jpanelCommon = (ICFBamJavaFXUuidGenPaneCommon) 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(buttonAddUuidGen);
        }
        buttonAddUuidCol = new CFButton();
        buttonAddUuidCol.setMinWidth(200);
        buttonAddUuidCol.setText("Add UuidCol");
        buttonAddUuidCol.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamUuidColObj obj = (ICFBamUuidColObj) schemaObj.getUuidColTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getUuidColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamUuidColEditObj edit = (ICFBamUuidColEditObj) (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);
                    ICFBamJavaFXUuidColPaneCommon jpanelCommon = (ICFBamJavaFXUuidColPaneCommon) 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(buttonAddUuidCol);
        }

        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");
                    }
                    ICFBamUuidDefObj selectedInstance = getJavaFXFocusAsUuidDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("UIDD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDT".equals(classCode)) {
                            ICFBamUuidTypeObj obj = (ICFBamUuidTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IGUU".equals(classCode)) {
                            ICFBamUuidGenObj obj = (ICFBamUuidGenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidGenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDC".equals(classCode)) {
                            ICFBamUuidColObj obj = (ICFBamUuidColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamUuidDefObj, ICFBamUuidTypeObj, ICFBamUuidGenObj, ICFBamUuidColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamUuidDefObj selectedInstance = getJavaFXFocusAsUuidDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("UIDD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDT".equals(classCode)) {
                            ICFBamUuidTypeObj obj = (ICFBamUuidTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("IGUU".equals(classCode)) {
                            ICFBamUuidGenObj obj = (ICFBamUuidGenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidGenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDC".equals(classCode)) {
                            ICFBamUuidColObj obj = (ICFBamUuidColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamUuidDefObj, ICFBamUuidTypeObj, ICFBamUuidGenObj, ICFBamUuidColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamUuidDefObj selectedInstance = getJavaFXFocusAsUuidDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("UIDD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidDefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXUuidDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDT".equals(classCode)) {
                            ICFBamUuidTypeObj obj = (ICFBamUuidTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidTypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXUuidTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IGUU".equals(classCode)) {
                            ICFBamUuidGenObj obj = (ICFBamUuidGenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidGenFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDC".equals(classCode)) {
                            ICFBamUuidColObj obj = (ICFBamUuidColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXUuidColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamUuidDefObj, ICFBamUuidTypeObj, ICFBamUuidGenObj, ICFBamUuidColObj");
                        }
                    }
                } 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.CFBamJavaFXInt32DefListPane.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  a  va  2  s .  c o  m
            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);
        }
        buttonAddInt32Col = new CFButton();
        buttonAddInt32Col.setMinWidth(200);
        buttonAddInt32Col.setText("Add Int32Col");
        buttonAddInt32Col.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamInt32ColObj obj = (ICFBamInt32ColObj) schemaObj.getInt32ColTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getInt32ColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamInt32ColEditObj edit = (ICFBamInt32ColEditObj) (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);
                    ICFBamJavaFXInt32ColPaneCommon jpanelCommon = (ICFBamJavaFXInt32ColPaneCommon) 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(buttonAddInt32Col);
        }

        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");
                    }
                    ICFBamInt32DefObj selectedInstance = getJavaFXFocusAsInt32Def();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I32D".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt32DefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt32DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("I32T".equals(classCode)) {
                            ICFBamInt32TypeObj obj = (ICFBamInt32TypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt32TypeFactory()
                                    .newViewEditForm(cfFormManager, obj, 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 if ("I32C".equals(classCode)) {
                            ICFBamInt32ColObj obj = (ICFBamInt32ColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt32ColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt32ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt32DefObj, ICFBamInt32TypeObj, ICFBamId32GenObj, ICFBamInt32ColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamInt32DefObj selectedInstance = getJavaFXFocusAsInt32Def();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I32D".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt32DefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt32DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("I32T".equals(classCode)) {
                            ICFBamInt32TypeObj obj = (ICFBamInt32TypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt32TypeFactory()
                                    .newViewEditForm(cfFormManager, obj, 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.View);
                            cfFormManager.pushForm(frame);
                        } else if ("I32C".equals(classCode)) {
                            ICFBamInt32ColObj obj = (ICFBamInt32ColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt32ColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt32ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt32DefObj, ICFBamInt32TypeObj, ICFBamId32GenObj, ICFBamInt32ColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamInt32DefObj selectedInstance = getJavaFXFocusAsInt32Def();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I32D".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt32DefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXInt32DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("I32T".equals(classCode)) {
                            ICFBamInt32TypeObj obj = (ICFBamInt32TypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt32TypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, 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 if ("I32C".equals(classCode)) {
                            ICFBamInt32ColObj obj = (ICFBamInt32ColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt32ColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXInt32ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt32DefObj, ICFBamInt32TypeObj, ICFBamId32GenObj, ICFBamInt32ColObj");
                        }
                    }
                } 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.CFBamJavaFXInt64DefListPane.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//from   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();
                    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);
        }
        buttonAddInt64Col = new CFButton();
        buttonAddInt64Col.setMinWidth(200);
        buttonAddInt64Col.setText("Add Int64Col");
        buttonAddInt64Col.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamInt64ColObj obj = (ICFBamInt64ColObj) schemaObj.getInt64ColTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getInt64ColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamInt64ColEditObj edit = (ICFBamInt64ColEditObj) (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);
                    ICFBamJavaFXInt64ColPaneCommon jpanelCommon = (ICFBamJavaFXInt64ColPaneCommon) 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(buttonAddInt64Col);
        }

        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");
                    }
                    ICFBamInt64DefObj selectedInstance = getJavaFXFocusAsInt64Def();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I64D".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt64DefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt64DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("I64T".equals(classCode)) {
                            ICFBamInt64TypeObj obj = (ICFBamInt64TypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt64TypeFactory()
                                    .newViewEditForm(cfFormManager, obj, 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 if ("I64C".equals(classCode)) {
                            ICFBamInt64ColObj obj = (ICFBamInt64ColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt64ColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt64ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt64DefObj, ICFBamInt64TypeObj, ICFBamId64GenObj, ICFBamInt64ColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamInt64DefObj selectedInstance = getJavaFXFocusAsInt64Def();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I64D".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt64DefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt64DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("I64T".equals(classCode)) {
                            ICFBamInt64TypeObj obj = (ICFBamInt64TypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt64TypeFactory()
                                    .newViewEditForm(cfFormManager, obj, 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.View);
                            cfFormManager.pushForm(frame);
                        } else if ("I64C".equals(classCode)) {
                            ICFBamInt64ColObj obj = (ICFBamInt64ColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt64ColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt64ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt64DefObj, ICFBamInt64TypeObj, ICFBamId64GenObj, ICFBamInt64ColObj");
                        }
                    }
                } 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");
                    }
                    ICFBamInt64DefObj selectedInstance = getJavaFXFocusAsInt64Def();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I64D".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt64DefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXInt64DefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("I64T".equals(classCode)) {
                            ICFBamInt64TypeObj obj = (ICFBamInt64TypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt64TypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, 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 if ("I64C".equals(classCode)) {
                            ICFBamInt64ColObj obj = (ICFBamInt64ColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getInt64ColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXInt64ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamInt64DefObj, ICFBamInt64TypeObj, ICFBamId64GenObj, ICFBamInt64ColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonDeleteSelected);

    }
    return (hboxMenu);
}

From source file:org.openscience.cdk.applications.taverna.weka.regression.EvaluateRegressionResultsAsPDFActivity.java

@Override
public void work() throws Exception {
    // Get input/* w w  w.  j  a va2 s  .c om*/
    String[] options = ((String) this.getConfiguration()
            .getAdditionalProperty(CDKTavernaConstants.PROPERTY_SCATTER_PLOT_OPTIONS)).split(";");
    List<File> modelFiles = this.getInputAsFileList(this.INPUT_PORTS[0]);
    List<Instances> trainDatasets = this.getInputAsList(this.INPUT_PORTS[1], Instances.class);
    List<Instances> testDatasets = null;
    if (options[0].equals("" + TEST_TRAININGSET_PORT)) {
        testDatasets = this.getInputAsList(this.INPUT_PORTS[2], Instances.class);
    } else {
        testDatasets = null;
    }
    String directory = modelFiles.get(0).getParent();

    // Do work
    ArrayList<String> resultFiles = new ArrayList<String>();
    HashMap<UUID, Double> orgClassMap = new HashMap<UUID, Double>();
    HashMap<UUID, Double> calcClassMap = new HashMap<UUID, Double>();
    WekaTools tools = new WekaTools();
    ChartTool chartTool = new ChartTool();
    List<Object> rmseCharts = new ArrayList<Object>();
    List<Double> trainMeanRMSE = new ArrayList<Double>();
    List<Double> testMeanRMSE = new ArrayList<Double>();
    List<Double> cvMeanRMSE = new ArrayList<Double>();
    DefaultCategoryDataset[] ratioRMSESet = new DefaultCategoryDataset[trainDatasets.size()];
    for (int i = 0; i < trainDatasets.size(); i++) {
        ratioRMSESet[i] = new DefaultCategoryDataset();
    }
    List<Double> trainingSetRatios = null;
    int fileIDX = 1;
    while (!modelFiles.isEmpty()) {
        trainingSetRatios = new ArrayList<Double>();
        List<Double> trainRMSE = new ArrayList<Double>();
        HashSet<Integer> trainSkippedRMSE = new HashSet<Integer>();
        List<Double> testRMSE = new ArrayList<Double>();
        HashSet<Integer> testSkippedRMSE = new HashSet<Integer>();
        List<Double> cvRMSE = new ArrayList<Double>();
        HashSet<Integer> cvSkippedRMSE = new HashSet<Integer>();
        List<Object> chartsObjects = new LinkedList<Object>();
        File modelFile = null;
        Classifier classifier = null;
        String name = "";
        for (int j = 0; j < trainDatasets.size(); j++) {
            LinkedList<Double> predictedValues = new LinkedList<Double>();
            LinkedList<Double> orgValues = new LinkedList<Double>();
            LinkedList<Double[]> yResidueValues = new LinkedList<Double[]>();
            LinkedList<String> yResidueNames = new LinkedList<String>();
            if (modelFiles.isEmpty()) {
                break;
            }
            calcClassMap.clear();
            modelFile = modelFiles.remove(0);
            classifier = (Classifier) SerializationHelper.read(modelFile.getPath());
            Instances testset = null;
            if (testDatasets != null) {
                testset = testDatasets.get(j);
            }
            name = classifier.getClass().getSimpleName();
            String sum = "Method: " + name + " " + tools.getOptionsFromFile(modelFile, name) + "\n\n";
            // Produce training set data
            Instances trainset = trainDatasets.get(j);
            Instances trainUUIDSet = Filter.useFilter(trainset, tools.getIDGetter(trainset));
            trainset = Filter.useFilter(trainset, tools.getIDRemover(trainset));
            double trainingSetRatio = 1.0;
            if (testset != null) {
                trainingSetRatio = trainset.numInstances()
                        / (double) (trainset.numInstances() + testset.numInstances());
            }
            trainingSetRatios.add(trainingSetRatio * 100);
            // Predict
            for (int k = 0; k < trainset.numInstances(); k++) {
                UUID uuid = UUID.fromString(trainUUIDSet.instance(k).stringValue(0));
                orgClassMap.put(uuid, trainset.instance(k).classValue());
                calcClassMap.put(uuid, classifier.classifyInstance(trainset.instance(k)));
            }
            // Evaluate
            Evaluation trainEval = new Evaluation(trainset);
            trainEval.evaluateModel(classifier, trainset);
            // Chart data
            DefaultXYDataset xyDataSet = new DefaultXYDataset();
            String trainSeries = "Training Set (RMSE: "
                    + String.format("%.2f", trainEval.rootMeanSquaredError()) + ")";
            XYSeries series = new XYSeries(trainSeries);
            Double[] yTrainResidues = new Double[trainUUIDSet.numInstances()];
            Double[] orgTrain = new Double[trainUUIDSet.numInstances()];
            Double[] calc = new Double[trainUUIDSet.numInstances()];
            for (int k = 0; k < trainUUIDSet.numInstances(); k++) {
                UUID uuid = UUID.fromString(trainUUIDSet.instance(k).stringValue(0));
                orgTrain[k] = orgClassMap.get(uuid);
                calc[k] = calcClassMap.get(uuid);
                if (calc[k] != null && orgTrain[k] != null) {
                    series.add(orgTrain[k].doubleValue(), calc[k]);
                    yTrainResidues[k] = calc[k].doubleValue() - orgTrain[k].doubleValue();
                } else {
                    ErrorLogger.getInstance().writeError("Can't find value for UUID: " + uuid.toString(),
                            this.getActivityName());
                    throw new CDKTavernaException(this.getActivityName(),
                            "Can't find value for UUID: " + uuid.toString());
                }
            }
            orgValues.addAll(Arrays.asList(orgTrain));
            predictedValues.addAll(Arrays.asList(calc));
            CollectionUtilities.sortTwoArrays(orgTrain, yTrainResidues);
            yResidueValues.add(yTrainResidues);
            yResidueNames.add(trainSeries);
            xyDataSet.addSeries(trainSeries, series.toArray());

            // Summary
            sum += "Training Set:\n";
            if (trainEval.rootRelativeSquaredError() > 300) {
                trainSkippedRMSE.add(j);
            }
            trainRMSE.add(trainEval.rootMeanSquaredError());
            sum += trainEval.toSummaryString(true);
            // Produce test set data
            if (testset != null) {
                Instances testUUIDSet = Filter.useFilter(testset, tools.getIDGetter(testset));
                testset = Filter.useFilter(testset, tools.getIDRemover(testset));
                // Predict
                for (int k = 0; k < testset.numInstances(); k++) {
                    UUID uuid = UUID.fromString(testUUIDSet.instance(k).stringValue(0));
                    orgClassMap.put(uuid, testset.instance(k).classValue());
                    calcClassMap.put(uuid, classifier.classifyInstance(testset.instance(k)));
                }
                // Evaluate
                Evaluation testEval = new Evaluation(testset);
                testEval.evaluateModel(classifier, testset);
                // Chart data
                String testSeries = "Test Set (RMSE: " + String.format("%.2f", testEval.rootMeanSquaredError())
                        + ")";
                series = new XYSeries(testSeries);
                Double[] yTestResidues = new Double[testUUIDSet.numInstances()];
                Double[] orgTest = new Double[testUUIDSet.numInstances()];
                calc = new Double[testUUIDSet.numInstances()];
                for (int k = 0; k < testUUIDSet.numInstances(); k++) {
                    UUID uuid = UUID.fromString(testUUIDSet.instance(k).stringValue(0));
                    orgTest[k] = orgClassMap.get(uuid);
                    calc[k] = calcClassMap.get(uuid);
                    if (calc[k] != null && orgTest[k] != null) {
                        series.add(orgTest[k].doubleValue(), calc[k].doubleValue());
                        yTestResidues[k] = calc[k].doubleValue() - orgTest[k].doubleValue();
                    } else {
                        ErrorLogger.getInstance().writeError("Can't find value for UUID: " + uuid.toString(),
                                this.getActivityName());
                        throw new CDKTavernaException(this.getActivityName(),
                                "Can't find value for UUID: " + uuid.toString());
                    }
                }
                orgValues.addAll(Arrays.asList(orgTest));
                predictedValues.addAll(Arrays.asList(calc));
                CollectionUtilities.sortTwoArrays(orgTest, yTestResidues);
                yResidueValues.add(yTestResidues);
                yResidueNames.add(testSeries);
                xyDataSet.addSeries(testSeries, series.toArray());
                // Create summary
                sum += "\nTest Set:\n";
                if (testEval.rootRelativeSquaredError() > 300) {
                    testSkippedRMSE.add(j);
                }
                testRMSE.add(testEval.rootMeanSquaredError());
                sum += testEval.toSummaryString(true);
            }
            // Produce cross validation data
            if (Boolean.parseBoolean(options[1])) {
                Evaluation cvEval = new Evaluation(trainset);
                if (testset != null) {
                    Instances fullSet = tools.getFullSet(trainset, testset);
                    cvEval.crossValidateModel(classifier, fullSet, 10, new Random(1));
                } else {
                    cvEval.crossValidateModel(classifier, trainset, 10, new Random(1));
                }
                sum += "\n10-fold cross-validation:\n";
                if (cvEval.rootRelativeSquaredError() > 300) {
                    cvSkippedRMSE.add(j);
                }
                cvRMSE.add(cvEval.rootMeanSquaredError());
                sum += cvEval.toSummaryString(true);
            }

            // Create scatter plot
            String header = classifier.getClass().getSimpleName() + "\n Training set ratio: "
                    + String.format("%.2f", trainingSetRatios.get(j)) + "%" + "\n Model name: "
                    + modelFile.getName();
            chartsObjects
                    .add(chartTool.createScatterPlot(xyDataSet, header, "Original values", "Predicted values"));
            // Create residue plot
            chartsObjects.add(chartTool.createResiduePlot(yResidueValues, header, "Index",
                    "(Predicted - Original)", yResidueNames));
            // Create curve
            Double[] tmpOrg = new Double[orgValues.size()];
            tmpOrg = orgValues.toArray(tmpOrg);
            Double[] tmpPred = new Double[predictedValues.size()];
            tmpPred = predictedValues.toArray(tmpPred);
            CollectionUtilities.sortTwoArrays(tmpOrg, tmpPred);
            DefaultXYDataset dataSet = new DefaultXYDataset();
            String orgName = "Original";
            XYSeries orgSeries = new XYSeries(orgName);
            String predName = "Predicted";
            XYSeries predSeries = new XYSeries(predName);
            for (int k = 0; k < tmpOrg.length; k++) {
                orgSeries.add((k + 1), tmpOrg[k]);
                predSeries.add((k + 1), tmpPred[k]);
            }
            dataSet.addSeries(orgName, orgSeries.toArray());
            dataSet.addSeries(predName, predSeries.toArray());
            chartsObjects.add(chartTool.createXYLineChart(header, "Index", "Value", dataSet, true, false));
            // Add summary
            chartsObjects.add(sum);
        }
        // Create RMSE Plot
        DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
        double meanRMSE = 0;
        for (int i = 0; i < trainRMSE.size(); i++) {
            if (!trainSkippedRMSE.contains(i)) {
                dataSet.addValue(trainRMSE.get(i), "Training Set",
                        "(" + String.format("%.2f", trainingSetRatios.get(i)) + "%/" + (i + 1) + ")");
                ratioRMSESet[i].addValue(trainRMSE.get(i), "Training Set",
                        "(" + String.format("%.2f", trainingSetRatios.get(i)) + "%/" + (i + 1) + "/" + fileIDX
                                + ")");
            }
            meanRMSE += trainRMSE.get(i);
        }
        trainMeanRMSE.add(meanRMSE / trainRMSE.size());
        meanRMSE = 0;
        if (!testRMSE.isEmpty()) {
            for (int i = 0; i < testRMSE.size(); i++) {
                if (!testSkippedRMSE.contains(i)) {
                    dataSet.addValue(testRMSE.get(i), "Test Set",
                            "(" + String.format("%.2f", trainingSetRatios.get(i)) + "%/" + (i + 1) + ")");
                    ratioRMSESet[i].addValue(testRMSE.get(i), "Test Set",
                            "(" + String.format("%.2f", trainingSetRatios.get(i)) + "%/" + (i + 1) + "/"
                                    + fileIDX + ")");
                }
                meanRMSE += testRMSE.get(i);
            }
            testMeanRMSE.add(meanRMSE / testRMSE.size());
        }
        meanRMSE = 0;
        if (!cvRMSE.isEmpty()) {
            for (int i = 0; i < cvRMSE.size(); i++) {
                if (!cvSkippedRMSE.contains(i)) {
                    dataSet.addValue(cvRMSE.get(i), "10-fold Cross-validation",
                            "(" + String.format("%.2f", trainingSetRatios.get(i)) + "%/" + (i + 1) + ")");
                    ratioRMSESet[i].addValue(cvRMSE.get(i), "10-fold Cross-validation",
                            "(" + String.format("%.2f", trainingSetRatios.get(i)) + "%/" + (i + 1) + "/"
                                    + fileIDX + ")");
                }
                meanRMSE += cvRMSE.get(i);
            }
            cvMeanRMSE.add(meanRMSE / cvRMSE.size());
        }
        JFreeChart rmseChart = chartTool.createLineChart(
                "RMSE Plot\n Classifier:" + name + " " + tools.getOptionsFromFile(modelFile, name),
                "(Training set ratio/Set Index/File index)", "RMSE", dataSet, false, true);
        chartsObjects.add(rmseChart);
        rmseCharts.add(rmseChart);
        // Write PDF
        File file = FileNameGenerator.getNewFile(directory, ".pdf", "ScatterPlot");
        chartTool.writeChartAsPDF(file, chartsObjects);
        resultFiles.add(file.getPath());
        fileIDX++;
    }
    // Create set ratio RMSE plots
    for (int i = 0; i < ratioRMSESet.length; i++) {
        JFreeChart rmseChart = chartTool
                .createLineChart(
                        "Set RMSE plot\n" + "(" + String.format("%.2f", trainingSetRatios.get(i)) + "%/"
                                + (i + 1) + ")",
                        "(Training set ratio/Index)", "RMSE", ratioRMSESet[i], false, true);
        rmseCharts.add(rmseChart);
    }
    // Create mean RMSE plot
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
    for (int i = 0; i < trainMeanRMSE.size(); i++) {
        dataSet.addValue(trainMeanRMSE.get(i), "Training Set", "" + (i + 1));
    }
    for (int i = 0; i < testMeanRMSE.size(); i++) {
        dataSet.addValue(testMeanRMSE.get(i), "Test Set", "" + (i + 1));
    }
    for (int i = 0; i < cvMeanRMSE.size(); i++) {
        dataSet.addValue(cvMeanRMSE.get(i), "10-fold Cross-validation", "" + (i + 1));
    }
    JFreeChart rmseChart = chartTool.createLineChart("RMSE Mean Plot", "Dataset number", "Mean RMSE", dataSet);
    rmseCharts.add(rmseChart);
    File file = FileNameGenerator.getNewFile(directory, ".pdf", "RMSE-Sum");
    chartTool.writeChartAsPDF(file, rmseCharts);
    resultFiles.add(file.getPath());
    // Set output
    this.setOutputAsStringList(resultFiles, this.OUTPUT_PORTS[0]);
}

From source file:com.peterbochs.PeterBochsDebugger.java

private void jLoadBreakpointButtonActionPerformed(ActionEvent evt) {
    if (jLoadBreakpointButton.getEventSource() == loadElfMenuItem) {
        JFileChooser fc = new JFileChooser(new File("."));
        int returnVal = fc.showOpenDialog(this);

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            sourceLevelDebugger.loadELF(file, null, 0);
        }/*from w  ww.  j av a 2  s  .  co m*/
    } else {
        jLoadBreakpointButton.setEnabled(false);
        LinkedList<Breakpoint> vector = Setting.getInstance().getBreakpoint();
        try {
            for (int x = 0; x < vector.size(); x++) {
                boolean match = false;
                for (int y = 0; y < this.breakpointTable.getRowCount(); y++) {
                    if (vector.get(x).getAddress().trim()
                            .equals(breakpointTable.getValueAt(y, 2).toString().trim())) {
                        match = true;
                        break;
                    }
                }
                if (!match) {
                    if (vector.get(x).getType().contains("pbreakpoint")) {
                        sendCommand("pb " + vector.get(x).getAddress());
                    } else {
                        sendCommand("lb " + vector.get(x).getAddress());
                    }
                    if (vector.get(x).getEnable().trim().equals("keep n")) {
                        sendCommand("bpd " + (x + 1));
                    }
                }
            }
        } catch (Exception e) {
            if (Global.debug) {
                e.printStackTrace();
            }
        }
        updateBreakpoint();
        updateBreakpointTableColor();
        jLoadBreakpointButton.setEnabled(true);
    }
}

From source file:com.lp.server.fertigung.ejbfac.FertigungFacBean.java

public void pruefePositionenMitSollsatzgroesseUnterschreitung(Integer losIId, BigDecimal bdZuErledigendeMenge,
        TheClientDto theClientDto) throws EJBExceptionLP {

    // Basis fuer die Sollsatzgroesse sind die bisher erledigte Menge und
    // die zu erledigende
    BigDecimal bdKuenftigErledigt = getErledigteMenge(losIId, theClientDto).add(bdZuErledigendeMenge);
    LosDto losDto = losFindByPrimaryKey(losIId);
    // es sollte von jeder Position ein prozentueller Anteil ausgegeben sein
    // der prozentsatz wird durch die kuenftig erl. Menge im Verhaeltnis zur
    // Losgroesse bestimmt
    BigDecimal bdFaktor = bdKuenftigErledigt.divide(losDto.getNLosgroesse(), 10, BigDecimal.ROUND_HALF_EVEN);
    // alle Positionen holen
    LossollmaterialDto[] sollmat = lossollmaterialFindByLosIId(losIId);
    LinkedList<LossollmaterialDto> listUnterschritten = new LinkedList<LossollmaterialDto>();
    // fuer jede einzelne soll- und istmenge vergleichen
    for (int i = 0; i < sollmat.length; i++) {
        // bisher ausgegebene Menge
        BigDecimal bdAusgegeben = getAusgegebeneMenge(sollmat[i].getIId(), null, theClientDto);
        // Die soll-ausgabe menge berechnen
        BigDecimal bdSollAusgabeMenge = Helper.rundeKaufmaennisch(sollmat[i].getNMenge().multiply(bdFaktor), 3);
        if (bdSollAusgabeMenge.compareTo(bdAusgegeben) > 0) {
            // Wenn die soll-ausgabe-menge noch nicht erreicht ist, dann zur
            // Liste hinzufuegen
            listUnterschritten.add(sollmat[i]);
        }//  w w  w  .  ja va 2  s.c om
    }
    // und jetzt noch ein Array aus der Liste bauen
    LossollmaterialDto[] sollmatUnterschritten = new LossollmaterialDto[listUnterschritten.size()];
    int i = 0;
    for (Iterator<?> iter = listUnterschritten.iterator(); iter.hasNext(); i++) {
        sollmatUnterschritten[i] = (LossollmaterialDto) iter.next();
    }

    if (sollmatUnterschritten.length > 0) {

        StringBuffer sText = new StringBuffer(getTextRespectUISpr("fert.sollsatzgroesseunterschritten",
                theClientDto.getMandant(), theClientDto.getLocUi()));

        String stkl = getTextRespectUISpr("lp.stueckliste", theClientDto.getMandant(), theClientDto.getLocUi());

        for (int j = 0; j < sollmatUnterschritten.length; j++) {
            sText.append("\n");

            if (losDto.getStuecklisteIId() != null) {
                sText.append(stkl);
                StuecklisteDto stklDto = getStuecklisteFac()
                        .stuecklisteFindByPrimaryKey(losDto.getStuecklisteIId(), theClientDto);
                sText.append(" " + stklDto.getArtikelDto().getCNr() + ": ");
            }

            ArtikelDto artikelDto = getArtikelFac()
                    .artikelFindByPrimaryKey(sollmatUnterschritten[j].getArtikelIId(), theClientDto);
            sText.append(artikelDto.formatArtikelbezeichnung());

        }
        ArrayList ai = new ArrayList();
        ai.add(sText);
        throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FERTIGUNG_SOLLSATZGROESSE_UNTERSCHRITTEN, ai,
                new Exception("losIId == null"));

    }
}

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

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

        vboxMenuAdd = new CFVBox(10);
        buttonAddDelSubDep1 = new CFButton();
        buttonAddDelSubDep1.setMinWidth(200);
        buttonAddDelSubDep1.setText("Add DelSubDep1");
        buttonAddDelSubDep1.setOnAction(new EventHandler<ActionEvent>() {
            @Override/*  www  . j  av  a  2s . co  m*/
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamDelSubDep1Obj obj = (ICFBamDelSubDep1Obj) schemaObj.getDelSubDep1TableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getDelSubDep1Factory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamDelSubDep1EditObj edit = (ICFBamDelSubDep1EditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamDelTopDepObj container = (ICFBamDelTopDepObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerDelTopDep(container);
                    ICFBamJavaFXDelSubDep1PaneCommon jpanelCommon = (ICFBamJavaFXDelSubDep1PaneCommon) 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 ICFBamDelTopDepObj) {
            list.add(buttonAddDelSubDep1);
        }
        buttonAddDelSubDep2 = new CFButton();
        buttonAddDelSubDep2.setMinWidth(200);
        buttonAddDelSubDep2.setText("Add DelSubDep2");
        buttonAddDelSubDep2.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamDelSubDep2Obj obj = (ICFBamDelSubDep2Obj) schemaObj.getDelSubDep2TableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getDelSubDep2Factory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamDelSubDep2EditObj edit = (ICFBamDelSubDep2EditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamDelSubDep1Obj container = (ICFBamDelSubDep1Obj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerDelSubDep1(container);
                    ICFBamJavaFXDelSubDep2PaneCommon jpanelCommon = (ICFBamJavaFXDelSubDep2PaneCommon) 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 ICFBamDelSubDep1Obj) {
            list.add(buttonAddDelSubDep2);
        }
        buttonAddDelSubDep3 = new CFButton();
        buttonAddDelSubDep3.setMinWidth(200);
        buttonAddDelSubDep3.setText("Add DelSubDep3");
        buttonAddDelSubDep3.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamDelSubDep3Obj obj = (ICFBamDelSubDep3Obj) schemaObj.getDelSubDep3TableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getDelSubDep3Factory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamDelSubDep3EditObj edit = (ICFBamDelSubDep3EditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamDelSubDep2Obj container = (ICFBamDelSubDep2Obj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerDelSubDep2(container);
                    ICFBamJavaFXDelSubDep3PaneCommon jpanelCommon = (ICFBamJavaFXDelSubDep3PaneCommon) 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 ICFBamDelSubDep2Obj) {
            list.add(buttonAddDelSubDep3);
        }
        buttonAddDelTopDep = new CFButton();
        buttonAddDelTopDep.setMinWidth(200);
        buttonAddDelTopDep.setText("Add DelTopDep");
        buttonAddDelTopDep.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamDelTopDepObj obj = (ICFBamDelTopDepObj) schemaObj.getDelTopDepTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getDelTopDepFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamDelTopDepEditObj edit = (ICFBamDelTopDepEditObj) (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);
                    ICFBamJavaFXDelTopDepPaneCommon jpanelCommon = (ICFBamJavaFXDelTopDepPaneCommon) 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(buttonAddDelTopDep);
        }

        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");
                    }
                    ICFBamDelDepObj selectedInstance = getJavaFXFocusAsDelDep();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("DELD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getDelDepFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDelDepPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DEL1".equals(classCode)) {
                            ICFBamDelSubDep1Obj obj = (ICFBamDelSubDep1Obj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelSubDep1Factory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDelSubDep1PaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DEL2".equals(classCode)) {
                            ICFBamDelSubDep2Obj obj = (ICFBamDelSubDep2Obj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelSubDep2Factory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDelSubDep2PaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DEL3".equals(classCode)) {
                            ICFBamDelSubDep3Obj obj = (ICFBamDelSubDep3Obj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelSubDep3Factory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDelSubDep3PaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DELT".equals(classCode)) {
                            ICFBamDelTopDepObj obj = (ICFBamDelTopDepObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelTopDepFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDelTopDepPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamDelDepObj, ICFBamDelSubDep1Obj, ICFBamDelSubDep2Obj, ICFBamDelSubDep3Obj, ICFBamDelTopDepObj");
                        }
                    }
                } 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");
                    }
                    ICFBamDelDepObj selectedInstance = getJavaFXFocusAsDelDep();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("DELD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getDelDepFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDelDepPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("DEL1".equals(classCode)) {
                            ICFBamDelSubDep1Obj obj = (ICFBamDelSubDep1Obj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelSubDep1Factory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDelSubDep1PaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("DEL2".equals(classCode)) {
                            ICFBamDelSubDep2Obj obj = (ICFBamDelSubDep2Obj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelSubDep2Factory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDelSubDep2PaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("DEL3".equals(classCode)) {
                            ICFBamDelSubDep3Obj obj = (ICFBamDelSubDep3Obj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelSubDep3Factory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDelSubDep3PaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("DELT".equals(classCode)) {
                            ICFBamDelTopDepObj obj = (ICFBamDelTopDepObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelTopDepFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDelTopDepPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamDelDepObj, ICFBamDelSubDep1Obj, ICFBamDelSubDep2Obj, ICFBamDelSubDep3Obj, ICFBamDelTopDepObj");
                        }
                    }
                } 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");
                    }
                    ICFBamDelDepObj selectedInstance = getJavaFXFocusAsDelDep();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("DELD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getDelDepFactory().newAskDeleteForm(cfFormManager,
                                    selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXDelDepPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DEL1".equals(classCode)) {
                            ICFBamDelSubDep1Obj obj = (ICFBamDelSubDep1Obj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelSubDep1Factory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXDelSubDep1PaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DEL2".equals(classCode)) {
                            ICFBamDelSubDep2Obj obj = (ICFBamDelSubDep2Obj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelSubDep2Factory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXDelSubDep2PaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DEL3".equals(classCode)) {
                            ICFBamDelSubDep3Obj obj = (ICFBamDelSubDep3Obj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelSubDep3Factory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXDelSubDep3PaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("DELT".equals(classCode)) {
                            ICFBamDelTopDepObj obj = (ICFBamDelTopDepObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getDelTopDepFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXDelTopDepPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamDelDepObj, ICFBamDelSubDep1Obj, ICFBamDelSubDep2Obj, ICFBamDelSubDep3Obj, ICFBamDelTopDepObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonDeleteSelected);

    }
    return (hboxMenu);
}