Example usage for javax.swing JCheckBox isSelected

List of usage examples for javax.swing JCheckBox isSelected

Introduction

In this page you can find the example usage for javax.swing JCheckBox isSelected.

Prototype

public boolean isSelected() 

Source Link

Document

Returns the state of the button.

Usage

From source file:org.nuclos.client.wizard.steps.NuclosEntitySQLLayoutStep.java

@Override
protected void initComponents() {

    double size[][] = { { TableLayout.FILL, 20, TableLayout.FILL },
            { TableLayout.PREFERRED, 20, 20, 20, 20, 20, 5, TableLayout.PREFERRED, 20 } };

    TableLayout layout = new TableLayout(size);
    layout.setVGap(3);/*  w w  w . j  a  va2 s .c  o  m*/
    layout.setHGap(5);
    this.setLayout(layout);

    lbRowColorScript = new JLabel(SpringLocaleDelegate.getInstance().getMessage(
            "wizard.step.entitysqllayout.rowcolor", "Hintergrundfarbe der Zeilendarstellung konfigurieren"));
    btRowColorScript = new JButton("...");
    btRowColorScript.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ScriptEditor editor = new ScriptEditor();
            if (getModel().getRowColorScript() != null) {
                editor.setScript(getModel().getRowColorScript());
            }
            editor.run();
            NuclosScript script = editor.getScript();
            if (org.nuclos.common2.StringUtils.isNullOrEmpty(script.getSource())) {
                script = null;
            }
            getModel().setRowColorScript(script);
        }
    });

    lbLayout = new JLabel(SpringLocaleDelegate.getInstance().getMessage("wizard.step.entitysqllayout.2",
            "M\u00f6chten Sie eine Standard-Maske generieren lassen"));
    cbLayout = new JCheckBox();
    cbLayout.setToolTipText(SpringLocaleDelegate.getInstance().getMessage(
            "wizard.step.entitysqllayout.tooltip.2", "M\u00f6chten Sie eine Standard-Maske generieren lassen"));

    lbAttributeGroup = new JLabel(SpringLocaleDelegate.getInstance()
            .getMessage("wizard.step.entitysqllayout.12", "Attributegruppen werden zusammengefasst"));
    cbAttributeGroup = new JCheckBox();
    cbAttributeGroup.setToolTipText(SpringLocaleDelegate.getInstance()
            .getMessage("wizard.step.entitysqllayout.tooltip.3", "Attributegruppen werden zusammengefasst"));

    lbAttributeText = new JLabel(SpringLocaleDelegate.getInstance().getMessage("wizard.step.entitysqllayout.13",
            "Geben Sie die Reihenfolge an, in der die Felder in der Maske erstellt werden sollen"));

    lbSubforms = new JLabel(SpringLocaleDelegate.getInstance().getMessage("wizard.step.entitysqllayout.14",
            "Vorhandene Unterformular mit ins Layout aufnehmen"));
    cbSubforms = new JCheckBox();
    cbSubforms.setToolTipText(SpringLocaleDelegate.getInstance().getMessage(
            "wizard.step.entitysqllayout.tooltip.4", "Vorhandene Unterformulare mit ins Layout aufnehmen"));

    lbEditFields = new JLabel(SpringLocaleDelegate.getInstance().getMessage("wizard.step.entitysqllayout.15",
            "Editierungsfelder erstellen:"));
    cbEditFields = new JCheckBox();
    cbEditFields.setSelected(true);
    cbEditFields.setToolTipText(SpringLocaleDelegate.getInstance().getMessage(
            "wizard.step.entitysqllayout.tooltip.7", "Editierungsfelder mit in das Layout aufnehmen"));

    listAttributeOrder = new JList();

    treeModel = new MyTreeModel();

    treeAttributeOrder = new JTree(treeModel);
    treeAttributeOrder.setCellRenderer(new MyTreeCellRenderer());
    treeAttributeOrder.setRootVisible(false);
    treeAttributeOrder.setExpandsSelectedPaths(true);

    sPane = new JScrollPane(listAttributeOrder);

    panelAttributes = new JPanel();
    double sizePanel[][] = { { TableLayout.FILL, 3, 20 }, { 20, 3, 20, 3, TableLayout.PREFERRED } };
    panelAttributes.setLayout(new TableLayout(sizePanel));

    btUp = new JButton(Icons.getInstance().getIconSortAscending());
    btUp.setToolTipText(SpringLocaleDelegate.getInstance().getMessage("wizard.step.entitysqllayout.tooltip.5",
            "Attribut nach oben schieben"));
    btDown = new JButton(Icons.getInstance().getIconSortDescending());
    btDown.setToolTipText(SpringLocaleDelegate.getInstance().getMessage("wizard.step.entitysqllayout.tooltip.6",
            "Attribut nach unten schieben"));

    panelAttributes.add(sPane, "0,0, 0,4");
    panelAttributes.add(btUp, "2,0");
    panelAttributes.add(btDown, "2,2");

    this.add(lbRowColorScript, "0,0");
    this.add(btRowColorScript, "1,0");
    this.add(lbLayout, "0,1");
    this.add(cbLayout, "1,1");
    this.add(lbAttributeGroup, "0,2");
    this.add(cbAttributeGroup, "1,2");
    this.add(lbSubforms, "0,3");
    this.add(cbSubforms, "1,3");
    this.add(lbEditFields, "0,4");
    this.add(cbEditFields, "1,4");
    this.add(lbAttributeText, "0,5, 1,5");
    this.add(panelAttributes, "0,6, 1,7");

    enableLayoutOptions(false);

    //      cbAttributeGroup.addItemListener(new ItemListener() {
    //
    //         @Override
    //         public void itemStateChanged(ItemEvent e) {
    //            JCheckBox cb = (JCheckBox)e.getItem();
    //            if(cb.isSelected()) {
    //               sPane.setViewportView(treeAttributeOrder);
    //            }
    //            else {
    //               sPane.setViewportView(listAttributeOrder);
    //            }
    //         }
    //      });

    cbLayout.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            JCheckBox cb = (JCheckBox) e.getItem();
            NuclosEntitySQLLayoutStep.this.model.setCreateLayout(cb.isSelected());
            if (cb.isSelected() && hasEntityLayout) {
                (new Bubble(cbLayout,
                        SpringLocaleDelegate.getInstance().getMessage("wizard.step.entitysqllayout.9",
                                "Achtung! Ihr bestehendes Layout wird berschrieben!"),
                        5, Position.UPPER)).setVisible(true);
            }
            enableLayoutOptions(cb.isSelected());
        }
    });

    btUp.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            //            if(cbAttributeGroup.isSelected()) {
            //               buttonUpAction2();
            //            }
            //            else {
            buttonUpAttributeAction();
            //            }

        }
    });

    btDown.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            //            if(cbAttributeGroup.isSelected()) {
            //               buttonDownAction2();
            //            }
            //            else {
            buttonDownAttributeAction();
        }
        //         }
    });

}

