Mercurial > hg > release > thermostat-0.7
changeset 715:864eb6f85042
Move Swing-dependent code into separate bundles: client-core
This commit updates the client-core bundle to strip out Swing dependencies and moves some common
non-Swing utilities classes from other bundles into the client-core bundle.
Reviewed-by: omajid
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-October/003811.html
author | Elliott Baron <ebaron@redhat.com> |
---|---|
date | Tue, 23 Oct 2012 11:17:50 -0400 |
parents | 3a4f6e0ded6b |
children | f1a4570624dd |
files | client/core/pom.xml client/core/src/main/java/com/redhat/thermostat/client/core/views/SearchFieldView.java client/core/src/main/java/com/redhat/thermostat/client/ui/BytesTickUnit.java client/core/src/main/java/com/redhat/thermostat/client/ui/ChartColors.java client/core/src/main/java/com/redhat/thermostat/client/ui/Decorator.java client/core/src/main/java/com/redhat/thermostat/client/ui/Palette.java client/core/src/main/java/com/redhat/thermostat/client/ui/SearchFieldView.java client/swing-components/src/main/java/com/redhat/thermostat/charts/BytesTickUnit.java client/swing-components/src/main/java/com/redhat/thermostat/swing/Palette.java |
diffstat | 9 files changed, 202 insertions(+), 254 deletions(-) [+] |
line wrap: on
line diff
--- a/client/core/pom.xml Wed Oct 17 16:28:16 2012 +0200 +++ b/client/core/pom.xml Tue Oct 23 11:17:50 2012 -0400 @@ -51,13 +51,6 @@ <name>Thermostat Client Core</name> <dependencies> - - <dependency> - <groupId>com.redhat.thermostat</groupId> - <artifactId>thermostat-laf</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -69,16 +62,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.easytesting</groupId> - <artifactId>fest-swing</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>net.java.openjdk.cacio</groupId> - <artifactId>cacio-tta</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-api-mockito</artifactId> <scope>test</scope> @@ -110,33 +93,10 @@ <artifactId>org.osgi.compendium</artifactId> <scope>provided</scope> </dependency> - - <dependency> - <groupId>com.redhat.thermostat</groupId> - <artifactId>thermostat-swing-components</artifactId> - <version>${project.version}</version> - </dependency> </dependencies> <build> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - <excludes> - <exclude>**/*.png</exclude> - </excludes> - </resource> - <resource> - <directory>src/main/resources</directory> - <filtering>false</filtering> - <includes> - <include>**/*.png</include> - </includes> - </resource> - </resources> - <plugins> <plugin> <groupId>org.apache.felix</groupId> @@ -145,26 +105,16 @@ <configuration> <instructions> <Bundle-Vendor>Red Hat, Inc.</Bundle-Vendor> - <Bundle-Activator>com.redhat.thermostat.client.internal.osgi.ThermostatActivator</Bundle-Activator> <Bundle-SymbolicName>com.redhat.thermostat.client.core</Bundle-SymbolicName> <Export-Package> com.redhat.thermostat.client.osgi.service, com.redhat.thermostat.client.ui, com.redhat.thermostat.client.locale, - <!-- Contains Swing view providers --> - com.redhat.thermostat.client.swing, <!-- Interfaces for views, controllers, etc. --> com.redhat.thermostat.client.core, com.redhat.thermostat.client.core.controllers, - com.redhat.thermostat.client.core.views, + com.redhat.thermostat.client.core.views </Export-Package> - <Private-Package> - com.redhat.thermostat.client.internal, - com.redhat.thermostat.client.internal.config, - com.redhat.thermostat.client.internal.osgi, - com.redhat.thermostat.client.internal.ui, - com.redhat.thermostat.client.internal.ui.swing - </Private-Package> <!-- Do not autogenerate uses clauses in Manifests --> <_nouses>true</_nouses> </instructions>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/core/src/main/java/com/redhat/thermostat/client/core/views/SearchFieldView.java Tue Oct 23 11:17:50 2012 -0400 @@ -0,0 +1,63 @@ +/* + * 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 + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.client.core.views; + +import com.redhat.thermostat.client.core.views.View; +import com.redhat.thermostat.common.ActionListener; + +public interface SearchFieldView extends View { + + /** For use by tests only */ + public static final String VIEW_NAME = "searchField"; + + public enum SearchAction { + TEXT_CHANGED, + PERFORM_SEARCH, + } + + public String getSearchText(); + + public void setSearchText(String text); + + void setLabel(String label); + + void setTooltip(String tooltip); + + public void addActionListener(ActionListener<SearchAction> listener); + public void removeActionListener(ActionListener<SearchAction> listener); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/BytesTickUnit.java Tue Oct 23 11:17:50 2012 -0400 @@ -0,0 +1,55 @@ +/* + * 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 + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.client.ui; + +import org.jfree.chart.axis.NumberTickUnit; + +import com.redhat.thermostat.common.utils.DisplayableValues; + +@SuppressWarnings("serial") +public class BytesTickUnit extends NumberTickUnit { + + public BytesTickUnit(double size) { + super(size); + } + + @Override + public String valueToString(double value) { + String[] displayable = DisplayableValues.bytes((long) value); + return displayable[0] + " " + displayable[1]; + } +}
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/ChartColors.java Wed Oct 17 16:28:16 2012 +0200 +++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/ChartColors.java Tue Oct 23 11:17:50 2012 -0400 @@ -38,7 +38,6 @@ import java.awt.Color; -import com.redhat.thermostat.swing.Palette; public class ChartColors { private static final Palette[] SERIES_COLORS = {
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/Decorator.java Wed Oct 17 16:28:16 2012 +0200 +++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/Decorator.java Tue Oct 23 11:17:50 2012 -0400 @@ -36,7 +36,6 @@ package com.redhat.thermostat.client.ui; - /** * A {@link Decorator} allows plugins to install special visual clues on * selected components.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/Palette.java Tue Oct 23 11:17:50 2012 -0400 @@ -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 + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.client.ui; + +import java.awt.Color; + +public enum Palette { + + THERMOSTAT_BLU(new Color(74, 93, 117)), + THERMOSTAT_RED(new Color(226, 46, 42)), + + RED(new Color(192, 0, 0)), + PALE_RED(new Color(192, 80, 77)), + + SKY_BLUE(new Color(79, 129, 189)), + AZUREUS(new Color(0, 176, 190)), + EGYPTIAN_BLUE(new Color(74, 144, 217)), + DIRTY_CYAN(new Color(75, 172, 198)), + PRUSSIAN_BLUE(new Color(0, 49, 83)), + + GREEN(new Color(146, 208, 80)), + TUNDRA_GREEN(new Color(155, 187, 89)), + + POMP_AND_POWER_VIOLET(new Color(128, 100, 162)), + VIOLET(new Color(112, 48, 160)), + + EARL_GRAY(new Color(128, 128, 128)), + + PALE_GRAY(new Color(235, 235, 235)), + LIGHT_GRAY(new Color(242, 242, 242)), + GRAY(new Color(216, 216, 216)), + DARK_GRAY(new Color(168, 172, 168)), + + GRANITA_ORANGE(new Color(247,150,70)), + + BLACK(Color.BLACK), + WHITE(Color.WHITE), + + /* END */ ; + + private Color color; + Palette(Color color) { + this.color = color; + } + + public Color getColor() { + return color; + } +}
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/SearchFieldView.java Wed Oct 17 16:28:16 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * 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 - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.client.ui; - -import com.redhat.thermostat.client.core.views.View; -import com.redhat.thermostat.common.ActionListener; - -public interface SearchFieldView extends View { - - /** For use by tests only */ - public static final String VIEW_NAME = "searchField"; - - public enum SearchAction { - TEXT_CHANGED, - PERFORM_SEARCH, - } - - public String getSearchText(); - - public void setSearchText(String text); - - void setLabel(String label); - - void setTooltip(String tooltip); - - public void addActionListener(ActionListener<SearchAction> listener); - public void removeActionListener(ActionListener<SearchAction> listener); - -}
--- a/client/swing-components/src/main/java/com/redhat/thermostat/charts/BytesTickUnit.java Wed Oct 17 16:28:16 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * 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 - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.charts; - -import org.jfree.chart.axis.NumberTickUnit; - -import com.redhat.thermostat.common.utils.DisplayableValues; - -@SuppressWarnings("serial") -public class BytesTickUnit extends NumberTickUnit { - - public BytesTickUnit(double size) { - super(size); - } - - @Override - public String valueToString(double value) { - String[] displayable = DisplayableValues.bytes((long) value); - return displayable[0] + " " + displayable[1]; - } -}
--- a/client/swing-components/src/main/java/com/redhat/thermostat/swing/Palette.java Wed Oct 17 16:28:16 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * 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 - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.swing; - -import java.awt.Color; - -public enum Palette { - - THERMOSTAT_BLU(new Color(74, 93, 117)), - THERMOSTAT_RED(new Color(226, 46, 42)), - - RED(new Color(192, 0, 0)), - PALE_RED(new Color(192, 80, 77)), - - SKY_BLUE(new Color(79, 129, 189)), - AZUREUS(new Color(0, 176, 190)), - EGYPTIAN_BLUE(new Color(74, 144, 217)), - DIRTY_CYAN(new Color(75, 172, 198)), - PRUSSIAN_BLUE(new Color(0, 49, 83)), - - GREEN(new Color(146, 208, 80)), - TUNDRA_GREEN(new Color(155, 187, 89)), - - POMP_AND_POWER_VIOLET(new Color(128, 100, 162)), - VIOLET(new Color(112, 48, 160)), - - EARL_GRAY(new Color(128, 128, 128)), - - PALE_GRAY(new Color(235, 235, 235)), - LIGHT_GRAY(new Color(242, 242, 242)), - GRAY(new Color(216, 216, 216)), - DARK_GRAY(new Color(168, 172, 168)), - - GRANITA_ORANGE(new Color(247,150,70)), - - BLACK(Color.BLACK), - WHITE(Color.WHITE), - - /* END */ ; - - private Color color; - Palette(Color color) { - this.color = color; - } - - public Color getColor() { - return color; - } -}