Example usage for javax.swing.event ListSelectionEvent getValueIsAdjusting

List of usage examples for javax.swing.event ListSelectionEvent getValueIsAdjusting

Introduction

In this page you can find the example usage for javax.swing.event ListSelectionEvent getValueIsAdjusting.

Prototype

public boolean getValueIsAdjusting() 

Source Link

Document

Returns whether or not this is one in a series of multiple events, where changes are still being made.

Usage

From source file:net.sf.keystore_explorer.gui.dialogs.extensions.DViewExtensions.java

private void initComponents() {
    ExtensionsTableModel extensionsTableModel = new ExtensionsTableModel();
    jtExtensions = new JKseTable(extensionsTableModel);

    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(extensionsTableModel);
    sorter.setComparator(2, new ObjectIdComparator());
    jtExtensions.setRowSorter(sorter);//from   w  w w.j  a va2  s . com

    jtExtensions.setShowGrid(false);
    jtExtensions.setRowMargin(0);
    jtExtensions.getColumnModel().setColumnMargin(0);
    jtExtensions.getTableHeader().setReorderingAllowed(false);
    jtExtensions.setAutoResizeMode(JKseTable.AUTO_RESIZE_ALL_COLUMNS);
    jtExtensions.setRowHeight(Math.max(18, jtExtensions.getRowHeight()));

    for (int i = 0; i < jtExtensions.getColumnCount(); i++) {
        TableColumn column = jtExtensions.getColumnModel().getColumn(i);
        column.setHeaderRenderer(
                new ExtensionsTableHeadRend(jtExtensions.getTableHeader().getDefaultRenderer()));
        column.setCellRenderer(new ExtensionsTableCellRend());
    }

    TableColumn criticalCol = jtExtensions.getColumnModel().getColumn(0);
    criticalCol.setResizable(false);
    criticalCol.setMinWidth(28);
    criticalCol.setMaxWidth(28);
    criticalCol.setPreferredWidth(28);

    ListSelectionModel selectionModel = jtExtensions.getSelectionModel();
    selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    selectionModel.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                try {
                    CursorUtil.setCursorBusy(DViewExtensions.this);
                    updateExtensionValue();
                } finally {
                    CursorUtil.setCursorFree(DViewExtensions.this);
                }
            }
        }
    });

    jspExtensionsTable = PlatformUtil.createScrollPane(jtExtensions,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jspExtensionsTable.getViewport().setBackground(jtExtensions.getBackground());

    jpExtensionsTable = new JPanel(new BorderLayout(5, 5));
    jpExtensionsTable.setPreferredSize(new Dimension(500, 200));
    jpExtensionsTable.add(jspExtensionsTable, BorderLayout.CENTER);

    jpExtensionValue = new JPanel(new BorderLayout(5, 5));

    jlExtensionValue = new JLabel(res.getString("DViewExtensions.jlExtensionValue.text"));

    jpExtensionValue.add(jlExtensionValue, BorderLayout.NORTH);

    jepExtensionValue = new JEditorPane();
    jepExtensionValue.setFont(new Font(Font.MONOSPACED, Font.PLAIN, LnfUtil.getDefaultFontSize()));
    jepExtensionValue.setEditable(false);
    jepExtensionValue.setToolTipText(res.getString("DViewExtensions.jtaExtensionValue.tooltip"));
    // JGoodies - keep uneditable color same as editable
    jepExtensionValue.putClientProperty("JTextArea.infoBackground", Boolean.TRUE);

    // for displaying URLs in extensions as clickable links
    jepExtensionValue.setContentType("text/html");
    jepExtensionValue.addHyperlinkListener(this);
    // use default font and foreground color from the component
    jepExtensionValue.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);

    jspExtensionValue = PlatformUtil.createScrollPane(jepExtensionValue,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    jpExtensionValueTextArea = new JPanel(new BorderLayout(5, 5));
    jpExtensionValueTextArea.setPreferredSize(new Dimension(500, 200));
    jpExtensionValueTextArea.add(jspExtensionValue, BorderLayout.CENTER);

    jpExtensionValue.add(jpExtensionValueTextArea, BorderLayout.CENTER);

    jbAsn1 = new JButton(res.getString("DViewExtensions.jbAsn1.text"));

    PlatformUtil.setMnemonic(jbAsn1, res.getString("DViewExtensions.jbAsn1.mnemonic").charAt(0));
    jbAsn1.setToolTipText(res.getString("DViewExtensions.jbAsn1.tooltip"));
    jbAsn1.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewExtensions.this);
                asn1DumpPressed();
            } finally {
                CursorUtil.setCursorFree(DViewExtensions.this);
            }
        }
    });

    jpExtensionValueAsn1 = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    jpExtensionValueAsn1.add(jbAsn1);

    jpExtensionValue.add(jpExtensionValueAsn1, BorderLayout.SOUTH);

    jpExtensions = new JPanel(new GridLayout(2, 1, 5, 5));
    jpExtensions.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5),
            new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5))));

    jpExtensions.add(jpExtensionsTable);
    jpExtensions.add(jpExtensionValue);

    jbOK = new JButton(res.getString("DViewExtensions.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });

    jpOK = PlatformUtil.createDialogButtonPanel(jbOK, false);

    extensionsTableModel.load(extensions);

    if (extensionsTableModel.getRowCount() > 0) {
        jtExtensions.changeSelection(0, 0, false, false);
    }

    getContentPane().add(jpExtensions, BorderLayout.CENTER);
    getContentPane().add(jpOK, BorderLayout.SOUTH);

    setResizable(false);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });

    getRootPane().setDefaultButton(jbOK);

    pack();

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            jbOK.requestFocus();
        }
    });
}