From source file:org.openconcerto.erp.core.finance.accounting.ui.ClotureMensuellePayePanel.java

public ClotureMensuellePayePanel() {

    super();/*from  w w w  .java2  s. c o  m*/

    this.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(2, 2, 1, 2);
    c.weightx = 0;
    c.weighty = 0;
    c.gridheight = 1;
    c.gridwidth = 1;
    c.gridx = 0;
    c.gridy = 0;

    JLabel labelMois = new JLabel("Cloture du mois de ");
    this.add(labelMois, c);

    final ElementComboBox selMois = new ElementComboBox(true, 25);
    selMois.init(((ComptaPropsConfiguration) Configuration.getInstance()).getDirectory()
            .getElement(MoisSQLElement.class));
    selMois.setButtonsVisible(false);
    c.gridx++;
    this.add(selMois, c);

    JLabel labelAnnee = new JLabel("Anne");
    c.gridx++;
    this.add(labelAnnee, c);
    final JTextField textAnnee = new JTextField(5);
    c.gridx++;
    this.add(textAnnee, c);
    DateFormat format = new SimpleDateFormat("yyyy");
    textAnnee.setText(format.format(new Date()));

    c.gridy++;
    c.gridx = 0;
    final JCheckBox boxValid = new JCheckBox("Valider toutes les payes du mois");
    final JCheckBox boxCompta = new JCheckBox("Gnrer les critures comptables associes");
    c.gridwidth = GridBagConstraints.REMAINDER;
    this.add(boxValid, c);
    boxValid.setSelected(true);
    c.gridy++;
    this.add(boxCompta, c);

    JButton buttonClot = new JButton("Clturer");
    JButton buttonFermer = new JButton("Fermer");

    JPanel panelButton = new JPanel();
    panelButton.add(buttonClot);
    panelButton.add(buttonFermer);
    c.anchor = GridBagConstraints.SOUTHEAST;
    c.fill = GridBagConstraints.NONE;
    c.weighty = 1;
    c.gridy++;
    this.add(panelButton, c);

    buttonFermer.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            ((JFrame) SwingUtilities.getRoot(ClotureMensuellePayePanel.this)).dispose();
        }
    });

    buttonClot.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {

                // Valider les fiches non valids des salaris actifs
                if (boxValid.isSelected()) {
                    SQLSelect selFiche = new SQLSelect();
                    SQLTable tableFiche = ClotureMensuellePayePanel.this.base.getTable("FICHE_PAYE");
                    SQLTable tableSalarie = ClotureMensuellePayePanel.this.base.getTable("SALARIE");
                    SQLTable tableInfosSal = ClotureMensuellePayePanel.this.base.getTable("INFOS_SALARIE_PAYE");
                    selFiche.addSelect(tableFiche.getField("ID"));

                    selFiche.setWhere(new Where(tableFiche.getField("VALIDE"), "=", Boolean.FALSE));
                    selFiche.andWhere(new Where(tableFiche.getField("ID_MOIS"), "=", selMois.getSelectedId()));
                    selFiche.andWhere(
                            new Where(tableFiche.getField("ANNEE"), "=", new Integer(textAnnee.getText())));
                    selFiche.andWhere(
                            new Where(tableSalarie.getField("ID"), "=", tableFiche.getField("ID_SALARIE")));
                    selFiche.andWhere(new Where(tableInfosSal.getField("ID"), "=",
                            tableSalarie.getField("ID_INFOS_SALARIE_PAYE")));

                    // FIXME ne pas valider les fiches d'un employ renvoy

                    // Where w2 = new Where(tableInfosSal.getField("DATE_SORTIE"), "IS",
                    // "NULL");
                    Calendar cal = Calendar.getInstance();
                    cal.set(Calendar.DATE, 1);
                    cal.set(Calendar.MONTH, selMois.getSelectedId() - 2);
                    cal.set(Calendar.YEAR, Integer.parseInt(textAnnee.getText()));
                    cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DATE));

                    Where w = new Where(tableInfosSal.getField("DATE_SORTIE"), "<=", cal.getTime());
                    w = w.or(new Where(tableInfosSal.getField("DATE_SORTIE"), "=", (Object) null));
                    selFiche.andWhere(w);
                    String req = selFiche.asString();
                    System.err.println(req);
                    List l = (List) ClotureMensuellePayePanel.this.base.getDataSource().execute(req,
                            new ArrayListHandler());

                    for (int i = 0; i < l.size(); i++) {

                        Object[] tmp = (Object[]) l.get(i);
                        SQLRow rowFicheTmp = tableFiche.getRow(Integer.parseInt(tmp[0].toString()));
                        System.err.println(rowFicheTmp);
                        FichePayeSQLElement.validationFiche(rowFicheTmp.getID());
                    }
                }

                // cloture du mois et generation compta

                SQLSelect selFiche = new SQLSelect(ClotureMensuellePayePanel.this.base);
                SQLTable tableFiche = ClotureMensuellePayePanel.this.base.getTable("FICHE_PAYE");
                SQLTable tableMois = ClotureMensuellePayePanel.this.base.getTable("MOIS");
                selFiche.addSelect(tableFiche.getField("ID"));

                selFiche.setWhere(new Where(tableFiche.getField("VALIDE"), "=", Boolean.TRUE));
                selFiche.andWhere(new Where(tableFiche.getField("ID_MOIS"), "=", selMois.getSelectedId()));
                selFiche.andWhere(
                        new Where(tableFiche.getField("ANNEE"), "=", new Integer(textAnnee.getText())));

                String req = selFiche.asString();

                List l = (List) ClotureMensuellePayePanel.this.base.getDataSource().execute(req,
                        new ArrayListHandler());

                if (l != null && l.size() > 0) {
                    int[] idS = new int[l.size()];
                    SQLRow rowMois = tableMois.getRow(selMois.getSelectedId());

                    for (int i = 0; i < l.size(); i++) {

                        Object[] tmp = (Object[]) l.get(i);
                        idS[i] = Integer.parseInt(tmp[0].toString());
                        SQLRow rowFiche = tableFiche.getRow(idS[i]);
                        FichePayeSQLElement.clotureMensuelle(selMois.getSelectedId(),
                                Integer.parseInt(textAnnee.getText()), rowFiche.getInt("ID_SALARIE"));
                    }
                    if (boxCompta.isSelected()) {
                        new GenerationMvtFichePaye(idS, rowMois.getString("NOM"), textAnnee.getText());
                    }
                }
                System.err.println(
                        "ClotureMensuellePayePanel.ClotureMensuellePayePanel().new ActionListener() {...}.actionPerformed()");
                JOptionPane.showMessageDialog(null, "Clture termine");
            } catch (Exception ex) {
                ExceptionHandler.handle("Unable to complete operation", ex);
            }
        }
    });
}

