MCPcopy Index your code
hub / github.com/benfry/processing4 / ListPanel

Method ListPanel

app/src/processing/app/contrib/ListPanel.java:91–193  ·  view source on GitHub ↗
(final ContributionTab contributionTab,
                   final Contribution.Filter filter,
                   final boolean enableSections,
                   final ContributionColumn... columns)

Source from the content-addressed store, hash-verified

89
90
91 public ListPanel(final ContributionTab contributionTab,
92 final Contribution.Filter filter,
93 final boolean enableSections,
94 final ContributionColumn... columns) {
95 this.contributionTab = contributionTab;
96 this.filter = filter;
97
98 model = new ContributionTableModel(columns); /* {
99 @Override
100 public void fireTableDataChanged() {
101 new Exception().printStackTrace(System.out);
102 super.fireTableDataChanged();
103 }
104 };*/
105 model.enableSections(enableSections);
106 table = new JTable(model) {
107 @Override
108 public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
109 Component c = super.prepareRenderer(renderer, row, column);
110 Object rowValue = getValueAt(row, column);
111 if (rowValue instanceof SectionHeaderContribution) {
112 c.setBackground(sectionColor);
113 } else if (isRowSelected(row)) {
114 if (((Contribution) rowValue).isCompatible()) {
115 c.setBackground(selectionColor);
116 } else {
117 c.setBackground(selectionColorIncompatible);
118 }
119 } else {
120 c.setBackground(rowColor);
121 }
122 return c;
123 }
124
125 @Override
126 public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
127 // disallow selection of the header lines
128 if (!(getValueAt(rowIndex, columnIndex) instanceof SectionHeaderContribution)) {
129 super.changeSelection(rowIndex, columnIndex, toggle, extend);
130 }
131 }
132 };
133
134 scrollPane = new JScrollPane(table);
135 scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
136 scrollPane.getVerticalScrollBar().setUI(new PdeScrollBarUI("manager.scrollbar"));
137 scrollPane.setBorder(BorderFactory.createEmptyBorder());
138 table.setFillsViewportHeight(true);
139 table.setDefaultRenderer(Contribution.class, new ContribCellRenderer());
140 table.setRowHeight(Toolkit.zoom(28));
141 table.setRowMargin(Toolkit.zoom(6));
142
143 TableColumnModel tcm = table.getColumnModel();
144 tcm.setColumnMargin(0);
145 tcm.getColumn(0).setMaxWidth(ManagerFrame.STATUS_WIDTH);
146 tcm.getColumn(2).setMinWidth(ManagerFrame.AUTHOR_WIDTH);
147 tcm.getColumn(2).setMaxWidth(ManagerFrame.AUTHOR_WIDTH);
148

Callers

nothing calls this directly

Calls 10

zoomMethod · 0.95
setSelectedDetailMethod · 0.95
enableSectionsMethod · 0.80
getValueAtMethod · 0.80
filterHasFocusMethod · 0.80
getComparatorMethod · 0.80
getMethod · 0.65
getColumnCountMethod · 0.65
setVisibleMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected