mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
deal with section heads and other quirky ugliness
This commit is contained in:
@@ -33,17 +33,17 @@ import processing.app.Util;
|
||||
import processing.app.ui.Editor;
|
||||
|
||||
public enum ContributionType {
|
||||
LIBRARY, TOOL, MODE, EXAMPLES;
|
||||
LIBRARY, MODE, TOOL, EXAMPLES;
|
||||
|
||||
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case LIBRARY:
|
||||
return "library";
|
||||
case TOOL:
|
||||
return "tool";
|
||||
case MODE:
|
||||
return "mode";
|
||||
case TOOL:
|
||||
return "tool";
|
||||
case EXAMPLES:
|
||||
return "examples";
|
||||
}
|
||||
@@ -61,6 +61,21 @@ public enum ContributionType {
|
||||
}
|
||||
|
||||
|
||||
public String getPluralTitle() {
|
||||
switch (this) {
|
||||
case LIBRARY:
|
||||
return "Libraries";
|
||||
case MODE:
|
||||
return "Modes";
|
||||
case TOOL:
|
||||
return "Tools";
|
||||
case EXAMPLES:
|
||||
return "Examples";
|
||||
}
|
||||
return null; // should be unreachable
|
||||
}
|
||||
|
||||
|
||||
// public String getFolderName() {
|
||||
// return toString();
|
||||
// /*
|
||||
@@ -115,12 +130,12 @@ public enum ContributionType {
|
||||
if ("library".equalsIgnoreCase(s)) {
|
||||
return LIBRARY;
|
||||
}
|
||||
if ("tool".equalsIgnoreCase(s)) {
|
||||
return TOOL;
|
||||
}
|
||||
if ("mode".equalsIgnoreCase(s)) {
|
||||
return MODE;
|
||||
}
|
||||
if ("tool".equalsIgnoreCase(s)) {
|
||||
return TOOL;
|
||||
}
|
||||
if ("examples".equalsIgnoreCase(s)) {
|
||||
return EXAMPLES;
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ implements Scrollable, ContributionListing.ChangeListener {
|
||||
model.setColumnIdentifiers(colName);
|
||||
scrollPane = new JScrollPane(table);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
scrollPane.setBorder(BorderFactory.createEmptyBorder());
|
||||
table.setFillsViewportHeight(true);
|
||||
table.setDefaultRenderer(Contribution.class, new ContribStatusRenderer());
|
||||
table.setFont(plainFont);
|
||||
|
||||
@@ -25,6 +25,8 @@ public class UpdateContributionTab extends ContributionTab {
|
||||
}
|
||||
};
|
||||
contributionListPanel = new UpdateListPanel(this, filter);
|
||||
// contributionListPanel.setBorder(new EmptyBorder(8, 8, 8, 8));
|
||||
|
||||
statusPanel = new UpdateStatusPanel(this, 650);
|
||||
contribListing = ContributionListing.getInstance();
|
||||
contribListing.addListener(contributionListPanel);
|
||||
@@ -49,12 +51,12 @@ public class UpdateContributionTab extends ContributionTab {
|
||||
layout.setHorizontalGroup(layout
|
||||
.createParallelGroup(GroupLayout.Alignment.CENTER)
|
||||
.addComponent(loaderLabel)
|
||||
.addComponent(contributionListPanel).addComponent(errorPanel)
|
||||
.addComponent(contributionListPanel)
|
||||
.addComponent(errorPanel)
|
||||
.addComponent(statusPanel));
|
||||
|
||||
layout.setVerticalGroup(layout
|
||||
.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER)
|
||||
.addComponent(loaderLabel)
|
||||
.addComponent(contributionListPanel))
|
||||
|
||||
@@ -4,14 +4,15 @@ import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Font;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.ListSelectionModel;
|
||||
@@ -25,9 +26,16 @@ import processing.app.ui.Toolkit;
|
||||
|
||||
|
||||
public class UpdateListPanel extends ListPanel {
|
||||
static final String[] PLURAL_TYPES = {
|
||||
ContributionType.LIBRARY.getPluralTitle(),
|
||||
ContributionType.MODE.getPluralTitle(),
|
||||
ContributionType.TOOL.getPluralTitle(),
|
||||
ContributionType.EXAMPLES.getPluralTitle(),
|
||||
};
|
||||
Set<String> sectionNames = new HashSet<String>(Arrays.asList(PLURAL_TYPES));
|
||||
|
||||
public UpdateListPanel(ContributionTab contributionTab,
|
||||
Contribution.Filter filter) {
|
||||
Contribution.Filter filter) {
|
||||
this.contributionTab = contributionTab;
|
||||
this.filter = filter;
|
||||
|
||||
@@ -55,10 +63,14 @@ public class UpdateListPanel extends ListPanel {
|
||||
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
|
||||
Component c = super.prepareRenderer(renderer, row, column);
|
||||
String title = (String) getValueAt(row, 1);
|
||||
if (title.equals("<html><i>Library</i></html>") || title.equals("<html><i>Tools</i></html>")
|
||||
|| title.equals("<html><i>Modes</i></html>") || title.equals("<html><i>Examples</i></html>")) {
|
||||
((JComponent) c).setBorder(BorderFactory
|
||||
.createMatteBorder(row == 0 ? 0 : 2, 0, 2, 0, Color.BLACK));
|
||||
if (title.equals("Libraries") ||
|
||||
title.equals("Modes") ||
|
||||
title.equals("Tools") ||
|
||||
title.equals("Examples")) {
|
||||
c.setBackground(new Color(0xFFf0f0f0));
|
||||
//((JComponent) c).setBorder(BorderFactory.createMatteBorder(row == 0 ? 0 : 1, 0, 1, 0, Color.GRAY));
|
||||
} else {
|
||||
c.setBackground(Color.WHITE);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@@ -67,17 +79,19 @@ public class UpdateListPanel extends ListPanel {
|
||||
public void changeSelection(int rowIndex, int columnIndex,
|
||||
boolean toggle, boolean extend) {
|
||||
String title = (String) getValueAt(rowIndex, 1);
|
||||
if (title.equals("<html><i>Library</i></html>") ||
|
||||
title.equals("<html><i>Tools</i></html>") ||
|
||||
title.equals("<html><i>Modes</i></html>") ||
|
||||
title.equals("<html><i>Examples</i></html>")){
|
||||
return;
|
||||
// Disallow selection on the fake rows
|
||||
if (!title.equals("Libraries") &&
|
||||
!title.equals("Modes") &&
|
||||
!title.equals("Tools") &&
|
||||
!title.equals("Examples")) {
|
||||
super.changeSelection(rowIndex, columnIndex, toggle, extend);
|
||||
}
|
||||
super.changeSelection(rowIndex, columnIndex, toggle, extend);
|
||||
}
|
||||
};
|
||||
|
||||
scrollPane = new JScrollPane(table);
|
||||
scrollPane.setBorder(BorderFactory.createEmptyBorder());
|
||||
|
||||
table.setFillsViewportHeight(true);
|
||||
table.setSelectionBackground(new Color(0xe0fffd));
|
||||
table.setSelectionForeground(table.getForeground());
|
||||
@@ -147,28 +161,23 @@ public class UpdateListPanel extends ListPanel {
|
||||
|
||||
@Override
|
||||
void updatePanelOrdering(Set<Contribution> contributionsSet) {
|
||||
// JLabel label = contributionTab.contribDialog.numberLabel;
|
||||
// if (getNoOfRows() == 0) {
|
||||
// label.setVisible(false);
|
||||
// } else {
|
||||
// label.setVisible(true);
|
||||
// label.setText(Integer.toString(panelByContribution.size()));
|
||||
// }
|
||||
// int updateCount = panelByContribution.size();
|
||||
// new Exception("update count is " + updateCount).printStackTrace(System.out);
|
||||
// (UpdateContributionTab) contributionTab
|
||||
|
||||
model.getDataVector().removeAllElements();
|
||||
model.fireTableDataChanged();
|
||||
ContributionType temp = null;
|
||||
ContributionType currentType = null;
|
||||
|
||||
// Avoid ugly synthesized bold
|
||||
Font boldFont = Toolkit.getSansFont(table.getFont().getSize(), Font.BOLD);
|
||||
String fontFace = "<font face=\"" + boldFont.getName() + "\">";
|
||||
|
||||
for (Contribution entry : contributionsSet) {
|
||||
if (entry.getType() != temp) {
|
||||
temp = entry.getType();
|
||||
if (entry.getType() != currentType) {
|
||||
currentType = entry.getType();
|
||||
model.addRow(new Object[] {
|
||||
null,
|
||||
"<html><i>" + temp.getTitle() + "</i></html>",
|
||||
null, null, null
|
||||
null, currentType.getTitle(), null, null, null
|
||||
});
|
||||
}
|
||||
//TODO Make this into a function
|
||||
|
||||
@@ -80,6 +80,10 @@ X https://github.com/processing/processing/issues/3643
|
||||
o Contributions Manager UI design
|
||||
X https://github.com/processing/processing/issues/3482
|
||||
X closing in favor of separate issues
|
||||
X updates tab has ugly horizontal line at top
|
||||
X CM selected tabs are too tall
|
||||
X https://github.com/processing/processing/issues/3598
|
||||
X why the aqua background when opening the window?
|
||||
|
||||
watcher
|
||||
X prevent re-prompting users when they say "no" to "sketch modified" message
|
||||
@@ -131,10 +135,7 @@ _ mouse events (i.e. toggle breakpoint) seem to be firing twice
|
||||
|
||||
|
||||
beta 7
|
||||
X CM selected tabs are too tall
|
||||
X https://github.com/processing/processing/issues/3598
|
||||
X why the aqua background when opening the window?
|
||||
_ bring back the # of updates on each tab
|
||||
_ bring back the # of updates on the update tab
|
||||
_ use this instead of the 'icon' stuff
|
||||
_ show number of updates available in the footer
|
||||
_ https://github.com/processing/processing/issues/3518
|
||||
@@ -167,17 +168,20 @@ _ list with contrib types separated is really wonky
|
||||
_ do we keep the list?
|
||||
_ does it even work for different contrib types?
|
||||
|
||||
|
||||
manager / 3.0 final
|
||||
_ updates tab has ugly horizontal line at top
|
||||
_ status/name/author table header is alternating color
|
||||
_ area above scroll bar looks like more scroll bar
|
||||
_ table header is the wrong font
|
||||
_ updates panel has the gray across, but nothing above the scrollbar
|
||||
_ remove focus blue from the scrollable list
|
||||
_ scrolling "past" top/bottom causes the screen to jiggle (OS X and Trackpad)
|
||||
_ looks like ContributionListing.getScrollableUnitIncrement() returns early
|
||||
_ get rid of gross italic subheads on the Updates page
|
||||
|
||||
|
||||
gui / post 3.0
|
||||
_ build custom scroll bar since the OS versions are so ugly?
|
||||
_ build custom scroll bar since the OS versions are so ugly
|
||||
_ error/warning location is awkward when no scroll bar is in use
|
||||
_ when only one screen-full, show ticks at exact location
|
||||
_ simpler/less confusing to not show at all?
|
||||
|
||||
Reference in New Issue
Block a user