/** * @param parent parent component. * @param filter filter to be edited. * @param filterIndex index of <code>filter</code> in the <code>filters</code>. This parameter is * needed to not compare filter with itself when validating. * @param filters all already configured filters. This parameter is used to * @param patterns all patterns available in this filter. */ public FilterDialog(Component parent, TodoFilter filter, int filterIndex, List<TodoFilter> filters, List<TodoPattern> patterns) { super(parent, true); myFilter = filter; myFilterIndex = filterIndex; myPatterns = patterns; myFilters = filters; myNameField = new JTextField(filter.getName()); MyModel model = new MyModel(); myTable = new Table(model); init(); }
private void initChunksPanel() { List<Chunk<Module>> chunks = getCycleChunks(); if (chunks.isEmpty()) { return; } myChunksPanel.setLayout(new BorderLayout()); myChunksPanel.setBorder( IdeBorderFactory.createTitledBorder(CompilerBundle.message("generate.ant.build.dialog.cyclic.modules.table.title"), true)); JLabel textLabel = new JLabel(CompilerBundle.message("generate.ant.build.dialog.cyclic.modules.table.description")); textLabel.setUI(new MultiLineLabelUI()); textLabel.setBorder(IdeBorderFactory.createEmptyBorder(4, 4, 6, 4)); myChunksPanel.add(textLabel, BorderLayout.NORTH); myTableModel = new MyTableModel(chunks); myTable = new Table(myTableModel); final MyTableCellRenderer cellRenderer = new MyTableCellRenderer(); final TableColumn nameColumn = myTable.getColumnModel().getColumn(MyTableModel.NAME_COLUMN); nameColumn.setCellEditor(ComboBoxTableCellEditor.INSTANCE); nameColumn.setCellRenderer(cellRenderer); final TableColumn labelColumn = myTable.getColumnModel().getColumn(MyTableModel.NUMBER_COLUMN); labelColumn.setCellRenderer(cellRenderer); final Dimension preferredSize = new Dimension(myTable.getPreferredSize()); preferredSize.height = (myTableModel.getRowCount() + 2) * myTable.getRowHeight() + myTable.getTableHeader().getHeight(); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); scrollPane.setPreferredSize(preferredSize); myChunksPanel.add(scrollPane, BorderLayout.CENTER); }
protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); Table table = new Table(new MyTableModel()); JLabel label = new JLabel(ProjectBundle.message("project.macros.prompt")); label.setBorder(IdeBorderFactory.createEmptyBorder(6, 6, 6, 6)); panel.add(label, BorderLayout.NORTH); panel.add(ScrollPaneFactory.createScrollPane(table), BorderLayout.CENTER); return panel; }
public EditContextDialog(Project project, Set<String> unresolvedPrefixes, Collection<Namespace> namespaces, Collection<Variable> variables, ContextProvider contextProvider) { super(project, false); myUnresolvedPrefixes = unresolvedPrefixes; setTitle("Edit XPath Context"); setModal(true); myContextProvider = new MyContextProvider(contextProvider); final List<Variable> m = copy(variables); myVariableTableModel = new VariableTableModel(m, project, XPathFileType.XPATH); myVariableTable = new Table(myVariableTableModel); myVariableTable.setDefaultRenderer(String.class, new VariableCellRenderer(m)); myVariableTable.setDefaultRenderer(Expression.class, new ExpressionCellRenderer(project)); myVariableTable.setDefaultEditor(Expression.class, new ExpressionCellEditor(project)); int width = new JLabel("Name").getPreferredSize().width; myVariableTable.getColumnModel().getColumn(0).setMinWidth(width); myVariableTable.getColumnModel().getColumn(0).setMaxWidth(width * 5); myVariableTable.setPreferredScrollableViewportSize(new Dimension(200, 130)); final List<Namespace> n = copy(namespaces); myNamespaceTableModel = new NamespaceTableModel(n); myNamespaceTable = new Table(myNamespaceTableModel); myNamespaceTable.setDefaultRenderer(String.class, new NamespaceCellRenderer(n)); width = new JLabel("Prefix").getPreferredSize().width; myNamespaceTable.getColumnModel().getColumn(0).setMinWidth(width); myNamespaceTable.getColumnModel().getColumn(0).setMaxWidth(width * 4); myNamespaceTable.setPreferredScrollableViewportSize(new Dimension(200, 150)); init(); }
private JScrollPane createTablePanel() { myTableModel = new MyTableModel(); myTable = new Table(myTableModel); myTable.setSurrendersFocusOnKeystroke(true); myTable.getTableHeader().setReorderingAllowed(false); final TableColumnModel columnModel = myTable.getColumnModel(); columnModel.getColumn(SKIP_SETTER).setCellRenderer(new BooleanTableCellRenderer()); myTable.registerKeyboardAction( new ActionListener() { public void actionPerformed(ActionEvent e) { final int[] selectedRows = myTable.getSelectedRows(); for (final int selectedRow : selectedRows) { final ParameterData parameterData = myTableModel.getParamData(selectedRow); if (parameterData.getDefaultValue() != null) { parameterData.setInsertSetter(!parameterData.isInsertSetter()); } } TableUtil.selectRows(myTable, selectedRows); } }, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), JComponent.WHEN_FOCUSED ); myTable.setPreferredScrollableViewportSize(new Dimension(550, myTable.getRowHeight() * 12)); myTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); //final Border titledBorder = IdeBorderFactory.createBoldTitledBorder("Parameters to Pass to the Builder"); //final Border emptyBorder = BorderFactory.createEmptyBorder(0, 5, 5, 5); //final Border border = BorderFactory.createCompoundBorder(titledBorder, emptyBorder); //scrollPane.setBorder(border); return scrollPane; }
private void setupTable() { myTable = new Table(); myTableModel = new MyTableModel(); myTable.setModel(myTableModel); myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { refreshValidatingComponent(); } }); myTable.setCellSelectionEnabled(false); myTable.setColumnSelectionAllowed(false); myTable.setRowSelectionAllowed(false); myTable.getTableHeader().setReorderingAllowed(false); }
void installEditSourceOnDoubleClick(Table table);