List of usage examples for java.awt GridBagConstraints HORIZONTAL
int HORIZONTAL
To view the source code for java.awt GridBagConstraints HORIZONTAL.
Click Source Link
From source file:gdt.jgui.entity.query.JQueryPanel.java
/** * The default constructor.//from ww w. ja v a 2s. c om */ public JQueryPanel() { GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 100, 0, 0 }; gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0 }; gridBagLayout.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE }; gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0 }; setLayout(gridBagLayout); JLabel lblElement = new JLabel("Element"); GridBagConstraints gbc_lblElement = new GridBagConstraints(); gbc_lblElement.insets = new Insets(5, 5, 5, 5); gbc_lblElement.gridx = 0; gbc_lblElement.gridy = 0; gbc_lblElement.anchor = GridBagConstraints.FIRST_LINE_START; add(lblElement, gbc_lblElement); elementComboBox = new JComboBox<String>(); GridBagConstraints gbc_elementComboBox = new GridBagConstraints(); gbc_elementComboBox.fill = GridBagConstraints.HORIZONTAL; gbc_elementComboBox.insets = new Insets(0, 0, 5, 0); gbc_elementComboBox.gridx = 1; gbc_elementComboBox.gridy = 0; gbc_elementComboBox.anchor = GridBagConstraints.FIRST_LINE_START; add(elementComboBox, gbc_elementComboBox); elementComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { try { initItemNameSelector(); } catch (Exception ee) { LOGGER.severe(ee.toString()); } } }); JLabel lblItemNameField = new JLabel("Item field"); GridBagConstraints gbc_lblItemField = new GridBagConstraints(); gbc_lblItemField.insets = new Insets(5, 5, 5, 5); gbc_lblItemField.gridx = 0; gbc_lblItemField.gridy = 1; gbc_lblItemField.anchor = GridBagConstraints.FIRST_LINE_START; add(lblItemNameField, gbc_lblItemField); itemNameFieldComboBox = new JComboBox<String>(); GridBagConstraints gbc_itemNameFieldComboBox = new GridBagConstraints(); gbc_itemNameFieldComboBox.insets = new Insets(0, 0, 5, 0); gbc_itemNameFieldComboBox.fill = GridBagConstraints.HORIZONTAL; gbc_itemNameFieldComboBox.gridx = 1; gbc_itemNameFieldComboBox.gridy = 1; gbc_itemNameFieldComboBox.anchor = GridBagConstraints.FIRST_LINE_START; add(itemNameFieldComboBox, gbc_itemNameFieldComboBox); itemNameFieldComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { try { initItemNameSelector(); initItemValueSelector(); } catch (Exception ee) { LOGGER.severe(ee.toString()); } } }); JLabel itemTitle = new JLabel("Item title"); GridBagConstraints gbc_lblItemtitle = new GridBagConstraints(); gbc_lblItemtitle.insets = new Insets(5, 5, 5, 5); gbc_lblItemtitle.gridx = 0; gbc_lblItemtitle.gridy = 2; gbc_lblItemtitle.anchor = GridBagConstraints.FIRST_LINE_START; add(itemTitle, gbc_lblItemtitle); itemNameComboBox = new JComboBox<String>(); GridBagConstraints gbc_itemComboBox = new GridBagConstraints(); gbc_itemComboBox.insets = new Insets(0, 0, 5, 0); gbc_itemComboBox.fill = GridBagConstraints.HORIZONTAL; gbc_itemComboBox.gridx = 1; gbc_itemComboBox.gridy = 2; gbc_itemComboBox.anchor = GridBagConstraints.FIRST_LINE_START; add(itemNameComboBox, gbc_itemComboBox); itemNameComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { try { initItemValueSelector(); } catch (Exception ee) { LOGGER.severe(ee.toString()); } } }); JLabel itemValue = new JLabel("Item value"); GridBagConstraints gbc_lblItemValue = new GridBagConstraints(); gbc_lblItemValue.insets = new Insets(5, 5, 5, 5); gbc_lblItemValue.weighty = 0.0; gbc_lblItemValue.gridx = 0; gbc_lblItemValue.gridy = 3; gbc_lblItemValue.anchor = GridBagConstraints.FIRST_LINE_START; add(itemValue, gbc_lblItemValue); itemValueComboBox = new JComboBox<String>(); GridBagConstraints gbc_itemValueComboBox = new GridBagConstraints(); gbc_itemValueComboBox.insets = new Insets(0, 0, 5, 0); gbc_itemValueComboBox.fill = GridBagConstraints.HORIZONTAL; gbc_itemValueComboBox.gridx = 1; gbc_itemValueComboBox.gridy = 3; gbc_itemValueComboBox.anchor = GridBagConstraints.FIRST_LINE_START; add(itemValueComboBox, gbc_itemValueComboBox); table = new JTable(); JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mouseClicked(java.awt.event.MouseEvent evt) { int row = table.rowAtPoint(evt.getPoint()); int col = table.columnAtPoint(evt.getPoint()); System.out.println("JQueryPanel:cell click:row=" + row + " column=" + col); if (col == 1) { String label$ = (String) table.getValueAt(row, 1); System.out.println("JQueryPanel:cell click:label=" + label$); Entigrator entigrator = console.getEntigrator(entihome$); String entity$ = entigrator.indx_keyAtLabel(label$); JEntityFacetPanel efp = new JEntityFacetPanel(); String efpLocator$ = efp.getLocator(); efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$); efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, entity$); JConsoleHandler.execute(console, efpLocator$); } } }); GridBagConstraints gbc_scroll_panel = new GridBagConstraints(); gbc_scroll_panel.anchor = GridBagConstraints.NORTH; gbc_scroll_panel.gridwidth = 2; gbc_scroll_panel.weighty = 1.0; gbc_scroll_panel.fill = GridBagConstraints.HORIZONTAL; gbc_scroll_panel.gridx = 0; gbc_scroll_panel.gridy = 4; add(scrollPane, gbc_scroll_panel); scrollPane.setMinimumSize(scrollPane.getPreferredSize()); }
From source file:com.sec.ose.osi.ui.frm.login.JPanLogin.java
/** * This method initializes jPanelUserInfo * //from w w w.j av a 2 s .c o m * @return javax.swing.JPanel */ private JPanel getJPanelUserInfo() { if (jPanelUserInfo == null) { jPanelUserInfo = new JPanel(); jPanelUserInfo.setLayout(new GridBagLayout()); // User ID JLabel jLabelUser = new JLabel("User ID:"); jLabelUser.setHorizontalAlignment(SwingConstants.RIGHT); jLabelUser.setText("User ID :"); jLabelUser.setEnabled(true); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = 0; gridBagConstraints.gridx = 0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new Insets(0, 10, 0, 0); jPanelUserInfo.add(jLabelUser, gridBagConstraints); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.gridy = 0; gridBagConstraints1.gridx = 1; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.insets = new Insets(5, 5, 5, 5); jPanelUserInfo.add(getJTextFieldUser(), gridBagConstraints1); // Password JLabel jLabelPwd = new JLabel(); jLabelPwd.setText("Password :"); jLabelPwd.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridy = 1; gridBagConstraints2.gridx = 0; gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints2.insets = new Insets(0, 10, 0, 0); jPanelUserInfo.add(jLabelPwd, gridBagConstraints2); GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.fill = GridBagConstraints.BOTH; gridBagConstraints3.gridy = 1; gridBagConstraints3.gridx = 1; gridBagConstraints3.weightx = 1.0; gridBagConstraints3.insets = new Insets(5, 5, 5, 5); jPanelUserInfo.add(getJPasswordField(), gridBagConstraints3); // Protex Server IP JLabel jLabelServer = new JLabel(); jLabelServer.setText("Protex Server IP :"); jLabelServer.setHorizontalAlignment(SwingConstants.RIGHT); jLabelServer.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED); GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridy = 2; gridBagConstraints11.gridx = 0; gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints11.insets = new Insets(0, 10, 5, 0); jPanelUserInfo.add(jLabelServer, gridBagConstraints11); GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.gridy = 2; gridBagConstraints21.gridx = 1; gridBagConstraints21.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints21.insets = new Insets(5, 5, 10, 5); jPanelUserInfo.add(getJTextFieldServerIP(), gridBagConstraints21); } return jPanelUserInfo; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.OtherTaskPaneUI.java
/** * Lays out the other annotations.//from w w w. j a v a 2 s .co m * * @param list The collection of annotation to layout. */ private void layoutOthers(Collection list) { clearDisplay(); DocComponent doc; GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.WEST; c.insets = new Insets(1, 2, 1, 2); c.gridx = 0; c.gridy = 0; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.NONE; if (!CollectionUtils.isEmpty(list)) { Iterator i = list.iterator(); while (i.hasNext()) { c.gridx = 0; c.weightx = 0; c.fill = GridBagConstraints.NONE; DataObject item = (DataObject) i.next(); if (filter == Filter.SHOW_ALL || (filter == Filter.ADDED_BY_ME && model.isLinkOwner(item)) || (filter == Filter.ADDED_BY_OTHERS && model.isAnnotatedByOther(item))) { doc = new DocComponent(item, model); doc.addPropertyChangeListener(controller); otherList.add(doc); add(new JLabel(getType((AnnotationData) item) + ":"), c); c.gridx = 1; c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; add(doc, c); c.gridy++; } } } }
From source file:com.hp.alm.ali.idea.content.settings.SettingsPanel.java
public SettingsPanel(final Project prj, Color bgColor) { this.prj = prj; this.projectConf = prj.getComponent(AliProjectConfiguration.class); previewAndConnection = new JPanel(new GridBagLayout()); previewAndConnection.setOpaque(false); GridBagConstraints c2 = new GridBagConstraints(); c2.gridx = 0;/*from w w w. java2 s. co m*/ c2.gridy = 1; c2.gridwidth = 2; c2.weighty = 1; c2.fill = GridBagConstraints.VERTICAL; JPanel filler = new JPanel(); filler.setOpaque(false); previewAndConnection.add(filler, c2); passwordPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); passwordPanel.setBackground(bgColor); JLabel label = new JLabel("Password"); label.setFont(label.getFont().deriveFont(Font.BOLD)); passwordPanel.add(label); final JPasswordField password = new JPasswordField(24); passwordPanel.add(password); JButton connect = new JButton("Login"); passwordPanel.add(connect); final JLabel message = new JLabel(); passwordPanel.add(message); ActionListener connectionAction = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { checkConnection(projectConf.getLocation(), projectConf.getDomain(), projectConf.getProject(), projectConf.getUsername(), password.getText()); } catch (AuthenticationFailed e) { message.setText(e.getMessage()); return; } projectConf.ALM_PASSWORD = password.getText(); projectConf.fireChanged(); } }; password.addActionListener(connectionAction); connect.addActionListener(connectionAction); restService = prj.getComponent(RestService.class); restService.addServerTypeListener(this); location = createTextPane(bgColor); domain = createTextPane(bgColor); project = createTextPane(bgColor); username = createTextPane(bgColor); final JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(bgColor); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); final JTextPane textPane = new JTextPane(); textPane.setEditorKit(new HTMLEditorKit()); textPane.setText( "<html><body>HP ALM integration can be configured on <a href=\"ide\">IDE</a> and overridden on <a href=\"project\">project</a> level.</body></html>"); textPane.setEditable(false); textPane.addHyperlinkListener(this); textPane.setBackground(bgColor); textPane.setCaret(new NonAdjustingCaret()); panel.add(textPane, BorderLayout.CENTER); JPanel content = new JPanel(new BorderLayout()); content.setBackground(bgColor); content.add(panel, BorderLayout.NORTH); content.add(previewAndConnection, BorderLayout.WEST); preview = new JPanel(new GridBagLayout()) { public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); // make enough room for the connection status message dim.width = Math.max(dim.width, 300); return dim; } public Dimension getMinimumSize() { return getPreferredSize(); } }; connectedTo(restService.getServerTypeIfAvailable()); preview.setBackground(bgColor); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.anchor = GridBagConstraints.WEST; preview.add(location, c); c.gridwidth = 1; c.gridy++; preview.add(domain, c); c.gridy++; preview.add(project, c); c.gridy++; preview.add(username, c); c.gridx++; c.gridy--; c.gridheight = 2; c.weightx = 0; c.anchor = GridBagConstraints.SOUTHEAST; final LinkLabel reload = new LinkLabel("Reload", IconLoader.getIcon("/actions/sync.png")); reload.setListener(new LinkListener() { public void linkSelected(LinkLabel linkLabel, Object o) { projectConf.fireChanged(); } }, null); preview.add(reload, c); JPanel previewNorth = new JPanel(new BorderLayout()); previewNorth.setBackground(bgColor); previewNorth.add(preview, BorderLayout.NORTH); addToGridBagPanel(0, 0, previewAndConnection, previewNorth); setBackground(bgColor); setLayout(new BorderLayout()); add(content, BorderLayout.CENTER); onChanged(); ApplicationManager.getApplication().getComponent(AliConfiguration.class).addListener(this); projectConf.addListener(this); }
From source file:com.sshtools.common.ui.SshToolsConnectionPanel.java
/** * * * @param parent/*from www . j a v a2 s .com*/ * @param profile * @param optionalTabs * * @return */ public static SshToolsConnectionProfile showConnectionDialog(Component parent, SshToolsConnectionProfile profile, SshToolsConnectionTab[] optionalTabs) { // If no properties are provided, then use the default if (profile == null) { int port = DEFAULT_PORT; String port_S = Integer.toString(DEFAULT_PORT); port_S = PreferencesStore.get(SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT, port_S); try { port = Integer.parseInt(port_S); } catch (NumberFormatException e) { log.warn("Could not parse the port number from defaults file (property name" + SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT + ", property value= " + port_S + ")."); } profile = new SshToolsConnectionProfile(); profile.setHost(PreferencesStore.get(SshToolsApplication.PREF_CONNECTION_LAST_HOST, "")); profile.setPort(PreferencesStore.getInt(SshToolsApplication.PREF_CONNECTION_LAST_PORT, port)); profile.setUsername(PreferencesStore.get(SshToolsApplication.PREF_CONNECTION_LAST_USER, "")); } final SshToolsConnectionPanel conx = new SshToolsConnectionPanel(true); if (optionalTabs != null) { for (int i = 0; i < optionalTabs.length; i++) { conx.addTab(optionalTabs[i]); } } conx.setConnectionProfile(profile); JDialog d = null; Window w = (Window) SwingUtilities.getAncestorOfClass(Window.class, parent); if (w instanceof JDialog) { d = new JDialog((JDialog) w, "Connection Profile", true); } else if (w instanceof JFrame) { d = new JDialog((JFrame) w, "Connection Profile", true); } else { d = new JDialog((JFrame) null, "Connection Profile", true); } final JDialog dialog = d; class UserAction { boolean connect; } final UserAction userAction = new UserAction(); // Create the bottom button panel final JButton cancel = new JButton("Cancel"); cancel.setMnemonic('c'); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { userAction.connect = false; dialog.setVisible(false); } }); final JButton connect = new JButton("Connect"); connect.setMnemonic('t'); connect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (conx.validateTabs()) { userAction.connect = true; dialog.setVisible(false); } } }); dialog.getRootPane().setDefaultButton(connect); JPanel buttonPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(6, 6, 0, 0); gbc.weighty = 1.0; UIUtil.jGridBagAdd(buttonPanel, connect, gbc, GridBagConstraints.RELATIVE); UIUtil.jGridBagAdd(buttonPanel, cancel, gbc, GridBagConstraints.REMAINDER); JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); southPanel.add(buttonPanel); // JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); mainPanel.add(conx, BorderLayout.CENTER); mainPanel.add(southPanel, BorderLayout.SOUTH); // Show the dialog dialog.getContentPane().setLayout(new GridLayout(1, 1)); dialog.getContentPane().add(mainPanel); dialog.pack(); dialog.setResizable(false); UIUtil.positionComponent(SwingConstants.CENTER, dialog); //show the simple box and act on the answer. SshToolsSimpleConnectionPrompt stscp = SshToolsSimpleConnectionPrompt.getInstance(); StringBuffer sb = new StringBuffer(); userAction.connect = !stscp.getHostname(sb, profile.getHost()); boolean advanced = stscp.getAdvanced(); if (advanced) { userAction.connect = false; profile.setHost(sb.toString()); conx.hosttab.setConnectionProfile(profile); dialog.setVisible(true); } // Make sure we didn't cancel if (!userAction.connect) { return null; } conx.applyTabs(); if (!advanced) profile.setHost(sb.toString()); if (!advanced) { int port = DEFAULT_PORT; String port_S = Integer.toString(DEFAULT_PORT); port_S = PreferencesStore.get(SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT, port_S); try { port = Integer.parseInt(port_S); } catch (NumberFormatException e) { log.warn("Could not parse the port number from defaults file (property name" + SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT + ", property value= " + port_S + ")."); } profile.setPort(port); } if (!advanced) profile.setUsername(""); PreferencesStore.put(SshToolsApplication.PREF_CONNECTION_LAST_HOST, profile.getHost()); // only save user inputed configuration if (advanced) { PreferencesStore.put(SshToolsApplication.PREF_CONNECTION_LAST_USER, profile.getUsername()); PreferencesStore.putInt(SshToolsApplication.PREF_CONNECTION_LAST_PORT, profile.getPort()); } // Return the connection properties return profile; }
From source file:gov.loc.repository.bagger.ui.NewBagFrame.java
private void layoutProfileSelection(JPanel contentPane, int row) { // content/* w w w.ja va 2s . co m*/ // profile selection JLabel bagProfileLabel = new JLabel(bagView.getPropertyMessage("Select Profile:")); bagProfileLabel.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); profileList = new JComboBox(bagView.getProfileStore().getProfileNames()); profileList.setName(bagView.getPropertyMessage("bag.label.projectlist")); profileList.setSelectedItem(bagView.getPropertyMessage("bag.project.noproject")); profileList.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); GridBagConstraints glbc = new GridBagConstraints(); JLabel spacerLabel = new JLabel(); glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); contentPane.add(bagProfileLabel, glbc); glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); contentPane.add(profileList, glbc); glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE, GridBagConstraints.EAST); contentPane.add(spacerLabel, glbc); }
From source file:net.vanosten.dings.swing.SummaryView.java
private void initializeChartPropertiesPanel() { chartPropertiesP = new JPanel(); GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); chartPropertiesP.setLayout(gbl);//from ww w. j av a 2 s . c om TitledBorder title; title = BorderFactory.createTitledBorder("Chart Properties"); chartPropertiesP.setBorder(title); JLabel typeL = new JLabel("Chart Type:"); typeL.setDisplayedMnemonic("C".charAt(0)); typeL.setLabelFor(chartTypeCB); JLabel emptyL = new JLabel(); Insets vghg = new Insets(DingsSwingConstants.SP_V_G, DingsSwingConstants.SP_H_G, 0, 0); //----type gbc.gridwidth = 1; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.LINE_END; gbc.insets = vghg; gbl.setConstraints(typeL, gbc); chartPropertiesP.add(typeL); //---- gbc.gridx = 1; gbc.anchor = GridBagConstraints.LINE_START; gbl.setConstraints(chartTypeCB, gbc); chartPropertiesP.add(chartTypeCB); //---- gbc.gridx = 2; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.HORIZONTAL; gbl.setConstraints(emptyL, gbc); chartPropertiesP.add(emptyL); //----chosen gbc.gridx = 1; gbc.gridy = 1; gbc.weightx = 0.0; gbc.fill = GridBagConstraints.NONE; gbl.setConstraints(chosenCB, gbc); chartPropertiesP.add(chosenCB); }
From source file:it.cnr.icar.eric.client.ui.swing.BusinessQueryPanel.java
/** * Class Constructor./*from w w w .j av a 2s. com*/ */ public BusinessQueryPanel(final FindParamsPanel findParamsPanel, ConfigurationType uiConfigurationType) throws JAXRException { super(findParamsPanel, uiConfigurationType); GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); objectTypeLabel = new JLabel(resourceBundle.getString("title.objectType"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(objectTypeLabel, c); add(objectTypeLabel); //TODO: SwingBoost: Localize this TreeNode tempTreeNode = new DefaultMutableTreeNode("loading object types..."); objectTypeCombo = new it.cnr.icar.eric.client.ui.swing.TreeCombo(new DefaultTreeModel(tempTreeNode)); c.gridx = 0; c.gridy = 1; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(objectTypeCombo, c); add(objectTypeCombo); objectTypeCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ev) { if (ev.getStateChange() == ItemEvent.DESELECTED) { return; } @SuppressWarnings("unused") String objectType = getObjectType().toString(); } }); //The caseSensitive CheckBox caseSensitiveCheckBox = new JCheckBox(resourceBundle.getString("title.caseSensitiveSearch")); caseSensitiveCheckBox.setSelected(false); caseSensitiveCheckBox.setEnabled(true); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(caseSensitiveCheckBox, c); add(caseSensitiveCheckBox); //The name Text nameLabel = new JLabel(resourceBundle.getString("title.name"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 3; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(nameLabel, c); add(nameLabel); nameText = new JTextField(); c.gridx = 0; c.gridy = 4; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(nameText, c); add(nameText); nameText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { findParamsPanel.find(); } }); //The description text descLabel = new JLabel(resourceBundle.getString("title.description"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 5; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(descLabel, c); add(descLabel); descText = new JTextField(); c.gridx = 0; c.gridy = 6; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(descText, c); add(descText); descText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { findParamsPanel.find(); } }); //Classifications classificationsLabel = new JLabel(resourceBundle.getString("title.classifications"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 7; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(classificationsLabel, c); add(classificationsLabel); classificationsList = new ClassificationsList(); classificationsList.setEditable(true); classificationsList.setVisibleRowCount(3); JScrollPane classificationsListScrollPane = new JScrollPane(classificationsList); //Workaround for bug 740746 where very wide item resulted in too short a height classificationsListScrollPane.setMinimumSize(new Dimension(-1, 50)); c.gridx = 0; c.gridy = 8; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(classificationsListScrollPane, c); add(classificationsListScrollPane); //Identifiers identifiersLabel = new JLabel(resourceBundle.getString("title.externalIdentifiers"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 9; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(identifiersLabel, c); add(identifiersLabel); extIdsList = new ExternalIdentifiersList(); extIdsList.setEditable(true); extIdsList.setVisibleRowCount(3); JScrollPane extIdsListScrollPane = new JScrollPane(extIdsList); //Workaround for bug 740746 where very wide item resulted in too short a height extIdsListScrollPane.setMinimumSize(new Dimension(-1, 50)); c.gridx = 0; c.gridy = 10; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(extIdsListScrollPane, c); add(extIdsListScrollPane); //External Links linksLabel = new JLabel(resourceBundle.getString("title.externalLinks"), SwingConstants.TRAILING); c.gridx = 0; c.gridy = 11; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(linksLabel, c); add(linksLabel); linksList = new ExternalLinksList(); linksList.setEditable(true); linksList.setVisibleRowCount(3); JScrollPane linksListScrollPane = new JScrollPane(linksList); //Workaround for bug 740746 where very wide item resulted in too short a height linksListScrollPane.setMinimumSize(new Dimension(-1, 50)); c.gridx = 0; c.gridy = 12; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(linksListScrollPane, c); add(linksListScrollPane); //add listener for 'locale' bound property RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this); }
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;/* w w w . j a va 2 s .co m*/ 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.nuxeo.launcher.sync.NuxeoSyncFrame.java
protected Component buildSyncPanel() { syncPanel = new JPanel(); syncPanel.setBackground(new Color(55, 55, 55)); syncPanel.setForeground(Color.WHITE); syncPanel.setLayout(new GridBagLayout()); JLabel l = new JLabel("Server IP", SwingConstants.TRAILING); l.setForeground(Color.WHITE); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1.0;/*from w w w. j a v a 2s .c om*/ c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.EAST; c.insets = new Insets(0, 0, 0, 0); syncPanel.add(l, c); syncServerIpTextField = new JTextField(10); l.setLabelFor(syncServerIpTextField); c.gridx = 1; c.gridy = 0; c.anchor = GridBagConstraints.WEST; syncPanel.add(syncServerIpTextField, c); l = new JLabel("Port", SwingConstants.TRAILING); l.setForeground(Color.WHITE); c.gridx = 0; c.gridy = 2; c.anchor = GridBagConstraints.EAST; syncPanel.add(l, c); syncPortTextField = new JTextField(10); l.setLabelFor(syncPortTextField); c.gridx = 1; c.gridy = 2; c.anchor = GridBagConstraints.WEST; syncPanel.add(syncPortTextField, c); l = new JLabel("Login", SwingConstants.TRAILING); l.setForeground(Color.WHITE); c.gridx = 0; c.gridy = 3; c.anchor = GridBagConstraints.EAST; syncPanel.add(l, c); syncLoginTextField = new JTextField(10); l.setLabelFor(syncLoginTextField); c.gridx = 1; c.gridy = 3; c.anchor = GridBagConstraints.WEST; syncPanel.add(syncLoginTextField, c); l = new JLabel("Password", SwingConstants.TRAILING); l.setForeground(Color.WHITE); c.gridx = 0; c.gridy = 4; c.anchor = GridBagConstraints.EAST; syncPanel.add(l, c); syncPasswordField = new JPasswordField(10); l.setLabelFor(syncPasswordField); c.gridx = 1; c.gridy = 4; c.anchor = GridBagConstraints.WEST; syncPanel.add(syncPasswordField, c); syncButton = new JButton(); c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 5; c.gridwidth = 2; c.insets = new Insets(10, 0, 0, 0); c.anchor = GridBagConstraints.CENTER; // set the action to the button synchronizeAction = createSyncAction(); syncButton.setAction(synchronizeAction); syncButton.setText("Synchronize"); updateSyncButton(); syncPanel.add(syncButton, c); errorMessageLabel = new JLabel("", SwingConstants.TRAILING); errorMessageLabel.setForeground(Color.RED); c.gridx = 0; c.gridy = 6; c.gridwidth = 2; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(10, 0, 0, 0); c.anchor = GridBagConstraints.CENTER; syncPanel.add(errorMessageLabel, c); return syncPanel; }