From source file:org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent.java

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

    // Numero du commande
    c.gridx = 0;//from w  w  w.  ja v a 2  s.c  om
    c.weightx = 0;
    this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c);

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

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

    JDate dateCommande = new JDate(true);
    c.gridx++;
    c.fill = GridBagConstraints.NONE;
    this.add(dateCommande, c);

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

    c.gridx = GridBagConstraints.RELATIVE;
    c.gridwidth = 1;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;
    this.add(this.fourn, c);

    if (!getTable().getFieldsName().contains("LIVRER")) {
        // Commande en cours
        JCheckBox boxEnCours = new JCheckBox(getLabelFor("EN_COURS"));
        c.gridx = 2;
        c.weightx = 0;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.gridwidth = GridBagConstraints.REMAINDER;
        this.add(boxEnCours, c);
        c.gridwidth = 1;
        this.addRequiredSQLObject(boxEnCours, "EN_COURS");
    }

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

        c.gridx = GridBagConstraints.RELATIVE;
        c.gridwidth = 1;
        c.weightx = 1;
        c.weighty = 0;
        c.fill = GridBagConstraints.HORIZONTAL;
        final ElementComboBox boxContactFournisseur = new ElementComboBox();
        final SQLElement contactElement = Configuration.getInstance().getDirectory()
                .getElement("CONTACT_FOURNISSEUR");
        boxContactFournisseur.init(contactElement, contactElement.getComboRequest(true));
        this.add(boxContactFournisseur, c);
        this.addView(boxContactFournisseur, "ID_CONTACT_FOURNISSEUR", REQ);

        fourn.addValueListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent arg0) {
                // TODO Raccord de mthode auto-gnr
                if (fourn.getSelectedRow() != null) {
                    boxContactFournisseur.getRequest()
                            .setWhere(new Where(contactElement.getTable().getField("ID_FOURNISSEUR"), "=",
                                    fourn.getSelectedRow().getID()));
                } else {
                    boxContactFournisseur.getRequest().setWhere(null);
                }
            }
        });
    }
    // Adresse de livraison
    if (getTable().getFieldsName().contains("ID_ADRESSE")) {
        if (getTable().getFieldsName().contains("LIVRAISON_F")) {
            c.gridx = 0;
            c.gridy++;
            c.weightx = 0;
            c.fill = GridBagConstraints.HORIZONTAL;
            this.add(new JLabel(getLabelFor("ID_ADRESSE")), c);
            c.gridx++;
            c.gridwidth = GridBagConstraints.REMAINDER;
            // c.gridy++;
            this.addView("ID_ADRESSE");
            final DefaultElementSQLObject comp = (DefaultElementSQLObject) this.getView("ID_ADRESSE").getComp();

            if (getTable().getFieldsName().contains("LIVRAISON_F")) {
                final JCheckBox boxLivr = new JCheckBox("Livr par le fournisseur");
                this.add(boxLivr, c);
                this.addSQLObject(boxLivr, "LIVRAISON_F");
                boxLivr.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        if (boxLivr.isSelected() && !comp.isCreated()) {
                            comp.setCreated(true);
                            if (CommandeSQLComponent.this.getTable().contains("ID_AFFAIRE")) {

                                SQLRowValues rowVals = getLivraisonAdr(
                                        ((ElementComboBox) CommandeSQLComponent.this.getView("ID_AFFAIRE")
                                                .getComp()).getSelectedRow());

                                comp.setValue(rowVals);
                            }

                        } else {
                            if (!boxLivr.isSelected()) {
                                comp.setCreated(false);
                            }
                        }
                    }
                });
            }

            c.gridy++;
            this.add(comp, c);
            this.add(this.getView("ID_ADRESSE").getComp(), c);
        } else {

            c.gridy++;
            c.gridx = 0;
            this.add(new JLabel("Livraison"), c);
            c.gridx++;
            c.gridwidth = GridBagConstraints.REMAINDER;
            this.add(boxLivrClient, c);
            c.gridwidth = 1;

            final GridBagConstraints cAdr = new DefaultGridBagConstraints();

            panelAdrSpec.add(new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT), cAdr);
            final ElementComboBox boxClient = new ElementComboBox(true);
            cAdr.weightx = 1;
            cAdr.gridx++;
            panelAdrSpec.add(boxClient, cAdr);
            this.addView(boxClient, "ID_CLIENT");

            cAdr.gridy++;
            cAdr.weightx = 0;
            cAdr.gridx = 0;
            panelAdrSpec.add(new JLabel("Adresse", SwingConstants.RIGHT), cAdr);
            final SQLRequestComboBox boxAdr = new SQLRequestComboBox(true);
            boxAdr.uiInit(Configuration.getInstance().getDirectory().getElement(getTable().getTable("ADRESSE"))
                    .getComboRequest(true));
            boxClient.addModelListener("wantedID", new PropertyChangeListener() {

                @Override
                public void propertyChange(PropertyChangeEvent evt) {
                    if (boxClient.getSelectedRow() != null && !boxClient.getSelectedRow().isUndefined()) {
                        Where w = new Where(boxAdr.getRequest().getPrimaryTable().getField("ID_CLIENT"), "=",
                                boxClient.getSelectedRow().getID());
                        w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=",
                                boxClient.getSelectedRow().getInt("ID_ADRESSE")));
                        w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=",
                                boxClient.getSelectedRow().getInt("ID_ADRESSE_F")));
                        w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=",
                                boxClient.getSelectedRow().getInt("ID_ADRESSE_L")));
                        boxAdr.getRequest().setWhere(w);
                    } else {
                        boxAdr.getRequest().setWhere(null);
                    }
                }
            });
            cAdr.weightx = 1;
            cAdr.gridx++;
            panelAdrSpec.add(boxAdr, cAdr);

            cAdr.gridx = 0;
            cAdr.gridy++;
            cAdr.weightx = 0;
            if (getMode() == Mode.MODIFICATION) {
                panelAdrSpec.add(new JLabel(getLabelFor("ID_ADRESSE")), cAdr);
            }
            cAdr.gridx++;
            cAdr.gridwidth = GridBagConstraints.REMAINDER;
            this.addView("ID_ADRESSE");
            compAdr = (DefaultElementSQLObject) this.getView("ID_ADRESSE").getComp();

            cAdr.gridy++;
            if (getMode() == Mode.MODIFICATION) {
                panelAdrSpec.add(compAdr, cAdr);
            }
            boxAdr.addValueListener(new PropertyChangeListener() {

                @Override
                public void propertyChange(PropertyChangeEvent evt) {
                    SQLRow row = boxAdr.getSelectedRow();
                    if (row != null && !row.isUndefined()) {
                        compAdr.setCreated(true);
                        SQLRowValues asRowValues = new SQLRowValues(row.asRowValues());
                        compAdr.setValue(asRowValues);
                    }
                }
            });

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

            boxLivrClient.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    panelAdrSpec.setVisible(boxLivrClient.isSelected());

                    if (!boxLivrClient.isSelected()) {
                        boxClient.setValue((Integer) null);
                        boxAdr.setValue((Integer) null);
                        compAdr.setCreated(false);
                    }
                }
            });
            panelAdrSpec.setVisible(false);
        }
    }
    c.gridwidth = 1;

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

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

    final ElementComboBox boxDevise = new ElementComboBox();
    if (DefaultNXProps.getInstance().getBooleanValue(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE,
            false)) {
        // Devise
        c.gridx = 0;
        c.gridy++;
        c.weightx = 0;
        c.fill = GridBagConstraints.HORIZONTAL;
        this.add(new JLabel(getLabelFor("ID_DEVISE"), SwingConstants.RIGHT), c);

        c.gridx = GridBagConstraints.RELATIVE;
        c.gridwidth = 1;
        c.weightx = 1;
        c.weighty = 0;
        c.fill = GridBagConstraints.NONE;
        this.add(boxDevise, c);
        this.addView(boxDevise, "ID_DEVISE");
    }

    // Reference
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.EAST;
    this.add(new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT), c);

    final JTextField textNom = new JTextField();
    c.gridx++;
    c.weightx = 1;
    this.add(textNom, c);

    String field;
    field = "ID_COMMERCIAL";
    // Commercial
    c.weightx = 0;
    c.gridx++;
    this.add(new JLabel(getLabelFor(field), SwingConstants.RIGHT), c);

    ElementComboBox commSel = new ElementComboBox(false, 25);
    c.gridx = GridBagConstraints.RELATIVE;
    c.gridwidth = 1;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.WEST;
    this.add(commSel, c);
    addRequiredSQLObject(commSel, field);

    // Table d'lment
    c.fill = GridBagConstraints.BOTH;
    c.gridy++;
    c.gridx = 0;
    c.weightx = 0;
    c.weighty = 1;
    c.gridwidth = 4;
    this.add(this.table, c);
    if (DefaultNXProps.getInstance().getBooleanValue(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE,
            false)) {

        boxDevise.addValueListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                table.setDevise(boxDevise.getSelectedRow());

            }
        });
    }

    this.fourn.addValueListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            table.setFournisseur(fourn.getSelectedRow());
        }
    });
    // Bottom
    c.gridy++;
    c.weighty = 0;
    this.add(getBottomPanel(), c);

    c.gridx = 0;
    c.gridy++;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;

    JPanel panelOO = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    panelOO.add(this.checkImpression, c);
    panelOO.add(this.checkVisu, c);
    c.gridwidth = GridBagConstraints.REMAINDER;
    this.add(panelOO, c);

    addRequiredSQLObject(this.fourn, "ID_FOURNISSEUR");
    addSQLObject(textNom, "NOM");
    addRequiredSQLObject(dateCommande, "DATE");
    // addRequiredSQLObject(radioEtat, "ID_ETAT_DEVIS");
    addRequiredSQLObject(this.numeroUniqueCommande, "NUMERO");
    addSQLObject(this.infos, "INFOS");

    this.numeroUniqueCommande.setText(NumerotationAutoSQLElement.getNextNumero(CommandeSQLElement.class));

    // radioEtat.setValue(EtatDevisSQLElement.EN_ATTENTE);
    // this.numeroUniqueDevis.addLabelWarningMouseListener(new MouseAdapter() {
    // public void mousePressed(MouseEvent e) {
    //
    // if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
    // numeroUniqueDevis.setText(NumerotationAutoSQLElement.getNextNumeroDevis());
    // }
    // }
    // });

    DefaultGridBagConstraints.lockMinimumSize(this.fourn);
    DefaultGridBagConstraints.lockMinimumSize(commSel);
}

