List of usage examples for java.awt GridBagConstraints NONE
int NONE
To view the source code for java.awt GridBagConstraints NONE.
Click Source Link
From source file:erigo.filepump.FilePump.java
private void createAndShowGUI(String default_outputFolderI, double default_filesPerSecI, int default_totNumFilesI, FileMode default_modeI, String default_ftpHostI, String default_ftpUserI, String default_ftpPasswordI) { // Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); // Create the GUI components GridBagLayout framegbl = new GridBagLayout(); filePumpGuiFrame = new JFrame("FilePump"); GridBagLayout gbl = new GridBagLayout(); JPanel guiPanel = new JPanel(gbl); outputFolderLabel = new JLabel(" "); Dimension preferredSize = new Dimension(200, 20); outputFolderLabel.setPreferredSize(preferredSize); filesPerSecLabel = new JLabel("1"); totNumFilesLabel = new JLabel("unlimited"); modeLabel = new JLabel("file system folder"); fileCountLabel = new JLabel("0"); endButton = new JButton("Finish test"); endButton.addActionListener(this); actionButton = new JButton("Start pump"); actionButton.setBackground(Color.GREEN); actionButton.addActionListener(this); filePumpGuiFrame.setFont(new Font("Dialog", Font.PLAIN, 12)); guiPanel.setFont(new Font("Dialog", Font.PLAIN, 12)); int row = 0;/* www.j a v a 2s . c om*/ GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0; gbc.weighty = 0; // ROW 1 JLabel label = new JLabel("Output directory"); gbc.insets = new Insets(15, 15, 0, 5); Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1); gbc.insets = new Insets(15, 0, 0, 15); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 100; gbc.weighty = 100; Utility.add(guiPanel, outputFolderLabel, gbl, gbc, 1, row, 1, 1); gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0; gbc.weighty = 0; ++row; // ROW 2 label = new JLabel("Files/sec"); gbc.insets = new Insets(15, 15, 0, 5); Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1); gbc.insets = new Insets(15, 0, 0, 15); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 100; gbc.weighty = 100; Utility.add(guiPanel, filesPerSecLabel, gbl, gbc, 1, row, 1, 1); gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0; gbc.weighty = 0; ++row; // ROW 3 label = new JLabel("Tot num files"); gbc.insets = new Insets(15, 15, 0, 5); Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1); gbc.insets = new Insets(15, 0, 0, 15); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 100; gbc.weighty = 100; Utility.add(guiPanel, totNumFilesLabel, gbl, gbc, 1, row, 1, 1); gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0; gbc.weighty = 0; ++row; // ROW 4 label = new JLabel("Mode"); gbc.insets = new Insets(15, 15, 0, 5); Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1); gbc.insets = new Insets(15, 0, 0, 15); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 100; gbc.weighty = 100; Utility.add(guiPanel, modeLabel, gbl, gbc, 1, row, 1, 1); gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0; gbc.weighty = 0; ++row; // ROW 5 label = new JLabel("File count"); gbc.insets = new Insets(15, 15, 0, 5); Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1); gbc.insets = new Insets(15, 0, 0, 15); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 100; gbc.weighty = 100; Utility.add(guiPanel, fileCountLabel, gbl, gbc, 1, row, 1, 1); gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0; gbc.weighty = 0; ++row; // ROW 6: command buttons JPanel buttonPanel = new JPanel(); buttonPanel.add(actionButton); buttonPanel.add(endButton); gbc.insets = new Insets(15, 15, 15, 15); gbc.anchor = GridBagConstraints.CENTER; Utility.add(guiPanel, buttonPanel, gbl, gbc, 0, row, 2, 1); gbc.anchor = GridBagConstraints.WEST; ++row; // Now add guiPanel to filePumpGuiFrame gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 100; gbc.weighty = 100; gbc.insets = new Insets(0, 0, 0, 0); Utility.add(filePumpGuiFrame, guiPanel, framegbl, gbc, 0, 0, 1, 1); // Add menu JMenuBar menuBar = createMenu(); filePumpGuiFrame.setJMenuBar(menuBar); // Display the window. filePumpGuiFrame.pack(); filePumpGuiFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); filePumpGuiFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { exit(); } }); // Create a settings dialog box pumpSettings = new FilePumpSettings(filePumpGuiFrame, default_outputFolderI, default_filesPerSecI, default_totNumFilesI, default_modeI, default_ftpHostI, default_ftpUserI, default_ftpPasswordI); // Initialize information displayed on the GUI front panel updateMainFrame(); filePumpGuiFrame.setVisible(true); }
From source file:org.docx4all.swing.ExternalHyperlinkDialog.java
private void fillRow2(JPanel host, GridBagConstraints c) { c.gridx = 0;//from w w w. ja va 2 s. c om c.gridy = 1; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.insets = gridCellInsets; c.ipadx = 0; c.ipady = 0; c.anchor = GridBagConstraints.LINE_START; c.fill = GridBagConstraints.NONE; this.tooltipLabel = new JLabel("Tooltip Text"); host.add(this.tooltipLabel, c); c.gridx = 1; c.gridy = 1; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.insets = gridCellInsets; c.ipadx = 0; c.ipady = 0; c.anchor = GridBagConstraints.LINE_START; c.fill = GridBagConstraints.HORIZONTAL; this.tooltipField = new JTextField(70); //this.tooltipField.setMinimumSize(new Dimension(100, 70)); //this.tooltipField.setPreferredSize(new Dimension(100, 70)); host.add(this.tooltipField, c); }
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 . j a va2s. co 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:net.sourceforge.squirrel_sql.client.preferences.UpdatePreferencesPanel.java
private JPanel createUpdateSitePanel() { JPanel pnl = new JPanel(new GridBagLayout()); pnl.setBorder(BorderFactory.createTitledBorder(i18n.UPDATE_SITE_BORDER_LABEL)); ItemListener urlUpdateItemListener = new UrlItemListener(); DocumentListener urlDocumentListener = new UrlDocumentListener(); final GridBagConstraints gbc = new GridBagConstraints(); setSeparatorConstraints(gbc, 0);/*w ww.ja va 2 s . c o m*/ gbc.gridwidth = 1; gbc.weightx = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; siteTypeLabel = new JLabel(i18n.SITE_TYPE_LABEL, JLabel.RIGHT); pnl.add(siteTypeLabel, gbc); // Site type setSeparatorConstraints(gbc, 0); gbc.gridx = 1; gbc.gridwidth = 1; gbc.fill = GridBagConstraints.NONE; pnl.add(getSiteTypePanel(), gbc); setSeparatorConstraints(gbc, 1); pnl.add(getSep(), gbc); // Update server name setLabelConstraints(gbc, 2); _serverLabel = new JLabel(i18n.SERVER, SwingConstants.RIGHT); pnl.add(_serverLabel, gbc); setFieldConstraints(gbc, 2); _updateServerName.getDocument().addDocumentListener(urlDocumentListener); pnl.add(_updateServerName, gbc); // Update server port setLabelConstraints(gbc, 3); _portLabel = new JLabel(i18n.PORT, SwingConstants.RIGHT); pnl.add(_portLabel, gbc); setFieldConstraints(gbc, 3); _updateServerPort.getDocument().addDocumentListener(urlDocumentListener); pnl.add(_updateServerPort, gbc); // Path to release.xml setLabelConstraints(gbc, 4); _pathLabel = new JLabel(i18n.PATH, SwingConstants.RIGHT); pnl.add(_pathLabel, gbc); setFieldConstraints(gbc, 4); _updateServerPath.getDocument().addDocumentListener(urlDocumentListener); pnl.add(_updateServerPath, gbc); // Channnel combo-box setLabelConstraints(gbc, 5); _channelLabel = new JLabel(i18n.CHANNEL, SwingConstants.RIGHT); pnl.add(_channelLabel, gbc); setFieldConstraints(gbc, 5); gbc.fill = GridBagConstraints.NONE; _updateServerChannel.addItemListener(urlUpdateItemListener); pnl.add(_updateServerChannel, gbc); // URL text field setLabelConstraints(gbc, 6); _urlLabel = new JLabel(i18n.URL, SwingConstants.RIGHT); pnl.add(_urlLabel, gbc); setFieldConstraints(gbc, 6); updateUrl(); pnl.add(_updateUrl, gbc); setFieldConstraints(gbc, 7); JLabel lblProxy = new JLabel(s_stringMgr.getString("UpdatePreferencesPanel.proxyHintHtml")); lblProxy.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); lblProxy.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { _prefrenceTabActvivationListener.activateTabForClass(ProxyPreferenceTabComponent.class); } }); pnl.add(lblProxy, gbc); // Test Connection Button Panel (Both the button and the status label setFieldConstraints(gbc, 8); Box buttonBox = Box.createHorizontalBox(); buttonBox.add(_testConnectionButton); buttonBox.add(Box.createHorizontalStrut(20)); buttonBox.add(_testConnectionStatusLabel); _testConnectionButton.addActionListener(new TestConnectionButtonListener()); pnl.add(buttonBox, gbc); // Separator setSeparatorConstraints(gbc, 9); pnl.add(getSep(), gbc); // Local update directory setLabelConstraints(gbc, 10); _localPathLabel = new JLabel(i18n.LOCAL_PATH, SwingConstants.RIGHT); pnl.add(_localPathLabel, gbc); setFieldConstraints(gbc, 10); pnl.add(_localPath, gbc); return pnl; }
From source file:gov.loc.repository.bagger.ui.SaveBagFrame.java
private JPanel createComponents() { Border border = new EmptyBorder(5, 5, 5, 5); TitlePane titlePane = new TitlePane(); initStandardCommands();/* ww w . j ava 2 s.c om*/ JPanel pageControl = new JPanel(new BorderLayout()); JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("SaveBagFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Define the Bag settings"))); titlePaneContainer.add(titlePane.getControl()); titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH); pageControl.add(titlePaneContainer, BorderLayout.NORTH); JPanel contentPane = new JPanel(); // TODO: Add bag name field // TODO: Add save name file selection button JLabel location = new JLabel("Save in:"); browseButton = new JButton(getMessage("bag.button.browse")); browseButton.addActionListener(new SaveBagAsHandler()); browseButton.setEnabled(true); browseButton.setToolTipText(getMessage("bag.button.browse.help")); String fileName = ""; DefaultBag bag = bagView.getBag(); if (bag != null) { fileName = bag.getName(); } bagNameField = new JTextField(fileName); bagNameField.setCaretPosition(fileName.length()); bagNameField.setEditable(false); bagNameField.setEnabled(false); // Holey bag control JLabel holeyLabel = new JLabel(bagView.getPropertyMessage("bag.label.isholey")); holeyLabel.setToolTipText(bagView.getPropertyMessage("bag.isholey.help")); holeyCheckbox = new JCheckBox(bagView.getPropertyMessage("bag.checkbox.isholey")); holeyCheckbox.setBorder(border); holeyCheckbox.setSelected(bag.isHoley()); holeyCheckbox.addActionListener(new HoleyBagHandler()); holeyCheckbox.setToolTipText(bagView.getPropertyMessage("bag.isholey.help")); urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label")); urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description")); urlLabel.setEnabled(bag.isHoley()); urlField = new JTextField(""); try { urlField.setText(bag.getFetch().getBaseURL()); } catch (Exception e) { log.error("fetch baseURL: " + e.getMessage()); } urlField.setEnabled(false); // TODO: Add format label JLabel serializeLabel; serializeLabel = new JLabel(getMessage("bag.label.ispackage")); serializeLabel.setToolTipText(getMessage("bag.serializetype.help")); // TODO: Add format selection panel noneButton = new JRadioButton(getMessage("bag.serializetype.none")); noneButton.setEnabled(true); AbstractAction serializeListener = new SerializeBagHandler(); noneButton.addActionListener(serializeListener); noneButton.setToolTipText(getMessage("bag.serializetype.none.help")); zipButton = new JRadioButton(getMessage("bag.serializetype.zip")); zipButton.setEnabled(true); zipButton.addActionListener(serializeListener); zipButton.setToolTipText(getMessage("bag.serializetype.zip.help")); /* tarButton = new JRadioButton(getMessage("bag.serializetype.tar")); tarButton.setEnabled(true); tarButton.addActionListener(serializeListener); tarButton.setToolTipText(getMessage("bag.serializetype.tar.help")); tarGzButton = new JRadioButton(getMessage("bag.serializetype.targz")); tarGzButton.setEnabled(true); tarGzButton.addActionListener(serializeListener); tarGzButton.setToolTipText(getMessage("bag.serializetype.targz.help")); tarBz2Button = new JRadioButton(getMessage("bag.serializetype.tarbz2")); tarBz2Button.setEnabled(true); tarBz2Button.addActionListener(serializeListener); tarBz2Button.setToolTipText(getMessage("bag.serializetype.tarbz2.help")); */ short mode = bag.getSerialMode(); if (mode == DefaultBag.NO_MODE) { this.noneButton.setEnabled(true); } else if (mode == DefaultBag.ZIP_MODE) { this.zipButton.setEnabled(true); } /*else if (mode == DefaultBag.TAR_MODE) { this.tarButton.setEnabled(true); } else if (mode == DefaultBag.TAR_GZ_MODE) { this.tarGzButton.setEnabled(true); } else if (mode == DefaultBag.TAR_BZ2_MODE) { this.tarBz2Button.setEnabled(true); } */else { this.noneButton.setEnabled(true); } ButtonGroup serializeGroup = new ButtonGroup(); serializeGroup.add(noneButton); serializeGroup.add(zipButton); //serializeGroup.add(tarButton); //serializeGroup.add(tarGzButton); //serializeGroup.add(tarBz2Button); serializeGroupPanel = new JPanel(new FlowLayout()); serializeGroupPanel.add(serializeLabel); serializeGroupPanel.add(noneButton); serializeGroupPanel.add(zipButton); //serializeGroupPanel.add(tarButton); //serializeGroupPanel.add(tarGzButton); //serializeGroupPanel.add(tarBz2Button); serializeGroupPanel.setBorder(border); serializeGroupPanel.setEnabled(true); serializeGroupPanel.setToolTipText(bagView.getPropertyMessage("bag.serializetype.help")); JLabel tagLabel = new JLabel(getMessage("bag.label.istag")); tagLabel.setToolTipText(getMessage("bag.label.istag.help")); isTagCheckbox = new JCheckBox(); isTagCheckbox.setBorder(border); isTagCheckbox.setSelected(bag.isBuildTagManifest()); isTagCheckbox.addActionListener(new TagManifestHandler()); isTagCheckbox.setToolTipText(getMessage("bag.checkbox.istag.help")); JLabel tagAlgorithmLabel = new JLabel(getMessage("bag.label.tagalgorithm")); tagAlgorithmLabel.setToolTipText(getMessage("bag.label.tagalgorithm.help")); ArrayList<String> listModel = new ArrayList<String>(); for (Algorithm algorithm : Algorithm.values()) { listModel.add(algorithm.bagItAlgorithm); } tagAlgorithmList = new JComboBox(listModel.toArray()); tagAlgorithmList.setName(getMessage("bag.tagalgorithmlist")); tagAlgorithmList.setSelectedItem(bag.getTagManifestAlgorithm()); tagAlgorithmList.addActionListener(new TagAlgorithmListHandler()); tagAlgorithmList.setToolTipText(getMessage("bag.tagalgorithmlist.help")); JLabel payloadLabel = new JLabel(getMessage("bag.label.ispayload")); payloadLabel.setToolTipText(getMessage("bag.ispayload.help")); isPayloadCheckbox = new JCheckBox(); isPayloadCheckbox.setBorder(border); isPayloadCheckbox.setSelected(bag.isBuildPayloadManifest()); isPayloadCheckbox.addActionListener(new PayloadManifestHandler()); isPayloadCheckbox.setToolTipText(getMessage("bag.ispayload.help")); JLabel payAlgorithmLabel = new JLabel(bagView.getPropertyMessage("bag.label.payalgorithm")); payAlgorithmLabel.setToolTipText(getMessage("bag.payalgorithm.help")); payAlgorithmList = new JComboBox(listModel.toArray()); payAlgorithmList.setName(getMessage("bag.payalgorithmlist")); payAlgorithmList.setSelectedItem(bag.getPayloadManifestAlgorithm()); payAlgorithmList.addActionListener(new PayAlgorithmListHandler()); payAlgorithmList.setToolTipText(getMessage("bag.payalgorithmlist.help")); GridBagLayout layout = new GridBagLayout(); GridBagConstraints glbc = new GridBagConstraints(); JPanel panel = new JPanel(layout); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); int row = 0; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(location, glbc); panel.add(location); buildConstraints(glbc, 2, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.EAST); glbc.ipadx = 5; layout.setConstraints(browseButton, glbc); glbc.ipadx = 0; panel.add(browseButton); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); glbc.ipadx = 5; layout.setConstraints(bagNameField, glbc); glbc.ipadx = 0; panel.add(bagNameField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(holeyLabel, glbc); panel.add(holeyLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.WEST, GridBagConstraints.WEST); layout.setConstraints(holeyCheckbox, glbc); panel.add(holeyCheckbox); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(urlLabel, glbc); panel.add(urlLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(urlField, glbc); panel.add(urlField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(serializeLabel, glbc); panel.add(serializeLabel); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); layout.setConstraints(serializeGroupPanel, glbc); panel.add(serializeGroupPanel); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(tagLabel, glbc); panel.add(tagLabel); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(isTagCheckbox, glbc); panel.add(isTagCheckbox); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(tagAlgorithmLabel, glbc); panel.add(tagAlgorithmLabel); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(tagAlgorithmList, glbc); panel.add(tagAlgorithmList); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(payloadLabel, glbc); panel.add(payloadLabel); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(isPayloadCheckbox, glbc); panel.add(isPayloadCheckbox); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(payAlgorithmLabel, glbc); panel.add(payAlgorithmLabel); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(payAlgorithmList, glbc); panel.add(payAlgorithmList); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); GuiStandardUtils.attachDialogBorder(contentPane); pageControl.add(panel); JComponent buttonBar = createButtonBar(); pageControl.add(buttonBar, BorderLayout.SOUTH); this.pack(); return pageControl; }
From source file:be.vds.jtbdive.client.view.core.dive.profile.DiveProfileGraphicDetailPanel.java
private JPanel createInstantDataPanel() { I18nLabel timeLabel = new I18nLabel("dive.time"); instantDepthLabel = new JLabel(); setDephtLabelText();/*from w w w . j ava2 s .com*/ instantTimeTf = new JTextField(6); instantTimeTf.setText(null); instantTimeTf.setEditable(false); instantTimeTf.setFocusable(false); instantDepthTf = new JTextField(6); instantDepthTf.setText(null); instantDepthTf.setEditable(false); instantDepthTf.setFocusable(false); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(3, 3, 3, 3); JPanel instantDataPanel = new DetailPanel(); instantDataPanel.setLayout(new GridBagLayout()); instantDataPanel.setOpaque(false); GridBagLayoutManager.addComponent(instantDataPanel, timeLabel, c, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); GridBagLayoutManager.addComponent(instantDataPanel, instantTimeTf, c, 1, 0, 1, 1, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); GridBagLayoutManager.addComponent(instantDataPanel, instantDepthLabel, c, 0, 1, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); GridBagLayoutManager.addComponent(instantDataPanel, instantDepthTf, c, 1, 1, 1, 1, 1, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); return instantDataPanel; }
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());// www . j a v a 2 s. 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:org.fhcrc.cpl.viewer.quant.gui.QuantitationReviewer.java
/** * Initialize all GUI components and display the UI *//*from w w w. j a va 2s .co m*/ protected void initGUI() { settingsCLM = new ProteinQuantChartsCLM(false); setTitle("Qurate"); try { setIconImage(ImageIO.read(WorkbenchFrame.class.getResourceAsStream("icon.gif"))); } catch (Exception e) { } try { Localizer.renderSwixml("org/fhcrc/cpl/viewer/quant/gui/QuantitationReviewer.xml", this); assert null != contentPanel; } catch (Exception x) { ApplicationContext.errorMessage("error creating dialog", x); throw new RuntimeException(x); } //Menu openFileAction = new OpenFileAction(this); createChartsAction = new CreateChartsAction(); filterPepXMLAction = new FilterPepXMLAction(this); proteinSummaryAction = new ProteinSummaryAction(this); try { JMenuBar jmenu = (JMenuBar) Localizer.getSwingEngine(this) .render("org/fhcrc/cpl/viewer/quant/gui/QuantitationReviewerMenu.xml"); for (int i = 0; i < jmenu.getMenuCount(); i++) jmenu.getMenu(i).getPopupMenu().setLightWeightPopupEnabled(false); this.setJMenuBar(jmenu); } catch (Exception x) { ApplicationContext.errorMessage(TextProvider.getText("ERROR_LOADING_MENUS"), x); throw new RuntimeException(x); } //Global stuff setSize(fullWidth, fullHeight); setContentPane(contentPanel); ListenerHelper helper = new ListenerHelper(this); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.PAGE_START; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.insets = new Insets(5, 5, 5, 5); gbc.weighty = 1; gbc.weightx = 1; leftPanel.setLayout(new GridBagLayout()); leftPanel.setBorder(BorderFactory.createLineBorder(Color.gray)); //Properties panel stuff propertiesTable = new QuantEvent.QuantEventPropertiesTable(); propertiesScrollPane = new JScrollPane(); propertiesScrollPane.setViewportView(propertiesTable); propertiesScrollPane.setMinimumSize(new Dimension(propertiesWidth, propertiesHeight)); //event summary table; disembodied eventSummaryTable = new QuantEventsSummaryTable(); eventSummaryTable.setVisible(true); ListSelectionModel tableSelectionModel = eventSummaryTable.getSelectionModel(); tableSelectionModel.addListSelectionListener(new EventSummaryTableListSelectionHandler()); JScrollPane eventSummaryScrollPane = new JScrollPane(); eventSummaryScrollPane.setViewportView(eventSummaryTable); eventSummaryScrollPane.setSize(propertiesWidth, propertiesHeight); eventSummaryFrame = new Frame("All Events"); eventSummaryFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { eventSummaryFrame.setVisible(false); } }); eventSummaryFrame.setSize(950, 450); eventSummaryFrame.add(eventSummaryScrollPane); //fields related to navigation navigationPanel = new JPanel(); backButton = new JButton("<"); backButton.setToolTipText("Previous Event"); backButton.setMaximumSize(new Dimension(50, 30)); backButton.setEnabled(false); forwardButton = new JButton(">"); forwardButton.setToolTipText("Next Event"); forwardButton.setMaximumSize(new Dimension(50, 30)); forwardButton.setEnabled(false); showEventSummaryButton = new JButton("Show All"); showEventSummaryButton.setToolTipText("Show all events in a table"); showEventSummaryButton.setEnabled(false); helper.addListener(backButton, "buttonBack_actionPerformed"); helper.addListener(forwardButton, "buttonForward_actionPerformed"); helper.addListener(showEventSummaryButton, "buttonShowEventSummary_actionPerformed"); gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = GridBagConstraints.RELATIVE; gbc.anchor = GridBagConstraints.WEST; navigationPanel.add(backButton, gbc); gbc.gridwidth = GridBagConstraints.RELATIVE; navigationPanel.add(forwardButton, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; navigationPanel.add(showEventSummaryButton, gbc); gbc.fill = GridBagConstraints.BOTH; navigationPanel.setBorder(BorderFactory.createTitledBorder("Event")); gbc.anchor = GridBagConstraints.PAGE_START; //Fields related to curation of events curationPanel = new JPanel(); curationPanel.setLayout(new GridBagLayout()); curationPanel.setBorder(BorderFactory.createTitledBorder("Curation")); //Quantitation curation JPanel quantCurationPanel = new JPanel(); quantCurationPanel.setLayout(new GridBagLayout()); quantCurationPanel.setBorder(BorderFactory.createTitledBorder("Quantitation")); quantCurationButtonGroup = new ButtonGroup(); JRadioButton unknownRadioButton = new JRadioButton("?"); JRadioButton goodRadioButton = new JRadioButton("Good"); JRadioButton badRadioButton = new JRadioButton("Bad"); onePeakRatioRadioButton = new JRadioButton("1-Peak"); unknownRadioButton.setEnabled(false); goodRadioButton.setEnabled(false); badRadioButton.setEnabled(false); onePeakRatioRadioButton.setEnabled(false); quantCurationButtonGroup.add(unknownRadioButton); quantCurationButtonGroup.add(goodRadioButton); quantCurationButtonGroup.add(badRadioButton); quantCurationButtonGroup.add(onePeakRatioRadioButton); unknownRadioButtonModel = unknownRadioButton.getModel(); goodRadioButtonModel = goodRadioButton.getModel(); badRadioButtonModel = badRadioButton.getModel(); onePeakRadioButtonModel = onePeakRatioRadioButton.getModel(); helper.addListener(unknownRadioButton, "buttonCuration_actionPerformed"); helper.addListener(goodRadioButton, "buttonCuration_actionPerformed"); helper.addListener(badRadioButton, "buttonCuration_actionPerformed"); helper.addListener(onePeakRadioButtonModel, "buttonCuration_actionPerformed"); gbc.anchor = GridBagConstraints.WEST; quantCurationPanel.add(unknownRadioButton, gbc); quantCurationPanel.add(badRadioButton, gbc); quantCurationPanel.add(goodRadioButton, gbc); quantCurationPanel.add(onePeakRatioRadioButton, gbc); gbc.anchor = GridBagConstraints.PAGE_START; //ID curation JPanel idCurationPanel = new JPanel(); idCurationPanel.setLayout(new GridBagLayout()); idCurationPanel.setBorder(BorderFactory.createTitledBorder("ID")); idCurationButtonGroup = new ButtonGroup(); JRadioButton idUnknownRadioButton = new JRadioButton("?"); JRadioButton idGoodRadioButton = new JRadioButton("Good"); JRadioButton idBadRadioButton = new JRadioButton("Bad"); idUnknownRadioButton.setEnabled(false); idGoodRadioButton.setEnabled(false); idBadRadioButton.setEnabled(false); idCurationButtonGroup.add(idUnknownRadioButton); idCurationButtonGroup.add(idGoodRadioButton); idCurationButtonGroup.add(idBadRadioButton); idUnknownRadioButtonModel = idUnknownRadioButton.getModel(); idGoodRadioButtonModel = idGoodRadioButton.getModel(); idBadRadioButtonModel = idBadRadioButton.getModel(); helper.addListener(idUnknownRadioButton, "buttonIDCuration_actionPerformed"); helper.addListener(idGoodRadioButton, "buttonIDCuration_actionPerformed"); helper.addListener(idBadRadioButton, "buttonIDCuration_actionPerformed"); gbc.anchor = GridBagConstraints.WEST; idCurationPanel.add(idUnknownRadioButton, gbc); idCurationPanel.add(idBadRadioButton, gbc); idCurationPanel.add(idGoodRadioButton, gbc); gbc.gridwidth = GridBagConstraints.RELATIVE; curationPanel.add(quantCurationPanel, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; curationPanel.add(idCurationPanel, gbc); //curation comment commentTextField = new JTextField(); commentTextField.setToolTipText("Comment on this event"); //saves after every keypress. Would be more efficient to save when navigating away or saving to file commentTextField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (quantEvents == null) return; QuantEvent quantEvent = quantEvents.get(displayedEventIndex); //save the comment, being careful about tabs and new lines quantEvent.setComment(commentTextField.getText().replace("\t", " ").replace("\n", " ")); } public void keyTyped(KeyEvent e) { } public void keyPressed(KeyEvent e) { } }); curationPanel.add(commentTextField, gbc); assessmentPanel = new JPanel(); assessmentPanel.setLayout(new GridBagLayout()); assessmentPanel.setBorder(BorderFactory.createTitledBorder("Algorithmic Assessment")); assessmentTypeTextField = new JTextField(); assessmentTypeTextField.setEditable(false); assessmentPanel.add(assessmentTypeTextField, gbc); assessmentDescTextField = new JTextField(); assessmentDescTextField.setEditable(false); assessmentPanel.add(assessmentDescTextField, gbc); //Theoretical peak distribution gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.CENTER; theoreticalPeaksPanel = new JPanel(); theoreticalPeaksPanel.setBorder(BorderFactory.createTitledBorder("Theoretical Peaks")); theoreticalPeaksPanel.setLayout(new GridBagLayout()); theoreticalPeaksPanel.setMinimumSize(new Dimension(leftPanelWidth - 10, theoreticalPeaksPanelHeight)); theoreticalPeaksPanel.setMaximumSize(new Dimension(1200, theoreticalPeaksPanelHeight)); showTheoreticalPeaks(); //Add everything to the left panel gbc.insets = new Insets(0, 5, 0, 5); gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.PAGE_START; leftPanel.addComponentListener(new LeftPanelResizeListener()); gbc.weighty = 10; gbc.fill = GridBagConstraints.VERTICAL; leftPanel.add(propertiesScrollPane, gbc); gbc.fill = GridBagConstraints.NONE; gbc.weighty = 1; gbc.anchor = GridBagConstraints.PAGE_END; gbc.fill = GridBagConstraints.HORIZONTAL; leftPanel.add(assessmentPanel, gbc); leftPanel.add(theoreticalPeaksPanel, gbc); gbc.fill = GridBagConstraints.HORIZONTAL; leftPanel.add(curationPanel, gbc); leftPanel.add(navigationPanel, gbc); gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 1; gbc.anchor = GridBagConstraints.PAGE_START; //Chart display multiChartDisplay = new TabbedMultiChartDisplayPanel(); multiChartDisplay.setResizeDelayMS(0); rightPanel.addComponentListener(new RightPanelResizeListener()); rightPanel.add(multiChartDisplay, gbc); //status message messageLabel.setBackground(Color.WHITE); messageLabel.setFont(Font.decode("verdana plain 12")); messageLabel.setText(" "); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); //paranoia. Sometimes it seems Qurate doesn't exit when you close every window addWindowStateListener(new WindowStateListener() { public void windowStateChanged(WindowEvent e) { if (e.getNewState() == WindowEvent.WINDOW_CLOSED) { dispose(); System.exit(0); } } }); }
From source file:org.pentaho.reporting.designer.extensions.pentaho.repository.dialogs.RepositoryPublishDialog.java
private JPanel createPublishSettingsPanel() { final JComboBox fileFormat = new JComboBox(exportFormatModel); final GridBagConstraints c = new GridBagConstraints(); final JPanel publishSettingsPanel = new JPanel(new GridBagLayout()); c.insets = new Insets(5, 5, 0, 5); c.gridwidth = 1;//from w ww. ja v a2s . co m c.gridx = 0; c.gridy = 0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; publishSettingsPanel.add(new JLabel(Messages.getInstance().getString("RepositoryPublishDialog.OutputType")), c); c.insets = new Insets(5, 5, 5, 0); c.gridwidth = 1; c.gridx = 0; c.gridy = 1; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.weightx = 0.0; publishSettingsPanel.add(fileFormat, c); c.insets = new Insets(0, 5, 5, 5); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; c.gridx = 1; c.gridy = 1; c.weightx = 1.0; publishSettingsPanel.add(lockOutputTypeCheckBox, c); return publishSettingsPanel; }
From source file:org.docx4all.swing.ExternalHyperlinkDialog.java
private void fillRow3(JPanel host, GridBagConstraints c) { c.gridx = 0;//from w ww . jav a2 s .c o m c.gridy = 2; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.insets = gridCellInsets; c.ipadx = 0; c.ipady = 0; c.anchor = GridBagConstraints.LINE_START; c.fill = GridBagConstraints.NONE; this.documentNameLabel = new JLabel("Document Name"); host.add(this.documentNameLabel, c); c.gridx = 1; c.gridy = 2; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.insets = gridCellInsets; c.ipadx = 0; c.ipady = 0; c.anchor = GridBagConstraints.LINE_START; c.fill = GridBagConstraints.HORIZONTAL; this.documentNameField = new JTextField(70); //this.documentNameField.setMinimumSize(new Dimension(100, 70)); //this.documentNameField.setPreferredSize(new Dimension(100, 70)); host.add(this.documentNameField, c); }