From source file:com.rubenlaguna.en4j.mainmodule.NoteListTopComponent.java

@Override
/**//from   w  ww  .jav  a 2  s .co m
 * @see         javax.swing.event.ListSelectionListener#valueChanged
 */
public void valueChanged(ListSelectionEvent arg0) {
    if (!arg0.getValueIsAdjusting()) {
        if (selectionModel != null) {
            EventList<Note> selectionList = selectionModel.getSelected();
            if ((selectionList != null) && (!selectionList.isEmpty())) {
                Object value = selectionList.get(0);
                if (value != null) {
                    LOG.log(Level.FINE, "selection changed: {0}", value.toString());
                    ic.set(Collections.singleton(value), null);
                    return;
                }
            }
        }
        ic.set(Collections.emptySet(), null);
        LOG.log(Level.FINE, "selection changed: nothing selected");
    }
}

From source file:uk.co.petertribble.jangle.SnmpTreePanel.java

public void valueChanged(ListSelectionEvent e) {
    if (!e.getValueIsAdjusting() && (slist.getSelectedIndex() != -1)) {
        Object o = slist.getSelectedValue();
        if (o instanceof SnmpObject) {
            showObject((SnmpObject) o);//www  .  ja  va 2 s .  com
        }
    }
}

From source file:com.mirth.connect.client.ui.alert.AlertChannelPane.java

