Example usage for java.awt GridBagConstraints EAST

List of usage examples for java.awt GridBagConstraints EAST

Introduction

In this page you can find the example usage for java.awt GridBagConstraints EAST.

Prototype

int EAST

To view the source code for java.awt GridBagConstraints EAST.

Click Source Link

Document

Put the component on the right side of its display area, centered vertically.

Usage

From source file:org.openconcerto.erp.core.sales.credit.component.AvoirClientSQLComponent.java

public void addViews() {
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();
    textNumero = new JUniqueTextField(16);
    // Champ Module
    c.gridx = 0;/*  w ww .ja v a  2  s.c  o  m*/
    c.gridy++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    final JPanel addP = ComptaSQLConfElement.createAdditionalPanel();
    this.setAdditionalFieldsPanel(new FormLayouter(addP, 1));
    this.add(addP, c);

    c.gridy++;
    c.gridwidth = 1;

    this.textNom = new JTextField();
    this.date = new JDate(true);

    this.date.addValueListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            fireValidChange();

        }
    });

    // Ligne 1: Numero
    this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c);
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    c.gridx++;

    DefaultGridBagConstraints.lockMinimumSize(textNumero);
    this.add(this.textNumero, c);

    // Date
    c.gridx++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(new JLabel("Date", SwingConstants.RIGHT), c);
    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    this.add(this.date, c);

    // Ligne 2: Libell
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT), c);
    c.gridx++;
    // c.weightx = 1;
    this.add(this.textNom, c);

    // Commercial
    c.gridx++;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    this.comboCommercial = new ElementComboBox();
    this.comboCommercial.setMinimumSize(this.comboCommercial.getPreferredSize());
    this.add(new JLabel(getLabelFor("ID_COMMERCIAL"), SwingConstants.RIGHT), c);
    c.gridx++;
    // c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    this.add(this.comboCommercial, c);

    this.addSQLObject(this.comboCommercial, "ID_COMMERCIAL");

    // Ligne 3: Motif
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    this.add(new JLabel(getLabelFor("MOTIF"), SwingConstants.RIGHT), c);
    c.gridx++;
    c.gridwidth = 3;
    // c.weightx = 1;

    JTextField textMotif = new JTextField();
    this.add(textMotif, c);

    // Client
    c.gridx = 0;
    c.gridy++;
    // c.weightx = 0;
    c.gridwidth = 1;
    this.add(new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT), c);
    c.gridx++;
    c.gridwidth = 3;
    // c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    this.add(this.comboClient, c);
    // Adresse spe
    c.gridx = 0;
    c.gridy++;
    c.fill = GridBagConstraints.HORIZONTAL;
    // c.weightx = 0;
    c.gridwidth = 1;
    this.add(new JLabel(getLabelFor("ID_ADRESSE"), SwingConstants.RIGHT), c);

    c.gridx++;
    c.gridwidth = 3;
    // c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    this.add(this.comboAdresse, c);
    final ComptaPropsConfiguration comptaPropsConfiguration = ((ComptaPropsConfiguration) Configuration
            .getInstance());

    // Contact
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    // c.weightx = 0;
    final JLabel labelContact = new JLabel(getLabelFor("ID_CONTACT"), SwingConstants.RIGHT);
    this.add(labelContact, c);

    c.gridx++;
    c.gridwidth = 3;
    // c.weightx = 1;
    c.fill = GridBagConstraints.NONE;

    this.add(selectContact, c);
    final SQLElement contactElement = getElement().getForeignElement("ID_CONTACT");
    selectContact.init(contactElement, contactElement.getComboRequest(true));
    this.addView(selectContact, "ID_CONTACT");
    this.defaultContactRowValues = new SQLRowValues(selectContact.getRequest().getPrimaryTable());
    selectContact.getAddComp().setDefaults(this.defaultContactRowValues);

    // Compte Service
    this.checkCompteServiceAuto = new JCheckBox(getLabelFor("COMPTE_SERVICE_AUTO"));
    this.addSQLObject(this.checkCompteServiceAuto, "COMPTE_SERVICE_AUTO");
    this.compteSelService = new ISQLCompteSelector();

    this.labelCompteServ = new JLabel("Compte Service");
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 1;
    // c.weightx = 0;
    this.labelCompteServ.setHorizontalAlignment(SwingConstants.RIGHT);
    this.add(this.labelCompteServ, c);

    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    // c.weightx = 1;
    this.add(this.compteSelService, c);

    this.addRequiredSQLObject(this.compteSelService, "ID_COMPTE_PCE_SERVICE");

    String valServ = DefaultNXProps.getInstance().getStringProperty("ArticleService");
    Boolean bServ = Boolean.valueOf(valServ);
    if (!bServ) {
        this.labelCompteServ.setVisible(false);
        this.compteSelService.setVisible(false);
    }

    this.checkCompteServiceAuto.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setCompteServiceVisible(!AvoirClientSQLComponent.this.checkCompteServiceAuto.isSelected());
        }
    });

    // setCompteServiceVisible(!(bServ != null && !bServ.booleanValue()));

    // Tarif
    if (this.getTable().getFieldsName().contains("ID_TARIF")) {
        // TARIF
        c.gridy++;
        c.gridx = 0;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        this.add(new JLabel("Tarif  appliquer", SwingConstants.RIGHT), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;

        c.weightx = 1;
        this.add(boxTarif, c);
        this.addView(boxTarif, "ID_TARIF");
        boxTarif.addValueListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                table.setTarif(boxTarif.getSelectedRow(), false);
            }
        });
    }

    // Table
    this.table = new AvoirItemTable();
    c.gridx = 0;
    c.gridy++;
    c.fill = GridBagConstraints.BOTH;
    c.gridheight = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weighty = 1;
    // c.weightx = 0;
    this.add(this.table, c);
    this.addView(this.table.getRowValuesTable(), "");

    // Panel du bas
    final JPanel panelBottom = getBottomPanel();
    c.gridy++;
    c.weighty = 0;
    this.add(panelBottom, c);

    // Infos

    c.gridheight = 1;
    c.gridx = 0;
    c.gridy++;
    this.add(new JLabel(getLabelFor("INFOS")), c);

    c.gridy++;
    c.fill = GridBagConstraints.BOTH;
    c.weighty = 0;
    c.gridwidth = 4;
    ITextArea infos = new ITextArea(4, 4);
    infos.setBorder(null);
    JScrollPane scrollPane = new JScrollPane(infos);
    DefaultGridBagConstraints.lockMinimumSize(scrollPane);
    this.add(scrollPane, c);

    //
    // Impression
    this.panelGestDoc = new PanelOOSQLComponent(this);
    c.fill = GridBagConstraints.NONE;
    c.gridy++;
    c.anchor = GridBagConstraints.EAST;
    this.add(panelGestDoc, c);

    this.addSQLObject(this.textNom, "NOM");
    if (getTable().contains("INFOS")) {
        this.addSQLObject(infos, "INFOS");
    }
    this.addSQLObject(this.boxAdeduire, "A_DEDUIRE");
    this.addSQLObject(textMotif, "MOTIF");
    this.addSQLObject(this.comboAdresse, "ID_ADRESSE");

    this.addRequiredSQLObject(this.textNumero, "NUMERO");
    this.addRequiredSQLObject(this.date, "DATE");
    this.addRequiredSQLObject(this.comboClient, "ID_CLIENT");

    this.boxAdeduire.addActionListener(this);

    this.comboClient.addModelListener("wantedID", this.listenerModeReglDefaut);
    this.comboClient.addModelListener("wantedID", this.changeClientListener);
    DefaultGridBagConstraints.lockMinimumSize(comboClient);
    DefaultGridBagConstraints.lockMinimumSize(this.comboAdresse);
    DefaultGridBagConstraints.lockMinimumSize(this.comboBanque);
    DefaultGridBagConstraints.lockMinimumSize(comboCommercial);

}

From source file:com.sec.ose.osi.ui.frm.main.identification.stringmatch.JPanStringMatchMain.java

/**
 * This method initializes jPanel3   //from w  ww . j  a va2  s  . co  m
 *    
 * @return javax.swing.JPanel   
 */