From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.SearchPanel.java

/**
 * Returns the scope of the search./*from w ww. ja  va  2s.  c o  m*/
 * 
 * @return See above.
 */
List<Integer> getScope() {
    List<Integer> list = new ArrayList<Integer>();
    Iterator i = scopes.keySet().iterator();
    JCheckBox box;
    Integer key;
    while (i.hasNext()) {
        key = (Integer) i.next();
        box = scopes.get(key);
        if (box.isSelected())
            list.add(key);
    }
    return list;
}

From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.SearchPanel.java

/**
 * Returns the scope of the search.//  w  ww. j  av  a 2  s. co m
 * 
 * @return See above.
 */
List<Integer> getType() {
    List<Integer> list = new ArrayList<Integer>();
    Iterator i = types.keySet().iterator();
    JCheckBox box;
    Integer key;
    while (i.hasNext()) {
        key = (Integer) i.next();
        box = types.get(key);
        if (box.isSelected())
            list.add(key);
    }
    return list;
}

From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptComponent.java

/** Handles the selection. */
private void handleSelection() {
    if (children == null)
        return;//from   www .  j  a  va  2s.  c  om
    if (component instanceof JCheckBox) {
        Iterator<ScriptComponent> i = children.iterator();
        ScriptComponent c;
        JCheckBox box = (JCheckBox) component;
        boolean selected = box.isSelected();
        while (i.hasNext()) {
            c = i.next();
            c.setEnabled(selected);
        }
    }
}