private void makeChannelTable() {
    ChannelTreeTableModel model = new ChannelTreeTableModel();
    model.setColumnIdentifiers(Arrays.asList(new String[] { "test" }));

    channelTreeTable.setTreeTableModel(model);
    channelTreeTable.setDoubleBuffered(true);
    channelTreeTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    channelTreeTable.setHorizontalScrollEnabled(true);
    channelTreeTable.packTable(UIConstants.COL_MARGIN);
    channelTreeTable.setRowHeight(UIConstants.ROW_HEIGHT);
    channelTreeTable.setOpaque(true);//from w  ww  . j  a v  a2 s  .co  m
    channelTreeTable.setRowSelectionAllowed(true);
    channelTreeTable.putClientProperty("JTree.lineStyle", "Horizontal");
    channelTreeTable.setAutoCreateColumnsFromModel(false);
    channelTreeTable.setShowGrid(true, true);
    channelTreeTable.setTableHeader(null);
    channelTreeTable.setDragEnabled(false);

    channelTreeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                boolean enabled = channelTreeTable.getSelectedRowCount() > 0;

                enableButton.setEnabled(enabled);
                disableButton.setEnabled(enabled);
            }
        }

    });

    channelTreeTable.setTreeCellRenderer(new TreeCellRenderer() {

        private JLabel label = new JLabel();

        @Override
        public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
                boolean expanded, boolean leaf, int row, boolean hasFocus) {
            if (value != null) {
                if (value instanceof ChannelTreeTableNode) {
                    ChannelTreeTableNode channelNode = (ChannelTreeTableNode) value;
                    ImageIcon icon;

                    if (channelNode.getChildCount() == 0) {
                        // node is a channel node with no children
                        icon = channelNode.isEnabled() ? UIConstants.ICON_BULLET_GREEN
                                : UIConstants.ICON_BULLET_RED;
                    } else {
                        // node is a channel node with children
                        boolean hasDisabled = false;
                        boolean hasEnabled = false;

                        for (int i = 0; i < channelNode.getChildCount(); i++) {
                            ConnectorTreeTableNode connectorNode = (ConnectorTreeTableNode) channelNode
                                    .getChildAt(i);

                            if (connectorNode.isEnabled()) {
                                hasEnabled = true;
                            } else {
                                hasDisabled = true;
                            }
                        }

                        if (hasEnabled && hasDisabled) {
                            icon = UIConstants.ICON_BULLET_YELLOW;
                        } else if (hasDisabled) {
                            icon = UIConstants.ICON_BULLET_RED;
                        } else if (hasEnabled) {
                            icon = UIConstants.ICON_BULLET_GREEN;
                        } else {
                            // This should never occur because a channel should never be a leaf.
                            icon = UIConstants.ICON_BULLET_RED;
                        }
                    }

                    label.setText(channelNode.getChannelName());
                    label.setIcon(icon);
                } else if (value instanceof ConnectorTreeTableNode) {
                    ConnectorTreeTableNode connectorNode = (ConnectorTreeTableNode) value;
                    ImageIcon icon = connectorNode.isEnabled() ? UIConstants.ICON_BULLET_GREEN
                            : UIConstants.ICON_BULLET_RED;
                    label.setText(connectorNode.getConnectorName());
                    label.setIcon(icon);
                }
            }
            return label;
        }

    });
    channelTreeTable.expandAll();
}

From source file:de.tor.tribes.ui.views.DSWorkbenchFormFrame.java

@Override
public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) {
        int selectionCount = jFormsTable.getSelectedRowCount();
        if (selectionCount != 0) {
            showInfo(/*from   w ww.  j a  va  2  s. c  o  m*/
                    selectionCount + ((selectionCount == 1) ? " Zeichnung gewhlt" : " Zeichnungen gewhlt"));
        }
    }
}

From source file:gui.QTLResultsPanel.java

/** listens for change to selected trait.
 * //  ww  w  .j a v a 2 s. c  o m
 */
public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting())
        return;
    Trait trait = (Trait) traitList.getSelectedValue();
    if (trait != prevtrait) {
        displayTrait(trait);
        prevtrait = trait;
    }
    if (currentTraitI == -1)
        return;
    if (AppFrame.tpmmode == AppFrame.TPMMODE_NONSNP)
        return;
    int i = modelList.getSelectedIndex();
    if (i != prevselectedsimplemodelindex) {
        prevselectedsimplemodelindex = i;
        if (i < 1) {
            modelList.clearSelection();
            return;
        }
        String l = modelList.getSelectedValue().toString();
        String modelid = l.split(" ")[0];
        String info = trait.get_modelCoefficient(modelid.trim());
        if (!info.isEmpty()) {
            simpleright.setText(info);
        } else {
            modelList.clearSelection();
        }
    }

}

