private JTable buildTable() { JTable table = SwingComponentFactory.buildTable(tableModel, rowSelectionModel); int rowHeight = 20; // start with minimum of 20 table.setRowHeight(rowHeight); return table; }
private JTable buildValuePairsTable() { CollectionValueModel valuePairsHolder = buildValuePairsHolder(); JTable table = SwingComponentFactory.buildTable( this.buildValuePairsTableModel(valuePairsHolder), this.buildValuePairsSelectionModel(valuePairsHolder)); this.addPropertyChangeListener( "enabled" /* stupid hard-coded property name */, this.buildTableEnabler(table)); return table; }
protected Component buildPage() { JTable table = SwingComponentFactory.buildTable(this.tableModel); TableColumn javaTypeColumn = table.getColumnModel().getColumn(MappingColumnAdapter.JAVA_TYPE_COLUMN); javaTypeColumn.setCellRenderer(this.buildJavaTypeRenderer()); TableColumn jdbcTypeColumn = table.getColumnModel().getColumn(MappingColumnAdapter.JDBC_TYPE_COLUMN); jdbcTypeColumn.setCellRenderer(this.buildJDBCTypeRenderer()); return table; }
private JTable buildTable() { JTable table = SwingComponentFactory.buildTable(tableModel, rowSelectionModel); int rowHeight = 20; // start with minimum of 20 // Name column TableColumn column = table.getColumnModel().getColumn(InsertFieldColumnAdapter.INSERT_FIELD_COLUMN); TableCellRenderer fieldRenderer = this.buildFieldColumnCellRenderer(); column.setCellRenderer(fieldRenderer); // Return-only column (check box) column = table.getColumnModel().getColumn(InsertFieldColumnAdapter.RETURN_ONLY_COLUMN); CheckBoxTableCellRenderer returnOnlyRenderer = new CheckBoxTableCellRenderer(); column.setCellRenderer(returnOnlyRenderer); column.setCellEditor(new TableCellEditorAdapter(new CheckBoxTableCellRenderer())); rowHeight = Math.max(rowHeight, returnOnlyRenderer.getPreferredHeight()); table.setRowHeight(rowHeight); return table; }
private JTable buildFieldPairsTable() { ListValueModel listValue = this.buildFieldPairsValue(); TableModel tableModel = this.buildFieldPairsTableModel(listValue); this.fieldPairsSelectionModel = this.buildFieldPairSelectionModel(listValue); JTable table = SwingComponentFactory.buildTable(tableModel, this.fieldPairsSelectionModel); TableColumn column; // source field column column = table.getColumnModel().getColumn(FieldPairsTableColumnAdapter.SOURCE_XPATH_COLUMN); column.setCellRenderer(this.buildXpathColumnCellRenderer()); // target field column column = table.getColumnModel().getColumn(FieldPairsTableColumnAdapter.TARGET_XPATH_COLUMN); column.setCellRenderer(this.buildXpathColumnCellRenderer()); this.addPropertyChangeListener( "enabled" /* stupid hard-coded property name */, this.buildTableEnabler(table)); return table; }
/** * 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"); }