public JPanel getJPanelRepreLicenFolder() {
    if (jPanelRepreLicenFolder == null) {
        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
        gridBagConstraints6.anchor = GridBagConstraints.WEST;
        gridBagConstraints6.insets = new Insets(0, 0, 0, 0);
        gridBagConstraints6.gridx = -1;
        gridBagConstraints6.gridy = -1;
        gridBagConstraints6.weightx = 0.0;
        gridBagConstraints6.fill = GridBagConstraints.VERTICAL;
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.anchor = GridBagConstraints.EAST;
        gridBagConstraints3.insets = new Insets(0, 0, 0, 3);
        gridBagConstraints3.gridx = -1;
        gridBagConstraints3.gridy = -1;
        gridBagConstraints3.weightx = 0.0;
        gridBagConstraints3.fill = GridBagConstraints.NONE;
        jPanelRepreLicenFolder = new JPanel();
        jPanelRepreLicenFolder.setLayout(new GridBagLayout());
        jPanelRepreLicenFolder.setPreferredSize(new Dimension(489, 33));
        jPanelRepreLicenFolder.add(jLabelRepresentativeLicenseForOpt2, gridBagConstraints3);
        jPanelRepreLicenFolder.add(getJComboLicenseNameForOpt2(), gridBagConstraints6);
    }
    return jPanelRepreLicenFolder;
}

From source file:org.jets3t.apps.cockpit.Cockpit.java

/**
 * Initialises the application's GUI elements.
 *//*from  w ww .  ja v  a2 s . com*/
private void initGui() {
    initMenus();

    JPanel appContent = new JPanel(new GridBagLayout());
    this.getContentPane().add(appContent);

    // Buckets panel.
    JPanel bucketsPanel = new JPanel(new GridBagLayout());

    JButton bucketActionButton = new JButton();
    bucketActionButton.setToolTipText("Bucket actions menu");
    guiUtils.applyIcon(bucketActionButton, "/images/nuvola/16x16/actions/misc.png");
    bucketActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            bucketActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    bucketsPanel.add(new JHtmlLabel("<html><b>Buckets</b></html>", this), new GridBagConstraints(0, 0, 1, 1, 1,
            0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    bucketsPanel.add(bucketActionButton, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    bucketTableModel = new BucketTableModel(false);
    bucketTableModelSorter = new TableSorter(bucketTableModel);
    bucketsTable = new JTable(bucketTableModelSorter);
    bucketTableModelSorter.setTableHeader(bucketsTable.getTableHeader());
    bucketsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    bucketsTable.getSelectionModel().addListSelectionListener(this);
    bucketsTable.setShowHorizontalLines(true);
    bucketsTable.setShowVerticalLines(false);
    bucketsTable.addMouseListener(new ContextMenuListener());
    bucketsPanel.add(new JScrollPane(bucketsTable), new GridBagConstraints(0, 1, 2, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0));
    bucketsPanel.add(new JLabel(" "), new GridBagConstraints(0, 2, 2, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Filter panel.
    filterObjectsPanel = new JPanel(new GridBagLayout());
    filterObjectsPrefix = new JTextField();
    filterObjectsPrefix.setToolTipText("Only show objects with this prefix");
    filterObjectsPrefix.addActionListener(this);
    filterObjectsPrefix.setActionCommand("RefreshObjects");
    filterObjectsDelimiter = new JComboBox(new String[] { "", "/", "?", "\\" });
    filterObjectsDelimiter.setEditable(true);
    filterObjectsDelimiter.setToolTipText("Object name delimiter");
    filterObjectsDelimiter.addActionListener(this);
    filterObjectsDelimiter.setActionCommand("RefreshObjects");
    filterObjectsPanel.add(new JHtmlLabel("Prefix:", this), new GridBagConstraints(0, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0,
            GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    filterObjectsPanel.add(new JHtmlLabel("Delimiter:", this), new GridBagConstraints(2, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    filterObjectsPanel.add(filterObjectsDelimiter, new GridBagConstraints(3, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.setVisible(false);

    // Objects panel.
    JPanel objectsPanel = new JPanel(new GridBagLayout());
    int row = 0;
    filterObjectsCheckBox = new JCheckBox("Filter objects");
    filterObjectsCheckBox.addActionListener(this);
    filterObjectsCheckBox.setToolTipText("Check this option to filter the objects listed");
    objectsPanel.add(new JHtmlLabel("<html><b>Objects</b></html>", this), new GridBagConstraints(0, row, 1, 1,
            1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    JButton objectActionButton = new JButton();
    objectActionButton.setToolTipText("Object actions menu");
    guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png");
    objectActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            objectActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsTable = new JTable();
    objectTableModel = new ObjectTableModel();
    objectTableModelSorter = new TableSorter(objectTableModel);
    objectTableModelSorter.setTableHeader(objectsTable.getTableHeader());
    objectsTable.setModel(objectTableModelSorter);
    objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 301092191828910402L;

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue());
            return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column);
        }
    });
    objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 7285511556343895652L;

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            Date date = (Date) value;
            return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus,
                    row, column);
        }
    });
    objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    objectsTable.getSelectionModel().addListSelectionListener(this);
    objectsTable.setShowHorizontalLines(true);
    objectsTable.setShowVerticalLines(true);
    objectsTable.addMouseListener(new ContextMenuListener());
    objectsTableSP = new JScrollPane(objectsTable);
    objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));
    objectsSummaryLabel = new JHtmlLabel("Please select a bucket", this);
    objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER);
    objectsSummaryLabel.setFocusable(false);
    objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Combine sections.
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bucketsPanel, objectsPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setContinuousLayout(true);

    appContent.add(splitPane, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // Set preferred sizes
    int preferredWidth = 800;
    int preferredHeight = 600;
    this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight)));

    splitPane.setResizeWeight(0.30);

    // Initialize drop target.
    initDropTarget(new JComponent[] { objectsTableSP, objectsTable });
    objectsTable.getDropTarget().setActive(false);
    objectsTableSP.getDropTarget().setActive(false);
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.s3.Cockpit.java

/**
 * Initialises the application's GUI elements.
 *//*w  w w  .  j  a v a  2  s.  c o  m*/
private void initGui() {
    initMenus();

    JPanel appContent = new JPanel(new GridBagLayout());
    this.getContentPane().add(appContent);

    // Buckets panel.
    JPanel bucketsPanel = new JPanel(new GridBagLayout());

    JButton bucketActionButton = new JButton();
    bucketActionButton.setToolTipText("Bucket actions menu");
    guiUtils.applyIcon(bucketActionButton, "/images/nuvola/16x16/actions/misc.png");
    bucketActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            bucketActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    bucketsPanel.add(new JHtmlLabel("<html><b>Buckets</b></html>", this), new GridBagConstraints(0, 0, 1, 1, 1,
            0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    bucketsPanel.add(bucketActionButton, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    bucketTableModel = new BucketTableModel(false);
    bucketTableModelSorter = new TableSorter(bucketTableModel);
    bucketsTable = new JTable(bucketTableModelSorter);
    bucketTableModelSorter.setTableHeader(bucketsTable.getTableHeader());
    bucketsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    bucketsTable.getSelectionModel().addListSelectionListener(this);
    bucketsTable.setShowHorizontalLines(true);
    bucketsTable.setShowVerticalLines(false);
    bucketsTable.addMouseListener(new ContextMenuListener());
    bucketsPanel.add(new JScrollPane(bucketsTable), new GridBagConstraints(0, 1, 2, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0));
    bucketsPanel.add(new JLabel(" "), new GridBagConstraints(0, 2, 2, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Filter panel.
    filterObjectsPanel = new JPanel(new GridBagLayout());
    filterObjectsPrefix = new JTextField();
    filterObjectsPrefix.setToolTipText("Only show objects with this prefix");
    filterObjectsPrefix.addActionListener(this);
    filterObjectsPrefix.setActionCommand("RefreshObjects");
    filterObjectsDelimiter = new JComboBox(new String[] { "", "/", "?", "\\" });
    filterObjectsDelimiter.setEditable(true);
    filterObjectsDelimiter.setToolTipText("Object name delimiter");
    filterObjectsDelimiter.addActionListener(this);
    filterObjectsDelimiter.setActionCommand("RefreshObjects");
    filterObjectsPanel.add(new JHtmlLabel("Prefix:", this), new GridBagConstraints(0, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0,
            GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    filterObjectsPanel.add(new JHtmlLabel("Delimiter:", this), new GridBagConstraints(2, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    filterObjectsPanel.add(filterObjectsDelimiter, new GridBagConstraints(3, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.setVisible(false);

    // Objects panel.
    JPanel objectsPanel = new JPanel(new GridBagLayout());
    int row = 0;
    filterObjectsCheckBox = new JCheckBox("Filter objects");
    filterObjectsCheckBox.addActionListener(this);
    filterObjectsCheckBox.setToolTipText("Check this option to filter the objects listed");
    objectsPanel.add(new JHtmlLabel("<html><b>Objects</b></html>", this), new GridBagConstraints(0, row, 1, 1,
            1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    JButton objectActionButton = new JButton();
    objectActionButton.setToolTipText("Object actions menu");
    guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png");
    objectActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            objectActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsTable = new JTable();
    objectTableModel = new ObjectTableModel();
    objectTableModelSorter = new TableSorter(objectTableModel);
    objectTableModelSorter.setTableHeader(objectsTable.getTableHeader());
    objectsTable.setModel(objectTableModelSorter);
    objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 301092191828910402L;

        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue());
            return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column);
        }
    });
    objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 7285511556343895652L;

        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            Date date = (Date) value;
            return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus,
                    row, column);
        }
    });
    objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    objectsTable.getSelectionModel().addListSelectionListener(this);
    objectsTable.setShowHorizontalLines(true);
    objectsTable.setShowVerticalLines(true);
    objectsTable.addMouseListener(new ContextMenuListener());
    objectsTableSP = new JScrollPane(objectsTable);
    objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));
    objectsSummaryLabel = new JHtmlLabel("Please select a bucket", this);
    objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER);
    objectsSummaryLabel.setFocusable(false);
    objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Combine sections.
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bucketsPanel, objectsPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setContinuousLayout(true);

    appContent.add(splitPane, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // Set preferred sizes
    int preferredWidth = 800;
    int preferredHeight = 600;
    this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight)));

    splitPane.setResizeWeight(0.30);

    // Initialize drop target.
    initDropTarget(new JComponent[] { objectsTableSP, objectsTable });
    objectsTable.getDropTarget().setActive(false);
    objectsTableSP.getDropTarget().setActive(false);
}

From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java

/**
 * @return//from w  w  w.j  av a2  s  .  com
 */
private JPanel createGradientConfigurationPanel() {

    // create gradient config panel
    JPanel gradientConfigPanel = new JPanel(new GridBagLayout());
    gradientConfigPanel.setPreferredSize(new Dimension(100, 50));

    GridBagConstraints itemConstraint;

    // add gradient label
    {
        JLabel gradientLabel = new ResourceLabel(
                "plotter.configuration_dialog.color_scheme_dialog.gradient_preview");

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1;
        itemConstraint.weighty = 1;
        itemConstraint.fill = GridBagConstraints.BOTH;
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(gradientLabel, itemConstraint);
    }

    // add combobox panel
    {
        JPanel comboBoxPanel = new JPanel(new GridBagLayout());

        // gradient start panel
        {

            JPanel startGradientPanel = createStartGradientPanel();

            itemConstraint = new GridBagConstraints();
            itemConstraint.weightx = 1.0;
            itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
            itemConstraint.anchor = GridBagConstraints.WEST;
            itemConstraint.fill = GridBagConstraints.HORIZONTAL;

            comboBoxPanel.add(startGradientPanel, itemConstraint);

        }

        // gradient end panel
        {

            JPanel endGradientPanel = createEndGradientPanel();

            itemConstraint = new GridBagConstraints();
            itemConstraint.weightx = 1.0;
            itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
            itemConstraint.anchor = GridBagConstraints.EAST;
            itemConstraint.fill = GridBagConstraints.HORIZONTAL;

            comboBoxPanel.add(endGradientPanel, itemConstraint);

        }

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1;
        itemConstraint.weighty = 0.0;
        itemConstraint.fill = GridBagConstraints.HORIZONTAL;
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(comboBoxPanel, itemConstraint);
    }

    // add 0.0 label
    {
        JLabel zeroLabel = new JLabel("0");

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 0;
        itemConstraint.weighty = 0;
        itemConstraint.fill = GridBagConstraints.NONE;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(zeroLabel, itemConstraint);
    }

    // add gradient preview
    {
        preview = new GradientPreview(null);

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1;
        itemConstraint.weighty = 1;
        itemConstraint.fill = GridBagConstraints.BOTH;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(preview, itemConstraint);

    }

    // add 1.0 label
    {
        JLabel zeroLabel = new JLabel("1");

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 0;
        itemConstraint.weighty = 0;
        itemConstraint.fill = GridBagConstraints.NONE;
        itemConstraint.insets = new Insets(2, 2, 2, 2);
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER;

        gradientConfigPanel.add(zeroLabel, itemConstraint);
    }

    return gradientConfigPanel;
}

From source file:us.paulevans.basicxslt.BasicXSLTFrame.java

/**
 * Rebuilds the XSL panel; first it removes all of the components; and then
 * it loops over the xslRows object and re-adds the components.
 *
 *///from  ww w .j av a 2 s .co m
