private void createPropertiesPanel() { myPropertiesPanel = new JPanel(new BorderLayout()); final JPanel emptyPanel = new JPanel(); emptyPanel.setMinimumSize(JBUI.emptySize()); emptyPanel.setPreferredSize(JBUI.emptySize()); myPropertiesPanelWrapper = new JPanel(new CardLayout()); myPropertiesPanel.setBorder(new CustomLineBorder(1, 0, 0, 0)); myPropertiesPanelWrapper.add(EMPTY_CARD, emptyPanel); myPropertiesPanelWrapper.add(PROPERTIES_CARD, myPropertiesPanel); }
public VcsLogGraphTable( @NotNull VcsLogUiImpl UI, @NotNull final VcsLogDataHolder logDataHolder, @NotNull VisiblePack initialDataPack) { super(); myUI = UI; myLogDataHolder = logDataHolder; myGraphCommitCellRenderer = new GraphCommitCellRender(logDataHolder, myGraphCellPainter, this); setDefaultRenderer(VirtualFile.class, new RootCellRenderer(myUI)); setDefaultRenderer(GraphCommitCell.class, myGraphCommitCellRenderer); setDefaultRenderer(String.class, new StringCellRenderer()); setShowHorizontalLines(false); setIntercellSpacing(JBUI.emptySize()); MouseAdapter mouseAdapter = new MyMouseAdapter(); addMouseMotionListener(mouseAdapter); addMouseListener(mouseAdapter); MyHeaderMouseAdapter headerAdapter = new MyHeaderMouseAdapter(); getTableHeader().addMouseListener(headerAdapter); getTableHeader().addMouseMotionListener(headerAdapter); getTableHeader().setReorderingAllowed(false); PopupHandler.installPopupHandler( this, VcsLogActionPlaces.POPUP_ACTION_GROUP, VcsLogActionPlaces.VCS_LOG_TABLE_PLACE); ScrollingUtil.installActions(this, false); GraphTableModel model = new GraphTableModel(initialDataPack, myLogDataHolder, myUI); setModel(model); initColumnSize(); }
public ProcessedModulesTable(final Project project) { super(new BorderLayout()); myTableModel = new MyTableModel(project); myTable = new JBTable(myTableModel); myTable.getEmptyText().setText("No modules configured"); // myTable.setShowGrid(false); myTable.setIntercellSpacing(JBUI.emptySize()); myTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); myTable.setColumnSelectionAllowed(false); final TableColumnModel columnModel = myTable.getColumnModel(); final TableColumn dirNameColumn = columnModel.getColumn(myTableModel.DIRNAME_COLUMN_INDEX); final String title = "Generated Sources Directory Name"; dirNameColumn.setHeaderValue(title); final JTableHeader tableHeader = myTable.getTableHeader(); final FontMetrics metrics = tableHeader.getFontMetrics(tableHeader.getFont()); final int preferredWidth = metrics.stringWidth(title) + 12; dirNameColumn.setPreferredWidth(preferredWidth); dirNameColumn.setMaxWidth(preferredWidth + 20); dirNameColumn.setCellRenderer(new MyElementColumnCellRenderer()); final TableColumn moduleColumn = columnModel.getColumn(myTableModel.ELEMENT_COLUMN_INDEX); moduleColumn.setHeaderValue("Module"); moduleColumn.setCellRenderer(new MyElementColumnCellRenderer()); final JPanel panel = ToolbarDecorator.createDecorator(myTable) .disableUpDownActions() .setPreferredSize(JBUI.size(100, 155)) .createPanel(); add(panel, BorderLayout.CENTER); final SpeedSearchBase<JBTable> speedSearch = new SpeedSearchBase<JBTable>(myTable) { public int getSelectedIndex() { return myTable.getSelectedRow(); } @Override protected int convertIndexToModel(int viewIndex) { return myTable.convertRowIndexToModel(viewIndex); } public Object[] getAllElements() { final int count = myTableModel.getRowCount(); Object[] elements = new Object[count]; for (int idx = 0; idx < count; idx++) { elements[idx] = myTableModel.getModuleAt(idx); } return elements; } public String getElementText(Object element) { return ((Module) element).getName() + " (" + FileUtil.toSystemDependentName(((Module) element).getModuleFilePath()) + ")"; } public void selectElement(Object element, String selectedText) { final int count = myTableModel.getRowCount(); for (int row = 0; row < count; row++) { if (element.equals(myTableModel.getModuleAt(row))) { final int viewRow = myTable.convertRowIndexToView(row); myTable.getSelectionModel().setSelectionInterval(viewRow, viewRow); TableUtil.scrollSelectionToVisible(myTable); break; } } } }; speedSearch.setComparator(new SpeedSearchComparator(false)); }