/** Initializes the layout of this view. */ protected void initializeLayout() { GridBagConstraints constraints = new GridBagConstraints(); // Name widgets JComponent nameWidgets = buildLabeledTextField("LOGIN_PROPERTY_EDITOR_NAME_FIELD", buildNameDocumentAdapter()); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 1; constraints.weighty = 0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; constraints.insets = new Insets(0, 0, 0, 0); add(nameWidgets, constraints); putClientProperty("initialFocus", nameWidgets.getComponent(1)); // Value widgets JComponent valueWidgets = buildLabeledTextField("LOGIN_PROPERTY_EDITOR_VALUE_FIELD", buildValueDocumentAdapter()); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 1; constraints.weighty = 1; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.PAGE_START; constraints.insets = new Insets(5, 0, 0, 0); add(valueWidgets, constraints); }
/** * Initializes the layout of this pane. * * @return The container with all its widgets */ protected void initializeLayout() { GridBagConstraints constraints = new GridBagConstraints(); selectionModel = buildPropertySelectionModel(); // Property table table = SwingComponentFactory.buildTable( this.buildPropertyTableAdapter(), this.buildTableColumnModel(), this.selectionModel); table.setAutoCreateColumnsFromModel(false); table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); table.setAutoscrolls(true); table.setSurrendersFocusOnKeystroke(true); table.getTableHeader().setReorderingAllowed(false); table.addPropertyChangeListener("enabled", new PropertyChangeHandler()); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 1; constraints.gridheight = 3; constraints.weightx = 1; constraints.weighty = 1; constraints.fill = GridBagConstraints.BOTH; constraints.anchor = GridBagConstraints.CENTER; constraints.insets = new Insets(0, 0, 0, 0); scrollPane = new JScrollPane(table); scrollPane.setMinimumSize(new Dimension(0, 0)); scrollPane.setPreferredSize(new Dimension(0, 0)); scrollPane.getViewport().setBackground(table.getBackground()); add(scrollPane, constraints); // Add button addButton = buildButton("LOGIN_PROPERTY_ADD_BUTTON"); addButton.addActionListener(buildAddActionListener()); constraints.gridx = 1; constraints.gridy = 0; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 0; constraints.weighty = 0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; constraints.insets = new Insets(0, 5, 0, 0); add(addButton, constraints); // Edit button editButton = buildButton("LOGIN_PROPERTY_EDIT_BUTTON"); editButton.addActionListener(buildEditActionListener()); editButton.setEnabled(false); constraints.gridx = 1; constraints.gridy = 1; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 0; constraints.weighty = 0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; constraints.insets = new Insets(5, 5, 0, 0); add(editButton, constraints); buildEditButtonEnabler(); // Remove button removeButton = buildButton("LOGIN_PROPERTY_REMOVE_BUTTON"); removeButton.addActionListener(buildRemoveActionListener(selectionModel)); removeButton.setEnabled(false); constraints.gridx = 1; constraints.gridy = 2; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 0; constraints.weighty = 0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.PAGE_START; constraints.insets = new Insets(5, 5, 0, 0); add(removeButton, constraints); buildRemoveButtonEnabler(); addHelpTopicId(this, "session.login.properties"); }