From source file:com.mirth.connect.client.ui.NotificationDialog.java

private void initComponents() {
    setLayout(new MigLayout("insets 12", "[]", "[fill][]"));

    notificationPanel = new JPanel();
    notificationPanel.setLayout(new MigLayout("insets 0 0 0 0, fill", "[200!][]", "[25!]0[]"));
    notificationPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    archiveAll = new JLabel("Archive All");
    archiveAll.setForeground(java.awt.Color.blue);
    archiveAll.setText("<html><u>Archive All</u></html>");
    archiveAll.setToolTipText("Archive all notifications below.");
    archiveAll.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

    newNotificationsLabel = new JLabel();
    newNotificationsLabel.setFont(newNotificationsLabel.getFont().deriveFont(Font.BOLD));
    headerListPanel = new JPanel();
    headerListPanel.setBackground(UIConstants.HIGHLIGHTER_COLOR);
    headerListPanel.setLayout(new MigLayout("insets 2, fill"));
    headerListPanel.setBorder(BorderFactory.createLineBorder(borderColor));

    list = new JList();
    list.setCellRenderer(new NotificationListCellRenderer());
    list.addListSelectionListener(new ListSelectionListener() {
        @Override//ww  w  .j  a  v  a  2 s .c  om
        public void valueChanged(ListSelectionEvent event) {
            if (!event.getValueIsAdjusting()) {
                currentNotification = (Notification) list.getSelectedValue();
                if (currentNotification != null) {
                    notificationNameTextField.setText(currentNotification.getName());
                    contentTextPane.setText(currentNotification.getContent());
                    archiveSelected();
                }
            }
        }
    });
    listScrollPane = new JScrollPane();
    listScrollPane.setBackground(UIConstants.BACKGROUND_COLOR);
    listScrollPane.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, borderColor));
    listScrollPane.setViewportView(list);
    listScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    archiveLabel = new JLabel();
    archiveLabel.setForeground(java.awt.Color.blue);
    archiveLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

    notificationNameTextField = new JTextField();
    notificationNameTextField.setFont(notificationNameTextField.getFont().deriveFont(Font.BOLD));
    notificationNameTextField.setEditable(false);
    notificationNameTextField.setFocusable(false);
    notificationNameTextField.setBorder(BorderFactory.createEmptyBorder());
    notificationNameTextField.setBackground(UIConstants.HIGHLIGHTER_COLOR);
    DefaultCaret nameCaret = (DefaultCaret) notificationNameTextField.getCaret();
    nameCaret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
    headerContentPanel = new JPanel();
    headerContentPanel.setLayout(new MigLayout("insets 2, fill"));
    headerContentPanel.setBorder(BorderFactory.createLineBorder(borderColor));
    headerContentPanel.setBackground(UIConstants.HIGHLIGHTER_COLOR);

    contentTextPane = new JTextPane();
    contentTextPane.setContentType("text/html");
    contentTextPane.setEditable(false);
    contentTextPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent evt) {
            if (evt.getEventType() == EventType.ACTIVATED && Desktop.isDesktopSupported()) {
                try {
                    if (Desktop.isDesktopSupported()) {
                        Desktop.getDesktop().browse(evt.getURL().toURI());
                    } else {
                        BareBonesBrowserLaunch.openURL(evt.getURL().toString());
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    });
    DefaultCaret contentCaret = (DefaultCaret) contentTextPane.getCaret();
    contentCaret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
    contentScrollPane = new JScrollPane();
    contentScrollPane.setViewportView(contentTextPane);
    contentScrollPane.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, borderColor));

    archiveLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            int index = list.getSelectedIndex();
            if (currentNotification.isArchived()) {
                notificationModel.setArchived(false, index);
                unarchivedCount++;
            } else {
                notificationModel.setArchived(true, index);
                unarchivedCount--;
            }
            archiveSelected();
            updateUnarchivedCountLabel();
        }
    });

    archiveAll.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            for (int i = 0; i < notificationModel.getSize(); i++) {
                notificationModel.setArchived(true, i);
            }
            unarchivedCount = 0;
            archiveSelected();
            updateUnarchivedCountLabel();
        }
    });

    notificationCheckBox = new JCheckBox("Show new notifications on login");
    notificationCheckBox.setBackground(UIConstants.BACKGROUND_COLOR);

    if (checkForNotifications == null || BooleanUtils.toBoolean(checkForNotifications)) {
        checkForNotificationsSetting = true;
        if (showNotificationPopup == null || BooleanUtils.toBoolean(showNotificationPopup)) {
            notificationCheckBox.setSelected(true);
        } else {
            notificationCheckBox.setSelected(false);
        }
    } else {
        notificationCheckBox.setSelected(false);
    }

    notificationCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (notificationCheckBox.isSelected() && !checkForNotificationsSetting) {
                alertSettingsChange();
            }
        }
    });

    closeButton = new JButton("Close");
    closeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            doSave();
        }
    });

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            doSave();
        }
    });
}