From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptComponent.java

/** 
 * Helper method. Returns the value associated to a script.
 * //from   ww w . java2 s. c  o m
 * @param c The component to handle.
 * @return See above.
 */
static Object getComponentValue(JComponent c) {
    if (c == null)
        return null;
    if (c instanceof JCheckBox) {
        JCheckBox box = (JCheckBox) c;
        return box.isSelected();
    } else if (c instanceof NumericalTextField) {
        return ((NumericalTextField) c).getValueAsNumber();
    } else if (c instanceof JTextField) {
        JTextField field = (JTextField) c;
        String value = field.getText();
        if (StringUtils.isBlank(value))
            return null;
        return value;
    } else if (c instanceof JComboBox) {
        JComboBox box = (JComboBox) c;
        return box.getSelectedItem();
    } else if (c instanceof ComplexParamPane) {
        return ((ComplexParamPane) c).getValue();
    } else if (c instanceof IdentifierParamPane) {
        return ((IdentifierParamPane) c).isReady();
    }
    return null;
}

From source file:org.panbox.desktop.common.gui.PanboxClientGUI.java

private void removeShareActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_removeShareActionPerformed
    JCheckBox checkbox = new JCheckBox(bundle.getString("client.shareList.removeShareDirectoryMessage"));
    String message = bundle.getString("really.shareList.removeShareMessage");
    Object[] params = { message, checkbox };

    int reallyRemove = JOptionPane.showConfirmDialog(null, params,
            bundle.getString("PanboxClientGUI.panboxMessage"), JOptionPane.YES_NO_OPTION);
    // int reallyRemove =
    // JOptionPane.showConfirmDialog(this,
    // "You are about to remove a share. Do you really want to continue?",
    // "Really remove this share?", JOptionPane.YES_NO_OPTION);
    if (reallyRemove == JOptionPane.YES_OPTION) {
        PanboxShare share = (PanboxShare) shareList.getSelectedValue();

        if (checkbox.isSelected()) {
            PleaseWaitDialog d = null;//from  w  ww .  j a v  a2s .  c  om
            try {
                d = new PleaseWaitDialog(this, bundle.getString("PanboxClient.operationInProgress"));
                d.setLocationRelativeTo(this);
                d.setVisible(true);
                FileUtils.deleteDirectoryTree(new File(share.getPath()));
                // shareList.setSelectedIndex(--idx);
                shareList.setSelectedIndex(-1);
            } catch (IOException e) {
                logger.error("Failed to remove share source directory!", e);
                JOptionPane.showMessageDialog(this, bundle.getString("PanboxClient.deleteShareContentsFailed"),
                        bundle.getString("error"), JOptionPane.ERROR_MESSAGE);
            } finally {
                if (d != null) {
                    d.dispose();
                }
            }
        }

        // remove share from view
        client.removeShare(share);

        enableDisableAddDeviceContactForShare();

        // Also update share list for selected device
        if (device != null) {
            deviceShareList.setModel(client.getDeviceShares(device));
        }
    }
}