private void rebuildXSLPanel() {

    int loop, size;
    int col, xslPanelRow;
    JTextField xslTf;
    JButton browseXslBtn, insertBtn;
    JComboBox action;
    JLabel xslLabel, indicatorLabel;
    JCheckBox removeCb;
    XSLRow xslRow;

    xslPanel.removeAll();
    xslPanelRow = 0;
    GUIUtils.add(xslPanel, new JLabel(""), xslPanelLayout, xslPanelConstraints, xslPanelRow, col = 0, 1, 1,
            GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel,
            new JLabel(stringFactory.getString(LabelStringFactory.MAIN_FRAME_XML_FILE_WITH_COLON)),
            xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1, GridBagConstraints.EAST,
            GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel, sourceXmlTf, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
            GridBagConstraints.WEST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel, new JLabel(""), xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
            GridBagConstraints.WEST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel, browseXmlBtn, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
            GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel, xmlAction, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
            GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(xslPanel, xmlIndicatorLabel, xslPanelLayout, xslPanelConstraints, xslPanelRow++, ++col, 1, 1,
            GridBagConstraints.WEST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    size = xslRows.size();
    for (loop = 0; loop < size; loop++) {
        xslRow = xslRows.get(loop);
        xslLabel = xslRow.getLabel();
        xslTf = xslRow.getTextField();
        removeCb = xslRow.getRemoveCb();
        browseXslBtn = xslRow.getBrowseBtn();
        insertBtn = xslRow.getInsertBtn();
        indicatorLabel = xslRow.getIndicatorLabel();
        action = xslRow.getAction();
        GUIUtils.add(xslPanel, insertBtn, xslPanelLayout, xslPanelConstraints, xslPanelRow, col = 0, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.EAST, GUIUtils.NO_INSETS);
        GUIUtils.add(xslPanel, xslLabel, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS);
        GUIUtils.add(xslPanel, xslTf, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
                GridBagConstraints.WEST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
        GUIUtils.add(xslPanel, removeCb, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
        GUIUtils.add(xslPanel, browseXslBtn, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
        GUIUtils.add(xslPanel, action, xslPanelLayout, xslPanelConstraints, xslPanelRow, ++col, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
        GUIUtils.add(xslPanel, indicatorLabel, xslPanelLayout, xslPanelConstraints, xslPanelRow++, ++col, 1, 1,
                GridBagConstraints.EAST, GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    }
}

From source file:org.openconcerto.erp.core.sales.invoice.component.SaisieVenteFactureSQLComponent.java

public void addViews() {
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();

    this.checkPrevisionnelle = new JCheckBox();
    this.checkComplement = new JCheckBox();
    this.fieldTTC = new DeviseField();

    final ComptaPropsConfiguration comptaPropsConfiguration = ((ComptaPropsConfiguration) Configuration
            .getInstance());/*from w  ww. j  a v  a 2s .  c  o m*/

    this.textAvoirTTC = new DeviseField();

    // Champ Module
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    final JPanel addP = ComptaSQLConfElement.createAdditionalPanel();
    this.setAdditionalFieldsPanel(new FormLayouter(addP, 1));
    this.add(addP, c);

    c.gridy++;
    c.gridwidth = 1;

    if (getTable().contains("ID_POLE_PRODUIT")) {
        JLabel labelPole = new JLabel(getLabelFor("ID_POLE_PRODUIT"));
        labelPole.setHorizontalAlignment(SwingConstants.RIGHT);
        this.add(labelPole, c);
        c.gridx++;
        ElementComboBox pole = new ElementComboBox();

        this.add(pole, c);
        this.addSQLObject(pole, "ID_POLE_PRODUIT");
        c.gridy++;
        c.gridwidth = 1;
        c.gridx = 0;
    }

    /*******************************************************************************************
     * * RENSEIGNEMENTS
     ******************************************************************************************/
    // Ligne 1 : Numero de facture
    JLabel labelNum = new JLabel(getLabelFor("NUMERO"));
    labelNum.setHorizontalAlignment(SwingConstants.RIGHT);
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    this.add(labelNum, c);

    this.textNumeroUnique = new JUniqueTextField(16);
    c.gridx++;
    c.weightx = 0;
    c.fill = GridBagConstraints.NONE;
    DefaultGridBagConstraints.lockMinimumSize(this.textNumeroUnique);
    this.add(textNumeroUnique, c);

    // Date
    c.gridx++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(new JLabel(getLabelFor("DATE"), SwingConstants.RIGHT), c);

    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    final JDate dateSaisie = new JDate(true);

    // listener permettant la mise  jour du numro de facture en fonction de la date
    // slectionne
    dateSaisie.addValueListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (!isFilling() && dateSaisie.getValue() != null) {

                final String nextNumero = NumerotationAutoSQLElement
                        .getNextNumero(SaisieVenteFactureSQLElement.class, dateSaisie.getValue());

                if (textNumeroUnique.getText().trim().length() > 0
                        && !nextNumero.equalsIgnoreCase(textNumeroUnique.getText())) {

                    int answer = JOptionPane.showConfirmDialog(SaisieVenteFactureSQLComponent.this,
                            "Voulez vous actualiser le numro de la facture?",
                            "Changement du numro de facture", JOptionPane.YES_NO_OPTION);
                    if (answer == JOptionPane.NO_OPTION) {
                        return;
                    }
                }

                textNumeroUnique.setText(nextNumero);

            }

        }
    });
    this.add(dateSaisie, c);

    // Ligne 2 : reference
    c.gridx = 0;
    c.gridwidth = 1;
    c.gridy++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    JLabel labelLibelle = new JLabel(getLabelFor("NOM"));
    labelLibelle.setHorizontalAlignment(SwingConstants.RIGHT);
    this.add(labelLibelle, c);

    SQLTextCombo textLibelle = new SQLTextCombo();
    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    this.add(textLibelle, c);

    this.addSQLObject(textLibelle, "NOM");
    c.fill = GridBagConstraints.HORIZONTAL;
    this.comboCommercial = new ElementComboBox(false);
    // Commercial
    String field;
    field = "ID_COMMERCIAL";
    c.gridx++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(new JLabel(getLabelFor(field), SwingConstants.RIGHT), c);

    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;

    this.add(this.comboCommercial, c);
    this.addRequiredSQLObject(this.comboCommercial, field);
    // Client
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT), c);

    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    this.comboClient = new ElementComboBox();

    this.add(this.comboClient, c);

    if (getTable().contains("ID_ECHEANCIER_CCI")) {
        // Echeancier
        c.gridx++;
        c.weightx = 0;
        c.fill = GridBagConstraints.HORIZONTAL;
        this.add(new JLabel(getLabelFor("ID_ECHEANCIER_CCI"), SwingConstants.RIGHT), c);

        c.gridx++;
        c.weightx = 1;
        c.fill = GridBagConstraints.NONE;
        final ElementComboBox echeancier = new ElementComboBox();
        final SQLElement contactElement = Configuration.getInstance().getDirectory()
                .getElement("ECHEANCIER_CCI");
        echeancier.init(contactElement, contactElement.getComboRequest(true));
        DefaultGridBagConstraints.lockMinimumSize(echeancier);
        this.addView(echeancier, "ID_ECHEANCIER_CCI");

        selAffaire.addValueListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent arg0) {
                // TODO Raccord de mthode auto-gnr
                if (selAffaire.getSelectedRow() != null) {
                    echeancier.getRequest().setWhere(new Where(contactElement.getTable().getField("ID_AFFAIRE"),
                            "=", selAffaire.getSelectedRow().getID()));

                    if (!isFilling()) {
                        SQLRow rowPole = selAffaire.getSelectedRow().getForeignRow("ID_POLE_PRODUIT");
                        comboCommercial.setValue(rowPole);
                    }
                } else {
                    echeancier.getRequest().setWhere(null);
                }
            }
        });
        this.add(echeancier, c);

    }

    this.comboClient.addValueListener(this.changeClientListener);

    this.comboAdresse = new ElementComboBox();
    this.comboAdresse.setAddIconVisible(false);
    this.comboAdresse.setListIconVisible(false);
    JLabel labelAdresse = new JLabel(getLabelFor("ID_ADRESSE"), SwingConstants.RIGHT);
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 1;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    labelAdresse.setHorizontalAlignment(SwingConstants.RIGHT);
    this.add(labelAdresse, c);

    c.gridx++;
    c.fill = GridBagConstraints.NONE;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1;
    this.add(this.comboAdresse, c);

    // Acompte
    this.checkAcompte = new JCheckBox(getLabelFor("ACOMPTE"));
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    // this.add(this.checkAcompte, c);
    c.gridwidth = 1;
    this.addView(this.checkAcompte, "ACOMPTE");

    // Compte Service
    this.checkCompteServiceAuto = new JCheckBox(getLabelFor("COMPTE_SERVICE_AUTO"));
    this.addSQLObject(this.checkCompteServiceAuto, "COMPTE_SERVICE_AUTO");
    this.compteSelService = new ISQLCompteSelector();

    this.labelCompteServ = new JLabel("Compte Service");
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 1;
    c.weightx = 0;
    this.labelCompteServ.setHorizontalAlignment(SwingConstants.RIGHT);
    this.add(this.labelCompteServ, c);

    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1;
    this.add(this.compteSelService, c);

    String valServ = DefaultNXProps.getInstance().getStringProperty("ArticleService");
    Boolean bServ = Boolean.valueOf(valServ);

    this.checkCompteServiceAuto.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setCompteServiceVisible(!SaisieVenteFactureSQLComponent.this.checkCompteServiceAuto.isSelected());
        }
    });

    // FIXME A checker si utile pour Preventec ou KD
    setCompteServiceVisible(false);
    // setCompteServiceVisible(!(bServ != null && !bServ.booleanValue()));

    final JPanel pAcompte = new JPanel();
    final DeviseField textAcompteHT = new DeviseField();
    pAcompte.add(new JLabel("Acompte HT"));
    pAcompte.add(textAcompteHT);

    pAcompte.add(new JLabel("soit"));
    final JTextField textAcompte = new JTextField(5);
    pAcompte.add(textAcompte);
    pAcompte.add(new JLabel("%"));
    c.gridx = 0;
    c.gridy++;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.NONE;
    this.add(pAcompte, c);
    c.anchor = GridBagConstraints.WEST;
    this.addView(textAcompte, "POURCENT_ACOMPTE");

    pAcompte.setVisible(false);

    /*******************************************************************************************
     * * DETAILS
     ******************************************************************************************/
    this.tableFacture = new SaisieVenteFactureItemTable();

    final ElementComboBox boxTarif = new ElementComboBox();
    if (this.getTable().getFieldsName().contains("ID_TARIF")) {
        // TARIF
        c.gridy++;
        c.gridx = 0;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        c.fill = GridBagConstraints.HORIZONTAL;
        this.add(new JLabel("Tarif  appliquer", SwingConstants.RIGHT), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.NONE;
        c.weightx = 1;
        DefaultGridBagConstraints.lockMinimumSize(boxTarif);
        this.add(boxTarif, c);
        this.addView(boxTarif, "ID_TARIF");
        boxTarif.addModelListener("wantedID", new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                SQLRow selectedRow = boxTarif.getRequest().getPrimaryTable().getRow(boxTarif.getWantedID());
                tableFacture.setTarif(selectedRow, false);
            }
        });
    }
    c.gridy++;
    c.gridx = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.BOTH;

    ITextArea infos = new ITextArea(4, 4);
    this.add(this.tableFacture, c);

    // FIXME
    this.addView(this.tableFacture.getRowValuesTable(), "");

    /*******************************************************************************************
     * * MODE DE REGLEMENT
     ******************************************************************************************/
    JPanel panelBottom = new JPanel(new GridBagLayout());
    GridBagConstraints cBottom = new DefaultGridBagConstraints();
    cBottom.weightx = 1;
    cBottom.anchor = GridBagConstraints.NORTHWEST;
    // Mode de rglement
    this.addView("ID_MODE_REGLEMENT", REQ + ";" + DEC + ";" + SEP);
    this.eltModeRegl = (ElementSQLObject) this.getView("ID_MODE_REGLEMENT");
    panelBottom.add(this.eltModeRegl, cBottom);

    /*******************************************************************************************
     * * FRAIS DE PORT ET REMISE
     ******************************************************************************************/
    JPanel panelFrais = new JPanel();
    panelFrais.setLayout(new GridBagLayout());

    final GridBagConstraints cFrais = new DefaultGridBagConstraints();

    this.textPortHT = new DeviseField(5);
    DefaultGridBagConstraints.lockMinimumSize(textPortHT);
    addSQLObject(this.textPortHT, "PORT_HT");
    this.textRemiseHT = new DeviseField(5);
    DefaultGridBagConstraints.lockMinimumSize(textRemiseHT);
    addSQLObject(this.textRemiseHT, "REMISE_HT");

    // Frais de port
    cFrais.gridheight = 1;
    cFrais.gridx = 1;
    SQLRequestComboBox boxTaxePort = new SQLRequestComboBox(false, 8);
    if (getTable().contains("ID_TAXE_PORT")) {

        JLabel labelPortHT = new JLabel(getLabelFor("PORT_HT"));
        labelPortHT.setHorizontalAlignment(SwingConstants.RIGHT);
        cFrais.gridy++;
        panelFrais.add(labelPortHT, cFrais);
        cFrais.gridx++;
        panelFrais.add(this.textPortHT, cFrais);

        JLabel labelTaxeHT = new JLabel(getLabelFor("ID_TAXE_PORT"));
        labelTaxeHT.setHorizontalAlignment(SwingConstants.RIGHT);
        cFrais.gridx = 1;
        cFrais.gridy++;
        panelFrais.add(labelTaxeHT, cFrais);
        cFrais.gridx++;
        panelFrais.add(boxTaxePort, cFrais);
        this.addView(boxTaxePort, "ID_TAXE_PORT", REQ);

        boxTaxePort.addValueListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                // TODO Raccord de mthode auto-gnr
                totalTTC.updateTotal();
            }
        });
    }

    // Remise
    JLabel labelRemiseHT = new JLabel(getLabelFor("REMISE_HT"));
    labelRemiseHT.setHorizontalAlignment(SwingConstants.RIGHT);
    cFrais.gridy++;
    cFrais.gridx = 1;
    panelFrais.add(labelRemiseHT, cFrais);
    cFrais.gridx++;
    panelFrais.add(this.textRemiseHT, cFrais);
    cFrais.gridy++;

    cBottom.gridx++;
    cBottom.weightx = 1;
    cBottom.anchor = GridBagConstraints.NORTHEAST;
    cBottom.fill = GridBagConstraints.NONE;
    panelBottom.add(panelFrais, cBottom);

    /*******************************************************************************************
     * * CALCUL DES TOTAUX
     ******************************************************************************************/
    DeviseField fieldHT = new DeviseField();
    final DeviseField fieldTVA = new DeviseField();
    DeviseField fieldService = new DeviseField();
    DeviseField fieldTHA = new DeviseField();

    DeviseField fieldDevise = null;
    if (getTable().getFieldsName().contains("T_DEVISE")) {
        fieldDevise = new DeviseField();
        addSQLObject(fieldDevise, "T_DEVISE");
    }
    // FIXME was required but not displayed for KD
    addSQLObject(fieldTHA, "T_HA");
    addRequiredSQLObject(fieldHT, "T_HT");
    addRequiredSQLObject(fieldTVA, "T_TVA");
    addRequiredSQLObject(this.fieldTTC, "T_TTC");
    addRequiredSQLObject(fieldService, "T_SERVICE");
    JTextField poids = new JTextField();
    addSQLObject(poids, "T_POIDS");

    totalTTC = new TotalPanel(this.tableFacture, fieldHT, fieldTVA, this.fieldTTC, this.textPortHT,
            this.textRemiseHT, fieldService, fieldTHA, fieldDevise, poids, null,
            (getTable().contains("ID_TAXE_PORT") ? boxTaxePort : null));
    DefaultGridBagConstraints.lockMinimumSize(totalTTC);
    cBottom.gridx++;
    cBottom.weightx = 1;
    cBottom.anchor = GridBagConstraints.EAST;
    cBottom.fill = GridBagConstraints.HORIZONTAL;
    panelBottom.add(totalTTC, cBottom);

    c.anchor = GridBagConstraints.WEST;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy++;
    c.weighty = 0;
    this.add(panelBottom, c);

    // Ligne : Avoir
    c.gridy++;
    c.gridx = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(createPanelAvoir(), c);

    // Infos
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 4;
    c.fill = GridBagConstraints.BOTH;
    this.add(new TitledSeparator(getLabelFor("INFOS")), c);

    c.gridy++;

    final JScrollPane comp = new JScrollPane(infos);
    infos.setBorder(null);
    DefaultGridBagConstraints.lockMinimumSize(comp);
    this.add(comp, c);

    this.panelOO = new PanelOOSQLComponent(this);
    c.gridy++;
    c.gridx = 0;
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTHEAST;
    this.add(this.panelOO, c);

    this.addSQLObject(this.textAvoirTTC, "T_AVOIR_TTC");

    this.addRequiredSQLObject(dateSaisie, "DATE");
    this.addRequiredSQLObject(this.comboClient, "ID_CLIENT");
    this.addSQLObject(this.comboAdresse, "ID_ADRESSE");
    this.addRequiredSQLObject(this.textNumeroUnique, "NUMERO");
    this.addSQLObject(infos, "INFOS");
    this.addSQLObject(this.checkPrevisionnelle, "PREVISIONNELLE");
    this.addSQLObject(this.checkComplement, "COMPLEMENT");
    this.addSQLObject(this.selAvoir, "ID_AVOIR_CLIENT");
    this.addSQLObject(this.compteSelService, "ID_COMPTE_PCE_SERVICE");
    ModeDeReglementSQLComponent modeReglComp;

    modeReglComp = (ModeDeReglementSQLComponent) this.eltModeRegl.getSQLChild();
    this.selAvoir.getRequest().setWhere(new Where(this.tableAvoir.getField("SOLDE"), "=", Boolean.FALSE));
    this.selAvoir.fillCombo();

    // Selection du compte de service
    int idCompteVenteService = rowPrefsCompte.getInt("ID_COMPTE_PCE_VENTE_SERVICE");
    if (idCompteVenteService <= 1) {
        try {
            idCompteVenteService = ComptePCESQLElement.getIdComptePceDefault("VentesServices");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    this.compteSelService.setValue(idCompteVenteService);

    // Lock

    DefaultGridBagConstraints.lockMinimumSize(this.comboClient);
    DefaultGridBagConstraints.lockMinimumSize(this.comboCommercial);
    DefaultGridBagConstraints.lockMinimumSize(this.comboAdresse);

    // Listeners

    this.comboClient.addValueListener(this.listenerModeReglDefaut);
    this.fieldTTC.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent e) {
            refreshText();
        }

    });

    this.selAvoir.addValueListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            refreshText();
        }

    });

    this.checkAcompte.addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {

            pAcompte.setVisible(SaisieVenteFactureSQLComponent.this.checkAcompte.isSelected());
        }
    });

    this.changeClientListener = new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {

            if (SaisieVenteFactureSQLComponent.this.comboClient.getValue() != null) {
                final SQLRow row = SaisieVenteFactureSQLComponent.this.comboClient.getSelectedRow();
                final int id = row == null ? SQLRow.NONEXISTANT_ID : row.getID();

                SaisieVenteFactureSQLComponent.this.defaultContactRowValues.putForeignID("ID_CLIENT", row);
                if (row != null) {
                    if (SaisieVenteFactureSQLComponent.this.contact != null) {
                        Where w = new Where(
                                SaisieVenteFactureSQLComponent.this.eltContact.getTable().getField("ID_CLIENT"),
                                "=", SQLRow.NONEXISTANT_ID);
                        w = w.or(new Where(
                                SaisieVenteFactureSQLComponent.this.eltContact.getTable().getField("ID_CLIENT"),
                                "=", id));
                        SaisieVenteFactureSQLComponent.this.contact.getRequest().setWhere(w);
                    }
                    if (SaisieVenteFactureSQLComponent.this.comboAdresse != null) {

                        Where w = new Where(SaisieVenteFactureSQLComponent.TABLE_ADRESSE.getKey(), "=",
                                row.getInt("ID_ADRESSE"));

                        w = w.or(new Where(SaisieVenteFactureSQLComponent.TABLE_ADRESSE.getKey(), "=",
                                row.getInt("ID_ADRESSE_L")));
                        w = w.or(new Where(SaisieVenteFactureSQLComponent.TABLE_ADRESSE.getKey(), "=",
                                row.getInt("ID_ADRESSE_F")));

                        SQLRow rowCli = row;

                        w = w.or(new Where(SaisieVenteFactureSQLComponent.TABLE_ADRESSE.getField("ID_CLIENT"),
                                "=", rowCli.getID()));

                        SaisieVenteFactureSQLComponent.this.comboAdresse.getRequest().setWhere(w);
                    }
                } else {
                    if (SaisieVenteFactureSQLComponent.this.comboAdresse != null) {
                        SaisieVenteFactureSQLComponent.this.comboAdresse.getRequest().setWhere(null);
                    }
                }
                SaisieVenteFactureSQLComponent.this.previousClient = id;
            }

        }
    };

    this.changeCompteListener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            SQLSelect sel = new SQLSelect(getTable().getBase());
            sel.addSelect(SaisieVenteFactureSQLComponent.this.client.getTable().getKey());
            Where where = new Where(
                    SaisieVenteFactureSQLComponent.this.client.getTable().getField("ID_COMPTE_PCE"), "=",
                    SaisieVenteFactureSQLComponent.this.compteSel.getValue());
            sel.setWhere(where);

            String req = sel.asString();
            List l = getTable().getBase().getDataSource().execute(req);
            if (l != null) {
                if (l.size() == 1) {
                    Map<String, Object> m = (Map<String, Object>) l.get(0);
                    Object o = m.get(SaisieVenteFactureSQLComponent.this.client.getTable().getKey().getName());
                    System.err.println("Only one value match :: " + o);
                    if (o != null) {
                        SaisieVenteFactureSQLComponent.this.comboClient
                                .setValue(Integer.valueOf(((Number) o).intValue()));
                    }
                }
            }
        }
    };

    this.textPortHT.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });

    this.textRemiseHT.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });
    this.comboClient.addValueListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (SaisieVenteFactureSQLComponent.this.isFilling())
                return;
            final SQLRow row = ((SQLRequestComboBox) evt.getSource()).getSelectedRow();
            if (row != null) {
                SaisieVenteFactureSQLComponent.this.defaultContactRowValues.putForeignID("ID_CLIENT", row);
                if (SaisieVenteFactureSQLComponent.this.client.getTable().contains("ID_TARIF")) {
                    SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
                    if (foreignRow != null && !foreignRow.isUndefined()
                            && (boxTarif.getSelectedRow() == null
                                    || boxTarif.getSelectedId() != foreignRow.getID())
                            && JOptionPane.showConfirmDialog(null,
                                    "Appliquer les tarifs associs au client?") == JOptionPane.YES_OPTION) {
                        boxTarif.setValue(foreignRow.getID());
                        // SaisieVenteFactureSQLComponent.this.tableFacture.setTarif(foreignRow,
                        // true);
                    } else {
                        boxTarif.setValue(foreignRow);
                    }

                }

                int idCpt = row.getInt("ID_COMPTE_PCE");

                if (idCpt <= 1) {
                    // Select Compte client par defaut
                    idCpt = rowPrefsCompte.getInt("ID_COMPTE_PCE_CLIENT");
                    if (idCpt <= 1) {
                        try {
                            idCpt = ComptePCESQLElement.getIdComptePceDefault("Clients");
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
                if (SaisieVenteFactureSQLComponent.this.compteSel != null) {
                    Integer i = SaisieVenteFactureSQLComponent.this.compteSel.getValue();
                    if (i == null || i.intValue() != idCpt) {
                        SaisieVenteFactureSQLComponent.this.compteSel.setValue(idCpt);
                    }
                }
            }

        }
    });

}