From source file:ec.util.chart.swing.JTimeSeriesRendererSupportDemo.java

private Component createObsTable(ListSelectionModel seriesSelectionModel) {
    final XTable result = new XTable();
    ColorCellRenderer renderer = new ColorCellRenderer(FontAwesome.FA_CIRCLE_O);
    result.setDefaultRenderer(Color.class, renderer);
    result.setDefaultEditor(Color.class, new ColorCellEditor(colorSchemeSupport, renderer));
    result.setDefaultRenderer(Font.class, FontCellRenderer.INSTANCE);
    result.setDefaultEditor(Font.class, new FontCellEditor());
    result.setDefaultRenderer(Stroke.class, StrokeCellRenderer.INSTANCE);
    result.setDefaultEditor(Stroke.class, new StrokeCellEditor());
    seriesSelectionModel.addListSelectionListener(new ListSelectionListener() {
        @Override//from w w  w . j  a  va2  s  . c  o m
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                int index = e.getFirstIndex();
                result.setModel(index != -1 ? new ObsModel(support.seriesInfos[index].obsInfos) : null);
                result.getModel().addTableModelListener(new TableModelListener() {
                    @Override
                    public void tableChanged(TableModelEvent e) {
                        chart.fireChartChanged();
                    }
                });
            }
        }
    });
    return ModernUI.withEmptyBorders(new JScrollPane(result));
}

From source file:fr.free.hd.servers.gui.FaceView.java

@Override
protected JComponent createControl() {
    final GridBagLayout layout = new GridBagLayout();
    final JPanel view = new JPanel(layout);

    //Face list// w ww.  jav a 2 s .c o m
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.gridheight = 3;
    c.weighty = 0.75;
    c.weightx = 0.15;
    c.fill = GridBagConstraints.BOTH;
    final JList facesList = CreateList();
    facesList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting() == false) {
                if (facesList.getSelectedIndex() != -1) {
                    face = (Face) facesList.getSelectedValue();
                    updateLabel();
                } else {

                }
            }
        }
    });
    view.add(facesList, c);

    // New button
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 3;
    c.fill = GridBagConstraints.BOTH;
    JButton btnNew = new JButton("Nouveau");
    btnNew.setEnabled(false);
    view.add(btnNew, c);

    // Save button
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 4;
    c.fill = GridBagConstraints.BOTH;
    JButton btnModified = new JButton("Modifier");
    btnModified.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            facesDAO.storeFace(face);
        }
    });
    view.add(btnModified, c);

    //Draw Face
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = 0;
    c.gridheight = 5;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 0.60;
    lblFace = new JLabel();
    view.add(lblFace, c);

    //Hand Panel
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 0;
    c.weightx = 0.15;
    c.fill = GridBagConstraints.BOTH;
    JPanel pnlHand = createPosition();
    view.add(pnlHand, c);

    //Mouth Panel
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 1;
    c.weightx = 0.15;
    c.fill = GridBagConstraints.BOTH;
    JPanel pnlKind = createKind();
    view.add(pnlKind, c);

    //Mouth Panel
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 2;
    c.weightx = 0.15;
    c.fill = GridBagConstraints.BOTH;
    JPanel pnlMouth = createMouth();
    view.add(pnlMouth, c);

    // Picture filename
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 5;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.BOTH;
    JTextField txtPath = new JTextField();
    view.add(txtPath, c);

    //Browse Button
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 5;
    c.fill = GridBagConstraints.BOTH;
    JButton btnBrownse = new JButton("Browse");
    view.add(btnBrownse, c);

    //Select default face
    if (facesList.getModel().getSize() > 0) {
        facesList.setSelectedIndex(0);
        position = HandPositionEnum.HAND_POSITION_MENTON;
        kind = HandKeyEnum.HAND_KEY_2V;
    }

    return view;
}