From source file:org.panbox.desktop.common.gui.PanboxClientGUI.java

/**
 * helper method for handling CSP-side access control configuration, after
 * having invited or removed single users from or to a share.
 * /* w w  w.j av  a2s  .c o  m*/
 * @param share
 *            share for whichparticipant list has changed
 * @param shareHasParticipants
 *            <code>true</code> if folder has just been shared initially and
 *            participants have only been added
 */
private void handleCSPShareParticipantConfiguration(PanboxShare share, boolean shareHasParticipants,
        List<PanboxGUIContact> selectedcontacts) {
    if (share instanceof DropboxPanboxShare) {
        DropboxAdapterFactory dbxFac = (DropboxAdapterFactory) CSPAdapterFactory
                .getInstance(StorageBackendType.DROPBOX);
        DropboxAPIIntegration dbIntegration = (DropboxAPIIntegration) dbxFac.getAPIAdapter();

        // before we continue, first check if directory has already been
        // synced to csp
        String shareid = FilenameUtils.getName(share.getPath());
        boolean shareIsOnline, shareConfigured = false;
        try {
            shareIsOnline = ((shareid != null) && (shareid.length() > 0)
                    && dbIntegration.exists("/" + shareid));
        } catch (CSPApiException e) {
            logger.error("Could not determine if share with path " + share.getPath() + " and shareid: "
                    + shareid + " has already been uploaded!");
            shareIsOnline = false;
        }

        if (shareIsOnline) {
            String message = bundle.getString("PanboxClientGUI.openDropboxShareConfig");
            JCheckBox copyToClipboard = new JCheckBox(bundle.getString("PanboxClientGUI.copyEmailToClipboard"));
            Object[] params = new Object[] { message, copyToClipboard };

            int res = JOptionPane.showConfirmDialog(this, params,
                    bundle.getString("PanboxClientGUI.openShareConfig"), JOptionPane.YES_NO_OPTION);

            if (res == JOptionPane.YES_OPTION) {
                if (copyToClipboard.isSelected()) {
                    String emails = PanboxGUIContact.getMailAsSepteratedValues(selectedcontacts, ";",
                            StorageBackendType.DROPBOX);
                    // copy the email of the selected contact into the
                    // clipboard
                    DesktopApi.copyToClipboard(emails.toString(), false);
                }

                try {
                    if (shareHasParticipants) {
                        // shows configuration page for shares with existing
                        // users in case of dropbox
                        dbIntegration.removeUser(shareid);
                    } else {
                        // shows initial setup page for new shares
                        dbIntegration.inviteUser(shareid);
                    }
                    shareConfigured = true;
                } catch (Exception e) {
                    logger.error("handleCSPShareParticipantConfiguration: Error opening share configuration",
                            e);
                    JOptionPane.showMessageDialog(this,
                            bundle.getString("PanboxClientGUI.errorOpeningShareConfig"),
                            bundle.getString("error"), JOptionPane.ERROR_MESSAGE);
                }
            }
        } else {
            // JOptionPane
            // .showMessageDialog(
            // this,
            // bundle.getString("PublishIdentitiesDialog.fileNotFoundInCloudStorage"),
            // bundle.getString("PublishIdentitiesDialog.fileNotFound"),
            // JOptionPane.WARNING_MESSAGE);
        }

        if (Settings.getInstance().isMailtoSchemeSupported()) {
            // now, offer to send panbox share invitation link
            String message;
            if (shareConfigured) {
                message = bundle.getString("PanboxClientGUI.sendInvitationLink.message");
            } else {
                if (shareIsOnline) {
                    message = bundle.getString("PanboxClientGUI.sendInvitationLinkNotConfigured.message");
                } else {
                    message = bundle.getString("PanboxClientGUI.sendInvitationLinkNoSync.message");
                }
            }

            int ret = JOptionPane.showConfirmDialog(this, message,
                    bundle.getString("PanboxClientGUI.InvitationLink.title"), JOptionPane.YES_NO_OPTION);
            if (ret == JOptionPane.YES_OPTION) {
                String emails = PanboxGUIContact.getMailAsSepteratedValues(selectedcontacts, ",",
                        StorageBackendType.DROPBOX);

                String mailto = "mailto:" + emails + "?subject="
                        + bundle.getString("client.mailTo.shareInvitationSubject") + "&body="
                        + PanboxURICmdShareInvitation.getPanboxLink(share.getUuid().toString(),
                                share.getType().name());

                DesktopApi.browse(URI.create(mailto));
            }
        } else {
            // offer to copy panbox share invitation link to
            // clipboard
            String message;
            if (shareConfigured) {
                message = bundle.getString("PanboxClientGUI.copyInvitationLink.message");
            } else {
                if (shareIsOnline) {
                    message = bundle.getString("PanboxClientGUI.copyInvitationLinkNotConfigured.message");
                } else {
                    message = bundle.getString("PanboxClientGUI.copyInvitationLinkNoSync.message");
                }
            }

            int ret = JOptionPane.showConfirmDialog(this, message,
                    bundle.getString("PanboxClientGUI.InvitationLink.title"), JOptionPane.YES_NO_OPTION);
            if (ret == JOptionPane.YES_OPTION) {
                URI uri = PanboxURICmdShareInvitation.getPanboxLink(share.getUuid().toString(),
                        share.getType().name());

                DesktopApi.copyToClipboard(uri.toASCIIString(), true);

                JOptionPane.showMessageDialog(this,
                        bundle.getString("PanboxClientGUI.copyInvitationLink.info") + "\n"
                                + uri.toASCIIString(),
                        bundle.getString("PanboxClientGUI.InvitationLink.title"),
                        JOptionPane.INFORMATION_MESSAGE);
            }

        }

    } else {
        logger.warn("handleCSPShareParticipantConfiguration: Unknown share type!");
    }
}

From source file:org.paxle.desktop.impl.dialogues.cconsole.CrawlingConsole.java

private void initOptions() {
    options.setLayout(new GridBagLayout());
    final GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = Utilities.INSETS_ZERO;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = gbc.gridy = 0;//from  w w  w . jav a2s  . c om
    final int show = model.type.showCmd;
    for (final Columns col : Columns.values()) {
        final int mask = 1 << col.ordinal();
        final JCheckBox cbox = new JCheckBox();
        cbox.setSelected((show & mask) != 0);

        // TODO: make static by setting an action-command which represents the respective cbox
        final class CboxAC implements ActionListener {
            public void actionPerformed(ActionEvent e) {
                if (cbox.isSelected()) {
                    model.setCols(model.type.showCmd | mask);
                } else {
                    model.setCols(model.type.showCmd & ~mask);
                }
            }
        }
        ;

        options.add(Utilities.instance.setButtonProps(cbox, col.getL10n(), new CboxAC(), null, -1, null), gbc);

        if (gbc.gridy < 5) {
            gbc.gridy++;
        } else {
            gbc.gridx++;
            gbc.gridy = 0;
        }
    }
}