public DetectedRootsChooser() { myModel = new ListTableModel<DetectedRootData>(); myTable = new TableView<DetectedRootData>(myModel); myTable.setTableHeader(null); myTable.setShowGrid(false); myComponent = ScrollPaneFactory.createScrollPane(myTable); myTable.registerKeyboardAction( new ActionListener() { public void actionPerformed(ActionEvent e) { invertSelectedRows(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), JComponent.WHEN_FOCUSED ); }
@NotNull public List<Item> getSelectedObjects() { ListSelectionModel selectionModel = getSelectionModel(); int minSelectionIndex = selectionModel.getMinSelectionIndex(); int maxSelectionIndex = selectionModel.getMaxSelectionIndex(); if (minSelectionIndex == -1 || maxSelectionIndex == -1) { return Collections.emptyList(); } List<Item> result = new SmartList<Item>(); ListTableModel<Item> model = getListTableModel(); for (int i = minSelectionIndex; i <= maxSelectionIndex; i++) { if (selectionModel.isSelectedIndex(i)) { int modelIndex = convertRowIndexToModel(i); if (modelIndex >= 0 && modelIndex < model.getRowCount()) { result.add(model.getRowValue(modelIndex)); } } } return result; }
private void updateRevisionsList() throws VcsException { if (myIsInLoading) return; if (myChangesOnlyCheckBox.isSelected()) { loadContentsFor(myRevisions.toArray(new VcsFileRevision[myRevisions.size()])); try { ((ListTableModel)myList.getModel()).setItems(filteredRevisions()); } catch (FilesTooBigForDiffException e) { myChangesOnlyCheckBox.setEnabled(false); myChangesOnlyCheckBox.setSelected(false); setErrorText(e.getMessage()); ((ListTableModel)myList.getModel()).setItems(myRevisions); } ((ListTableModel)myList.getModel()).fireTableDataChanged(); updateDiff(0, 0); } else { ((ListTableModel)myList.getModel()).setItems(myRevisions); ((ListTableModel)myList.getModel()).fireTableDataChanged(); } }
private synchronized void updateDiff(int first, int second) { if (myIsDisposed || myIsInLoading) return; List items = ((ListTableModel)myList.getModel()).getItems(); VcsFileRevision firstRev = (VcsFileRevision)items.get(first); VcsFileRevision secondRev = (VcsFileRevision)items.get(second); if (VcsHistoryUtil.compare(firstRev, secondRev) > 0) { VcsFileRevision tmp = firstRev; firstRev = secondRev; secondRev = tmp; } if (myIsDisposed) return; DiffRequest diffRequest = createDiffRequest(firstRev, secondRev); myDiffPanel.setRequest(diffRequest); }
private void setupParameterList(List<ParamInfo> arguments) { final ListTableModel<ParamInfo> dataModel = new ListTableModel<ParamInfo>(new NameColumnInfo(), new TypeColumnInfo()); dataModel.setItems(arguments); myParametersTable.setModel(dataModel); if (arguments.isEmpty()) return; String max0 = arguments.get(0).name; String max1 = arguments.get(0).type; for (ParamInfo argument : arguments) { if (argument.name.length() > max0.length()) max0 = argument.name; if (argument.type.length() > max1.length()) max1 = argument.type; } final FontMetrics metrics = myParametersTable.getFontMetrics(myParametersTable.getFont()); final TableColumn column0 = myParametersTable.getColumnModel().getColumn(0); column0.setPreferredWidth(metrics.stringWidth(max0 + " ")); final TableColumn column1 = myParametersTable.getColumnModel().getColumn(1); column1.setPreferredWidth(metrics.stringWidth(max1 + " ")); }
private void updateTable() { //noinspection unchecked List<Pair<StatefulPolicyDescriptor, Boolean>> list = new ArrayList<Pair<StatefulPolicyDescriptor, Boolean>>(myProjectToDescriptors.get(getSelectedProject()).descriptors.size()); try { for (StatefulPolicyDescriptor descriptor : myProjectToDescriptors.get(getSelectedProject()).descriptors) { list.add(Pair.create(descriptor, CheckinPoliciesManager.find(descriptor.getType()) != null)); } } catch (DuplicatePolicyIdException e) { // can't get here throw new RuntimeException(e); } //noinspection unchecked ((ListTableModel)myPoliciesTable.getModel()).setItems(list); }
public UseAliasListForm() { this.tableView = new TableView<>(); this.modelList = new ListTableModel<>( new ClassColumn(), new AliasColumn(), new DisableColumn() ); this.tableView.setModelAndUpdateColumns(this.modelList); buttonReset.addActionListener(e -> { tableView.getTableViewModel().fireTableDataChanged(); changed = true; resetList(); try { apply(); ApplicationSettings.getInstance().provideDefaults = false; JOptionPane.showMessageDialog(panel, "Default alias applied"); } catch (ConfigurationException ignored) { } }); initList(); }
public void changeColumnSet(DualViewColumnInfo[] columns) { myTreeView.setTableModel(new ListTreeTableModelOnColumns((TreeNode)myTreeView.getTreeViewModel().getRoot(), createTreeColumns(columns))); myFlatView.setModelAndUpdateColumns(new ListTableModel(columns)); if (myTreeCellRenderer != null) myTreeView.setTreeCellRenderer(myTreeCellRenderer); setRootVisible(myRootVisible); refreshFlatModel(); addWidthListenersTo(myTreeView); addWidthListenersTo(myFlatView); }
public void selectFirstIncludedAttachment() { final List items = ((ListTableModel)myTable.getModel()).getItems(); for (Object item : items) { if (((Attachment)item).isIncluded()) { myTable.setSelection(Collections.singleton((Attachment)item)); break; } } }
public void reset() { IssueNavigationConfiguration configuration = IssueNavigationConfiguration.getInstance(myProject); myLinks = new ArrayList<IssueNavigationLink>(); for(IssueNavigationLink link: configuration.getLinks()) { myLinks.add(new IssueNavigationLink(link.getIssueRegexp(), link.getLinkRegexp())); } myModel = new ListTableModel<IssueNavigationLink>( new ColumnInfo[] { ISSUE_COLUMN, LINK_COLUMN }, myLinks, 0); myLinkTable.setModel(myModel); }
private void setCustomPathToFirstListed() { ListTableModel<ConfigurableWebBrowser> model = browsersEditor.getModel(); for (int i = 0, n = model.getRowCount(); i < n; i++) { ConfigurableWebBrowser browser = model.getRowValue(i); if (browser.isActive() && browser.getPath() != null) { alternativeBrowserPathField.setText(browser.getPath()); return; } } alternativeBrowserPathField.setText(""); }
public void doDispose() { BaseTableView.store(myStorage, myTable); myTable.setModelAndUpdateColumns(new ListTableModel(TestColumnInfo.COLUMN_NAMES)); myModel = null; myChildInfo = null; myCurrentTest = null; }
public PropertiesTab() { myPropertiesTable = new JBTable(); UIPropertyBinding.TableListBinding<BuildFileProperty> tableListBinding = getBinding().bindList(myPropertiesTable, PROPERTY_COLUMNS, AntBuildFileImpl.ANT_PROPERTIES); tableListBinding.setColumnWidths(GlobalAntConfiguration.PROPERTIES_TABLE_LAYOUT); myWholePanel = ToolbarDecorator.createDecorator(myPropertiesTable) .setAddAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { if (myPropertiesTable.isEditing() && !myPropertiesTable.getCellEditor().stopCellEditing()) { return; } BuildFileProperty item = new BuildFileProperty(); ListTableModel<BuildFileProperty> model = (ListTableModel<BuildFileProperty>)myPropertiesTable.getModel(); ArrayList<BuildFileProperty> items = new ArrayList<BuildFileProperty>(model.getItems()); items.add(item); model.setItems(items); int newIndex = model.indexOf(item); ListSelectionModel selectionModel = myPropertiesTable.getSelectionModel(); selectionModel.clearSelection(); selectionModel.setSelectionInterval(newIndex, newIndex); ColumnInfo[] columns = model.getColumnInfos(); for (int i = 0; i < columns.length; i++) { ColumnInfo column = columns[i]; if (column.isCellEditable(item)) { myPropertiesTable.requestFocusInWindow(); myPropertiesTable.editCellAt(newIndex, i); break; } } } }).disableUpDownActions().createPanel(); myWholePanel.setBorder(null); }
public CustomizeKeywordSubstitutionDialog(Project project, String description, ImportConfiguration importConfiguration) { super(project); setTitle(description); myImportConfiguration = importConfiguration; myModel = new ListTableModel<FileExtension>(COLUMNS); myModel.setItems(collectFileTypes()); init(); pack(); }
@Override public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) { this.project = project; table = new TableView<DeploymentTableItem>(new ListTableModel<DeploymentTableItem>(DESC, PROGRESS, STATUS, START_TIME)); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // add mouse listener for links in table table.addMouseListener(createTableMouseListener()); toolWindow.getComponent().add(new JBScrollPane(table)); registerDeploymentListener(); }
public TelemetryDisplay(InspectionGadgetsTelemetry telemetry) { tableModel = new ListTableModel<InspectionRunTime>(createColumns(), telemetry.buildList(), 0); final JTable table = new JBTable(tableModel); new TableSpeedSearch(table); scrollPane = ScrollPaneFactory.createScrollPane(table); }
public VariablesPanel() { super(new BorderLayout()); setName(VARIABLES_PANEL); variablesModel = new ListTableModel<XQueryRunVariable>(IS_ACTIVE, NAME, NAMESPACE, TYPE, VALUE); variablesTable = prepareVariablesTable(); toolbarDecorator = prepareVariablesTableToolbarDecorator(variablesTable); add(toolbarDecorator.createPanel()); setPreferredSize(new Dimension(- 1, 120)); }
@Test public void shouldHaveTheRightColumnNames() { ListTableModel<XQueryRunVariable> model = (ListTableModel<XQueryRunVariable>) window.table().component() .getModel(); ColumnInfo[] columnInfoArray = model.getColumnInfos(); assertThat(columnInfoArray[0].getName(), is(IsActiveColumnInfo.HEADER)); assertThat(columnInfoArray[1].getName(), is(NameColumnInfo.HEADER)); assertThat(columnInfoArray[2].getName(), is(NamespaceColumnInfo.HEADER)); assertThat(columnInfoArray[3].getName(), is(TypeColumnInfo.HEADER)); assertThat(columnInfoArray[4].getName(), is(ValueColumnInfo.HEADER)); }
private void createUIComponents() { mainPanel = new JPanel(); mainPanel.setLayout(new GridLayout(0, 1)); this.modelList = new ListTableModel<>( new IconColumn(), new NamespaceColumn(), new ServiceColumn() ); for (Map.Entry<String, Set<String>> entry : this.arguments.entrySet()) { this.modelList.addRow(new ServiceParameter(entry.getKey(), entry.getValue())); } this.tableView = new TableView<>(); this.tableView.setModelAndUpdateColumns(this.modelList); mainPanel.add(ToolbarDecorator.createDecorator(this.tableView) .disableAddAction() .disableDownAction() .disableRemoveAction() .disableUpDownActions() .createPanel() ); }
protected ListTableModel<MuleSdk> getSdkTableModel() { return new SdkTableModel(); }
public ListTableModel<WeaveInput> getWeaveInputs() { return myModel; }
public AddWeaveInputAction(ListTableModel<WeaveInput> myModel) { this.myModel = myModel; }
public RemoveWeaveInputAction(ListTableModel<WeaveInput> myModel) { this.myModel = myModel; }
public EditWeaveInputAction(ListTableModel<WeaveInput> myModel) { this.myModel = myModel; }
@Override protected ListTableModel createListModel() { return new ListTableModel<Item>(NAME_COLUMN, SCOPE_COLUMN); }
public TableView() { this(new ListTableModel<Item>(ColumnInfo.EMPTY_ARRAY)); }
public TableView(final ListTableModel<Item> model) { super(model); setModelAndUpdateColumns(model); }
/** * use {@link #setModelAndUpdateColumns(com.intellij.util.ui.ListTableModel<Item>)} instead * @param model */ @Deprecated public void setModel(final ListTableModel<Item> model) { setModelAndUpdateColumns(model); }