Examples of CloseSaveButtonTab


Examples of fr.soleil.gui.flyscan.gui.custom.tabbedpane.CloseSaveButtonTabbedPane.CloseSaveButtonTab

            if (tabbedPane != null && isEnabled) {
                int cnt = tabbedPane.getTabCount();
                for (int index = 0; index < cnt; index++) {
                    Component component = tabbedPane.getTabComponentAt(index);
                    final CloseSaveButtonTab closeSaveButtonTab = (CloseSaveButtonTab) component;
                    final StringButton checkButton = closeSaveButtonTab.getCheckButton();
                    final ConfigurationGUI configurationGUI = closeSaveButtonTab.getConfigurationGUI();
                    final Configuration config = configurationGUI.getConfiguration();

                    // Instead of using a comete box for connecting the check button to the 'CheckConfig' command, a
                    // TangoCommand is created to avoid displaying the check result in a popup and display it within the
                    // config error area
                    checkButton.addButtonListener(new IButtonListener() {

                        @Override
                        public void actionPerformed(EventObject event) {
                            try {
                                configurationGUI.removeCheckConfigLabelError();
                                String deParsedConfig = ConfigParser.getInstance().deParse(config, getPlugins());
                                String[] configContent = deParsedConfig.split(System.getProperty("line.separator"));
                                String[] checkResult = checkConfig(configContent);
                                if (checkResult == null) {
                                    JOptionPane.showMessageDialog(checkButton, "Configuration ok");
                                } else {
                                    StringBuffer sb = new StringBuffer();
                                    for (String s : checkResult) {
                                        sb.append(s);
                                        sb.append(System.getProperty("line.separator"));
                                    }

                                    displayCheckConfigError(configurationGUI, sb.toString());
                                }

                            } catch (DevFailed e) {
                                String message = DevFailedUtils.toString(e);
//                                System.err.println(message);
                                displayCheckConfigError(configurationGUI, message);
                                LOGGER.log(Level.SEVERE, message);
                            }

                        }
                    });

                    final JButton saveButton = closeSaveButtonTab.getSaveButton();

                    saveButton.addMouseListener(new MouseAdapter() {
                        @Override
                        public void mouseClicked(MouseEvent e) {
                            if (closeSaveButtonTab.getTitle().trim().endsWith(Utilities.ASTERISK)) {
                                closeSaveButtonTab.setTitle(closeSaveButtonTab.getTitle().replaceAll("\\*", "").trim());
                                Configuration configuration = closeSaveButtonTab.getConfigurationGUI()
                                        .getConfiguration();
                                String deParsedConfig = ConfigParser.getInstance().deParse(configuration, getPlugins());
                                // System.out.println(deParsedConfig);
                                String[] arguments = deParsedConfig.split(System.getProperty("line.separator"));

                                TangoCommand saveCommand;
                                try {
                                    saveCommand = new TangoCommand(getModel(), "WriteConfig");
                                    saveCommand.execute(String[].class, (Object[]) arguments);
                                } catch (DevFailed e1) {
                                    LOGGER.log(Level.SEVERE, e1.getMessage());
                                }

                                saveButton.setEnabled(false);
                                closeSaveButtonTab.getCheckButton().setEnabled(true);
                            }

                        }

                        @Override
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.