From source file:net.sourceforge.squirrel_sql.client.preferences.WikiTablePreferencesPanel.java

private void setLabelConstraints(GridBagConstraints gbc, int gridy) {
    gbc.gridx = 0;/*from w  w w .j  a  v  a 2s. c om*/
    gbc.gridy = gridy;
    //      gbc.gridwidth = 0;
    gbc.weightx = 0;
    gbc.insets = LABEL_INSETS;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;
}

From source file:org.esa.beam.visat.toolviews.spectrum.SpectrumToolView.java

@Override
public JComponent createControl() {
    final JFreeChart chart = ChartFactory.createXYLineChart(CHART_TITLE, "Wavelength (nm)", "", null,
            PlotOrientation.VERTICAL, true, true, false);
    chart.getXYPlot().getRangeAxis().addChangeListener(new AxisChangeListener() {
        @Override/*from  ww  w  . ja  va2  s.com*/
        public void axisChanged(AxisChangeEvent axisChangeEvent) {
            if (!isCodeInducedAxisChange) {
                rangeAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange();
            }
        }
    });
    chart.getXYPlot().getDomainAxis().addChangeListener(new AxisChangeListener() {
        @Override
        public void axisChanged(AxisChangeEvent axisChangeEvent) {
            if (!isCodeInducedAxisChange) {
                domainAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange();
            }
        }
    });
    chart.getXYPlot().getRangeAxis().setAutoRange(false);
    rangeAxisAdjustmentIsFrozen = false;
    chart.getXYPlot().getDomainAxis().setAutoRange(false);
    domainAxisAdjustmentIsFrozen = false;
    chartPanel = new ChartPanel(chart);
    chartHandler = new ChartHandler(chart);
    final XYPlotMarker plotMarker = new XYPlotMarker(chartPanel, new XYPlotMarker.Listener() {
        @Override
        public void pointSelected(XYDataset xyDataset, int seriesIndex, Point2D dataPoint) {
            if (hasDiagram()) {
                if (cursorSynchronizer == null) {
                    cursorSynchronizer = new CursorSynchronizer(VisatApp.getApp());
                }
                if (!cursorSynchronizer.isEnabled()) {
                    cursorSynchronizer.setEnabled(true);
                }
            }
        }

        @Override
        public void pointDeselected() {
            cursorSynchronizer.setEnabled(false);
        }
    });

    titleBase = getDescriptor().getTitle();
    filterButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Filter24.gif"), false);
    filterButton.setName("filterButton");
    filterButton.setEnabled(false);
    filterButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            selectSpectralBands();
            recreateChart();
        }
    });

    showSpectrumForCursorButton = ToolButtonFactory
            .createButton(UIUtils.loadImageIcon("icons/CursorSpectrum24.gif"), true);
    showSpectrumForCursorButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            recreateChart();
        }
    });
    showSpectrumForCursorButton.setName("showSpectrumForCursorButton");
    showSpectrumForCursorButton.setSelected(true);
    showSpectrumForCursorButton.setToolTipText("Show spectrum at cursor position.");

    showSpectraForSelectedPinsButton = ToolButtonFactory
            .createButton(UIUtils.loadImageIcon("icons/SelectedPinSpectra24.gif"), true);
    showSpectraForSelectedPinsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (isShowingSpectraForAllPins()) {
                showSpectraForAllPinsButton.setSelected(false);
            } else if (!isShowingSpectraForSelectedPins()) {
                plotMarker.setInvisible();
            }
            recreateChart();
        }
    });
    showSpectraForSelectedPinsButton.setName("showSpectraForSelectedPinsButton");
    showSpectraForSelectedPinsButton.setToolTipText("Show spectra for selected pins.");

    showSpectraForAllPinsButton = ToolButtonFactory
            .createButton(UIUtils.loadImageIcon("icons/PinSpectra24.gif"), true);
    showSpectraForAllPinsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (isShowingSpectraForSelectedPins()) {
                showSpectraForSelectedPinsButton.setSelected(false);
            } else if (!isShowingSpectraForAllPins()) {
                plotMarker.setInvisible();
            }
            recreateChart();
        }
    });
    showSpectraForAllPinsButton.setName("showSpectraForAllPinsButton");
    showSpectraForAllPinsButton.setToolTipText("Show spectra for all pins.");

    // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007)
    //        showAveragePinSpectrumButton = ToolButtonFactory.createButton(
    //                UIUtils.loadImageIcon("icons/AverageSpectrum24.gif"), true);
    //        showAveragePinSpectrumButton.addActionListener(new ActionListener() {
    //            public void actionPerformed(ActionEvent e) {
    //                // todo - implement
    //            }
    //        });
    //        showAveragePinSpectrumButton.setName("showAveragePinSpectrumButton");
    //        showAveragePinSpectrumButton.setToolTipText("Show average spectrum of all pin spectra.");

    showGridButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/SpectrumGrid24.gif"), true);
    showGridButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            chartHandler.setGridVisible(showGridButton.isSelected());
        }
    });
    showGridButton.setName("showGridButton");
    showGridButton.setToolTipText("Show diagram grid.");

    // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007)
    //        showGraphPointsButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/GraphPoints24.gif"), true);
    //        showGraphPointsButton.addActionListener(new ActionListener() {
    //            public void actionPerformed(ActionEvent e) {
    //                // todo - implement
    //                JOptionPane.showMessageDialog(null, "Not implemented");
    //            }
    //        });
    //        showGraphPointsButton.setName("showGraphPointsButton");
    //        showGraphPointsButton.setToolTipText("Show graph points grid.");

    AbstractButton exportSpectraButton = ToolButtonFactory
            .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false);
    exportSpectraButton.addActionListener(new SpectraExportAction(this));
    exportSpectraButton.setToolTipText("Export spectra to text file.");
    exportSpectraButton.setName("exportSpectraButton");

    AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help22.png"),
            false);
    helpButton.setName("helpButton");
    helpButton.setToolTipText("Help."); /*I18N*/

    final JPanel buttonPane = GridBagUtils.createPanel();
    final GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.NONE;
    gbc.insets.top = 2;
    gbc.gridy = 0;
    buttonPane.add(filterButton, gbc);
    gbc.gridy++;
    buttonPane.add(showSpectrumForCursorButton, gbc);
    gbc.gridy++;
    buttonPane.add(showSpectraForSelectedPinsButton, gbc);
    gbc.gridy++;
    buttonPane.add(showSpectraForAllPinsButton, gbc);
    gbc.gridy++;
    // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007)
    //        buttonPane.add(showAveragePinSpectrumButton, gbc);
    //        gbc.gridy++;
    buttonPane.add(showGridButton, gbc);
    gbc.gridy++;
    // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007)
    //        buttonPane.add(showGraphPointsButton, gbc);
    //        gbc.gridy++;
    buttonPane.add(exportSpectraButton, gbc);

    gbc.gridy++;
    gbc.insets.bottom = 0;
    gbc.fill = GridBagConstraints.VERTICAL;
    gbc.weighty = 1.0;
    gbc.gridwidth = 2;
    buttonPane.add(new JLabel(" "), gbc); // filler
    gbc.fill = GridBagConstraints.NONE;
    gbc.weighty = 0.0;
    gbc.gridy = 10;
    gbc.anchor = GridBagConstraints.EAST;
    buttonPane.add(helpButton, gbc);

    chartPanel.setPreferredSize(new Dimension(300, 200));
    chartPanel.setBackground(Color.white);
    chartPanel.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createBevelBorder(BevelBorder.LOWERED), BorderFactory.createEmptyBorder(2, 2, 2, 2)));
    chartPanel.addChartMouseListener(plotMarker);

    JPanel mainPane = new JPanel(new BorderLayout(4, 4));
    mainPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    mainPane.add(BorderLayout.CENTER, chartPanel);
    mainPane.add(BorderLayout.EAST, buttonPane);
    mainPane.setPreferredSize(new Dimension(320, 200));

    if (getDescriptor().getHelpId() != null) {
        HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId());
        HelpSys.enableHelpKey(mainPane, getDescriptor().getHelpId());
    }

    // Add an internal frame listener to VISAT so that we can update our
    // spectrum dialog with the information of the currently activated
    // product scene view.
    //
    VisatApp.getApp().addInternalFrameListener(new SpectrumIFL());

    VisatApp.getApp().getProductManager().addListener(new ProductManager.Listener() {
        @Override
        public void productAdded(ProductManager.Event event) {
            // ignored
        }

        @Override
        public void productRemoved(ProductManager.Event event) {
            final Product product = event.getProduct();
            if (getCurrentProduct() == product) {
                chartPanel.getChart().getXYPlot().setDataset(null);
                setCurrentView(null);
                setCurrentProduct(null);
            }
            if (productToAllSpectraMap.containsKey(product)) {
                productToAllSpectraMap.remove(product);
            }
            if (productToBandsMap.containsKey(product)) {
                productToBandsMap.remove(product);
            }
            PlacemarkGroup pinGroup = product.getPinGroup();
            for (int i = 0; i < pinGroup.getNodeCount(); i++) {
                chartHandler.removePinInformation(pinGroup.get(i));
            }
        }
    });

    final ProductSceneView view = VisatApp.getApp().getSelectedProductSceneView();
    if (view != null) {
        handleViewActivated(view);
    } else {
        setCurrentView(view);
    }
    updateUIState();
    return mainPane;
}

