com.intellij.util.ui.ListTableModel Java Examples
The following examples show how to use
com.intellij.util.ui.ListTableModel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TargetExpressionListUi.java From intellij with Apache License 2.0 | 7 votes |
public TargetExpressionListUi(Project project) { this.project = project; listModel = new ListTableModel<>(new TargetColumn()); tableView = new TableView<>(listModel); tableView.getEmptyText().setText("Choose some targets"); tableView.setPreferredScrollableViewportSize(new Dimension(200, tableView.getRowHeight() * 4)); setLayout(new BorderLayout()); add( ToolbarDecorator.createDecorator(tableView) .setAddAction(button -> addTarget()) .setRemoveAction(button -> removeTarget()) .disableUpDownActions() .createPanel(), BorderLayout.CENTER); }
Example #2
Source File: UseAliasListForm.java From idea-php-annotation-plugin with MIT License | 6 votes |
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(); }
Example #3
Source File: ChooseLabelDialog.java From p4ic4idea with Apache License 2.0 | 6 votes |
private void createUIComponents() { searchResultsModel = new ListTableModel<>( new ColumnInfo<P4Label, String>(P4Bundle.getString("search.label.label-name")) { @Nullable @Override public String valueOf(P4Label o) { return o == null ? null : o.getName(); } }, new ColumnInfo<P4Label, String>(P4Bundle.getString("search.label.label-description")) { @Nullable @Override public String valueOf(P4Label o) { return o == null ? null : o.getDescription(); } }); mySearchResults = new JBTable(searchResultsModel); mySearchResults.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mySearchSpinner = new AsyncProcessIcon("Searching for labels"); }
Example #4
Source File: IssueNavigationConfigurationPanel.java From consulo with Apache License 2.0 | 5 votes |
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); }
Example #5
Source File: ServiceArgumentSelectionDialog.java From idea-php-symfony2-plugin with MIT License | 5 votes |
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() ); }
Example #6
Source File: VariablesPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
@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)); }
Example #7
Source File: VariablesPanel.java From intellij-xquery with Apache License 2.0 | 5 votes |
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)); }
Example #8
Source File: DualView.java From consulo with Apache License 2.0 | 5 votes |
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); }
Example #9
Source File: AttachmentsTabForm.java From consulo with Apache License 2.0 | 5 votes |
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; } } }
Example #10
Source File: ShowFeatureUsageStatisticsDialog.java From consulo with Apache License 2.0 | 4 votes |
protected JComponent createCenterPanel() { Splitter splitter = new Splitter(true); splitter.setShowDividerControls(true); ProductivityFeaturesRegistry registry = ProductivityFeaturesRegistry.getInstance(); ArrayList<FeatureDescriptor> features = new ArrayList<FeatureDescriptor>(); for (String id : registry.getFeatureIds()) { features.add(registry.getFeatureDescriptor(id)); } final TableView table = new TableView<FeatureDescriptor>(new ListTableModel<FeatureDescriptor>(COLUMNS, features, 0)); new TableViewSpeedSearch<FeatureDescriptor>(table) { @Override protected String getItemText(@Nonnull FeatureDescriptor element) { return element.getDisplayName(); } }; JPanel controlsPanel = new JPanel(new VerticalFlowLayout()); Application app = ApplicationManager.getApplication(); long uptime = System.currentTimeMillis() - app.getStartTime(); long idleTime = app.getIdleTime(); final String uptimeS = FeatureStatisticsBundle.message("feature.statistics.application.uptime", ApplicationNamesInfo.getInstance().getFullProductName(), DateFormatUtil.formatDuration(uptime)); final String idleTimeS = FeatureStatisticsBundle.message("feature.statistics.application.idle.time", DateFormatUtil.formatDuration(idleTime)); String labelText = uptimeS + ", " + idleTimeS; CompletionStatistics stats = ((FeatureUsageTrackerImpl)FeatureUsageTracker.getInstance()).getCompletionStatistics(); if (stats.dayCount > 0 && stats.sparedCharacters > 0) { String total = formatCharacterCount(stats.sparedCharacters, true); String perDay = formatCharacterCount(stats.sparedCharacters / stats.dayCount, false); labelText += "<br>Code completion has saved you from typing at least " + total + " since " + DateFormatUtil.formatDate(stats.startDate) + " (~" + perDay + " per working day)"; } CumulativeStatistics fstats = ((FeatureUsageTrackerImpl)FeatureUsageTracker.getInstance()).getFixesStats(); if (fstats.dayCount > 0 && fstats.invocations > 0) { labelText += "<br>Quick fixes have saved you from " + fstats.invocations + " possible bugs since " + DateFormatUtil.formatDate(fstats.startDate) + " (~" + fstats.invocations / fstats.dayCount + " per working day)"; } controlsPanel.add(new JLabel("<html><body>" + labelText + "</body></html>"), BorderLayout.NORTH); JPanel topPanel = new JPanel(new BorderLayout()); topPanel.add(controlsPanel, BorderLayout.NORTH); topPanel.add(ScrollPaneFactory.createScrollPane(table), BorderLayout.CENTER); splitter.setFirstComponent(topPanel); final JEditorPane browser = new JEditorPane(UIUtil.HTML_MIME, ""); browser.setEditable(false); splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(browser)); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { Collection selection = table.getSelection(); try { if (selection.isEmpty()) { browser.read(new StringReader(""), null); } else { FeatureDescriptor feature = (FeatureDescriptor)selection.iterator().next(); TipUIUtil.openTipInBrowser(feature.getTipFileName(), browser, feature.getProvider()); } } catch (IOException ex) { LOG.info(ex); } } }); return splitter; }
Example #11
Source File: TableModelEditor.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public ListTableModel<T> getModel() { return model; }
Example #12
Source File: AttachmentsTabForm.java From consulo with Apache License 2.0 | 4 votes |
public void setAttachments(List<Attachment> attachments) { myTable.setModelAndUpdateColumns(new ListTableModel<Attachment>(new ColumnInfo[]{ENABLED_COLUMN, PATH_COLUMN}, attachments, 1)); myTable.setBorder(IdeBorderFactory.createBorder()); myTable.setSelection(Collections.singletonList(attachments.get(0))); }
Example #13
Source File: TableView.java From consulo with Apache License 2.0 | 4 votes |
public TableView() { this(new ListTableModel<Item>(ColumnInfo.EMPTY_ARRAY)); }
Example #14
Source File: DualView.java From consulo with Apache License 2.0 | 4 votes |
private void refreshFlatModel() { if (myTableRefreshingIsLocked) return; ((ListTableModel)myFlatView.getModel()).setItems(myTreeView.getFlattenItems()); }
Example #15
Source File: BaseTableView.java From consulo with Apache License 2.0 | 4 votes |
public BaseTableView(final ListTableModel model) { super(model); }
Example #16
Source File: TableView.java From consulo with Apache License 2.0 | 4 votes |
public ListTableModel<Item> getListTableModel() { return (ListTableModel<Item>)super.getModel(); }
Example #17
Source File: TableView.java From consulo with Apache License 2.0 | 4 votes |
public void setModelAndUpdateColumns(final ListTableModel<Item> model) { super.setModel(model); createDefaultColumnsFromModel(); updateColumnSizes(); }
Example #18
Source File: TableView.java From consulo with Apache License 2.0 | 4 votes |
/** * use {@link #setModelAndUpdateColumns(com.intellij.util.ui.ListTableModel<Item>)} instead * @param model */ @Deprecated public void setModel(final ListTableModel<Item> model) { setModelAndUpdateColumns(model); }
Example #19
Source File: TableView.java From consulo with Apache License 2.0 | 4 votes |
public TableView(final ListTableModel<Item> model) { super(model); setModelAndUpdateColumns(model); }
Example #20
Source File: MuleSdkSelectionDialog.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
protected ListTableModel<MuleSdk> getSdkTableModel() { return new SdkTableModel(); }
Example #21
Source File: BuckSettingsUI.java From buck with Apache License 2.0 | 4 votes |
private JPanel initBuckCellSection() { JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(IdeBorderFactory.createTitledBorder("Cells", true)); cellTableModel = new ListTableModel<>(CELL_NAME_COLUMN, ROOT_COLUMN, BUILD_FILENAME_COLUMN); cellTableModel.setItems(buckCellSettingsProvider.getCells()); TableView<BuckCell> cellTable = new TableView<>(cellTableModel); cellTable.setPreferredScrollableViewportSize( new Dimension( cellTable.getPreferredScrollableViewportSize().width, 8 * cellTable.getRowHeight())); ToolbarDecorator decorator = ToolbarDecorator.createDecorator(cellTable) .setAddAction( (AnActionButton button) -> { final FileChooserDescriptor dirChooser = FileChooserDescriptorFactory.createSingleFolderDescriptor() .withTitle("Select root directory of buck cell"); Project project = buckProjectSettingsProvider.getProject(); FileChooser.chooseFile( dirChooser, project, BuckSettingsUI.this, project.getBaseDir(), file -> { BuckCell buckCell = new BuckCell(); buckCell.setName(file.getName()); buckCell.setRoot(file.getPath()); cellTableModel.addRow(buckCell); }); }) .addExtraAction( new AnActionButton("Automatically discover cells", Actions.Find) { @Override public void actionPerformed(AnActionEvent anActionEvent) { discoverCells(); } }); JBLabel label = new JBLabel("By default, commands take place in the topmost cell"); panel.add(label, BorderLayout.NORTH); panel.add(decorator.createPanel(), BorderLayout.CENTER); return panel; }
Example #22
Source File: SearchSelectPanel.java From p4ic4idea with Apache License 2.0 | 4 votes |
public SearchSelectPanel(@NotNull P4CommandRunner.QueryAnswer<? extends Collection<T>> query, @Nullable final SelectionChangedListener listener, @NotNull List<ColumnInfo<T, ?>> columns) { super(new BorderLayout()); Runnable onSelectionChange = () -> { if (listener == null) { return; } int count = 0; synchronized (itemSync) { for (SelectedItem<T> item : items) { if (item.selected) { count++; } } } listener.selectionCount(count); }; ColumnInfo[] columnArray = new ColumnInfo[columns.size() + 1]; columnArray[0] = new BooleanColumnInfo<SelectedItem<T>>(P4Bundle.getString("search-select.column.selected"), true) { @Override protected boolean booleanValue(SelectedItem<T> o) { return o.selected; } @Override protected void setBooleanValue(SelectedItem<T> o, boolean value) { o.selected = value; onSelectionChange.run(); } }; this.searchableColumns = new ArrayList<>(columns.size()); for (int i = 0; i < columns.size(); i++) { ColumnInfo<T, ?> column = columns.get(i); columnArray[i + 1] = proxyColumnInfo(column, onSelectionChange); if (String.class.equals(column.getColumnClass())) { //noinspection unchecked searchableColumns.add((ColumnInfo<T, String>) column); } } tableModel = new ListTableModel<>(columnArray); final JBTable table = new JBTable(tableModel); table.getColumnModel().getColumn(0).setCellEditor(new BooleanTableCellEditor(false, SwingConstants.CENTER)); table.getColumnModel().getColumn(0).setCellRenderer(new BooleanTableCellRenderer(SwingConstants.CENTER)); this.add(new JBScrollPane(table), BorderLayout.CENTER); this.add(table.getTableHeader(), BorderLayout.NORTH); table.getEmptyText().setText(P4Bundle.getString("search-select.status.loading")); final FilterComponent filterComponent = new FilterComponent("search-select", 10, true) { @Override public void filter() { String text = getFilter(); filterTable(text); } }; this.add(filterComponent, BorderLayout.SOUTH); query .whenCompleted((tValues) -> { table.getEmptyText().setText(P4Bundle.getString("search-select.status.empty")); synchronized (itemSync) { items.clear(); tValues.forEach(t -> items.add(new SelectedItem<>(t))); } filterTable(filterComponent.getFilter()); }) .whenServerError(e -> { table.getEmptyText().setText(P4Bundle.message("search-select.status.error", e.getLocalizedMessage())); synchronized (itemSync) { items.clear(); } if (listener != null) { listener.selectionCount(-1); } }); }
Example #23
Source File: SubmitModel.java From p4ic4idea with Apache License 2.0 | 4 votes |
void setJobModel(@NotNull ListTableModel<P4Job> model) { this.jobModel = model; }
Example #24
Source File: WeaveRunnerConfPanel.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
public EditWeaveInputAction(ListTableModel<WeaveInput> myModel) { this.myModel = myModel; }
Example #25
Source File: WeaveRunnerConfPanel.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
public RemoveWeaveInputAction(ListTableModel<WeaveInput> myModel) { this.myModel = myModel; }
Example #26
Source File: WeaveRunnerConfPanel.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
public AddWeaveInputAction(ListTableModel<WeaveInput> myModel) { this.myModel = myModel; }
Example #27
Source File: WeaveRunnerConfPanel.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
public ListTableModel<WeaveInput> getWeaveInputs() { return myModel; }
Example #28
Source File: ListTableWithButtons.java From consulo with Apache License 2.0 | votes |
protected abstract ListTableModel createListModel();