# HG changeset patch # User Mario Torre # Date 1355252515 -3600 # Node ID 8faa914b76a4741e1c594f6b5b80fa7870d06884 Initial import. diff -r 000000000000 -r 8faa914b76a4 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,15 @@ +/target/ + +syntax: regexp +# Ignore all {.classpath,.project,.settings/*} files except for folders in +# eclipse +# +# Using negative lookahead expression +^(?!eclipse).*\.(settings|project|classpath) + +syntax: glob +target/* +bin/* +*~ +nbactions*.xml +nb-configuration.xml diff -r 000000000000 -r 8faa914b76a4 pom.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pom.xml Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,92 @@ + + 4.0.0 + + Dolphin Look And Feel + http://icedtea.classpath.org/dolphin + + com.redhat.laf + dolphin + 0.5.1-SNAPSHOT + bundle + + + /usr/share/java + UTF-8 + + + + + junit + junit + 4.10 + test + + + + + + + + src/main/resources + false + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + + 1.7 + 1.7 + -XDignore.symbol.file=true + + + + + org.apache.felix + maven-bundle-plugin + true + 1.4.0 + + + com.redhat.laf.dolphin + Red Hat, Inc. + + com.redhat.swing.laf.dolphin, + com.redhat.swing.laf.dolphin.borders, + com.redhat.swing.laf.dolphin.button, + com.redhat.swing.laf.dolphin.icons, + com.redhat.swing.laf.dolphin.menu, + com.redhat.swing.laf.dolphin.scrollbars, + com.redhat.swing.laf.dolphin.split, + com.redhat.swing.laf.dolphin.tab, + com.redhat.swing.laf.dolphin.text, + com.redhat.swing.laf.dolphin.themes, + com.redhat.swing.laf.dolphin.table, + com.redhat.swing.laf.dolphin.tree, + + + com.redhat.swing.laf.dolphin.showcase, + com.redhat.swing.laf.dolphin.showcase.table, + com.redhat.swing.laf.dolphin.showcase.tree, + + + <_nouses>true + + + + + + + + diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/DolphinLookAndFeel.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/DolphinLookAndFeel.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,185 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin; + +import java.awt.Color; + +import javax.swing.UIDefaults; +import javax.swing.plaf.IconUIResource; +import javax.swing.plaf.InsetsUIResource; +import javax.swing.plaf.metal.MetalLookAndFeel; + +import com.redhat.swing.laf.dolphin.icons.DolphinAscendingArrowIcon; +import com.redhat.swing.laf.dolphin.icons.DolphinCheckBoxIcon; +import com.redhat.swing.laf.dolphin.icons.DolphinDescendingArrowIcon; +import com.redhat.swing.laf.dolphin.icons.DolphinRadioIcon; +import com.redhat.swing.laf.dolphin.split.DolphinSplitPaneDividerBorder; +import com.redhat.swing.laf.dolphin.themes.DolphinDefaultTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; + +public class DolphinLookAndFeel extends MetalLookAndFeel { + + private static final DolphinTheme theme = new DolphinDefaultTheme(); + static { + MetalLookAndFeel.setCurrentTheme(theme); + } + + public static DolphinTheme getTheme() { + return theme; + } + + @Override + protected void initClassDefaults(UIDefaults table) { + super.initClassDefaults(table); + + Object[] uiDefaults = { + "swing.boldMetal", Boolean.FALSE, + + "ButtonUI", "com.redhat.swing.laf.dolphin.button.DolphinButtonUI", + "ToggleButtonUI", "com.redhat.swing.laf.dolphin.button.DolphinToggleButtonUI", + "CheckBoxUI", "com.redhat.swing.laf.dolphin.button.DolphinCheckBoxUI", + "TreeUI", "com.redhat.swing.laf.dolphin.tree.DolphinTreeUI", + "TextFieldUI", "com.redhat.swing.laf.dolphin.text.DolphinTextFieldUI", + "PasswordFieldUI", "com.redhat.swing.laf.dolphin.text.DolphinPasswordFieldUI", + "TabbedPaneUI", "com.redhat.swing.laf.dolphin.tab.DolphinTabbedPaneUI", + "ScrollBarUI", "com.redhat.swing.laf.dolphin.scrollbars.DolphinScrollBarUI", + "SplitPaneUI", "com.redhat.swing.laf.dolphin.split.DolphinSplitPaneUI", + "SeparatorUI", "com.redhat.swing.laf.dolphin.split.DolphinSeparatorUI", + "PopupMenuSeparatorUI", "com.redhat.swing.laf.dolphin.split.DolphinSeparatorUI", + "TableUI", "com.redhat.swing.laf.dolphin.table.DolphinTableUI", + "TableUI", "com.redhat.swing.laf.dolphin.table.DolphinTableUI", + "TableHeaderUI", "com.redhat.swing.laf.dolphin.table.DolphinTableHeaderUI", + + // menu ui defined in theme specific "addCustomEntriesToTable" + }; + + table.putDefaults(uiDefaults); + } + + @Override + protected void initComponentDefaults(UIDefaults table) { + super.initComponentDefaults(table); + + Object[] uiDefaults = { + + "window", theme.getWindowBackgroundColor(), + "Panel.background", theme.getWindowBackgroundColor(), + + "text", theme.getSystemTextColor(), + "textHighlight", theme.getSelectionColor(), + "textHighlightText", theme.getSelectionColor(), + + "Button.focus", theme.getSelectionColor(), + "Button.border", theme.getButtonBorder(), + "Button.borderPaintsFocus", theme.borderPaintsFocus(), + "Button.invertedForeground", theme.getSelectionColorForeground(), + + "ToggleButton.focus", theme.getSelectionColor(), + "ToggleButton.border", theme.getButtonBorder(), + "ToggleButton.borderPaintsFocus", theme.borderPaintsFocus(), + "ToggleButton.invertedForeground", theme.getSelectionColorForeground(), + "ToggleButton.rollover", Boolean.TRUE, + + "CheckBox.icon", new IconUIResource(new DolphinCheckBoxIcon()), + + "RadioButton.icon", new IconUIResource(new DolphinRadioIcon()), + + "Tree.repaintWholeRow", Boolean.TRUE, + "Tree.lineTypeDashed", theme.getTreeLineTypeDashed(), + "Tree.rendererFillBackground", theme.getTreeRendererFillBackground(), + "Tree.selectionForeground", theme.getSelectionColorForeground(), + "Tree.selectionBackground", theme.getSelectionColor(), + + "TextField.border", theme.getTextFieldBorder(), + "TextField.caretBlinkRate", 0, + "TextField.selectionBackground", theme.getSelectionColor(), + "TextField.selectionForeground", theme.getSelectionColorForeground(), + + "PasswordField.border", theme.getTextFieldBorder(), + "PasswordField.caretBlinkRate", 0, + "PasswordField.selectionBackground", theme.getSelectionColor(), + "PasswordField.selectionForeground", theme.getSelectionColorForeground(), + + "TextArea.border", theme.getTextAreaBorder(), + "TextArea.selectionBackground", theme.getSelectionColor(), + "TextArea.selectionForeground", theme.getSelectionColorForeground(), + "TextArea.caretBlinkRate", 0, + + "ScrollPane.border", theme.getScrollPaneBorder(), + + "List.selectionBackground", theme.getSelectionColor(), + "List.selectionForeground", theme.getSelectionColorForeground(), + + "ScrollBar.width", 15, + "SplitPane.dividerSize", new Integer(7), + "SplitPaneDivider.border", new DolphinSplitPaneDividerBorder(), + "SplitPane.border", null, + "SplitPane.oneTouchButtonSize", theme.getOneTouchButtonSize(), + "SplitPane.oneTouchButtonOffset", theme.getOneTouchButtonOffset(), + + "TableHeader.cellBorder", theme.getTableCellBorder(), + "TableHeader.focusCellBorder", theme.getTableFocusCellBorder(), + "TableHeader.background", theme.getTableHeaderBackgroundColor(), + "TableHeader.foreground", theme.getTableHeaderForegroundColor(), + "TableHeader.font", theme.getTableHeaderFont(), + "Table.ascendingSortIcon", new IconUIResource(new DolphinAscendingArrowIcon()), + "Table.descendingSortIcon", new IconUIResource(new DolphinDescendingArrowIcon()), + + "Table.selectionBackground", theme.getTableSelectionCellBackground(), + "Table.selectionForeground", theme.getTableSelectionCellForeground(), + + "TableHeader.rightAlignSortArrow", true, + }; + + table.putDefaults(uiDefaults); + } + + @Override + public String getID() { + return "Dolphin Look And Feel"; + } + + @Override + public String getDescription() { + return "Dolphin Look And Feel"; + } + + @Override + public String getName() { + return getID(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/borders/DolphinCommonBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/borders/DolphinCommonBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,83 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.borders; + +import java.awt.Component; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.RenderingHints; +import java.awt.Shape; +import java.awt.geom.RoundRectangle2D; + +import java.io.Serializable; + +import javax.swing.plaf.UIResource; + +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +/** + */ +public class DolphinCommonBorder extends DolphinDebugBorder implements UIResource, Serializable { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) { + + Graphics2D graphics = (Graphics2D) g.create(); + DolphinThemeUtils.setAntialiasing(graphics); + + graphics.translate(x, y); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + Paint paint = + new GradientPaint(0, 0, theme.getBorderGradientTopColor(), + 0, c.getHeight(), + theme.getBorderGradientTopColor()); + graphics.setPaint(paint); + + graphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, + RenderingHints.VALUE_STROKE_DEFAULT); + + Shape shape = new RoundRectangle2D.Float(0, 0, width - 1, + height - 1, 4, 4); + graphics.draw(shape); + graphics.dispose(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/borders/DolphinDebugBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/borders/DolphinDebugBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,66 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.borders; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.Shape; +import java.awt.geom.RoundRectangle2D; + +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinDebugBorder extends DolphinNullBorder { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) + { + Graphics2D graphics = (Graphics2D) g.create(); + + graphics.translate(x, y); + + graphics.setPaint(Color.RED); + + Shape shape = new RoundRectangle2D.Float(0, 0, width - 1, + height - 1, 4, 4); + graphics.draw(shape); + graphics.dispose(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/borders/DolphinNullBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/borders/DolphinNullBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,75 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.borders; + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Insets; +import java.io.Serializable; + +import javax.swing.border.AbstractBorder; +import javax.swing.plaf.UIResource; + +/** + * An Empty border that doesn't paint anything when used. + * + */ +public class DolphinNullBorder extends AbstractBorder implements UIResource, Serializable { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) + { + /* bypass all graphics ops */ + } + + @Override + public Insets getBorderInsets(Component c) { + return getBorderInsets(c, new Insets(0, 0, 0, 0)); + } + + @Override + public Insets getBorderInsets(Component c, Insets insets) { + + insets.top = 4; + insets.left = 4; + insets.right = 4; + insets.bottom = 4; + + return insets; + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/button/DolphinButtonBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/button/DolphinButtonBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,82 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.button; + +import java.awt.Color; +import java.awt.Component; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.Shape; + +import com.redhat.swing.laf.dolphin.borders.DolphinNullBorder; +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinButtonBorder extends DolphinNullBorder { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) + { + Graphics2D graphics = (Graphics2D) g.create(); + + DolphinThemeUtils.setAntialiasing(graphics); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + Color topGradient = null; + Color bottomGradient = null; + if (c.isEnabled()) { + topGradient = theme.getBorderGradientTopColor(); + bottomGradient = theme.getBorderGradientBottomColor(); + } else { + topGradient = theme.getBorderGradientTopDisabledColor(); + bottomGradient = theme.getBorderGradientBottomDisabledColor(); + } + + Paint paint = new GradientPaint(0, 0, topGradient, 0, height, + bottomGradient); + graphics.setPaint(paint); + + Shape shape = DolphinThemeUtils.getRoundShape(width, height); + graphics.draw(shape); + + graphics.dispose(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/button/DolphinButtonUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/button/DolphinButtonUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,197 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.button; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.geom.RoundRectangle2D; +import java.lang.reflect.Field; + +import javax.swing.AbstractButton; +import javax.swing.ButtonModel; +import javax.swing.JComponent; +import javax.swing.UIManager; +import javax.swing.plaf.ColorUIResource; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.metal.MetalButtonUI; + +import sun.swing.SwingUtilities2; + +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; +import com.sun.java.swing.SwingUtilities3; + +public class DolphinButtonUI extends MetalButtonUI { + + private static final DolphinButtonUI singleton = new DolphinButtonUI(); + private boolean canPaintFocus; + + public static ComponentUI createUI(JComponent b) { + return singleton; + } + + @Override + public void installDefaults(AbstractButton b) { + + super.installDefaults(b); + canPaintFocus = !UIManager.getBoolean("Button.borderPaintsFocus"); + } + + @Override + public void update(Graphics g, JComponent c) { + + paint(g, c); + } + + @Override + public void paint(Graphics g, JComponent c) { + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + Graphics2D graphics = (Graphics2D) g.create(); + + AbstractButton button = (AbstractButton) c; + ButtonModel model = button.getModel(); + + DolphinThemeUtils.setAntialiasing(graphics); + + Color topGradient = null; + Color bottomGradient = null; + if (!c.isEnabled()) { + topGradient = theme.getButtonGradientDisabledTopColor(); + bottomGradient = theme.getButtonGradientDisabledBottomColor(); + } else { + if (model.isRollover()) { + topGradient = theme.getButtonGradientTopRolloverColor(); + bottomGradient = theme.getButtonGradientBottomRolloverColor(); + } else { + topGradient = theme.getButtonGradientTopColor(); + bottomGradient = theme.getButtonGradientBottomColor(); + } + } + + if (button.isOpaque()) { + graphics.clearRect(0, 0, c.getWidth(), c.getHeight()); + } + + if (button.isContentAreaFilled() && button.isOpaque()) { + Paint paint = new GradientPaint(0, 0, topGradient, 0, c.getHeight(), + bottomGradient); + graphics.setPaint(paint); + Shape shape = DolphinThemeUtils.getRoundShape(c.getWidth(), c.getHeight()); + graphics.fill(shape); + } + + graphics.dispose(); + + super.paint(g, c); + } + + @Override + protected void paintButtonPressed(Graphics g, AbstractButton b) { + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + Graphics2D graphics = (Graphics2D) g.create(); + + Paint paint = + new GradientPaint(0, 0, theme.getButtonGradientPressedTopColor(), + 0, b.getHeight(), + theme.getButtonGradientPressedBottomColor()); + + graphics.setPaint(paint); + + Shape shape = DolphinThemeUtils.getRoundShape(b.getWidth(), b.getHeight()); + graphics.fill(shape); + + graphics.dispose(); + } + + @Override + protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, + Rectangle textRect, Rectangle iconRect) { + + if (!canPaintFocus) + return; + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + Graphics2D graphics = (Graphics2D) g.create(); + DolphinThemeUtils.setAntialiasing(graphics); + + graphics.translate(viewRect.x - 1, viewRect.y -1); + graphics.setStroke(new BasicStroke(1)); + + ColorUIResource topGradient = theme.getButtonFocusGradientTopColor(); + ColorUIResource bottomGradient = theme.getButtonFocusGradientBottomColor(); + + Paint paint = new GradientPaint(0, 0, topGradient, 0, viewRect.height, + bottomGradient); + graphics.setPaint(paint); + + Shape shape = DolphinThemeUtils.getRoundShape(viewRect.width + 2, viewRect.height + 2); + + graphics.draw(shape); + graphics.dispose(); + } + + @Override + protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) { + AbstractButton button = (AbstractButton) c; + + ButtonModel model = button.getModel(); + FontMetrics metrics = button.getFontMetrics(button.getFont()); + + if (!model.isEnabled()) { + g.setColor(UIManager.getColor("Button.disabledText")); + } else { + if (model.isPressed()) { + g.setColor(UIManager.getColor("Button.invertedForeground")); + } else { + g.setColor(UIManager.getColor("text")); + } + } + SwingUtilities2.drawStringUnderlineCharAt(button, g, text, button.getDisplayedMnemonicIndex(), textRect.x, textRect.y + metrics.getAscent()); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/button/DolphinCheckBoxUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/button/DolphinCheckBoxUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,56 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.button; + +import javax.swing.JComponent; +import javax.swing.plaf.ComponentUI; + +public class DolphinCheckBoxUI extends DolphinRadioButtonUI { + + private static final DolphinCheckBoxUI singleton = new DolphinCheckBoxUI(); + + private final static String propertyPrefix = "CheckBox" + "."; + + public static ComponentUI createUI(JComponent b) { + return singleton; + } + + @Override + protected String getPropertyPrefix() { + return propertyPrefix; + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/button/DolphinRadioButtonUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/button/DolphinRadioButtonUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.button; + +import javax.swing.JComponent; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.metal.MetalRadioButtonUI; + +public class DolphinRadioButtonUI extends MetalRadioButtonUI { + + private static final DolphinRadioButtonUI singleton = new DolphinRadioButtonUI(); + + public static ComponentUI createUI(JComponent b) { + return singleton; + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/button/DolphinToggleButtonUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/button/DolphinToggleButtonUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,188 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.button; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.Rectangle; +import java.awt.Shape; + +import javax.swing.AbstractButton; +import javax.swing.ButtonModel; +import javax.swing.JComponent; +import javax.swing.UIManager; +import javax.swing.plaf.ColorUIResource; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.metal.MetalToggleButtonUI; + +import sun.swing.SwingUtilities2; + +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinToggleButtonUI extends MetalToggleButtonUI { + + private static final DolphinToggleButtonUI singleton = new DolphinToggleButtonUI(); + private boolean canPaintFocus; + + public static ComponentUI createUI(JComponent b) { + return singleton; + } + + @Override + public void installDefaults(AbstractButton b) { + super.installDefaults(b); + canPaintFocus = !UIManager.getBoolean("ToggleButton.borderPaintsFocus"); + } + + @Override + public void update(Graphics g, JComponent c) { + paint(g, c); + } + + @Override + public void paint(Graphics g, JComponent c) { + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + Graphics2D graphics = (Graphics2D) g.create(); + + graphics.clearRect(0, 0, c.getWidth(), c.getHeight()); + DolphinThemeUtils.setAntialiasing(graphics); + + AbstractButton button = (AbstractButton) c; + ButtonModel model = button.getModel(); + Color topGradient = null; + Color bottomGradient = null; + if (!c.isEnabled()) { + topGradient = theme.getButtonGradientDisabledTopColor(); + bottomGradient = theme.getButtonGradientDisabledBottomColor(); + } else { + if (model.isRollover() || (model.isPressed() && !model.isArmed())) { + topGradient = theme.getButtonGradientTopRolloverColor(); + bottomGradient = theme.getButtonGradientBottomRolloverColor(); + } else { + topGradient = theme.getButtonGradientTopColor(); + bottomGradient = theme.getButtonGradientBottomColor(); + } + } + + Paint paint = new GradientPaint(0, 0, topGradient, 0, c.getHeight(), + bottomGradient); + graphics.setPaint(paint); + + Shape shape = DolphinThemeUtils.getRoundShape(c.getWidth(), c.getHeight()); + + graphics.fill(shape); + graphics.dispose(); + + super.paint(g, c); + } + + @Override + protected void paintButtonPressed(Graphics g, AbstractButton b) { + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + Graphics2D graphics = (Graphics2D) g.create(); + + Paint paint = + new GradientPaint(0, 0, theme.getButtonGradientPressedTopColor(), + 0, b.getHeight(), + theme.getButtonGradientPressedBottomColor()); + + graphics.setPaint(paint); + + Shape shape = DolphinThemeUtils.getRoundShape(b.getWidth(), b.getHeight()); + graphics.fill(shape); + + graphics.dispose(); + } + + @Override + protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, + Rectangle textRect, Rectangle iconRect) { + + if (!canPaintFocus) + return; + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + Graphics2D graphics = (Graphics2D) g.create(); + DolphinThemeUtils.setAntialiasing(graphics); + + graphics.translate(viewRect.x - 1, viewRect.y -1); + graphics.setStroke(new BasicStroke(1)); + + ColorUIResource topGradient = theme.getButtonFocusGradientTopColor(); + ColorUIResource bottomGradient = theme.getButtonFocusGradientBottomColor(); + + Paint paint = new GradientPaint(0, 0, topGradient, 0, viewRect.height, + bottomGradient); + graphics.setPaint(paint); + + Shape shape = DolphinThemeUtils.getRoundShape(viewRect.width + 2, viewRect.height + 2); + + graphics.draw(shape); + graphics.dispose(); + } + + @Override + protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) { + AbstractButton button = (AbstractButton) c; + + ButtonModel model = button.getModel(); + FontMetrics metrics = button.getFontMetrics(button.getFont()); + + if (!model.isEnabled()) { + g.setColor(UIManager.getColor("ToggleButton.disabledText")); + } else { + if (model.isPressed() || model.isSelected()) { + g.setColor(UIManager.getColor("ToggleButton.invertedForeground")); + } else { + g.setColor(UIManager.getColor("text")); + } + } + SwingUtilities2.drawStringUnderlineCharAt(button, g, text, button.getDisplayedMnemonicIndex(), textRect.x, textRect.y + metrics.getAscent()); + } + +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinAscendingArrowIcon.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinAscendingArrowIcon.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.icons; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; + +import javax.swing.ImageIcon; + +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinAscendingArrowIcon extends ImageIcon { + + @Override + public int getIconHeight() { + return 12; + } + + @Override + public int getIconWidth() { + return 12; + } + + @Override + public synchronized void paintIcon(Component c, Graphics g, int x, int y) { + Graphics2D graphics = DolphinThemeUtils.createAAGraphics(g); + + Color baseColor = DolphinThemeUtils.getCurrentTheme().getIconsBaseColor(); + + graphics.setColor(new Color(baseColor.getRed(), baseColor.getGreen(), + baseColor.getBlue(), 200)); + + graphics.setStroke(new BasicStroke(2.0f)); + + graphics.translate(x, y); + + graphics.drawLine(1, 7, 5, 3); + graphics.drawLine(6, 4, 9, 7); + + graphics.dispose(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinCheckBoxIcon.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinCheckBoxIcon.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,44 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.icons; + +public class DolphinCheckBoxIcon extends ToggleIcon { + + public DolphinCheckBoxIcon() { + super("/checkbox-unchecked.png", "/checkbox-checked.png", "/checkbox-disabled.png", "/checkbox-checked-disabled.png"); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinCheckBoxMenuIcon.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinCheckBoxMenuIcon.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,75 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.icons; + +import java.awt.Component; +import java.awt.Graphics; + +import javax.swing.AbstractButton; +import javax.swing.ImageIcon; + +public class DolphinCheckBoxMenuIcon extends ImageIcon { + + private ImageIcon delegate = new ImageIcon(getClass().getResource("/checkbox-menuitem-checked.png")); + + @Override + public int getIconHeight() { + return delegate.getIconHeight(); + } + + @Override + public int getIconWidth() { + return delegate.getIconWidth(); + } + + @Override + public synchronized void paintIcon(Component c, Graphics g, int x, int y) { + + boolean paintIcon = true; + + if (c instanceof AbstractButton) { + AbstractButton button = (AbstractButton) c; + if (!button.getModel().isSelected()) { + paintIcon = false; + } + } + + if (paintIcon) { + delegate.paintIcon(c, g, x, y); + } + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinDescendingArrowIcon.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinDescendingArrowIcon.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.icons; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; + +import javax.swing.ImageIcon; + +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinDescendingArrowIcon extends ImageIcon { + + @Override + public int getIconHeight() { + return 12; + } + + @Override + public int getIconWidth() { + return 12; + } + + @Override + public synchronized void paintIcon(Component c, Graphics g, int x, int y) { + Graphics2D graphics = DolphinThemeUtils.createAAGraphics(g); + + Color baseColor = DolphinThemeUtils.getCurrentTheme().getIconsBaseColor(); + + graphics.setColor(new Color(baseColor.getRed(), baseColor.getGreen(), + baseColor.getBlue(), 200)); + + graphics.setStroke(new BasicStroke(2.0f)); + + graphics.translate(x, y); + + graphics.drawLine(1, 4, 5, 8); + graphics.drawLine(6, 7, 9, 4); + + graphics.dispose(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinRadioButtonMenuIcon.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinRadioButtonMenuIcon.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,76 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.icons; + +import java.awt.Component; +import java.awt.Graphics; + +import javax.swing.AbstractButton; +import javax.swing.Icon; +import javax.swing.ImageIcon; + +public class DolphinRadioButtonMenuIcon extends ImageIcon { + + private ImageIcon delegate = new ImageIcon(getClass().getResource("/radio-menuitem-checked.png")); + + @Override + public int getIconHeight() { + return delegate.getIconHeight(); + } + + @Override + public int getIconWidth() { + return delegate.getIconWidth(); + } + + @Override + public synchronized void paintIcon(Component c, Graphics g, int x, int y) { + + boolean paintIcon = true; + + if (c instanceof AbstractButton) { + AbstractButton button = (AbstractButton) c; + if (!button.getModel().isSelected()) { + paintIcon = false; + } + } + + if (paintIcon) { + delegate.paintIcon(c, g, x, y); + } + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinRadioIcon.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/icons/DolphinRadioIcon.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,44 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.icons; + +public class DolphinRadioIcon extends ToggleIcon { + + public DolphinRadioIcon() { + super("/radio-unselected.png", "/radio-selected.png", "/radio-disabled-unselected.png", "/radio-disabled-selected.png"); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/icons/ToggleIcon.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/icons/ToggleIcon.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,102 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.icons; + +import java.awt.Component; +import java.awt.Graphics; + +import javax.swing.AbstractButton; +import javax.swing.ImageIcon; + +class ToggleIcon extends ImageIcon { + + private final ImageIcon unselectedDelegate; + private final ImageIcon selectedDelegate; + private final ImageIcon disabledUnselectedDelegate; + private final ImageIcon disabledSelectedDelegate; + + /** The icons must be the same size */ + public ToggleIcon(String unchecked, String checked, String disabledUnchecked, String disabledChecked) { + unselectedDelegate = new ImageIcon(getClass().getResource(unchecked)); + selectedDelegate = new ImageIcon(getClass().getResource(checked)); + disabledUnselectedDelegate = new ImageIcon(getClass().getResource(disabledUnchecked)); + disabledSelectedDelegate = new ImageIcon(getClass().getResource(disabledChecked)); + } + + @Override + public int getIconHeight() { + return unselectedDelegate.getIconHeight(); + } + + @Override + public int getIconWidth() { + return unselectedDelegate.getIconWidth(); + } + + @Override + public synchronized void paintIcon(Component c, Graphics g, int x, int y) { + + boolean paintIcon = true; + + boolean selected = false; + boolean enabled = true; + + if (c instanceof AbstractButton) { + AbstractButton button = (AbstractButton) c; + if (!button.getModel().isEnabled()) { + enabled = false; + } + if (button.getModel().isSelected()) { + selected = true; + } + } + + if (paintIcon) { + if (enabled && !selected) { + unselectedDelegate.paintIcon(c, g, x, y); + } else if (enabled && selected) { + selectedDelegate.paintIcon(c, g, x, y); + } else if (!enabled && !selected){ + disabledUnselectedDelegate.paintIcon(c, g, x, y); + } else if (!enabled && selected) { + disabledSelectedDelegate.paintIcon(c, g, x, y); + } + } + } + + +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuBarBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuBarBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,72 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.menu; + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; + +import com.redhat.swing.laf.dolphin.borders.DolphinDebugBorder; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinMenuBarBorder extends DolphinDebugBorder { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, + int width, int height) + { + Graphics2D graphics = (Graphics2D) g.create(); + graphics.translate(x, y + height - 1); + + graphics.setPaint(DolphinThemeUtils.getCurrentTheme().getMenuBorderDefaultColor()); + + graphics.drawLine(0, 0, width, 0); + graphics.dispose(); + } + + @Override + public Insets getBorderInsets(Component c, Insets insets) { + + insets.top = 1; + insets.left = 2; + insets.right = 2; + insets.bottom = 1; + + return insets; + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuBarUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuBarUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.menu; + +import java.awt.Graphics; + +import javax.swing.JComponent; +import javax.swing.plaf.ColorUIResource; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.metal.MetalMenuBarUI; + +public class DolphinMenuBarUI extends MetalMenuBarUI { + + public static ComponentUI createUI(JComponent b) { + return new DolphinMenuBarUI(); + } + + @Override + public void update(Graphics g, JComponent c) { + if (c.isOpaque() && (c.getBackground() instanceof ColorUIResource)) { + g.setColor(c.getBackground()); + g.fillRect(0, 0, c.getWidth(), c.getHeight()); + } + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.menu; + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; + +import com.redhat.swing.laf.dolphin.borders.DolphinDebugBorder; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinMenuBorder extends DolphinDebugBorder { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, + int width, int height) + { + Graphics2D graphics = (Graphics2D) g.create(); + graphics.translate(x, y + height - 1); + + graphics.setPaint(DolphinThemeUtils.getCurrentTheme().getMenuBorderDefaultColor()); + + graphics.drawLine(5, 0, width - 10, 0); + graphics.dispose(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuItemBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuItemBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,62 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.menu; + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Insets; + +public class DolphinMenuItemBorder extends DolphinMenuBarBorder { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) + { + // no border + } + + @Override + public Insets getBorderInsets(Component c, Insets insets) { + + insets.top = 3; + insets.left = 2; + insets.right = 2; + insets.bottom = 3; + + return insets; + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinMenuUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.menu; + +import java.awt.Graphics; + +import javax.swing.JComponent; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicMenuUI; + +public class DolphinMenuUI extends BasicMenuUI { + + public static ComponentUI createUI(JComponent x) { + return new DolphinMenuUI(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinPopupMenuBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/menu/DolphinPopupMenuBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.menu; + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; + +import javax.swing.AbstractButton; +import javax.swing.JToolBar; +import javax.swing.text.JTextComponent; + +import com.redhat.swing.laf.dolphin.borders.DolphinDebugBorder; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinPopupMenuBorder extends DolphinDebugBorder { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, + int width, int height) + { + Graphics2D graphics = (Graphics2D) g.create(); + graphics.translate(x, y); + + graphics.setPaint(DolphinThemeUtils.getCurrentTheme().getMenuBorderDefaultColor()); + + graphics.drawLine(0, 0, 0, height); + graphics.drawLine(0, height - 1, width - 1, height - 1); + graphics.drawLine(width -1, height - 1, width - 1, 0); + graphics.drawLine(width -1, 0, 0, 0); + + graphics.dispose(); + } + + @Override + public Insets getBorderInsets(Component c, Insets insets) { + + insets.top = 1; + insets.left = 1; + insets.right = 1; + insets.bottom = 1; + + return insets; + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/scrollbars/DolphinScrollBarUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/scrollbars/DolphinScrollBarUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,163 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.scrollbars; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JScrollBar; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.metal.MetalScrollBarUI; + +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinScrollBarUI extends MetalScrollBarUI { + + private class EmptyButton extends JButton { + + public EmptyButton() { + setMaximumSize(new Dimension(0, 0)); + } + + @Override + public void paint(Graphics g) { + Graphics2D graphics = (Graphics2D) g.create(); + DolphinThemeUtils.setAntialiasing(graphics); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + graphics.setColor(theme.getScrollBarTrackColor()); + + graphics.fillRect(0, 0, getWidth(), getHeight()); + } + } + + public static ComponentUI createUI(JComponent b) { + return new DolphinScrollBarUI(); + } + + @Override + protected JButton createDecreaseButton(int orientation) { + return new EmptyButton(); + } + + @Override + protected JButton createIncreaseButton(int orientation) { + return new EmptyButton(); + } + + @Override + protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { + + Graphics2D graphics = (Graphics2D) g.create(); + DolphinThemeUtils.setAntialiasing(graphics); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + graphics.translate(trackBounds.x, trackBounds.y); + graphics.setColor(theme.getScrollBarTrackColor()); + + graphics.fillRect(0, 0, trackBounds.width, trackBounds.height); + } + + @Override + protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { + + // NOTE: those displacements are meant to ensure that always 3 pixels + // are left between the thumb and the track + + int x = 0; + int y = 0; + + int w = 0; + int h = 0; + + if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { + x = thumbBounds.x + 3; + y = thumbBounds.y; + + w = thumbBounds.width - 4; + h = thumbBounds.height - 1; + + } else { + x = thumbBounds.x; + y = thumbBounds.y + 3; + + w = thumbBounds.width - 1; + h = thumbBounds.height - 5; + } + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + Color thumbColour = null; + if (scrollbar.getModel().getValueIsAdjusting()) { + thumbColour = theme.getThumbMovingColor(); + } else if (checkFocus(new Rectangle(x, y, w, h))) { + thumbColour = theme.getThumbFocusedColor(); + } else { + thumbColour = theme.getThumbColor(); + } + + Graphics2D graphics = (Graphics2D) g.create(); + DolphinThemeUtils.setAntialiasing(graphics); + + graphics.translate(x, y); + graphics.setColor(thumbColour); + + Shape shape = DolphinThemeUtils.getRoundShape(w, h, 8, 8); + graphics.fill(shape); + + graphics.dispose(); + } + + private boolean checkFocus(Rectangle rectangle) { + Point mouseCoords = scrollbar.getMousePosition(true); + if (mouseCoords != null) { + return rectangle.contains(mouseCoords); + } + return false; + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/ButtonsDemo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/ButtonsDemo.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,179 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.UIManager; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import javax.swing.LayoutStyle.ComponentPlacement; + +import com.redhat.swing.laf.dolphin.DolphinLookAndFeel; +import javax.swing.JLabel; +import javax.swing.JToggleButton; +import javax.swing.SwingConstants; +import javax.swing.JRadioButton; +import javax.swing.JCheckBox; + +public class ButtonsDemo extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + UIManager.setLookAndFeel(new DolphinLookAndFeel()); + + ButtonsDemo frame = new ButtonsDemo(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public ButtonsDemo() { + setTitle("Button Demo"); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 355, 436); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + + JPanel panel = new JPanel(); + GroupLayout gl_contentPane = new GroupLayout(contentPane); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(panel, GroupLayout.DEFAULT_SIZE, 379, Short.MAX_VALUE) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(Alignment.LEADING) + .addComponent(panel, GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE) + ); + + JButton btnNewButton = new JButton("Test"); + + JButton button = new JButton("Test"); + button.setEnabled(false); + + JLabel lblNewLabel = new JLabel("Toggle: "); + lblNewLabel.setHorizontalAlignment(SwingConstants.RIGHT); + + JToggleButton tglbtnNewToggleButton = new JToggleButton("New toggle button"); + + JRadioButton rdbtnNewRadioButton = new JRadioButton("Radio"); + + JCheckBox chckbxCheckbox = new JCheckBox("CheckBox"); + + JCheckBox chckbxDisabled = new JCheckBox("Disabled"); + chckbxDisabled.setEnabled(false); + chckbxDisabled.setSelected(true); + + JRadioButton rdbtnDisabled = new JRadioButton("Disabled"); + rdbtnDisabled.setEnabled(false); + GroupLayout gl_panel = new GroupLayout(panel); + gl_panel.setHorizontalGroup( + gl_panel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel.createSequentialGroup() + .addContainerGap() + .addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 83, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) + .addComponent(tglbtnNewToggleButton, 0, 0, Short.MAX_VALUE) + .addComponent(button, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE) + .addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(115, Short.MAX_VALUE)) + .addGroup(gl_panel.createSequentialGroup() + .addGap(135) + .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel.createSequentialGroup() + .addComponent(rdbtnDisabled) + .addContainerGap()) + .addGroup(gl_panel.createSequentialGroup() + .addComponent(rdbtnNewRadioButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(135)))) + .addGroup(gl_panel.createSequentialGroup() + .addGap(121) + .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel.createSequentialGroup() + .addComponent(chckbxDisabled, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + .addGroup(gl_panel.createSequentialGroup() + .addComponent(chckbxCheckbox, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addGap(122)))) + ); + gl_panel.setVerticalGroup( + gl_panel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel.createSequentialGroup() + .addContainerGap() + .addComponent(btnNewButton) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(button) + .addGap(55) + .addGroup(gl_panel.createParallelGroup(Alignment.BASELINE) + .addComponent(tglbtnNewToggleButton) + .addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) + .addGap(18) + .addComponent(rdbtnNewRadioButton) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(rdbtnDisabled) + .addGap(18) + .addComponent(chckbxCheckbox) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(chckbxDisabled) + .addContainerGap(114, Short.MAX_VALUE)) + ); + panel.setLayout(gl_panel); + contentPane.setLayout(gl_contentPane); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/IconsDemo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/IconsDemo.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,129 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.LayoutStyle.ComponentPlacement; + +import com.redhat.swing.laf.dolphin.icons.DolphinAscendingArrowIcon; +import com.redhat.swing.laf.dolphin.icons.DolphinCheckBoxMenuIcon; +import com.redhat.swing.laf.dolphin.icons.DolphinDescendingArrowIcon; +import com.redhat.swing.laf.dolphin.icons.DolphinRadioButtonMenuIcon; + +public class IconsDemo extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + IconsDemo frame = new IconsDemo(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public IconsDemo() { + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 479, 309); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + contentPane.setLayout(new BorderLayout(0, 0)); + setContentPane(contentPane); + + JPanel panel = new JPanel(); + contentPane.add(panel, BorderLayout.CENTER); + + JLabel lblCheckbox = new JLabel("Check"); + lblCheckbox.setIcon(new DolphinCheckBoxMenuIcon()); + + JLabel lblRadio = new JLabel("Radio"); + lblRadio.setIcon(new DolphinRadioButtonMenuIcon()); + + JLabel lblAscending = new JLabel("Ascending"); + lblAscending.setIcon(new DolphinAscendingArrowIcon()); + + JLabel lblDescending = new JLabel("Descending"); + lblDescending.setIcon(new DolphinDescendingArrowIcon()); + + GroupLayout gl_panel = new GroupLayout(panel); + gl_panel.setHorizontalGroup( + gl_panel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel.createSequentialGroup() + .addContainerGap() + .addComponent(lblCheckbox, GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(lblRadio, GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(lblAscending, GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(lblDescending, GroupLayout.PREFERRED_SIZE, 148, GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + gl_panel.setVerticalGroup( + gl_panel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel.createSequentialGroup() + .addContainerGap() + .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel.createParallelGroup(Alignment.BASELINE) + .addComponent(lblAscending, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) + .addComponent(lblDescending, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)) + .addComponent(lblRadio, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE) + .addComponent(lblCheckbox, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(227, Short.MAX_VALUE)) + ); + panel.setLayout(gl_panel); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/MenuDemo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/MenuDemo.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,135 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase; + +import java.awt.EventQueue; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; + +import javax.swing.JFrame; +import javax.swing.JMenuBar; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.KeyStroke; +import javax.swing.UIManager; + +import com.redhat.swing.laf.dolphin.DolphinLookAndFeel; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JSeparator; + +public class MenuDemo { + + private JFrame frame; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + UIManager.setLookAndFeel(new DolphinLookAndFeel()); + + MenuDemo window = new MenuDemo(); + window.frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the application. + */ + public MenuDemo() { + initialize(); + } + + /** + * Initialize the contents of the frame. + */ + private void initialize() { + frame = new JFrame(); + frame.setBounds(100, 100, 450, 300); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JMenuBar menuBar = new JMenuBar(); + frame.setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("New menu"); + menuBar.add(mnNewMenu); + + mnNewMenu.addSeparator(); + + JMenu mnNewMenu_1 = new JMenu("New menu"); + mnNewMenu.add(mnNewMenu_1); + + JMenuItem mntmNewMenuItem_2 = new JMenuItem("New menu item"); + mnNewMenu_1.add(mntmNewMenuItem_2); + + JRadioButtonMenuItem rdbtnmntmNewRadioItem_1 = new JRadioButtonMenuItem("New radio item"); + mnNewMenu_1.add(rdbtnmntmNewRadioItem_1); + + JMenuItem mntmNewMenuItem_3 = new JMenuItem("New menu item"); + mnNewMenu_1.add(mntmNewMenuItem_3); + + JMenuItem mntmNewMenuItem = new JMenuItem("New menu item"); + mntmNewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_DOWN_MASK)); + mnNewMenu.add(mntmNewMenuItem); + + JMenuItem mntmNewMenuItem_1 = new JMenuItem("New menu item"); + mnNewMenu.add(mntmNewMenuItem_1); + + JSeparator separator = new JSeparator(); + mnNewMenu.add(separator); + + JRadioButtonMenuItem rdbtnmntmNewRadioItem = new JRadioButtonMenuItem("New radio item"); + mnNewMenu.add(rdbtnmntmNewRadioItem); + + JCheckBoxMenuItem chckbxmntmNewCheckItem = new JCheckBoxMenuItem("New check item"); + mnNewMenu.add(chckbxmntmNewCheckItem); + + JMenu mnNewMenu_2 = new JMenu("New menu"); + menuBar.add(mnNewMenu_2); + + JMenu mnNewMenu_3 = new JMenu("New menu"); + mnNewMenu_2.add(mnNewMenu_3); + } + +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/SplitPaneDemo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/SplitPaneDemo.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,99 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.UIManager; +import javax.swing.border.EmptyBorder; +import javax.swing.JSplitPane; + +import com.redhat.swing.laf.dolphin.DolphinLookAndFeel; + +public class SplitPaneDemo extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + UIManager.setLookAndFeel(new DolphinLookAndFeel()); + //UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel()); + + SplitPaneDemo frame = new SplitPaneDemo(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public SplitPaneDemo() { + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 450, 300); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + contentPane.setLayout(new BorderLayout(0, 0)); + setContentPane(contentPane); + + JSplitPane splitPane = new JSplitPane(); + contentPane.add(splitPane, BorderLayout.CENTER); + + JSplitPane splitPane_1 = new JSplitPane(); + splitPane_1.setOrientation(JSplitPane.VERTICAL_SPLIT); + splitPane_1.setOneTouchExpandable(true); + splitPane.setRightComponent(splitPane_1); + + JPanel panel = new JPanel(); + splitPane_1.setRightComponent(panel); + + JPanel panel_1 = new JPanel(); + splitPane_1.setLeftComponent(panel_1); + } + +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/SrollBarsDemo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/SrollBarsDemo.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,129 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.UIManager; +import javax.swing.border.EmptyBorder; +import javax.swing.JScrollPane; +import javax.swing.JLabel; + +import com.redhat.swing.laf.dolphin.DolphinLookAndFeel; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JScrollBar; +import javax.swing.LayoutStyle.ComponentPlacement; + +public class SrollBarsDemo extends JFrame { + + private JPanel contentPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + UIManager.setLookAndFeel(new DolphinLookAndFeel()); + + SrollBarsDemo frame = new SrollBarsDemo(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public SrollBarsDemo() { + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 450, 300); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + contentPane.setLayout(new BorderLayout(0, 0)); + setContentPane(contentPane); + + JPanel panel = new JPanel(); + contentPane.add(panel, BorderLayout.CENTER); + + JScrollBar scrollBar = new JScrollBar(); + + JScrollBar scrollBar_1 = new JScrollBar(); + scrollBar_1.setOrientation(JScrollBar.HORIZONTAL); + + JScrollBar scrollBar_2 = new JScrollBar(); + + JScrollBar scrollBar_3 = new JScrollBar(); + scrollBar_3.setOrientation(JScrollBar.HORIZONTAL); + GroupLayout gl_panel = new GroupLayout(panel); + gl_panel.setHorizontalGroup( + gl_panel.createParallelGroup(Alignment.TRAILING) + .addGroup(gl_panel.createSequentialGroup() + .addContainerGap() + .addComponent(scrollBar_2, GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(scrollBar_3, GroupLayout.PREFERRED_SIZE, 234, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED, 198, Short.MAX_VALUE) + .addComponent(scrollBar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(gl_panel.createSequentialGroup() + .addComponent(scrollBar_1, GroupLayout.DEFAULT_SIZE, 553, Short.MAX_VALUE) + .addContainerGap()) + ); + gl_panel.setVerticalGroup( + gl_panel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel.createSequentialGroup() + .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) + .addComponent(scrollBar, GroupLayout.PREFERRED_SIZE, 239, GroupLayout.PREFERRED_SIZE) + .addGroup(gl_panel.createSequentialGroup() + .addGap(22) + .addGroup(gl_panel.createParallelGroup(Alignment.TRAILING, false) + .addComponent(scrollBar_3, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(scrollBar_2, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)))) + .addPreferredGap(ComponentPlacement.RELATED, 7, Short.MAX_VALUE) + .addComponent(scrollBar_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + ); + panel.setLayout(gl_panel); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/TabPaneDemo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/TabPaneDemo.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,181 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase; + +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.UIManager; + +import java.awt.BorderLayout; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JTabbedPane; + +import com.redhat.swing.laf.dolphin.DolphinLookAndFeel; +import javax.swing.JLabel; +import javax.swing.JButton; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JTextField; +import javax.swing.JTextArea; + +public class TabPaneDemo { + + private JFrame frame; + private JTextField textField; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + + UIManager.setLookAndFeel(new DolphinLookAndFeel()); + + TabPaneDemo window = new TabPaneDemo(); + window.frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the application. + */ + public TabPaneDemo() { + initialize(); + } + + /** + * Initialize the contents of the frame. + */ + private void initialize() { + frame = new JFrame(); + frame.setBounds(100, 100, 450, 300); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JPanel panel = new JPanel(); + frame.getContentPane().add(panel, BorderLayout.CENTER); + + JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); + GroupLayout gl_panel = new GroupLayout(panel); + gl_panel.setHorizontalGroup( + gl_panel.createParallelGroup(Alignment.LEADING) + .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE) + ); + gl_panel.setVerticalGroup( + gl_panel.createParallelGroup(Alignment.LEADING) + .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE) + ); + + JPanel panel_1 = new JPanel(); + tabbedPane.addTab("New tab", null, panel_1, null); + + JLabel lblNewLabel = new JLabel("New label"); + + JButton btnNewButton = new JButton("New button"); + GroupLayout gl_panel_1 = new GroupLayout(panel_1); + gl_panel_1.setHorizontalGroup( + gl_panel_1.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_1.createSequentialGroup() + .addContainerGap() + .addComponent(lblNewLabel) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addComponent(btnNewButton) + .addContainerGap(228, Short.MAX_VALUE)) + ); + gl_panel_1.setVerticalGroup( + gl_panel_1.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_1.createSequentialGroup() + .addContainerGap() + .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE) + .addComponent(lblNewLabel) + .addComponent(btnNewButton)) + .addContainerGap(223, Short.MAX_VALUE)) + ); + panel_1.setLayout(gl_panel_1); + + JPanel panel_2 = new JPanel(); + tabbedPane.addTab("New tab", null, panel_2, null); + + textField = new JTextField(); + textField.setColumns(10); + GroupLayout gl_panel_2 = new GroupLayout(panel_2); + gl_panel_2.setHorizontalGroup( + gl_panel_2.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_2.createSequentialGroup() + .addContainerGap() + .addComponent(textField, GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE) + .addContainerGap()) + ); + gl_panel_2.setVerticalGroup( + gl_panel_2.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_2.createSequentialGroup() + .addContainerGap() + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addContainerGap(219, Short.MAX_VALUE)) + ); + panel_2.setLayout(gl_panel_2); + + JPanel panel_3 = new JPanel(); + tabbedPane.addTab("New tab", null, panel_3, null); + + JTextArea textArea = new JTextArea(); + GroupLayout gl_panel_3 = new GroupLayout(panel_3); + gl_panel_3.setHorizontalGroup( + gl_panel_3.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_3.createSequentialGroup() + .addContainerGap() + .addComponent(textArea, GroupLayout.PREFERRED_SIZE, 421, GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + gl_panel_3.setVerticalGroup( + gl_panel_3.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel_3.createSequentialGroup() + .addGap(5) + .addComponent(textArea, GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE) + .addContainerGap()) + ); + panel_3.setLayout(gl_panel_3); + panel.setLayout(gl_panel); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/TextFieldDemo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/TextFieldDemo.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,174 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase; + +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.SpringLayout; +import javax.swing.JPanel; +import javax.swing.UIManager; + +import java.awt.BorderLayout; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.JTextArea; + +import com.redhat.swing.laf.dolphin.DolphinLookAndFeel; +import javax.swing.JPasswordField; +import javax.swing.JFormattedTextField; +import javax.swing.JTextPane; + +public class TextFieldDemo { + + private JFrame frame; + private JTextField textField; + private JPasswordField passwordField; + private JFormattedTextField formattedTextField; + private JTextPane textPane; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + try { + UIManager.setLookAndFeel(new DolphinLookAndFeel()); + + TextFieldDemo window = new TextFieldDemo(); + window.frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the application. + */ + public TextFieldDemo() { + initialize(); + } + + /** + * Initialize the contents of the frame. + */ + private void initialize() { + frame = new JFrame(); + frame.setBounds(100, 100, 450, 300); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JPanel panel = new JPanel(); + frame.getContentPane().add(panel, BorderLayout.CENTER); + + JLabel lblNewLabel = new JLabel("text field:"); + + textField = new JTextField(); + textField.setColumns(10); + + JLabel lblNewLabel_1 = new JLabel("text area:"); + + JTextArea textArea = new JTextArea(); + + JLabel lblPassswordField = new JLabel("passsword field"); + + passwordField = new JPasswordField(); + + JLabel lblFormattedField = new JLabel("formatted field"); + + formattedTextField = new JFormattedTextField(); + + JLabel lblTextpane = new JLabel("textpane"); + + textPane = new JTextPane(); + GroupLayout gl_panel = new GroupLayout(panel); + gl_panel.setHorizontalGroup( + gl_panel.createParallelGroup(Alignment.LEADING) + .addGroup(Alignment.TRAILING, gl_panel.createSequentialGroup() + .addContainerGap() + .addGroup(gl_panel.createParallelGroup(Alignment.TRAILING) + .addComponent(textPane, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 549, Short.MAX_VALUE) + .addComponent(textArea, GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE) + .addGroup(Alignment.LEADING, gl_panel.createSequentialGroup() + .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) + .addComponent(lblPassswordField) + .addComponent(lblNewLabel) + .addComponent(lblFormattedField)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) + .addComponent(formattedTextField, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE) + .addComponent(textField, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE) + .addComponent(passwordField, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE))) + .addComponent(lblNewLabel_1, Alignment.LEADING) + .addComponent(lblTextpane, Alignment.LEADING)) + .addContainerGap()) + ); + gl_panel.setVerticalGroup( + gl_panel.createParallelGroup(Alignment.LEADING) + .addGroup(gl_panel.createSequentialGroup() + .addContainerGap() + .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) + .addComponent(lblNewLabel) + .addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) + .addComponent(lblPassswordField) + .addGroup(gl_panel.createSequentialGroup() + .addComponent(passwordField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_panel.createParallelGroup(Alignment.BASELINE) + .addComponent(formattedTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblFormattedField)))) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(lblNewLabel_1) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(textArea, GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(lblTextpane) + .addPreferredGap(ComponentPlacement.RELATED) + .addComponent(textPane, GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE) + .addContainerGap()) + ); + panel.setLayout(gl_panel); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/table/TableDemo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/table/TableDemo.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,161 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase.table; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.GradientPaint; +import java.awt.geom.Point2D; +import java.awt.geom.Point2D.Float; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.UIManager; +import javax.swing.border.EmptyBorder; +import javax.swing.JTable; + +import com.redhat.swing.laf.dolphin.DolphinLookAndFeel; + +public class TableDemo extends JFrame { + + private JPanel contentPane; + private JTable table; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + + UIManager.setLookAndFeel(new DolphinLookAndFeel()); + + TableDemo frame = new TableDemo(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public TableDemo() { + + String[] columnNames = {"First Name", + "Last Name", + "Sport", + "# of Years", + "Vegetarian"}; + + Object[][] data = { + { "Kathy", "Smith", "Snowboarding", new Integer(5), + new Boolean(false) }, + { "John", "Doe", "Rowing", new Integer(3), new Boolean(true) }, + { "Sue", "Black", "Knitting", new Integer(2), + new Boolean(false) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Kathy", "Smith", "Snowboarding", new Integer(5), + new Boolean(false) }, + { "John", "Doe", "Rowing", new Integer(3), new Boolean(true) }, + { "Sue", "Black", "Knitting", new Integer(2), + new Boolean(false) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Jane", "White", "Speed reading", new Integer(20), + new Boolean(true) }, + { "Joe", "Brown", + "Pool", new Integer(10), new Boolean(false)} + }; + + table = new JTable(data, columnNames); + table.setFillsViewportHeight(true); + table.setAutoCreateRowSorter(true); + + JScrollPane scrollPane = new JScrollPane(table); + + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 450, 300); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + contentPane.setLayout(new BorderLayout(0, 0)); + setContentPane(contentPane); + + contentPane.add(scrollPane, BorderLayout.CENTER); + } + +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/tree/JTreeDemo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/tree/JTreeDemo.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,126 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase.tree; + +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JPanel; +import javax.swing.UIManager; +import javax.swing.border.TitledBorder; +import javax.swing.JScrollPane; + +import com.redhat.swing.laf.dolphin.DolphinLookAndFeel; + +public class JTreeDemo { + + private JFrame frame; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + System.setProperty("dolphin.tree.nofill", "false"); + //UIManager.setLookAndFeel(new javax.swing.plaf.nimbus.NimbusLookAndFeel()); + UIManager.setLookAndFeel(new DolphinLookAndFeel()); + + JTreeDemo window = new JTreeDemo(); + window.frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the application. + */ + public JTreeDemo() { + initialize(); + } + + /** + * Initialize the contents of the frame. + */ + private void initialize() { + frame = new JFrame(); + frame.setBounds(100, 100, 579, 579); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JPanel panel = new JPanel(); + panel.setBorder(new TitledBorder(null, "JTree Rendering Test", TitledBorder.RIGHT, TitledBorder.TOP, null, null)); + GroupLayout groupLayout = new GroupLayout(frame.getContentPane()); + groupLayout.setHorizontalGroup( + groupLayout.createParallelGroup(Alignment.LEADING) + .addGroup(groupLayout.createSequentialGroup() + .addContainerGap() + .addComponent(panel, GroupLayout.DEFAULT_SIZE, 555, Short.MAX_VALUE) + .addContainerGap()) + ); + groupLayout.setVerticalGroup( + groupLayout.createParallelGroup(Alignment.LEADING) + .addGroup(groupLayout.createSequentialGroup() + .addContainerGap() + .addComponent(panel, GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) + .addContainerGap()) + ); + + JScrollPane scrollPane = new JScrollPane(new JTreeView().getTree()); + + GroupLayout gl_panel = new GroupLayout(panel); + gl_panel.setHorizontalGroup( + gl_panel.createParallelGroup(Alignment.LEADING) + .addComponent(scrollPane, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 545, Short.MAX_VALUE) + ); + gl_panel.setVerticalGroup( + gl_panel.createParallelGroup(Alignment.LEADING) + .addGroup(Alignment.TRAILING, gl_panel.createSequentialGroup() + .addContainerGap() + .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 498, Short.MAX_VALUE)) + ); + + + panel.setLayout(gl_panel); + frame.getContentPane().setLayout(groupLayout); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/tree/JTreeView.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/tree/JTreeView.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,100 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase.tree; + +import javax.swing.JTree; + +class JTreeView { + + private JTree tree; + + public JTreeView() { + + ThermostatTreeNode top = new ThermostatTreeNode("Root ThermostatTreeNode"); + fillNodes(top); + + tree = new JTree(top); + tree.setRowHeight(25); + } + + private void fillNodes(ThermostatTreeNode top) { + ThermostatTreeNode category = null; + ThermostatTreeNode book = null; + + category = new ThermostatTreeNode("Books for Java Programmers"); + top.add(category); + + //original Tutorial + book = new ThermostatTreeNode(new VMInfo + ("The Java Tutorial: A Short Course on the Basics", + "tutorial.html")); + category.add(book); + + //Tutorial Continued + book = new ThermostatTreeNode(new VMInfo + ("The Java Tutorial Continued: The Rest of the JDK", + "tutorialcont.html")); + category.add(book); + + //Swing Tutorial + book = new ThermostatTreeNode(new VMInfo + ("The Swing Tutorial: A Guide to Constructing GUIs", + "swingtutorial.html")); + category.add(book); + + //...add more books for programmers... + + category = new ThermostatTreeNode("Books for Java Implementers"); + top.add(category); + + //VM + book = new ThermostatTreeNode(new VMInfo + ("The Java Virtual Machine Specification", + "vm.html")); + category.add(book); + + //Language Spec + book = new ThermostatTreeNode(new VMInfo + ("The Java Language Specification", + "jls.html")); + category.add(book); + } + + public JTree getTree() { + return tree; + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/tree/ThermostatTreeNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/tree/ThermostatTreeNode.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,50 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase.tree; + +import javax.swing.tree.DefaultMutableTreeNode; + +class ThermostatTreeNode extends DefaultMutableTreeNode { + + public ThermostatTreeNode(String rootNode) { + super(rootNode); + } + + public ThermostatTreeNode(VMInfo rootNode) { + super(rootNode); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/showcase/tree/VMInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/showcase/tree/VMInfo.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.showcase.tree; + +import java.net.URL; + +class VMInfo { + public String bookName; + public URL bookURL; + + public VMInfo(String book, String filename) { + bookName = book; + bookURL = getClass().getResource(filename); + if (bookURL == null) { + System.err.println("Couldn't find file: " + + filename); + } + } + + public String toString() { + return bookName; + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/split/DolphinSeparatorUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/split/DolphinSeparatorUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,97 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.split; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.LinearGradientPaint; +import java.awt.geom.Point2D; + +import javax.swing.JComponent; +import javax.swing.JSeparator; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.metal.MetalSeparatorUI; + +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinSeparatorUI extends MetalSeparatorUI { + + public static ComponentUI createUI(JComponent c) { + return new DolphinSeparatorUI(); + } + + @Override + public void paint(Graphics g, JComponent c) { + + Graphics2D graphics = (Graphics2D) g.create(); + DolphinThemeUtils.setAntialiasing(graphics); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + JSeparator separator = ((JSeparator) c); + if (separator.getOrientation() == JSeparator.HORIZONTAL) { + + paintSeparator(graphics, c.getX(), 0, c.getWidth(), 0, + c.getBackground(), theme.getSeparatorColor()); + + } else { + + paintSeparator(graphics, 0, c.getY(), 0, c.getHeight(), + c.getBackground(), theme.getSeparatorColor()); + } + + graphics.dispose(); + } + + static void paintSeparator(Graphics2D graphics, int x, int y, int w, int h, Color side, Color center) { + + graphics.translate(x, y); + LinearGradientPaint paint = + new LinearGradientPaint(new Point2D.Float(0, 0), + new Point2D.Float(w, h), + new float[] { 0.0f, 0.499f, 0.5f, 1.0f }, + new Color[] { side, + center, + center, + side }); + + graphics.setPaint(paint); + graphics.drawLine(0, 0, w, h); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/split/DolphinSplitPaneDivider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/split/DolphinSplitPaneDivider.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,116 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.split; + +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Shape; +import java.awt.geom.RoundRectangle2D; + +import javax.swing.JButton; +import javax.swing.JSplitPane; +import javax.swing.plaf.basic.BasicSplitPaneDivider; + +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +@SuppressWarnings("serial") +public class DolphinSplitPaneDivider extends BasicSplitPaneDivider { + + private static final int MARKER_SIZE = 28; + + private DolphinSplitPaneUI ui; + + public DolphinSplitPaneDivider(DolphinSplitPaneUI ui) { + super(ui); + this.ui = ui; + } + + private void drawMarkers(Graphics2D graphics, Shape shape, int deltaX, + int deltaY) + { + for (int i = 0; i < 5; i++) { + graphics.translate(deltaX, deltaY); + graphics.draw(shape); + } + } + + @Override + public void paint(Graphics g) { + + Graphics2D graphics = (Graphics2D) g.create(); + DolphinThemeUtils.setAntialiasing(graphics); + + graphics.setColor(getBackground()); + graphics.fillRect(0, 0, getWidth(), getHeight()); + + Shape shape = new RoundRectangle2D.Double(0., 0., 1., 1., 4, 4); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + graphics.setColor(theme.getSplitPaneDividerBorderColor()); + + int x = 0; + int y = 0; + + if (ui.getSplitPane().getOrientation() == JSplitPane.VERTICAL_SPLIT) { + x = getWidth()/2 - MARKER_SIZE/2; + y = getHeight()/2; + graphics.translate(x, y); + drawMarkers(graphics, shape, 5, 0); + + } else { + x = getWidth()/2; + y = getHeight()/2 - MARKER_SIZE/2; + graphics.translate(x, y); + drawMarkers(graphics, shape, 0, 5); + } + + graphics.dispose(); + + super.paint(g); + } + + @Override + protected JButton createLeftOneTouchButton() { + return super.createLeftOneTouchButton(); + } + + @Override + protected JButton createRightOneTouchButton() { + return super.createRightOneTouchButton(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/split/DolphinSplitPaneDividerBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/split/DolphinSplitPaneDividerBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,88 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.split; + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; + +import javax.swing.JScrollBar; +import javax.swing.plaf.basic.BasicSplitPaneDivider; +import javax.swing.plaf.basic.BasicSplitPaneUI; + +import com.redhat.swing.laf.dolphin.borders.DolphinDebugBorder; +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +@SuppressWarnings("serial") +public class DolphinSplitPaneDividerBorder extends DolphinDebugBorder { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) { + + if (!(c instanceof BasicSplitPaneDivider)) { + return; + } + + Graphics2D graphics = (Graphics2D) g.create(); + DolphinThemeUtils.setAntialiasing(graphics); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + BasicSplitPaneUI splitPane = + ((BasicSplitPaneDivider)c).getBasicSplitPaneUI(); + if (splitPane.getOrientation() == JScrollBar.HORIZONTAL) { + + DolphinSeparatorUI.paintSeparator(graphics, x, height - 1, width, 0, + c.getBackground(), theme.getSplitPaneDividerBorderColor()); + + } else { + + DolphinSeparatorUI.paintSeparator(graphics, width - 1, y, 0, height, + c.getBackground(), theme.getSplitPaneDividerBorderColor()); + } + + graphics.dispose(); + } + + public Insets getBorderInsets(Component c) { + Insets insets = new Insets(1, 1, 1, 1); + return insets; + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/split/DolphinSplitPaneUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/split/DolphinSplitPaneUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.split; + +import javax.swing.JComponent; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicSplitPaneDivider; +import javax.swing.plaf.metal.MetalSplitPaneUI; + +public class DolphinSplitPaneUI extends MetalSplitPaneUI { + + public static ComponentUI createUI(JComponent x) { + return new DolphinSplitPaneUI(); + } + + @Override + public BasicSplitPaneDivider createDefaultDivider() { + return new DolphinSplitPaneDivider(this); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/tab/DolphinTabbedPaneUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/tab/DolphinTabbedPaneUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,299 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.tab; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.LinearGradientPaint; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.geom.GeneralPath; +import java.awt.geom.Point2D; + +import javax.swing.JComponent; +import javax.swing.JTabbedPane; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.metal.MetalTabbedPaneUI; + +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinTabbedPaneUI extends MetalTabbedPaneUI { + + private static final boolean keepBG; + static { + keepBG = DolphinThemeUtils.getCurrentTheme().getTabPaneKeepBackgroundColor(); + } + + private static final int MAGIC_NUMBER = 3; + + public static ComponentUI createUI(JComponent tabPane) { + return new DolphinTabbedPaneUI(); + } + + private Shape createTabShape(int x, int y, int w, int h) { + int x2Points[] = { x, x + MAGIC_NUMBER, x + w - MAGIC_NUMBER, x + w }; + int y2Points[] = { y + h, y , y, y + h }; + GeneralPath tab = + new GeneralPath(GeneralPath.WIND_EVEN_ODD, x2Points.length); + + tab.moveTo(x2Points[0], y2Points[0]); + + for (int index = 1; index < x2Points.length; index++) { + tab.lineTo(x2Points[index], y2Points[index]); + }; + tab.closePath(); + + return tab; + } + + private boolean bgSet; + @Override + public void paint(Graphics g, JComponent c) { + if (!keepBG && !bgSet) { + if (c instanceof JTabbedPane) { + // well, who else... + JTabbedPane tabPane = (JTabbedPane) c; + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + for (int i = 0; i < tabPane.getComponentCount(); i++) { + tabPane.getComponent(i).setBackground(theme.getTabAreaBackground()); + } + bgSet = true; + } + } + super.paint(g, c); + } + + @Override + protected void paintTopTabBorder(int tabIndex, Graphics g, int x, int y, + int w, int h, int btm, int rght, boolean isSelected) + { + Graphics2D graphics = (Graphics2D) g.create(); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + Color topColor = theme.getBorderGradientTopColor(); + Color bottomColor = theme.getBorderGradientBottomColor(); + DolphinThemeUtils.setAntialiasing(graphics); + + if (isSelected) { + graphics.setStroke(new BasicStroke(1.5f)); + topColor = theme.getSelectionColor(); + DolphinThemeUtils.setGradientPaint(graphics, 0, y + h, topColor, bottomColor); + graphics.draw(createTabShape(x - 2, y - 1, w + 4, h + 2)); + } else { + DolphinThemeUtils.setGradientPaint(graphics, 0, y + h/2, topColor, bottomColor); + graphics.draw(createTabShape(x, y, w, h)); + } + + graphics.dispose(); + } + + private void paintContentVerticalEdge(Graphics g, int x, int y, + int w, int h) + { + Graphics2D graphics = (Graphics2D) g.create(); + graphics.translate(x, y); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + LinearGradientPaint paint = + new LinearGradientPaint(new Point2D.Float(0, 0), + new Point2D.Float(0, h), + new float[] { 0.0f, 0.2f, 1.0f }, + new Color[] { theme.getTabTopHedgeColor(), + theme.getTabTopHedgeColor(), + theme.getTabBottomHedgeColor()}); + graphics.setPaint(paint); + graphics.drawLine(0, 0, 0, h); + + graphics.dispose(); + } + + @Override + protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, + int selectedIndex, int x, int y, + int w, int h) + { + if (tabPlacement == LEFT) { + super.paintContentBorderLeftEdge(g, tabPlacement, selectedIndex, + x, y, w, h); + } + + paintContentVerticalEdge(g, x, y, w, h); + } + + @Override + protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, + int selectedIndex, int x, int y, + int w, int h) + { + if (tabPlacement == RIGHT) { + super.paintContentBorderRightEdge(g, tabPlacement, selectedIndex, + x, y, w, h); + } + + paintContentVerticalEdge(g, x + w - 1, y, w, h); + } + + @Override + protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, + int selectedIndex, int x, int y, + int w, int h) + { + if (tabPlacement == BOTTOM) { + super.paintContentBorderBottomEdge(g, tabPlacement, selectedIndex, + x, y, w, h); + } else { + Graphics2D graphics = (Graphics2D) g.create(); + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + graphics.setColor(theme.getTabBottomHedgeColor()); + graphics.drawLine(x, y + h - 1, x + w - 1, y + h - 1); + } + } + + protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, + int selectedIndex, int x, int y, + int w, int h) + { + // This is a copy of the paintContentBorderTopEdge from + // MetalTabbedPaneUI with the x starting and end points of the line + // fine tuned to the shape of our tab + Graphics2D graphics = (Graphics2D) g.create(); + + Rectangle selRect = selectedIndex < 0 ? null : getTabBounds( + selectedIndex, calcRect); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + graphics.setColor(theme.getTabTopHedgeColor()); + + graphics.setStroke(new BasicStroke(1.0f)); + DolphinThemeUtils.setAntialiasing(graphics); + + // Draw unbroken line if tabs are not on TOP, OR + // selected tab is not in run adjacent to content, OR + // selected tab is not visible (SCROLL_TAB_LAYOUT) + // + if (tabPlacement != TOP || selectedIndex < 0 + || (selRect.y + selRect.height + 1 < y) + || (selRect.x < x || selRect.x > x + w)) { + graphics.drawLine(x, y, x + w - 2, y); + } else { + // Break line to show visual connection to selected tab + graphics.drawLine(x, y, selRect.x - 2, y); + if (selRect.x + selRect.width < x + w - 2) { + graphics.drawLine(selRect.x + selRect.width + 2, y, x + w - 2, y); + } else { + graphics.setColor(shadow); + graphics.drawLine(x + w - 2, y, x + w - 2, y); + } + } + + graphics.dispose(); + } + + @Override + protected void paintContentBorder(Graphics g, int tabPlacement, + int selectedIndex) { + super.paintContentBorder(g, tabPlacement, selectedIndex); + } + + @Override + protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, + int tabIndex, Rectangle iconRect, Rectangle textRect) { + super.paintTab(g, tabPlacement, rects, tabIndex, iconRect, textRect); + } + + @Override + protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, + int x, int y, int w, int h, boolean isSelected) + { + switch (tabPlacement) { + case TOP: { + Graphics2D graphics = (Graphics2D) g.create(); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + + Color topColor = null; + Color bottomColor = null; + if (isSelected) { + topColor = theme.getTabTopGradient(); + bottomColor = theme.getTabBottomGradient(); + } else { + topColor = theme.getUnselectedTabTopGradient(); + bottomColor = theme.getUnselectedTabTopGradient(); + } + + DolphinThemeUtils.setAntialiasing(graphics); + DolphinThemeUtils.setGradientPaint(graphics, 0, y + h/2, topColor, bottomColor); + + if (isSelected) { + graphics.fill(createTabShape(x - 2, y - 1, w + 4, h + 2)); + } else { + graphics.fill(createTabShape(x, y, w, h)); + } + + graphics.dispose(); + } break; + + default: + super.paintTabBackground(g, tabPlacement, tabIndex, x, y, w, h, isSelected); + break; + } + } + + @Override + protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, + int tabIndex, Rectangle iconRect, Rectangle textRect, + boolean isSelected) + { + switch (tabPlacement) { + case TOP: { + // TODO + + } break; + + default: + super.paintFocusIndicator(g, tabPlacement, rects, tabIndex, iconRect, textRect, isSelected); + break; + } + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/table/DefaultDolphinTableCellHeaderRenderer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/table/DefaultDolphinTableCellHeaderRenderer.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.table; + +import sun.swing.table.DefaultTableCellHeaderRenderer; + +@SuppressWarnings({ "serial", "restriction" }) +public class DefaultDolphinTableCellHeaderRenderer extends DefaultTableCellHeaderRenderer { + + @Override + public void setHorizontalTextPosition(int textPosition) { + super.setHorizontalTextPosition(textPosition); + } + + @Override + public void setHorizontalAlignment(int alignment) { + super.setHorizontalAlignment(alignment); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/table/DolphinDefaultTableHeaderFocusBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/table/DolphinDefaultTableHeaderFocusBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,64 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.table; + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; + +import com.redhat.swing.laf.dolphin.borders.DolphinDebugBorder; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +@SuppressWarnings("serial") +public class DolphinDefaultTableHeaderFocusBorder extends DolphinDebugBorder { + + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { + + Graphics2D graphics = DolphinThemeUtils.createAAGraphics(g); + + DolphinThemeUtils.setGradientPaint(graphics, 0, height, c.getForeground(), c.getBackground()); + + graphics.drawLine(0, 0, width - 1, 0); + + graphics.drawLine(0, 0, 0, height - 1); + graphics.drawLine(width - 1, 0, width - 1, height - 1); + + graphics.dispose(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/table/DolphinTableHeaderUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/table/DolphinTableHeaderUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,69 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.table; + +import java.awt.Graphics; + +import javax.swing.JComponent; +import javax.swing.JLabel; + +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicTableHeaderUI; + +public class DolphinTableHeaderUI extends BasicTableHeaderUI { + + public static ComponentUI createUI(JComponent c) { + return new DolphinTableHeaderUI(); + } + + @Override + protected void installDefaults() { + DefaultDolphinTableCellHeaderRenderer cellRenderer = + new DefaultDolphinTableCellHeaderRenderer(); + + cellRenderer.setHorizontalTextPosition(JLabel.LEADING); + cellRenderer.setHorizontalAlignment(JLabel.LEADING); + + header.setDefaultRenderer(cellRenderer); + super.installDefaults(); + } + + @Override + public void paint(Graphics g, JComponent c) { + super.paint(g, c); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/table/DolphinTableUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/table/DolphinTableUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.table; + +import javax.swing.JComponent; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicTableUI; + +public class DolphinTableUI extends BasicTableUI { + + public static ComponentUI createUI(JComponent c) { + return new DolphinTableUI(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/text/DolphinPasswordFieldUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/text/DolphinPasswordFieldUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.text; + +import java.awt.Graphics; +import java.awt.Graphics2D; + +import javax.swing.JComponent; +import javax.swing.Painter; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicPasswordFieldUI; +import javax.swing.text.JTextComponent; + +public class DolphinPasswordFieldUI extends BasicPasswordFieldUI { + + private final Painter backgroundPainter = new TextFieldBackgroundPainter(); + + public static ComponentUI createUI(JComponent b) { + return new DolphinPasswordFieldUI(); + } + + @Override + protected void paintBackground(Graphics g) { + JTextComponent c = getComponent(); + backgroundPainter.paint((Graphics2D) g, c, c.getWidth(), c.getHeight()); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/text/DolphinTextAreaBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/text/DolphinTextAreaBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,76 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.text; + +import java.awt.Component; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.RenderingHints; +import java.awt.Shape; +import java.awt.geom.Rectangle2D; + +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +public class DolphinTextAreaBorder extends DolphinTextBorder { + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) { + + Graphics2D graphics = (Graphics2D) g.create(); + DolphinThemeUtils.setAntialiasing(graphics); + + graphics.translate(x, y); + + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + Paint paint = + new GradientPaint(0, 0, theme.getBorderGradientTopColor(), + 0, c.getHeight(), + theme.getBorderGradientTopColor()); + graphics.setPaint(paint); + + graphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, + RenderingHints.VALUE_STROKE_DEFAULT); + + Shape shape = new Rectangle2D.Float(0, 0, width - 1, height - 1); + graphics.draw(shape); + graphics.dispose(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/text/DolphinTextAreaUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/text/DolphinTextAreaUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,49 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.text; + +import javax.swing.JComponent; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicTextAreaUI; + +public class DolphinTextAreaUI extends BasicTextAreaUI { + + public static ComponentUI createUI(JComponent b) { + return new DolphinTextAreaUI(); + } + +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/text/DolphinTextBorder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/text/DolphinTextBorder.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.text; + +import com.redhat.swing.laf.dolphin.borders.DolphinCommonBorder; + +public class DolphinTextBorder extends DolphinCommonBorder { + +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/text/DolphinTextFieldUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/text/DolphinTextFieldUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,61 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.text; + +import java.awt.Graphics; +import java.awt.Graphics2D; + +import javax.swing.JComponent; +import javax.swing.Painter; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.metal.MetalTextFieldUI; +import javax.swing.text.JTextComponent; + +public class DolphinTextFieldUI extends MetalTextFieldUI { + + private final Painter backgroundPainter = new TextFieldBackgroundPainter(); + + public static ComponentUI createUI(JComponent b) { + return new DolphinTextFieldUI(); + } + + @Override + protected void paintBackground(Graphics g) { + JTextComponent c = getComponent(); + backgroundPainter.paint((Graphics2D) g, c, c.getWidth(), c.getHeight()); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/text/TextFieldBackgroundPainter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/text/TextFieldBackgroundPainter.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.text; + +import java.awt.GradientPaint; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.Shape; +import java.awt.geom.RoundRectangle2D; + +import javax.swing.JComponent; +import javax.swing.Painter; + +import com.redhat.swing.laf.dolphin.themes.DolphinTheme; +import com.redhat.swing.laf.dolphin.themes.DolphinThemeUtils; + +class TextFieldBackgroundPainter implements Painter { + + @Override + public void paint(Graphics2D g, JComponent c, int width, int height) { + DolphinTheme theme = DolphinThemeUtils.getCurrentTheme(); + g = (Graphics2D) g.create(); + Paint paint = + new GradientPaint(0, 0, theme.getTextFieldBackgroundTopGradient(), + 0, 10, theme.getTextFieldBackgroundBottomGradient()); + g.setPaint(paint); + Shape shape = new RoundRectangle2D.Double(0, 0, width - 1, height - 1, 4, 4); + g.fill(shape); + g.dispose(); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinDefaultTheme.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinDefaultTheme.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,487 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.themes; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +import java.awt.Graphics; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.UIDefaults; +import javax.swing.border.AbstractBorder; +import javax.swing.border.Border; +import javax.swing.plaf.ColorUIResource; +import javax.swing.plaf.FontUIResource; +import javax.swing.plaf.IconUIResource; +import javax.swing.plaf.InsetsUIResource; + +import com.redhat.swing.laf.dolphin.button.DolphinButtonBorder; +import com.redhat.swing.laf.dolphin.icons.DolphinCheckBoxMenuIcon; +import com.redhat.swing.laf.dolphin.icons.DolphinRadioButtonMenuIcon; +import com.redhat.swing.laf.dolphin.menu.DolphinMenuBarBorder; +import com.redhat.swing.laf.dolphin.menu.DolphinMenuBorder; +import com.redhat.swing.laf.dolphin.menu.DolphinMenuItemBorder; +import com.redhat.swing.laf.dolphin.menu.DolphinPopupMenuBorder; +import com.redhat.swing.laf.dolphin.table.DolphinDefaultTableHeaderFocusBorder; +import com.redhat.swing.laf.dolphin.text.DolphinTextAreaBorder; +import com.redhat.swing.laf.dolphin.text.DolphinTextBorder; + +public class DolphinDefaultTheme extends DolphinTheme { + + private static final ColorUIResource WHITE = new ColorUIResource(Color.WHITE); + + private static final ColorUIResource WINDOW_BACKGROUND = new ColorUIResource(0xEDEDED); + + private static final ColorUIResource BUTTON_GRADIENT_TOP = new ColorUIResource(0xf1f3f1); + private static final ColorUIResource BUTTON_GRADIENT_TOP_ROLLOVER = new ColorUIResource(0xfcfdfc); + private static final ColorUIResource BUTTON_GRADIENT_BOTTOM = new ColorUIResource(0xdbdddb); + private static final ColorUIResource BUTTON_GRADIENT_BOTTOM_ROLLOVER = new ColorUIResource(0xe6eae6); + private static final ColorUIResource BUTTON_GRADIENT_PRESSED_TOP = new ColorUIResource(0xa6aca6); + private static final ColorUIResource BUTTON_GRADIENT_PRESSED_BOTTOM = new ColorUIResource(0xed9dad9); + private static final ColorUIResource BUTTON_GRADIENT_DISABLED_TOP = new ColorUIResource(0xf4f4f2); + private static final ColorUIResource BUTTON_GRADIENT_DISABLED_BOTTOM = new ColorUIResource(0xf4f4f2); + private static final ColorUIResource BUTTON_GRADIENT_FOCUS_TOP = new ColorUIResource(0xbcd5ef); + private static final ColorUIResource BUTTON_GRADIENT_FOCUS_BOTTOM = new ColorUIResource(0x93b0d3); + + private static final ColorUIResource BORDER_GRADIENT_DEFAULT_TOP = new ColorUIResource(0xa7aba7); + private static final ColorUIResource BORDER_GRADIENT_DEFAULT_BOTTOM = new ColorUIResource(0xa8aca8); + private static final ColorUIResource BORDER_GRADIENT_DISABLED_TOP = new ColorUIResource(0xbabcb8); + private static final ColorUIResource BORDER_GRADIENT_DISABLED_BOTTOM = new ColorUIResource(0xbabcb8); + + private static final ColorUIResource TEXT_DEFAULT_COLOR = new ColorUIResource(0x2e3436); + + private static final ColorUIResource TEXT_FIELD_BACKGROUND_TOP_GRADIENT = new ColorUIResource(0xF2F2F2); + private static final ColorUIResource TEXT_FIELD_BACKGROUND_BOTTOM_GRADIENT = new ColorUIResource(Color.WHITE); + + private static final ColorUIResource TITLED_BORDER_BORDER_COLOR = new ColorUIResource(0xa8aca8); + + private static final ColorUIResource SELECTION_COLOR = new ColorUIResource(0x4A90D9); + private static final ColorUIResource SELECTION_FOREGROUND = WHITE; + + private static final ColorUIResource TREE_HEADER_COLOR = new ColorUIResource(0x1A58AD); + + private static final ColorUIResource TAB_TOP_GRADIENT_COLOR = new ColorUIResource(0xF9F9F9); + + private static final ColorUIResource TAB_UNSELECTED_TOP_GRADIENT_COLOR = new ColorUIResource(0xe6e6e6); + private static final ColorUIResource TAB_UNSELECTED_BOTTOM_GRADIENT_COLOR = new ColorUIResource(0xcbcbcb); + + private static final ColorUIResource THUMB_COLOR = new ColorUIResource(0x9B9D9E); + private static final ColorUIResource TRACK_COLOR = new ColorUIResource(0xD6D6D6); + private static final ColorUIResource THUMB_FOCUSED_COLOR = new ColorUIResource(0x828586); + private static final ColorUIResource THUMB_MOVING_COLOR = SELECTION_COLOR; + + private static final ColorUIResource SEPARATOR = new ColorUIResource(0xebebeb); + + private static final ColorUIResource TABLE_SEPARATOR = new ColorUIResource(0xf2f2f2); + + private static final ColorUIResource TABLE_HEADER_FOREGROUND = new ColorUIResource(0x888a85); + + private static final ColorUIResource ICONS_COLOR = TABLE_HEADER_FOREGROUND; + + @Override + public ColorUIResource getWindowBackgroundColor() { + return WINDOW_BACKGROUND; + } + + @Override + public boolean borderPaintsFocus() { + return false; + } + + @Override + public ColorUIResource getSystemTextColor() { + return TEXT_DEFAULT_COLOR; + } + + @Override + public ColorUIResource getControlTextColor() { + return getSystemTextColor(); + } + + @Override + public ColorUIResource getButtonGradientTopColor() { + return BUTTON_GRADIENT_TOP; + } + + @Override + public ColorUIResource getButtonGradientTopRolloverColor() { + return BUTTON_GRADIENT_TOP_ROLLOVER; + } + + @Override + public ColorUIResource getButtonGradientBottomColor() { + return BUTTON_GRADIENT_BOTTOM; + } + + @Override + public ColorUIResource getButtonGradientBottomRolloverColor() { + return BUTTON_GRADIENT_BOTTOM_ROLLOVER; + } + + @Override + public ColorUIResource getButtonGradientPressedTopColor() { + return BUTTON_GRADIENT_PRESSED_TOP; + } + + @Override + public ColorUIResource getButtonGradientPressedBottomColor() { + return BUTTON_GRADIENT_PRESSED_BOTTOM; + } + + @Override + public ColorUIResource getButtonGradientDisabledTopColor() { + return BUTTON_GRADIENT_DISABLED_TOP; + } + + @Override + public ColorUIResource getButtonGradientDisabledBottomColor() { + return BUTTON_GRADIENT_DISABLED_BOTTOM; + } + + @Override + public ColorUIResource getBorderGradientTopColor() { + return BORDER_GRADIENT_DEFAULT_TOP; + } + + @Override + public ColorUIResource getBorderGradientBottomColor() { + return BORDER_GRADIENT_DEFAULT_BOTTOM; + } + + @Override + public ColorUIResource getBorderGradientTopDisabledColor() { + return BORDER_GRADIENT_DISABLED_TOP; + } + + @Override + public ColorUIResource getBorderGradientBottomDisabledColor() { + return BORDER_GRADIENT_DISABLED_BOTTOM; + } + + @Override + public ColorUIResource getButtonFocusGradientTopColor() { + return BUTTON_GRADIENT_FOCUS_TOP; + } + + @Override + public ColorUIResource getButtonFocusGradientBottomColor() { + return BUTTON_GRADIENT_FOCUS_BOTTOM; + } + + @Override + public ColorUIResource getTitledBorderBorderColor() { + return TITLED_BORDER_BORDER_COLOR; + } + + @Override + public boolean getTreeRendererFillBackground() { + return true; + } + + @Override + public boolean getTreeLineTypeDashed() { + return false; + } + + @Override + public ColorUIResource getSelectionColor() { + return SELECTION_COLOR; + } + + @Override + public ColorUIResource getSelectionColorForeground() { + return SELECTION_FOREGROUND; + } + + @Override + public ColorUIResource getTreeHeaderColor() { + return TREE_HEADER_COLOR; + } + + @Override + public AbstractBorder getButtonBorder() { + return new DolphinButtonBorder(); + } + + @Override + public AbstractBorder getTextFieldBorder() { + return new DolphinTextBorder(); + } + + @Override + public ColorUIResource getMenuBarBackgroundColor() { + return WINDOW_BACKGROUND; + } + + @Override + public ColorUIResource getMenuBackgroundColor() { + return WHITE; + } + + @Override + public ColorUIResource getMenuForegroundColor() { + return SELECTION_COLOR; + } + + @Override + public AbstractBorder getTextAreaBorder() { + return new DolphinTextAreaBorder(); + } + + @Override + public AbstractBorder getScrollPaneBorder() { + return new DolphinTextAreaBorder(); + } + + @Override + public ColorUIResource getTabAreaBackground() { + return WHITE; + } + + @Override + public ColorUIResource getTabAreaForeground() { + return TEXT_DEFAULT_COLOR; + } + + @Override + public ColorUIResource getTabBottomGradient() { + return WHITE; + } + + @Override + public ColorUIResource getTabTopGradient() { + return TAB_TOP_GRADIENT_COLOR; + } + + @Override + public ColorUIResource getUnselectedTabBottomGradient() { + return TAB_UNSELECTED_BOTTOM_GRADIENT_COLOR; + } + + @Override + public ColorUIResource getUnselectedTabTopGradient() { + return TAB_UNSELECTED_TOP_GRADIENT_COLOR; + } + + @Override + public ColorUIResource getTextFieldBackgroundTopGradient() { + return TEXT_FIELD_BACKGROUND_TOP_GRADIENT; + } + + @Override + public ColorUIResource getTextFieldBackgroundBottomGradient() { + return TEXT_FIELD_BACKGROUND_BOTTOM_GRADIENT; + } + + @Override + public ColorUIResource getThumbColor() { + return THUMB_COLOR; + } + + @Override + public ColorUIResource getScrollBarTrackColor() { + return TRACK_COLOR; + } + + @Override + public ColorUIResource getThumbFocusedColor() { + return THUMB_FOCUSED_COLOR; + } + + @Override + public ColorUIResource getThumbMovingColor() { + return THUMB_MOVING_COLOR; + } + + @Override + public ColorUIResource getSplitPaneDividerBorderColor() { + return BORDER_GRADIENT_DEFAULT_TOP; + } + + @Override + public ColorUIResource getTabTopHedgeColor() { + return BORDER_GRADIENT_DEFAULT_TOP; + } + + @Override + public ColorUIResource getTabBottomHedgeColor() { + return BORDER_GRADIENT_DEFAULT_BOTTOM; + } + + @Override + public ColorUIResource getMenuBorderDefaultColor() { + return BORDER_GRADIENT_DEFAULT_BOTTOM; + } + + @Override + public ColorUIResource getMenuSelectedBackground() { + return SELECTION_COLOR; + } + + @Override + public ColorUIResource getMenuSelectedForeground() { + return SELECTION_FOREGROUND; + } + + @Override + public Color getSeparatorColor() { + return SEPARATOR; + } + + private FontUIResource defaultfont; + private void initFont() { + if (defaultfont == null) { + Font font = new Font("Cantarell", Font.PLAIN, 13); + defaultfont = new FontUIResource(font); + } + } + + @Override + public FontUIResource getSystemTextFont() { + initFont(); + return defaultfont; + } + + @Override + public FontUIResource getControlTextFont() { + initFont(); + return defaultfont; + } + + @Override + public FontUIResource getMenuTextFont() { + initFont(); + return defaultfont; + } + + @Override + public ColorUIResource getTableHeaderBackgroundColor() { + return WHITE; + } + + @Override + public ColorUIResource getTableHeaderForegroundColor() { + return TABLE_HEADER_FOREGROUND; + } + + @Override + public Font getTableHeaderFont() { + initFont(); + return defaultfont.deriveFont(Font.BOLD); + } + + @Override + public Border getTableCellBorder() { + return new DolphinDefaultTableHeaderFocusBorder(); + } + + @Override + public Border getTableFocusCellBorder() { + return getTableCellBorder(); + } + + @Override + public ColorUIResource getIconsBaseColor() { + return ICONS_COLOR; + } + + @Override + public int getOneTouchButtonSize() { + return 4; + } + + @Override + public int getOneTouchButtonOffset() { + return 2; + } + + @Override + public ColorUIResource getTableSelectionCellBackground() { + return SELECTION_COLOR; + } + + @Override + public ColorUIResource getTableSelectionCellForeground() { + return SELECTION_FOREGROUND; + } + + @Override + public void addCustomEntriesToTable(UIDefaults table) { + super.addCustomEntriesToTable(table); + + Border menuItemBorder = new DolphinMenuItemBorder(); + + Object[] uiDefaults = { + + "MenuBarUI", "com.redhat.swing.laf.dolphin.menu.DolphinMenuBarUI", + "MenuBar.background", getMenuBarBackgroundColor(), + "MenuBar.border", new DolphinMenuBarBorder(), + + "MenuUI", "com.redhat.swing.laf.dolphin.menu.DolphinMenuUI", + + "Menu.border", menuItemBorder, + "MenuItem.border", menuItemBorder, + "MenuItem.selectionForeground", getMenuSelectedForeground(), + "MenuItem.selectionBackground", getMenuSelectedBackground(), + "MenuItem.background", getMenuBackgroundColor(), + + "RadioButtonMenuItem.background", getMenuBackgroundColor(), + "RadioButtonMenuItem.border", menuItemBorder, + "RadioButtonMenuItem.checkIcon", new IconUIResource(new DolphinRadioButtonMenuIcon()), + + "CheckBoxMenuItem.border", menuItemBorder, + "CheckBoxMenuItem.background", getMenuBackgroundColor(), + "CheckBoxMenuItem.checkIcon", new IconUIResource(new DolphinCheckBoxMenuIcon()), + + "PopupMenu.background", getMenuBackgroundColor(), + "PopupMenu.foreground", getMenuForegroundColor(), + "PopupMenu.border", new DolphinPopupMenuBorder(), + + "TabbedPane.contentAreaColor", getTabAreaBackground(), + "TabbedPane.tabAreaBackground", getTabAreaBackground(), + "TabbedPane.background", getTabAreaBackground(), + "TabbedPane.foreground", getTabAreaForeground(), + + "Table.gridColor", TABLE_SEPARATOR, + }; + + table.putDefaults(uiDefaults); + } + +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinTheme.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinTheme.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,145 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.themes; + +import java.awt.Color; +import java.awt.Font; + +import javax.swing.border.AbstractBorder; +import javax.swing.border.Border; +import javax.swing.plaf.ColorUIResource; +import javax.swing.plaf.metal.OceanTheme; + +public abstract class DolphinTheme extends OceanTheme { + + abstract public boolean borderPaintsFocus(); + + abstract public ColorUIResource getButtonGradientTopColor(); + abstract public ColorUIResource getButtonGradientBottomColor(); + abstract public ColorUIResource getButtonGradientTopRolloverColor(); + abstract public ColorUIResource getButtonGradientBottomRolloverColor(); + abstract public ColorUIResource getButtonGradientPressedTopColor(); + abstract public ColorUIResource getButtonGradientPressedBottomColor(); + abstract public ColorUIResource getButtonGradientDisabledTopColor(); + abstract public ColorUIResource getButtonGradientDisabledBottomColor(); + abstract public ColorUIResource getButtonFocusGradientTopColor(); + abstract public ColorUIResource getButtonFocusGradientBottomColor(); + + abstract public ColorUIResource getBorderGradientTopColor(); + abstract public ColorUIResource getBorderGradientBottomColor(); + abstract public ColorUIResource getBorderGradientTopDisabledColor(); + abstract public ColorUIResource getBorderGradientBottomDisabledColor(); + + abstract public ColorUIResource getTitledBorderBorderColor(); + + abstract public boolean getTreeRendererFillBackground(); + abstract public boolean getTreeLineTypeDashed(); + + abstract public ColorUIResource getSelectionColor(); + abstract public ColorUIResource getSelectionColorForeground(); + abstract public ColorUIResource getTreeHeaderColor(); + + abstract public AbstractBorder getTextAreaBorder(); + abstract public AbstractBorder getTextFieldBorder(); + abstract public AbstractBorder getButtonBorder(); + public abstract AbstractBorder getScrollPaneBorder(); + + public boolean treePaintWholeRow() { + return !Boolean.getBoolean("dolphin.tree.nofill"); + } + + public void setTreePaintWholeRow(boolean value) { + System.setProperty("dolphin.tree.nofill", String.valueOf(value)); + } + + public boolean getTabPaneKeepBackgroundColor() { + return Boolean.getBoolean("dolphin.tab.keepbg"); + } + + public void setTabPaneKeepBackgroundColor(boolean value) { + System.setProperty("dolphin.tab.keepbg", String.valueOf(value)); + } + + public abstract ColorUIResource getWindowBackgroundColor(); + + public abstract ColorUIResource getMenuBarBackgroundColor(); + public abstract ColorUIResource getMenuBackgroundColor(); + public abstract ColorUIResource getMenuForegroundColor(); + public abstract ColorUIResource getTabAreaBackground(); + public abstract ColorUIResource getTabAreaForeground(); + + public abstract ColorUIResource getTabTopGradient(); + public abstract ColorUIResource getTabBottomGradient(); + + public abstract ColorUIResource getUnselectedTabTopGradient(); + public abstract ColorUIResource getUnselectedTabBottomGradient(); + + public abstract ColorUIResource getTextFieldBackgroundTopGradient(); + public abstract ColorUIResource getTextFieldBackgroundBottomGradient(); + + abstract public ColorUIResource getThumbColor(); + + abstract public ColorUIResource getScrollBarTrackColor(); + + abstract public ColorUIResource getThumbFocusedColor(); + abstract public ColorUIResource getThumbMovingColor(); + + abstract public ColorUIResource getSplitPaneDividerBorderColor(); + + abstract public ColorUIResource getTabTopHedgeColor(); + abstract public ColorUIResource getTabBottomHedgeColor(); + + abstract public ColorUIResource getMenuBorderDefaultColor(); + + abstract public Color getSeparatorColor(); + + abstract public ColorUIResource getTableHeaderBackgroundColor(); + abstract public ColorUIResource getTableHeaderForegroundColor(); + + abstract public Font getTableHeaderFont(); + + abstract public Border getTableCellBorder(); + abstract public Border getTableFocusCellBorder(); + + abstract public ColorUIResource getIconsBaseColor(); + + abstract public int getOneTouchButtonSize(); + abstract public int getOneTouchButtonOffset(); + + abstract public ColorUIResource getTableSelectionCellBackground(); + abstract public ColorUIResource getTableSelectionCellForeground(); +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinThemeUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/themes/DolphinThemeUtils.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,97 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.themes; + +import java.awt.Color; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.RenderingHints; +import java.awt.Shape; +import java.awt.geom.RoundRectangle2D; + +import com.redhat.swing.laf.dolphin.DolphinLookAndFeel; + +/** + */ +public class DolphinThemeUtils { + + private static final boolean aaOff; + + static { + aaOff = Boolean.getBoolean("dolphin.aa.off"); + } + + /** + * Sets the Antialiasing hint on this graphics object. + * + * The AA hint is on by default, but can be turned of by setting the system + * property: {@code icedlook.aa.off} + */ + public static void setAntialiasing(Graphics2D graphics) { + if (!aaOff) { + graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + } + } + + public static void setGradientPaint(Graphics2D g, int x, int height, + Color start, Color stop) + { + Paint paint = new GradientPaint(x, 0, start, 0, height, stop); + g.setPaint(paint); + } + + public static DolphinTheme getCurrentTheme() { + return DolphinLookAndFeel.getTheme(); + } + + public static Shape getRoundShape(int width, int height) { + return new RoundRectangle2D.Double(0, 0, width - 2, height - 1, 4, 4); + } + + public static Shape getRoundShape(int width, int height, int arcx, int arcy) { + return new RoundRectangle2D.Double(0, 0, width - 2, height - 1, arcx, arcy); + } + + public static Graphics2D createAAGraphics(Graphics graphics) { + Graphics2D result = (Graphics2D) graphics.create(); + setAntialiasing(result); + return result; + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/java/com/redhat/swing/laf/dolphin/tree/DolphinTreeUI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/redhat/swing/laf/dolphin/tree/DolphinTreeUI.java Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,79 @@ +/* + * Copyright 2012 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 + * . + * + * 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.swing.laf.dolphin.tree; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Rectangle; + +import javax.swing.JComponent; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicTreeUI; +import javax.swing.tree.TreePath; + +import com.redhat.swing.laf.dolphin.DolphinLookAndFeel; + +public class DolphinTreeUI extends BasicTreeUI { + + private static final boolean paintWholeRow; + static { + paintWholeRow = DolphinLookAndFeel.getTheme().treePaintWholeRow(); + } + + public DolphinTreeUI() { + } + + public static ComponentUI createUI(JComponent component) { + return new DolphinTreeUI(); + } + + @Override + protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, + Rectangle bounds, TreePath path, int row, boolean isExpanded, + boolean hasBeenExpanded, boolean isLeaf) + { + if (paintWholeRow && tree.isRowSelected(row)) { + Graphics g1 = g.create(); + Color alpha = DolphinLookAndFeel.getTheme().getSelectionColor(); + g1.setColor(alpha); + g1.fillRect(0, row * tree.getRowHeight(), tree.getWidth(), tree.getRowHeight()); + g1.dispose(); + } + super.paintRow(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); + } +} diff -r 000000000000 -r 8faa914b76a4 src/main/resources/checkbox-checked-disabled.png Binary file src/main/resources/checkbox-checked-disabled.png has changed diff -r 000000000000 -r 8faa914b76a4 src/main/resources/checkbox-checked.png Binary file src/main/resources/checkbox-checked.png has changed diff -r 000000000000 -r 8faa914b76a4 src/main/resources/checkbox-disabled.png Binary file src/main/resources/checkbox-disabled.png has changed diff -r 000000000000 -r 8faa914b76a4 src/main/resources/checkbox-menuitem-checked.png Binary file src/main/resources/checkbox-menuitem-checked.png has changed diff -r 000000000000 -r 8faa914b76a4 src/main/resources/checkbox-menuitem-checked.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/resources/checkbox-menuitem-checked.svg Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,63 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff -r 000000000000 -r 8faa914b76a4 src/main/resources/checkbox-unchecked.png Binary file src/main/resources/checkbox-unchecked.png has changed diff -r 000000000000 -r 8faa914b76a4 src/main/resources/radio-disabled-selected.png Binary file src/main/resources/radio-disabled-selected.png has changed diff -r 000000000000 -r 8faa914b76a4 src/main/resources/radio-disabled-unselected.png Binary file src/main/resources/radio-disabled-unselected.png has changed diff -r 000000000000 -r 8faa914b76a4 src/main/resources/radio-menuitem-checked.png Binary file src/main/resources/radio-menuitem-checked.png has changed diff -r 000000000000 -r 8faa914b76a4 src/main/resources/radio-menuitem-checked.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/resources/radio-menuitem-checked.svg Tue Dec 11 20:01:55 2012 +0100 @@ -0,0 +1,67 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff -r 000000000000 -r 8faa914b76a4 src/main/resources/radio-selected.png Binary file src/main/resources/radio-selected.png has changed diff -r 000000000000 -r 8faa914b76a4 src/main/resources/radio-unselected.png Binary file src/main/resources/radio-unselected.png has changed