From source file:edu.ku.brc.specify.tools.schemalocale.SchemaLocalizerFrame.java

/**
 * Export data //from   ww  w . j a v  a2s  .c  om
 */
protected void exportSingleLocale() {
    statusBar.setText(getResourceString("SchemaLocalizerFrame.EXPORTING")); //$NON-NLS-1$
    statusBar.paintImmediately(statusBar.getBounds());

    schemaLocPanel.getAllDataFromUI();

    if (localizableIO.hasChanged()) {
        if (UIRegistry.askYesNoLocalized("SAVE", "CANCEL",
                UIRegistry.getResourceString("SchemaLocalizerFrame.NEEDS_SAVING"),
                "SAVE") == JOptionPane.YES_NO_OPTION) {
            localizableIO.save();
        } else {
            return;
        }
    }

    Vector<Locale> stdLocales = SchemaI18NService.getInstance().getStdLocaleList(false);
    final JList list = new JList(stdLocales);
    list.setCellRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            if (value != null) {
                setText(((Locale) value).getDisplayName());
            }
            return this;
        }
    });

    PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "f:p:g"));
    pb.add(UIHelper.createScrollPane(list), (new CellConstraints()).xy(1, 1));
    pb.setDefaultDialogBorder();

    final CustomDialog dlg = new CustomDialog((Frame) UIRegistry.getTopWindow(),
            getResourceString("SchemaLocalizerFrame.CHOOSE_LOCALE"), true, pb.getPanel());
    list.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                dlg.getOkBtn().setEnabled(list.getSelectedValue() != null);
            }
        }
    });
    dlg.createUI();
    dlg.getOkBtn().setEnabled(false);

    UIHelper.centerAndShow(dlg);
    if (!dlg.isCancelled()) {
        Locale locale = (Locale) list.getSelectedValue();
        if (locale != null) {
            FileDialog fileDlg = new FileDialog((Frame) UIRegistry.getTopWindow(),
                    getResourceString("SchemaLocalizerFrame.SVFILENAME"), FileDialog.SAVE);
            fileDlg.setVisible(true);
            String fileName = fileDlg.getFile();
            if (StringUtils.isNotEmpty(fileName)) {
                File outFile = new File(fileDlg.getDirectory() + File.separator + fileName);
                boolean savedOK = localizableIO.exportSingleLanguageToDirectory(outFile, locale);
                if (savedOK) {
                    String msg = UIRegistry.getLocalizedMessage("SchemaLocalizerFrame.EXPORTEDTO",
                            locale.getDisplayName(), outFile.getAbsolutePath());
                    UIRegistry.displayInfoMsgDlg(msg);
                } else {
                    String msg = UIRegistry.getLocalizedMessage("SchemaLocalizerFrame.EXPORTING_ERR",
                            outFile.getAbsolutePath());
                    UIRegistry.showError(msg);
                }

            }
        }
    }
}