From source file:com.rapidminer.gui.new_plotter.gui.dialog.ManageZoomDialog.java

/**
 * Setup the GUI.//from  w  ww .j ava 2s . c o  m
 */
private void setupGUI() {
    JPanel mainPanel = new JPanel();
    this.setContentPane(mainPanel);

    // start layout
    mainPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 0;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(5, 5, 2, 5);
    JPanel radioPanel = new JPanel();
    radioPanel.setLayout(new BorderLayout());
    zoomRadiobutton = new JRadioButton(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.zoom.label"));
    zoomRadiobutton.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.zoom.tip"));
    zoomRadiobutton.setSelected(true);
    radioPanel.add(zoomRadiobutton, BorderLayout.LINE_START);

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.weightx = 1;
    selectionRadiobutton = new JRadioButton(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.selection.label"));
    selectionRadiobutton
            .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.selection.tip"));
    selectionRadiobutton.setHorizontalAlignment(SwingConstants.CENTER);
    radioPanel.add(selectionRadiobutton, BorderLayout.LINE_END);

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 3;
    this.add(radioPanel, gbc);

    ButtonGroup group = new ButtonGroup();
    group.add(zoomRadiobutton);
    group.add(selectionRadiobutton);

    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1;
    gbc.gridwidth = 3;
    gbc.anchor = GridBagConstraints.CENTER;
    rangeAxisSelectionCombobox = new JComboBox();
    rangeAxisSelectionCombobox.setToolTipText(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.range_axis_combobox.tip"));
    rangeAxisSelectionCombobox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updateValueRange();
        }
    });
    this.add(rangeAxisSelectionCombobox, gbc);

    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 1;
    gbc.gridwidth = 3;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(5, 5, 2, 5);
    JLabel domainRangeLowerBoundLabel = new JLabel(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.domain_lower_bound.label"));
    this.add(domainRangeLowerBoundLabel, gbc);

    gbc.gridx = 1;
    gbc.gridy = 2;
    gbc.insets = new Insets(2, 5, 2, 5);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    domainRangeLowerBoundField = new JTextField();
    domainRangeLowerBoundField.setText(String.valueOf(domainRangeLowerBound));
    domainRangeLowerBoundField.setInputVerifier(new InputVerifier() {

        @Override
        public boolean verify(JComponent input) {
            return verifyDomainRangeLowerBoundInput(input);
        }
    });
    domainRangeLowerBoundField.setToolTipText(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.domain_lower_bound.tip"));
    this.add(domainRangeLowerBoundField, gbc);

    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.fill = GridBagConstraints.NONE;
    JLabel domainRangeUpperBoundLabel = new JLabel(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.domain_upper_bound.label"));
    this.add(domainRangeUpperBoundLabel, gbc);

    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    domainRangeUpperBoundField = new JTextField();
    domainRangeUpperBoundField.setToolTipText(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.domain_upper_bound.tip"));
    domainRangeUpperBoundField.setText(String.valueOf(domainRangeUpperBound));
    domainRangeUpperBoundField.setInputVerifier(new InputVerifier() {

        @Override
        public boolean verify(JComponent input) {
            return verifyDomainRangeUpperBoundInput(input);
        }
    });
    this.add(domainRangeUpperBoundField, gbc);

    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.fill = GridBagConstraints.NONE;
    JLabel valueRangeLowerBoundLabel = new JLabel(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.value_lower_bound.label"));
    this.add(valueRangeLowerBoundLabel, gbc);

    gbc.gridx = 1;
    gbc.gridy = 4;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    valueRangeLowerBoundField = new JTextField();
    valueRangeLowerBoundField.setToolTipText(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.value_lower_bound.tip"));
    valueRangeLowerBoundField.setText(String.valueOf(valueRangeLowerBound));
    valueRangeLowerBoundField.setInputVerifier(new InputVerifier() {

        @Override
        public boolean verify(JComponent input) {
            return verifyValueRangeLowerBoundInput(input);
        }
    });
    this.add(valueRangeLowerBoundField, gbc);

    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.fill = GridBagConstraints.NONE;
    JLabel valueRangeUpperBoundLabel = new JLabel(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.value_upper_bound.label"));
    this.add(valueRangeUpperBoundLabel, gbc);

    gbc.gridx = 1;
    gbc.gridy = 5;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    valueRangeUpperBoundField = new JTextField();
    valueRangeUpperBoundField.setToolTipText(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.value_upper_bound.tip"));
    valueRangeUpperBoundField.setText(String.valueOf(valueRangeUpperBound));
    valueRangeUpperBoundField.setInputVerifier(new InputVerifier() {

        @Override
        public boolean verify(JComponent input) {
            return verifyValueRangeUpperBoundInput(input);
        }
    });
    this.add(valueRangeUpperBoundField, gbc);

    gbc.gridx = 0;
    gbc.gridy = 6;
    gbc.gridwidth = 3;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.CENTER;
    this.add(new JSeparator(), gbc);

    gbc.gridx = 0;
    gbc.gridy = 7;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    JLabel colorMinValueLabel = new JLabel(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.color_min_value.label"));
    this.add(colorMinValueLabel, gbc);

    gbc.gridx = 1;
    gbc.gridy = 7;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    colorMinValueField = new JTextField();
    colorMinValueField
            .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.color_min_value.tip"));
    colorMinValueField.setText(String.valueOf(colorMinValue));
    colorMinValueField.setInputVerifier(new InputVerifier() {

        @Override
        public boolean verify(JComponent input) {
            return verifyColorInput(input);
        }
    });
    colorMinValueField.setEnabled(false);
    this.add(colorMinValueField, gbc);

    gbc.gridx = 0;
    gbc.gridy = 8;
    gbc.fill = GridBagConstraints.NONE;
    JLabel colorMaxValueLabel = new JLabel(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.color_max_value.label"));
    this.add(colorMaxValueLabel, gbc);

    gbc.gridx = 1;
    gbc.gridy = 8;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    colorMaxValueField = new JTextField();
    colorMaxValueField
            .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.color_max_value.tip"));
    colorMaxValueField.setText(String.valueOf(colorMaxValue));
    colorMaxValueField.setInputVerifier(new InputVerifier() {

        @Override
        public boolean verify(JComponent input) {
            return verifyColorInput(input);
        }
    });
    colorMaxValueField.setEnabled(false);
    this.add(colorMaxValueField, gbc);

    gbc.gridx = 1;
    gbc.gridy = 9;
    gbc.fill = GridBagConstraints.NONE;
    restoreColorButton = new JButton(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.restore_color.label"));
    restoreColorButton
            .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.restore_color.tip"));
    restoreColorButton.setIcon(SwingTools.createIcon(
            "16/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.restore_color.icon")));
    restoreColorButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            LinkAndBrushSelection linkAndBrushSelection = new LinkAndBrushSelection(SelectionType.RESTORE_COLOR,
                    new LinkedList<Pair<Integer, Range>>(), new LinkedList<Pair<Integer, Range>>(), null, null,
                    engine.getPlotInstance());
            engine.getChartPanel().informLinkAndBrushSelectionListeners(linkAndBrushSelection);
            updateColorValues();
        }
    });
    restoreColorButton.setEnabled(false);
    this.add(restoreColorButton, gbc);

    gbc.gridx = 0;
    gbc.gridy = 10;
    gbc.gridwidth = 3;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.insets = new Insets(2, 5, 5, 5);
    this.add(new JSeparator(), gbc);

    gbc.gridx = 0;
    gbc.gridy = 11;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(5, 5, 5, 5);
    okButton = new JButton(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.ok.label"));
    okButton.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.ok.tip"));
    okButton.setIcon(SwingTools
            .createIcon("24/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.ok.icon")));
    okButton.setMnemonic(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.ok.mne").toCharArray()[0]);
    okButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            // make sure fields have correct values
            boolean fieldsPassedChecks = checkFields();
            if (!fieldsPassedChecks) {
                return;
            }

            Object selectedItem = rangeAxisSelectionCombobox.getSelectedItem();
            if (selectedItem != null && selectedItem instanceof RangeAxisConfig) {
                RangeAxisConfig config = (RangeAxisConfig) selectedItem;
                boolean zoomOnLinkAndBrushSelection = engine.getChartPanel().getZoomOnLinkAndBrushSelection();
                Range domainRange = new Range(Double.parseDouble(domainRangeLowerBoundField.getText()),
                        Double.parseDouble(domainRangeUpperBoundField.getText()));
                Range valueRange = new Range(Double.parseDouble(valueRangeLowerBoundField.getText()),
                        Double.parseDouble(valueRangeUpperBoundField.getText()));
                LinkedList<Pair<Integer, Range>> domainRangeList = new LinkedList<Pair<Integer, Range>>();
                // only add domain zoom if != 0
                if (domainRange.getUpperBound() != 0) {
                    domainRangeList.add(new Pair<Integer, Range>(0, domainRange));
                }
                LinkedList<Pair<Integer, Range>> valueRangeList = new LinkedList<Pair<Integer, Range>>();
                // only add range zoom if at least one RangeAxisConfig exists
                if (engine.getPlotInstance().getMasterPlotConfiguration().getRangeAxisConfigs().size() > 0) {
                    if (valueRange.getUpperBound() != 0) {
                        // only add value zoom if != 0
                        valueRangeList.add(
                                new Pair<Integer, Range>(engine.getPlotInstance().getMasterPlotConfiguration()
                                        .getIndexOfRangeAxisConfigById(config.getId()), valueRange));
                    }
                }

                // zoom or select or color
                LinkAndBrushSelection linkAndBrushSelection = null;
                if (zoomRadiobutton.isSelected()) {
                    linkAndBrushSelection = new LinkAndBrushSelection(SelectionType.ZOOM_IN, domainRangeList,
                            valueRangeList);
                    if (isColorChanged(Double.parseDouble(colorMinValueField.getText()),
                            Double.parseDouble(colorMaxValueField.getText()))) {
                        linkAndBrushSelection = new LinkAndBrushSelection(SelectionType.COLOR_ZOOM,
                                domainRangeList, valueRangeList,
                                Double.parseDouble(colorMinValueField.getText()),
                                Double.parseDouble(colorMaxValueField.getText()), engine.getPlotInstance());
                    }
                } else if (selectionRadiobutton.isSelected()) {
                    linkAndBrushSelection = new LinkAndBrushSelection(SelectionType.SELECTION, domainRangeList,
                            valueRangeList);
                    if (isColorChanged(Double.parseDouble(colorMinValueField.getText()),
                            Double.parseDouble(colorMaxValueField.getText()))) {
                        linkAndBrushSelection = new LinkAndBrushSelection(SelectionType.COLOR_SELECTION,
                                domainRangeList, valueRangeList,
                                Double.parseDouble(colorMinValueField.getText()),
                                Double.parseDouble(colorMaxValueField.getText()), engine.getPlotInstance());
                    }
                }
                engine.getChartPanel().informLinkAndBrushSelectionListeners(linkAndBrushSelection);
                engine.getChartPanel().setZoomOnLinkAndBrushSelection(zoomOnLinkAndBrushSelection);
            } else {
                return;
            }

            ManageZoomDialog.this.dispose();
        }
    });
    okButton.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                okButton.doClick();
            }
        }
    });
    this.add(okButton, gbc);

    gbc.gridx = 2;
    gbc.gridy = 11;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;
    cancelButton = new JButton(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.cancel.label"));
    cancelButton.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.cancel.tip"));
    cancelButton.setIcon(SwingTools
            .createIcon("24/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.cancel.icon")));
    cancelButton.setMnemonic(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.cancel.mne").toCharArray()[0]);
    cancelButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            // cancel requested, close dialog
            ManageZoomDialog.this.dispose();
        }
    });
    this.add(cancelButton, gbc);

    // misc settings
    this.setMinimumSize(new Dimension(375, 360));
    // center dialog
    this.setLocationRelativeTo(null);
    this.setTitle(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.title.label"));
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setModal(true);

    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowActivated(WindowEvent e) {
            okButton.requestFocusInWindow();
        }
    });
}