From e83d60ec6b346a888f0142a43de2dd4f3e078d82 Mon Sep 17 00:00:00 2001 From: Akarshit Wal Date: Tue, 14 Jul 2015 22:14:14 +0530 Subject: [PATCH] Alpha --- .../app/contrib/ContributionListPanel.java | 9 +- .../contrib/ContributionManagerDialog.java | 67 ++- .../app/contrib/ContributionTab.java | 420 ++---------------- .../processing/app/contrib/StatusPanel.java | 17 +- .../contrib/UpdateContribListingPanel.java | 44 +- .../app/contrib/UpdateStatusPanel.java | 8 +- build/shared/lib/icons/loader.gif | Bin 0 -> 8787 bytes 7 files changed, 173 insertions(+), 392 deletions(-) create mode 100644 build/shared/lib/icons/loader.gif diff --git a/app/src/processing/app/contrib/ContributionListPanel.java b/app/src/processing/app/contrib/ContributionListPanel.java index 1d7303364..42786fdfc 100644 --- a/app/src/processing/app/contrib/ContributionListPanel.java +++ b/app/src/processing/app/contrib/ContributionListPanel.java @@ -55,7 +55,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib // private StatusPanel status; protected ContributionFilter filter; // private ContributionListing contribListing; - private ContributionListing contribListing = ContributionListing.getInstance(); + protected ContributionListing contribListing = ContributionListing.getInstance(); protected JTable table; DefaultTableModel dtm; @@ -107,6 +107,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib dtm.setColumnIdentifiers(colName); JScrollPane scrollPane = new JScrollPane(table); table.setFillsViewportHeight(true); +// table.setBorder(); table.setDefaultRenderer(Contribution.class, new StatusRendere()); table.setRowHeight(30); table.setRowMargin(6); @@ -251,12 +252,12 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib Icon icon = null; label.setBorder(BorderFactory.createEmptyBorder(0, 17, 0, 0)); if (contribution.isInstalled()) { - icon = UIManager.getIcon("OptionPane.warningIcon"); + icon = Toolkit.getLibIcon("icons/installedAndUptodate.png"); if (contribListing.hasUpdates(contribution)) { - icon = Toolkit.getLibIcon("icons/pde-16.png"); + icon = Toolkit.getLibIcon("icons/installedNeedsUpdate.png"); } if (!contribution.isCompatible(Base.getRevision())) { - icon = Toolkit.getLibIcon("icons/pde-16.png"); + icon = Toolkit.getLibIcon("icons/installedIncompatible.png"); } } label.setIcon(icon); diff --git a/app/src/processing/app/contrib/ContributionManagerDialog.java b/app/src/processing/app/contrib/ContributionManagerDialog.java index a39d505bb..ac5b17593 100644 --- a/app/src/processing/app/contrib/ContributionManagerDialog.java +++ b/app/src/processing/app/contrib/ContributionManagerDialog.java @@ -119,7 +119,7 @@ public class ContributionManagerDialog { public void makeFrame(final Editor editor) { dialog = new JFrame(title); - + String[] tabTitles = { "Tools","Libraries","Modes","Examples","Updates"}; tabbedPane = new JTabbedPane(); makeAndShowTab(false, true); @@ -141,19 +141,43 @@ public class ContributionManagerDialog { tabbedPane.addTab("Updates", null, updatesContributionTab.panel, "Updates"); tabbedPane.setMnemonicAt(3, KeyEvent.VK_5); tabbedPane.setUI(new SpacedTabbedPaneUI()); + tabbedPane.setBackground(Color.WHITE); + tabbedPane.setOpaque(true); + tabbedPane.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2)); JPanel updateTabPanel = new JPanel(true); - numberLabel.setOpaque(true); - numberLabel.setBackground(Color.BLUE); + numberLabel.setOpaque(false); + numberLabel.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0)); + JLabel numberBackground = new JLabel(Toolkit.getLibIcon("icons/notification.png")); JLabel updateTabLabel = new JLabel("Update"); + updateTabPanel.setOpaque(false); + updateTabPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory + .createMatteBorder(0, 2, 0, 0, Color.BLACK), BorderFactory + .createEmptyBorder(4, 4, 4, 4))); + tabbedPane.setTabComponentAt(4, updateTabPanel); + + JLabel tabLabels[] = new JLabel[4]; + for(int i = 0 ; i < tabLabels.length;i++){ + tabLabels[i] = new JLabel(tabTitles[i]); + tabLabels[i] + .setBorder(BorderFactory.createCompoundBorder(BorderFactory + .createMatteBorder(0, (i == 0 ? 0 : 2), 0, (i == 3 ? 2 : 0), + Color.BLACK), BorderFactory + .createEmptyBorder(4, 4, 4, 4))); + tabbedPane.setTabComponentAt(i, tabLabels[i]); + } GroupLayout tabLayout = new GroupLayout(updateTabPanel); tabLayout.setAutoCreateGaps(true); updateTabPanel.setLayout(tabLayout); - tabLayout.setHorizontalGroup(tabLayout.createSequentialGroup().addComponent(numberLabel).addComponent(updateTabLabel)); - tabLayout.setVerticalGroup(tabLayout.createParallelGroup().addComponent(numberLabel).addComponent(updateTabLabel)); - tabbedPane.setTabComponentAt(4, updateTabPanel); + tabLayout.setHorizontalGroup(tabLayout + .createSequentialGroup() + .addGroup(tabLayout.createParallelGroup().addComponent(numberLabel) + .addComponent(numberBackground)).addComponent(updateTabLabel)); + tabLayout.setVerticalGroup(tabLayout.createParallelGroup(GroupLayout.Alignment.CENTER) + .addComponent(numberBackground).addComponent(numberLabel) + .addComponent(updateTabLabel)); tabbedPane.addChangeListener(new ChangeListener() { @@ -227,18 +251,40 @@ public class ContributionManagerDialog { public class SpacedTabbedPaneUI extends BasicTabbedPaneUI { + + @Override + protected void installDefaults() { + UIManager.put("TabbedPane.selected", Color.WHITE); + super.installDefaults(); + highlight = Color.WHITE; + lightHighlight = Color.WHITE; + shadow = Color.WHITE; + darkShadow = Color.WHITE; + focus = Color.LIGHT_GRAY; + tabInsets = new Insets(0, 0, 0, 0); + contentBorderInsets = new Insets(0, 0, 0, 0); + tabAreaInsets = new Insets(0, 0, 0, 0); + selectedTabPadInsets = new Insets(0, 0, 0, 0); + } + @Override protected LayoutManager createLayoutManager() { return new BasicTabbedPaneUI.TabbedPaneLayout() { + + @Override + public void addLayoutComponent(String name, Component comp) { + // TODO Auto-generated method stub + super.addLayoutComponent(name, comp); + } @Override protected void calculateTabRects(int tabPlacement, int tabCount) { super.calculateTabRects(tabPlacement, tabCount); for (int i = 0; i < rects.length; i++) { + rects[i].y -= 10; + rects[i].height += 15; if (i == 4) { - rects[i].x = tabbedPane.getWidth() - rects[i].width; + rects[i].x = tabbedPane.getWidth() - rects[i].width - 2; } - rects[i].y -= 5; - rects[i].height += 5; } } }; @@ -249,14 +295,15 @@ public class ContributionManagerDialog { GroupLayout layout = new GroupLayout(dialog.getContentPane()); dialog.getContentPane().setLayout(layout); dialog.setResizable(true); + layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createParallelGroup() .addComponent(tabbedPane)); layout.setVerticalGroup(layout .createParallelGroup() .addComponent(tabbedPane)); layout.setHonorsVisibility(tabbedPane, true); + dialog.getContentPane().setBackground(Color.WHITE); dialog.validate(); - dialog.pack(); dialog.repaint(); } diff --git a/app/src/processing/app/contrib/ContributionTab.java b/app/src/processing/app/contrib/ContributionTab.java index 7413b1675..a4a86a5e9 100644 --- a/app/src/processing/app/contrib/ContributionTab.java +++ b/app/src/processing/app/contrib/ContributionTab.java @@ -54,6 +54,7 @@ public class ContributionTab { ContributionListPanel contributionListPanel; StatusPanel statusPanel; FilterField filterField; + JLabel filterLabel; JButton restartButton; JLabel categoryLabel; JLabel loaderLabel; @@ -96,9 +97,9 @@ public class ContributionTab { contribListing = ContributionListing.getInstance(); if (contributionType == null) { contributionListPanel = new UpdateContribListingPanel(this, filter); - statusPanel = new UpdateStatusPanel(450, this); + statusPanel = new UpdateStatusPanel(650, this); } else { - statusPanel = new StatusPanel(450,this); + statusPanel = new StatusPanel(650,this); contributionListPanel = new ContributionListPanel(this, filter); } contribListing.addContributionListener(contributionListPanel); @@ -149,6 +150,8 @@ public class ContributionTab { loaderLabel = new JLabel(Toolkit.getLibIcon("icons/loader.gif")); loaderLabel.setOpaque(false); loaderLabel.setBackground(Color.WHITE); + filterLabel = new JLabel("Filter"); + filterLabel.setOpaque(false); } /*restartButton = new JButton(Language.text("contrib.restart")); @@ -201,24 +204,29 @@ public class ContributionTab { GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); - layout.setAutoCreateContainerGaps(true); - layout.setAutoCreateGaps(true); +// layout.setAutoCreateContainerGaps(true); +// layout.setAutoCreateGaps(true); layout.setHorizontalGroup(layout .createParallelGroup(GroupLayout.Alignment.CENTER) - .addGroup(layout.createSequentialGroup() + .addGroup(layout + .createSequentialGroup() + .addContainerGap() + .addComponent(filterLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(filterField) - .addComponent(categoryChooser, GroupLayout.PREFERRED_SIZE, - GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addComponent(loaderLabel).addComponent(contributionListPanel) - .addComponent(errorPanel).addComponent(statusPanel)); - + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(categoryChooser, + categoryChooser.getPreferredSize().width + 20, + categoryChooser.getPreferredSize().width + 20, + categoryChooser.getPreferredSize().width + 20) + .addContainerGap()).addComponent(loaderLabel) + .addComponent(contributionListPanel).addComponent(errorPanel) + .addComponent(statusPanel)); + layout.setVerticalGroup(layout .createSequentialGroup() - .addGroup(layout - .createParallelGroup(GroupLayout.Alignment.CENTER) - .addComponent(categoryChooser, GroupLayout.PREFERRED_SIZE, - GroupLayout.DEFAULT_SIZE, - GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) + .addComponent(filterLabel).addComponent(categoryChooser) .addComponent(filterField)) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(loaderLabel) @@ -228,6 +236,9 @@ public class ContributionTab { GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); layout.linkSize(SwingConstants.VERTICAL, categoryChooser, filterField); layout.setHonorsVisibility(contributionListPanel, false); + + panel.setBackground(Color.WHITE); + panel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2)); } @@ -279,7 +290,7 @@ public class ContributionTab { closeButton = new JButton("X"); - closeButton.setOpaque(false); + closeButton.setContentAreaFilled(false); closeButton.addActionListener(new ActionListener() { @Override @@ -288,6 +299,8 @@ public class ContributionTab { } }); tryAgainButton = new JButton("Try Again"); + tryAgainButton.setContentAreaFilled(false); + tryAgainButton.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK, 1),BorderFactory.createEmptyBorder(3, 0, 3, 0))); tryAgainButton.addActionListener(new ActionListener() { @Override @@ -300,8 +313,12 @@ public class ContributionTab { .createSequentialGroup() .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) - .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) - .addComponent(errorMessage).addComponent(tryAgainButton)) + .addGroup(layout + .createParallelGroup(GroupLayout.Alignment.CENTER) + .addComponent(errorMessage) + .addComponent(tryAgainButton, statusPanel.BUTTON_WIDTH, + statusPanel.BUTTON_WIDTH, + statusPanel.BUTTON_WIDTH)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(closeButton)); @@ -309,7 +326,8 @@ public class ContributionTab { .createSequentialGroup() .addGroup(layout.createParallelGroup().addComponent(errorMessage) .addComponent(closeButton)).addComponent(tryAgainButton)); - errorPanel.setBackground(Color.BLUE); + errorPanel.setBackground(Color.PINK); + errorPanel.validate(); } @@ -388,68 +406,36 @@ public class ContributionTab { } - - - protected void setFilterText(String filter) { - if (filter == null || filter.isEmpty()) { - filterField.setText(""); - filterField.showingHint = true; - } else { - filterField.setText(filter); - filterField.showingHint = false; - } - filterField.applyFilter(); - } - - // private JPanel getPlaceholder() { // return contributionListPanel.statusPlaceholder; // } //TODO: this is causing a lot of bugs as the hint is wrongly firing applyFilter() - class FilterField extends JPanel { - JTextField searchField; - JButton searchButton; - String filterHint; - boolean showingHint; + class FilterField extends JTextField { + Icon searchIcon; List filters; public FilterField () { - searchField = new JTextField(Language.text("contrib.filter_your_search")); - filterHint = Language.text("contrib.filter_your_search"); - searchButton = new JButton("S"); + super(""); + searchIcon = Toolkit.getLibIcon("icons/searchIcon.png"); + setOpaque(false); - ComponentBorder cb = new ComponentBorder(searchButton,"LEFT"); - cb.install( searchField); - GroupLayout layout = new GroupLayout(this); - setLayout(layout); - - layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(searchField)); - layout.setVerticalGroup(layout.createParallelGroup().addComponent(searchField)); - - showingHint = true; filters = new ArrayList(); - updateStyle(); addFocusListener(new FocusListener() { public void focusLost(FocusEvent focusEvent) { - if (filterField.getText().isEmpty()) { - showingHint = true; + if (getText().isEmpty()) { + setBorder(BorderFactory.createMatteBorder(0, 33, 0, 0, searchIcon)); } - updateStyle(); } public void focusGained(FocusEvent focusEvent) { - if (showingHint) { - showingHint = false; - filterField.setText(""); - } - updateStyle(); + setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0)); } }); - searchField.getDocument().addDocumentListener(new DocumentListener() { + getDocument().addDocumentListener(new DocumentListener() { public void removeUpdate(DocumentEvent e) { applyFilter(); } @@ -465,7 +451,7 @@ public class ContributionTab { } public void applyFilter() { - String filter = filterField.getFilterText(); + String filter = getText(); filter = filter.toLowerCase(); // Replace anything but 0-9, a-z, or : with a space @@ -476,29 +462,6 @@ public class ContributionTab { contributionListPanel.updateColors(); } - public String getFilterText() { - return showingHint ? "" : getText(); - } - - public String getText() { - return searchField.getText(); - } - - public void setText(String text) { - searchField.setText(text); - } - - public void updateStyle() { - if (showingHint) { - setText(filterHint); - // setForeground(UIManager.getColor("TextField.light")); // too light - setForeground(Color.gray); - setFont(getFont().deriveFont(Font.ITALIC)); - } else { - setForeground(UIManager.getColor("TextField.foreground")); - setFont(getFont().deriveFont(Font.PLAIN)); - } - } } @@ -509,293 +472,4 @@ public class ContributionTab { public void updateStatusPanel(ContributionPanel contributionPanel) { statusPanel.update(contributionPanel); } - /** - * The ComponentBorder class allows you to place a real component in - * the space reserved for painting the Border of a component. - * - * This class takes advantage of the knowledge that all Swing components are - * also Containers. By default the layout manager is null, so we should be - * able to place a child component anywhere in the parent component. In order - * to prevent the child component from painting over top of the parent - * component a Border is added to the parent componet such that the insets of - * the Border will reserve space for the child component to be painted without - * affecting the parent component. - */ - public class ComponentBorder implements Border - { - static final String TOP = "TOP"; - static final String LEFT = "LEFT"; - static final String BOTTOM = "BOTTOM"; - static final String RIGHT = "RIGHT"; - - public static final float LEADING = 0.0f; - public static final float CENTER = 0.5f; - public static final float TRAILING = 1.0f; - - private JComponent parent; - private JComponent component; - private String edge; - private float alignment; - private int gap = 5; - private boolean adjustInsets = true; - private Insets borderInsets = new Insets(0, 0, 0, 0); - - /** - * Convenience constructor that uses the default edge (Edge.RIGHT) and - * alignment (CENTER). - * - * @param component the component to be added in the Border area - */ - public ComponentBorder(JComponent component) - { - this(component, RIGHT); - } - - /** - * Convenience constructor that uses the default alignment (CENTER). - * - * @param component the component to be added in the Border area - * @param edge a valid Edge enum of TOP, LEFT, BOTTOM, RIGHT - */ - public ComponentBorder(JComponent component, String edge) - { - this(component, edge, CENTER); - } - - /** - * Main constructor to create a ComponentBorder. - * - * @param component the component to be added in the Border area - * @param edge a valid Edge enum of TOP, LEFT, BOTTOM, RIGHT - * @param alignment the alignment of the component along the - * specified Edge. Must be in the range 0 - 1.0. - */ - public ComponentBorder(JComponent component, String edge, float alignment ) - { - this.component = component; - component.setSize( component.getPreferredSize() ); - component.setCursor(Cursor.getDefaultCursor()); - setEdge( edge ); - setAlignment( alignment ); - } - - public boolean isAdjustInsets() - { - return adjustInsets; - } - - public void setAdjustInsets(boolean adjustInsets) - { - this.adjustInsets = adjustInsets; - } - - /** - * Get the component alignment along the Border Edge - * - * @return the alignment - */ - public float getAlignment() - { - return alignment; - } - - /** - * Set the component alignment along the Border Edge - * - * @param alignment a value in the range 0 - 1.0. Standard values would be - * CENTER (default), LEFT and RIGHT. - */ - public void setAlignment(float alignment) - { - this.alignment = alignment > 1.0f ? 1.0f : alignment < 0.0f ? 0.0f : alignment; - } - - /** - * Get the Edge the component is positioned along - * - * @return the Edge - */ - public String getEdge() - { - return edge; - } - - /** - * Set the Edge the component is positioned along - * - * @param edge the Edge the component is position on. - */ - public void setEdge(String edge) - { - this.edge = edge; - } - - /** - * Get the gap between the border component and the parent component - * - * @return the gap in pixels. - */ - public int getGap() - { - return gap; - } - - /** - * Set the gap between the border component and the parent component - * - * @param gap the gap in pixels (default is 5) - */ - public void setGap(int gap) - { - this.gap = gap; - } - - // -// Implement the Border interface - // - - public Insets getBorderInsets(Component c) - { - return borderInsets; - } - - public boolean isBorderOpaque() - { - return false; - } - - /** - * In this case a real component is to be painted. Setting the location - * of the component will cause it to be painted at that location. - */ - public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) - { - float x2 = (width - component.getWidth()) * component.getAlignmentX() + x; - float y2 = (height - component.getHeight()) * component.getAlignmentY() + y; - component.setLocation((int)x2, (int)y2); - } - - /* - * Install this Border on the specified component by replacing the - * existing Border with a CompoundBorder containing the original Border - * and our ComponentBorder - * - * This method should only be invoked once all the properties of this - * class have been set. Installing the Border more than once will cause - * unpredictable results. - */ - public void install(JComponent parent) - { - this.parent = parent; - - determineInsetsAndAlignment(); - - // Add this Border to the parent - - Border current = parent.getBorder(); - - if (current == null) - { - parent.setBorder(this); - } - else - { - CompoundBorder compound = new CompoundBorder(current, this); - parent.setBorder(compound); - } - - // Add component to the parent - - parent.add(component); - } - - /** - * The insets need to be determined so they are included in the preferred - * size of the component the Border is attached to. - * - * The alignment of the component is determined here so it doesn't need - * to be recalculated every time the Border is painted. - */ - private void determineInsetsAndAlignment() - { - borderInsets = new Insets(0, 0, 0, 0); - - // The insets will only be updated for the edge the component will be - // diplayed on. - // - // The X, Y alignment of the component is controlled by both the edge - // and alignment parameters - - if (edge.equals("TOP")) - { - borderInsets.top = component.getPreferredSize().height + gap; - component.setAlignmentX(alignment); - component.setAlignmentY(0.0f); - } - else if (edge.equals("BOTTOM")) - { - borderInsets.bottom = component.getPreferredSize().height + gap; - component.setAlignmentX(alignment); - component.setAlignmentY(1.0f); - } - else if (edge.equals("LEFT")) - { - borderInsets.left = component.getPreferredSize().width + gap; - component.setAlignmentX(0.0f); - component.setAlignmentY(alignment); - } - else if (edge.equals("RIGHT")) - { - borderInsets.right = component.getPreferredSize().width + gap; - component.setAlignmentX(1.0f); - component.setAlignmentY(alignment); - } - - if (adjustInsets) - adjustBorderInsets(); - } - - /* - * The complimentary edges of the Border may need to be adjusted to allow - * the component to fit completely in the bounds of the parent component. - */ - private void adjustBorderInsets() - { - Insets parentInsets = parent.getInsets(); - - // May need to adust the height of the parent component to fit - // the component in the Border - - if (edge.equals("RIGHT") || edge.equals("LEFT")) - { - int parentHeight = parent.getPreferredSize().height - parentInsets.top - parentInsets.bottom; - int diff = component.getHeight() - parentHeight; - - if (diff > 0) - { - int topDiff = (int)(diff * alignment); - int bottomDiff = diff - topDiff; - borderInsets.top += topDiff; - borderInsets.bottom += bottomDiff; - } - } - - // May need to adust the width of the parent component to fit - // the component in the Border - - if (edge.equals("TOP") || edge.equals("BOTTOM")) - { - int parentWidth = parent.getPreferredSize().width - parentInsets.left - parentInsets.right; - int diff = component.getWidth() - parentWidth; - - if (diff > 0) - { - int leftDiff = (int)(diff * alignment); - int rightDiff = diff - leftDiff; - borderInsets.left += leftDiff; - borderInsets.right += rightDiff; - } - } - } - } } diff --git a/app/src/processing/app/contrib/StatusPanel.java b/app/src/processing/app/contrib/StatusPanel.java index cd140d2b0..97e3a5c87 100644 --- a/app/src/processing/app/contrib/StatusPanel.java +++ b/app/src/processing/app/contrib/StatusPanel.java @@ -26,6 +26,7 @@ import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.swing.BorderFactory; import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JLabel; @@ -55,6 +56,9 @@ class StatusPanel extends JPanel { ContributionTab contributionTab; public StatusPanel(int width, final ContributionTab contributionTab) { + super(); + setBackground(Color.WHITE); + setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK)); this.contributionTab = contributionTab; label = new JTextPane(); label.setEditable(false); @@ -72,6 +76,8 @@ class StatusPanel extends JPanel { } }); installButton = new JButton("Install"); + installButton.setContentAreaFilled(false); + installButton.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK, 1),BorderFactory.createEmptyBorder(3, 0, 3, 0))); installButton.addActionListener(new ActionListener() { @Override @@ -83,9 +89,12 @@ class StatusPanel extends JPanel { } }); progressBarPanel = new JPanel(); - progressBarPanel.setLayout(new BorderLayout());; - updateLabel = new JLabel(" "); + progressBarPanel.setLayout(new BorderLayout()); + progressBarPanel.setOpaque(false); + updateLabel = new JLabel(" "); updateButton = new JButton("Update"); + updateButton.setContentAreaFilled(false); + updateButton.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK, 1),BorderFactory.createEmptyBorder(3, 0, 3, 0))); updateButton.addActionListener(new ActionListener() { @Override @@ -98,6 +107,8 @@ class StatusPanel extends JPanel { }); removeButton = new JButton("Remove"); + removeButton.setContentAreaFilled(false); + removeButton.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK, 1),BorderFactory.createEmptyBorder(3, 0, 3, 0))); removeButton.addActionListener(new ActionListener() { @Override @@ -150,6 +161,8 @@ class StatusPanel extends JPanel { removeButton.setEnabled(false); layout.setHonorsVisibility(updateLabel, false); // Makes the label take up space even though not visible + + validate(); } diff --git a/app/src/processing/app/contrib/UpdateContribListingPanel.java b/app/src/processing/app/contrib/UpdateContribListingPanel.java index e80df90f0..4d327b3d8 100644 --- a/app/src/processing/app/contrib/UpdateContribListingPanel.java +++ b/app/src/processing/app/contrib/UpdateContribListingPanel.java @@ -8,15 +8,19 @@ 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; import javax.swing.UIManager; import javax.swing.table.DefaultTableModel; +import javax.swing.table.JTableHeader; import javax.swing.table.TableCellRenderer; import processing.app.Base; +import processing.app.contrib.ContributionListPanel.MyColumnHeaderRenderer; +import processing.app.ui.Toolkit; public class UpdateContribListingPanel extends ContributionListPanel { @@ -83,7 +87,26 @@ public class UpdateContribListingPanel extends ContributionListPanel { table.setRowSelectionAllowed(true); table.setAutoCreateColumnsFromModel(true); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - + table.getTableHeader().setDefaultRenderer(new MyColumnHeaderRenderer() { + @Override + public Component getTableCellRendererComponent(JTable table, + Object value, + boolean isSelected, + boolean hasFocus, int row, + int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, + row, column); + JTableHeader tableHeader = table.getTableHeader(); + if (tableHeader != null) { + setForeground(tableHeader.getForeground()); + } + setIcon(getIcon(table, column)); + setBackground(Color.WHITE); + setBorder(BorderFactory.createMatteBorder(2, 0, 2, 0, Color.BLACK)); + return this; + } + }); + GroupLayout layout = new GroupLayout(this); layout.setHorizontalGroup(layout.createParallelGroup().addComponent(scrollPane)); layout.setVerticalGroup(layout.createSequentialGroup().addComponent(scrollPane)); @@ -164,9 +187,19 @@ public class UpdateContribListingPanel extends ContributionListPanel { } } } + Icon icon = null; + if (entry.isInstalled()) { + icon = Toolkit.getLibIcon("icons/installedAndUptodate.png"); + if (contribListing.hasUpdates(entry)) { + icon = Toolkit.getLibIcon("icons/installedNeedsUpdate.png"); + } + if (!entry.isCompatible(Base.getRevision())) { + icon = Toolkit.getLibIcon("icons/installedIncompatible.png"); + } + } dtm .addRow(new Object[] { - "", "" + entry.getName() + "", name, entry.getPrettyVersion(), + icon, "" + entry.getName() + "", name, entry.getPrettyVersion(), contributionTab.contribListing.getLatestVersion(entry) }); } } @@ -178,5 +211,12 @@ public class UpdateContribListingPanel extends ContributionListPanel { public boolean isCellEditable(int row, int column) { return false; } + @Override + public Class getColumnClass(int columnIndex) { + if(columnIndex == 0){ + return Icon.class; + } + return super.getColumnClass(columnIndex); + } } } diff --git a/app/src/processing/app/contrib/UpdateStatusPanel.java b/app/src/processing/app/contrib/UpdateStatusPanel.java index b5f1237cf..0e654a439 100644 --- a/app/src/processing/app/contrib/UpdateStatusPanel.java +++ b/app/src/processing/app/contrib/UpdateStatusPanel.java @@ -1,8 +1,10 @@ package processing.app.contrib; +import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.swing.BorderFactory; import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.LayoutStyle; @@ -11,6 +13,8 @@ public class UpdateStatusPanel extends StatusPanel { public UpdateStatusPanel(int width, final ContributionTab contributionTab) { super(); updateButton = new JButton("Update All"); + updateButton.setContentAreaFilled(false); + updateButton.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK, 1),BorderFactory.createEmptyBorder(3, 0, 3, 0))); updateButton.addActionListener(new ActionListener() { @Override @@ -21,6 +25,8 @@ public class UpdateStatusPanel extends StatusPanel { } } }); + this.setBackground(Color.WHITE); + this.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, Color.BLACK)); layout = new GroupLayout(this); this.setLayout(layout); @@ -31,7 +37,7 @@ public class UpdateStatusPanel extends StatusPanel { .createSequentialGroup() .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) - .addComponent(updateButton)); + .addComponent(updateButton, BUTTON_WIDTH, BUTTON_WIDTH, BUTTON_WIDTH)); layout.setVerticalGroup(layout.createParallelGroup() .addComponent(updateButton)); updateButton.setVisible(true); diff --git a/build/shared/lib/icons/loader.gif b/build/shared/lib/icons/loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..60cbc6a1372936920c764a1a87ab97bba4278846 GIT binary patch literal 8787 zcmajlc~lek-aqgpGnp-uWU?=ikc1FJ2oN^qa;-P31w;*th>A5JC~j>;q!g`9NZ7;$ z6ciQPfC`9c(YoMTKt$XTt;MZ^RcozYskYwQ+dh4!_w@Gnhds|PfA9zAz~Q{+J@4=G z;q8Qpv46`_P!yCODU{!S`;9`Ow6(Q)y|Ws|w=k64P5ZX%&knemROBxEqEy7R0R#wM1=RTP&N+B4Hs75LRHra8(maTQ4OrbFathRvWslXm4i?w#&WbiX4 zv+(d_I=hRFo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