com.intellij.util.ui.ColumnInfo Java Examples
The following examples show how to use
com.intellij.util.ui.ColumnInfo.
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: TableModelEditor.java From consulo with Apache License 2.0 | 6 votes |
@Override public void setValueAt(Object newValue, int rowIndex, int columnIndex) { if (rowIndex < getRowCount()) { @SuppressWarnings("unchecked") ColumnInfo<T, Object> column = (ColumnInfo<T, Object>)getColumnInfos()[columnIndex]; T item = getItem(rowIndex); Object oldValue = column.valueOf(item); if (column.getColumnClass() == String.class ? !Comparing.strEqual(((String)oldValue), ((String)newValue)) : !Comparing.equal(oldValue, newValue)) { column.setValue(helper.getMutable(item, rowIndex), newValue); if (dataChangedListener != null) { dataChangedListener.dataChanged(column, rowIndex); } } } }
Example #2
Source File: InspectorPanel.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
PropertiesPanel(FlutterApp flutterApp, InspectorService inspectorService) { super(new ListTreeTableModelOnColumns( new DefaultMutableTreeNode(), new ColumnInfo[]{ new PropertyNameColumnInfo("Property"), new PropertyValueColumnInfo("Value") } )); this.flutterApp = flutterApp; this.groups = new InspectorObjectGroupManager(inspectorService, "panel"); setRootVisible(false); setStriped(true); setRowHeight(getRowHeight() + JBUI.scale(4)); final JTableHeader tableHeader = getTableHeader(); tableHeader.setPreferredSize(new Dimension(0, getRowHeight())); getColumnModel().getColumn(0).setPreferredWidth(120); getColumnModel().getColumn(1).setPreferredWidth(200); }
Example #3
Source File: DualView.java From consulo with Apache License 2.0 | 6 votes |
private ColumnInfo[] createTreeColumns(DualViewColumnInfo[] columns) { Collection<ColumnInfo> result = new ArrayList<ColumnInfo>(); final ColumnInfo firstColumn = columns[0]; ColumnInfo firstTreeColumn = new ColumnInfo(firstColumn.getName()) { public Object valueOf(Object object) { return firstColumn.valueOf(object); } public Class getColumnClass() { return TreeTableModel.class; } public boolean isCellEditable(Object o) { return true; } }; result.add(firstTreeColumn); for (int i = 1; i < columns.length; i++) { DualViewColumnInfo column = columns[i]; if (column.shouldBeShownIsTheTree()) result.add(column); } return result.toArray(new ColumnInfo[result.size()]); }
Example #4
Source File: InspectorPanel.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
PropertiesPanel(FlutterApp flutterApp, InspectorService inspectorService) { super(new ListTreeTableModelOnColumns( new DefaultMutableTreeNode(), new ColumnInfo[]{ new PropertyNameColumnInfo("Property"), new PropertyValueColumnInfo("Value") } )); this.flutterApp = flutterApp; this.groups = new InspectorObjectGroupManager(inspectorService, "panel"); setRootVisible(false); setStriped(true); setRowHeight(getRowHeight() + JBUI.scale(4)); final JTableHeader tableHeader = getTableHeader(); tableHeader.setPreferredSize(new Dimension(0, getRowHeight())); getColumnModel().getColumn(0).setPreferredWidth(120); getColumnModel().getColumn(1).setPreferredWidth(200); }
Example #5
Source File: ColumnDefinitions.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 6 votes |
@NotNull private static ColumnInfo<DefaultMutableTreeNode, String> getArgumentColumn(String title, String argumentKey) { return new ColumnInfo<DefaultMutableTreeNode, String>(title) { @Nullable @Override public String valueOf(DefaultMutableTreeNode o) { return ((GraphQueryPlan) o.getUserObject()).getArguments().entrySet().stream() .filter(e -> e.getKey().equalsIgnoreCase(argumentKey)) .map(Map.Entry::getValue) .findFirst() .map(val -> { if (val instanceof Double) { return FORMATTER.format(val); } return val.toString(); }) .orElse("0"); } }; }
Example #6
Source File: JsonTreeTableView.java From nosql4idea with Apache License 2.0 | 6 votes |
public JsonTreeTableView(TreeNode rootNode, ColumnInfo[] columnInfos) { super(new ListTreeTableModelOnColumns(rootNode, columnInfos)); this.columns = columnInfos; final TreeTableTree tree = getTree(); tree.setShowsRootHandles(true); tree.setRootVisible(false); UIUtil.setLineStyleAngled(tree); setTreeCellRenderer(new KeyCellRenderer()); TreeUtil.expand(tree, 2); new TreeTableSpeedSearch(this, new Convertor<TreePath, String>() { @Override public String convert(final TreePath path) { final NoSqlTreeNode node = (NoSqlTreeNode) path.getLastPathComponent(); NodeDescriptor descriptor = node.getDescriptor(); return descriptor.getFormattedKey(); } }); }
Example #7
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 #8
Source File: FileHistoryPanelImpl.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull private DualViewColumnInfo[] createColumnList(@Nonnull Project project, @Nonnull VcsHistoryProvider provider, @javax.annotation.Nullable ColumnInfo[] additionalColumns) { ArrayList<DualViewColumnInfo> columns = new ArrayList<>(); columns.add(new RevisionColumnInfo(myRevisionsInOrderComparator)); if (!provider.isDateOmittable()) columns.add(new DateColumnInfo()); columns.add(new AuthorColumnInfo()); ArrayList<DualViewColumnInfo> additionalColumnInfo = new ArrayList<>(); if (additionalColumns != null) { for (ColumnInfo additionalColumn : additionalColumns) { additionalColumnInfo.add(new FileHistoryColumnWrapper(additionalColumn) { @Override protected DualView getDualView() { return myDualView; } }); } } columns.addAll(additionalColumnInfo); columns.add(new MessageColumnInfo(project)); return columns.toArray(new DualViewColumnInfo[columns.size()]); }
Example #9
Source File: TableModelEditor.java From consulo with Apache License 2.0 | 5 votes |
/** * source will be copied, passed list will not be used directly * * Implement {@link DialogItemEditor} instead of {@link CollectionItemEditor} if you want provide dialog to edit. */ public TableModelEditor(@Nonnull List<T> items, @Nonnull ColumnInfo[] columns, @Nonnull CollectionItemEditor<T> itemEditor, @Nonnull String emptyText) { super(itemEditor); model = new MyListTableModel(columns, new ArrayList<>(items)); table = new TableView<>(model); table.setDefaultEditor(Enum.class, ComboBoxTableCellEditor.INSTANCE); table.setStriped(true); table.setEnableAntialiasing(true); preferredScrollableViewportHeightInRows(JBTable.PREFERRED_SCROLLABLE_VIEWPORT_HEIGHT_IN_ROWS); new TableSpeedSearch(table); ColumnInfo firstColumn = columns[0]; if ((firstColumn.getColumnClass() == boolean.class || firstColumn.getColumnClass() == Boolean.class) && firstColumn.getName().isEmpty()) { TableUtil.setupCheckboxColumn(table.getColumnModel().getColumn(0)); } boolean needTableHeader = false; for (ColumnInfo column : columns) { if (!StringUtil.isEmpty(column.getName())) { needTableHeader = true; break; } } if (!needTableHeader) { table.setTableHeader(null); } table.getEmptyText().setText(emptyText); MyRemoveAction removeAction = new MyRemoveAction(); toolbarDecorator = ToolbarDecorator.createDecorator(table, this).setRemoveAction(removeAction).setRemoveActionUpdater(removeAction); if (itemEditor instanceof DialogItemEditor) { addDialogActions(); } }
Example #10
Source File: WorkspaceMappingsTableEditor.java From azure-devops-intellij with MIT License | 5 votes |
public void setMappings(final List<Workspace.Mapping> mappings) { if (mappings != null) { final List<Row> rows = new ArrayList<Row>(mappings.size()); for (final Workspace.Mapping mapping : mappings) { rows.add(new Row(mapping.getServerPath(), mapping.getLocalPath(), mapping.isCloaked() ? MappingType.CLOAKED : MappingType.MAPPED)); } setModel(new ColumnInfo[]{new MappingTypeColumn(), new ServerPathColumn(project, serverContext), new LocalPathColumn(project)}, rows); } }
Example #11
Source File: ColumnDefinitions.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 5 votes |
static ColumnInfo[] getProfileQueryPlanColumns() { return new ColumnInfo[]{ OPERATOR_COL, ARGUMENTS_COL, ROWS_COL, DB_HITS_COL, ESTIMATED_ROWS_COL, IDENTIFIERS_COL }; }
Example #12
Source File: ColumnDefinitions.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 5 votes |
static ColumnInfo[] getQueryPlanColumns() { return new ColumnInfo[]{ OPERATOR_COL, ARGUMENTS_COL, ESTIMATED_ROWS_COL, IDENTIFIERS_COL }; }
Example #13
Source File: ParameterTableModelBase.java From consulo with Apache License 2.0 | 5 votes |
public ParameterTableModelBase(PsiElement typeContext, PsiElement defaultValueContext, ColumnInfo... columnInfos) { super(columnInfos); myTypeContext = typeContext; myDefaultValueContext = defaultValueContext; }
Example #14
Source File: SearchSelectPanel.java From p4ic4idea with Apache License 2.0 | 5 votes |
private void filterTable(String text) { final List<SelectedItem<T>> visibleItems; if (text == null || text.isEmpty()) { synchronized (itemSync) { visibleItems = new ArrayList<>(items); } } else { List<SelectedItem<T>> rootItems; synchronized (itemSync) { rootItems = new ArrayList<>(items); } visibleItems = new ArrayList<>(rootItems.size()); for (SelectedItem<T> item : rootItems) { if (item.selected) { visibleItems.add(item); continue; } for (ColumnInfo<T, String> searchableColumn : searchableColumns) { String value = searchableColumn.valueOf(item.value); if (value == null || value.isEmpty()) { // Skip blank values when a filter is on. continue; } String lc = value.toLowerCase(); if (lc.contains(text)) { visibleItems.add(item); break; } } } } SwingUtilities.invokeLater(() -> tableModel.setItems(visibleItems)); }
Example #15
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 #16
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 #17
Source File: CompareWithSelectedRevisionAction.java From consulo with Apache License 2.0 | 5 votes |
private static void showTreePopup(final List<TreeItem<VcsFileRevision>> roots, final VirtualFile file, final Project project, final DiffProvider diffProvider) { final TreeTableView treeTable = new TreeTableView(new ListTreeTableModelOnColumns(new TreeNodeAdapter(null, null, roots), new ColumnInfo[]{BRANCH_COLUMN, REVISION_COLUMN, DATE_COLUMN, AUTHOR_COLUMN})); Runnable runnable = new Runnable() { public void run() { int index = treeTable.getSelectionModel().getMinSelectionIndex(); if (index == -1) { return; } VcsFileRevision revision = getRevisionAt(treeTable, index); if (revision != null) { DiffActionExecutor.showDiff(diffProvider, revision.getRevisionNumber(), file, project, VcsBackgroundableActions.COMPARE_WITH); } } }; treeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); new PopupChooserBuilder(treeTable). setTitle(VcsBundle.message("lookup.title.vcs.file.revisions")). setItemChoosenCallback(runnable). setSouthComponent(createCommentsPanel(treeTable)). setResizable(true). setDimensionServiceKey("Vcs.CompareWithSelectedRevision.Popup"). createPopup(). showCenteredInCurrentWindow(project); }
Example #18
Source File: InstalledPluginsTableModel.java From consulo with Apache License 2.0 | 5 votes |
public InstalledPluginsTableModel() { super.columns = new ColumnInfo[]{new MyPluginManagerColumnInfo(), new EnabledPluginInfo()}; view = new ArrayList<>(consulo.container.plugin.PluginManager.getPlugins()); view.addAll(InstalledPluginsState.getInstance().getAllPlugins()); reset(view); for (Iterator<PluginDescriptor> iterator = view.iterator(); iterator.hasNext(); ) { @NonNls final PluginId pluginId = iterator.next().getPluginId(); if (PluginManagerCore.isSystemPlugin(pluginId)) { iterator.remove(); } } setSortKey(new RowSorter.SortKey(getNameColumn(), SortOrder.ASCENDING)); }
Example #19
Source File: ListTreeTableModelOnColumns.java From consulo with Apache License 2.0 | 5 votes |
/** * @param columns * @return true if changed */ public boolean setColumns(ColumnInfo[] columns) { if (myColumns != null && Arrays.equals(myColumns, columns)) { return false; } myColumns = columns; return true; }
Example #20
Source File: TableView.java From consulo with Apache License 2.0 | 5 votes |
public TableCellRenderer getCellRenderer(int row, int column) { final ColumnInfo<Item, ?> columnInfo = getListTableModel().getColumnInfos()[convertColumnIndexToModel(column)]; final Item item = getListTableModel().getItems().get(convertRowIndexToModel(row)); final TableCellRenderer renderer = columnInfo.getCustomizedRenderer(item, columnInfo.getRenderer(item)); if (renderer == null) { return super.getCellRenderer(row, column); } else { return renderer; } }
Example #21
Source File: TableModelEditor.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public List<T> apply() { if (helper.hasModifiedItems()) { @SuppressWarnings("unchecked") final ColumnInfo<T, Object>[] columns = model.getColumnInfos(); helper.process(new TObjectObjectProcedure<T, T>() { @Override public boolean execute(T newItem, @Nonnull T oldItem) { for (ColumnInfo<T, Object> column : columns) { if (column.isCellEditable(newItem)) { column.setValue(oldItem, column.valueOf(newItem)); } } if (itemEditor instanceof DialogItemEditor) { ((DialogItemEditor<T>)itemEditor).applyEdited(oldItem, newItem); } model.items.set(ContainerUtil.indexOfIdentity(model.items, newItem), oldItem); return true; } }); } helper.reset(model.items); return model.items; }
Example #22
Source File: CommittedChangesTableModel.java From consulo with Apache License 2.0 | 5 votes |
private static ColumnInfo[] buildColumnInfos(final ChangeListColumn[] columns) { ColumnInfo[] result = new ColumnInfo[columns.length]; for(int i=0; i<columns.length; i++) { result [i] = new ColumnInfoAdapter(columns [i]); } return result; }
Example #23
Source File: SimpleParameterTablePanel.java From consulo with Apache License 2.0 | 4 votes |
public SimpleParameterTablePanel(Project project, Language language, ColumnInfo... columnInfos) { super(new PassParameterColumnInfo(), new NameColumnInfo(language, project)); }
Example #24
Source File: FileHistoryColumnWrapper.java From consulo with Apache License 2.0 | 4 votes |
public FileHistoryColumnWrapper(@Nonnull ColumnInfo<VcsFileRevision, T> additionalColumn) { super(additionalColumn.getName()); myBaseColumn = additionalColumn; }
Example #25
Source File: TableModelEditor.java From consulo with Apache License 2.0 | 4 votes |
public MyListTableModel(@Nonnull ColumnInfo[] columns, @Nonnull List<T> items) { super(columns, items); this.items = items; }
Example #26
Source File: AbstractParameterTablePanel.java From consulo with Apache License 2.0 | 4 votes |
public MyTableModel(@Nonnull ColumnInfo... columnInfos) { super(columnInfos); }
Example #27
Source File: AbstractParameterTablePanel.java From consulo with Apache License 2.0 | 4 votes |
public AbstractParameterTablePanel(P[] parameterData, ColumnInfo... columnInfos) { this(columnInfos); init(parameterData); }
Example #28
Source File: PluginTableModel.java From consulo with Apache License 2.0 | 4 votes |
public PluginTableModel(ColumnInfo... columns) { this.columns = columns; }
Example #29
Source File: PluginTableModel.java From consulo with Apache License 2.0 | 4 votes |
@Override public ColumnInfo[] getColumnInfos() { return columns; }
Example #30
Source File: CheckboxTreeTable.java From consulo with Apache License 2.0 | 4 votes |
public CheckboxTreeTable(CheckedTreeNode root, CheckboxTree.CheckboxTreeCellRenderer renderer, final ColumnInfo[] columns) { super(new ListTreeTableModelOnColumns(root, columns)); initTree(getTree(), renderer); }