Mercurial > hg > release > thermostat-0.15
changeset 1261:ecf0cfd9dafe
New VMTree (part II)
review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-September/008322.html
reviewed-by: omajid
line wrap: on
line diff
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/Palette.java Mon Sep 30 16:38:49 2013 +0200 +++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/Palette.java Mon Sep 30 16:38:49 2013 +0200 @@ -77,6 +77,11 @@ DARK_BLUE(new Color(0x030A0C)), ROYAL_BLUE(new Color(0x0A242D)), ELEGANT_CYAN(new Color(0x39CAFF)), + ELEGANT_BLACK(new Color(0x34313A)), + ROYAL_BLACK(new Color(0x2E2B33)), + + DROID_BLACK(new Color(0x161616)), + DROID_GRAY(new Color(0x272627)), /* END */ ;
--- a/client/swing/src/main/java/com/redhat/thermostat/client/swing/GraphicsUtils.java Mon Sep 30 16:38:49 2013 +0200 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/GraphicsUtils.java Mon Sep 30 16:38:49 2013 +0200 @@ -43,12 +43,15 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Paint; +import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.Shape; import java.awt.geom.RoundRectangle2D; import javax.swing.JComponent; +import com.redhat.thermostat.client.ui.Palette; + import sun.swing.SwingUtilities2; @SuppressWarnings("restriction") @@ -67,9 +70,13 @@ } public void drawStringWithShadow(JComponent component, Graphics2D graphics, String string, Color foreground, int x, int y) { + drawStringWithShadow(component, graphics, string, foreground, new Color(0f, 0f, 0f, 0.1f), x, y); + } + + public void drawStringWithShadow(JComponent component, Graphics2D graphics, String string, Color foreground, Color shadow, int x, int y) { // paint it twice to give a subtle drop shadow effect - graphics.setColor(new Color(0f, 0f, 0f, 0.1f)); + graphics.setColor(shadow); SwingUtilities2.drawString(component, graphics, string, x, y + 1); graphics.setColor(foreground); @@ -97,5 +104,33 @@ public Color deriveWithAlpha(Color color, int alpha) { return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha); } + + public Color deriveWithAlpha(Color color, float alpha) { + float [] rgb = color.getComponents(null); + return new Color(rgb[0], rgb[1], rgb[2], alpha); + } + + public Color deriveWithAlpha(Palette color, int alpha) { + return deriveWithAlpha(color.getColor(), alpha); + } + + public Color deriveWithAlpha(Palette color, float alpha) { + return deriveWithAlpha(color.getColor(), alpha); + } + + public void deriveGraphicsAndFill(Color color, Graphics g) { + Graphics2D graphics = GraphicsUtils.getInstance().createAAGraphics(g); + + graphics.setColor(color); + + Rectangle clip = graphics.getClipBounds(); + graphics.fillRect(clip.x, clip.y, clip.width, clip.height); + + graphics.dispose(); + } + + public void deriveGraphicsAndFill(Palette color, Graphics g) { + deriveGraphicsAndFill(color.getColor(), g); + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/sidepane/ExpanderComponent.java Mon Sep 30 16:38:49 2013 +0200 @@ -0,0 +1,128 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.client.swing.internal.sidepane; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import javax.swing.Box; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.SwingConstants; + +import com.redhat.thermostat.client.swing.GraphicsUtils; +import com.redhat.thermostat.client.swing.components.DebugBorder; +import com.redhat.thermostat.client.swing.components.FontAwesomeIcon; +import com.redhat.thermostat.client.swing.components.Icon; +import com.redhat.thermostat.client.swing.internal.splitpane.ThermostatSplitPane; +import com.redhat.thermostat.client.ui.Palette; + +@SuppressWarnings("serial") +public class ExpanderComponent extends JPanel { + + public static int ICON_WIDTH = 20; + public static final String EXPANDED_PROPERTY = "ExpanderComponent_EXPANDED_PROPERTY"; + + private class ExpanderComponentBorder extends DebugBorder { + @Override + public void paintBorder(Component c, Graphics g, int x, int y, + int width, int height) + { + Graphics2D graphics = GraphicsUtils.getInstance().createAAGraphics(g); + Insets insets = getBorderInsets(c); + + int xStart = x + width - insets.right; + graphics.translate(xStart, y); + + graphics.setColor(Palette.LIGHT_GRAY.getColor()); + graphics.fillRect(0, y, width, height); + + ThermostatSplitPane.paint(graphics, insets.right, height, Palette.LIGHT_GRAY.getColor()); + graphics.dispose(); + } + + @Override + public Insets getBorderInsets(Component c, Insets insets) { + insets.top = 0; + insets.left = 0; + insets.right = 5; + insets.bottom = 1; + + return insets; + } + } + + public ExpanderComponent() { + + setBackground(Color.BLACK); + setLayout(new BorderLayout()); + + setBorder(new ExpanderComponentBorder()); + + final Icon mainIcon = new FontAwesomeIcon('\uf101', ICON_WIDTH, TopSidePane.FG_COLOR); + final Icon hover = new FontAwesomeIcon('\uf101', ICON_WIDTH, ThermostatSidePanel.FG_TEXT_COLOR); + + final JLabel expander = new JLabel(mainIcon); + expander.setHorizontalTextPosition(SwingConstants.LEFT); + + expander.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + expander.setIcon(hover); + } + @Override + public void mouseExited(MouseEvent e) { + expander.setIcon(mainIcon); + } + @Override + public void mouseClicked(MouseEvent e) { + expander.setIcon(mainIcon); + firePropertyChange(EXPANDED_PROPERTY, false, true); + } + }); + + add(Box.createRigidArea(new Dimension(5, 0)), BorderLayout.WEST); + add(expander, BorderLayout.CENTER); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/sidepane/ThermostatSidePanel.java Mon Sep 30 16:38:49 2013 +0200 @@ -0,0 +1,101 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.client.swing.internal.sidepane; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import javax.swing.JComponent; +import javax.swing.JPanel; + +import com.redhat.thermostat.client.ui.Palette; + +@SuppressWarnings("serial") +public class ThermostatSidePanel extends JPanel { + + public static final Color BG_COLOR = Palette.DROID_GRAY.getColor(); + + public static final Color FG_COLOR = Palette.EARL_GRAY.getColor(); + public static final Color FG_TEXT_COLOR = Palette.LIGHT_GRAY.getColor(); + + public static final String COLLAPSED = "ThermostatSidePanel_collapsed"; + + private TopSidePane top; + private JPanel bottom; + + public ThermostatSidePanel() { + + setLayout(new BorderLayout()); + setBackground(Color.BLACK); + + top = new TopSidePane(); + top.addPropertyChangeListener(TopSidePane.COLLAPSED_PROPERTY, + new PropertyChangeListener() + { + @Override + public void propertyChange(PropertyChangeEvent evt) { + firePropertyChange(COLLAPSED, evt.getOldValue(), + evt.getNewValue()); + } + }); + add(top, BorderLayout.NORTH); + + bottom = new JPanel(); + bottom.setLayout(new BorderLayout()); + add(bottom, BorderLayout.CENTER); + } + + public void addContent(JComponent comp) { + addContent(comp, null); + } + + public void removeComponent(JComponent comp) { + bottom.remove(comp); + repaint(); + } + + public void addContent(JComponent comp, Object contraints) { + bottom.add(comp, contraints); + repaint(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/sidepane/TopSidePane.java Mon Sep 30 16:38:49 2013 +0200 @@ -0,0 +1,123 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.client.swing.internal.sidepane; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import javax.swing.JLabel; +import javax.swing.JPanel; + +import com.redhat.thermostat.client.swing.GraphicsUtils; +import com.redhat.thermostat.client.swing.components.DebugBorder; +import com.redhat.thermostat.client.swing.components.FontAwesomeIcon; +import com.redhat.thermostat.client.swing.components.Icon; + +@SuppressWarnings("serial") +class TopSidePane extends JPanel { + + static final String COLLAPSED_PROPERTY = "collapsed"; + + static int ICON_WIDTH = 24; + + static Color ICON_BG_COLOR = ThermostatSidePanel.FG_TEXT_COLOR; + + static Color FG_COLOR = ThermostatSidePanel.FG_COLOR; + private Color currentFGColor = ThermostatSidePanel.FG_COLOR; + + public TopSidePane() { + setBackground(Color.BLACK); + setLayout(new BorderLayout()); + + final Icon mainIcon = new FontAwesomeIcon('\uf100', ICON_WIDTH, FG_COLOR); + final Icon hover = new FontAwesomeIcon('\uf100', ICON_WIDTH, ICON_BG_COLOR); + + final JLabel expander = new JLabel(mainIcon); + expander.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + setState(ICON_BG_COLOR, hover); + } + @Override + public void mouseExited(MouseEvent e) { + setState(FG_COLOR, mainIcon); + } + @Override + public void mouseClicked(MouseEvent e) { + setState(FG_COLOR, mainIcon); + firePropertyChange(COLLAPSED_PROPERTY, false, true); + } + + private void setState(Color color, Icon icon) { + currentFGColor = color; + expander.setIcon(icon); + repaint(); + } + }); + + add(expander, BorderLayout.EAST); + + setBorder(new TopSidePaneBorder()); + } + + @Override + protected void paintComponent(Graphics g) { + + GraphicsUtils utils = GraphicsUtils.getInstance(); + Graphics2D graphics = utils.createAAGraphics(g); + + graphics.setColor(getBackground()); + graphics.fillRect(0, 0, getWidth(), getHeight()); + + graphics.dispose(); + } + + private class TopSidePaneBorder extends DebugBorder { + @Override + public void paintBorder(Component c, Graphics g, int x, int y, + int width, int height) + { + g.setColor(GraphicsUtils.getInstance().deriveWithAlpha(currentFGColor, 100)); + g.drawLine(x, y + height - 1, x + width, y + height - 1); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/splitpane/ThermostatSplitPane.java Mon Sep 30 16:38:49 2013 +0200 @@ -0,0 +1,69 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.client.swing.internal.splitpane; + +import java.awt.Color; +import java.awt.GradientPaint; +import java.awt.Graphics2D; +import java.awt.Paint; + +import javax.swing.JSplitPane; + +import com.redhat.thermostat.client.swing.GraphicsUtils; + +@SuppressWarnings("serial") +public class ThermostatSplitPane extends JSplitPane { + + public ThermostatSplitPane() { + setUI(new ThermostatSplitPaneUI()); + setContinuousLayout(true); + } + + public static void paint(Graphics2D graphics, int width, int height, + Color background) + { + GraphicsUtils utils = GraphicsUtils.getInstance(); + + Color left = utils.deriveWithAlpha(Color.BLACK, 60); + Color right = utils.deriveWithAlpha(background, 0); + + Paint paint = new GradientPaint(0, 0, left, width, 0, right); + graphics.setPaint(paint); + + graphics.fillRect(0, 0, width, height); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/splitpane/ThermostatSplitPaneBorder.java Mon Sep 30 16:38:49 2013 +0200 @@ -0,0 +1,68 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.client.swing.internal.splitpane; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; + +import com.redhat.thermostat.client.swing.GraphicsUtils; +import com.redhat.thermostat.client.swing.components.DebugBorder; + +@SuppressWarnings("serial") +class ThermostatSplitPaneBorder extends DebugBorder { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) + { + Graphics2D graphics = GraphicsUtils.getInstance().createAAGraphics(g); + + graphics.setColor(new Color(0xb6b6b6)); + graphics.drawLine(x, y + height - 1, x + width, y + height - 1); + + graphics.dispose(); + } + + @Override + public Insets getBorderInsets(Component c, Insets insets) { + insets.bottom = 1; + return insets; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/splitpane/ThermostatSplitPaneDivider.java Mon Sep 30 16:38:49 2013 +0200 @@ -0,0 +1,63 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.client.swing.internal.splitpane; + +import java.awt.Graphics; +import java.awt.Graphics2D; + +import javax.swing.plaf.basic.BasicSplitPaneDivider; +import javax.swing.plaf.basic.BasicSplitPaneUI; + +import com.redhat.thermostat.client.swing.GraphicsUtils; + +@SuppressWarnings("serial") +class ThermostatSplitPaneDivider extends BasicSplitPaneDivider { + + public ThermostatSplitPaneDivider(BasicSplitPaneUI ui) { + super(ui); + } + + @Override + public void paint(Graphics g) { + + Graphics2D graphics = GraphicsUtils.getInstance().createAAGraphics(g); + ThermostatSplitPane.paint(graphics, getWidth(), getHeight(), getBackground()); + graphics.dispose(); + + super.paint(g); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/splitpane/ThermostatSplitPaneUI.java Mon Sep 30 16:38:49 2013 +0200 @@ -0,0 +1,55 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.client.swing.internal.splitpane; + +import javax.swing.plaf.basic.BasicSplitPaneDivider; +import javax.swing.plaf.basic.BasicSplitPaneUI; + +class ThermostatSplitPaneUI extends BasicSplitPaneUI { + + @Override + protected void installDefaults() { + super.installDefaults(); + splitPane.setBorder(new ThermostatSplitPaneBorder()); + divider.setBorder(new ThermostatSplitPaneUIDividerBorder()); + } + + @Override + public BasicSplitPaneDivider createDefaultDivider() { + return new ThermostatSplitPaneDivider(this); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/swing/src/main/java/com/redhat/thermostat/client/swing/internal/splitpane/ThermostatSplitPaneUIDividerBorder.java Mon Sep 30 16:38:49 2013 +0200 @@ -0,0 +1,64 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.client.swing.internal.splitpane; + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Insets; + +import com.redhat.thermostat.client.swing.components.DebugBorder; + +@SuppressWarnings("serial") +class ThermostatSplitPaneUIDividerBorder extends DebugBorder { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) + { + } + + @Override + public Insets getBorderInsets(Component c, Insets insets) { + + insets.top = 0; + insets.left = 0; + insets.right = 0; + insets.bottom = 0; + + return insets; + } +}