diff --git a/looks/.classpath b/looks/.classpath new file mode 100644 index 0000000000..4b19d49ccc --- /dev/null +++ b/looks/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/looks/.project b/looks/.project new file mode 100644 index 0000000000..558ab1aa61 --- /dev/null +++ b/looks/.project @@ -0,0 +1,17 @@ + + + looks + Adempiere PLAF UI + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/looks/PLAF_Test.bat b/looks/PLAF_Test.bat new file mode 100644 index 0000000000..eb448f5362 --- /dev/null +++ b/looks/PLAF_Test.bat @@ -0,0 +1,10 @@ +@Title PLAF Test + +@Rem $Id: PLAF_Test.bat,v 1.3 2002/03/16 06:00:11 jjanke Exp $ +@Rem Put the swing.properties file in the \rje\lib directory +@set JAVA_HOME=D:\j2sdk1.4.0 + +@Rem +%JAVA_HOME%\jre\bin\java -cp D:\Adempiere\looks\CLooks.jar;%JAVA_HOME%\demo\jfc\SwingSet2\SwingSet2.jar org.compiere.plaf.AdempierePLAF SwingSet2 + +@Pause \ No newline at end of file diff --git a/looks/RUN.bat b/looks/RUN.bat new file mode 100644 index 0000000000..be3bc48473 --- /dev/null +++ b/looks/RUN.bat @@ -0,0 +1,2 @@ +java -jar CLooks.jar +@pause \ No newline at end of file diff --git a/looks/RUN_build.bat b/looks/RUN_build.bat new file mode 100644 index 0000000000..cc086b2279 --- /dev/null +++ b/looks/RUN_build.bat @@ -0,0 +1,25 @@ +@Title Build Looks +@Rem $Header: /cvsroot/adempiere/looks/RUN_build.bat,v 1.15 2005/09/16 00:50:55 jjanke Exp $ + +@CALL ..\utils_dev\myDevEnv.bat +@IF NOT %ADEMPIERE_ENV%==Y GOTO NOBUILD + +@echo Cleanup ... +@"%JAVA_HOME%\bin\java" -Dant.home="." %ANT_PROPERTIES% org.apache.tools.ant.Main clean + +@echo Building ... +@"%JAVA_HOME%\bin\java" -Dant.home="." %ANT_PROPERTIES% org.apache.tools.ant.Main looksDistribution + +@echo Documentation ... +@"%JAVA_HOME%\bin\java" -Dant.home="." %ANT_PROPERTIES% org.apache.tools.ant.Main looksDocumentation + +@echo Release ... +@"%JAVA_HOME%\bin\java" -Dant.home="." %ANT_PROPERTIES% org.apache.tools.ant.Main looksRelease + +@Echo Done ... +@sleep 60 +@exit + +:NOBUILD +@Echo Check myDevEnv.bat (copy from myDevEnvTemplate.bat) +@Pause diff --git a/looks/RUN_build.sh b/looks/RUN_build.sh new file mode 100644 index 0000000000..5f80633c60 --- /dev/null +++ b/looks/RUN_build.sh @@ -0,0 +1,18 @@ +# Module compiling script +# Ported from Windows script Marek Mosiewicz + + +SAVED_DIR=`pwd` #save current dir +cd `dirname $0`/../utils_dev #change dir to place where script resides - doesn not work with sym links +UTILS_DEV=`pwd` #this is adempiere source +cd $SAVED_DIR #back to the saved directory + +. $UTILS_DEV/myDevEnv.sh #call environment +echo done +if [ ! $ADEMPIERE_ENV==Y ] ; then + echo "Can't set developemeent environemnt - check myDevEnv.sh" + exit 1 +fi + +echo running Ant +$JAVA_HOME/bin/java -Dant.home="." $ANT_PROPERTIES org.apache.tools.ant.Main diff --git a/looks/Swingset.bat b/looks/Swingset.bat new file mode 100644 index 0000000000..1bc80a928c --- /dev/null +++ b/looks/Swingset.bat @@ -0,0 +1,11 @@ +@Title Swingset + +@Rem $Id: Swingset.bat,v 1.1 2002/03/17 02:29:49 jjanke Exp $ +@Rem Put the swing.properties file in the \rje\lib directory +@set JAVA_HOME=D:\j2sdk1.4.0 + +@Rem +%JAVA_HOME%\jre\bin\java -jar %JAVA_HOME%\demo\jfc\SwingSet2\SwingSet2.jar + +@Echo done ... +@Sleep 10 \ No newline at end of file diff --git a/looks/adempiereLooks.jnlp b/looks/adempiereLooks.jnlp new file mode 100644 index 0000000000..ec0e1640f1 --- /dev/null +++ b/looks/adempiereLooks.jnlp @@ -0,0 +1,26 @@ + + + + + Adempiere Looks + ComPiere, Inc. + + + Adempiere Looks - Pluggable Look and Feel for Java + Adempiere Looks + Adempiere Looks + Adempiere Looks (Current Release from SorceForge) + + + + + + + + + + + \ No newline at end of file diff --git a/looks/adempiereLooks_local.jnlp b/looks/adempiereLooks_local.jnlp new file mode 100644 index 0000000000..b9e07727bc --- /dev/null +++ b/looks/adempiereLooks_local.jnlp @@ -0,0 +1,26 @@ + + + + + Adempiere Looks Local + ComPiere, Inc. + + + Adempiere Looks - Pluggable Look and Feel for Java (Local) + Adempiere Looks (Local) + Adempiere Looks (Local) + Adempiere Looks (Local) + + + + + + + + + + + \ No newline at end of file diff --git a/looks/build.xml b/looks/build.xml new file mode 100644 index 0000000000..f2842ddc49 --- /dev/null +++ b/looks/build.xml @@ -0,0 +1,146 @@ + + + + + + + + + Build the UI subproject within the Adempiere project. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TM Looks API Documentation]]> +
Adempiere Looks 1.3]]>
+ Copyright (c) 1999-2005 ComPiere, Inc. - Author: Jorg Janke]]> + +
+
+ + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/looks/documentation.bat b/looks/documentation.bat new file mode 100644 index 0000000000..659c934f80 --- /dev/null +++ b/looks/documentation.bat @@ -0,0 +1,5 @@ +@Rem API Documentation for Base + +call ..\doc\documentation.bat src doc -private + +@pause \ No newline at end of file diff --git a/looks/javadoc.xml b/looks/javadoc.xml new file mode 100644 index 0000000000..f0623d5842 --- /dev/null +++ b/looks/javadoc.xml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/looks/overview.html b/looks/overview.html new file mode 100644 index 0000000000..ec16b5ef70 --- /dev/null +++ b/looks/overview.html @@ -0,0 +1,50 @@ + + +Adempiere Looks Overview + + +

Adempiere Looks + Adempiere Looks is a 3D extension of the Java Metal Look and Feel.

+

For updates + check http://www.adempiere.org/looks.

+

Overview

+

Adempiere Looks was inspired by the Kunststoff + Look and Feel and adds color capabilities as well as texture backgrounds. Adempiere + Looks is free and Open Source.

+

Adempiere Looks are based on Java 1.4.0.

+

Adempiere Looks Utilities allow you to change the Look and Feel of your application + by the individual user. This is not restricted to the standard and Adempiere + Looks, but also Kunststoff. + You can also define your own Theme.

+

Constants

+

Start Options

+

Change the default Look & Feel

+

You can change the default Look & Feel by editing or adding the file swing.properties + in the folder $JAVA_HOME/jre/lib

+

Start via AdempierePLAF

+

You can change the Look & Feel to the one selected by starting via CompmierePLAF. + Example:

+
  java -cp AdempiereLooks.jar;SwingSet2.jar 
+    org.compiere.plaf.AdempierePLAF SwingSet2
+

This tries to invoke the main method of the class of if not found the + constructor without parameters.

+

Modify main Method

+

Just add the line:

+
  AdempierePLAF.setPLAF();
+

Change the Look & Feel

+

You set the Look & Feel by invoking the Adempiere PLAF Editor:

+

Stand alone:

+
  java -jar AdempiereLooks.jar
+  java -cp AdempiereLooks.jar org.compiere.plaf.AdempierePLAF
+

or within your program by

+
  new AdempierePLAFEditor ();
+

and from a Dialog or Frame to change the Look and Feel of your current windows + via

+
  new AdempierePLAFEditor (this);
+
+

You can also set the Adempiere Look directly:

+
  UIManager.setLookAndFeel
+    (new org.compiere.plaf.AdempiereLookAndFeel());
+

 

+ + \ No newline at end of file diff --git a/looks/packages.txt b/looks/packages.txt new file mode 100644 index 0000000000..7b9e734446 --- /dev/null +++ b/looks/packages.txt @@ -0,0 +1,3 @@ +org.compiere.plaf +org.compiere.swing +org.compiere.util diff --git a/looks/src/org/adempiere/plaf/AdempiereButtonListener.java b/looks/src/org/adempiere/plaf/AdempiereButtonListener.java new file mode 100755 index 0000000000..89e8a79924 --- /dev/null +++ b/looks/src/org/adempiere/plaf/AdempiereButtonListener.java @@ -0,0 +1,96 @@ +/****************************************************************************** + * The contents of this file are subject to the Compiere License Version 1.1 + * ("License"); You may not use this file except in compliance with the License + * You may obtain a copy of the License at http://www.compiere.org/license.html + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial + * Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke + * are Copyright (C) 1999-2005 Jorg Janke. + * All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved. + * Contributor(s): ______________________________________. + *****************************************************************************/ +package org.adempiere.plaf; + +import java.awt.event.*; +import java.beans.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; + +/** + * Button Listener + * + * @author Jorg Janke + * @version $Id: CompiereButtonListener.java,v 1.1 2005/12/05 02:38:28 jjanke Exp $ + */ +public class AdempiereButtonListener extends BasicButtonListener +{ + /** + * Compiere Button Listener + * @param b button + */ + public AdempiereButtonListener (AbstractButton b) + { + super (b); + } // CompiereButtonListener + + /** + * Install Keyboard Actions + * @param c component + */ + public void installKeyboardActions (JComponent c) + { + super.installKeyboardActions (c); + updateMnemonicBindingX ((AbstractButton)c); + } // installKeyboardActions + + /** + * Property Change + * @param e event + */ + public void propertyChange (PropertyChangeEvent e) + { + String prop = e.getPropertyName(); + if (prop == AbstractButton.MNEMONIC_CHANGED_PROPERTY) + updateMnemonicBindingX ((AbstractButton)e.getSource()); + else + super.propertyChange (e); + } // propertyChange + + /** + * Update Mnemonic Binding + * @param b button + */ + void updateMnemonicBindingX (AbstractButton b) + { + int m = b.getMnemonic(); + if (m != 0) + { + InputMap map = SwingUtilities.getUIInputMap(b, JComponent.WHEN_IN_FOCUSED_WINDOW); + + if (map == null) + { + map = new ComponentInputMapUIResource(b); + SwingUtilities.replaceUIInputMap(b, JComponent.WHEN_IN_FOCUSED_WINDOW, map); + } + map.clear(); + String className = b.getClass().getName(); + int mask = InputEvent.ALT_MASK; // Default Buttons + if (b instanceof JCheckBox // In Tab + || className.indexOf("VButton") != -1) + mask = InputEvent.SHIFT_MASK + InputEvent.CTRL_MASK; + map.put(KeyStroke.getKeyStroke(m, mask, false), "pressed"); + map.put(KeyStroke.getKeyStroke(m, mask, true), "released"); + map.put(KeyStroke.getKeyStroke(m, 0, true), "released"); + } + else + { + InputMap map = SwingUtilities.getUIInputMap(b, JComponent.WHEN_IN_FOCUSED_WINDOW); + if (map != null) + map.clear(); + } + } // updateMnemonicBindingX + +} // CompiereButtonListener diff --git a/looks/src/org/adempiere/plaf/AdempiereColor.java b/looks/src/org/adempiere/plaf/AdempiereColor.java new file mode 100755 index 0000000000..09d3de16ea --- /dev/null +++ b/looks/src/org/adempiere/plaf/AdempiereColor.java @@ -0,0 +1,1268 @@ +/****************************************************************************** + * The contents of this file are subject to the Compiere License Version 1.1 + * ("License"); You may not use this file except in compliance with the License + * You may obtain a copy of the License at http://www.compiere.org/license.html + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial + * Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke + * are Copyright (C) 1999-2005 Jorg Janke. + * All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved. + * Contributor(s): ______________________________________. + *****************************************************************************/ +package org.adempiere.plaf; + +import java.awt.*; +import java.awt.image.*; +import java.io.*; +import java.net.*; +import java.util.*; +import java.util.logging.*; +import javax.swing.*; +import javax.swing.plaf.*; +import org.compiere.util.*; +import org.compiere.plaf.*; + +/** + * Compiere Background Color + * + * @author Jorg Janke + * @version $Id: CompiereColor.java,v 1.24 2005/10/21 15:44:12 jjanke Exp $ + */ +public class AdempiereColor implements Serializable +{ + /** Background type Flat */ + public static final String TYPE_FLAT = "F"; + /** Background type Gradient */ + public static final String TYPE_GRADIENT = "G"; + /** Background type Lines */ + public static final String TYPE_LINES = "L"; + /** Background type Texture */ + public static final String TYPE_TEXTURE = "T"; + + /** Names */ + private static ResourceBundle s_res = ResourceBundle.getBundle("org.compiere.plaf.PlafRes"); + + /** Type Values */ + public static final String[] TYPE_VALUES = new String[] { + TYPE_FLAT, TYPE_GRADIENT, TYPE_LINES, TYPE_TEXTURE + }; + /** Type Names */ + public static final String[] TYPE_NAMES = new String[] { + s_res.getString("BackColType_Flat"), + s_res.getString("BackColType_Gradient"), + s_res.getString("BackColType_Lines"), + s_res.getString("BackColType_Texture") + }; + /** Types */ + public static final ValueNamePair[] TYPES = new ValueNamePair[] { + new ValueNamePair(TYPE_VALUES[0], TYPE_NAMES[0]), + new ValueNamePair(TYPE_VALUES[1], TYPE_NAMES[1]), + new ValueNamePair(TYPE_VALUES[2], TYPE_NAMES[2]), + new ValueNamePair(TYPE_VALUES[3], TYPE_NAMES[3]) + }; + + /** Gradient Starting Values */ + public static final int[] GRADIENT_SP_VALUES = new int[] { + SwingConstants.NORTH, SwingConstants.NORTH_EAST, + SwingConstants.EAST, SwingConstants.SOUTH_EAST, + SwingConstants.SOUTH, SwingConstants.SOUTH_WEST, + SwingConstants.WEST, SwingConstants.NORTH_WEST + }; + /** Gradient Starting Names */ + public static final String[] GRADIENT_SP_NAMES = new String[] { + "North", "North-East", + "East", "South-East", + "South", "South-West", + "West", "North-West" + }; + /** Gradient Starting Point */ + public static final KeyNamePair[] GRADIENT_SP = new KeyNamePair[] { + new KeyNamePair(GRADIENT_SP_VALUES[0], GRADIENT_SP_NAMES[0]), + new KeyNamePair(GRADIENT_SP_VALUES[1], GRADIENT_SP_NAMES[1]), + new KeyNamePair(GRADIENT_SP_VALUES[2], GRADIENT_SP_NAMES[2]), + new KeyNamePair(GRADIENT_SP_VALUES[3], GRADIENT_SP_NAMES[3]), + new KeyNamePair(GRADIENT_SP_VALUES[4], GRADIENT_SP_NAMES[4]), + new KeyNamePair(GRADIENT_SP_VALUES[5], GRADIENT_SP_NAMES[5]), + new KeyNamePair(GRADIENT_SP_VALUES[6], GRADIENT_SP_NAMES[6]), + new KeyNamePair(GRADIENT_SP_VALUES[7], GRADIENT_SP_NAMES[7]) + }; + /** Exception text */ + private static final String EXCEPTION_TEXT = "Arguments cannot be NULL"; + + + /************************************************************************** + * Set Background of Component to default color + * @param c component + */ + /* + public static void setBackground (JComponent c) + { + setBackground (c, CompierePanelUI.getDefaultBackground()); + } // setBackground + */ + /** + * Set Background of Component + * @param c Component + * @param cc Color + */ + public static void setBackground (JComponent c, AdempiereColor cc) + { + c.putClientProperty(AdempierePLAF.BACKGROUND, cc); + } // setBackground + + /** + * Get Background Color of component + * @param c JComponent + * @return Color + */ + public static AdempiereColor getBackground (JComponent c) + { + AdempiereColor bg = null; + try + { + bg = (AdempiereColor)c.getClientProperty(AdempierePLAF.BACKGROUND); + } + catch (Exception e) + { + log.severe("ClientProperty: " + e.getMessage()); + } + return bg; + } // getBackground + + /** + * Set Background of Window Content Pane to default color + * @param win window + */ + /* + public static void setBackground (Window win) + { + setBackground (win, CompierePanelUI.getDefaultBackground()); + } // setBackground + */ + /** + * Set Background of Window Content Pane + * @param win window + * @param cc compiere color + */ + public static void setBackground (Window win, AdempiereColor cc) + { + if (win instanceof JDialog) + { + ((JPanel)((JDialog)win).getContentPane()).putClientProperty(AdempierePLAF.BACKGROUND, cc); + // ((JPanel)((JDialog)win).getContentPane()).setName("contentPane"); + } + else if (win instanceof JFrame) + { + ((JPanel)((JFrame)win).getContentPane()).putClientProperty(AdempierePLAF.BACKGROUND, cc); + // ((JPanel)((JFrame)win).getContentPane()).setName("contentPane"); + } + else if (win instanceof JWindow) + { + ((JPanel)((JWindow)win).getContentPane()).putClientProperty(AdempierePLAF.BACKGROUND, cc); + // ((JPanel)((JWindow)win).getContentPane()).setName("contentPane"); + } + } // setBackground + + /** + * Set Default Background + * @param bg Background Color + * @see CompierePanelUI#setDefaultBackground + */ + /* + public static void setDefaultBackground (AdempiereColor bg) + { + CompierePanelUI.setDefaultBackground(bg); + } // setDefaultBackground + */ + + /** + * Get Default Background + * @return Background + * @see CompierePanelUI#getDefaultBackground + */ + /* + public static AdempiereColor getDefaultBackground() + { + return CompierePanelUI.getDefaultBackground(); + } // getDefaultBackground + + /** + * + * Set Default Background + * @param setDefault if true, the background will be set to the default color + * @see CompierePanelUI#setSetDefault + */ + public static void setSetDefault (boolean setDefault) + { + AdempierePanelUI.setSetDefault(setDefault); + } // setSetDefault + + /** + * Is the Default Background set by default + * @return true if default background is set + * @see AdempierePanelUI#isSetDefault + */ + public static boolean isSetDefault() + { + return AdempierePanelUI.isSetDefault(); + } // isSetDefault + + /** + * Parse attributes and return CompiereColor + * @param attributes attributes + * @return CompiereColor + */ + public static AdempiereColor parse (String attributes) + { + AdempiereColor cc = new AdempiereColor (); + try + { + if (attributes != null && attributes.length() > 0) + cc.parseAttributres (attributes); + } + catch (Exception e) + { + log.severe("(" + attributes + ") - " + e.toString()); + } + return cc; + } // parse + + + /************************************************************************* + * Create Gradient Background Color (Window System Color - White) + */ + public AdempiereColor() + { + this (TYPE_GRADIENT); + } // CompiereColor + + /** + * Create Default Background Colors of Type + * @param type Background type (see constants TYPE_*) + */ + public AdempiereColor (String type) + { + if (type == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + if (type.equals(TYPE_FLAT) || type.equals(TYPE_GRADIENT) + || type.equals(TYPE_TEXTURE) || type.equals(TYPE_LINES)) + { + m_type = type; + } + else + new java.lang.IllegalArgumentException ("Invalid Type"); + } // CompiereColor + + /** + * Create Flat Background Color + * @param bg background + */ + public AdempiereColor (Color bg) + { + this (bg, true); + } // CompiereColor + + /** + * Create Background Color + * @param bg Color + * @param flat if true create Flat color otherwise Gradient color with white lower color + */ + public AdempiereColor (Color bg, boolean flat) + { + if (bg == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + m_type = flat ? TYPE_FLAT : TYPE_GRADIENT; + m_primaryColor = bg; + } // CompiereColor + + /** + * Set Background to Gradient colors + * @param upperColor upper Color + * @param lowerColor lower Color + * @param startPoint Starting point - e.g. SOUTH_WEST see SwingConstants, default NORTH_WEST + * @param repeatDistance X/Y Distance to repeat gradient in points - 0 no repeats + */ + public AdempiereColor (Color upperColor, Color lowerColor, int startPoint, int repeatDistance) + { + if (upperColor == null || lowerColor == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + m_type = TYPE_GRADIENT; + m_primaryColor = upperColor; + m_secondaryColor = lowerColor; + m_startPoint = startPoint; + m_repeatDistance = repeatDistance; + } // CompiereColor + + /** + * Set Background to Gradient colors. + * Starting in the north, repeat after 100 pt + * @param upperColor upper color + * @param lowerColor lower color + */ + public AdempiereColor (Color upperColor, Color lowerColor) + { + this (upperColor, lowerColor, SwingConstants.NORTH_WEST, 100); + } // CompiereColor + + /** + * Set Background to Texture + * + * @param textureURL URL to a *.gif or *.jpg graphic file + * @param taint Color to taint the texture (use white for not tainting it) + * @param compositeAlpha Value from 0(no) to 1(full) taining + */ + public AdempiereColor (URL textureURL, Color taint, float compositeAlpha) + { + if (textureURL == null || taint == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + m_type = TYPE_TEXTURE; + m_textureURL = textureURL; + m_primaryColor = taint; + m_compositeAlpha = compositeAlpha; + } // CompiereColor + + /** + * Set Background to Texture + * + * @param textureURL URL to a *.gif or *.jpg graphic file + * @param taint Color to taint the texture (use white for not tainting it) + * @param compositeAlpha Tainting value from 0 (no - FullGraph) to 1 (full - NoGraph) + */ + public AdempiereColor (String textureURL, Color taint, float compositeAlpha) + { + if (textureURL == null || taint == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + m_type = TYPE_TEXTURE; + setTextureURL(textureURL); + m_primaryColor = taint; + m_compositeAlpha = compositeAlpha; + } // CompiereColor + + /** + * Set Background to Lines + * + * @param lineColor line color + * @param backColor background color + * @param lineWidth Stroke width in point + * @param lineDistance Distance between lines in points + */ + public AdempiereColor (Color lineColor, Color backColor, float lineWidth, int lineDistance) + { + if (lineColor == null || backColor == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + m_type = TYPE_LINES; + m_primaryColor = backColor; + m_secondaryColor = lineColor; + m_lineWidth = lineWidth; + m_lineDistance = lineDistance; + } // CompiereColor + + /** + * Copy Color + * @param cc color + */ + public AdempiereColor (AdempiereColor cc) + { + if (cc == null) + return; + setColor(cc); + } // CompiereColor + + /*************************************************************************/ + + /** Type - Default: Gradient */ + private String m_type = TYPE_GRADIENT; + + /** Primary Color - Default Panel back */ + private Color m_primaryColor = UIManager.getColor("Panel.background"); + /** Secondary Color - Default: gray-white */ + private Color m_secondaryColor = new Color (245, 245, 245); + + /** Texture Graph URL */ + private URL m_textureURL = null; + /** Texture Graph */ + private BufferedImage m_image = null; + /** Texture Alpha - Default: 0.7 */ + private float m_compositeAlpha = 0.7f; + + /** Line Width - Default: 1 */ + private float m_lineWidth = 1.0f; + /** Line Distance - Default: 5 */ + private int m_lineDistance = 5; + + /** Gradient Starting point - Default: NORTH_WEST */ + private int m_startPoint = SwingConstants.NORTH_WEST; + /** Gradient repeat distance in points - Default: 100 */ + private int m_repeatDistance = 100; + + /** Background */ + private ColorBackground m_back = null; + /** 3D Look */ + private boolean m_3d = true; + + /** Diry marker for repaining Background */ + private boolean m_dirty = true; + /** Logger */ + private static Logger log = Logger.getLogger(AdempiereColor.class.getName()); + + /************************************************************************** + * Get BackgroundType (Flat, Gradient, Lines, Texture) + * @return Background Type (see TYPE_* constants) + */ + public String getType() + { + return m_type; + } // getType + + /** + * Flat Background Type (default) + * @return true if Flat background + */ + public boolean isFlat() + { + return TYPE_FLAT.equals(getType()); + } // isFlat + + /** + * Gradient Background Type + * @return true if Gradient background + */ + public boolean isGradient() + { + return TYPE_GRADIENT.equals(getType()); + } // isGradient + + /** + * Line Background Type + * @return true if Line background + */ + public boolean isLine() + { + return TYPE_LINES.equals(getType()); + } // isLine + + /** + * Texture Background Type + * @return true if Texture background + */ + public boolean isTexture() + { + return TYPE_TEXTURE.equals(getType()); + } // isTexture + + + /************************ + * Get Flat Color + * @return Primary Color + */ + public Color getFlatColor() + { + return m_primaryColor; + } // getFlatColor + + /** + * Set Flat Color + * @param color flat color + */ + public void setFlatColor(Color color) + { + if (!isFlat() || color == null) + return; + m_primaryColor = color; + m_dirty = true; + } // getFlatColor + + + /************************ + * Gradient Upper Color + * @return Color or null + */ + public Color getGradientUpperColor() + { + if (!isGradient()) + return null; + return m_primaryColor; + } // getGradientUpperColor + + /** + * Gradient Upper Color + * @param color upper color + */ + public void setGradientUpperColor(Color color) + { + if (!isGradient() || color == null) + return; + m_primaryColor = color; + m_dirty = true; + } // getGradientUpperColor + + /** + * Gradient Lower Color + * @return Color or null + */ + public Color getGradientLowerColor() + { + if (!isGradient()) + return null; + return m_secondaryColor; + } // getGradientLowerColor + + /** + * Gradient Lower Color + * @param color lower color + */ + public void setGradientLowerColor(Color color) + { + if (!isGradient() || color == null) + return; + m_secondaryColor = color; + m_dirty = true; + } // setGradientLowerColor + + /** + * Gradient Starting Point + * @return starting point - e.g. NORTH - or 0 + * @see SwingConstants + */ + public int getGradientStartPoint () + { + if (!isGradient()) + return 0; + return m_startPoint; + } // getGradientStartPoint + + /** + * Gradient Starting Point + * @param startPoint starting point - e.g. NORTH + * @see SwingConstants + */ + public void setGradientStartPoint (int startPoint) + { + if (!isGradient()) + return; + m_startPoint = startPoint; + m_dirty = true; + } // setGradientStartPoint + + /** + * Gradient Repeat Distance in point + * @return Repeat Distance - or 0 + */ + public int getGradientRepeatDistance () + { + if (!isGradient()) + return 0; + return m_repeatDistance; + } // getGradientRepeatDistance + + /** + * Gradient Repeat Distance. + * Zero stands for no repeats + * @param repeatDistance repeat gradient after point x+repeat / y+repeat (depending on direction) + */ + public void setGradientRepeatDistance (int repeatDistance) + { + if (!isGradient()) + return; + m_repeatDistance = repeatDistance; + m_dirty = true; + } // setGradientRepeatDistance + + /** + * Gradient Repeat Distance. + * Zero stands for no repeats + * @param repeatDistanceString repeat gradient after point x+repeat / y+repeat (depending on direction) + */ + public void setGradientRepeatDistance (String repeatDistanceString) + { + if (!isGradient()) + return; + try + { + setGradientRepeatDistance(Integer.parseInt(repeatDistanceString)); + } + catch (Exception e) + { + log.severe("Parsing=" + + repeatDistanceString + " - " + e.getMessage()); + } + } // setGradientRepeatDistance + + + /************************ + * Texture Url + * @return URL (if not found, org.compiere.plaf.background.jpg is used) + */ + public URL getTextureURL() + { + if (!isTexture()) + return null; + if (m_textureURL == null) + m_textureURL = AdempiereColor.class.getResource("Compiere200x100.gif"); + return m_textureURL; + } // getTextureURL + + /** + * Get Texture Image based on Texture URL + * @return Image + */ + public BufferedImage getTextureImage() + { + if (m_image == null) + { + URL url = getTextureURL(); + m_image = AdempiereUtils.loadBufferedImage(url, BufferedImage.TYPE_INT_ARGB_PRE); + } + return m_image; + } // getTextureImage + + /** + * Texture Url + * @param url URL to graphic file (jpg) + */ + public void setTextureURL(URL url) + { + if (!isTexture() || url == null) + return; + m_textureURL = url; + m_image = null; + m_dirty = true; + } // setTextureURL + + /** + * Texture Url + * @param urlString URL to graphic file (jpg) + */ + public void setTextureURL(String urlString) + { + if (!isTexture() || urlString == null) + return; + try + { + setTextureURL (new URL(urlString)); + } + catch (Exception e) + { + log.severe("Parsing URL=" + + urlString + " - " + e.getMessage()); + } + } // setTextureURL + + /** + * Texture Taint Color + * @return Color or null + */ + public Color getTextureTaintColor() + { + if (!isTexture()) + return null; + return m_primaryColor; + } // getTextureTaintColor + + /** + * Texture Taint Color + * @param color taint color + */ + public void setTextureTaintColor(Color color) + { + if (!isTexture() || color == null) + return; + m_primaryColor = color; + m_dirty = true; + } // setTextureTaintColor + + /** + * Texture Composite Alpha + * @return Composite Ampha or 0f + */ + public float getTextureCompositeAlpha() + { + if (!isTexture()) + return 0f; + return m_compositeAlpha; + } // getTextureCompositeAlpha + + /** + * Texture Composite Alpha + * @param alpha alpha value + */ + public void setTextureCompositeAlpha(float alpha) + { + if (!isTexture()) + return; + m_compositeAlpha = alpha; + m_dirty = true; + } // setTextureCompositeAlpha + + /** + * Texture Composite Alpha + * @param alphaString String to be parsed + */ + public void setTextureCompositeAlpha(String alphaString) + { + if (!isTexture() || alphaString == null) + return; + try + { + setTextureCompositeAlpha(Float.parseFloat(alphaString)); + } + catch (Exception e) + { + log.severe("Parsing=" + + alphaString + " - " + e.getMessage()); + } + } // setTextureCompositeAlpha + + + /************************ + * Line Color + * @return Color or null + */ + public Color getLineColor() + { + if (!isLine()) + return null; + return m_secondaryColor; + } // getLineColor + + /** + * Line Color + * @param color line color + */ + public void setLineColor(Color color) + { + if (!isLine() || color == null) + return; + m_secondaryColor = color; + m_dirty = true; + } // setLineColor + + /** + * Line Background Color + * @return Color or null + */ + public Color getLineBackColor() + { + if (!isLine()) + return null; + return m_primaryColor; + } // getLineBackColor + + /** + * Line Background Color + * @param color background color + */ + public void setLineBackColor(Color color) + { + if (!isLine() || color == null) + return; + m_primaryColor = color; + m_dirty = true; + } // setLineBackColor + + /** + * Background Line Width + * @return width or 0f + */ + public float getLineWidth() + { + if (!isLine()) + return 0f; + return m_lineWidth; + } // getLineWidth + + /** + * Background Line Width + * @param width line width + */ + public void setLineWidth(float width) + { + if (!isLine()) + return; + m_lineWidth = width; + m_dirty = true; + } // setLineWidth + + /** + * Background Line Width + * @param widthString line width + */ + public void setLineWidth(String widthString) + { + if (!isLine() || widthString == null) + return; + try + { + setLineWidth(Float.parseFloat(widthString)); + } + catch (Exception e) + { + log.severe("Parsing=" + + widthString + " - " + e.getMessage()); + } + } // setLineWidth + + /** + * Background Line distance in pt + * @return distance or 0 + */ + public int getLineDistance() + { + if (!isLine()) + return 0; + return m_lineDistance; + } // getLineDistance + + /** + * Background Line distance in pt + * @param distance line distance + */ + public void setLineDistance(int distance) + { + if (!isLine()) + return; + m_lineDistance = distance; + m_dirty = true; + } // setLineDistance + + /** + * Background Line distance in pt + * @param distanceString line distance + */ + public void setLineDistance(String distanceString) + { + if (!isLine()) + return; + try + { + setLineDistance(Integer.parseInt(distanceString)); + } + catch (Exception e) + { + log.severe("Parsing=" + + distanceString + " - " + e.getMessage()); + } + } // setLineDistance + + /** + * Set Prinary Color + * @param color primary color + */ + protected void setPrimaryColor (Color color) + { + if (color != null) + m_primaryColor = color; + } // setPrimaryColor + + /** + * Set CompiereColor from CompiereColor + * @param cc CompiereColor + */ + public void setColor (AdempiereColor cc) + { + if (cc == null) + return; + m_type = cc.getType(); + // + if (cc.isFlat()) + m_primaryColor = cc.getFlatColor(); + else if (cc.isGradient()) + { + m_primaryColor = cc.getGradientUpperColor(); + m_secondaryColor = cc.getGradientLowerColor(); + m_startPoint = cc.getGradientStartPoint(); + m_repeatDistance = cc.getGradientRepeatDistance(); + } + else if (cc.isTexture()) + { + setTextureURL(cc.getTextureURL()); + m_primaryColor = cc.getTextureTaintColor(); + m_compositeAlpha = cc.getTextureCompositeAlpha(); + } + else if (cc.isLine()) + { + m_primaryColor = cc.getLineBackColor(); + m_secondaryColor = cc.getLineColor(); + m_lineWidth = cc.getLineWidth(); + m_lineDistance = cc.getLineDistance(); + } + else + log.severe("Invalid Color"); + // + m_dirty = true; + } // setColor + + + /************************************************************************** + * Fill with CompiereColor Background + * @param g the Graphics context in which to paint + * @param c the component being painted + */ + public void paint (Graphics g, JComponent c) + { + getColorBackground(c).paint (g, c); + } // paint + + /** + * Fill with Compiere Background + * @param g graphics + * @param c component + * @param x x pos + * @param y y pos + * @param w with + * @param h height + */ + public void paintRect (Graphics g, JComponent c, int x, int y, int w, int h) + { + getColorBackground(c).paintRect (g,c, x,y, w,h); + } // paintRect + + /** + * Get Background + * @param c Componenr + * @return Background + */ + private ColorBackground getColorBackground (JComponent c) + { + if (m_back == null) + { + Rectangle bounds = c.getBounds(); + Container container = c.getParent(); + while (container != null) + { + bounds = container.getBounds(bounds); + container = container.getParent(); + } + m_back = new ColorBackground (bounds); + } + return m_back; + } // getBackground + + + /************************************************************************** + * String representation + * @return string representation + */ + public String toString() + { + StringBuffer sb = new StringBuffer ("CompiereColor["); + if (isFlat()) + sb.append("Flat") + .append(" ").append(AdempiereTheme.getColorAsString(getFlatColor())); + else if (isGradient()) + sb.append("Gradient") + .append(" Upper=").append(AdempiereTheme.getColorAsString(getGradientUpperColor())) + .append(",Lower=").append(AdempiereTheme.getColorAsString(getGradientLowerColor())) + .append(",Start=").append(getGradientStartPoint()) + .append(",RDistance=").append(getGradientRepeatDistance()); + else if (isLine()) + sb.append("Line") + .append(" Color=").append(AdempiereTheme.getColorAsString(getLineColor())) + .append(",BackColor=").append(AdempiereTheme.getColorAsString(getLineBackColor())) + .append(",Width=").append(getLineWidth()) + .append(",Distance=").append(getLineDistance()); + else if (isTexture()) + sb.append("Texture") + .append(" GraphURL=").append(getTextureURL()) + .append(",Taint=").append(AdempiereTheme.getColorAsString(getTextureTaintColor())) + .append(",Alpha=").append(getTextureCompositeAlpha()); + sb.append("]"); + return sb.toString(); + } // toString + + /** + * Parse String Representation and set Attributes + * @param str parse string + */ + private void parseAttributres (String str) + { + if (str.indexOf("[Flat ") != -1) + { + m_type = TYPE_FLAT; + m_primaryColor = AdempiereTheme.parseColor(str, + new ColorUIResource(m_primaryColor)); + } + else if (str.indexOf("[Gradient ") != -1) + { + m_type = TYPE_GRADIENT; + m_primaryColor = AdempiereTheme.parseColor(str.substring(str.indexOf(" Upper=")+7, str.indexOf(",Lower=")), + new ColorUIResource(m_primaryColor)); + m_secondaryColor = AdempiereTheme.parseColor(str.substring(str.indexOf(",Lower=")+7, str.indexOf(",Start=")), + new ColorUIResource(m_secondaryColor)); + m_startPoint = Integer.parseInt(str.substring(str.indexOf(",Start=")+7, str.indexOf(",RDistance="))); + setGradientRepeatDistance(str.substring(str.indexOf(",RDistance=")+11, str.lastIndexOf("]"))); + } + else if (str.indexOf("[Line ") != -1) + { + m_type = TYPE_LINES; + m_primaryColor =AdempiereTheme.parseColor(str.substring(str.indexOf(" Color=")+7, str.indexOf(",BackColor=")), + new ColorUIResource(m_primaryColor)); + m_secondaryColor = AdempiereTheme.parseColor(str.substring(str.indexOf(",BackColor=")+11, str.indexOf(",Width=")), + new ColorUIResource(m_secondaryColor)); + setLineWidth(str.substring(str.indexOf(",Width=")+7, str.indexOf(",Distance="))); + setLineDistance(str.substring(str.indexOf(",Distance=")+10, str.lastIndexOf("]"))); + } + else if (str.indexOf("[Texture ") != -1) + { + m_type = TYPE_TEXTURE; + setTextureURL (str.substring(str.indexOf(" GraphURL=")+10, str.indexOf(",Taint="))); + m_primaryColor = AdempiereTheme.parseColor(str.substring(str.indexOf(",Taint=")+7, str.indexOf(",Alpha=")), + new ColorUIResource(m_primaryColor)); + setTextureCompositeAlpha (str.substring(str.indexOf(",Alpha=")+7, str.lastIndexOf("]"))); + } + } // parseString + + /** + * Does the background needs to be redone + * @return true if there were changes + */ + boolean isDirty() + { + return m_dirty; + } // isDirty + + /** + * Set Dirty + * @param dirty if true, the background will be re-painted + */ + void setDirty (boolean dirty) + { + m_dirty = dirty; + } // setDirty + + +/****************************************************************************** + * Background contains a Buffered Image with the background. + * The initial size is determined by the constructor. + * It is resized if required when painting. + *
+ * The Buffered image is a 8-bit RGBA color components packed into integer pixels. + * The image has a DirectColorModel with alpha. The color data in this image + * is considered to be premultiplied with alpha + */ +public class ColorBackground +{ + /** + * Create Color Background + * @param bounds Rectangle to fit in + */ + public ColorBackground (Rectangle bounds) + { + createColorBackground (bounds); + fillColorBackground (); + } // Background + + private int m_height = 200; + private int m_width = 200; + private BufferedImage m_backImage; + private int m_colorBlind = AdempiereColorBlind.getColorType(); + + /** + * Create Color Background + * @param bounds Rectangle to fit in + */ + private void createColorBackground (Rectangle bounds) + { + m_height = Math.max(bounds.y + bounds.height, m_height); + m_width = Math.max(bounds.x + bounds.width, m_width); + m_backImage = new BufferedImage (m_width, m_height, BufferedImage.TYPE_INT_ARGB_PRE); + } // create Background + + + /** + * Fill Background with Color + */ + public void fillColorBackground () + { + Graphics2D g2D = m_backImage.createGraphics(); + + if (isGradient()) + { + Point start = null; + Point end = null; + int r = 1; // repeats + switch (m_startPoint) + { + case SwingConstants.NORTH_WEST: + start = new Point (0, 0); + if (m_repeatDistance > 0) + end = new Point (m_repeatDistance, m_repeatDistance); + // end = new Point (Math.min(m_repeatDistance, m_width), Math.min(m_repeatDistance, height)); + else + end = new Point (m_width/r, m_height/r); + break; + case SwingConstants.WEST: + start = new Point (0, m_height/2); + if (m_repeatDistance > 0) + end = new Point (m_repeatDistance, m_height/2); + // end = new Point (Math.min(m_repeatDistance, m_width), m_height/2); + else + end = new Point (m_width/r, m_height/2); + break; + case SwingConstants.SOUTH_WEST: + start = new Point (0, m_height); + if (m_repeatDistance > 0) + end = new Point (m_repeatDistance, m_height-m_repeatDistance); + // end = new Point (Math.min(m_width, m_repeatDistance), Math.max(0, m_height-m_repeatDistance)); + else + end = new Point (m_width/r, m_height-(m_height/r)); + break; + case SwingConstants.SOUTH: + start = new Point (0, m_height); + if (m_repeatDistance > 0) + end = new Point (0, m_height-m_repeatDistance); + // end = new Point (0, Math.max(0, m_height-m_repeatDistance)); + else + end = new Point (0, m_height-(m_height/r)); + break; + case SwingConstants.SOUTH_EAST: + start = new Point (m_width, m_height); + if (m_repeatDistance > 0) + end = new Point (m_width-m_repeatDistance, m_height-m_repeatDistance); + // end = new Point (Math.min(0, m_width-m_repeatDistance), Math.max(0, m_height-m_repeatDistance)); + else + end = new Point (m_width-(m_width/r), m_height-(m_height/r)); + break; + case SwingConstants.EAST: + start = new Point (m_width, m_height/2); + if (m_repeatDistance > 0) + end = new Point (m_width-m_repeatDistance, m_height/2); + // end = new Point (Math.min(0, m_width-m_repeatDistance), m_height/2); + else + end = new Point (m_width-(m_width/r), m_height/2); + break; + case SwingConstants.NORTH_EAST: + start = new Point (m_width, 0); + if (m_repeatDistance > 0) + end = new Point (m_width-m_repeatDistance, m_repeatDistance); + // end = new Point (Math.min(0, m_width-m_repeatDistance), Math.min(m_height, m_repeatDistance)); + else + end = new Point (m_width-(m_width/r), m_height/r); + break; + default: + case SwingConstants.NORTH: + start = new Point (0, 0); + if (m_repeatDistance > 0) + end = new Point (0, m_repeatDistance); + // end = new Point (0, Math.min(m_height, m_repeatDistance)); + else + end = new Point (0, m_height/r); + } + GradientPaint paint = new GradientPaint( + start, + AdempiereColorBlind.getDichromatColor(getGradientUpperColor()), + end, + AdempiereColorBlind.getDichromatColor(getGradientLowerColor()), + true); // cyclic + g2D.setPaint(paint); + g2D.fillRect(0, 0, m_width, m_height); + } + else if (isTexture()) + { + BufferedImage image = getTextureImage(); + if (image == null) + { + g2D.setPaint(AdempiereColorBlind.getDichromatColor(getFlatColor())); + g2D.fillRect(0, 0, m_width, m_height); + } + else + { + Rectangle anchor = new Rectangle (0,0, image.getWidth(), image.getHeight()); + TexturePaint texture = new TexturePaint (image, anchor); + g2D.setPaint(texture); + g2D.fillRect(0, 0, m_width, m_height); + g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getTextureCompositeAlpha())); + g2D.setPaint(AdempiereColorBlind.getDichromatColor(getTextureTaintColor())); + g2D.fillRect(0, 0, m_width, m_height); + } + } + else if (isLine()) + { + // Background + g2D.setPaint(AdempiereColorBlind.getDichromatColor(getLineBackColor())); + g2D.fillRect(0, 0, m_width, m_height); + // Lines + g2D.setPaint(AdempiereColorBlind.getDichromatColor(getLineColor())); + g2D.setStroke(new BasicStroke(getLineWidth())); + for (int y = 0; y < m_height; y += getLineDistance()) + g2D.drawLine(0, y, m_width, y); + } + else // flat + { + g2D.setPaint(AdempiereColorBlind.getDichromatColor(getFlatColor())); + g2D.fillRect(0, 0, m_width, m_height); + } + setDirty (false); + } // fillBackground + + /** + * Paint/copy background to component + * @param g graphics + * @param c component + */ + public void paint (Graphics g, JComponent c) + { + Rectangle bounds = c.getBounds(); + check (bounds); + // + int h = c.getHeight(); + int w = c.getWidth(); + // Copy Background + g.drawImage (m_backImage, + 0, 0, // destination start point + w, h, // destination end point + bounds.x, bounds.y, // source start + bounds.x+w, bounds.y+h, // source end + c); + } // paint + + /** + * Paint/copy background to component rectangle + * @param g graphics + * @param c compnent + * @param x x pos + * @param y y pos + * @param w width + * @param h height + */ + public void paintRect (Graphics g, JComponent c, int x, int y, int w, int h) + { + Rectangle bounds = c.getBounds(); + check (bounds); + // Copy Background + g.drawImage (m_backImage, + x, y, // destination start point + x+w, h+y, // destination end point + x, y, // source start + x+w, y+h, // source end + c); + } // paint + + /** + * Check size of background and repaint if required + * @param bounds Bounds of component + */ + private void check (Rectangle bounds) + { + // Re-Create, if Color Type changed + if (AdempiereColorBlind.getColorType() != m_colorBlind) + { + m_colorBlind = AdempiereColorBlind.getColorType(); + setDirty(true); + } + // we need to create new background + if ((m_height < (bounds.y + bounds.height)) + || (m_width < (bounds.x + bounds.width))) + { + createColorBackground (bounds); + fillColorBackground(); + } + else if (isDirty()) + fillColorBackground(); + } // check + +} // ColorBackground + +} // CompiereColor diff --git a/looks/src/org/adempiere/plaf/AdempiereColorBlind.java b/looks/src/org/adempiere/plaf/AdempiereColorBlind.java new file mode 100755 index 0000000000..e6bf0c8e37 --- /dev/null +++ b/looks/src/org/adempiere/plaf/AdempiereColorBlind.java @@ -0,0 +1,286 @@ +/****************************************************************************** + * The contents of this file are subject to the Compiere License Version 1.1 + * ("License"); You may not use this file except in compliance with the License + * You may obtain a copy of the License at http://www.compiere.org/license.html + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial + * Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke + * are Copyright (C) 1999-2005 Jorg Janke. + * All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved. + * Contributor(s): ______________________________________. + *****************************************************************************/ +package org.adempiere.plaf; + +import java.awt.Color; +import java.util.logging.*; + +import javax.swing.plaf.ColorUIResource; + +/** + * Color Blind Utilities. + * These utilities help to show how color blind/challenged see colors. + * + * Created by Thomas Wolfmaier. + * Copyright (C) 1999-2005 HCIRN. + * All rights reserved. + * @see HCIRN + * + * @author Thomas Wolfmaier + * @version $Id: ColorBlind.java,v 1.8 2005/10/14 00:42:52 jjanke Exp $ + */ +public class AdempiereColorBlind +{ + /** Color Blindness Type - 0=none */ + public static final String[] COLORBLIND_TYPE = + {"", "Protanopia", "Deuteranopia", "Tritanopia"}; + + public static final int NORMAL = 0; + public static final int PROTANOPIA = 1; + public static final int DEUTERANOPIA = 2; + public static final int TRITANOPIA = 3; + + /*************************************************************************/ + + private static final double[][] confusionPoints = + { {0.735, 0.265}, + {1.140, -0.140}, + {0.171, -0.003} + }; + private static final double[][][] colorAxes = + { {{0.115807, 0.073581}, {0.471899, 0.527051}}, + {{0.102776, 0.102864}, {0.505845, 0.493211}}, + {{0.045391, 0.294976}, {0.665764, 0.334011}} + }; + private static final double[][] RGBtoXYZMatrix = + { {0.430574, 0.341550, 0.178325}, + {0.222015, 0.706655, 0.071330}, + {0.020183, 0.129553, 0.939180} + }; + private static final double[][] XYZtoRGBMatrix = + { { 3.063218, -1.393325, -0.475802}, + {-0.969243, 1.875966, 0.041555}, + { 0.067871, -0.228834, 1.069251} + }; + private static final double[] whitePoint = + { 0.312713, 0.329016, 0.358271 + }; + private static final double gamma = 2.2; + + /** Color Blind Type */ + private static int s_colorType = NORMAL; + + /** Logger */ + private static Logger log = Logger.getLogger(AdempiereColorBlind.class.getName()); + + + /** + * Set Color Type for Color Blind view + * @param colorType (0 = none) + */ + public static void setColorType (int colorType) + { + if (colorType > 0 && colorType < 4) + s_colorType = colorType; + else + s_colorType = 0; + if (s_colorType != 0) + log.config(COLORBLIND_TYPE[colorType]); + } // setColorType + + /** + * Get Color Type for Color Blind view + * @return colorType (0 = none) + */ + public static int getColorType () + { + return s_colorType; + } // getColorType + + + /************************************************************************** + * Convert "normal" color to Dichromat Color based on set color type + * @param color Java Color object containing values for RGB + * @return Dichromat Color + */ + public static ColorUIResource getDichromatColorUIResource (ColorUIResource color) + { + if (s_colorType == NORMAL) + return color; + return new ColorUIResource(getDichromatColorUIResource (color, s_colorType)); + } // convertToDichromatColorUIResource + + /** + * Convert "normal" color to Dichromat Color + * @param color Java Color object containing values for RGB + * @param colorType PROTANOPIA = 1, DEUTERANOPIA = 2 or TRITANOPIA = 3 as declared above + * @return Dichromat Color + */ + public static Color getDichromatColorUIResource (ColorUIResource color, int colorType) + { + if (s_colorType == NORMAL) + return color; + return new ColorUIResource(getDichromatColor (color, s_colorType)); + } // convertToDichromatColorUIResource + + /** + * Convert "normal" color to Dichromat Color based on set color type + * @param color Java Color object containing values for RGB + * @return Dichromat Color + */ + public static Color getDichromatColor (Color color) + { + if (s_colorType == NORMAL) + return color; + return getDichromatColor (color, s_colorType); + } // convertToDichromatColor + + /** + * Convert "normal" color to Dichromat Color + * @param color Java Color object containing values for RGB + * @param colorType PROTANOPIA = 1, DEUTERANOPIA = 2 or TRITANOPIA = 3 as declared above + * @return Dichromat Color + */ + public static Color getDichromatColor (Color color, int colorType) + { + // check type & return if not valid + int type = 0; + if (colorType > 0 && colorType < 4) + type = colorType; + // No conversion or no color + if (type == 0 || color == null) + return color; + type--; // correct to zero based + + // Return white & black - not converted + if (color.equals(Color.black) || color.equals(Color.white)) + return color; + + double red = color.getRed(); + double green = color.getGreen(); + double blue = color.getBlue(); + + // System.out.println("Red: " + red + " Green: " + green + " Blue: " + blue); + + double X = RGBtoXYZMatrix[0][0] * Math.pow(red / 255.0, gamma) + + RGBtoXYZMatrix[0][1] * Math.pow(green / 255.0, gamma) + + RGBtoXYZMatrix[0][2] * Math.pow(blue / 255.0, gamma); + double Y = RGBtoXYZMatrix[1][0] * Math.pow(red / 255.0, gamma) + + RGBtoXYZMatrix[1][1] * Math.pow(green / 255.0, gamma) + + RGBtoXYZMatrix[1][2] * Math.pow(blue / 255.0, gamma); + double Z = RGBtoXYZMatrix[2][0] * Math.pow(red / 255.0, gamma) + + RGBtoXYZMatrix[2][1] * Math.pow(green / 255.0, gamma) + + RGBtoXYZMatrix[2][2] * Math.pow(blue / 255.0, gamma); + + // System.out.println("X: " + X + " Y: " + Y + " Z: " + Z); + + double x = 0.0; + double y = 0.0; + + if ((X + Y + Z) != 0.0) + { + x = X / (X + Y + Z); + y = Y / (X + Y + Z); + } + + // System.out.println("x: " + x + " y: " + y + " Y: " + Y); + + double Yn = Y; + double Xn = (whitePoint[0] * Yn) / whitePoint[1]; + double Zn = (whitePoint[2] * Yn) / whitePoint[1]; + + double xc = confusionPoints[type][0]; + double yc = confusionPoints[type][1]; + + double x1 = colorAxes[type][0][0]; + double y1 = colorAxes[type][0][1]; + double x2 = colorAxes[type][1][0]; + double y2 = colorAxes[type][1][1]; + + double ap = (y2 - y1) / (x2 - x1); + double bp = y1 - (x1 * ap); + + // System.out.println("ap: " + ap + " bp: " + bp); + + double a; + if (x < xc) + a = (yc - y) / (xc - x); + else + a = (y - yc) / (x - xc); + + double b = y - (x * a); + + // System.out.println("a: " + a + " b: " + b); + + x = (bp - b) / (a - ap); + y = a * x + b; + + // System.out.println("x: " + x + " y: " + y); + + X = 0.0; + Z = 0.0; + if (y != 0) + { + X = x * (Y / y); + Z = (1 - x - y) * (Y / y); + } + + // System.out.println("X: " + X + " Y: " + Y + " Z: " + Z); + + red = XYZtoRGBMatrix[0][0] * X + + XYZtoRGBMatrix[0][1] * Y + + XYZtoRGBMatrix[0][2] * Z; + green = XYZtoRGBMatrix[1][0] * X + + XYZtoRGBMatrix[1][1] * Y + + XYZtoRGBMatrix[1][2] * Z; + blue = XYZtoRGBMatrix[2][0] * X + + XYZtoRGBMatrix[2][1] * Y + + XYZtoRGBMatrix[2][2] * Z; + + // System.out.println("Red: " + red + " Green: " + green + " Blue: " + blue); + + double reddiff = XYZtoRGBMatrix[0][0] * (Xn - X) + + XYZtoRGBMatrix[0][1] * (Yn - Y) + + XYZtoRGBMatrix[0][2] * (Zn - Z); + double greendiff = XYZtoRGBMatrix[1][0] * (Xn - X) + + XYZtoRGBMatrix[1][1] * (Yn - Y) + + XYZtoRGBMatrix[1][2] * (Zn - Z); + double bluediff = XYZtoRGBMatrix[2][0] * (Xn - X) + + XYZtoRGBMatrix[2][1] * (Yn - Y) + + XYZtoRGBMatrix[2][2] * (Zn - Z); + + double cr = ((red < 0.0 ? 0.0 : 1.0) - red) / reddiff; + double cg = ((green < 0.0 ? 0.0 : 1.0) - green) / greendiff; + double cb = ((blue < 0.0 ? 0.0 : 1.0) - blue) / bluediff; + + // System.out.println("cr: " + cr + " cg: " + cg + " cb: " + cb); + + double c1 = (cr < 0 || cr > 1) ? 0 : cr; + double c2 = (cg < 0 || cg > 1) ? 0 : cg; + double c3 = (cb < 0 || cb > 1) ? 0 : cb; + double c = Math.max(c1, Math.max(c2, c3)); + + // System.out.println("c: " + c); + + red = red + c * reddiff; + green = green + c * greendiff; + blue = blue + c * bluediff; + + // System.out.println("Red: " + red + " Green: " + green + " Blue: " + blue); + + red = Math.pow(red, 1.0 / gamma); + green = Math.pow(green, 1.0 / gamma); + blue = Math.pow(blue, 1.0 / gamma); + + // System.out.println("Red: " + red + " Green: " + green + " Blue: " + blue); + // System.out.println("Red: " + red * 255.0 + " Green: " + green * 255.0 + " Blue: " + blue * 255.0); + + Color retValue = new Color((float)red, (float)green, (float)blue); + log.fine("Color " + color.getRed() + "-" + color.getGreen() + "-" + color.getBlue() + + " -> " + retValue.getRed() + "-" + retValue.getGreen() + "-" + retValue.getBlue() + " <- " + COLORBLIND_TYPE[colorType]); + + return retValue; + } // convertToDichromatColor + +} // ColorBlind diff --git a/looks/src/org/adempiere/plaf/AdempiereComboBoxUI.java b/looks/src/org/adempiere/plaf/AdempiereComboBoxUI.java new file mode 100755 index 0000000000..652ef55b74 --- /dev/null +++ b/looks/src/org/adempiere/plaf/AdempiereComboBoxUI.java @@ -0,0 +1,109 @@ +/****************************************************************************** + * The contents of this file are subject to the Compiere License Version 1.1 + * ("License"); You may not use this file except in compliance with the License + * You may obtain a copy of the License at http://www.compiere.org/license.html + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial + * Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke + * are Copyright (C) 1999-2005 Jorg Janke. + * All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved. + * Contributor(s): ______________________________________. + *****************************************************************************/ +package org.adempiere.plaf; + +import java.awt.event.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; +import javax.swing.plaf.metal.*; + +import org.compiere.plaf.AdempiereComboPopup; + + +/** + * Compiere ComboBox UI. + * The ComboBox is opaque - with opaque arrow button and textfield background + * + * @author Jorg Janke + * @version $Id: CompiereComboBoxUI.java,v 1.10 2005/10/09 19:01:37 jjanke Exp $ + */ +public class AdempiereComboBoxUI extends com.jgoodies.looks.plastic.PlasticComboBoxUI +{ + /** + * Create UI + * @param c + * @return new instance of CompiereComboBoxUI + */ + public static ComponentUI createUI(JComponent c) + { + return new AdempiereComboBoxUI(); + } // CreateUI + + /*************************************************************************/ + + static int s_no = 0; + /** + * Install UI - Set ComboBox opaque. + * Bug in Metal: arrowButton gets Mouse Events, so add the JComboBox + * MouseListeners to the arrowButton + * @see org.compiere.swing.CComboBox#addMouseListener(MouseListener) + * @param c componrnt + */ + public void installUI (JComponent c) + { + MouseListener[] ml = c.getMouseListeners(); + super.installUI(c); + c.setOpaque(false); + // + for (int i = 0; i < ml.length; i++) + { + // System.out.println("adding " + c.getClass().getName()); + arrowButton.addMouseListener(ml[i]); + } + + } // installUI + + /*************************************************************************/ + + /** + * Create opaque button + * @return opaque button + */ + protected JButton createArrowButton() + { + JButton button = super.createArrowButton(); + button.setContentAreaFilled(false); + button.setOpaque(false); + return button; + } // createArrowButton + + public JButton getArrowButton() + { + return arrowButton; + } + + /** + * Set Icon of arrow button + * @param defaultIcon + */ + public void setIcon(Icon defaultIcon) + { + ((MetalComboBoxButton)arrowButton).setComboIcon(defaultIcon); + } // setIcon + + /*************************************************************************/ + + /** + * Create Popup + * @return AdempiereComboPopup + */ + protected ComboPopup createPopup() + { + AdempiereComboPopup newPopup = new AdempiereComboPopup( comboBox ); + newPopup.getAccessibleContext().setAccessibleParent(comboBox); + return newPopup; + } // createPopup + +} // AdempiereComboBoxUI diff --git a/looks/src/org/adempiere/plaf/AdempiereLabelUI.java b/looks/src/org/adempiere/plaf/AdempiereLabelUI.java new file mode 100755 index 0000000000..14e9380b02 --- /dev/null +++ b/looks/src/org/adempiere/plaf/AdempiereLabelUI.java @@ -0,0 +1,153 @@ +/****************************************************************************** + * The contents of this file are subject to the Compiere License Version 1.1 + * ("License"); You may not use this file except in compliance with the License + * You may obtain a copy of the License at http://www.compiere.org/license.html + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial + * Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke + * are Copyright (C) 1999-2005 Jorg Janke. + * All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved. + * Contributor(s): ______________________________________. + *****************************************************************************/ +package org.adempiere.plaf; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +import sun.swing.*; + +/** + * Compiere Label UI + * + * @author Jorg Janke + * @version $Id: CompiereLabelUI.java,v 1.2 2005/12/05 02:38:28 jjanke Exp $ + */ +public class AdempiereLabelUI extends MetalLabelUI +{ + /** Singleton */ + protected static AdempiereLabelUI compiereLabelUI = new AdempiereLabelUI(); + + /** + * Create UI + * @param c component + * @return singleton + */ + public static AdempiereLabelUI createUI(JComponent c) + { + return compiereLabelUI; + } // createUI + + /** + * Install Keyboard Actions + * @param l label + */ + protected void installKeyboardActions (JLabel l) + { + // super.installKeyboardActions(l); + int dka = l.getDisplayedMnemonic(); + if (dka != 0) + { + Component lf = l.getLabelFor(); + if (lf != null) + { + ActionMap actionMap = l.getActionMap(); + actionMap.put(PRESS, ACTION_PRESS); + InputMap inputMap = SwingUtilities.getUIInputMap (l, JComponent.WHEN_IN_FOCUSED_WINDOW); + if (inputMap == null) + { + inputMap = new ComponentInputMapUIResource (l); + SwingUtilities.replaceUIInputMap (l, JComponent.WHEN_IN_FOCUSED_WINDOW, inputMap); + } + inputMap.clear (); + inputMap.put (KeyStroke.getKeyStroke (dka, + ActionEvent.SHIFT_MASK+ActionEvent.CTRL_MASK, false), PRESS); + } + } + } // installKeyboardActions + + + /** Action Name */ + private static final String PRESS = "press"; + /** Press Action */ + private static PressAction ACTION_PRESS = new PressAction(); + + /** + * Compiere Label UI Actions + */ + private static class PressAction extends UIAction + { + + PressAction () + { + super (PRESS); + } + + public void actionPerformed (ActionEvent e) + { + JLabel label = (JLabel)e.getSource (); + String key = getName (); + if (key == PRESS) + { + doPress (label); + } + } // actionPerformed + + /** + * Do Press - Focus the Field + * @param label label + */ + private void doPress (JLabel label) + { + Component labelFor = label.getLabelFor (); + if (labelFor != null && labelFor.isEnabled ()) + { + Component owner = label.getLabelFor (); + if (owner instanceof Container + && ((Container)owner).isFocusCycleRoot ()) + { + owner.requestFocus (); + } + else + { + if (owner instanceof Container) + { + Container container = (Container)owner; + if (container.isFocusCycleRoot()) + { + FocusTraversalPolicy policy = container.getFocusTraversalPolicy(); + Component comp = policy.getDefaultComponent(container); + if (comp != null) + { + comp.requestFocus(); + return; + } + } + Container rootAncestor = container.getFocusCycleRootAncestor(); + if (rootAncestor != null) + { + FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy(); + Component comp = policy.getComponentAfter(rootAncestor, container); + if (comp != null && SwingUtilities.isDescendingFrom(comp, container)) + { + comp.requestFocus(); + return; + } + } + } + if (owner.isFocusable()) + { + owner.requestFocus(); + return; + } + // No Forcus + } + } + } // doPress + } // PressAction + +} // CompiereLabelUI diff --git a/looks/src/org/adempiere/plaf/AdempiereLookAndFeel.java b/looks/src/org/adempiere/plaf/AdempiereLookAndFeel.java new file mode 100755 index 0000000000..4fb4c896c4 --- /dev/null +++ b/looks/src/org/adempiere/plaf/AdempiereLookAndFeel.java @@ -0,0 +1,247 @@ +/****************************************************************************** + * The contents of this file are subject to the Compiere License Version 1.1 + * ("License"); You may not use this file except in compliance with the License + * You may obtain a copy of the License at http://www.compiere.org/license.html + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial + * Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke + * are Copyright (C) 1999-2005 Jorg Janke. + * All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved. + * Contributor(s): ______________________________________. + *****************************************************************************/ +package org.adempiere.plaf; + +import java.awt.*; + +import javax.swing.*; +import javax.swing.plaf.metal.*; + +/** + * Compiere Look & Feel. + * We wanted a nice UI not the battleship gray based stuff. + * I guess a matter of taste. + * + * : + * UIManager.setLookAndFeel(new com.compiere.plaf.CompiereLookAndFeel()); + * // or UIManager.setLookAndFeel("com.compiere.plaf.CompiereLookAndFeel"); + * + * + * @author Jorg Janke + * @version $Id: CompiereLookAndFeel.java,v 1.19 2005/12/05 02:38:28 jjanke Exp $ + */ +public class AdempiereLookAndFeel extends com.jgoodies.looks.plastic.PlasticLookAndFeel +{ + /** + * Constructor + */ + public AdempiereLookAndFeel() + { + super(); + // System.setProperty("awt.visualbell", "true"); + } // CompiereLookAndFeel + + /** The name */ + public static final String NAME = "Adempiere"; + + /** The Theme */ + private static AdempiereTheme s_adempiereTheme = new org.adempiere.plaf.AdempiereTheme(); + private static AdempiereTheme s_theme = s_adempiereTheme; + + /** Paint Round Corners */ + protected static boolean ROUND = false; + + /** + * The Name + * @return Name + */ + public String getName() + { + return NAME; + } // getName + + /** + * The ID + * @return Name + */ + public String getID() + { + return NAME; + } // getID + + /** + * The Description + * @return description + */ + public String getDescription() + { + return "Adempiere Look & Feel - (c) 2001-2005 Victor Perez"; + } // getDescription + + + /************************************************************************** + * Get/Create Defaults + * @return UI Defaults + */ + public UIDefaults getDefaults() + { + // System.out.println("CompiereLookAndFeel.getDefaults"); + // Theme already created/set + //MetalLookAndFeel.setCurrentTheme(s_theme); + com.jgoodies.looks.plastic.PlasticLookAndFeel.setCurrentTheme(s_theme); + UIDefaults defaults = super.getDefaults(); // calls init..Defaults + return defaults; + } // getDefaults + + /** + * Creates the mapping from UI class IDs to ComponentUI classes, + * putting the ID-ComponentUI pairs in the passed-in defaults table. + * Each JComponent class specifies its own UI class ID string. + * + * @param table UI Defaults + */ + protected void initClassDefaults(UIDefaults table) + { + //System.out.println("AdempiereLookAndFeel.initClassDefaults"); + super.initClassDefaults( table); + // Overwrite + /*putDefault (table, "PanelUI"); + putDefault (table, "ButtonUI"); + putDefault (table, "ToggleButtonUI"); + putDefault (table, "TabbedPaneUI"); + putDefault (table, "TableHeaderUI"); + putDefault (table, "RadioButtonUI");*/ + //putDefault (table, "CheckBoxUI"); + putDefault (table, "ComboBoxUI"); + /*putDefault (table, "MenuUI"); + putDefault (table, "MenuBarUI"); + putDefault (table, "MenuItemUI"); + putDefault (table, "CheckBoxMenuItemUI"); + putDefault (table, "ToolBarUI"); + putDefault (table, "RootPaneUI"); + putDefault (table, "ViewportUI"); + putDefault (table, "SplitPaneUI"); + putDefault (table, "ScrollPaneUI");*/ + putDefault (table, "LabelUI"); + /*putDefault (table, "ToolTipUI"); + putDefault (table, "TextAreaUI");*/ + + } // initClassDefaults + + /** + * Put "uiKey - ClassName" pair in UIDefaults + * @param table + * @param uiKey + */ + private void putDefault (UIDefaults table, String uiKey) + { + try + { + String className = "org.adempiere.plaf.Adempiere" + uiKey; + table.put(uiKey, className); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } // putDefault + + /** + * For overwriting Component defaults + * @param table + */ + protected void initSystemColorDefaults (UIDefaults table) + { + // System.out.println("CompiereLookAndFeel.initSystemColorDefaults"); + super.initSystemColorDefaults( table); + + // we made the color a bit darker + // table.put("textHighlight", CompiereUtils.getTranslucentColor(getTextHighlightColor(), 128)); + } // initSystemColorDefaults + + /** + * For overwriting Component defaults + * @param table + */ + protected void initComponentDefaults (UIDefaults table) + { + // System.out.println("CompiereLookAndFeel.initComponentDefaults"); + super.initComponentDefaults( table); + + // ComboBox defaults + Color c = table.getColor("TextField.background"); + table.put("ComboBox.background", c); + table.put("ComboBox.listBackground", c); + + // globalqss + Class lf = com.jgoodies.looks.plastic.PlasticLookAndFeel.class; + table.put("Tree.openIcon", makeIcon(lf, "icons/TreeOpen.gif")); + table.put("Tree.closedIcon", makeIcon(lf, "icons/TreeClosed.gif")); + table.put("Tree.leafIcon", makeIcon(lf, "icons/TreeLeaf.gif")); + + } // initComponentDefaults + + + /************************************************************************** + * Create Default Thems + */ + protected void createDefaultTheme() + { + setCurrentTheme(s_theme); + } // createDefaultTheme + + /** + * Set Current Theme + * @param theme metal theme + */ + public static void setCurrentTheme (org.adempiere.plaf.AdempiereTheme theme) + { + if (theme != null) + s_theme = theme; + MetalLookAndFeel.setCurrentTheme(s_theme); + } // setCurrentTheme + + /** + * Get Current Theme + * @return Metal Theme + */ + public static AdempiereTheme getCurrentTheme() + { + return s_theme; + } // getCurrentTheme + + /** + * Get Compiere Theme + * @return Metal Theme + */ + public static AdempiereTheme getAdempiereTheme() + { + return s_adempiereTheme; + } // getCurrentTheme + + /** + * Error Feedback. + *

+ * Invoked when the user attempts an invalid operation, + * such as pasting into an uneditable JTextField + * that has focus. + *

+ *

+ * If the user has enabled visual error indication on + * the desktop, this method will flash the caption bar + * of the active window. The user can also set the + * property awt.visualbell=true to achieve the same + * results. + *

+ * @param component Component the error occured in, may be + * null indicating the error condition is + * not directly associated with a + * Component. + */ + public void provideErrorFeedback (Component component) + { + super.provideErrorFeedback (component); + } // provideErrorFeedback + +} // CompiereLookAndFeel diff --git a/looks/src/org/adempiere/plaf/AdempiereTheme.java b/looks/src/org/adempiere/plaf/AdempiereTheme.java new file mode 100755 index 0000000000..2657993568 --- /dev/null +++ b/looks/src/org/adempiere/plaf/AdempiereTheme.java @@ -0,0 +1,638 @@ +package org.adempiere.plaf; + + +import java.awt.Color; +import java.awt.Font; +import java.awt.SystemColor; +import java.util.logging.Logger; + +import javax.swing.UIDefaults; +import javax.swing.plaf.ColorUIResource; +import javax.swing.plaf.FontUIResource; + +//import org.compiere.plaf.ColorBlind; +import org.compiere.util.Ini; + +import com.jgoodies.looks.plastic.PlasticScrollBarUI; +import com.jgoodies.looks.plastic.theme.*; + + +/** + * A theme based on GTK2-Gilouche and tango project iconset. + * It has been optimized to work with Suse SLED 10 default desktop settings. + * + * + * @author vpj-cd + * @version $Revision: 1.0 $ + */ +public class AdempiereTheme extends com.jgoodies.looks.plastic.theme.DesertBluer { + + + /** + * Return Theme Name + * @return Theme Name + */ + public String getName() + { + return s_name; + } // getName + + + /** + * String Representation + * @return info + */ + public String toString () + { + return getName(); + } // toString + + + + /** Static Initializer */ + static + { + s_theme = new org.adempiere.plaf.AdempiereTheme(); + } + + /** + * Set Theme to current Metal Theme and copy it + */ + public static void setTheme () + { + log.fine(""); + org.adempiere.plaf.AdempiereTheme copyFrom = new org.adempiere.plaf.AdempiereTheme(); + boolean flat = Ini.isPropertyBool(Ini.P_UI_FLAT); + setTheme (copyFrom, flat); + } // setTheme + + /** + * Set Theme to current Metal Theme and copy it + * @param copyFrom theme + * @param flat flat colors + */ + public static void setTheme (org.adempiere.plaf.AdempiereTheme copyFrom, boolean flat) + { + if (copyFrom == null || copyFrom instanceof org.adempiere.plaf.AdempiereTheme) + return; + log.fine(copyFrom.getName() + " - Flat=" + flat); + // May not be correct, if Themes overwrites default methods + primary1 = copyFrom.getPrimaryControlDarkShadow(); + primary2 = copyFrom.getPrimaryControlShadow(); + primary3 = copyFrom.getPrimaryControl(); + secondary1 = copyFrom.getControlDarkShadow(); + secondary2 = copyFrom.getControlShadow(); + secondary3 = copyFrom.getControl(); + org.compiere.plaf.AdempierePanelUI.setDefaultBackground(new org.compiere.plaf.AdempiereColor(secondary3, flat)); + white = copyFrom.getPrimaryControlHighlight(); + black = copyFrom.getPrimaryControlInfo(); + // + controlFont = copyFrom.getControlTextFont(); + systemFont = copyFrom.getSystemTextFont(); + userFont = copyFrom.getUserTextFont(); + smallFont = copyFrom.getSubTextFont(); + menuFont = copyFrom.getMenuTextFont(); + windowFont = copyFrom.getWindowTitleFont(); + } // setTheme + + + //------------------------------------------------- + /** Theme Name */ + protected static String s_name = "Adempiere Theme"; + public static final String NAME = s_name; + /** Logger */ + protected static Logger log = Logger.getLogger(org.adempiere.plaf.AdempiereTheme.class.getName()); + /** Active Theme */ + protected static AdempiereTheme s_theme = null; + + /** Blue 51,51,102 */ + public static ColorUIResource primary0 = new ColorUIResource(103, 152, 203); + /** Blue 102, 102, 153 */ + //protected static ColorUIResource primary1; + public static ColorUIResource primary1 = new ColorUIResource( 101, 138, 187); + /** Blue 153, 153, 204 */ + public static ColorUIResource primary2 = new ColorUIResource(103, 152, 203); + /** Blue 204, 204, 255 */ + public static ColorUIResource primary3= new ColorUIResource(233, 238, 245); // + + /** Black */ + public final ColorUIResource secondary0 = new ColorUIResource(0, 0, 0); + /** Gray 102, 102, 102 */ + //protected static ColorUIResource secondary1; + public static ColorUIResource secondary1= new ColorUIResource(190, 179, 153); + /** Gray 153, 153, 153 */ + //protected static ColorUIResource secondary2; + public static ColorUIResource secondary2= new ColorUIResource(246, 239, 224); + /** BlueGray 214, 224, 234 - background */ + //protected static ColorUIResource secondary3; + public static ColorUIResource secondary3= new ColorUIResource(251, 248, 241); + /** White */ + public final ColorUIResource secondary4 = new ColorUIResource(255, 255, 255); + + /** Black */ + public static ColorUIResource black = BLACK; + /** White */ + public static ColorUIResource white = WHITE; + + /** Background for mandatory fields */ + public static ColorUIResource mandatory = new ColorUIResource(233, 238, 245); // blueish + /** Background for fields in error 180,220,143 */ + public static ColorUIResource error = new ColorUIResource(220, 241, 203); // green ; + /** Background for inactive fields */ + public static ColorUIResource inactive = new ColorUIResource(241,239,222); //234, 234, 234); + /** Background for info fields */ + public static ColorUIResource info = new ColorUIResource(251, 248, 251); // somewhat white + + /** Foreground Text OK */ + public static ColorUIResource txt_ok =new ColorUIResource(0, 153, 255); // blue ; + /** Foreground Text Error */ + public static ColorUIResource txt_error = new ColorUIResource(255, 0, 51); // red ; + + /** Control font */ + public static FontUIResource controlFont; + /** System font */ + public static FontUIResource systemFont; + /** User font */ + public static FontUIResource userFont; + /** Small font */ + public static FontUIResource smallFont; + /** Window Title font */ + public static FontUIResource windowFont; + /** Menu font */ + public static FontUIResource menuFont; + + /** Default Font */ + public static final String FONT_DEFAULT = "Dialog"; + /** Default Font Size */ + public static final int FONT_SIZE = 12; + + + /************************************************************************** + * Get Primary 1 (blue in default Metal Theme) + * @return color + */ + public ColorUIResource getPrimary1() + { + return AdempiereColorBlind.getDichromatColorUIResource(primary1); + } + public ColorUIResource getPrimary2() + { + return AdempiereColorBlind.getDichromatColorUIResource(primary2); + } + public ColorUIResource getPrimary3() + { + return AdempiereColorBlind.getDichromatColorUIResource(primary3); + } + + /** + * Get Seconary 1 (gray in default Metal Theme) + * @return color + */ + public ColorUIResource getSecondary0() + { + return AdempiereColorBlind.getDichromatColorUIResource(secondary0); + } + public ColorUIResource getSecondary1() + { + return AdempiereColorBlind.getDichromatColorUIResource(secondary1); + } + public ColorUIResource getSecondary2() + { + return AdempiereColorBlind.getDichromatColorUIResource(secondary2); + } + public ColorUIResource getSecondary3() + { + return AdempiereColorBlind.getDichromatColorUIResource(secondary3); + } + public ColorUIResource getSecondary4() + { + return AdempiereColorBlind.getDichromatColorUIResource(secondary4); + } + + public ColorUIResource getBlack() + { + return AdempiereColorBlind.getDichromatColorUIResource(black); + } + public ColorUIResource getWhite() + { + return AdempiereColorBlind.getDichromatColorUIResource(white); + } + + /** + * Control Font (plain) + * @return font + */ + protected static FontUIResource _getControlTextFont() + { + if (controlFont == null) + { + try + { + controlFont = new FontUIResource(Font.getFont("swing.plaf.metal.controlFont", + new Font(FONT_DEFAULT, Font.PLAIN, FONT_SIZE))); + } + catch (Exception e) + { + controlFont = new FontUIResource(FONT_DEFAULT, Font.PLAIN, FONT_SIZE); + } + } + return controlFont; + } + public FontUIResource getControlTextFont() {return _getControlTextFont();} + + /** + * System Font + * @return font + */ + protected static FontUIResource _getSystemTextFont() + { + if (systemFont == null) + { + try + { + systemFont = new FontUIResource(Font.getFont("swing.plaf.metal.systemFont", + new Font(FONT_DEFAULT, Font.PLAIN, FONT_SIZE))); + } + catch (Exception e) + { + systemFont = new FontUIResource(FONT_DEFAULT, Font.PLAIN, FONT_SIZE); + } + } + return systemFont; + } + public FontUIResource getSystemTextFont() {return _getSystemTextFont();} + + /** + * User Font + * @return font + */ + protected static FontUIResource _getUserTextFont() + { + if (userFont == null) + { + try + { + userFont = new FontUIResource(Font.getFont("swing.plaf.metal.userFont", + new Font(FONT_DEFAULT, Font.PLAIN, FONT_SIZE))); + } + catch (Exception e) + { + userFont = new FontUIResource(FONT_DEFAULT, Font.PLAIN, FONT_SIZE); + } + } + return userFont; + } + public FontUIResource getUserTextFont() {return _getUserTextFont();} + + /** + * Menu + * @return font + */ + protected static FontUIResource _getMenuTextFont() + { + if (menuFont == null) + { + try + { + menuFont = new FontUIResource(Font.getFont("swing.plaf.metal.menuFont", + new Font(FONT_DEFAULT, Font.PLAIN, FONT_SIZE))); + } + catch (Exception e) + { + menuFont = new FontUIResource(FONT_DEFAULT, Font.PLAIN, FONT_SIZE); + } + } + return menuFont; + } + public FontUIResource getMenuTextFont() {return _getMenuTextFont();} + + /** + * Window Title + * @return font + */ + protected static FontUIResource _getWindowTitleFont() + { + if (windowFont == null) + { + try + { + windowFont = new FontUIResource(Font.getFont("swing.plaf.metal.windowFont", + new Font(FONT_DEFAULT, Font.BOLD, FONT_SIZE+2))); + } + catch (Exception e) + { + windowFont = new FontUIResource(FONT_DEFAULT, Font.BOLD, FONT_SIZE+2); + } + } + return windowFont; + } + public FontUIResource getWindowTitleFont() {return _getWindowTitleFont();} + + /** + * Sub Text + * @return font + */ + protected static FontUIResource _getSubTextFont() + { + if (smallFont == null) + { + try + { + smallFont = new FontUIResource(Font.getFont("swing.plaf.metal.smallFont", + new Font(FONT_DEFAULT, Font.PLAIN, FONT_SIZE-2))); + } + catch (Exception e) + { + smallFont = new FontUIResource(FONT_DEFAULT, Font.PLAIN, FONT_SIZE-2); + } + } + return smallFont; + } + public FontUIResource getSubTextFont() {return _getSubTextFont();} + + // Static property info + + private static final String P_Primary1 = "#ColorPrimary1"; + private static final String P_Primary2 = "#ColorPrimary2"; + private static final String P_Primary3 = "#ColorPrimary3"; + private static final String P_Secondary1 = "#ColorSecondary1"; + private static final String P_Secondary2 = "#ColorSecondary2"; + private static final String P_Secondary3 = "#ColorSecondary3"; + private static final String P_Black = "#ColorBlack"; + private static final String P_White = "#ColorWhite"; + private static final String P_Error = "#ColorError"; + private static final String P_Info = "#ColorInfo"; + private static final String P_Mandatory = "#ColorMandatory"; + private static final String P_Inactive = "#ColorInactive"; + private static final String P_Txt_OK = "#ColorTextOK"; + private static final String P_Txt_Error = "#ColorTextError"; + // + private static final String P_Control = "#FontControl"; + private static final String P_System = "#FontSystem"; + private static final String P_User = "#FontUser"; + private static final String P_Small = "#FontSmall"; + private static final String P_Window = "#FontWindow"; + private static final String P_Menu = "#FontMenu"; + /** Background Color */ + protected static final String P_AdempiereColor = "#AdempiereColor"; + + /** + * Save information in Properties + */ + public static void save () + { + //log.config(AdempiereColor.getDefaultBackground().toString()); + // + Ini.setProperty(P_Primary1, getColorAsString(primary1)); + Ini.setProperty(P_Primary2, getColorAsString(primary2)); + Ini.setProperty(P_Primary3, getColorAsString(primary3)); + Ini.setProperty(P_Secondary1, getColorAsString(secondary1)); + Ini.setProperty(P_Secondary2, getColorAsString(secondary2)); + Ini.setProperty(P_Secondary3, getColorAsString(secondary3)); + Ini.setProperty(P_Error, getColorAsString(error)); + Ini.setProperty(P_Info, getColorAsString(info)); + Ini.setProperty(P_Mandatory, getColorAsString(mandatory)); + Ini.setProperty(P_Inactive, getColorAsString(inactive)); + Ini.setProperty(P_White, getColorAsString(white)); + Ini.setProperty(P_Black, getColorAsString(black)); + Ini.setProperty(P_Txt_OK, getColorAsString(txt_ok)); + Ini.setProperty(P_Txt_Error, getColorAsString(txt_error)); + // + Ini.setProperty(P_Control, ((Font)controlFont).toString()); + Ini.setProperty(P_System, ((Font)systemFont).toString()); + Ini.setProperty(P_User, ((Font)userFont).toString()); + Ini.setProperty(P_Small, ((Font)smallFont).toString()); + Ini.setProperty(P_Window, ((Font)windowFont).toString()); + Ini.setProperty(P_Menu, ((Font)menuFont).toString()); + // + //AdempiereColor cc = org.adempiere.plaf.AdempiereColor.getDefaultBackground(); + //Ini.setProperty(P_CompiereColor, cc.toString()); + } // save + + /** + * Parses Color into String representation. + * Required as SystemColors and Alpha Colors have different formats + * @param c Color + * @return [r=102,g=102,b=153,a=255] + * @see #parseColor + */ + public static String getColorAsString (Color c) + { + if (c == null) + c = SystemColor.control; + StringBuffer sb = new StringBuffer("[r=").append(c.getRed()) + .append(",g=").append(c.getGreen()) + .append(",b=").append(c.getBlue()) + .append(",a=").append(c.getAlpha()) + .append("]"); + // System.out.println(sb.toString()); + return sb.toString(); + } // getColorAsString + + /** + * Load Properties from Ini + */ + public static void load () + { + primary1 = parseColor (Ini.getProperty(P_Primary1), primary1); + primary2 = parseColor (Ini.getProperty(P_Primary2), primary2); + primary3 = parseColor (Ini.getProperty(P_Primary3), primary3); + secondary1 = parseColor (Ini.getProperty(P_Secondary1), secondary1); + secondary2 = parseColor (Ini.getProperty(P_Secondary2), secondary2); + secondary3 = parseColor (Ini.getProperty(P_Secondary3), secondary3); + error = parseColor(Ini.getProperty(P_Error), error); + info = parseColor(Ini.getProperty(P_Info), info); + mandatory = parseColor(Ini.getProperty(P_Mandatory), mandatory); + inactive = parseColor(Ini.getProperty(P_Inactive), inactive); + white = parseColor(Ini.getProperty(P_White), white); + black = parseColor(Ini.getProperty(P_Black), black); + txt_ok = parseColor(Ini.getProperty(P_Txt_OK), txt_ok); + txt_error = parseColor(Ini.getProperty(P_Txt_Error), txt_error); + // + controlFont = parseFont(Ini.getProperty(P_Control), controlFont); + systemFont = parseFont(Ini.getProperty(P_System), systemFont); + userFont = parseFont(Ini.getProperty(P_User), userFont); + smallFont = parseFont(Ini.getProperty(P_Small), smallFont); + windowFont = parseFont(Ini.getProperty(P_Window), windowFont); + menuFont = parseFont(Ini.getProperty(P_Menu), menuFont); + // + //AdempiereColor cc = AdempiereColor.parse(Ini.getProperty(P_AdempiereColor)); + //AdempiereColor.setDefaultBackground(cc); + } // load + + /** + * Set Default Colors + */ + public void setDefault() + { + } // setDefault + + /** + * Reset Info in Properties + */ + public static void reset () + { +/** + Ini.remove (P_Primary1); + Ini.remove (P_Primary2); + Ini.remove (P_Primary3); + Ini.remove (P_Secondary1); + Ini.remove (P_Secondary2); + Ini.remove (P_Secondary3); + Ini.remove (P_Error); + Ini.remove (P_Info); + Ini.remove (P_Mandatory); + Ini.remove (P_Inactive); + Ini.remove (P_White); + Ini.remove (P_Black); + Ini.remove (P_Txt_OK); + Ini.remove (P_Txt_Error); + // + Ini.remove (P_Control); + Ini.remove (P_System); + Ini.remove (P_User); + Ini.remove (P_Small); + Ini.remove (P_Window); + Ini.remove (P_Menu); + // CompiereColor + Ini.remove(P_CompiereColor); +**/ + // Initialize + Ini.setProperty(Ini.P_UI_LOOK, org.adempiere.plaf.AdempiereLookAndFeel.NAME); + Ini.setProperty(Ini.P_UI_THEME, s_name); + // + if (s_theme != null) + s_theme.setDefault(); + + // Background + // CompiereColor cc = new CompiereColor(SystemColor.control); // flat Windows 212-208-200 + // CompiereColor cc = new CompiereColor(secondary3); // flat Metal 204-204-204 + //AdempiereColor cc = new AdempiereColor(secondary3, false); + //AdempiereColor.setDefaultBackground (cc); + // + save(); // save properties + } // reset + + /** + * Parse Color. + *

+ * Color - [r=102,g=102,b=153,a=0] + * + * @param information string information to be parsed + * @param stdColor color used if info cannot parsed + * @return color + * @see #getColorAsString + */ + protected static ColorUIResource parseColor (String information, ColorUIResource stdColor) + { + if (information == null + || information.length() == 0 + || information.trim().length() == 0) + return stdColor; + // System.out.print("ParseColor=" + info); + try + { + int r = Integer.parseInt(information.substring(information.indexOf("r=")+2, information.indexOf(",g="))); + int g = Integer.parseInt(information.substring(information.indexOf("g=")+2, information.indexOf(",b="))); + int b = 0; + int a = 255; + if (information.indexOf("a=") == -1) + b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf("]"))); + else + { + b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf(",a="))); + a = Integer.parseInt(information.substring(information.indexOf("a=")+2, information.indexOf("]"))); + } + ColorUIResource retValue = new ColorUIResource(new Color(r, g, b, a)); + // System.out.println(" - " + retValue.toString()); + return retValue; + } + catch (Exception e) + { + log.config(information + " - cannot parse: " + e.toString()); + } + return stdColor; + } // parseColor + + /** + * Parse Font + *

+ * javax.swing.plaf.FontUIResource[family=dialog.bold,name=Dialog,style=bold,size=12] + * + * @param information string information to be parsed + * @param stdFont font used if info cannot be parsed + * @return font + */ + private static FontUIResource parseFont(String information, FontUIResource stdFont) + { + if (information == null + || information.length() == 0 + || information.trim().length() == 0) + return stdFont; + // System.out.print("ParseFont=" + info); + try + { + String name = information.substring(information.indexOf("name=")+5, information.indexOf(",style=")); + String s = information.substring(information.indexOf("style=")+6, information.indexOf(",size=")); + int style = Font.PLAIN; + if (s.equals("bold")) + style = Font.BOLD; + else if (s.equals("italic")) + style = Font.ITALIC; + else if (s.equals("bolditalic")) + style = Font.BOLD | Font.ITALIC; + int size = Integer.parseInt(information.substring(information.indexOf(",size=")+6, information.lastIndexOf("]"))); + FontUIResource retValue = new FontUIResource(name,style,size); + // System.out.println(" - " + retValue.toString()); + return retValue; + } + catch (Exception e) + { + log.config(information + " - cannot parse: " + e.toString()); + } + return stdFont; + } // parseFont + + //----------------------------------------------------- + + + public ColorUIResource getFocusColor() { + return getPrimary2(); + } + + public ColorUIResource getPrimaryControlShadow() { + return getPrimary3(); + } + + public ColorUIResource getMenuSelectedBackground() { + return getPrimary1(); + } + public ColorUIResource getMenuSelectedForeground() { + return WHITE; + } + + public ColorUIResource getMenuItemBackground() { + return WHITE; + } + + public ColorUIResource getToggleButtonCheckColor() { + return new ColorUIResource( 220, 241, 203); + } + + public void addCustomEntriesToTable(UIDefaults table) { + super.addCustomEntriesToTable(table); + Object[] uiDefaults = + { + "ScrollBar.thumbHighlight", + getPrimaryControlHighlight(), + PlasticScrollBarUI.MAX_BUMPS_WIDTH_KEY, + new Integer(22), + PlasticScrollBarUI.MAX_BUMPS_WIDTH_KEY, new Integer(30), + //"TabbedPane.selected", getWhite(), + "TabbedPane.selectHighlight", new ColorUIResource(231, 218, 188), + }; + + table.putDefaults(uiDefaults); + } + +} diff --git a/looks/src/org/adempiere/plaf/icons/CL16.gif b/looks/src/org/adempiere/plaf/icons/CL16.gif new file mode 100644 index 0000000000..27d903c3e2 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/CL16.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/CL32.gif b/looks/src/org/adempiere/plaf/icons/CL32.gif new file mode 100644 index 0000000000..c83d267cbd Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/CL32.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/Cancel24.gif b/looks/src/org/adempiere/plaf/icons/Cancel24.gif new file mode 100644 index 0000000000..d91a52dc0c Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/Cancel24.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/Computer.gif b/looks/src/org/adempiere/plaf/icons/Computer.gif new file mode 100755 index 0000000000..c9cc93eff9 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/Computer.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/Error.gif b/looks/src/org/adempiere/plaf/icons/Error.gif new file mode 100644 index 0000000000..b2ac9f57b4 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/Error.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/File.gif b/looks/src/org/adempiere/plaf/icons/File.gif new file mode 100644 index 0000000000..2d7f2d6017 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/File.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/FloppyDrive.gif b/looks/src/org/adempiere/plaf/icons/FloppyDrive.gif new file mode 100644 index 0000000000..f1d7a19859 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/FloppyDrive.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/HardDrive.gif b/looks/src/org/adempiere/plaf/icons/HardDrive.gif new file mode 100644 index 0000000000..5c3b8587f4 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/HardDrive.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/HomeFolder.gif b/looks/src/org/adempiere/plaf/icons/HomeFolder.gif new file mode 100644 index 0000000000..13d2c00d08 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/HomeFolder.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/Inform.gif b/looks/src/org/adempiere/plaf/icons/Inform.gif new file mode 100644 index 0000000000..2ac57475c3 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/Inform.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/NewFolder.gif b/looks/src/org/adempiere/plaf/icons/NewFolder.gif new file mode 100644 index 0000000000..628f4d50ff Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/NewFolder.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/Ok24.gif b/looks/src/org/adempiere/plaf/icons/Ok24.gif new file mode 100644 index 0000000000..027d18f531 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/Ok24.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/Question.gif b/looks/src/org/adempiere/plaf/icons/Question.gif new file mode 100644 index 0000000000..dc19aa1706 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/Question.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/TreeClosed.gif b/looks/src/org/adempiere/plaf/icons/TreeClosed.gif new file mode 100644 index 0000000000..901edc9624 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/TreeClosed.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/TreeLeaf.gif b/looks/src/org/adempiere/plaf/icons/TreeLeaf.gif new file mode 100644 index 0000000000..63042304b1 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/TreeLeaf.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/TreeOpen.gif b/looks/src/org/adempiere/plaf/icons/TreeOpen.gif new file mode 100644 index 0000000000..1e074cd024 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/TreeOpen.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/UpFolder.gif b/looks/src/org/adempiere/plaf/icons/UpFolder.gif new file mode 100644 index 0000000000..fa9a7d71b5 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/UpFolder.gif differ diff --git a/looks/src/org/adempiere/plaf/icons/Warn.gif b/looks/src/org/adempiere/plaf/icons/Warn.gif new file mode 100644 index 0000000000..a05e160c20 Binary files /dev/null and b/looks/src/org/adempiere/plaf/icons/Warn.gif differ diff --git a/looks/src/org/compiere/license.html b/looks/src/org/compiere/license.html new file mode 100644 index 0000000000..a4e87c198d --- /dev/null +++ b/looks/src/org/compiere/license.html @@ -0,0 +1,81 @@ + + +Adempiere Public License + + + +

+

ADEMPIERE PUBLIC LICENSE

+ Version 1.2 +

Contact info@adempiere.org for licensing alternatives.

+

GNU General Public License

+

Version 2, June 1991

+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.  
+59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+  
+
+

Preamble

+

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

+

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

+

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

+

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

+

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

+

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

+

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

+

The precise terms and conditions for copying, distribution and modification follow.

+

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

+

0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". +

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. +

1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. +

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. +

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: +

+

+ +
+
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. +

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. +

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + +

+ +
+
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. +

4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. +

5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. +

6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. +

7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. +

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. +

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. +

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. +

8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. +

9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. +

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. +

10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. +

NO WARRANTY

+

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +

+

END OF TERMS AND CONDITION

+

+ + diff --git a/looks/src/org/compiere/plaf/Adempiere200x100.gif b/looks/src/org/compiere/plaf/Adempiere200x100.gif new file mode 100644 index 0000000000..f3e3c93682 Binary files /dev/null and b/looks/src/org/compiere/plaf/Adempiere200x100.gif differ diff --git a/looks/src/org/compiere/plaf/AdempiereButtonListener.java b/looks/src/org/compiere/plaf/AdempiereButtonListener.java new file mode 100644 index 0000000000..daade5c4c5 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereButtonListener.java @@ -0,0 +1,99 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.event.*; +import java.beans.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; + +/** + * Button Listener + * + * @author Jorg Janke + * @version $Id: AdempiereButtonListener.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereButtonListener extends BasicButtonListener +{ + /** + * Adempiere Button Listener + * @param b button + */ + public AdempiereButtonListener (AbstractButton b) + { + super (b); + } // AdempiereButtonListener + + /** + * Install Keyboard Actions + * @param c component + */ + public void installKeyboardActions (JComponent c) + { + super.installKeyboardActions (c); + updateMnemonicBindingX ((AbstractButton)c); + } // installKeyboardActions + + /** + * Property Change + * @param e event + */ + public void propertyChange (PropertyChangeEvent e) + { + String prop = e.getPropertyName(); + if (prop == AbstractButton.MNEMONIC_CHANGED_PROPERTY) + updateMnemonicBindingX ((AbstractButton)e.getSource()); + else + super.propertyChange (e); + } // propertyChange + + /** + * Update Mnemonic Binding + * @param b button + */ + void updateMnemonicBindingX (AbstractButton b) + { + int m = b.getMnemonic(); + if (m != 0) + { + InputMap map = SwingUtilities.getUIInputMap(b, JComponent.WHEN_IN_FOCUSED_WINDOW); + + if (map == null) + { + map = new ComponentInputMapUIResource(b); + SwingUtilities.replaceUIInputMap(b, JComponent.WHEN_IN_FOCUSED_WINDOW, map); + } + map.clear(); + String className = b.getClass().getName(); + int mask = InputEvent.ALT_MASK; // Default Buttons + if (b instanceof JCheckBox // In Tab + || className.indexOf("VButton") != -1) + mask = InputEvent.SHIFT_MASK + InputEvent.CTRL_MASK; + map.put(KeyStroke.getKeyStroke(m, mask, false), "pressed"); + map.put(KeyStroke.getKeyStroke(m, mask, true), "released"); + map.put(KeyStroke.getKeyStroke(m, 0, true), "released"); + } + else + { + InputMap map = SwingUtilities.getUIInputMap(b, JComponent.WHEN_IN_FOCUSED_WINDOW); + if (map != null) + map.clear(); + } + } // updateMnemonicBindingX + +} // AdempiereButtonListener diff --git a/looks/src/org/compiere/plaf/AdempiereButtonUI.java b/looks/src/org/compiere/plaf/AdempiereButtonUI.java new file mode 100644 index 0000000000..141b07b175 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereButtonUI.java @@ -0,0 +1,132 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; +import javax.swing.plaf.metal.*; + +/** + * Button UI + * + * @author Jorg Janke + * @version $Id: AdempiereButtonUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereButtonUI extends MetalButtonUI +{ + /** + * Static Create UI + * @param c + * @return Adempiere Button UI + */ + public static ComponentUI createUI (JComponent c) + { + return s_buttonUI; + } // createUI + + /** UI shared */ + private static AdempiereButtonUI s_buttonUI = new AdempiereButtonUI(); + + + /************************************************************************** + * Install Defaults + * @param b + */ + public void installDefaults(AbstractButton b) + { + super.installDefaults(b); + b.setOpaque(false); + } // installDefaults + + /** + * Update. + * This method is invoked by JComponent when the specified + * component is being painted. + * + * By default this method will fill the specified component with + * its background color (if its opaque property is + * true) and then immediately call paint. + * + * @param g the Graphics context in which to paint + * @param c the component being painted + * + * @see #paint + * @see javax.swing.JComponent#paintComponent + */ + public void update(Graphics g, JComponent c) + { + // System.out.println(c.getClass() + " ** " + ((JButton)c).getText() + " ** " + c.isOpaque()); + if (c.isOpaque()) + AdempiereUtils.fillRectange((Graphics2D)g, c, CompiereLookAndFeel.ROUND); + paint (g, c); + } // update + + /** + * Paint 3D boxes + * @param g + * @param c + */ + public void paint (Graphics g, JComponent c) + { + super.paint( g, c); + AbstractButton b = (AbstractButton) c; + ButtonModel model = b.getModel(); + boolean in = model.isPressed() || model.isSelected(); + // + if (b.isBorderPainted()) + AdempiereUtils.paint3Deffect((Graphics2D)g, c, CompiereLookAndFeel.ROUND, !in); + } // paint + + /** + * Don't get selected Color - use default (otherwise the pressed button is gray) + * @param g + * @param b + */ + protected void paintButtonPressed(Graphics g, AbstractButton b) + { + // if (b.isContentAreaFilled()) + // { + // Dimension size = b.getSize(); + // g.setColor(getSelectColor()); + // g.fillRect(0, 0, size.width, size.height); + // } + } // paintButtonPressed + + /** + * Is Tool Bar Button + * @param c + * @return true if toolbar + */ + boolean isToolBarButton(JComponent c) + { + return (c.getParent() instanceof JToolBar); + } // isToolBarButton + + + /** + * Create Button Listener + * @param b button + * @return listener + */ + protected BasicButtonListener createButtonListener (AbstractButton b) + { + return new AdempiereButtonListener(b); + } // createButtonListener + +} // AdempiereButtonUI diff --git a/looks/src/org/compiere/plaf/AdempiereCheckBoxMenuItemUI.java b/looks/src/org/compiere/plaf/AdempiereCheckBoxMenuItemUI.java new file mode 100644 index 0000000000..9315c9e741 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereCheckBoxMenuItemUI.java @@ -0,0 +1,51 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; + +/** + * Menu Check Box UI + * + * @author Jorg Janke + * @version $Id: AdempiereCheckBoxMenuItemUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI +{ + /** + * Create own instance + * @param c compoment + * @return AdempiereMenuBarUI + */ + public static ComponentUI createUI(JComponent c) + { + return new AdempiereMenuItemUI(); + } // createUI + + /** + * Install UI + * @param c + */ + public void installUI (JComponent c) + { + super.installUI(c); + c.setOpaque(false); // use MenuBarUI background + } // installUI + +} // AdempiereCheckBoxMenuItemUI diff --git a/looks/src/org/compiere/plaf/AdempiereCheckBoxUI.java b/looks/src/org/compiere/plaf/AdempiereCheckBoxUI.java new file mode 100644 index 0000000000..f39e6595b7 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereCheckBoxUI.java @@ -0,0 +1,67 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import javax.swing.AbstractButton; +import javax.swing.JComponent; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.*; +import javax.swing.plaf.metal.MetalCheckBoxUI; + +/** + * Check Box UI + * + * @author Jorg Janke + * @version $Id: AdempiereCheckBoxUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereCheckBoxUI extends MetalCheckBoxUI +{ + /** + * Create UI + * @param b + * @return ComponentUI + */ + public static ComponentUI createUI (JComponent b) + { + return s_checkBoxUI; + } // createUI + + /** UI shared */ + private static AdempiereCheckBoxUI s_checkBoxUI = new AdempiereCheckBoxUI(); + + + /************************************************************************** + * Install Defaults + * @param b + */ + public void installDefaults (AbstractButton b) + { + super.installDefaults(b); + b.setOpaque(false); + } // installDefaults + + /** + * Create Button Listener + * @param b button + * @return listener + */ + protected BasicButtonListener createButtonListener (AbstractButton b) + { + return new AdempiereButtonListener(b); + } // createButtonListener + +} // AdempiereCheckBoxUI diff --git a/looks/src/org/compiere/plaf/AdempiereColor.java b/looks/src/org/compiere/plaf/AdempiereColor.java new file mode 100644 index 0000000000..5236e0ac23 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereColor.java @@ -0,0 +1,1264 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import java.awt.image.*; +import java.io.*; +import java.net.*; +import java.util.*; +import java.util.logging.*; +import javax.swing.*; +import javax.swing.plaf.*; +import org.compiere.util.*; + +/** + * Adempiere Background Color + * + * @author Jorg Janke + * @version $Id: AdempiereColor.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereColor implements Serializable +{ + /** Background type Flat */ + public static final String TYPE_FLAT = "F"; + /** Background type Gradient */ + public static final String TYPE_GRADIENT = "G"; + /** Background type Lines */ + public static final String TYPE_LINES = "L"; + /** Background type Texture */ + public static final String TYPE_TEXTURE = "T"; + + /** Names */ + private static ResourceBundle s_res = ResourceBundle.getBundle("org.compiere.plaf.PlafRes"); + + /** Type Values */ + public static final String[] TYPE_VALUES = new String[] { + TYPE_FLAT, TYPE_GRADIENT, TYPE_LINES, TYPE_TEXTURE + }; + /** Type Names */ + public static final String[] TYPE_NAMES = new String[] { + s_res.getString("BackColType_Flat"), + s_res.getString("BackColType_Gradient"), + s_res.getString("BackColType_Lines"), + s_res.getString("BackColType_Texture") + }; + /** Types */ + public static final ValueNamePair[] TYPES = new ValueNamePair[] { + new ValueNamePair(TYPE_VALUES[0], TYPE_NAMES[0]), + new ValueNamePair(TYPE_VALUES[1], TYPE_NAMES[1]), + new ValueNamePair(TYPE_VALUES[2], TYPE_NAMES[2]), + new ValueNamePair(TYPE_VALUES[3], TYPE_NAMES[3]) + }; + + /** Gradient Starting Values */ + public static final int[] GRADIENT_SP_VALUES = new int[] { + SwingConstants.NORTH, SwingConstants.NORTH_EAST, + SwingConstants.EAST, SwingConstants.SOUTH_EAST, + SwingConstants.SOUTH, SwingConstants.SOUTH_WEST, + SwingConstants.WEST, SwingConstants.NORTH_WEST + }; + /** Gradient Starting Names */ + public static final String[] GRADIENT_SP_NAMES = new String[] { + "North", "North-East", + "East", "South-East", + "South", "South-West", + "West", "North-West" + }; + /** Gradient Starting Point */ + public static final KeyNamePair[] GRADIENT_SP = new KeyNamePair[] { + new KeyNamePair(GRADIENT_SP_VALUES[0], GRADIENT_SP_NAMES[0]), + new KeyNamePair(GRADIENT_SP_VALUES[1], GRADIENT_SP_NAMES[1]), + new KeyNamePair(GRADIENT_SP_VALUES[2], GRADIENT_SP_NAMES[2]), + new KeyNamePair(GRADIENT_SP_VALUES[3], GRADIENT_SP_NAMES[3]), + new KeyNamePair(GRADIENT_SP_VALUES[4], GRADIENT_SP_NAMES[4]), + new KeyNamePair(GRADIENT_SP_VALUES[5], GRADIENT_SP_NAMES[5]), + new KeyNamePair(GRADIENT_SP_VALUES[6], GRADIENT_SP_NAMES[6]), + new KeyNamePair(GRADIENT_SP_VALUES[7], GRADIENT_SP_NAMES[7]) + }; + /** Exception text */ + private static final String EXCEPTION_TEXT = "Arguments cannot be NULL"; + + + /************************************************************************** + * Set Background of Component to default color + * @param c component + */ + public static void setBackground (JComponent c) + { + setBackground (c, AdempierePanelUI.getDefaultBackground()); + } // setBackground + + /** + * Set Background of Component + * @param c Component + * @param cc Color + */ + public static void setBackground (JComponent c, AdempiereColor cc) + { + c.putClientProperty(AdempierePLAF.BACKGROUND, cc); + } // setBackground + + /** + * Get Background Color of component + * @param c JComponent + * @return Color + */ + public static AdempiereColor getBackground (JComponent c) + { + AdempiereColor bg = null; + try + { + bg = (AdempiereColor)c.getClientProperty(AdempierePLAF.BACKGROUND); + } + catch (Exception e) + { + log.severe("ClientProperty: " + e.getMessage()); + } + return bg; + } // getBackground + + /** + * Set Background of Window Content Pane to default color + * @param win window + */ + public static void setBackground (Window win) + { + setBackground (win, AdempierePanelUI.getDefaultBackground()); + } // setBackground + + /** + * Set Background of Window Content Pane + * @param win window + * @param cc adempiere color + */ + public static void setBackground (Window win, AdempiereColor cc) + { + if (win instanceof JDialog) + { + ((JPanel)((JDialog)win).getContentPane()).putClientProperty(AdempierePLAF.BACKGROUND, cc); + // ((JPanel)((JDialog)win).getContentPane()).setName("contentPane"); + } + else if (win instanceof JFrame) + { + ((JPanel)((JFrame)win).getContentPane()).putClientProperty(AdempierePLAF.BACKGROUND, cc); + // ((JPanel)((JFrame)win).getContentPane()).setName("contentPane"); + } + else if (win instanceof JWindow) + { + ((JPanel)((JWindow)win).getContentPane()).putClientProperty(AdempierePLAF.BACKGROUND, cc); + // ((JPanel)((JWindow)win).getContentPane()).setName("contentPane"); + } + } // setBackground + + /** + * Set Default Background + * @param bg Background Color + * @see AdempierePanelUI#setDefaultBackground + */ + public static void setDefaultBackground (AdempiereColor bg) + { + AdempierePanelUI.setDefaultBackground(bg); + } // setDefaultBackground + + /** + * Get Default Background + * @return Background + * @see AdempierePanelUI#getDefaultBackground + */ + public static AdempiereColor getDefaultBackground() + { + return AdempierePanelUI.getDefaultBackground(); + } // getDefaultBackground + + /** + * Set Default Background + * @param setDefault if true, the background will be set to the default color + * @see AdempierePanelUI#setSetDefault + */ + public static void setSetDefault (boolean setDefault) + { + AdempierePanelUI.setSetDefault(setDefault); + } // setSetDefault + + /** + * Is the Default Background set by default + * @return true if default background is set + * @see AdempierePanelUI#isSetDefault + */ + public static boolean isSetDefault() + { + return AdempierePanelUI.isSetDefault(); + } // isSetDefault + + /** + * Parse attributes and return AdempiereColor + * @param attributes attributes + * @return AdempiereColor + */ + public static AdempiereColor parse (String attributes) + { + AdempiereColor cc = new AdempiereColor (); + try + { + if (attributes != null && attributes.length() > 0) + cc.parseAttributres (attributes); + } + catch (Exception e) + { + log.severe("(" + attributes + ") - " + e.toString()); + } + return cc; + } // parse + + + /************************************************************************* + * Create Gradient Background Color (Window System Color - White) + */ + public AdempiereColor() + { + this (TYPE_GRADIENT); + } // AdempiereColor + + /** + * Create Default Background Colors of Type + * @param type Background type (see constants TYPE_*) + */ + public AdempiereColor (String type) + { + if (type == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + if (type.equals(TYPE_FLAT) || type.equals(TYPE_GRADIENT) + || type.equals(TYPE_TEXTURE) || type.equals(TYPE_LINES)) + { + m_type = type; + } + else + new java.lang.IllegalArgumentException ("Invalid Type"); + } // AdempiereColor + + /** + * Create Flat Background Color + * @param bg background + */ + public AdempiereColor (Color bg) + { + this (bg, true); + } // AdempiereColor + + /** + * Create Background Color + * @param bg Color + * @param flat if true create Flat color otherwise Gradient color with white lower color + */ + public AdempiereColor (Color bg, boolean flat) + { + if (bg == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + m_type = flat ? TYPE_FLAT : TYPE_GRADIENT; + m_primaryColor = bg; + } // AdempiereColor + + /** + * Set Background to Gradient colors + * @param upperColor upper Color + * @param lowerColor lower Color + * @param startPoint Starting point - e.g. SOUTH_WEST see SwingConstants, default NORTH_WEST + * @param repeatDistance X/Y Distance to repeat gradient in points - 0 no repeats + */ + public AdempiereColor (Color upperColor, Color lowerColor, int startPoint, int repeatDistance) + { + if (upperColor == null || lowerColor == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + m_type = TYPE_GRADIENT; + m_primaryColor = upperColor; + m_secondaryColor = lowerColor; + m_startPoint = startPoint; + m_repeatDistance = repeatDistance; + } // AdempiereColor + + /** + * Set Background to Gradient colors. + * Starting in the north, repeat after 100 pt + * @param upperColor upper color + * @param lowerColor lower color + */ + public AdempiereColor (Color upperColor, Color lowerColor) + { + this (upperColor, lowerColor, SwingConstants.NORTH_WEST, 100); + } // AdempiereColor + + /** + * Set Background to Texture + * + * @param textureURL URL to a *.gif or *.jpg graphic file + * @param taint Color to taint the texture (use white for not tainting it) + * @param compositeAlpha Value from 0(no) to 1(full) taining + */ + public AdempiereColor (URL textureURL, Color taint, float compositeAlpha) + { + if (textureURL == null || taint == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + m_type = TYPE_TEXTURE; + m_textureURL = textureURL; + m_primaryColor = taint; + m_compositeAlpha = compositeAlpha; + } // AdempiereColor + + /** + * Set Background to Texture + * + * @param textureURL URL to a *.gif or *.jpg graphic file + * @param taint Color to taint the texture (use white for not tainting it) + * @param compositeAlpha Tainting value from 0 (no - FullGraph) to 1 (full - NoGraph) + */ + public AdempiereColor (String textureURL, Color taint, float compositeAlpha) + { + if (textureURL == null || taint == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + m_type = TYPE_TEXTURE; + setTextureURL(textureURL); + m_primaryColor = taint; + m_compositeAlpha = compositeAlpha; + } // AdempiereColor + + /** + * Set Background to Lines + * + * @param lineColor line color + * @param backColor background color + * @param lineWidth Stroke width in point + * @param lineDistance Distance between lines in points + */ + public AdempiereColor (Color lineColor, Color backColor, float lineWidth, int lineDistance) + { + if (lineColor == null || backColor == null) + new java.lang.IllegalArgumentException (EXCEPTION_TEXT); + m_type = TYPE_LINES; + m_primaryColor = backColor; + m_secondaryColor = lineColor; + m_lineWidth = lineWidth; + m_lineDistance = lineDistance; + } // AdempiereColor + + /** + * Copy Color + * @param cc color + */ + public AdempiereColor (AdempiereColor cc) + { + if (cc == null) + return; + setColor(cc); + } // AdempiereColor + + /*************************************************************************/ + + /** Type - Default: Gradient */ + private String m_type = TYPE_GRADIENT; + + /** Primary Color - Default Panel back */ + private Color m_primaryColor = UIManager.getColor("Panel.background"); + /** Secondary Color - Default: gray-white */ + private Color m_secondaryColor = new Color (245, 245, 245); + + /** Texture Graph URL */ + private URL m_textureURL = null; + /** Texture Graph */ + private BufferedImage m_image = null; + /** Texture Alpha - Default: 0.7 */ + private float m_compositeAlpha = 0.7f; + + /** Line Width - Default: 1 */ + private float m_lineWidth = 1.0f; + /** Line Distance - Default: 5 */ + private int m_lineDistance = 5; + + /** Gradient Starting point - Default: NORTH_WEST */ + private int m_startPoint = SwingConstants.NORTH_WEST; + /** Gradient repeat distance in points - Default: 100 */ + private int m_repeatDistance = 100; + + /** Background */ + private ColorBackground m_back = null; + /** 3D Look */ + private boolean m_3d = true; + + /** Diry marker for repaining Background */ + private boolean m_dirty = true; + /** Logger */ + private static Logger log = Logger.getLogger(AdempiereColor.class.getName()); + + /************************************************************************** + * Get BackgroundType (Flat, Gradient, Lines, Texture) + * @return Background Type (see TYPE_* constants) + */ + public String getType() + { + return m_type; + } // getType + + /** + * Flat Background Type (default) + * @return true if Flat background + */ + public boolean isFlat() + { + return TYPE_FLAT.equals(getType()); + } // isFlat + + /** + * Gradient Background Type + * @return true if Gradient background + */ + public boolean isGradient() + { + return TYPE_GRADIENT.equals(getType()); + } // isGradient + + /** + * Line Background Type + * @return true if Line background + */ + public boolean isLine() + { + return TYPE_LINES.equals(getType()); + } // isLine + + /** + * Texture Background Type + * @return true if Texture background + */ + public boolean isTexture() + { + return TYPE_TEXTURE.equals(getType()); + } // isTexture + + + /************************ + * Get Flat Color + * @return Primary Color + */ + public Color getFlatColor() + { + return m_primaryColor; + } // getFlatColor + + /** + * Set Flat Color + * @param color flat color + */ + public void setFlatColor(Color color) + { + if (!isFlat() || color == null) + return; + m_primaryColor = color; + m_dirty = true; + } // getFlatColor + + + /************************ + * Gradient Upper Color + * @return Color or null + */ + public Color getGradientUpperColor() + { + if (!isGradient()) + return null; + return m_primaryColor; + } // getGradientUpperColor + + /** + * Gradient Upper Color + * @param color upper color + */ + public void setGradientUpperColor(Color color) + { + if (!isGradient() || color == null) + return; + m_primaryColor = color; + m_dirty = true; + } // getGradientUpperColor + + /** + * Gradient Lower Color + * @return Color or null + */ + public Color getGradientLowerColor() + { + if (!isGradient()) + return null; + return m_secondaryColor; + } // getGradientLowerColor + + /** + * Gradient Lower Color + * @param color lower color + */ + public void setGradientLowerColor(Color color) + { + if (!isGradient() || color == null) + return; + m_secondaryColor = color; + m_dirty = true; + } // setGradientLowerColor + + /** + * Gradient Starting Point + * @return starting point - e.g. NORTH - or 0 + * @see SwingConstants + */ + public int getGradientStartPoint () + { + if (!isGradient()) + return 0; + return m_startPoint; + } // getGradientStartPoint + + /** + * Gradient Starting Point + * @param startPoint starting point - e.g. NORTH + * @see SwingConstants + */ + public void setGradientStartPoint (int startPoint) + { + if (!isGradient()) + return; + m_startPoint = startPoint; + m_dirty = true; + } // setGradientStartPoint + + /** + * Gradient Repeat Distance in point + * @return Repeat Distance - or 0 + */ + public int getGradientRepeatDistance () + { + if (!isGradient()) + return 0; + return m_repeatDistance; + } // getGradientRepeatDistance + + /** + * Gradient Repeat Distance. + * Zero stands for no repeats + * @param repeatDistance repeat gradient after point x+repeat / y+repeat (depending on direction) + */ + public void setGradientRepeatDistance (int repeatDistance) + { + if (!isGradient()) + return; + m_repeatDistance = repeatDistance; + m_dirty = true; + } // setGradientRepeatDistance + + /** + * Gradient Repeat Distance. + * Zero stands for no repeats + * @param repeatDistanceString repeat gradient after point x+repeat / y+repeat (depending on direction) + */ + public void setGradientRepeatDistance (String repeatDistanceString) + { + if (!isGradient()) + return; + try + { + setGradientRepeatDistance(Integer.parseInt(repeatDistanceString)); + } + catch (Exception e) + { + log.severe("Parsing=" + + repeatDistanceString + " - " + e.getMessage()); + } + } // setGradientRepeatDistance + + + /************************ + * Texture Url + * @return URL (if not found, org.compiere.plaf.background.jpg is used) + */ + public URL getTextureURL() + { + if (!isTexture()) + return null; + if (m_textureURL == null) + m_textureURL = AdempiereColor.class.getResource("Adempiere00x100.gif"); + return m_textureURL; + } // getTextureURL + + /** + * Get Texture Image based on Texture URL + * @return Image + */ + public BufferedImage getTextureImage() + { + if (m_image == null) + { + URL url = getTextureURL(); + m_image = AdempiereUtils.loadBufferedImage(url, BufferedImage.TYPE_INT_ARGB_PRE); + } + return m_image; + } // getTextureImage + + /** + * Texture Url + * @param url URL to graphic file (jpg) + */ + public void setTextureURL(URL url) + { + if (!isTexture() || url == null) + return; + m_textureURL = url; + m_image = null; + m_dirty = true; + } // setTextureURL + + /** + * Texture Url + * @param urlString URL to graphic file (jpg) + */ + public void setTextureURL(String urlString) + { + if (!isTexture() || urlString == null) + return; + try + { + setTextureURL (new URL(urlString)); + } + catch (Exception e) + { + log.severe("Parsing URL=" + + urlString + " - " + e.getMessage()); + } + } // setTextureURL + + /** + * Texture Taint Color + * @return Color or null + */ + public Color getTextureTaintColor() + { + if (!isTexture()) + return null; + return m_primaryColor; + } // getTextureTaintColor + + /** + * Texture Taint Color + * @param color taint color + */ + public void setTextureTaintColor(Color color) + { + if (!isTexture() || color == null) + return; + m_primaryColor = color; + m_dirty = true; + } // setTextureTaintColor + + /** + * Texture Composite Alpha + * @return Composite Ampha or 0f + */ + public float getTextureCompositeAlpha() + { + if (!isTexture()) + return 0f; + return m_compositeAlpha; + } // getTextureCompositeAlpha + + /** + * Texture Composite Alpha + * @param alpha alpha value + */ + public void setTextureCompositeAlpha(float alpha) + { + if (!isTexture()) + return; + m_compositeAlpha = alpha; + m_dirty = true; + } // setTextureCompositeAlpha + + /** + * Texture Composite Alpha + * @param alphaString String to be parsed + */ + public void setTextureCompositeAlpha(String alphaString) + { + if (!isTexture() || alphaString == null) + return; + try + { + setTextureCompositeAlpha(Float.parseFloat(alphaString)); + } + catch (Exception e) + { + log.severe("Parsing=" + + alphaString + " - " + e.getMessage()); + } + } // setTextureCompositeAlpha + + + /************************ + * Line Color + * @return Color or null + */ + public Color getLineColor() + { + if (!isLine()) + return null; + return m_secondaryColor; + } // getLineColor + + /** + * Line Color + * @param color line color + */ + public void setLineColor(Color color) + { + if (!isLine() || color == null) + return; + m_secondaryColor = color; + m_dirty = true; + } // setLineColor + + /** + * Line Background Color + * @return Color or null + */ + public Color getLineBackColor() + { + if (!isLine()) + return null; + return m_primaryColor; + } // getLineBackColor + + /** + * Line Background Color + * @param color background color + */ + public void setLineBackColor(Color color) + { + if (!isLine() || color == null) + return; + m_primaryColor = color; + m_dirty = true; + } // setLineBackColor + + /** + * Background Line Width + * @return width or 0f + */ + public float getLineWidth() + { + if (!isLine()) + return 0f; + return m_lineWidth; + } // getLineWidth + + /** + * Background Line Width + * @param width line width + */ + public void setLineWidth(float width) + { + if (!isLine()) + return; + m_lineWidth = width; + m_dirty = true; + } // setLineWidth + + /** + * Background Line Width + * @param widthString line width + */ + public void setLineWidth(String widthString) + { + if (!isLine() || widthString == null) + return; + try + { + setLineWidth(Float.parseFloat(widthString)); + } + catch (Exception e) + { + log.severe("Parsing=" + + widthString + " - " + e.getMessage()); + } + } // setLineWidth + + /** + * Background Line distance in pt + * @return distance or 0 + */ + public int getLineDistance() + { + if (!isLine()) + return 0; + return m_lineDistance; + } // getLineDistance + + /** + * Background Line distance in pt + * @param distance line distance + */ + public void setLineDistance(int distance) + { + if (!isLine()) + return; + m_lineDistance = distance; + m_dirty = true; + } // setLineDistance + + /** + * Background Line distance in pt + * @param distanceString line distance + */ + public void setLineDistance(String distanceString) + { + if (!isLine()) + return; + try + { + setLineDistance(Integer.parseInt(distanceString)); + } + catch (Exception e) + { + log.severe("Parsing=" + + distanceString + " - " + e.getMessage()); + } + } // setLineDistance + + /** + * Set Prinary Color + * @param color primary color + */ + protected void setPrimaryColor (Color color) + { + if (color != null) + m_primaryColor = color; + } // setPrimaryColor + + /** + * Set AdempiereColor from AdempiereColor + * @param cc AdempiereColor + */ + public void setColor (AdempiereColor cc) + { + if (cc == null) + return; + m_type = cc.getType(); + // + if (cc.isFlat()) + m_primaryColor = cc.getFlatColor(); + else if (cc.isGradient()) + { + m_primaryColor = cc.getGradientUpperColor(); + m_secondaryColor = cc.getGradientLowerColor(); + m_startPoint = cc.getGradientStartPoint(); + m_repeatDistance = cc.getGradientRepeatDistance(); + } + else if (cc.isTexture()) + { + setTextureURL(cc.getTextureURL()); + m_primaryColor = cc.getTextureTaintColor(); + m_compositeAlpha = cc.getTextureCompositeAlpha(); + } + else if (cc.isLine()) + { + m_primaryColor = cc.getLineBackColor(); + m_secondaryColor = cc.getLineColor(); + m_lineWidth = cc.getLineWidth(); + m_lineDistance = cc.getLineDistance(); + } + else + log.severe("Invalid Color"); + // + m_dirty = true; + } // setColor + + + /************************************************************************** + * Fill with AdempiereColor Background + * @param g the Graphics context in which to paint + * @param c the component being painted + */ + public void paint (Graphics g, JComponent c) + { + getColorBackground(c).paint (g, c); + } // paint + + /** + * Fill with Adempiere Background + * @param g graphics + * @param c component + * @param x x pos + * @param y y pos + * @param w with + * @param h height + */ + public void paintRect (Graphics g, JComponent c, int x, int y, int w, int h) + { + getColorBackground(c).paintRect (g,c, x,y, w,h); + } // paintRect + + /** + * Get Background + * @param c Componenr + * @return Background + */ + private ColorBackground getColorBackground (JComponent c) + { + if (m_back == null) + { + Rectangle bounds = c.getBounds(); + Container container = c.getParent(); + while (container != null) + { + bounds = container.getBounds(bounds); + container = container.getParent(); + } + m_back = new ColorBackground (bounds); + } + return m_back; + } // getBackground + + + /************************************************************************** + * String representation + * @return string representation + */ + public String toString() + { + StringBuffer sb = new StringBuffer ("AdempiereColor["); + if (isFlat()) + sb.append("Flat") + .append(" ").append(CompiereTheme.getColorAsString(getFlatColor())); + else if (isGradient()) + sb.append("Gradient") + .append(" Upper=").append(CompiereTheme.getColorAsString(getGradientUpperColor())) + .append(",Lower=").append(CompiereTheme.getColorAsString(getGradientLowerColor())) + .append(",Start=").append(getGradientStartPoint()) + .append(",RDistance=").append(getGradientRepeatDistance()); + else if (isLine()) + sb.append("Line") + .append(" Color=").append(CompiereTheme.getColorAsString(getLineColor())) + .append(",BackColor=").append(CompiereTheme.getColorAsString(getLineBackColor())) + .append(",Width=").append(getLineWidth()) + .append(",Distance=").append(getLineDistance()); + else if (isTexture()) + sb.append("Texture") + .append(" GraphURL=").append(getTextureURL()) + .append(",Taint=").append(CompiereTheme.getColorAsString(getTextureTaintColor())) + .append(",Alpha=").append(getTextureCompositeAlpha()); + sb.append("]"); + return sb.toString(); + } // toString + + /** + * Parse String Representation and set Attributes + * @param str parse string + */ + private void parseAttributres (String str) + { + if (str.indexOf("[Flat ") != -1) + { + m_type = TYPE_FLAT; + m_primaryColor = CompiereTheme.parseColor(str, + new ColorUIResource(m_primaryColor)); + } + else if (str.indexOf("[Gradient ") != -1) + { + m_type = TYPE_GRADIENT; + m_primaryColor = CompiereTheme.parseColor(str.substring(str.indexOf(" Upper=")+7, str.indexOf(",Lower=")), + new ColorUIResource(m_primaryColor)); + m_secondaryColor = CompiereTheme.parseColor(str.substring(str.indexOf(",Lower=")+7, str.indexOf(",Start=")), + new ColorUIResource(m_secondaryColor)); + m_startPoint = Integer.parseInt(str.substring(str.indexOf(",Start=")+7, str.indexOf(",RDistance="))); + setGradientRepeatDistance(str.substring(str.indexOf(",RDistance=")+11, str.lastIndexOf("]"))); + } + else if (str.indexOf("[Line ") != -1) + { + m_type = TYPE_LINES; + m_primaryColor = CompiereTheme.parseColor(str.substring(str.indexOf(" Color=")+7, str.indexOf(",BackColor=")), + new ColorUIResource(m_primaryColor)); + m_secondaryColor = CompiereTheme.parseColor(str.substring(str.indexOf(",BackColor=")+11, str.indexOf(",Width=")), + new ColorUIResource(m_secondaryColor)); + setLineWidth(str.substring(str.indexOf(",Width=")+7, str.indexOf(",Distance="))); + setLineDistance(str.substring(str.indexOf(",Distance=")+10, str.lastIndexOf("]"))); + } + else if (str.indexOf("[Texture ") != -1) + { + m_type = TYPE_TEXTURE; + setTextureURL (str.substring(str.indexOf(" GraphURL=")+10, str.indexOf(",Taint="))); + m_primaryColor = CompiereTheme.parseColor(str.substring(str.indexOf(",Taint=")+7, str.indexOf(",Alpha=")), + new ColorUIResource(m_primaryColor)); + setTextureCompositeAlpha (str.substring(str.indexOf(",Alpha=")+7, str.lastIndexOf("]"))); + } + } // parseString + + /** + * Does the background needs to be redone + * @return true if there were changes + */ + boolean isDirty() + { + return m_dirty; + } // isDirty + + /** + * Set Dirty + * @param dirty if true, the background will be re-painted + */ + void setDirty (boolean dirty) + { + m_dirty = dirty; + } // setDirty + + +/****************************************************************************** + * Background contains a Buffered Image with the background. + * The initial size is determined by the constructor. + * It is resized if required when painting. + *
+ * The Buffered image is a 8-bit RGBA color components packed into integer pixels. + * The image has a DirectColorModel with alpha. The color data in this image + * is considered to be premultiplied with alpha + */ +public class ColorBackground +{ + /** + * Create Color Background + * @param bounds Rectangle to fit in + */ + public ColorBackground (Rectangle bounds) + { + createColorBackground (bounds); + fillColorBackground (); + } // Background + + private int m_height = 200; + private int m_width = 200; + private BufferedImage m_backImage; + private int m_colorBlind = ColorBlind.getColorType(); + + /** + * Create Color Background + * @param bounds Rectangle to fit in + */ + private void createColorBackground (Rectangle bounds) + { + m_height = Math.max(bounds.y + bounds.height, m_height); + m_width = Math.max(bounds.x + bounds.width, m_width); + m_backImage = new BufferedImage (m_width, m_height, BufferedImage.TYPE_INT_ARGB_PRE); + } // create Background + + + /** + * Fill Background with Color + */ + public void fillColorBackground () + { + Graphics2D g2D = m_backImage.createGraphics(); + + if (isGradient()) + { + Point start = null; + Point end = null; + int r = 1; // repeats + switch (m_startPoint) + { + case SwingConstants.NORTH_WEST: + start = new Point (0, 0); + if (m_repeatDistance > 0) + end = new Point (m_repeatDistance, m_repeatDistance); + // end = new Point (Math.min(m_repeatDistance, m_width), Math.min(m_repeatDistance, height)); + else + end = new Point (m_width/r, m_height/r); + break; + case SwingConstants.WEST: + start = new Point (0, m_height/2); + if (m_repeatDistance > 0) + end = new Point (m_repeatDistance, m_height/2); + // end = new Point (Math.min(m_repeatDistance, m_width), m_height/2); + else + end = new Point (m_width/r, m_height/2); + break; + case SwingConstants.SOUTH_WEST: + start = new Point (0, m_height); + if (m_repeatDistance > 0) + end = new Point (m_repeatDistance, m_height-m_repeatDistance); + // end = new Point (Math.min(m_width, m_repeatDistance), Math.max(0, m_height-m_repeatDistance)); + else + end = new Point (m_width/r, m_height-(m_height/r)); + break; + case SwingConstants.SOUTH: + start = new Point (0, m_height); + if (m_repeatDistance > 0) + end = new Point (0, m_height-m_repeatDistance); + // end = new Point (0, Math.max(0, m_height-m_repeatDistance)); + else + end = new Point (0, m_height-(m_height/r)); + break; + case SwingConstants.SOUTH_EAST: + start = new Point (m_width, m_height); + if (m_repeatDistance > 0) + end = new Point (m_width-m_repeatDistance, m_height-m_repeatDistance); + // end = new Point (Math.min(0, m_width-m_repeatDistance), Math.max(0, m_height-m_repeatDistance)); + else + end = new Point (m_width-(m_width/r), m_height-(m_height/r)); + break; + case SwingConstants.EAST: + start = new Point (m_width, m_height/2); + if (m_repeatDistance > 0) + end = new Point (m_width-m_repeatDistance, m_height/2); + // end = new Point (Math.min(0, m_width-m_repeatDistance), m_height/2); + else + end = new Point (m_width-(m_width/r), m_height/2); + break; + case SwingConstants.NORTH_EAST: + start = new Point (m_width, 0); + if (m_repeatDistance > 0) + end = new Point (m_width-m_repeatDistance, m_repeatDistance); + // end = new Point (Math.min(0, m_width-m_repeatDistance), Math.min(m_height, m_repeatDistance)); + else + end = new Point (m_width-(m_width/r), m_height/r); + break; + default: + case SwingConstants.NORTH: + start = new Point (0, 0); + if (m_repeatDistance > 0) + end = new Point (0, m_repeatDistance); + // end = new Point (0, Math.min(m_height, m_repeatDistance)); + else + end = new Point (0, m_height/r); + } + GradientPaint paint = new GradientPaint( + start, + ColorBlind.getDichromatColor(getGradientUpperColor()), + end, + ColorBlind.getDichromatColor(getGradientLowerColor()), + true); // cyclic + g2D.setPaint(paint); + g2D.fillRect(0, 0, m_width, m_height); + } + else if (isTexture()) + { + BufferedImage image = getTextureImage(); + if (image == null) + { + g2D.setPaint(ColorBlind.getDichromatColor(getFlatColor())); + g2D.fillRect(0, 0, m_width, m_height); + } + else + { + Rectangle anchor = new Rectangle (0,0, image.getWidth(), image.getHeight()); + TexturePaint texture = new TexturePaint (image, anchor); + g2D.setPaint(texture); + g2D.fillRect(0, 0, m_width, m_height); + g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getTextureCompositeAlpha())); + g2D.setPaint(ColorBlind.getDichromatColor(getTextureTaintColor())); + g2D.fillRect(0, 0, m_width, m_height); + } + } + else if (isLine()) + { + // Background + g2D.setPaint(ColorBlind.getDichromatColor(getLineBackColor())); + g2D.fillRect(0, 0, m_width, m_height); + // Lines + g2D.setPaint(ColorBlind.getDichromatColor(getLineColor())); + g2D.setStroke(new BasicStroke(getLineWidth())); + for (int y = 0; y < m_height; y += getLineDistance()) + g2D.drawLine(0, y, m_width, y); + } + else // flat + { + g2D.setPaint(ColorBlind.getDichromatColor(getFlatColor())); + g2D.fillRect(0, 0, m_width, m_height); + } + setDirty (false); + } // fillBackground + + /** + * Paint/copy background to component + * @param g graphics + * @param c component + */ + public void paint (Graphics g, JComponent c) + { + Rectangle bounds = c.getBounds(); + check (bounds); + // + int h = c.getHeight(); + int w = c.getWidth(); + // Copy Background + g.drawImage (m_backImage, + 0, 0, // destination start point + w, h, // destination end point + bounds.x, bounds.y, // source start + bounds.x+w, bounds.y+h, // source end + c); + } // paint + + /** + * Paint/copy background to component rectangle + * @param g graphics + * @param c compnent + * @param x x pos + * @param y y pos + * @param w width + * @param h height + */ + public void paintRect (Graphics g, JComponent c, int x, int y, int w, int h) + { + Rectangle bounds = c.getBounds(); + check (bounds); + // Copy Background + g.drawImage (m_backImage, + x, y, // destination start point + x+w, h+y, // destination end point + x, y, // source start + x+w, y+h, // source end + c); + } // paint + + /** + * Check size of background and repaint if required + * @param bounds Bounds of component + */ + private void check (Rectangle bounds) + { + // Re-Create, if Color Type changed + if (ColorBlind.getColorType() != m_colorBlind) + { + m_colorBlind = ColorBlind.getColorType(); + setDirty(true); + } + // we need to create new background + if ((m_height < (bounds.y + bounds.height)) + || (m_width < (bounds.x + bounds.width))) + { + createColorBackground (bounds); + fillColorBackground(); + } + else if (isDirty()) + fillColorBackground(); + } // check + +} // ColorBackground + +} // AdempiereColor diff --git a/looks/src/org/compiere/plaf/AdempiereColorEditor.java b/looks/src/org/compiere/plaf/AdempiereColorEditor.java new file mode 100644 index 0000000000..a825c757a6 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereColorEditor.java @@ -0,0 +1,660 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import java.util.*; +import javax.swing.*; +import org.compiere.swing.*; +import org.compiere.util.*; + +/** + * Adempiere Color Editor + * + * @author Jorg Janke + * @version $Id: AdempiereColorEditor.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereColorEditor extends CDialog + implements ActionListener, PropertyEditor +{ + /** + * Get Background AdempiereColor + * @param owner owner + * @param color optional initial color + * @return AdempiereColor + */ + public static AdempiereColor showDialog (Frame owner, AdempiereColor color) + { + AdempiereColorEditor cce = new AdempiereColorEditor (owner, color); + if (cce.isSaved()) + return cce.getColor(); + return color; + } // showDialog + + /** + * Get Background AdempiereColor + * @param owner owner + * @param color optional initial color + * @return AdempiereColor + */ + public static AdempiereColor showDialog (Dialog owner, AdempiereColor color) + { + AdempiereColorEditor cce = new AdempiereColorEditor (owner, color); + if (cce.isSaved()) + return cce.getColor(); + return color; + } // showIt + + /*************************************************************************/ + + /** + * Create AdempiereColor Dialog with color + * @param owner owner + * @param color Start Color + */ + public AdempiereColorEditor (Frame owner, AdempiereColor color) + { + super(owner, "", true); + init (color); + } // AdempiereColorEditor + + /** + * Create AdempiereColor Dialog with color + * @param owner owner + * @param color Start Color + */ + public AdempiereColorEditor (Dialog owner, AdempiereColor color) + { + super(owner, "", true); + init (color); + } // AdempiereColorEditor + + /** + * Init Dialog + * @param color Start Color + */ + private void init (AdempiereColor color) + { + try + { + jbInit(); + } + catch(Exception e) + { + e.printStackTrace(); + } + + bOK.addActionListener(this); + bCancel.addActionListener(this); + typeField.addActionListener(this); + flatField.addActionListener(this); + gradientUpper.addActionListener(this); + gradientLower.addActionListener(this); + urlField.addActionListener(this); + alphaField.addActionListener(this); + taintColor.addActionListener(this); + lineColor.addActionListener(this); + backColor.addActionListener(this); + widthField.addActionListener(this); + distanceField.addActionListener(this); + gradientStartField.addActionListener(this); + gradientDistanceField.addActionListener(this); + + if (color == null) + setColor (m_cc); + else + setColor (new AdempiereColor(color)); + AdempierePLAF.showCenterScreen(this); + } // init + + + private static ResourceBundle res = ResourceBundle.getBundle("org.compiere.plaf.PlafRes"); + private AdempiereColor m_cc = null; + private boolean m_saved = false; + private boolean m_setting = false; + + // + private CPanel northPanel = new CPanel(); + private CPanel southPanel = new CPanel(); + private CButton bOK = AdempierePLAF.getOKButton(); + private CButton bCancel = AdempierePLAF.getCancelButton(); + private FlowLayout southLayout = new FlowLayout(); + private GridBagLayout northLayout = new GridBagLayout(); + private CLabel typeLabel = new CLabel(); + private CComboBox typeField = new CComboBox(AdempiereColor.TYPES); + private CButton gradientUpper = new CButton(); + private CButton gradientLower = new CButton(); + private CLabel urlLabel = new CLabel(); + private CTextField urlField = new CTextField(30); + private CLabel alphaLabel = new CLabel(); + private CTextField alphaField = new CTextField(10); + private CButton taintColor = new CButton(); + private CButton lineColor = new CButton(); + private CButton backColor = new CButton(); + private CLabel widthLabel = new CLabel(); + private CTextField widthField = new CTextField(10); + private CLabel distanceLabel = new CLabel(); + private CTextField distanceField = new CTextField(10); + private CPanel centerPanel = new CPanel(); + private CButton flatField = new CButton(); + private CComboBox gradientStartField = new CComboBox(AdempiereColor.GRADIENT_SP); + private CTextField gradientDistanceField = new CTextField(10); + private CLabel gradientStartLabel = new CLabel(); + private CLabel gradientDistanceLabel = new CLabel(); + + /** + * Static Layout. + *

+	 *      - northPanel
+	 *          - labels & fields
+	 *      - centerPanel
+	 *      - southPanel
+	 *  
+ * @throws Exception + */ + private void jbInit() throws Exception + { + this.setTitle(res.getString("AdempiereColorEditor")); + southPanel.setLayout(southLayout); + southLayout.setAlignment(FlowLayout.RIGHT); + northPanel.setLayout(northLayout); + typeLabel.setText(res.getString("AdempiereType")); + gradientUpper.setText(res.getString("GradientUpperColor")); + gradientLower.setText(res.getString("GradientLowerColor")); + gradientStartLabel.setText(res.getString("GradientStart")); + gradientDistanceLabel.setText(res.getString("GradientDistance")); + urlLabel.setText(res.getString("TextureURL")); + alphaLabel.setText(res.getString("TextureAlpha")); + taintColor.setText(res.getString("TextureTaintColor")); + lineColor.setText(res.getString("LineColor")); + backColor.setText(res.getString("LineBackColor")); + widthLabel.setText(res.getString("LineWidth")); + distanceLabel.setText(res.getString("LineDistance")); + flatField.setText(res.getString("FlatColor")); + centerPanel.setBorder(BorderFactory.createRaisedBevelBorder()); + centerPanel.setPreferredSize(new Dimension(400, 200)); + centerPanel.setOpaque(true); + northPanel.setPreferredSize(new Dimension(400, 150)); + southPanel.add(bCancel, null); + this.getContentPane().add(northPanel, BorderLayout.NORTH); + southPanel.add(bOK, null); + this.getContentPane().add(southPanel, BorderLayout.SOUTH); + this.getContentPane().add(centerPanel, BorderLayout.CENTER); + northPanel.add(typeLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(typeField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); + northPanel.add(gradientLower, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(urlField, new GridBagConstraints(1, 5, 2, 1, 1.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(alphaLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(alphaField, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(taintColor, new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(backColor, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(widthLabel, new GridBagConstraints(0, 9, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(widthField, new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(distanceLabel, new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(distanceField, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(flatField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(gradientStartField, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(gradientDistanceField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(urlLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(gradientStartLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(gradientDistanceLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(gradientUpper, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); + northPanel.add(lineColor, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); + } // jbInit + + /** + * Action Listener + * @param e event + */ + public void actionPerformed(ActionEvent e) + { + if (m_setting) + return; + if (e.getSource() == bOK) + { + m_saved = true; + dispose(); + return; + } + else if (e.getSource() == bCancel) + { + dispose(); + return; + } + + /**** Field Changes ****/ + try + { + // Type + if (e.getSource() == typeField) + cmd_type(); + // Flat + else if (e.getSource() == flatField) + m_cc.setFlatColor(JColorChooser.showDialog + (this, flatField.getText(), m_cc.getFlatColor())); + // Gradient + else if (e.getSource() == gradientUpper) + m_cc.setGradientUpperColor(JColorChooser.showDialog + (this, gradientUpper.getText(), m_cc.getGradientUpperColor())); + else if (e.getSource() == gradientLower) + m_cc.setGradientLowerColor(JColorChooser.showDialog + (this, gradientLower.getText(), m_cc.getGradientLowerColor())); + else if (e.getSource() == gradientStartField) + m_cc.setGradientStartPoint + (((KeyNamePair)gradientStartField.getSelectedItem()).getKey()); + else if (e.getSource() == gradientDistanceField) + m_cc.setGradientRepeatDistance(gradientDistanceField.getText()); + // Texture + else if (e.getSource() == urlField) + m_cc.setTextureURL(urlField.getText()); + else if (e.getSource() == alphaField) + m_cc.setTextureCompositeAlpha(alphaField.getText()); + else if (e.getSource() == taintColor) + m_cc.setTextureTaintColor(JColorChooser.showDialog + (this, taintColor.getText(), m_cc.getTextureTaintColor())); + // Lines + else if (e.getSource() == lineColor) + m_cc.setLineColor(JColorChooser.showDialog + (this, lineColor.getText(), m_cc.getLineColor())); + else if (e.getSource() == backColor) + m_cc.setLineBackColor(JColorChooser.showDialog + (this, backColor.getText(), m_cc.getLineBackColor())); + else if (e.getSource() == widthField) + m_cc.setLineWidth(widthField.getText()); + else if (e.getSource() == distanceField) + m_cc.setLineDistance(distanceField.getText()); + } + catch (Exception ee) + { + } + setColor (m_cc); + } // actionPerformed + + /** + * Set Type with default values + */ + private void cmd_type() + { + ValueNamePair vp = (ValueNamePair)typeField.getSelectedItem(); + if (vp.getValue().equals(AdempiereColor.TYPE_FLAT)) + m_cc = new AdempiereColor(AdempiereColor.TYPE_FLAT); + else if (vp.getValue().equals(AdempiereColor.TYPE_GRADIENT)) + m_cc = new AdempiereColor(AdempiereColor.TYPE_GRADIENT); + else if (vp.getValue().equals(AdempiereColor.TYPE_TEXTURE)) + m_cc = new AdempiereColor(AdempiereColor.TYPE_TEXTURE); + else if (vp.getValue().equals(AdempiereColor.TYPE_LINES)) + m_cc = new AdempiereColor(AdempiereColor.TYPE_LINES); + setColor (m_cc); + } // cmd_type + + /** + * Set Color and update UI + * @param color color + */ + public void setColor (AdempiereColor color) + { + if (color == null && m_cc != null) + return; + // + // System.out.println("AdempiereColorEditor.setColor " + color); + m_cc = color; + if (m_cc == null) + m_cc = AdempierePanelUI.getDefaultBackground(); + + // update display + updateFields(); + centerPanel.setBackgroundColor(m_cc); + centerPanel.repaint(); + } // setColor + + /** + * UpdateField from AdempiereColor + */ + private void updateFields() + { + m_setting = true; + // Type + for (int i = 0; i < AdempiereColor.TYPES.length; i++) + { + if (m_cc.getType().equals(AdempiereColor.TYPE_VALUES[i])) + { + typeField.setSelectedItem(AdempiereColor.TYPES[i]); + break; + } + } + // + if (m_cc.isFlat()) + { + flatField.setVisible(true); + gradientUpper.setVisible(false); + gradientLower.setVisible(false); + gradientStartLabel.setVisible(false); + gradientDistanceLabel.setVisible(false); + gradientStartField.setVisible(false); + gradientDistanceField.setVisible(false); + urlLabel.setVisible(false); + urlField.setVisible(false); + alphaLabel.setVisible(false); + alphaField.setVisible(false); + taintColor.setVisible(false); + lineColor.setVisible(false); + backColor.setVisible(false); + widthLabel.setVisible(false); + widthField.setVisible(false); + distanceLabel.setVisible(false); + distanceField.setVisible(false); + // + flatField.setBackground(m_cc.getFlatColor()); + } + else if (m_cc.isGradient()) + { + flatField.setVisible(false); + gradientUpper.setVisible(true); + gradientLower.setVisible(true); + gradientStartLabel.setVisible(true); + gradientDistanceLabel.setVisible(true); + gradientStartField.setVisible(true); + gradientDistanceField.setVisible(true); + urlLabel.setVisible(false); + urlField.setVisible(false); + alphaLabel.setVisible(false); + alphaField.setVisible(false); + taintColor.setVisible(false); + lineColor.setVisible(false); + backColor.setVisible(false); + widthLabel.setVisible(false); + widthField.setVisible(false); + distanceLabel.setVisible(false); + distanceField.setVisible(false); + // + gradientUpper.setBackground(m_cc.getGradientUpperColor()); + gradientLower.setBackground(m_cc.getGradientLowerColor()); + gradientDistanceField.setText(String.valueOf(m_cc.getGradientRepeatDistance())); + for (int i = 0; i < AdempiereColor.GRADIENT_SP.length; i++) + { + if (m_cc.getGradientStartPoint() == AdempiereColor.GRADIENT_SP_VALUES[i]) + { + gradientStartField.setSelectedItem(AdempiereColor.GRADIENT_SP[i]); + break; + } + } + } + else if (m_cc.isTexture()) + { + flatField.setVisible(false); + gradientUpper.setVisible(false); + gradientLower.setVisible(false); + gradientStartLabel.setVisible(false); + gradientDistanceLabel.setVisible(false); + gradientStartField.setVisible(false); + gradientDistanceField.setVisible(false); + urlLabel.setVisible(true); + urlField.setVisible(true); + alphaLabel.setVisible(true); + alphaField.setVisible(true); + taintColor.setVisible(true); + lineColor.setVisible(false); + backColor.setVisible(false); + widthLabel.setVisible(false); + widthField.setVisible(false); + distanceLabel.setVisible(false); + distanceField.setVisible(false); + // + urlField.setText(m_cc.getTextureURL().toString()); + alphaField.setText(String.valueOf(m_cc.getTextureCompositeAlpha())); + taintColor.setBackground(m_cc.getTextureTaintColor()); + } + else if (m_cc.isLine()) + { + flatField.setVisible(false); + gradientUpper.setVisible(false); + gradientLower.setVisible(false); + gradientStartLabel.setVisible(false); + gradientDistanceLabel.setVisible(false); + gradientStartField.setVisible(false); + gradientDistanceField.setVisible(false); + urlLabel.setVisible(false); + urlField.setVisible(false); + alphaLabel.setVisible(false); + alphaField.setVisible(false); + taintColor.setVisible(false); + lineColor.setVisible(true); + backColor.setVisible(true); + widthLabel.setVisible(true); + widthField.setVisible(true); + distanceLabel.setVisible(true); + distanceField.setVisible(true); + // + lineColor.setBackground(m_cc.getLineColor()); + backColor.setBackground(m_cc.getLineBackColor()); + widthField.setText(String.valueOf(m_cc.getLineWidth())); + distanceField.setText(String.valueOf(m_cc.getLineDistance())); + } + m_setting = false; + } // updateFields + + /** + * Get Color + * @return Color, when saved - else null + */ + public AdempiereColor getColor() + { + return m_cc; + } // getColor + + /** + * Was the selection saved + * @return true if saved + */ + public boolean isSaved() + { + return m_saved; + } // m_saved + + /*************************************************************************/ + + /** + * Set (or change) the object that is to be edited. Primitive types such + * as "int" must be wrapped as the corresponding object type such as + * "java.lang.Integer". + * + * @param value The new target object to be edited. Note that this + * object should not be modified by the PropertyEditor, rather + * the PropertyEditor should create a new object to hold any + * modified value. + */ + public void setValue(Object value) + { + if (value != null && value instanceof AdempiereColor) + setColor (new AdempiereColor((AdempiereColor)value)); + else + throw new IllegalArgumentException("AdempiereColorEditor.setValue requires AdempiereColor"); + } // setValue + + /** + * Gets the property value. + * + * @return The value of the property. Primitive types such as "int" will + * be wrapped as the corresponding object type such as "java.lang.Integer". + */ + public Object getValue() + { + return getColor(); + } // getColor + + /** + * Determines whether this property editor is paintable. + * @return True if the class will honor the paintValue method. + */ + public boolean isPaintable() + { + return false; + } + + /** + * Paint a representation of the value into a given area of screen + * real estate. Note that the propertyEditor is responsible for doing + * its own clipping so that it fits into the given rectangle. + *

+ * If the PropertyEditor doesn't honor paint requests (see isPaintable) + * this method should be a silent noop. + *

+ * The given Graphics object will have the default font, color, etc of + * the parent container. The PropertyEditor may change graphics attributes + * such as font and color and doesn't need to restore the old values. + * + * @param gfx Graphics object to paint into. + * @param box Rectangle within graphics object into which we should paint. + */ + public void paintValue(Graphics gfx, Rectangle box) + { + /**@todo: Implement this java.beans.PropertyEditor method*/ + throw new java.lang.UnsupportedOperationException("Method paintValue() not yet implemented."); + } // paintValue + + /** + * This method is intended for use when generating Java code to set + * the value of the property. It should return a fragment of Java code + * that can be used to initialize a variable with the current property + * value. + *

+ * Example results are "2", "new Color(127,127,34)", "Color.orange", etc. + * + * @return A fragment of Java code representing an initializer for the + * current value. + */ + public String getJavaInitializationString() + { + return "new AdempiereColor()"; + } // String getJavaInitializationString + + /** + * Gets the property value as text. + * + * @return The property value as a human editable string. + *

Returns null if the value can't be expressed as an editable string. + *

If a non-null value is returned, then the PropertyEditor should + * be prepared to parse that string back in setAsText(). + */ + public String getAsText() + { + return m_cc.toString(); + } // getAsText + + /** + * Set the property value by parsing a given String. May raise + * java.lang.IllegalArgumentException if either the String is + * badly formatted or if this kind of property can't be expressed + * as text. + * @param text The string to be parsed. + * @throws IllegalArgumentException + */ + public void setAsText(String text) throws java.lang.IllegalArgumentException + { + throw new java.lang.IllegalArgumentException("AdempiereColorEditor.setAsText not supported"); + } // setAsText + + /** + * If the property value must be one of a set of known tagged values, + * then this method should return an array of the tags. This can + * be used to represent (for example) enum values. If a PropertyEditor + * supports tags, then it should support the use of setAsText with + * a tag value as a way of setting the value and the use of getAsText + * to identify the current value. + * + * @return The tag values for this property. May be null if this + * property cannot be represented as a tagged value. + */ + public String[] getTags() + { + return null; + } // getTags + + /** + * A PropertyEditor may choose to make available a full custom Component + * that edits its property value. It is the responsibility of the + * PropertyEditor to hook itself up to its editor Component itself and + * to report property value changes by firing a PropertyChange event. + *

+ * The higher-level code that calls getCustomEditor may either embed + * the Component in some larger property sheet, or it may put it in + * its own individual dialog, or ... + * + * @return A java.awt.Component that will allow a human to directly + * edit the current property value. May be null if this is + * not supported. + */ + public Component getCustomEditor() + { + return this; + } // getCustomEditor + + /** + * Determines whether this property editor supports a custom editor. + * @return True if the propertyEditor can provide a custom editor. + */ + public boolean supportsCustomEditor() + { + return true; + } // supportsCustomEditor + + /** + * Register a listener for the PropertyChange event. When a + * PropertyEditor changes its value it should fire a PropertyChange + * event on all registered PropertyChangeListeners, specifying the + * null value for the property name and itself as the source. + * + * @param listener An object to be invoked when a PropertyChange + * event is fired. + */ + public void addPropertyChangeListener(PropertyChangeListener listener) + { + super.addPropertyChangeListener(listener); + } // addPropertyChangeListener + + /** + * Remove a listener for the PropertyChange event. + * @param listener The PropertyChange listener to be removed. + */ + public void removePropertyChangeListener(PropertyChangeListener listener) + { + super.removePropertyChangeListener(listener); + } // removePropertyChangeListener + +} // AdempiereColorEditor diff --git a/looks/src/org/compiere/plaf/AdempiereComboBoxUI.java b/looks/src/org/compiere/plaf/AdempiereComboBoxUI.java new file mode 100644 index 0000000000..d5f1b842e9 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereComboBoxUI.java @@ -0,0 +1,110 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.event.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; +import javax.swing.plaf.metal.*; + + +/** + * Adempiere ComboBox UI. + * The ComboBox is opaque - with opaque arrow button and textfield background + * + * @author Jorg Janke + * @version $Id: AdempiereComboBoxUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereComboBoxUI extends MetalComboBoxUI +{ + /** + * Create UI + * @param c + * @return new instance of AdempiereComboBoxUI + */ + public static ComponentUI createUI(JComponent c) + { + return new AdempiereComboBoxUI(); + } // CreateUI + + /*************************************************************************/ + + static int s_no = 0; + /** + * Install UI - Set ComboBox opaque. + * Bug in Metal: arrowButton gets Mouse Events, so add the JComboBox + * MouseListeners to the arrowButton + * @see org.compiere.swing.CComboBox#addMouseListener(MouseListener) + * @param c componrnt + */ + public void installUI (JComponent c) + { + MouseListener[] ml = c.getMouseListeners(); + super.installUI(c); + c.setOpaque(false); + // + for (int i = 0; i < ml.length; i++) + { + // System.out.println("adding " + c.getClass().getName()); + arrowButton.addMouseListener(ml[i]); + } + + } // installUI + + /*************************************************************************/ + + /** + * Create opaque button + * @return opaque button + */ + protected JButton createArrowButton() + { + JButton button = super.createArrowButton(); + button.setContentAreaFilled(false); + button.setOpaque(false); + return button; + } // createArrowButton + + public JButton getArrowButton() + { + return arrowButton; + } + + /** + * Set Icon of arrow button + * @param defaultIcon + */ + public void setIcon(Icon defaultIcon) + { + ((MetalComboBoxButton)arrowButton).setComboIcon(defaultIcon); + } // setIcon + + /*************************************************************************/ + + /** + * Create Popup + * @return AdempiereComboPopup + */ + protected ComboPopup createPopup() + { + AdempiereComboPopup newPopup = new AdempiereComboPopup( comboBox ); + newPopup.getAccessibleContext().setAccessibleParent(comboBox); + return newPopup; + } // createPopup + +} // AdempiereComboBoxUI diff --git a/looks/src/org/compiere/plaf/AdempiereComboPopup.java b/looks/src/org/compiere/plaf/AdempiereComboPopup.java new file mode 100644 index 0000000000..637b4fd8ff --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereComboPopup.java @@ -0,0 +1,74 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import javax.swing.*; +import javax.swing.plaf.basic.*; +import org.compiere.swing.*; + +/** + * Adempiere Combo Popup - allows to prevent the display of the popup + * + * @author Jorg Janke + * @version $Id: AdempiereComboPopup.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereComboPopup extends BasicComboPopup +{ + /** + * Constructor + * @param combo + */ + public AdempiereComboPopup(JComboBox combo) + { + super(combo); + } // AdempiereComboPopup + + /** + * Conditionally show the Popup. + * If the combo is a CComboBox/CField, the return value of the + * method displayPopup determines if the popup is actually displayed + * @see CComboBox#displayPopup() + * @see CField#displayPopup() + */ + public void show() + { + // Check ComboBox if popup should be displayed + if (comboBox instanceof CComboBox && !((CComboBox)comboBox).displayPopup()) + return; + // Check Field if popup should be displayed + if (comboBox instanceof CField && !((CField)comboBox).displayPopup()) + return; + super.show(); + } // show + + + /** + * Inform CComboBox and CField that Popup was hidden + * @see CComboBox.hidingPopup + * @see CField.hidingPopup + * + public void hide() + { + super.hide(); + // Inform ComboBox that popup was hidden + if (comboBox instanceof CComboBox) + (CComboBox)comboBox).hidingPopup(); + else if (comboBox instanceof CComboBox) + (CComboBox)comboBox).hidingPopup(); + } // hided + /**/ +} // AdempiereComboPopup diff --git a/looks/src/org/compiere/plaf/AdempiereLabelUI.java b/looks/src/org/compiere/plaf/AdempiereLabelUI.java new file mode 100644 index 0000000000..3b7c3e7d60 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereLabelUI.java @@ -0,0 +1,156 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +import sun.swing.*; + +/** + * Adempiere Label UI + * + * @author Jorg Janke + * @version $Id: AdempiereLabelUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereLabelUI extends MetalLabelUI +{ + /** Singleton */ + protected static AdempiereLabelUI adempiereLabelUI = new AdempiereLabelUI(); + + /** + * Create UI + * @param c component + * @return singleton + */ + public static AdempiereLabelUI createUI(JComponent c) + { + return adempiereLabelUI; + } // createUI + + /** + * Install Keyboard Actions + * @param l label + */ + protected void installKeyboardActions (JLabel l) + { + // super.installKeyboardActions(l); + int dka = l.getDisplayedMnemonic(); + if (dka != 0) + { + Component lf = l.getLabelFor(); + if (lf != null) + { + ActionMap actionMap = l.getActionMap(); + actionMap.put(PRESS, ACTION_PRESS); + InputMap inputMap = SwingUtilities.getUIInputMap (l, JComponent.WHEN_IN_FOCUSED_WINDOW); + if (inputMap == null) + { + inputMap = new ComponentInputMapUIResource (l); + SwingUtilities.replaceUIInputMap (l, JComponent.WHEN_IN_FOCUSED_WINDOW, inputMap); + } + inputMap.clear (); + inputMap.put (KeyStroke.getKeyStroke (dka, + ActionEvent.SHIFT_MASK+ActionEvent.CTRL_MASK, false), PRESS); + } + } + } // installKeyboardActions + + + /** Action Name */ + private static final String PRESS = "press"; + /** Press Action */ + private static PressAction ACTION_PRESS = new PressAction(); + + /** + * Adempiere Label UI Actions + */ + private static class PressAction extends UIAction + { + + PressAction () + { + super (PRESS); + } + + public void actionPerformed (ActionEvent e) + { + JLabel label = (JLabel)e.getSource (); + String key = getName (); + if (key == PRESS) + { + doPress (label); + } + } // actionPerformed + + /** + * Do Press - Focus the Field + * @param label label + */ + private void doPress (JLabel label) + { + Component labelFor = label.getLabelFor (); + if (labelFor != null && labelFor.isEnabled ()) + { + Component owner = label.getLabelFor (); + if (owner instanceof Container + && ((Container)owner).isFocusCycleRoot ()) + { + owner.requestFocus (); + } + else + { + if (owner instanceof Container) + { + Container container = (Container)owner; + if (container.isFocusCycleRoot()) + { + FocusTraversalPolicy policy = container.getFocusTraversalPolicy(); + Component comp = policy.getDefaultComponent(container); + if (comp != null) + { + comp.requestFocus(); + return; + } + } + Container rootAncestor = container.getFocusCycleRootAncestor(); + if (rootAncestor != null) + { + FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy(); + Component comp = policy.getComponentAfter(rootAncestor, container); + if (comp != null && SwingUtilities.isDescendingFrom(comp, container)) + { + comp.requestFocus(); + return; + } + } + } + if (owner.isFocusable()) + { + owner.requestFocus(); + return; + } + // No Forcus + } + } + } // doPress + } // PressAction + +} // AdempiereLabelUI diff --git a/looks/src/org/compiere/plaf/AdempiereMenuBarUI.java b/looks/src/org/compiere/plaf/AdempiereMenuBarUI.java new file mode 100644 index 0000000000..1da07ed041 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereMenuBarUI.java @@ -0,0 +1,74 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +/** + * Adempiere Menu Bar UI. + * Main Menu background + * + * @author Jorg Janke + * @version $Id: AdempiereMenuBarUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereMenuBarUI extends MetalMenuBarUI +{ + /** + * Create own instance + * @param x + * @return AdempiereMenuBarUI + */ + public static ComponentUI createUI (JComponent x) + { + return new AdempiereMenuBarUI(); + } // createUI + + /** + * Install UI + * @param c + */ + public void installUI (JComponent c) + { + super.installUI(c); + c.setOpaque(true); + } // installUI + + /** + * Update UI + * @param g graphics + * @param c component + */ + public void update (Graphics g, JComponent c) + { + if (c.isOpaque()) + { + // Get AdempiereColor + AdempiereColor bg = AdempiereColor.getDefaultBackground(); + bg.paint (g, c); + } + else + { + g.setColor(c.getBackground()); + g.fillRect(0,0, c.getWidth(), c.getHeight()); + } + paint(g,c); + } // update + +} // AdempiereMenuBarUI diff --git a/looks/src/org/compiere/plaf/AdempiereMenuItemUI.java b/looks/src/org/compiere/plaf/AdempiereMenuItemUI.java new file mode 100644 index 0000000000..57a7220e0c --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereMenuItemUI.java @@ -0,0 +1,88 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; + +/** + * Menu Item UI + * + * @author Jorg Janke + * @version $Id: AdempiereMenuItemUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereMenuItemUI extends BasicMenuItemUI +{ + /** + * Create own instance + * @param c compoment + * @return AdempiereMenuBarUI + */ + public static ComponentUI createUI(JComponent c) + { + return new AdempiereMenuItemUI(); + } // createUI + + /** + * Install UI + * @param c + */ + public void installUI (JComponent c) + { + super.installUI(c); + c.setOpaque(false); // use MenuBarUI background + } // installUI + + /** + * Update UI + * @param g graphics + * @param c component + */ + public void update (Graphics g, JComponent c) + { + if (c.isOpaque()) + { + AdempiereColor bg = AdempiereColor.getDefaultBackground(); + bg.paint (g, c); + // + // g.setColor(c.getBackground()); + // g.fillRect(0,0, c.getWidth(), c.getHeight()); + } + paint(g,c); + } // update + + /** + * Paint Background + * @param g graphics + * @param menuItem menu + * @param bgColor bg color + */ + protected void paintBackground (Graphics g, JMenuItem menuItem, Color bgColor) + { + ButtonModel model = menuItem.getModel(); + if (model.isArmed()) + super.paintBackground (g, menuItem, bgColor); + else + { + AdempiereColor bg = AdempiereColor.getDefaultBackground(); + bg.paint (g, menuItem); + } + } // paintBackground + +} // AdempiereMenuItemUI diff --git a/looks/src/org/compiere/plaf/AdempiereMenuUI.java b/looks/src/org/compiere/plaf/AdempiereMenuUI.java new file mode 100644 index 0000000000..cbf8fe6950 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereMenuUI.java @@ -0,0 +1,52 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import javax.swing.JComponent; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicMenuUI; + +/** + * Adempiere Menu UI. + * The main menu. + * + * @author Jorg Janke + * @version $Id: AdempiereMenuUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereMenuUI extends BasicMenuUI +{ + /** + * Create own instance + * @param x + * @return AdempiereMenuBarUI + */ + public static ComponentUI createUI(JComponent x) + { + return new AdempiereMenuUI(); + } // createUI + + /** + * Install UI + * @param c + */ + public void installUI (JComponent c) + { + super.installUI(c); + c.setOpaque(false); // use MenuBarUI background + } // installUI + +} // AdempiereMenuUI diff --git a/looks/src/org/compiere/plaf/AdempierePLAF.java b/looks/src/org/compiere/plaf/AdempierePLAF.java new file mode 100644 index 0000000000..4d72e0ebd0 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempierePLAF.java @@ -0,0 +1,696 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import java.awt.event.*; +import java.lang.reflect.*; +import java.util.*; +import java.util.logging.*; +import javax.swing.*; +import javax.swing.plaf.metal.*; +//import org.compiere.process.OrgOwnership; +import org.compiere.swing.*; +import org.compiere.util.*; + +/** + * Variable Pluggable Look And Feel. + * Provides an easy access to the required currently active PLAF information + * + * @author Jorg Janke + * @version $Id: AdempierePLAF.java,v 1.3 2006/07/30 00:52:23 jjanke Exp $ + */ +public final class AdempierePLAF +{ + /** Version tag */ + public static final String VERSION = "R1.4.0"; + /** Key of Client Property to paint in AdempiereColor */ + public static final String BACKGROUND = "AdempiereBackground"; + /** Key of Client Property for Rectangle Items - if exists, the standard background is used */ + public static final String BACKGROUND_FILL = "AdempiereBackgroundFill"; + /** Key of Client Property for CPanel */ + public static final String TABLEVEL = "AdempiereTabLevel"; + + /** Logger */ + private static Logger log = Logger.getLogger(AdempierePLAF.class.getName()); + + /****** Background *******************************************************/ + + /** + * Return Normal field background color "text". + * Windows = white + * @return Color + */ + public static Color getFieldBackground_Normal() + { + // window => white + return ColorBlind.getDichromatColor(UIManager.getColor("text")); + } // getFieldBackground_Normal + + /** + * Return Error field background (AdempiereTheme) + * @return Color + */ + public static Color getFieldBackground_Error() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.error); + } // getFieldBackground_Error + + /** + * Return Mandatory field background color (AdempiereTheme) + * @return Color + */ + public static Color getFieldBackground_Mandatory() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.mandatory); + } // getFieldBackground_Mandatory + + /** + * Return Inactive field background color (AdempiereTheme) + * @return Color + */ + public static Color getFieldBackground_Inactive() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.inactive); + } // getFieldBackground_Inactive + + /** + * Return form background color "control". + * Windows = lightGray + * @return Color + */ + public static Color getFormBackground() + { + return ColorBlind.getDichromatColor(UIManager.getColor("control")); + } // getFormBackground + + /** + * Info Background Color "info" + * Windows = info (light yellow) + * @return Color + */ + public static Color getInfoBackground() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.info); + } // getInfoBackground + + + /****** Text *************************************************************/ + + /** + * Normal field text foreground color "textText" + * Windows = black + * @return Color + */ + public static Color getTextColor_Normal() + { + return ColorBlind.getDichromatColor(UIManager.getColor("textText")); + } // getText_Normal + + /** + * OK Text Foreground Color (Theme) + * @return Color + */ + public static Color getTextColor_OK() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.txt_ok); + } // getText_OK + + /** + * Issue Text Foreground Color (Theme) + * @return Color + */ + public static Color getTextColor_Issue() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.txt_error); + } // getText_Issue + + /** + * Label Text foreground Color "controlText" + * Windows = black + * @return Color + */ + public static Color getTextColor_Label() + { + return ColorBlind.getDichromatColor(UIManager.getColor("controlText")); + } // getTextColor_Label + + /** + * Get Primary1 + * @return primary 1 + */ + public static Color getPrimary1() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.primary1); + } + /** + * Get Primary2 + * @return primary 2 + */ + public static Color getPrimary2() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.primary2); + } + /** + * Get Primary3 + * @return primary 3 + */ + public static Color getPrimary3() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.primary3); + } + /** + * Get Secondary 1 + * @return secondary 1 + */ + public static Color getSecondary1() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.secondary1); + } + /** + * Get Secondary 2 + * @return secondary 2 + */ + public static Color getSecondary2() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.secondary2); + } + /** + * Get Secondary 3 + * @return secondary 3 + */ + public static Color getSecondary3() + { + return ColorBlind.getDichromatColor(AdempiereThemeInnova.secondary3); + } + + + /****** Fonts ************************************************************/ + + /** + * Get Header Font (window/label font) + * @return font + */ + public static Font getFont_Header() + { + return CompiereTheme.windowFont; + // return UIManager.getFont("Label.font"); + } // getFont_Header + + /** + * Get Field Font + * @return font + */ + public static Font getFont_Field() + { + return CompiereTheme.userFont; + // return UIManager.getFont("TextField.font"); + } // getFont_Field + + /** + * Get Label Font + * @return font + */ + public static Font getFont_Label() + { + return CompiereTheme.controlFont; + // return UIManager.getFont("Label.font"); + } // setFont_Label + + /** + * Get Small (report) Font + * @return font + */ + public static Font getFont_Small() + { + return CompiereTheme.smallFont; + } // setFont_Small + + /****** Available L&F ****************************************************/ + + /** Availablle Looks */ + private static ValueNamePair[] s_looks = null; + /** Default PLAF */ + private static ValueNamePair s_defaultPLAF = null; + /** Availablle Themes */ + private static ValueNamePair[] s_themes = null; + + private static ValueNamePair s_vp_adempiereTheme = null; + private static ValueNamePair s_vp_metalTheme = null; + private static ValueNamePair s_vp_kunststoffTheme = null; + //e-evolution vpj-cd 19102006 + private static ValueNamePair s_vp_jgoodiesTheme = null; + //e-evolution vpj-cd 1910200sky + + /** PLAF class list + com.sun.java.swing.plaf.windows.WindowsLookAndFeel + com.sun.java.swing.plaf.motif.MotifLookAndFeel + javax.swing.plaf.metal.MetalLookAndFeel + + /** + * Static Initializer. + * - Fill available PLAFs and Themes + */ + static + { + ArrayList plafList = new ArrayList(); + //e-evolution vpj-cd 19102006 + ValueNamePair vp = null; + ArrayList themeList = new ArrayList(); + + try + { + Class c = Class.forName("com.jgoodies.looks.plastic.PlasticLookAndFeel"); + vp = new ValueNamePair("org.adempiere.plaf.AdempiereLookAndFeel", org.adempiere.plaf.AdempiereLookAndFeel.NAME); + plafList.add(vp); + s_vp_jgoodiesTheme = new ValueNamePair("org.compiere.plaf.AdempiereTheme", AdempiereThemeInnova.NAME); + themeList.add (s_vp_jgoodiesTheme); + } + catch (Exception e) + { + // log.severe("Kuststoff not found"); + } + //e-evolution vpj-cd 19102006 + //vpj-cd ValueNamePair vp = new ValueNamePair("org.compiere.plaf.CompiereLookAndFeel", CompiereLookAndFeel.NAME); + vp = new ValueNamePair("org.compiere.plaf.CompiereLookAndFeel", CompiereLookAndFeel.NAME); + plafList.add (vp); + // Themes + //vpj-cd ArrayList themeList = new ArrayList(); + s_vp_adempiereTheme = new ValueNamePair("org.compiere.plaf.CompiereThemeBlueMetal", CompiereThemeBlueMetal.NAME); + themeList.add (s_vp_adempiereTheme); + themeList.add (new ValueNamePair("org.compiere.plaf.CompiereThemeIce", CompiereThemeIce.NAME)); + // Metal + s_vp_metalTheme = new ValueNamePair("javax.swing.plaf.metal.DefaultMetalTheme", "Steel"); + themeList.add (s_vp_metalTheme); + themeList.add (new ValueNamePair("javax.swing.plaf.metal.OceanTheme", "Ocean")); +// themeList.add (new ValueNamePair("javax.swing.plaf.metal.MetalHighContrastTheme", "Java High Contrast")); + // + themeList.add (new ValueNamePair("org.compiere.plaf.AquaTheme", "Aqua")); + themeList.add (new ValueNamePair("org.compiere.plaf.CharcoalTheme", "Charcoal")); + themeList.add (new ValueNamePair("org.compiere.plaf.ContrastTheme", "Contrast")); + themeList.add (new ValueNamePair("org.compiere.plaf.EmeraldTheme", "Emerald")); + themeList.add (new ValueNamePair("org.compiere.plaf.RubyTheme", "Ruby")); + + // Discover and Install - Kuststoff + try + { + Class c = Class.forName("com.incors.plaf.kunststoff.KunststoffLookAndFeel"); + vp = new ValueNamePair("com.incors.plaf.kunststoff.KunststoffLookAndFeel", "Kunststoff"); + plafList.add(vp); + vp = new ValueNamePair("com.incors.plaf.kunststoff.KunststoffTheme", "Kuststoff"); + themeList.add(vp); + s_vp_kunststoffTheme = vp; + } + catch (Exception e) + { + // log.severe("Kuststoff not found"); + } + + // Install discovered PLAFs + for (int i = 0; i < plafList.size(); i++) + { + vp = (ValueNamePair)plafList.get(i); + UIManager.installLookAndFeel(vp.getName(), vp.getValue()); + } + + // Fill Available PLAFs + plafList = new ArrayList(); + UIManager.LookAndFeelInfo[] lfInfo = UIManager.getInstalledLookAndFeels(); + for (int i = 0; i < lfInfo.length; i++) + { + vp = new ValueNamePair (lfInfo[i].getClassName(), lfInfo[i].getName()); + plafList.add(vp); + //begin vpj-cd e-evolution 26 oct 2006 + //if (lfInfo[i].getName().equals(CompiereLookAndFeel.NAME)) + if (lfInfo[i].getName().equals(org.adempiere.plaf.AdempiereLookAndFeel.NAME)) + //end vpj-cd e-evolution 26 oct 2006 + { + s_defaultPLAF = vp; + log.finest(vp.getName() + " (default)"); + } + else + log.finest(vp.getName()); + } + s_looks = new ValueNamePair[plafList.size()]; + plafList.toArray(s_looks); + + // Fill Available Themes + s_themes = new ValueNamePair[themeList.size()]; + themeList.toArray(s_themes); + // + // printPLAFDefaults(); + } // static Initializer + + + /** + * Get available Look And Feels + * @return Array of ValueNamePair with name and class of Look and Feel + */ + public static ValueNamePair[] getPLAFs() + { + return s_looks; + } // getPLAFs + + /** + * Get the list of available Metal Themes if the current L&F is a Metal L&F + * @return Array of Strings with Names of Metal Themes + */ + public static ValueNamePair[] getThemes () + { + if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) + return s_themes; + return new ValueNamePair[0]; + } // getThemes + + + /************************************************************************** + * Set PLAF based on Ini Properties + * @param win Optional Window + */ + public static void setPLAF (Window win) + { + String look = Ini.getProperty(Ini.P_UI_LOOK); + String lookTheme = Ini.getProperty(Ini.P_UI_THEME); + // Search for PLAF + ValueNamePair plaf = null; + for (int i = 0; i < s_looks.length; i++) + { + if (s_looks[i].getName().equals(look)) + { + plaf = s_looks[i]; + break; + } + } + // Search for Theme + ValueNamePair theme = null; + for (int i = 0; i < s_themes.length; i++) + { + if (s_themes[i].getName().equals(lookTheme)) + { + theme = s_themes[i]; + break; + } + } + // Set PLAF + setPLAF (plaf == null ? s_defaultPLAF : plaf, theme, win); + } // setPLAF + + /** + * Set PLAF and update Ini + * + * @param plaf ValueNamePair of the PLAF to be set + * @param theme Optional Theme name + * @param win Optional Window + */ + public static void setPLAF (ValueNamePair plaf, ValueNamePair theme, Window win) + { + if (plaf == null) + return; + log.config(plaf + (theme == null ? "" : (" - " + theme))); + + // Look & Feel + try + { + UIManager.setLookAndFeel(plaf.getValue()); + } + catch (Exception e) + { + log.severe(e.getMessage()); + } + LookAndFeel laf = UIManager.getLookAndFeel(); + Ini.setProperty(Ini.P_UI_LOOK, plaf.getName()); + + // Optional Theme + Ini.setProperty(Ini.P_UI_THEME, ""); + // Default Theme + if (theme == null && laf instanceof MetalLookAndFeel) + { + String className = laf.getClass().getName(); + if (className.equals("javax.swing.plaf.metal.MetalLookAndFeel")) + theme = s_vp_metalTheme; + else if (className.equals("org.compiere.plaf.CompiereLookAndFeel")) + theme = s_vp_adempiereTheme; + else if (className.equals("com.incors.plaf.kunststoff.KunststoffLookAndFeel")) + theme = s_vp_kunststoffTheme; + //e-evolution vpj-cd + else if (className.equals("org.adempiere.plaf.AdempiereLookAndFeel")) + theme = s_vp_jgoodiesTheme; + //e-evolution vpj-cd + } + if (theme != null && laf instanceof MetalLookAndFeel && theme.getValue().length() > 0) + { + try + { + Class c = Class.forName(theme.getValue()); + MetalTheme t = (MetalTheme)c.newInstance(); + if (t instanceof CompiereTheme) + AdempiereThemeInnova.load(); + if (laf instanceof CompiereLookAndFeel) + CompiereLookAndFeel.setCurrentTheme(t); + else + MetalLookAndFeel.setCurrentTheme(t); + // + boolean flat = Ini.isPropertyBool(Ini.P_UI_FLAT); + CompiereTheme.setTheme(t, flat); // copies it if not AdempiereTheme + Ini.setProperty(Ini.P_UI_THEME, theme.getName()); + } + catch (Exception e) + { + log.severe("Theme - " + e.getMessage()); + } + } + updateUI (win); + log.config(plaf + " - " + theme); + // printPLAFDefaults(); + } // setPLAF + + /** + * Update UI of this and parent Windows + * @param win window + */ + public static void updateUI (Window win) + { + if (win == null) + return; + Window c = win; + do + { + SwingUtilities.updateComponentTreeUI(c); + c.invalidate(); + c.pack(); + c.validate(); + c.repaint(); + c = c.getOwner(); + } + while (c != null); + } // updateUI + + /** + * Reset PLAF Settings + * @param win Window to be reset + */ + public static void reset (Window win) + { + // Clean Theme Properties + AdempiereThemeInnova.reset (); // sets properties + AdempierePLAF.setPLAF (win); + } // reset + + /** + * Print current UIDefaults + */ + public static void printPLAFDefaults () + { + System.out.println(UIManager.getLookAndFeel()); + Object[] keys = UIManager.getLookAndFeelDefaults().keySet().toArray(); + Arrays.sort(keys); + char lastStart = ' '; + for (int i = 0; i < keys.length; i++) + { + StringBuffer sb = new StringBuffer(); + sb.append(keys[i]).append(" = ").append(UIManager.get(keys[i])); + if (keys[i].toString().charAt(0) != lastStart) + { + System.out.println(); + lastStart = keys[i].toString().charAt(0); + } + System.out.println(sb); + } + } // printPLAFDefaults + + /** + * Is AdempiereL&F the active L&F + * @return true if L&F is Adempiere + */ + public static boolean isActive() + { + return UIManager.getLookAndFeel() instanceof CompiereLookAndFeel; + } // isActive + + /*************************************************************************/ + + static ResourceBundle s_res = ResourceBundle.getBundle("org.compiere.plaf.PlafRes"); + + /** + * Create OK Button + * @return OK button + */ + public static CButton getOKButton() + { + CButton b = new CButton(); + b.setIcon(new ImageIcon(AdempierePLAF.class.getResource("icons/Ok24.gif"))); + b.setMargin(new Insets(0,10,0,10)); + b.setToolTipText (s_res.getString("OK")); + return b; + } // getOKButton + + /** + * Create Cancel Button + * @return Cancel button + */ + public static CButton getCancelButton() + { + CButton b = new CButton(); + b.setIcon(new ImageIcon(AdempierePLAF.class.getResource("icons/Cancel24.gif"))); + b.setMargin(new Insets(0,10,0,10)); + b.setToolTipText (s_res.getString("Cancel")); + return b; + } // getCancelButton + + /** + * Center Window on Screen and show it + * @param window window + */ + public static void showCenterScreen (Window window) + { + window.pack(); + Dimension sSize = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension wSize = window.getSize(); + window.setLocation(((sSize.width-wSize.width)/2), ((sSize.height-wSize.height)/2)); + window.toFront(); + window.setVisible(true); + } // showCenterScreen + + + /************************************************************************** + * Start Class With Adempiere Look or Adempiere PLAF Editor + * @param args first parameter is class to start, if none start PLAF Editor + */ + public static void main (String[] args) + { + String jVersion = System.getProperty("java.version"); + if (!(jVersion.startsWith("1.5"))) + { + JOptionPane.showMessageDialog (null, + "Require Java Version 1.5 or up - Not " + jVersion, + "AdempierePLAF - Version Conflict", + JOptionPane.ERROR_MESSAGE); + System.exit(1); + } + + // set the defined PLAF + Ini.loadProperties (true); + AdempiereThemeInnova.load (); + setPLAF (null); + // + if (args.length == 0) + { + AdempierePLAFFrame frame = new AdempierePLAFFrame(); + return; + } + + String className = args[0]; + // find class + Class startClass = null; + try + { + startClass = Class.forName(className); + } + catch (Exception e) + { + log.severe("Did not find: " + className); + e.printStackTrace(); + System.exit(1); + } + + // try static main method + try + { + Method[] methods = startClass.getMethods(); + for (int i = 0; i < methods.length; i++) + { + if (Modifier.isStatic(methods[i].getModifiers()) && methods[i].getName().equals("main")) + { + String[] startArgs = new String[args.length-1]; + for (int ii = 1; ii < args.length; ii++) + startArgs[ii-i] = args[ii]; + methods[i].invoke(null, new Object[] {startArgs}); + } + return; + } + } + catch (Exception ee) + { + log.severe("Problems invoking main"); + ee.printStackTrace(); + } + + // start the class + try + { + startClass.newInstance(); + } + catch (Exception e) + { + log.severe("Cannot start: " + className); + e.printStackTrace(); + System.exit(1); + } + } // main + +} // AdempierePLAF + +/** + * Frame to display Editor + */ +class AdempierePLAFFrame extends CFrame +{ + /** + * Frame to display Editor + */ + public AdempierePLAFFrame() + { + super("AdempierePLAF"); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setIconImage(Toolkit.getDefaultToolkit().getImage(AdempierePLAF.class.getResource("icons/CL16.gif"))); + AdempierePLAF.showCenterScreen(this); + } // AdempierePLAFFrame + + /** + * Show Editor + * @param e event + */ + protected void processWindowEvent (WindowEvent e) + { + super.processWindowEvent(e); + if (e.getID() == WindowEvent.WINDOW_OPENED) + { + AdempierePLAFEditor ed = new AdempierePLAFEditor(this, true); + dispose(); + } + } // processWindowEvents +} // AdempierePLAFFrame diff --git a/looks/src/org/compiere/plaf/AdempierePLAFEditor.java b/looks/src/org/compiere/plaf/AdempierePLAFEditor.java new file mode 100644 index 0000000000..2885e41e32 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempierePLAFEditor.java @@ -0,0 +1,628 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import java.util.logging.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.plaf.metal.*; +import org.compiere.swing.*; +import org.compiere.util.*; +import sun.awt.*; + +/** + * Adempiere PLAF Editor. + *

+ * start with new AdempierePLAFEditor() + * + * @author Jorg Janke + * @version $Id: AdempierePLAFEditor.java,v 1.3 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempierePLAFEditor extends JDialog + implements ActionListener +{ + /** + * Default Constructor + * Don't Show Example + */ + public AdempierePLAFEditor() + { + super(); + init(false); + } // AdempierePLAFEditor + + /** + * Constructor + * @param showExample if true, show Example + */ + public AdempierePLAFEditor (boolean showExample) + { + super(); + init(showExample); + } // AdempierePLAFEditor + + /** + * Modal Dialog Constructor + * @param owner + * @param showExample if true, show Example + */ + public AdempierePLAFEditor(Dialog owner, boolean showExample) + { + super(owner, "", true); + init(showExample); + } // AdempierePLAFEditor + + /** + * Modal Frame Constructor + * @param owner + * @param showExample if true, show Example + */ + public AdempierePLAFEditor(Frame owner, boolean showExample) + { + super(owner, "", true); + init(showExample); + } // AdempierePLAFEditor + + /** Logger */ + private static Logger log = Logger.getLogger(AdempierePLAFEditor.class.getName()); + + + /************************************************************************** + * Init Editor + * @param showExample if true, show Example + */ + private void init (boolean showExample) + { + try + { + jbInit(); + dynInit(); + + // Display + example.setVisible(showExample); + blindLabel.setVisible(showExample); + blindField.setVisible(showExample); + AdempierePLAF.showCenterScreen(this); + } + catch(Exception e) + { + log.log(Level.SEVERE, "", e); + } + // AdempiereUtils.setNotBuffered(this); + } // PLAFEditor + + /** Diable Theme Field */ + private boolean m_setting = false; + /** We did test for true color */ + private boolean m_colorTest = false; + + static ResourceBundle s_res = ResourceBundle.getBundle("org.compiere.plaf.PlafRes"); + static Object[] s_columns = new Object[] {"-0-", "-1-", "-2-", "-3-", "-O-", "-l-"}; + static Object[][] s_data = new Object[][] { + {"-00-", "-01-", "-02-", "-03-", "-0O-", "-0l-"}, + {"-10-", "-11-", "-12-", "-13-", "-1O-", "-1l-"}, + {"-20-", "-21-", "-22-", "-23-", "-2O-", "-2l-"}, + {"-30-", "-31-", "-32-", "-33-", "-3O-", "-3l-"}, + {"-O0-", "-O1-", "-O2-", "-O3-", "-OO-", "-Ol-"}, + {"-l0-", "-l1-", "-l2-", "-l3-", "-lO-", "-ll-"}}; + static Object[] s_pos = new Object[] {"Top", "Left", "Bottom", "Right"}; + + private CPanel mainPanel = new CPanel(new BorderLayout()); + private CPanel northPanel = new CPanel(); + private CPanel southPanel = new CPanel(); + private CButton bOK = AdempierePLAF.getOKButton(); + private CButton bCancel = AdempierePLAF.getCancelButton(); + private CButton bHelp = new CButton(); /** @todo Help Button */ + private GridBagLayout northLayout = new GridBagLayout(); + private CLabel lfLabel = new CLabel(); + private CComboBox lfField = new CComboBox(AdempierePLAF.getPLAFs()); + private CLabel themeLabel = new CLabel(); + private CComboBox themeField = new CComboBox(AdempierePLAF.getThemes()); + private CButton cButton = new CButton(); + private FlowLayout southLayout = new FlowLayout(); + private CButton rButton = new CButton(); + private CButton bSetColor = new CButton(); + private CCheckBox cDefault = new CCheckBox(); + private CComboBox blindField = new CComboBox(ColorBlind.COLORBLIND_TYPE); + private CCheckBox flatField = new CCheckBox(); + private CLabel blindLabel = new CLabel(); + private BorderLayout mainLayout = new BorderLayout(); + // + private CTabbedPane example = new CTabbedPane(); + private CPanel jPanel1 = new CPanel(); + private TitledBorder exampleBorder; + private CPanel jPanel2 = new CPanel(); + private JLabel jLabel1 = new JLabel(); + private JTextField jTextField1 = new JTextField(); + private JCheckBox jCheckBox1 = new JCheckBox(); + private JRadioButton jRadioButton1 = new JRadioButton(); + private CButton jButton1 = new CButton(); + private CToggleButton jToggleButton1 = new CToggleButton(); + private CComboBox jComboBox1 = new CComboBox(s_columns); + private JTextArea jTextArea1 = new JTextArea(); + private JTextPane jTextPane1 = new JTextPane(); + private JEditorPane jEditorPane1 = new JEditorPane(); + private JPasswordField jPasswordField1 = new JPasswordField(); + private JList jList1 = new JList(s_columns); + private JSplitPane jSplitPane1 = new JSplitPane(); + private BorderLayout borderLayout1 = new BorderLayout(); + private JScrollPane jScrollPane1 = new JScrollPane(); + private JTree jTree1 = new JTree(); + private JScrollPane jScrollPane2 = new JScrollPane(); + private JTable jTable1 = new JTable(s_data, s_columns); + private GridBagLayout gridBagLayout1 = new GridBagLayout(); + private CPanel jPanelFlat = new CPanel(new AdempiereColor(new Color(255,205,255), true)); + private CPanel jPanelGradient = new CPanel(new AdempiereColor(new Color(233,210,210), new Color(217,210,233))); + private CPanel jPanelTexture = new CPanel(new AdempiereColor(AdempiereColor.class.getResource("vincent.jpg"), Color.lightGray, 0.7f)); + private CPanel jPanelLines = new CPanel(new AdempiereColor(new Color(178,181,205), new Color(193,193,205), 1.0f, 5)); + private JButton jButtonFlat = new JButton(); + private CButton jButtonGardient = new CButton(); + private JButton jButtonTexture = new JButton(); + private CButton jButtonLines = new CButton(); + private JComboBox jComboBoxFlat = new JComboBox(s_pos); + private JTextField jTextFieldFlat = new JTextField(); + private JLabel jLabelFlat = new JLabel(); + private CComboBox jComboBoxGradient = new CComboBox(s_pos); + private CTextField jTextFieldGradient = new CTextField(); + private CLabel jLabelGradient = new CLabel(); + private JComboBox jComboBoxTexture = new JComboBox(s_pos); + private JTextField jTextFieldTexture = new JTextField(); + private JLabel jLabelTexture = new JLabel(); + private CComboBox jComboBoxLines = new CComboBox(s_pos); + private CTextField jTextFieldLines = new CTextField(); + private CLabel jLabelLines = new CLabel(); + private CCheckBox jCheckBoxLines = new CCheckBox(); + private JCheckBox jCheckBoxTexture = new JCheckBox(); + private CCheckBox jCheckBoxGradient = new CCheckBox(); + private JCheckBox jCheckBoxFlat = new JCheckBox(); + + /** + * Static Layout + * @throws Exception + */ + private void jbInit() throws Exception + { + this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + this.setTitle(s_res.getString("LookAndFeelEditor") + " " + AdempierePLAF.VERSION); + mainPanel.setLayout(mainLayout); + mainLayout.setHgap(5); + mainLayout.setVgap(5); + jTextFieldFlat.setColumns(10); + jTextFieldGradient.setColumns(10); + jTextFieldTexture.setColumns(10); + jTextFieldLines.setColumns(10); + jCheckBoxLines.setText("jCheckBox"); + jCheckBoxTexture.setText("jCheckBox"); + jCheckBoxGradient.setText("jCheckBox"); + jCheckBoxFlat.setText("jCheckBox"); + jPanelGradient.setToolTipText("Indented Level 1"); + jPanelTexture.setToolTipText("Indented Level 2"); + jPanelLines.setToolTipText("Indented Level 1"); + this.getContentPane().add(mainPanel, BorderLayout.CENTER); + AdempiereColor.setBackground(this); + // + lfLabel.setText(s_res.getString("LookAndFeel")); + lfField.addActionListener(this); + themeLabel.setText(s_res.getString("Theme")); + themeField.addActionListener(this); + cButton.setText(s_res.getString("EditAdempiereTheme")); + cButton.addActionListener(this); + rButton.setText(s_res.getString("Reset")); + rButton.addActionListener(this); + cDefault.setText(s_res.getString("SetDefault")); + cDefault.addActionListener(this); + bSetColor.setText(s_res.getString("SetDefaultColor")); + bSetColor.addActionListener(this); + blindLabel.setText(s_res.getString("ColorBlind")); + blindField.addActionListener(this); + flatField.setText(s_res.getString("FlatColor")); + flatField.setSelected(Ini.isPropertyBool(Ini.P_UI_FLAT)); + flatField.addActionListener(this); + // + bOK.addActionListener(this); + bCancel.addActionListener(this); + bHelp.addActionListener(this); + // + northPanel.setLayout(northLayout); + southPanel.setLayout(southLayout); + southLayout.setAlignment(FlowLayout.RIGHT); + // + exampleBorder = new TitledBorder(s_res.getString("Example")); + example.setBorder(exampleBorder); + + jLabel1.setText("jLabel"); + jTextField1.setText("jTextField"); + jCheckBox1.setText("jCheckBox"); + jRadioButton1.setText("jRadioButton"); + jButton1.setText("jButton"); + jToggleButton1.setText("jToggleButton"); + jTextArea1.setText("jTextArea"); + jTextPane1.setText("jTextPane"); + jEditorPane1.setText("jEditorPane"); + jPasswordField1.setText("jPasswordField"); + jPanel2.setLayout(borderLayout1); + jPanel1.setLayout(gridBagLayout1); + jScrollPane1.setPreferredSize(new Dimension(100, 200)); + jScrollPane2.setPreferredSize(new Dimension(100, 200)); + jButtonFlat.setText("Confirm"); + jButtonGardient.setText("Input"); + jButtonTexture.setText("Message"); + jButtonLines.setText("Error"); + jTextFieldFlat.setText("jTextField"); + jLabelFlat.setText("jLabel"); + jTextFieldGradient.setText("jTextField"); + jLabelGradient.setText("jLabel"); + jTextFieldTexture.setText("jTextField"); + jLabelTexture.setText("jLabel"); + jTextFieldLines.setText("jTextField"); + jLabelLines.setText("jLabel"); + mainPanel.add(northPanel, BorderLayout.NORTH); + northPanel.add(lfLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0)); + northPanel.add(lfField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 0, 0)); + northPanel.add(themeLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0)); + northPanel.add(themeField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0)); + northPanel.add(cButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0)); + northPanel.add(rButton, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0)); + northPanel.add(bSetColor, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0)); + northPanel.add(cDefault, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0)); + northPanel.add(flatField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 12), 0, 0)); + northPanel.add(blindLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0)); + northPanel.add(blindField, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 12), 0, 0)); + mainPanel.add(southPanel, BorderLayout.SOUTH); + southPanel.add(bCancel, null); + southPanel.add(bOK, null); + mainPanel.add(example, BorderLayout.CENTER); + example.add(jPanel1, "JPanel"); + jPanel1.add(jTextPane1, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.2 + ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); + jPanel1.add(jEditorPane1, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.2 + ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); + jPanel1.add(jList1, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.2 + ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); + jPanel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + jPanel1.add(jTextField1, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); + jPanel1.add(jCheckBox1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(1, 1, 1, 1), 0, 0)); + jPanel1.add(jRadioButton1, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + jPanel1.add(jButton1, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.1 + ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + jPanel1.add(jToggleButton1, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.1 + ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + jPanel1.add(jTextArea1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.2 + ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); + jPanel1.add(jComboBox1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + jPanel1.add(jPasswordField1, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); + example.add(jPanel2, "JPanel"); + jPanel2.add(jSplitPane1, BorderLayout.CENTER); + jSplitPane1.add(jScrollPane1, JSplitPane.LEFT); + jSplitPane1.add(jScrollPane2, JSplitPane.RIGHT); + jPanelFlat.setName("FlatP"); + jPanelGradient.setName("GradientP"); + jPanelTexture.setName("TextureP"); + jPanelLines.setName("LineP"); + example.add(jPanelFlat, "jPanel Flat"); + jPanelFlat.add(jButtonFlat, null); + jPanelFlat.add(jComboBoxFlat, null); + example.add(jPanelGradient, "jPanel Gradient 1"); + jPanelGradient.add(jButtonGardient, null); + jPanelGradient.add(jComboBoxGradient, null); + jPanelGradient.add(jLabelGradient, null); + jPanelGradient.add(jTextFieldGradient, null); + example.add(jPanelTexture, "jPanel Texture 2"); + jPanelTexture.add(jButtonTexture, null); + jPanelTexture.add(jComboBoxTexture, null); + jPanelTexture.add(jLabelTexture, null); + jPanelTexture.add(jTextFieldTexture, null); + example.add(jPanelLines, "jPanel Lines 1"); + jPanelLines.add(jButtonLines, null); + jPanelLines.add(jComboBoxLines, null); + jPanelLines.add(jLabelLines, null); + jPanelLines.add(jTextFieldLines, null); + jScrollPane2.getViewport().add(jTable1, null); + jScrollPane1.getViewport().add(jTree1, null); + jPanelFlat.add(jLabelFlat, null); + jPanelFlat.add(jTextFieldFlat, null); + jPanelLines.add(jCheckBoxLines, null); + jPanelTexture.add(jCheckBoxTexture, null); + jPanelGradient.add(jCheckBoxGradient, null); + jPanelFlat.add(jCheckBoxFlat, null); + } // jbInit + + /** + * Dynamic Init + */ + private void dynInit() + { + // setLFSelection(); + // + jPanelGradient.setTabLevel(1); + jPanelTexture.setTabLevel(2); + jPanelLines.setTabLevel(1); + // + jComboBoxFlat.addActionListener(this); + jComboBoxGradient.addActionListener(this); + jComboBoxTexture.addActionListener(this); + jComboBoxLines.addActionListener(this); + // + jButton1.addActionListener(this); + jButtonFlat.addActionListener(this); + jButtonGardient.addActionListener(this); + jButtonTexture.addActionListener(this); + jButtonLines.addActionListener(this); + // + AdempierePLAF.setPLAF(this); + } // dynInit + + /** + * Set Picks From Environment + */ + private void setLFSelection() + { + m_setting = true; + // Search for PLAF + ValueNamePair plaf = null; + LookAndFeel lookFeel = UIManager.getLookAndFeel(); + String look = lookFeel.getClass().getName(); + for (int i = 0; i < AdempierePLAF.getPLAFs().length; i++) + { + ValueNamePair vp = AdempierePLAF.getPLAFs()[i]; + if (vp.getValue().equals(look)) + { + plaf = vp; + break; + } + } + if (plaf != null) + lfField.setSelectedItem(plaf); + + + // Search for Theme + MetalTheme metalTheme = null; + ValueNamePair theme = null; + boolean metal = UIManager.getLookAndFeel() instanceof MetalLookAndFeel; + themeField.setModel(new DefaultComboBoxModel(AdempierePLAF.getThemes())); + if (metal) + { + theme = null; + AppContext context = AppContext.getAppContext(); + metalTheme = (MetalTheme)context.get("currentMetalTheme"); + if (metalTheme != null) + { + String lookTheme = metalTheme.getName(); + for (int i = 0; i < AdempierePLAF.getThemes().length; i++) + { + ValueNamePair vp = AdempierePLAF.getThemes()[i]; + if (vp.getName().equals(lookTheme)) + { + theme = vp; + break; + } + } + } + if (theme != null) + themeField.setSelectedItem(theme); + } + m_setting = false; + log.info(lookFeel + " - " + metalTheme); + } // setLFSelection + + + /************************************************************************** + * ActionListener + * @param e + */ + public void actionPerformed(ActionEvent e) + { + setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + // OK - Save & Finish + if (e.getSource() == bOK) + { + CompiereTheme.save(); + Ini.saveProperties(true); + dispose(); + } + // Cancel - Finish + else if (e.getSource() == bCancel) + { + dispose(); + } + else if (e.getSource() == bHelp) + { + new MiniBrowser("http://www.adempiere.org/looks/help.html"); + } + + // Look & Feel changed + else if (e.getSource() == lfField && !m_setting) + { + m_setting = true; // disable Theme setting + // set new theme + AdempierePLAF.setPLAF((ValueNamePair)lfField.getSelectedItem(), null, this); + setLFSelection(); + setBackgroundToTheme(); + AdempierePLAF.setPLAF(this); // twice ?? + m_setting = false; // enable Theme setting + } + // Theme Field Changed + else if (e.getSource() == themeField && !m_setting) + { + Ini.setProperty(Ini.P_UI_THEME, themeField.getSelectedItem().toString()); + AdempierePLAF.setPLAF((ValueNamePair)lfField.getSelectedItem(), (ValueNamePair)themeField.getSelectedItem(), this); + CompiereTheme.setTheme(); // copy Theme + setBackgroundToTheme(); + AdempierePLAF.setPLAF(this); // twice (??) + } + + // Start Adempiere Theme Editor + else if (e.getSource() == cButton) + { + new AdempiereThemeEditor(this); + setBackgroundToTheme(); + } + + // Reset PLAFs + else if (e.getSource() == rButton) + { + AdempierePLAF.reset(this); + setLFSelection(); + ColorBlind.setColorType(ColorBlind.NORMAL); + AdempierePLAF.setPLAF(this); // twice ?? + } + + // Set Default Background Color + else if (e.getSource() == bSetColor) + { + AdempiereColor cc = AdempiereColorEditor.showDialog(this, AdempierePanelUI.getDefaultBackground()); + AdempierePanelUI.setDefaultBackground(cc); + AdempierePLAF.updateUI(this); + Ini.setProperty(CompiereTheme.P_AdempiereColor, cc.toString()); + } + // Set Background as Default + else if (e.getSource() == cDefault) + { + AdempierePanelUI.setSetDefault(cDefault.isSelected()); + AdempierePLAF.updateUI(this); + } + // Flat + else if (e.getSource() == flatField) + { + Ini.setProperty(Ini.P_UI_FLAT, flatField.isSelected()); + setBackgroundToTheme(); + } + // ColorBlind + else if (e.getSource() == blindField) + { + int sel = blindField.getSelectedIndex(); + if (sel != ColorBlind.getColorType()) + { + // Test for True color + if (!m_colorTest) + { + m_colorTest = true; + int size = Toolkit.getDefaultToolkit().getColorModel().getPixelSize(); + if (size < 24) + JOptionPane.showMessageDialog(this, + "Your environment has only a pixel size of " + size + + ".\nTo see the effect, you need to have a pixel size of 24 (true color)", + "Insufficient Color Capabilities", + JOptionPane.ERROR_MESSAGE); + } + ColorBlind.setColorType(sel); + AdempierePLAF.updateUI(this); + AdempierePLAF.setPLAF(this); // twice (??) + } + } + + + // Change Tab Pacement + else if (e.getSource() == jComboBoxFlat || e.getSource() == jComboBoxGradient + || e.getSource() == jComboBoxTexture || e.getSource() == jComboBoxLines) + { + if (!m_setting) + { + m_setting = true; + int index = ((JComboBox)e.getSource()).getSelectedIndex(); + example.setTabPlacement(index+1); + jComboBoxFlat.setSelectedIndex(index); + jComboBoxGradient.setSelectedIndex(index); + jComboBoxTexture.setSelectedIndex(index); + jComboBoxLines.setSelectedIndex(index); + m_setting = false; + } + } + // Display Options + else if (e.getSource() == jButtonFlat) + JOptionPane.showConfirmDialog(this, "Confirm Dialog"); + else if (e.getSource() == jButtonGardient) + JOptionPane.showInputDialog(this, "Input Dialog"); + else if (e.getSource() == jButtonTexture) + JOptionPane.showMessageDialog(this, "Message Dialog"); + else if (e.getSource() == jButtonLines) + JOptionPane.showMessageDialog(this, "Message Dialog - Error", "Error", JOptionPane.ERROR_MESSAGE); + + // Test + else if (e.getSource() == jButton1) + { + } + + /********************/ + + // Metal + boolean metal = UIManager.getLookAndFeel() instanceof MetalLookAndFeel; + themeField.setEnabled(metal); + themeLabel.setEnabled(metal); + boolean adempiere = UIManager.getLookAndFeel() instanceof CompiereLookAndFeel; + flatField.setEnabled(adempiere); + + // ColorBlind - only with Adempiere L&F & Theme + boolean enableBlind = adempiere + && themeField.getSelectedItem() != null + && themeField.getSelectedItem().toString().indexOf("Adempiere") != -1; + blindField.setEnabled(enableBlind); + blindLabel.setEnabled(enableBlind); + if (e.getSource() != blindField && !enableBlind) + blindField.setSelectedIndex(0); + + // done + setCursor(Cursor.getDefaultCursor()); + } // actionPerformed + + /** + * Set AdempiereColor Background to Theme Background + */ + private void setBackgroundToTheme() + { + // Not flat for Adempiere L&F + boolean flat = Ini.isPropertyBool(Ini.P_UI_FLAT); + AdempiereColor cc = new AdempiereColor(CompiereTheme.secondary3, flat); + AdempierePanelUI.setDefaultBackground(cc); + Ini.setProperty(CompiereTheme.P_AdempiereColor, cc.toString()); + AdempierePLAF.updateUI(this); + } // setBackgroundToTheme + + + /** + * Dispose + * Exit, if there is no real owning parent (not modal) - shortcut + */ + public void dispose() + { + super.dispose(); + if (!isModal()) + System.exit(0); + } // dispose + +} // AdempierePLAFEditor diff --git a/looks/src/org/compiere/plaf/AdempierePanelUI.java b/looks/src/org/compiere/plaf/AdempierePanelUI.java new file mode 100644 index 0000000000..074088f981 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempierePanelUI.java @@ -0,0 +1,177 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; + +/** + * Panel UI. + * The default properties can be set via + *

+ *  AdempierePanelUI.setDefaultBackground (new AdempiereColor());
+ *  
+ * The individual Panel can set the background type by setting the + * parameter via + *
+ *  putClientProperty(AdempierePanelUI.BACKGROUND, new AdempiereColor());
+ *  
+ * @see org.compiere.swing.CPanel + * + * @author Jorg Janke + * @version $Id: AdempierePanelUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempierePanelUI extends BasicPanelUI +{ + /** + * Static Create UI + * @param c Vomponent + * @return Adempiere Panel UI + */ + public static ComponentUI createUI (JComponent c) + { + // return new AdempierePanelUI(); + return s_panelUI; + } // createUI + + /** UI */ + private static AdempierePanelUI s_panelUI = new AdempierePanelUI(); + + + /************************************************************************** + * Install Defaults + * @param p Panel + */ + protected void installDefaults (JPanel p) + { + super.installDefaults(p); + /** If enabled, all windows are with Adempiere Background, + * but Sun dialogs (print ..) are "patchy" as they are opaque ** + // System.out.println ("BG=" + p.getClientProperty(AdempierePLAF.BACKGROUND)); + if (s_setDefault || p.getClientProperty(AdempierePLAF.BACKGROUND) == null) + p.putClientProperty (AdempierePLAF.BACKGROUND, s_default); + /** **/ + } // installDefaults + + + /************************************************************************** + * Update. + * This method is invoked by JComponent when the specified + * component is being painted. + * + * By default this method will fill the specified component with + * its background color (if its opaque property is + * true) and then immediately call paint. + * + * @param g the Graphics context in which to paint + * @param c the component being painted + * + * @see javax.swing.JComponent#paintComponent + */ + public void update (Graphics g, JComponent c) + { + // AdempiereUtils.printParents (c); + if (c.isOpaque()) + updateIt (g, c); + paint (g, c); // does nothing + } // update + + /** + * Print background based on AdempiereColor or flat background if not found + * @param g + * @param c + */ + static void updateIt (Graphics g, JComponent c) + { + // System.out.print("Panel " + c.getName()); + // System.out.print(" Bounds=" + c.getBounds().toString()); + // System.out.print(" - Background: "); + + // Get AdempiereColor + AdempiereColor bg = null; + try + { + bg = (AdempiereColor)c.getClientProperty(AdempierePLAF.BACKGROUND); + } + catch (Exception e) + { + System.err.println("AdempierePanelUI - ClientProperty: " + e.getMessage()); + } + // paint adempiere background + if (bg != null) + { + // System.out.print(bg); + bg.paint (g, c); + } + else + { + // System.out.print(c.getBackground()); + g.setColor(c.getBackground()); + g.fillRect(0,0, c.getWidth(), c.getHeight()); + } + // System.out.println(); + } // updateIt + + /*************************************************************************/ + + /** Default Background */ + private static AdempiereColor s_default = new AdempiereColor(); + /** Set Background to default setting */ + private static boolean s_setDefault = false; + + + /** + * Set Default Background + * @param bg Background Color + */ + public static void setDefaultBackground (AdempiereColor bg) + { + if (bg == null) + return; + s_default.setColor(bg); + } // setBackground + + /** + * Get Default Background + * @return Background + */ + public static AdempiereColor getDefaultBackground() + { + return s_default; + } // getBackground + + /** + * Set Default Background + * @param setDefault if true, the background will be set to the default color + */ + public static void setSetDefault (boolean setDefault) + { + s_setDefault = setDefault; + } // setSetDefault + + /** + * Is the Default Background set by default + * @return true if default background is set + */ + public static boolean isSetDefault() + { + return s_setDefault; + } // isSetDefault + +} // AdempierePanel diff --git a/looks/src/org/compiere/plaf/AdempiereRadioButtonUI.java b/looks/src/org/compiere/plaf/AdempiereRadioButtonUI.java new file mode 100644 index 0000000000..38fdae696c --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereRadioButtonUI.java @@ -0,0 +1,55 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +/** + * Adempiere Radio Button UI + * + * @author Jorg Janke + * @version $Id: AdempiereRadioButtonUI.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class AdempiereRadioButtonUI extends MetalRadioButtonUI +{ + /** + * Create UI + * @param c component + * @return ComponentUI + */ + public static ComponentUI createUI (JComponent c) + { + return s_radioButtonUI; + } // createUI + + /** UI */ + private static final AdempiereRadioButtonUI s_radioButtonUI = new AdempiereRadioButtonUI(); + + + /************************************************************************** + * Install Defaults + * @param b Button + */ + public void installDefaults (AbstractButton b) + { + super.installDefaults(b); + b.setOpaque(false); + } // installDefaults + +} // AdempiereRadioButtonUI diff --git a/looks/src/org/compiere/plaf/AdempiereRootPaneUI.java b/looks/src/org/compiere/plaf/AdempiereRootPaneUI.java new file mode 100644 index 0000000000..bba7b073e6 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereRootPaneUI.java @@ -0,0 +1,33 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import javax.swing.plaf.metal.MetalRootPaneUI; + +/** + * Root Pane UI + * + * @author Jorg Janke + * @version $Id: AdempiereRootPaneUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereRootPaneUI extends MetalRootPaneUI +{ +/** + * MetalTitlePane does the Layout & Painting of the Window including System MenuBar + * The titlePane is private in MetalRootPaneUI + */ +} // AdempiereRootPaneUI diff --git a/looks/src/org/compiere/plaf/AdempiereScrollPaneUI.java b/looks/src/org/compiere/plaf/AdempiereScrollPaneUI.java new file mode 100644 index 0000000000..6b5a619907 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereScrollPaneUI.java @@ -0,0 +1,53 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +/** + * Adempiere Scroll Pane UI + * + * @author Jorg Janke + * @version $Id: AdempiereScrollPaneUI.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class AdempiereScrollPaneUI extends MetalScrollPaneUI +{ + /** + * Create UI (not shared) + * @param x + * @return UI + */ + public static ComponentUI createUI(JComponent x) + { + return new AdempiereScrollPaneUI(); + } // createUI + + /** + * Install UI + * @param c + */ + public void installUI (JComponent c) + { + super.installUI(c); + c.setOpaque(false); + // was ignored as set in constructor after updateUI - Sun bug: 138828 + ((JScrollPane)c).getViewport().setOpaque(false); + } // installUI + +} // AdempiereScrollPaneUI diff --git a/looks/src/org/compiere/plaf/AdempiereSplitPaneDivider.java b/looks/src/org/compiere/plaf/AdempiereSplitPaneDivider.java new file mode 100644 index 0000000000..6ef6f38f96 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereSplitPaneDivider.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import javax.swing.plaf.basic.*; + +/** + * Split Pane Divider + * + * @author Jorg Janke + * @version $Id: AdempiereSplitPaneDivider.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +class AdempiereSplitPaneDivider extends BasicSplitPaneDivider +{ + /** + * Constructor + * @param ui + */ + public AdempiereSplitPaneDivider (BasicSplitPaneUI ui) + { + super (ui); + // BasicBorders$SplitPaneDividerBorder - ignored set after constructor + setBorder(null); + } // AdempiereSplitPaneDivider + + /** + * Paints the divider. + * If the border is painted, it creates a light gray bar on top/button. + * Still, a light gray 1 pt shaddow border is painted on top/button + * @param g + */ + public void paint (Graphics g) + { + // BasicBorders$SplitPaneDividerBorder + setBorder(null); + super.paint(g); + } // paint + +} // AdempiereSplitPaneDivider diff --git a/looks/src/org/compiere/plaf/AdempiereSplitPaneUI.java b/looks/src/org/compiere/plaf/AdempiereSplitPaneUI.java new file mode 100644 index 0000000000..db50024d39 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereSplitPaneUI.java @@ -0,0 +1,68 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; + +/** + * Adempiere Split Pane UI. + * When moving, the divider is painted in darkGray. + * + * @author Jorg Janke + * @version $Id: AdempiereSplitPaneUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereSplitPaneUI extends BasicSplitPaneUI +{ + /** + * Creates a new MetalSplitPaneUI instance + * @param x + * @return ComponentUI + */ + public static ComponentUI createUI (JComponent x) + { + return new AdempiereSplitPaneUI(); + } // createUI + + /** + * Creates the default divider. + * @return SplitPaneDivider + */ + public BasicSplitPaneDivider createDefaultDivider() + { + return new AdempiereSplitPaneDivider (this); + } + + /** + * Installs the UI. + * @param c + */ + public void installUI (JComponent c) + { + super.installUI(c); + c.setOpaque(false); + // BasicBorders$SplitPaneBorder paints gray border + // resulting in a 2pt border for the left/right components + // but results in 1pt gray line on top/button of divider. + // Still, a 1 pt shaddow light gay line is painted + c.setBorder(null); + } // installUI + + + +} // AdempiereSplitPaneUI diff --git a/looks/src/org/compiere/plaf/AdempiereTabbedPaneUI.java b/looks/src/org/compiere/plaf/AdempiereTabbedPaneUI.java new file mode 100644 index 0000000000..de81523b13 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereTabbedPaneUI.java @@ -0,0 +1,1048 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; +import javax.swing.plaf.metal.*; + +/** + * Same implementation detail as in AdempierePanelUI. + * Additional handling of dwawing tabs. + * @see AdempierePanelUI + * + * @author Jorg Janke + * @version $Id: AdempiereTabbedPaneUI.java,v 1.3 2006/07/30 00:52:23 jjanke Exp $ + */ +public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI +{ + /** + * Static Create UI + * @param c Component + * @return Adempiere TabbedPaneUI + */ + public static ComponentUI createUI(JComponent c) + { + return new AdempiereTabbedPaneUI(); + } // createUI + + /** + * Install Defaults + */ + protected void installDefaults() + { + super.installDefaults(); + tabPane.setOpaque(false); + } // installDefaults + + + /************************************************************************* + * Update - + * This method is invoked by JComponent when the specified + * component is being painted. + * + * By default this method will fill the specified component with + * its background color (if its opaque property is + * true) and then immediately call paint. + * + * @param g the Graphics context in which to paint + * @param c the component being painted + * + * @see #paint + * @see javax.swing.JComponent#paintComponent + */ + public void update (Graphics g, JComponent c) + { + /** + System.out.println (c.getClass().getName() + " ** " + c.isOpaque()); + Container container = c.getParent(); + while (container != null) + { + System.out.println (" - " + container.getClass() + " ** " + container.isOpaque() ); + container = container.getParent(); + } + */ + + // System.out.println("Tab: Bounds=" + c.getBounds() + " - " + c.getClass().getName()); + + if (c.isOpaque()) + AdempierePanelUI.updateIt (g, c); // tabAreaBackground + paint (g, c); + } // update + + /** + * Paint it + * @param g graphics + * @param c component + */ + public void paint( Graphics g, JComponent c ) + { + int tabPlacement = tabPane.getTabPlacement(); + Insets insets = c.getInsets(); + Dimension size = c.getSize(); + + if ( tabPane.isOpaque() ) + { + g.setColor(c.getBackground()); + /** @todo Printing of area behind Tabs */ + switch (tabPlacement) + { + case LEFT: + g.fillRect( insets.left, insets.top, + calculateTabAreaWidth( tabPlacement, runCount, maxTabWidth ), + size.height - insets.bottom - insets.top ); + break; + case BOTTOM: + int totalTabHeight = calculateTabAreaHeight( tabPlacement, runCount, maxTabHeight ); + g.fillRect( insets.left, size.height - insets.bottom - totalTabHeight, + size.width - insets.left - insets.right, + totalTabHeight ); + break; + case RIGHT: + int totalTabWidth = calculateTabAreaWidth( tabPlacement, runCount, maxTabWidth ); + g.fillRect( size.width - insets.right - totalTabWidth, + insets.top, totalTabWidth, + size.height - insets.top - insets.bottom ); + break; + // + case TOP: + default: + g.fillRect( insets.left, insets.top, + size.width - insets.right - insets.left, + calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight) ); + paintHighlightBelowTab(); + } + } + else + super.paint( g, c ); + } // paint + + + /************************************************************************** + * Paint the actual Tab Background. + * Called from Basic.PaintTab (<- Basic.paintTabArea <- Basic.paint) + *

+ * Based on MetalTabbedPaneUI.paintTabBackground: + * Differences: + * - Color based on primary Background of Tab + * - Selected Tab is painted + *

+	 *          selected    not sel
+	 *  top     //////////  //////////  (lighter)
+	 *                      ++++++++++  (flat/darker)
+	 *
+	 *  bottom              //////////  (flat/lighter)
+	 *          ++++++++++  ++++++++++  (darker)
+	 *
+	 *  sides               //////////  (flat/ligher)
+	 *                      ++++++++++  (flat/darker)
+	 *  
+ * @param g graphics + * @param tabPlacement tab placement + * @param tabIndex tab index + * @param x x + * @param y y + * @param w width + * @param h height + * @param isSelected selected + */ + protected void paintTabBackground (Graphics g, int tabPlacement, + int tabIndex, int x, int y, int w, int h, boolean isSelected) + { + Graphics2D g2D = (Graphics2D)g; + + + // Get Background color of Tab + Component comp = tabPane.getComponentAt(tabIndex); + // System.out.println("Tab " + tabIndex + " Comp=" + comp.getName() + " " + comp.getClass().getName() + " x=" + x + ", y=" + y + ", w=" +w + ", h=" + h); + g2D.setPaint(comp.getBackground()); + AdempiereColor bg = AdempiereColor.getDefaultBackground(); + if (comp instanceof JPanel) + { + JPanel jp = (JPanel)comp; + try + { + bg = (AdempiereColor)jp.getClientProperty(AdempierePLAF.BACKGROUND); + } + catch (Exception e) + { + System.err.println("AdempiereTabbedPaneUI - ClientProperty: " + e.getMessage()); + } + } + + if (bg == null) // No Background + { + if (AdempiereUtils.isLeftToRight(tabPane)) + { + switch (tabPlacement) + { + case LEFT: + g2D.fillRect( x + 5, y + 1, w - 5, h - 1); + g2D.fillRect( x + 2, y + 4, 3, h - 4 ); + break; + case BOTTOM: + g2D.fillRect( x + 2, y, w - 2, h - 4 ); + g2D.fillRect( x + 5, y + (h - 1) - 3, w - 5, 3 ); + break; + case RIGHT: + g2D.fillRect( x + 1, y + 1, w - 5, h - 1); + g2D.fillRect( x + (w - 1) - 3, y + 5, 3, h - 5 ); + break; + case TOP: + default: + g2D.fillRect( x + 4, y + 2, (w - 1) - 3, (h - 1) - 1 ); + g2D.fillRect( x + 2, y + 5, 2, h - 5 ); + } + } + else + { + switch (tabPlacement) + { + case LEFT: + g2D.fillRect( x + 5, y + 1, w - 5, h - 1); + g2D.fillRect( x + 2, y + 4, 3, h - 4 ); + break; + case BOTTOM: + g2D.fillRect( x, y, w - 5, h - 1 ); + g2D.fillRect( x + (w - 1) - 4, y, 4, h - 5); + g2D.fillRect( x + (w - 1) - 4, y + (h - 1) - 4, 2, 2); + break; + case RIGHT: + g2D.fillRect( x + 1, y + 1, w - 5, h - 1); + g2D.fillRect( x + (w - 1) - 3, y + 5, 3, h - 5 ); + break; + case TOP: + default: + g2D.fillRect( x, y + 2, (w - 1) - 3, (h - 1) - 1 ); + g2D.fillRect( x + (w - 1) - 3, y + 4, 3, h - 4 ); + } + } + } + else // we have a background + { + if (AdempiereUtils.isLeftToRight(tabPane)) + { + switch (tabPlacement) + { + case LEFT: + bg.paintRect (g2D, tabPane, x + 5, y + 1, w - 5, h - 1); + bg.paintRect (g2D, tabPane, x + 2, y + 4, 3, h - 4 ); + break; + case BOTTOM: + bg.paintRect (g2D, tabPane, x + 2, y, w - 2, h - 4 ); + bg.paintRect (g2D, tabPane, x + 5, y + (h - 1) - 3, w - 5, 3 ); + break; + case RIGHT: + // bg.paintRect (g2D, tabPane, x + 1, y + 1, w - 5, h - 1); + bg.paintRect (g2D, tabPane, x, y + 2, w - 4, h - 2); // changed + bg.paintRect (g2D, tabPane, x + (w - 1) - 3, y + 5, 3, h - 5 ); + break; + case TOP: + default: + bg.paintRect (g2D, tabPane, x + 4, y + 2, (w - 1) - 3, (h - 1) - 1 ); + bg.paintRect (g2D, tabPane, x + 2, y + 5, 2, h - 5 ); + } + } + else + { + switch (tabPlacement) + { + case LEFT: + bg.paintRect (g2D, tabPane, x + 5, y + 1, w - 5, h - 1); + bg.paintRect (g2D, tabPane, x + 2, y + 4, 3, h - 4 ); + break; + case BOTTOM: + bg.paintRect (g2D, tabPane, x, y, w - 5, h - 1 ); + bg.paintRect (g2D, tabPane, x + (w - 1) - 4, y, 4, h - 5); + bg.paintRect (g2D, tabPane, x + (w - 1) - 4, y + (h - 1) - 4, 2, 2); + break; + case RIGHT: + bg.paintRect (g2D, tabPane, x + 1, y + 1, w - 5, h - 1); + bg.paintRect (g2D, tabPane, x + (w - 1) - 3, y + 5, 3, h - 5 ); + break; + case TOP: + default: + bg.paintRect (g2D, tabPane, x, y + 2, (w - 1) - 3, (h - 1) - 1 ); + bg.paintRect (g2D, tabPane, x + (w - 1) - 3, y + 4, 3, h - 4 ); + } + } + } + + // Upper Part - not when selected and R/L/B + if (!(isSelected && (tabPlacement == RIGHT || tabPlacement == LEFT || tabPlacement == BOTTOM))) + { + Shape top = new Rectangle (x, y, w, h/2); // upper half + if (tabPlacement == TOP || tabPlacement == LEFT) + top = new Polygon ( // top left triangle + new int[] {x+6, x+w, x+w, x, x }, + new int[] {y, y, y+(h/2), y+(h/2), y+6 }, 5); + else if (tabPlacement == RIGHT) + top = new Polygon ( // top right triangle + new int[] {x, x+w-6, x+w, x+w, x }, + new int[] {y, y, y+6, y+(h/2), y+(h/2) }, 5); + // lighter + GradientPaint paint = new GradientPaint ( + x, y, AdempiereUtils.COL_1TOP, + x, y+(h/2), AdempiereUtils.COL_1END); + g2D.setPaint(paint); + g2D.fill(top); + } + + // Lower part - not when selected and T/R/L + if (!(isSelected && (tabPlacement == TOP || tabPlacement == RIGHT || tabPlacement == LEFT))) + { + Shape end = new Rectangle (x, y+(h/2), w, h/2); // lower half + if (tabPlacement == BOTTOM) + end = new Polygon ( // bottom left triangle + new int[] {x, x+w, x+w, x+6, x }, + new int[] {y+(h/2), y+(h/2), y+h, y+h, y+h-6 }, 5); + // darker + GradientPaint paint = new GradientPaint ( + x, y+(h/2), AdempiereUtils.COL_2TOP, + x, y+h, AdempiereUtils.COL_2END); + g2D.setPaint(paint); + g2D.fill(end); + } + + } // paintTabBackground + + + /************************************************************************** + * Paint Content Border (overwriting BasicTabbedPanelUI) + * Uses Color from actual Tab (not from TabbedPane) + * @param g graphics + * @param tabPlacement tab placement + * @param selectedIndex index + */ + protected void paintContentBorder (Graphics g, int tabPlacement, int selectedIndex) + { + // System.out.println("TabContentBorder " ); + int width = tabPane.getWidth(); + int height = tabPane.getHeight(); + Insets insets = tabPane.getInsets(); + + int x = insets.left; + int y = insets.top; + int w = width - insets.right - insets.left; + int h = height - insets.top - insets.bottom; + + switch (tabPlacement) + { + case LEFT: + x += calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); + w -= (x - insets.left); + break; + case RIGHT: + w -= calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); + break; + case BOTTOM: + h -= calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); + break; + case TOP: + default: + y += calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); + h -= (y - insets.top); + } + + // Fill region behind content area - basically a border + Component comp = null; + if (selectedIndex != -1) + comp = tabPane.getComponentAt(selectedIndex); + if (comp != null && comp instanceof JComponent) + { + JComponent jc = (JComponent)comp; + AdempiereColor bg = null; + try + { + if (jc != null) + bg = (AdempiereColor)jc.getClientProperty(AdempierePLAF.BACKGROUND); + } + catch (Exception e) + { + System.err.println("AdempiereTabbedPaneUI - ClientProperty: " + e.getMessage()); + } + if (bg == null) + { + bg = new AdempiereColor(jc.getBackground()); + jc.putClientProperty(AdempierePLAF.BACKGROUND, bg); + } + bg.paintRect(g, jc, x,y, w,h); + } + // Not a JComponent - paint flat + else if (comp != null) + { + g.setColor(comp.getBackground()); + g.fillRect(x,y, w,h); + } + + paintContentBorderTopEdge(g, tabPlacement, selectedIndex, x, y, w, h); + paintContentBorderLeftEdge(g, tabPlacement, selectedIndex, x, y, w, h); + paintContentBorderBottomEdge(g, tabPlacement, selectedIndex, x, y, w, h); + paintContentBorderRightEdge(g, tabPlacement, selectedIndex, x, y, w, h); + } // paintContentBorder + + /** + * Paint left content border edge + * @param g graphics + * @param tabPlacement tab placement + * @param selectedIndex index + * @param x x + * @param y y + * @param w width + * @param h height + */ + protected void paintContentBorderLeftEdge (Graphics g, int tabPlacement, + int selectedIndex, int x, int y, int w, int h) + { + Rectangle selRect = selectedIndex < 0 ? null : getTabBounds(selectedIndex, calcRect); + g.setColor(selectHighlight); + + // Draw unbroken line if tabs are not on LEFT, OR + // selected tab is not in run adjacent to content, OR + // selected tab is not visible (SCROLL_TAB_LAYOUT) + if (tabPlacement != LEFT || selectedIndex < 0 + || (selRect.x + selRect.width + 1 < x) + || (selRect.y < y || selRect.y > y + h)) + { + g.drawLine(x, y, x, y+h-2); + } + else + { + // Break line to show visual connection to selected tab + g.drawLine(x, y, x, selRect.y + 1); + if (selRect.y + selRect.height < y + h - 2) + g.drawLine(x, selRect.y + selRect.height + 1, x, y+h-2); // bug + } + } + + /** + * Paint bottom content area edge + * @param g graphics + * @param tabPlacement tab placement + * @param selectedIndex index + * @param x x + * @param y y + * @param w width + * @param h height + */ + protected void paintContentBorderBottomEdge (Graphics g, int tabPlacement, + int selectedIndex, int x, int y, int w, int h) + { + boolean leftToRight = AdempiereUtils.isLeftToRight(tabPane); + int bottom = y + h - 1; + int right = x + w - 1; + Rectangle selRect = selectedIndex < 0 ? null : getTabBounds(selectedIndex, calcRect); + g.setColor(shadow); + + // Draw unbroken line if tabs are not on BOTTOM, OR + // selected tab is not in run adjacent to content, OR + // selected tab is not visible (SCROLL_TAB_LAYOUT) + if (tabPlacement != BOTTOM + || selectedIndex < 0 +// || (selRect.y - 1 > h) // bug!! + || (selRect.x < x || selRect.x > x + w)) + { + g.setColor(darkShadow); + g.drawLine(x, y+h-1, x+w-1, y+h-1); + } + else + { + // Break line to show visual connection to selected tab + boolean lastInRun = isLastInRun(selectedIndex); + g.setColor(darkShadow); + if ( leftToRight || lastInRun ) + g.drawLine(x, bottom, selRect.x, bottom); + else + g.drawLine(x, bottom, selRect.x - 1, bottom); + + if (selRect.x + selRect.width < x + w - 2) + { + if ( leftToRight && !lastInRun ) + g.drawLine(selRect.x + selRect.width, bottom, right, bottom); + else + g.drawLine(selRect.x + selRect.width - 1, bottom, right, bottom); + } + } + } // paintContentBorderBottomEdge + + /** + * Paint right Contenr border edge + * @param g graphics + * @param tabPlacement tab placement + * @param selectedIndex index + * @param x x + * @param y y + * @param w width + * @param h height + */ + protected void paintContentBorderRightEdge (Graphics g, int tabPlacement, + int selectedIndex, int x, int y, int w, int h) + { + Rectangle selRect = selectedIndex < 0 ? null : getTabBounds(selectedIndex, calcRect); + g.setColor(shadow); + + // Draw unbroken line if tabs are not on RIGHT, OR + // selected tab is not in run adjacent to content, OR + // selected tab is not visible (SCROLL_TAB_LAYOUT) + if (tabPlacement != RIGHT + || selectedIndex < 0 +// || (selRect.x - 1 > w) // bug !! + || (selRect.y < y || selRect.y > y + h) + ) + { + g.setColor(darkShadow); + g.drawLine(x+w-1, y, x+w-1, y+h-1); + } + else + { + // Break line to show visual connection to selected tab + g.setColor(darkShadow); + g.drawLine(x+w-1, y, x+w-1, selRect.y); + if (selRect.y + selRect.height < y + h - 2) + { + g.setColor(darkShadow); + g.drawLine(x+w-1, selRect.y + selRect.height, x+w-1, y+h-2); + } + } + } // paintContentBorderRightEdge + + /** + * Is Last Run + * @param tabIndex index + * @return true if last tab run + */ + private boolean isLastInRun (int tabIndex) + { + int run = getRunForTab( tabPane.getTabCount(), tabIndex ); + int lastIndex = lastTabInRun( tabPane.getTabCount(), run ); + return tabIndex == lastIndex; + } // isLastRun + + + /************************************************************************** + * Fill Tab gap triangle (no) + * @param currentRun current run + * @param tabIndex tab index + * @param x x + * @param y y + * @return false + */ + protected boolean shouldFillGap (int currentRun, int tabIndex, int x, int y) + { + return false; + } // shouldFillGap + + /** + * Paint Top Tab Border + * @param tabIndex index + * @param g graphics + * @param x x + * @param y y + * @param w width + * @param h height + * @param btm bottom + * @param rght right + * @param isSelected selected + */ + protected void paintTopTabBorder ( int tabIndex, Graphics g, + int x, int y, int w, int h, int btm, int rght, boolean isSelected ) + { + int currentRun = getRunForTab( tabPane.getTabCount(), tabIndex ); + int lastIndex = lastTabInRun( tabPane.getTabCount(), currentRun ); + int firstIndex = tabRuns[ currentRun ]; + boolean leftToRight = AdempiereUtils.isLeftToRight(tabPane); + int bottom = h - 1; + int right = w - 1; + + // ** Paint Gap ** + if ( shouldFillGap( currentRun, tabIndex, x, y ) ) + { + g.translate( x, y ); + if ( leftToRight ) + { + g.setColor( getColorForGap( currentRun, x, y + 1 ) ); + g.fillRect( 1, 0, 5, 3 ); + g.fillRect( 1, 3, 2, 2 ); + } + else + { + g.setColor( getColorForGap( currentRun, x + w - 1, y + 1 ) ); + g.fillRect( right - 5, 0, 5, 3 ); + g.fillRect( right - 2, 3, 2, 2 ); + } + g.translate( -x, -y ); + } + + g.translate( x, y ); + // ** Paint Border ** + g.setColor( darkShadow ); + if (leftToRight) + { + // Paint slant + g.drawLine( 1, 5, 6, 0 ); + // Paint top + g.drawLine( 6, 0, right, 0 ); + // Paint right + if ( tabIndex==lastIndex ) // last tab in run + g.drawLine( right, 1, right, bottom ); + // Paint left + if ( tabIndex != tabRuns[ runCount - 1 ] ) // not the first tab in the last run + g.drawLine( 0, 0, 0, bottom ); + else // the first tab in the last run + g.drawLine( 0, 6, 0, bottom ); + } + else + { + // Paint slant + g.drawLine( right - 1, 5, right - 6, 0 ); + // Paint top + g.drawLine( right - 6, 0, 0, 0 ); + // Paint right + if ( tabIndex != tabRuns[ runCount - 1 ] ) // not the first tab in the last run + g.drawLine( right, 0, right, bottom ); + else // the first tab in the last run + g.drawLine( right, 6, right, bottom ); + // Paint left + if ( tabIndex==lastIndex ) // last tab in run + g.drawLine( 0, 1, 0, bottom ); + } + + // Paint button + if (!isSelected) + g.drawLine(0, bottom, right, bottom); // added + + // ** Paint Highlight ** + g.setColor( isSelected ? selectHighlight : highlight ); + if ( leftToRight ) + { + // Paint slant + g.drawLine( 1, 6, 6, 1 ); + // Paint top + if (tabIndex == lastIndex) + g.drawLine( 6, 1, right-1, 1 ); + else + g.drawLine( 6, 1, right, 1 ); // bug !! + // Paint left + g.drawLine( 1, 6, 1, bottom ); + + // paint highlight in the gap on tab behind this one + // on the left end (where they all line up) + if ( tabIndex==firstIndex && tabIndex!=tabRuns[runCount - 1] ) + { + // first tab in run but not first tab in last run + if (tabPane.getSelectedIndex()==tabRuns[currentRun+1]) + { + // tab in front of selected tab + g.setColor( selectHighlight ); + } + else + { + // tab in front of normal tab + g.setColor( highlight ); + } + g.drawLine( 1, 0, 1, 4 ); + } + } + else + { + // Paint slant + g.drawLine( right - 1, 6, right - 6, 1 ); + // Paint top + g.drawLine( right - 6, 1, 1, 1 ); + + // Paint left + if ( tabIndex==lastIndex ) // last tab in run + g.drawLine( 1, 1, 1, bottom ); + else + g.drawLine( 0, 1, 0, bottom ); + } + g.translate( -x, -y ); + } // paintTopTabBorder + + /** + * Paint Border of Left Tab. + * Does not fill triangle + * + * @param tabIndex index + * @param g graphics + * @param x x + * @param y y + * @param w width + * @param h height + * @param btm bottom + * @param rght right + * @param isSelected selected + */ + protected void paintLeftTabBorder (int tabIndex, Graphics g, + int x, int y, int w, int h, int btm, int rght, boolean isSelected) + { + int tabCount = tabPane.getTabCount(); + int currentRun = getRunForTab( tabCount, tabIndex ); + int lastIndex = lastTabInRun( tabCount, currentRun ); + int firstIndex = tabRuns[ currentRun ]; + + g.translate( x, y ); + + int bottom = h - 1; + int right = w - 1; + + // ** Paint Highlight ** + g.setColor( isSelected ? selectHighlight : highlight ); + // Paint slant + g.drawLine( 1, 6, 6, 1 ); + // Paint top + g.drawLine( 6, 1, right, 1 ); + // Paint left + g.drawLine( 1, 6, 1, bottom ); + // Paint right + if (!isSelected) + g.drawLine(right-1, 0, right-1, bottom ); + + // ** Paint Border ** + g.setColor( darkShadow ); + // Paint slant + g.drawLine( 1, 5, 6, 0 ); + // Paint top + g.drawLine( 6, 0, right, 0 ); + // Paint left + g.drawLine( 0, 6, 0, bottom ); + // Paint bottom + g.drawLine( 0, bottom, right, bottom ); + // Paint right + if (!isSelected) + g.drawLine(right, 0, right, bottom ); + // + g.translate( -x, -y ); + } // paintLeftTabBorder + + + /** + * Paint Border of Right Tab. + * Does not fill triangle + * + * @param tabIndex index + * @param g graphics + * @param x x + * @param y y + * @param w width + * @param h height + * @param btm bottom + * @param rght right + * @param isSelected selected + */ + protected void paintRightTabBorder (int tabIndex, Graphics g, + int x, int y, int w, int h, int btm, int rght, boolean isSelected) + { + int tabCount = tabPane.getTabCount(); + int currentRun = getRunForTab( tabCount, tabIndex ); + int lastIndex = lastTabInRun( tabCount, currentRun ); + int firstIndex = tabRuns[ currentRun ]; + + g.translate( x, y ); + + int bottom = h - 1; + int right = w - 1; + + // ** Paint Highlight ** + g.setColor( isSelected ? selectHighlight : highlight ); + // Paint slant + g.drawLine (right-6, 1, right-1, 6 ); + // Paint top + g.drawLine (0, 1, right - 6, 1 ); + // Paint right + g.drawLine (right-1, 6, right-1, bottom-1); + // Paint left + if (!isSelected) + g.drawLine (0, 1, 0, bottom-1); + + // ** Paint Border ** + g.setColor( darkShadow ); + // Paint slant + g.drawLine (right - 6, 0, right, 6 ); + // Paint top + g.drawLine (0, 0, right - 6, 0 ); + // Paint right + g.drawLine (right, 6, right, bottom ); + // Paint bottom + g.drawLine( 0, bottom, right, bottom ); + + g.translate( -x, -y ); + } // paintRightTabBorder + + + /************************************************************************** + * Calculate Tab Width. + * We may have to overwrite to adjust width for TabHirarchyLevel + * @param tabPlacement tab placement + * @param tabIndex tab index + * @param metrics metcics + * @return tab width + */ + protected int calculateTabWidth (int tabPlacement, int tabIndex, FontMetrics metrics) + { + boolean calculate = !(tabPlacement == TOP || tabPlacement == BOTTOM); + // HTML + if (getTextViewForTab(tabIndex) != null) + calculate = false; + // No spaces in title + String title = tabPane.getTitleAt(tabIndex); + int pos = title.indexOf(" "); + if (calculate && pos == -1) + calculate = false; + if (!calculate) + return super.calculateTabWidth (tabPlacement, tabIndex, metrics); + // + Icon icon = getIconForTab(tabIndex); + Insets tabInsetsLocal = getTabInsets(tabPlacement, tabIndex); + int width = tabInsetsLocal.left + tabInsetsLocal.right + 3; + + if (icon != null) + width += icon.getIconWidth() + textIconGap; + + String firstLine = title.substring(0, pos); + String secondLine = title.substring(pos+1); + width += Math.max(SwingUtilities.computeStringWidth (metrics, firstLine), + SwingUtilities.computeStringWidth (metrics, secondLine)); + return width; + } // calculateTabWidth + + /** + * Calculate TabHeight + * @param tabPlacement tab placement + * @param tabIndex tab index + * @param fontHeight font height + * @return tab height + */ + protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) + { + boolean calculate = !(tabPlacement == TOP || tabPlacement == BOTTOM); + // HTML + if (getTextViewForTab(tabIndex) != null) + calculate = false; + // No spaces in title + String title = tabPane.getTitleAt(tabIndex); + int pos = title.indexOf(" "); + if (calculate && pos == -1) + calculate = false; + if (!calculate) + return super.calculateTabHeight (tabPlacement, tabIndex, fontHeight); + // + int height = fontHeight * 2; + Icon icon = getIconForTab(tabIndex); + Insets tabInsetsLocal = getTabInsets(tabPlacement, tabIndex); + if (icon != null) + height = Math.max(height, icon.getIconHeight()); + height += tabInsetsLocal.top + tabInsetsLocal.bottom + 2; + return height; + } + + /** + * Layout Label + * @param tabPlacement tab placement + * @param metrics fint metrics + * @param tabIndex tab index + * @param title title + * @param icon icon + * @param tabRect tab bounds + * @param iconRect icon bounds + * @param textRect text bounds + * @param isSelected selected + */ + protected void layoutLabel(int tabPlacement, + FontMetrics metrics, int tabIndex, String title, Icon icon, + Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected) + { + boolean calculate = !(tabPlacement == TOP || tabPlacement == BOTTOM); + // HTML + if (getTextViewForTab(tabIndex) != null) + calculate = false; + if (!calculate) + { + super.layoutLabel (tabPlacement, metrics, tabIndex, title, icon, + tabRect, iconRect, textRect, isSelected); + // System.out.println("1.tabRect=" + tabRect + " - textRect=" + textRect + " - " + title); + return; + } + // + textRect.x = textRect.y = iconRect.x = iconRect.y = 0; + SwingUtilities.layoutCompoundLabel(tabPane, + metrics, title, icon, + SwingUtilities.TOP, // vert + SwingUtilities.LEFT, // horiz + SwingUtilities.CENTER, // vert Text + SwingUtilities.TRAILING, // horiz Text + tabRect, + iconRect, + textRect, + textIconGap); + tabPane.putClientProperty("html", null); + int xNudge = getTabLabelShiftX(tabPlacement, tabIndex, isSelected); + int yNudge = getTabLabelShiftY(tabPlacement, tabIndex, isSelected); + // positioned top left - add gap + Insets tabInsetsLocal = getTabInsets(tabPlacement, tabIndex); + xNudge += tabInsetsLocal.left; + yNudge += tabInsetsLocal.top + 1; + iconRect.x += xNudge; + iconRect.y += yNudge; + textRect.x += xNudge; + textRect.y += yNudge; + // System.out.println("2.tabRect=" + tabRect + " - textRect=" + textRect + " - " + title); + } + + /** + * Paint Tab + * @param g graphics + * @param tabPlacement tab placement + * @param font font + * @param metrics font metrics + * @param tabIndex tab index + * @param title title + * @param textRect text bounds + * @param isSelected selected + */ + protected void paintText (Graphics g, int tabPlacement, + Font font, FontMetrics metrics, int tabIndex, + String title, Rectangle textRect, boolean isSelected) + { + boolean calculate = !(tabPlacement == TOP || tabPlacement == BOTTOM); + // HTML + if (getTextViewForTab(tabIndex) != null) + calculate = false; + if (!calculate) + { + super.paintText (g, tabPlacement, font, metrics, tabIndex, + title, textRect, isSelected); + return; + } + + // System.out.println("3.textRect " + textRect + " - " + title); + String firstLine = title; + String secondLine = null; + int pos = title.indexOf(' '); + if (pos != -1) + { + firstLine = title.substring(0, pos); + secondLine = title.substring(pos+1); + } + + g.setFont(font); + int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex); + if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex)) + { + Color c = tabPane.getForegroundAt(tabIndex); + if (!isSelected) + { + if (c.equals(Color.black)) + c = Color.darkGray; + else + c = c.brighter(); + } + g.setColor(c); + // first line + BasicGraphicsUtils.drawStringUnderlineCharAt + (g, firstLine, mnemIndex, textRect.x, textRect.y + metrics.getAscent()); + // secondLine + if (secondLine != null) + BasicGraphicsUtils.drawStringUnderlineCharAt + (g, secondLine, mnemIndex-firstLine.length(), + textRect.x, textRect.y + metrics.getAscent() + metrics.getHeight()); + } + else + { // tab disabled + g.setColor(tabPane.getBackgroundAt(tabIndex).brighter()); + BasicGraphicsUtils.drawStringUnderlineCharAt + (g, firstLine, mnemIndex, textRect.x, textRect.y + metrics.getAscent()); + // secondLine + if (secondLine != null) + BasicGraphicsUtils.drawStringUnderlineCharAt + (g, secondLine, mnemIndex-firstLine.length(), + textRect.x, textRect.y + metrics.getAscent() + metrics.getHeight()); + // + g.setColor(tabPane.getBackgroundAt(tabIndex).darker()); + BasicGraphicsUtils.drawStringUnderlineCharAt + (g, firstLine, mnemIndex, textRect.x -1, textRect.y + metrics.getAscent() -1); + // secondLine + if (secondLine != null) + BasicGraphicsUtils.drawStringUnderlineCharAt + (g, secondLine, mnemIndex-firstLine.length(), + textRect.x -1, textRect.y + metrics.getAscent() + metrics.getHeight() -1); + } + } // paintText + + + /************************************************************************** + * Create Layout Manager to size & position tabs + * @return Layout Manager + */ + protected LayoutManager createLayoutManager() + { + return new TabbedPaneLayout(); + } // createLayoutManager + + /** + * Layout Manager to overwrite TabRect size + */ + public class TabbedPaneLayout extends MetalTabbedPaneUI.TabbedPaneLayout + { + /** + * Calculate Tab Rectangle Size + * @param tabPlacement tab placement + * @param tabCount no of tabs + */ + protected void calculateTabRects(int tabPlacement, int tabCount) + { + super.calculateTabRects(tabPlacement, tabCount); + if (tabPlacement == TOP || tabPlacement == BOTTOM) + return; + // System.out.println("calculateTabRects " + tabCount); + int tabHeight = calculateMaxTabHeight(tabPlacement); + for (int i = 0; i < rects.length; i++) + { + int level = 0; + Component comp = tabPane.getComponentAt(i); + if (comp instanceof JComponent) + { + JComponent jc = (JComponent)comp; + try + { + Integer ll = (Integer)jc.getClientProperty(AdempierePLAF.TABLEVEL); + if (ll != null) + level = ll.intValue(); + } + catch (Exception e) + { + System.err.println("AdempiereTabbedPaneUI - ClientProperty: " + e.getMessage()); + } + } + if (level != 0) + { + if (tabPlacement == LEFT) + rects[i].x += level * 5; + rects[i].width -= level * 5; + } + // Height + rects[i].height = tabHeight; + if (i > 0) + rects[i].y = rects[i-1].y + tabHeight; // rects[i-1].height; + } // for all rects + } // calculate TabRects + + } // TabbedPaneLayout + +} // AdempiereTabbedPaneUI diff --git a/looks/src/org/compiere/plaf/AdempiereTableHeaderUI.java b/looks/src/org/compiere/plaf/AdempiereTableHeaderUI.java new file mode 100644 index 0000000000..8d4d61ab52 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereTableHeaderUI.java @@ -0,0 +1,95 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.Graphics; +import java.awt.Graphics2D; + +import javax.swing.JComponent; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.basic.BasicTableHeaderUI; + +/** + * Table Header UI + * 3D effect + * + * @author Jorg Janke + * @version $Id: AdempiereTableHeaderUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereTableHeaderUI extends BasicTableHeaderUI +{ + /** + * Static Create UI + * @param c Component + * @return Adempiere TableHeader UI + */ + public static ComponentUI createUI(JComponent c) + { + return new AdempiereTableHeaderUI(); + } // createUI + + + /** + * Install UI - set not Opaque + * @param c + */ + public void installUI(JComponent c) + { + super.installUI(c); + // TableHeader is in JViewpoiunt, which is Opaque + // When UI created, TableHeader not added to viewpoint + c.setOpaque(true); + c.putClientProperty(AdempierePLAF.BACKGROUND_FILL, "Y"); + } // installUI + + + /************************************************************************** + * Update - + * This method is invoked by JComponent when the specified + * component is being painted. + * + * By default this method will fill the specified component with + * its background color (if its opaque property is + * true) and then immediately call paint. + * + * @param g the Graphics context in which to paint + * @param c the component being painted + * + * @see #paint + * @see javax.swing.JComponent#paintComponent + */ + public void update(Graphics g, JComponent c) + { + // AdempiereUtils.printParents (c); // Parent is JViewpoint + if (c.isOpaque()) // flat + AdempiereUtils.fillRectange((Graphics2D)g, c, CompiereLookAndFeel.ROUND); + // + paint (g, c); + } // update + + /** + * Paint 3D box + * @param g + * @param c + */ + public void paint(Graphics g, JComponent c) + { + super.paint( g, c); + AdempiereUtils.paint3Deffect((Graphics2D)g, c, CompiereLookAndFeel.ROUND, true); + } // paint + +} // AdempiereTableHeader diff --git a/looks/src/org/compiere/plaf/AdempiereTextAreaUI.java b/looks/src/org/compiere/plaf/AdempiereTextAreaUI.java new file mode 100644 index 0000000000..e5aad468c0 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereTextAreaUI.java @@ -0,0 +1,109 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import java.awt.event.*; +import java.beans.*; +import java.util.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; +import javax.swing.text.*; + + +public class AdempiereTextAreaUI extends BasicTextAreaUI +{ + /** + * Creates a UI for a JTextArea. + * Tab is the normal focus traversal key - to enter Tab enter Ctrl-Tab + * + * @param ta a text area + * @return the UI + */ + public static ComponentUI createUI(JComponent ta) + { + return new AdempiereTextAreaUI(ta); + } + + /** + * Constructor + * @param ta text area + */ + public AdempiereTextAreaUI (JComponent ta) + { + if (ta instanceof JTextComponent) + m_editor = (JTextComponent)ta; + } // AdempiereTextAreaUI + + /** The Editor */ + private JTextComponent m_editor = null; + /** Tab Stroke */ + private static KeyStroke s_stroke = KeyStroke.getKeyStroke (KeyEvent.VK_TAB, InputEvent.CTRL_MASK); + /** Tab Action */ + private static Action s_action = new DefaultEditorKit.InsertTabAction(); + + /** + * Create Keymap + * @return key Map + */ + protected Keymap createKeymap () + { + Keymap map = super.createKeymap (); + map.addActionForKeyStroke(s_stroke, s_action); + return map; + } // createKeyMap + + /** + * Property Change + * @param evt event + */ + protected void propertyChange (PropertyChangeEvent evt) + { + String name = evt.getPropertyName(); + if ("editable".equals(name)) + updateFocusTraversalKeysX(); + else + super.propertyChange (evt); + } // propertyChange + + /** + * UpdateFocusTraversalKeysX + */ + void updateFocusTraversalKeysX () + { + if (m_editor == null) + return; + // + EditorKit editorKit = getEditorKit (m_editor); + if (editorKit != null && editorKit instanceof DefaultEditorKit) + { + Set storedForwardTraversalKeys = m_editor.getFocusTraversalKeys (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); + Set storedBackwardTraversalKeys = m_editor.getFocusTraversalKeys (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); + Set forwardTraversalKeys = new HashSet(storedForwardTraversalKeys); + Set backwardTraversalKeys = new HashSet(storedBackwardTraversalKeys); + // + forwardTraversalKeys.add (KeyStroke.getKeyStroke (KeyEvent.VK_TAB, 0)); + forwardTraversalKeys.remove(s_stroke); + backwardTraversalKeys.add (KeyStroke.getKeyStroke (KeyEvent.VK_TAB, InputEvent.SHIFT_MASK)); + // + LookAndFeel.installProperty (m_editor, "focusTraversalKeysForward", forwardTraversalKeys); + LookAndFeel.installProperty (m_editor, "focusTraversalKeysBackward", backwardTraversalKeys); + } + } // updateFocusTraversalKeysX + +} // AdempiereTextAreaUI diff --git a/looks/src/org/compiere/plaf/AdempiereThemeEditor.java b/looks/src/org/compiere/plaf/AdempiereThemeEditor.java new file mode 100644 index 0000000000..dbf6317f09 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereThemeEditor.java @@ -0,0 +1,416 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; + +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +import org.compiere.swing.*; + +/** + * Java Theme Editor. + * Edit the attributes and save them in Ini.properties. + * Does not set background of AdempiereColorUI. + * + * @author Jorg Janke + * @version $Id: AdempiereThemeEditor.java,v 1.3 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereThemeEditor extends CDialog + implements ActionListener +{ + /** + * Constructor + * @param owner Frame owner + */ + public AdempiereThemeEditor (JDialog owner) + { + super(owner, s_res.getString("AdempiereThemeEditor"), true); + try + { + jbInit(); + loadTheme(); + dynInit(); + AdempierePLAF.showCenterScreen(this); + } + catch(Exception e) + { + System.err.println("AdempiereThemeEditor"); + e.printStackTrace(); + } + } // AdempiereThemeEditor + + static ResourceBundle s_res = ResourceBundle.getBundle("org.compiere.plaf.PlafRes"); + + private CButton primary1 = new CButton(); + private CButton primary2 = new CButton(); + private CButton primary3 = new CButton(); + private CButton secondary1 = new CButton(); + private CButton secondary2 = new CButton(); + private CButton secondary3 = new CButton(); + private CButton controlFont = new CButton(); + private CButton systemFont = new CButton(); + private CButton userFont = new CButton(); + private CButton smallFont = new CButton(); + private CButton mandatory = new CButton(); + private CButton error = new CButton(); + private CButton windowFont = new CButton(); + private CButton menuFont = new CButton(); + private CButton white = new CButton(); + private CButton black = new CButton(); + private CPanel confirmPanel = new CPanel(); + + private CButton inactive = new CButton(); + private CButton txt_ok = new CButton(); + private CButton txt_error = new CButton(); + private CButton bCancel = AdempierePLAF.getCancelButton(); + private CButton bOK = AdempierePLAF.getOKButton(); + private FlowLayout confirmLayout = new FlowLayout(); + private CPanel centerPanel = new CPanel(); + private CPanel metalColorPanel = new CPanel(); + private BorderLayout centerLayout = new BorderLayout(); + private CPanel adempiereColorPanel = new CPanel(); + private TitledBorder metalColorBorder; + private TitledBorder adempiereColorBorder; + private GridLayout metalColorLayout = new GridLayout(); + private GridLayout adempiereColorLayout = new GridLayout(); + private CPanel fontPanel = new CPanel(); + private GridLayout fontLayout = new GridLayout(); + private TitledBorder fontBorder; + private CButton info = new CButton(); + + /** + * Static Init + * @throws Exception + */ + private void jbInit() throws Exception + { + metalColorBorder = new TitledBorder(s_res.getString("MetalColors")); + adempiereColorBorder = new TitledBorder(s_res.getString("AdempiereColors")); + fontBorder = new TitledBorder(s_res.getString("AdempiereFonts")); + fontPanel.setBorder(fontBorder); + fontPanel.setOpaque(false); + + this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + // + primary1.setToolTipText(s_res.getString("Primary1Info")); + primary1.setText(s_res.getString("Primary1")); + primary1.addActionListener(this); + primary2.setToolTipText(s_res.getString("Primary2Info")); + primary2.setText(s_res.getString("Primary2")); + primary2.addActionListener(this); + primary3.setToolTipText(s_res.getString("Primary3Info")); + primary3.setText(s_res.getString("Primary3")); + primary3.addActionListener(this); + secondary1.setToolTipText(s_res.getString("Secondary1Info")); + secondary1.setText(s_res.getString("Secondary1")); + secondary1.addActionListener(this); + secondary2.setToolTipText(s_res.getString("Secondary2Info")); + secondary2.setText(s_res.getString("Secondary2")); + secondary2.addActionListener(this); + secondary3.setToolTipText(s_res.getString("Secondary3Info")); + secondary3.setText(s_res.getString("Secondary3")); + secondary3.addActionListener(this); + controlFont.setToolTipText(s_res.getString("ControlFontInfo")); + controlFont.setText(s_res.getString("ControlFont")); + controlFont.addActionListener(this); + systemFont.setToolTipText(s_res.getString("SystemFontInfo")); + systemFont.setText(s_res.getString("SystemFont")); + systemFont.addActionListener(this); + userFont.setToolTipText(s_res.getString("UserFontInfo")); + userFont.setText(s_res.getString("UserFont")); + userFont.addActionListener(this); + smallFont.setText(s_res.getString("SmallFont")); + smallFont.addActionListener(this); + mandatory.setToolTipText(s_res.getString("MandatoryInfo")); + mandatory.setText(s_res.getString("Mandatory")); + mandatory.addActionListener(this); + error.setToolTipText(s_res.getString("ErrorInfo")); + error.setText(s_res.getString("Error")); + error.addActionListener(this); + info.setToolTipText(s_res.getString("InfoInfo")); + info.setText(s_res.getString("Info")); + info.addActionListener(this); + windowFont.setText(s_res.getString("WindowTitleFont")); + windowFont.addActionListener(this); + menuFont.setText(s_res.getString("MenuFont")); + menuFont.addActionListener(this); + white.setToolTipText(s_res.getString("WhiteInfo")); + white.setText(s_res.getString("White")); + white.addActionListener(this); + black.setToolTipText(s_res.getString("BlackInfo")); + black.setText(s_res.getString("Black")); + black.addActionListener(this); + inactive.setToolTipText(s_res.getString("InactiveInfo")); + inactive.setText(s_res.getString("Inactive")); + inactive.addActionListener(this); + txt_ok.setToolTipText(s_res.getString("TextOKInfo")); + txt_ok.setText(s_res.getString("TextOK")); + txt_ok.addActionListener(this); + txt_error.setToolTipText(s_res.getString("TextIssueInfo")); + txt_error.setText(s_res.getString("TextIssue")); + txt_error.addActionListener(this); + // + confirmPanel.setLayout(confirmLayout); + confirmLayout.setAlignment(FlowLayout.RIGHT); + centerPanel.setLayout(centerLayout); + metalColorPanel.setBorder(metalColorBorder); + metalColorPanel.setOpaque(false); + metalColorPanel.setLayout(metalColorLayout); + adempiereColorPanel.setLayout(adempiereColorLayout); + adempiereColorPanel.setBorder(adempiereColorBorder); + adempiereColorPanel.setOpaque(false); + metalColorLayout.setColumns(3); + metalColorLayout.setHgap(5); + metalColorLayout.setRows(3); + metalColorLayout.setVgap(5); + adempiereColorLayout.setColumns(4); + adempiereColorLayout.setHgap(5); + adempiereColorLayout.setRows(2); + adempiereColorLayout.setVgap(5); + fontPanel.setLayout(fontLayout); + fontLayout.setColumns(3); + fontLayout.setHgap(5); + fontLayout.setRows(2); + fontLayout.setVgap(5); + centerLayout.setVgap(5); + fontBorder.setTitle(s_res.getString("Fonts")); + confirmPanel.setOpaque(false); + this.getContentPane().add(confirmPanel, BorderLayout.SOUTH); + confirmPanel.add(bCancel, null); + confirmPanel.add(bOK, null); + this.getContentPane().add(centerPanel, BorderLayout.CENTER); + centerPanel.add(metalColorPanel, BorderLayout.NORTH); + metalColorPanel.add(primary1, null); + metalColorPanel.add(primary2, null); + metalColorPanel.add(primary3, null); + metalColorPanel.add(secondary1, null); + metalColorPanel.add(secondary2, null); + metalColorPanel.add(secondary3, null); + metalColorPanel.add(white, null); + metalColorPanel.add(black, null); + centerPanel.add(adempiereColorPanel, BorderLayout.CENTER); + adempiereColorPanel.add(txt_error, null); + centerPanel.add(fontPanel, BorderLayout.SOUTH); + fontPanel.add(controlFont, null); + fontPanel.add(systemFont, null); + fontPanel.add(menuFont, null); + fontPanel.add(userFont, null); + fontPanel.add(windowFont, null); + fontPanel.add(smallFont, null); + adempiereColorPanel.add(error, null); + adempiereColorPanel.add(inactive, null); + adempiereColorPanel.add(txt_ok, null); + adempiereColorPanel.add(mandatory, null); + adempiereColorPanel.add(info, null); + bCancel.addActionListener(this); + bOK.addActionListener(this); + } // jbInit + + /** + * Load Theme from current Setting (if MetalLookAndFeel) + */ + private void loadTheme() + { + if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) + { + // AdempiereTheme.setTheme(); + } + else // Not a Metal Theme + { + primary1.setEnabled(false); + primary2.setEnabled(false); + primary3.setEnabled(false); + secondary1.setEnabled(false); + secondary2.setEnabled(false); + secondary3.setEnabled(false); + } + } // loadTheme + + /** + * Dynamic Init + */ + private void dynInit() + { + // Colors + primary1.setBackground(CompiereTheme.primary1); + primary2.setBackground(CompiereTheme.primary2); + primary3.setBackground(CompiereTheme.primary3); + secondary1.setBackground(CompiereTheme.secondary1); + secondary2.setBackground(CompiereTheme.secondary2); + secondary3.setBackground(CompiereTheme.secondary3); + // + white.setBackground(CompiereTheme.white); + black.setBackground(CompiereTheme.secondary3); + black.setForeground(CompiereTheme.black); + // + error.setBackground(CompiereTheme.error); + mandatory.setBackground(CompiereTheme.mandatory); + inactive.setBackground(CompiereTheme.inactive); + info.setBackground(CompiereTheme.info); + // + txt_ok.setBackground(CompiereTheme.white); + txt_ok.setForeground(CompiereTheme.txt_ok); + txt_error.setBackground(CompiereTheme.white); // AdempierePLAF.getFieldBackground_Normal() + txt_error.setForeground(CompiereTheme.txt_error); + + // Fonts + controlFont.setFont(CompiereTheme.controlFont); + systemFont.setFont(CompiereTheme.systemFont); + userFont.setFont(CompiereTheme.userFont); + smallFont.setFont(CompiereTheme.smallFont); + menuFont.setFont(CompiereTheme.menuFont); + windowFont.setFont(CompiereTheme.windowFont); + } // dynInit + + /** + * Action Listener + * @param e + */ + public void actionPerformed(ActionEvent e) + { + // Confirm + if (e.getSource() == bOK) + { + CompiereTheme.save(); + dispose(); + return; + } + // Cancel + else if (e.getSource() == bCancel) + { + dispose(); + return; + } + + try { // to capture errors when Cancel in JColorChooser + + if (e.getSource() == primary1) + { + CompiereTheme.primary1 = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("Primary1"), CompiereTheme.primary1)); + } + else if (e.getSource() == primary2) + { + CompiereTheme.primary2 = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("Primary2"), CompiereTheme.primary2)); + } + else if (e.getSource() == primary3) + { + CompiereTheme.primary3 = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("Primary3"), CompiereTheme.primary3)); + } + else if (e.getSource() == secondary1) + { + CompiereTheme.secondary1 = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("Secondary1"), CompiereTheme.secondary1)); + } + else if (e.getSource() == secondary2) + { + CompiereTheme.secondary2 = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("Secondary2"), CompiereTheme.secondary2)); + } + else if (e.getSource() == secondary3) + { + CompiereTheme.secondary3 = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("Secondary3"), CompiereTheme.secondary3)); + } + + else if (e.getSource() == error) + { + CompiereTheme.error = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("Error"), CompiereTheme.error)); + } + else if (e.getSource() == mandatory) + { + CompiereTheme.mandatory = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("Mandatory"), CompiereTheme.mandatory)); + } + else if (e.getSource() == inactive) + { + CompiereTheme.inactive = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("Inactive"), CompiereTheme.inactive)); + } + else if (e.getSource() == info) + { + CompiereTheme.info = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("Info"), CompiereTheme.info)); + } + + else if (e.getSource() == black) + { + CompiereTheme.black = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("Black"), CompiereTheme.black)); + } + else if (e.getSource() == white) + { + CompiereTheme.white = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("White"), CompiereTheme.white)); + } + else if (e.getSource() == txt_ok) + { + CompiereTheme.txt_ok = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("TextOK"), CompiereTheme.txt_ok)); + } + else if (e.getSource() == txt_error) + { + CompiereTheme.txt_error = new ColorUIResource(JColorChooser.showDialog + (this, s_res.getString("TextIssue"), CompiereTheme.txt_error)); + } + + else if (e.getSource() == controlFont) + { + CompiereTheme.controlFont = new FontUIResource(FontChooser.showDialog + (this, s_res.getString("ControlFont"), CompiereTheme.controlFont)); + } + else if (e.getSource() == systemFont) + { + CompiereTheme.systemFont = new FontUIResource(FontChooser.showDialog + (this, s_res.getString("SystemFont"), CompiereTheme.systemFont)); + } + else if (e.getSource() == userFont) + { + CompiereTheme.userFont = new FontUIResource(FontChooser.showDialog + (this, s_res.getString("UserFont"), CompiereTheme.userFont)); + } + else if (e.getSource() == smallFont) + { + CompiereTheme.smallFont = new FontUIResource(FontChooser.showDialog + (this, s_res.getString("SmallFont"), CompiereTheme.smallFont)); + } + else if (e.getSource() == menuFont) + { + CompiereTheme.menuFont = new FontUIResource(FontChooser.showDialog + (this, s_res.getString("MenuFont"), CompiereTheme.menuFont)); + } + else if (e.getSource() == windowFont) + { + CompiereTheme.windowFont = new FontUIResource(FontChooser.showDialog + (this, s_res.getString("WindowTitleFont"), CompiereTheme.windowFont)); + } + + } catch (Exception ee) {} // to capture errors when Cancel in JColorChooser + + dynInit(); + } // actionPerformed + +} // AdempiereThemeEditor diff --git a/looks/src/org/compiere/plaf/AdempiereThemeInnova.java b/looks/src/org/compiere/plaf/AdempiereThemeInnova.java new file mode 100644 index 0000000000..5dcec2db4a --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereThemeInnova.java @@ -0,0 +1,115 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import javax.swing.plaf.*; + +/** + * Adempiere default Blue Metal Color Theme + * + * @author Jorg Janke, Adam Michau + * @version $Id: AdempiereThemeBlueMetal.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereThemeInnova extends org.adempiere.plaf.AdempiereTheme +{ + /** + * Adempiere default Theme Blue Metal + */ + public AdempiereThemeInnova() + { + setDefault(); + s_theme = this; + s_name = NAME; + } // AdempiereThemeBlueMetal + + /** Name */ + public static final String NAME = "Adempiere Theme"; + + /** + * Set Defaults + */ + public void setDefault() + { + + + /** Blue 51,51,102 */ + primary0 = new ColorUIResource(103, 152, 203); + /** Blue 102, 102, 153 */ + //protected static ColorUIResource primary1; + primary1 = new ColorUIResource( 101, 138, 187); + /** Blue 153, 153, 204 */ + primary2 = new ColorUIResource(103, 152, 203); + /** Blue 204, 204, 255 */ + primary3= new ColorUIResource(233, 238, 245); // + + /** Black */ + //secondary0 = new ColorUIResource(0, 0, 0); + /** Gray 102, 102, 102 */ + //protected static ColorUIResource secondary1; + secondary1= new ColorUIResource(190, 179, 153); + /** Gray 153, 153, 153 */ + //protected static ColorUIResource secondary2; + secondary2= new ColorUIResource(246, 239, 224); + /** BlueGray 214, 224, 234 - background */ + //protected static ColorUIResource secondary3; + secondary3= new ColorUIResource(251, 248, 241); + /** White */ + //secondary4 = new ColorUIResource(255, 255, 255); + + /** Black */ + black = BLACK; + /** White */ + white = WHITE; + + /** Background for mandatory fields */ + mandatory = new ColorUIResource(233, 238, 245); // blueish + /** Background for fields in error 180,220,143 */ + error = new ColorUIResource(220, 241, 203); // green ; + /** Background for inactive fields */ + inactive = new ColorUIResource(241,239,222);//241,239,222 + /** Background for info fields */ + info = new ColorUIResource(251, 248, 251); // somewhat white + + /** Foreground Text OK */ + txt_ok =new ColorUIResource(0, 153, 255); // blue ; + /** Foreground Text Error */ + txt_error = new ColorUIResource(255, 0, 51); // red ; + + /** Black */ + // secondary0 = new ColorUIResource(0, 0, 0); + /** Control font */ + controlFont = null; + _getControlTextFont(); + /** System font */ + systemFont = null; + _getSystemTextFont(); + /** User font */ + userFont = null; + _getUserTextFont(); + /** Small font */ + smallFont = null; + _getSubTextFont(); + /** Window Title font */ + windowFont = null; + _getWindowTitleFont(); + /** Menu font */ + menuFont = null; + _getMenuTextFont(); + } // setDefault + +} // AdempiereThemeBlueMetal diff --git a/looks/src/org/compiere/plaf/AdempiereToggleButtonUI.java b/looks/src/org/compiere/plaf/AdempiereToggleButtonUI.java new file mode 100644 index 0000000000..e846d8685e --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereToggleButtonUI.java @@ -0,0 +1,109 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +/** + * Adempiere Toggle Button UI + * + * @author Jorg Janke + * @version $Id: AdempiereToggleButtonUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereToggleButtonUI extends MetalToggleButtonUI +{ + /** + * Static Create UI + * @param c Component + * @return Adempiere ToggleButton UI + */ + public static ComponentUI createUI (JComponent c) + { + return s_toggleButtonUI; + } // createUI + + /** UI shared */ + private static AdempiereToggleButtonUI s_toggleButtonUI = new AdempiereToggleButtonUI(); + + + /************************************************************************** + * Install Defaults + * @param b + */ + public void installDefaults(AbstractButton b) + { + super.installDefaults(b); + b.setOpaque(false); + } // installDefaults + + /** + * Update - + * This method is invoked by JComponent when the specified + * component is being painted. + * + * By default this method will fill the specified component with + * its background color (if its opaque property is + * true) and then immediately call paint. + * + * @param g the Graphics context in which to paint + * @param c the component being painted + * + * @see #paint + * @see javax.swing.JComponent#paintComponent + */ + public void update(Graphics g, JComponent c) + { + if (c.isOpaque()) // flat background + // AdempiereColor.getDefaultBackground().paint(g, c); + AdempiereUtils.fillRectange((Graphics2D)g, c, CompiereLookAndFeel.ROUND); + paint (g, c); + } // update + + /** + * Paint 3D Box + * @param g Graphics + * @param c Component + */ + public void paint(Graphics g, JComponent c) + { + super.paint(g, c); + AbstractButton b = (AbstractButton) c; + ButtonModel model = b.getModel(); + boolean in = model.isPressed() || model.isSelected(); + // + AdempiereUtils.paint3Deffect((Graphics2D)g, c, CompiereLookAndFeel.ROUND, !in); + } // paint + + /** + * Don't get selected Color - use default (otherwise the pressed button is gray) + * @param g + * @param b + */ + protected void paintButtonPressed(Graphics g, AbstractButton b) + { + // if (b.isContentAreaFilled()) + // { + // Dimension size = b.getSize(); + // g.setColor(getSelectColor()); + // g.fillRect(0, 0, size.width, size.height); + // } + } // paintButtonPressed + +} // AdempiereToggleButton diff --git a/looks/src/org/compiere/plaf/AdempiereToolBarUI.java b/looks/src/org/compiere/plaf/AdempiereToolBarUI.java new file mode 100644 index 0000000000..50f47ff30e --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereToolBarUI.java @@ -0,0 +1,60 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +/** + * Adempiere Tool Bar + * + * @author Jorg Janke + * @version $Id: AdempiereToolBarUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereToolBarUI extends MetalToolBarUI +{ + /** + * Create UI (own instance) + * @param c + * @return AdempiereToolBarUI + */ + public static ComponentUI createUI (JComponent c) + { + return new AdempiereToolBarUI(); + } // createUI + + + /** + * Install UI - not Opaque + * @param c + */ + public void installUI( JComponent c ) + { + super.installUI (c); + c.setOpaque(false); + } // installUI + + /** + * JToolbar error : I just instanciate and display a toolbar + * in the AWT dispatcher thread. When the toolbar is repaint + * with a SwingUtilities.updateTreeView, buttons are larger + * than usual. Note that I have several toolbars + * == paint is done by Metal, so error is there == + */ + +} // AdempiereToolBarUI diff --git a/looks/src/org/compiere/plaf/AdempiereToolTipUI.java b/looks/src/org/compiere/plaf/AdempiereToolTipUI.java new file mode 100644 index 0000000000..83722b5c44 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereToolTipUI.java @@ -0,0 +1,91 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +/** + * Tool Tip + * + * @author Jorg Janke + * @version $Id: AdempiereToolTipUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class AdempiereToolTipUI extends MetalToolTipUI +{ + + public static ComponentUI createUI(JComponent c) + { + return sharedInstance; + } + + static AdempiereToolTipUI sharedInstance = new AdempiereToolTipUI(); + + private JToolTip tip; + + public Dimension getPreferredSize(JComponent c) + { + tip = (JToolTip)c; + return super.getPreferredSize(c); + } + public void paint(Graphics g, JComponent c) + { + tip = (JToolTip)c; + super.paint(g, c); + } + + /** + * Get Accelerator String + * @return string + */ + public String getAcceleratorString () + { + String str = super.getAcceleratorString(); + + if (tip == null || isAcceleratorHidden ()) + return str; + JComponent comp = tip.getComponent (); + if (comp == null || comp instanceof JTabbedPane || comp instanceof JMenuItem) + return str; + + KeyStroke[] keys = comp.getRegisteredKeyStrokes (); + StringBuffer controlKeyStr = new StringBuffer(); + for (int i = 0; i < keys.length; i++) + { + int mod = keys[i].getModifiers (); + int condition = comp.getConditionForKeyStroke (keys[i]); + if (condition == JComponent.WHEN_IN_FOCUSED_WINDOW) + { + String prefix = KeyEvent.getKeyModifiersText (mod); + if (prefix.length() > 1) + { + if (controlKeyStr.length() > 0) + controlKeyStr.append(" "); + controlKeyStr.append(prefix).append("-") + .append(KeyEvent.getKeyText(keys[i].getKeyCode())); + break; // just first + } + } + } + return controlKeyStr.toString(); + } // getAcceleratorString + +} // AdempierelToolTipUI diff --git a/looks/src/org/compiere/plaf/AdempiereUtils.java b/looks/src/org/compiere/plaf/AdempiereUtils.java new file mode 100644 index 0000000000..fd30b68dc6 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereUtils.java @@ -0,0 +1,472 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import java.awt.geom.*; +import java.awt.image.*; +import java.io.*; +import java.net.*; +import java.util.logging.*; +import javax.swing.*; +import com.sun.image.codec.jpeg.*; + +/** + * UI utilities + * + * @author Jorg Janke + * @version $Id: AdempiereUtils.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class AdempiereUtils +{ + + /** Logger */ + private static Logger log = Logger.getLogger(AdempiereUtils.class.getName()); + + /** + * Fill Background with Color. + * (Ususlly called from update methods) + * + * @param g2D Graphics + * @param c Component + * @param round paint round corners + */ + public static void fillRectange(Graphics2D g2D, JComponent c, boolean round) + { + // Paint in AdempiereColor? + AdempiereColor cc = null; + boolean stdCC = c.getClientProperty(AdempierePLAF.BACKGROUND_FILL) != null; + try + { + cc = (AdempiereColor)c.getClientProperty(AdempierePLAF.BACKGROUND); + } + catch (Exception e) + { + stdCC = true; + } + if (stdCC) + cc = AdempiereColor.getDefaultBackground(); + + // Paint AdempiereColor + if (cc != null) + { + // bounds is often not within Panel bouunds + cc.paint(g2D, c); + } + // Paint Flat Color + else + { + Paint paint = c.getBackground(); + g2D.setPaint(paint); + // + RectangularShape rec = null; + if (round) + rec = new RoundRectangle2D.Float(0, 0, c.getWidth(),c.getHeight(), 15,15); + else + rec = new Rectangle(0,0, c.getWidth(),c.getHeight()); + g2D.fill(rec); + } + } // fill Rectangle + + /** Top Top Color - white 128 the higher the ligher */ + static public final Color COL_1TOP = new Color(255, 255, 255, 128); + /** End Top Color - white 0 */ + static public final Color COL_1END = new Color(255, 255, 255, 0); + /** Top End Color - black 0 */ + static public final Color COL_2TOP = new Color(0, 0, 0, 0); + /** End End Color - black 64 the higher the darker */ + static public final Color COL_2END = new Color(0, 0, 0, 64); + + /** + * Paint 3D effect in (lighten in upper half, darken in lowerhalf) + * (called from paint methods) + * + * @param g2D Graphics + * @param r Ractangle + * @param round paint round corners + * @param out paint sticking out (not pressed) + */ + public static void paint3Deffect (Graphics2D g2D, Rectangle r, boolean round, boolean out) + { + // paint upper gradient + GradientPaint topPaint = null; + if (out) + topPaint = new GradientPaint(r.x, r.y, COL_1TOP, r.x, r.y+r.height/2, COL_1END); + else + topPaint = new GradientPaint(r.x, r.y, COL_2END, r.x, r.y+r.height/2, COL_2TOP); + g2D.setPaint(topPaint); + // + RectangularShape topRec = null; + if (round) + topRec = new RoundRectangle2D.Float(r.x,r.y, r.width,r.height/2, 15,15); + else + topRec = new Rectangle(r.x,r.y, r.width,r.height/2); + g2D.fill(topRec); + + // paint lower gradient + GradientPaint endPaint = null; // upper left corner to lower left + if (out) + endPaint = new GradientPaint(r.x, r.y+r.height/2, COL_2TOP, r.x, r.y+r.height, COL_2END); + else + endPaint = new GradientPaint(r.x, r.y+r.height/2, COL_1END, r.x, r.y+r.height, COL_1TOP); + g2D.setPaint(endPaint); + // + RectangularShape endRec = null; + if (round) + endRec = new RoundRectangle2D.Float(r.x, r.y+r.height/2, r.width, r.height/2, 15,15); + else + endRec = new Rectangle(r.x, r.y+r.height/2, r.width, r.height/2); + g2D.fill(endRec); + } // paint3Deffect + + /** + * Paint 3D effect in (lighten in upper half, darken in lowerhalf) + * (called from paint methods) + * + * @param g2D Graphics + * @param c Component + * @param round paint round corners + * @param out paint sticking out (not pressed) + */ + public static void paint3Deffect (Graphics2D g2D, JComponent c, boolean round, boolean out) + { + // paint upper gradient + GradientPaint topPaint = null; + if (out) + topPaint = new GradientPaint(0,0, COL_1TOP, 0,c.getHeight()/2, COL_1END); + else + topPaint = new GradientPaint(0,0, COL_2END, 0,c.getHeight()/2, COL_2TOP); + g2D.setPaint(topPaint); + // + RectangularShape topRec = null; + if (round) + topRec = new RoundRectangle2D.Float(0, 0, c.getWidth(),c.getHeight()/2, 15,15); + else + topRec = new Rectangle(0,0, c.getWidth(),c.getHeight()/2); + g2D.fill(topRec); + + // paint lower gradient + GradientPaint endPaint = null; + if (out) + endPaint = new GradientPaint(0, c.getHeight()/2, COL_2TOP, 0,c.getHeight(), COL_2END); + else + endPaint = new GradientPaint(0, c.getHeight()/2, COL_1END, 0,c.getHeight(), COL_1TOP); + g2D.setPaint(endPaint); + // + RectangularShape endRec = null; + if (round) + endRec = new RoundRectangle2D.Float(0, c.getHeight()/2, c.getWidth(),c.getHeight()/2, 15,15); + else + endRec = new Rectangle(0, c.getHeight()/2, c.getWidth(), c.getHeight()/2); + g2D.fill(endRec); + } // paint3Deffect + + + /************************************************************************* + * Helper to simplify creation of translucent colors + * @param c Color + * @param alpha alpha + * @return Translucent Color + */ + static public Color getTranslucentColor(Color c, int alpha) + { + return new Color(c.getRed(), c.getGreen(), c.getBlue(), alpha); + } // getTranslucentColor + + + /** + * Set Not Buffered. Recursive for all contained components + * @param c + */ + static public void setNotBuffered (Component c) + { + if (c instanceof JComponent) + ((JComponent)c).setDoubleBuffered(false); + if (c instanceof Container) + { + Component[] cc = ((Container)c).getComponents(); + for (int i = 0; i < cc.length; i++) + setNotBuffered(cc[i]); + } + } // setNotBuffered + + + /*************************************************************************/ + + /** Component for media tracker */ + protected final static Component s_component = new Component() {}; + /** Media tracker */ + protected final static MediaTracker s_tracker = new MediaTracker(s_component); + + /** + * load the image located at path. + * + * @param path location of image file in local file system + * - otherwise relative to class + * @return loaded image at path or url + * @see java.io.File#toURL() + */ + public static synchronized Image loadImage(String path) + { + Image image = null; + try + { + File file = new File(path); + URL url = file.toURL(); + image = loadImage(url); + } + catch (MalformedURLException e) + { + log.severe("Path= " + path + " - " + e.getMessage()); + } + return image; + } // loadImage + + /** + * Load the image located at URL. + * + * @param url URL where the image file is located. + * @return loaded image at path or url + * @see java.io.File#toURL() + */ + public static synchronized Image loadImage(URL url) + { + Image image = null; + image = Toolkit.getDefaultToolkit().getImage(url); + if (image != null) + { + s_tracker.addImage(image, 0); + try + { + s_tracker.waitForAll(); + } + catch (InterruptedException e) + { + log.severe("Url= " + url + " - " + e.getMessage()); + s_tracker.removeImage(image); + image = null; + } + finally + { + if (image != null) + s_tracker.removeImage(image); + if (s_tracker.isErrorAny()) + { + log.severe("Tracker: " + s_tracker.getErrorsAny()[0]); + image = null; + } + + if (image != null) + { + if (image.getWidth(null) < 0 || image.getHeight(null) < 0) + { + log.severe("Image=0"); + image = null; + } + } + } + } + return image; + } // loadImage + + /** + * Load an image from a given file into a BufferedImage. + * The image is returned in the format defined by the imageType parameter. + * Note that this is special cased for JPEG images where loading is performed + * outside the standard media tracker, for efficiency reasons. + * + * @param file File where the image file is located. + * @param imageType one of the image type defined in the BufferedImage class. + * @return loaded image at path or url + * @see java.awt.image.BufferedImage + */ + public static synchronized BufferedImage loadBufferedImage(File file, int imageType) + { + BufferedImage image = null; + try + { + URL url = file.toURL(); + image = loadBufferedImage(url, imageType); + } + catch (MalformedURLException e) + { + log.severe("File: " + file + " - " + e.getMessage()); + } + return image; + } // loadBufferedImage + + /** + * Load an image from a given path into a BufferedImage. + * The image is returned in the format defined by the imageType parameter. + * Note that this is special cased for JPEG images where loading is performed + * outside the standard media tracker, for efficiency reasons. + * + * @param path Name of file where the image file is located. + * @param imageType one of the image type defined in the BufferedImage class. + * @return loaded image at path or url + * @see java.awt.image.BufferedImage + */ + public static synchronized BufferedImage loadBufferedImage(String path, int imageType) + { + File file = new File(path); + BufferedImage image = null; + try + { + URL url = file.toURL(); + image = loadBufferedImage(url, imageType); + } + catch (MalformedURLException e) + { + log.severe("Path: " + path + " - " + e.getMessage()); + } + return image; + } // loadBufferedImage + + /** + * Loads an image from a given URL into a BufferedImage. + * The image is returned in the format defined by the imageType parameter. + * Note that this is special cased for JPEG images where loading is performed + * outside the standard media tracker, for efficiency reasons. + * + * @param url URL where the image file is located. + * @param imageType one of the image type defined in the BufferedImage class. + * @return loaded image at path or url + * @see java.awt.image.BufferedImage + */ + public static synchronized BufferedImage loadBufferedImage(URL url, int imageType) + { + BufferedImage image = null; + // Special handling for JPEG images to avoid extra processing if possible. + if (url == null || !url.toString().toLowerCase().endsWith(".jpg")) + { + Image tmpImage = loadImage(url); + if (tmpImage != null) + { + image = new BufferedImage(tmpImage.getWidth(null), tmpImage.getHeight(null), imageType); + Graphics2D g = image.createGraphics(); + g.drawImage(tmpImage, 0, 0, null); + g.dispose(); + } + } + else + { + BufferedImage tmpImage = loadBufferedJPEGImage(url); + if (tmpImage != null) + { + if (tmpImage.getType() != imageType) + { + log.config("Incompatible JPEG image type: creating new buffer image"); + image = new BufferedImage(tmpImage.getWidth(null), tmpImage.getHeight(null), imageType); + Graphics2D g = image.createGraphics(); + g.drawImage(tmpImage, 0, 0, null); + g.dispose(); + } + else + image = tmpImage; + } + } + return image; + } // loadBufferedImage + + /** + * Load a JPEG image from a given location. + * + * @param url URL where the image file is located. + * @return loaded image at path or url + */ + public static synchronized BufferedImage loadBufferedJPEGImage (URL url) + { + BufferedImage image = null; + if (url != null) + { + InputStream in = null; + try + { + in = url.openStream(); + JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(in); + image = decoder.decodeAsBufferedImage(); + } + catch (Exception e) + { + log.severe("URL: " + url + " - " + e.getMessage()); + image = null; + } + finally + { + try + { + if (in != null) + in.close(); + } + catch (IOException ioe) + { + log.severe("URL: " + url + " - " + ioe.getMessage()); + } + } + if (image != null) + { + log.config("Image type : " + image.getType()); + if (image.getWidth() <= 0 || image.getHeight() <= 0) + { + log.severe("URL: " + url + " =0"); + image = null; + } + } + } + return image; + } + + + /************************************************************************* + * Convenience function for determining ComponentOrientation. + * Copied from MetalUtils + * @param c Component + * @return true, if left to right + */ + public static boolean isLeftToRight (Component c) + { + return c.getComponentOrientation().isLeftToRight(); + } // isLeftToRight + + /** Debug SequenceNo */ + private static int s_no = 0; + + /** + * Print Oarent of Component + * @param c component + */ + static void printParents (JComponent c) + { + if (c.getName() == null) + c.setName("C" + String.valueOf(s_no++)); + System.out.print(c.getName()); + System.out.print(" - " + c.getClass().getName()); + System.out.println (" ** " + c.isOpaque() + " bg=" + (c.getClientProperty(AdempierePLAF.BACKGROUND) != null)); + // + Container container = c.getParent(); + while (container != null) + { + System.out.print (" - " + container.getName() + " " + container.getClass().getName() + + " ** " + container.isOpaque()); + if (container instanceof JComponent) + System.out.print (" bg=" + (((JComponent)container).getClientProperty(AdempierePLAF.BACKGROUND) != null)); + System.out.println (); + container = container.getParent(); + } + } // printParents + +} // AdempiereTuils diff --git a/looks/src/org/compiere/plaf/AdempiereViewportUI.java b/looks/src/org/compiere/plaf/AdempiereViewportUI.java new file mode 100644 index 0000000000..2a8dbed456 --- /dev/null +++ b/looks/src/org/compiere/plaf/AdempiereViewportUI.java @@ -0,0 +1,58 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import javax.swing.JComponent; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.ViewportUI; +import javax.swing.plaf.basic.BasicViewportUI; + +/** + * Adempiere View Point + * + * @author Jorg Janke + * @version $Id: AdempiereViewportUI.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class AdempiereViewportUI extends BasicViewportUI +{ + /** Shared UI object */ + private static ViewportUI viewportUI; + + /** + * Create UI + * @param c + * @return AdempiereViewpointUI + */ + public static ComponentUI createUI (JComponent c) + { + if (viewportUI == null) + viewportUI = new AdempiereViewportUI(); + return viewportUI; + } // createUI + + /** + * Install UI + * @param c + */ + public void installUI(JComponent c) + { + super.installUI(c); + // will be ignored as set in constructor after updateUI - Sun bug: 4677611 + c.setOpaque(false); + } // installUI + +} // AdempiereViewpointUI diff --git a/looks/src/org/compiere/plaf/AquaTheme.java b/looks/src/org/compiere/plaf/AquaTheme.java new file mode 100644 index 0000000000..5fc2f07032 --- /dev/null +++ b/looks/src/org/compiere/plaf/AquaTheme.java @@ -0,0 +1,44 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +/* + * @(#)AquaTheme.java 1.9 04/07/26 + */ +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + + +/** + * This class describes a theme using "blue-green" colors. + * + * 1.9 07/26/04 + * @author Steve Wilson + */ +public class AquaTheme extends DefaultMetalTheme { + + public String getName() { return "Aqua"; } + + private final ColorUIResource primary1 = new ColorUIResource(102, 153, 153); + private final ColorUIResource primary2 = new ColorUIResource(128, 192, 192); + private final ColorUIResource primary3 = new ColorUIResource(159, 235, 235); + + protected ColorUIResource getPrimary1() { return primary1; } + protected ColorUIResource getPrimary2() { return primary2; } + protected ColorUIResource getPrimary3() { return primary3; } + +} diff --git a/looks/src/org/compiere/plaf/CharcoalTheme.java b/looks/src/org/compiere/plaf/CharcoalTheme.java new file mode 100644 index 0000000000..80d8e462aa --- /dev/null +++ b/looks/src/org/compiere/plaf/CharcoalTheme.java @@ -0,0 +1,59 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +/* + * @(#)CharcoalTheme.java 1.9 04/07/26 + */ + + +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +/** + * This class describes a theme using gray colors. + * + * 1.9 07/26/04 + * @author Steve Wilson + */ +public class CharcoalTheme extends DefaultMetalTheme { + + public String getName() { return "Charcoal"; } + + private final ColorUIResource primary1 = new ColorUIResource(66, 33, 66); + private final ColorUIResource primary2 = new ColorUIResource(90, 86, 99); + private final ColorUIResource primary3 = new ColorUIResource(99, 99, 99); + + private final ColorUIResource secondary1 = new ColorUIResource(0, 0, 0); + private final ColorUIResource secondary2 = new ColorUIResource(51, 51, 51); + private final ColorUIResource secondary3 = new ColorUIResource(102, 102, 102); + + private final ColorUIResource black = new ColorUIResource(222, 222, 222); + private final ColorUIResource white = new ColorUIResource(0, 0, 0); + + protected ColorUIResource getPrimary1() { return primary1; } + protected ColorUIResource getPrimary2() { return primary2; } + protected ColorUIResource getPrimary3() { return primary3; } + + protected ColorUIResource getSecondary1() { return secondary1; } + protected ColorUIResource getSecondary2() { return secondary2; } + protected ColorUIResource getSecondary3() { return secondary3; } + + protected ColorUIResource getBlack() { return black; } + protected ColorUIResource getWhite() { return white; } + +} diff --git a/looks/src/org/compiere/plaf/ColorBlind.java b/looks/src/org/compiere/plaf/ColorBlind.java new file mode 100644 index 0000000000..3767aff90f --- /dev/null +++ b/looks/src/org/compiere/plaf/ColorBlind.java @@ -0,0 +1,289 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.Color; +import java.util.logging.*; + +import javax.swing.plaf.ColorUIResource; + +/** + * Color Blind Utilities. + * These utilities help to show how color blind/challenged see colors. + * + * Created by Thomas Wolfmaier. + * Copyright (C) 1999-2005 HCIRN. + * All rights reserved. + * @see HCIRN + * + * @author Thomas Wolfmaier + * @version $Id: ColorBlind.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class ColorBlind +{ + /** Color Blindness Type - 0=none */ + public static final String[] COLORBLIND_TYPE = + {"", "Protanopia", "Deuteranopia", "Tritanopia"}; + + public static final int NORMAL = 0; + public static final int PROTANOPIA = 1; + public static final int DEUTERANOPIA = 2; + public static final int TRITANOPIA = 3; + + /*************************************************************************/ + + private static final double[][] confusionPoints = + { {0.735, 0.265}, + {1.140, -0.140}, + {0.171, -0.003} + }; + private static final double[][][] colorAxes = + { {{0.115807, 0.073581}, {0.471899, 0.527051}}, + {{0.102776, 0.102864}, {0.505845, 0.493211}}, + {{0.045391, 0.294976}, {0.665764, 0.334011}} + }; + private static final double[][] RGBtoXYZMatrix = + { {0.430574, 0.341550, 0.178325}, + {0.222015, 0.706655, 0.071330}, + {0.020183, 0.129553, 0.939180} + }; + private static final double[][] XYZtoRGBMatrix = + { { 3.063218, -1.393325, -0.475802}, + {-0.969243, 1.875966, 0.041555}, + { 0.067871, -0.228834, 1.069251} + }; + private static final double[] whitePoint = + { 0.312713, 0.329016, 0.358271 + }; + private static final double gamma = 2.2; + + /** Color Blind Type */ + private static int s_colorType = NORMAL; + + /** Logger */ + private static Logger log = Logger.getLogger(ColorBlind.class.getName()); + + + /** + * Set Color Type for Color Blind view + * @param colorType (0 = none) + */ + public static void setColorType (int colorType) + { + if (colorType > 0 && colorType < 4) + s_colorType = colorType; + else + s_colorType = 0; + if (s_colorType != 0) + log.config(COLORBLIND_TYPE[colorType]); + } // setColorType + + /** + * Get Color Type for Color Blind view + * @return colorType (0 = none) + */ + public static int getColorType () + { + return s_colorType; + } // getColorType + + + /************************************************************************** + * Convert "normal" color to Dichromat Color based on set color type + * @param color Java Color object containing values for RGB + * @return Dichromat Color + */ + public static ColorUIResource getDichromatColorUIResource (ColorUIResource color) + { + if (s_colorType == NORMAL) + return color; + return new ColorUIResource(getDichromatColorUIResource (color, s_colorType)); + } // convertToDichromatColorUIResource + + /** + * Convert "normal" color to Dichromat Color + * @param color Java Color object containing values for RGB + * @param colorType PROTANOPIA = 1, DEUTERANOPIA = 2 or TRITANOPIA = 3 as declared above + * @return Dichromat Color + */ + public static Color getDichromatColorUIResource (ColorUIResource color, int colorType) + { + if (s_colorType == NORMAL) + return color; + return new ColorUIResource(getDichromatColor (color, s_colorType)); + } // convertToDichromatColorUIResource + + /** + * Convert "normal" color to Dichromat Color based on set color type + * @param color Java Color object containing values for RGB + * @return Dichromat Color + */ + public static Color getDichromatColor (Color color) + { + if (s_colorType == NORMAL) + return color; + return getDichromatColor (color, s_colorType); + } // convertToDichromatColor + + /** + * Convert "normal" color to Dichromat Color + * @param color Java Color object containing values for RGB + * @param colorType PROTANOPIA = 1, DEUTERANOPIA = 2 or TRITANOPIA = 3 as declared above + * @return Dichromat Color + */ + public static Color getDichromatColor (Color color, int colorType) + { + // check type & return if not valid + int type = 0; + if (colorType > 0 && colorType < 4) + type = colorType; + // No conversion or no color + if (type == 0 || color == null) + return color; + type--; // correct to zero based + + // Return white & black - not converted + if (color.equals(Color.black) || color.equals(Color.white)) + return color; + + double red = color.getRed(); + double green = color.getGreen(); + double blue = color.getBlue(); + + // System.out.println("Red: " + red + " Green: " + green + " Blue: " + blue); + + double X = RGBtoXYZMatrix[0][0] * Math.pow(red / 255.0, gamma) + + RGBtoXYZMatrix[0][1] * Math.pow(green / 255.0, gamma) + + RGBtoXYZMatrix[0][2] * Math.pow(blue / 255.0, gamma); + double Y = RGBtoXYZMatrix[1][0] * Math.pow(red / 255.0, gamma) + + RGBtoXYZMatrix[1][1] * Math.pow(green / 255.0, gamma) + + RGBtoXYZMatrix[1][2] * Math.pow(blue / 255.0, gamma); + double Z = RGBtoXYZMatrix[2][0] * Math.pow(red / 255.0, gamma) + + RGBtoXYZMatrix[2][1] * Math.pow(green / 255.0, gamma) + + RGBtoXYZMatrix[2][2] * Math.pow(blue / 255.0, gamma); + + // System.out.println("X: " + X + " Y: " + Y + " Z: " + Z); + + double x = 0.0; + double y = 0.0; + + if ((X + Y + Z) != 0.0) + { + x = X / (X + Y + Z); + y = Y / (X + Y + Z); + } + + // System.out.println("x: " + x + " y: " + y + " Y: " + Y); + + double Yn = Y; + double Xn = (whitePoint[0] * Yn) / whitePoint[1]; + double Zn = (whitePoint[2] * Yn) / whitePoint[1]; + + double xc = confusionPoints[type][0]; + double yc = confusionPoints[type][1]; + + double x1 = colorAxes[type][0][0]; + double y1 = colorAxes[type][0][1]; + double x2 = colorAxes[type][1][0]; + double y2 = colorAxes[type][1][1]; + + double ap = (y2 - y1) / (x2 - x1); + double bp = y1 - (x1 * ap); + + // System.out.println("ap: " + ap + " bp: " + bp); + + double a; + if (x < xc) + a = (yc - y) / (xc - x); + else + a = (y - yc) / (x - xc); + + double b = y - (x * a); + + // System.out.println("a: " + a + " b: " + b); + + x = (bp - b) / (a - ap); + y = a * x + b; + + // System.out.println("x: " + x + " y: " + y); + + X = 0.0; + Z = 0.0; + if (y != 0) + { + X = x * (Y / y); + Z = (1 - x - y) * (Y / y); + } + + // System.out.println("X: " + X + " Y: " + Y + " Z: " + Z); + + red = XYZtoRGBMatrix[0][0] * X + + XYZtoRGBMatrix[0][1] * Y + + XYZtoRGBMatrix[0][2] * Z; + green = XYZtoRGBMatrix[1][0] * X + + XYZtoRGBMatrix[1][1] * Y + + XYZtoRGBMatrix[1][2] * Z; + blue = XYZtoRGBMatrix[2][0] * X + + XYZtoRGBMatrix[2][1] * Y + + XYZtoRGBMatrix[2][2] * Z; + + // System.out.println("Red: " + red + " Green: " + green + " Blue: " + blue); + + double reddiff = XYZtoRGBMatrix[0][0] * (Xn - X) + + XYZtoRGBMatrix[0][1] * (Yn - Y) + + XYZtoRGBMatrix[0][2] * (Zn - Z); + double greendiff = XYZtoRGBMatrix[1][0] * (Xn - X) + + XYZtoRGBMatrix[1][1] * (Yn - Y) + + XYZtoRGBMatrix[1][2] * (Zn - Z); + double bluediff = XYZtoRGBMatrix[2][0] * (Xn - X) + + XYZtoRGBMatrix[2][1] * (Yn - Y) + + XYZtoRGBMatrix[2][2] * (Zn - Z); + + double cr = ((red < 0.0 ? 0.0 : 1.0) - red) / reddiff; + double cg = ((green < 0.0 ? 0.0 : 1.0) - green) / greendiff; + double cb = ((blue < 0.0 ? 0.0 : 1.0) - blue) / bluediff; + + // System.out.println("cr: " + cr + " cg: " + cg + " cb: " + cb); + + double c1 = (cr < 0 || cr > 1) ? 0 : cr; + double c2 = (cg < 0 || cg > 1) ? 0 : cg; + double c3 = (cb < 0 || cb > 1) ? 0 : cb; + double c = Math.max(c1, Math.max(c2, c3)); + + // System.out.println("c: " + c); + + red = red + c * reddiff; + green = green + c * greendiff; + blue = blue + c * bluediff; + + // System.out.println("Red: " + red + " Green: " + green + " Blue: " + blue); + + red = Math.pow(red, 1.0 / gamma); + green = Math.pow(green, 1.0 / gamma); + blue = Math.pow(blue, 1.0 / gamma); + + // System.out.println("Red: " + red + " Green: " + green + " Blue: " + blue); + // System.out.println("Red: " + red * 255.0 + " Green: " + green * 255.0 + " Blue: " + blue * 255.0); + + Color retValue = new Color((float)red, (float)green, (float)blue); + log.fine("Color " + color.getRed() + "-" + color.getGreen() + "-" + color.getBlue() + + " -> " + retValue.getRed() + "-" + retValue.getGreen() + "-" + retValue.getBlue() + " <- " + COLORBLIND_TYPE[colorType]); + + return retValue; + } // convertToDichromatColor + +} // ColorBlind diff --git a/looks/src/org/compiere/plaf/CompiereLookAndFeel.java b/looks/src/org/compiere/plaf/CompiereLookAndFeel.java new file mode 100644 index 0000000000..90e56d8206 --- /dev/null +++ b/looks/src/org/compiere/plaf/CompiereLookAndFeel.java @@ -0,0 +1,242 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; + +import javax.swing.*; +import javax.swing.plaf.metal.*; + +/** + * Adempiere Look & Feel. + * We wanted a nice UI not the battleship gray based stuff. + * I guess a matter of taste. + * + * : + * UIManager.setLookAndFeel(new com.adempiere.plaf.AdempiereLookAndFeel()); + * // or UIManager.setLookAndFeel("com.adempiere.plaf.AdempiereLookAndFeel"); + * + * + * @author Jorg Janke + * @version $Id: AdempiereLookAndFeel.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CompiereLookAndFeel extends MetalLookAndFeel +{ + /** + * Constructor + */ + public CompiereLookAndFeel() + { + super(); + // System.setProperty("awt.visualbell", "true"); + } // AdempiereLookAndFeel + + /** The name */ + public static final String NAME = "Compiere"; + + /** The Theme */ + private static CompiereTheme s_adempiereTheme = new CompiereThemeBlueMetal(); + private static MetalTheme s_theme = s_adempiereTheme; + + /** Paint Round Corners */ + protected static boolean ROUND = false; + + /** + * The Name + * @return Name + */ + public String getName() + { + return NAME; + } // getName + + /** + * The ID + * @return Name + */ + public String getID() + { + return NAME; + } // getID + + /** + * The Description + * @return description + */ + public String getDescription() + { + return "Adempiere Look & Feel - (c) 2001-2005 Jorg Janke"; + } // getDescription + + + /************************************************************************** + * Get/Create Defaults + * @return UI Defaults + */ + public UIDefaults getDefaults() + { + // System.out.println("AdempiereLookAndFeel.getDefaults"); + // Theme already created/set + MetalLookAndFeel.setCurrentTheme(s_theme); + UIDefaults defaults = super.getDefaults(); // calls init..Defaults + return defaults; + } // getDefaults + + /** + * Creates the mapping from UI class IDs to ComponentUI classes, + * putting the ID-ComponentUI pairs in the passed-in defaults table. + * Each JComponent class specifies its own UI class ID string. + * + * @param table UI Defaults + */ + protected void initClassDefaults(UIDefaults table) + { + // System.out.println("AdempiereLookAndFeel.initClassDefaults"); + super.initClassDefaults( table); + // Overwrite + putDefault (table, "PanelUI"); + putDefault (table, "ButtonUI"); + putDefault (table, "ToggleButtonUI"); + putDefault (table, "TabbedPaneUI"); + putDefault (table, "TableHeaderUI"); + putDefault (table, "RadioButtonUI"); + putDefault (table, "CheckBoxUI"); + putDefault (table, "ComboBoxUI"); + putDefault (table, "MenuUI"); + putDefault (table, "MenuBarUI"); + putDefault (table, "MenuItemUI"); + putDefault (table, "CheckBoxMenuItemUI"); + putDefault (table, "ToolBarUI"); + putDefault (table, "RootPaneUI"); + putDefault (table, "ViewportUI"); + putDefault (table, "SplitPaneUI"); + putDefault (table, "ScrollPaneUI"); + putDefault (table, "LabelUI"); + putDefault (table, "ToolTipUI"); + putDefault (table, "TextAreaUI"); + + } // initClassDefaults + + /** + * Put "uiKey - ClassName" pair in UIDefaults + * @param table + * @param uiKey + */ + private void putDefault (UIDefaults table, String uiKey) + { + try + { + String className = "org.compiere.plaf.Adempiere" + uiKey; + table.put(uiKey, className); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } // putDefault + + /** + * For overwriting Component defaults + * @param table + */ + protected void initSystemColorDefaults (UIDefaults table) + { + // System.out.println("AdempiereLookAndFeel.initSystemColorDefaults"); + super.initSystemColorDefaults( table); + + // we made the color a bit darker + // table.put("textHighlight", AdempiereUtils.getTranslucentColor(getTextHighlightColor(), 128)); + } // initSystemColorDefaults + + /** + * For overwriting Component defaults + * @param table + */ + protected void initComponentDefaults (UIDefaults table) + { + // System.out.println("AdempiereLookAndFeel.initComponentDefaults"); + super.initComponentDefaults( table); + + // ComboBox defaults + Color c = table.getColor("TextField.background"); + table.put("ComboBox.background", c); + table.put("ComboBox.listBackground", c); + } // initComponentDefaults + + + /************************************************************************** + * Create Default Thems + */ + protected void createDefaultTheme() + { + setCurrentTheme(s_theme); + } // createDefaultTheme + + /** + * Set Current Theme + * @param theme metal theme + */ + public static void setCurrentTheme (MetalTheme theme) + { + if (theme != null) + s_theme = theme; + MetalLookAndFeel.setCurrentTheme(s_theme); + } // setCurrentTheme + + /** + * Get Current Theme + * @return Metal Theme + */ + public static MetalTheme getCurrentTheme() + { + return s_theme; + } // getCurrentTheme + + /** + * Get Adempiere Theme + * @return Metal Theme + */ + public static CompiereTheme getAdempiereTheme() + { + return s_adempiereTheme; + } // getCurrentTheme + + /** + * Error Feedback. + *

+ * Invoked when the user attempts an invalid operation, + * such as pasting into an uneditable JTextField + * that has focus. + *

+ *

+ * If the user has enabled visual error indication on + * the desktop, this method will flash the caption bar + * of the active window. The user can also set the + * property awt.visualbell=true to achieve the same + * results. + *

+ * @param component Component the error occured in, may be + * null indicating the error condition is + * not directly associated with a + * Component. + */ + public void provideErrorFeedback (Component component) + { + super.provideErrorFeedback (component); + } // provideErrorFeedback + +} // AdempiereLookAndFeel diff --git a/looks/src/org/compiere/plaf/CompiereTheme.java b/looks/src/org/compiere/plaf/CompiereTheme.java new file mode 100644 index 0000000000..70c8d4c1c9 --- /dev/null +++ b/looks/src/org/compiere/plaf/CompiereTheme.java @@ -0,0 +1,601 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import java.util.logging.*; +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; +import org.compiere.util.*; +import sun.awt.*; + +/** + * Adempiere User definable Theme (if used in Metal L&F). + * In other Environments, it provides UI extensions (e.g. Error Color) + * + * @author Jorg Janke + * @version $Id: AdempiereTheme.java,v 1.4 2006/07/30 00:52:23 jjanke Exp $ + */ +public class CompiereTheme extends MetalTheme +{ + /** + * Constructor - nop + */ + public CompiereTheme() + { + } // AdempiereTheme + + /** + * Return Theme Name + * @return Theme Name + */ + public String getName() + { + return s_name; + } // getName + + /** + * String Representation + * @return info + */ + public String toString () + { + return s_name; + } // toString + + /** + * Set Default Colors + */ + protected void setDefault() + { + } // setDefault + + /** Static Initializer */ + static + { + s_theme = new CompiereThemeBlueMetal(); + } + + /** Theme Name */ + protected static String s_name = "Compiere Theme"; + /** Logger */ + protected static Logger log = Logger.getLogger(CompiereTheme.class.getName()); + /** Active Theme */ + protected static CompiereTheme s_theme = null; + + /** Blue 51,51,102 */ + protected static ColorUIResource primary0 = new ColorUIResource(51, 51, 102); + /** Blue 102, 102, 153 */ + protected static ColorUIResource primary1; + /** Blue 153, 153, 204 */ + protected static ColorUIResource primary2; + /** Blue 204, 204, 255 */ + protected static ColorUIResource primary3; + + /** Black */ + protected final ColorUIResource secondary0 = new ColorUIResource(0, 0, 0); + /** Gray 102, 102, 102 */ + protected static ColorUIResource secondary1; + /** Gray 153, 153, 153 */ + protected static ColorUIResource secondary2; + /** BlueGray 214, 224, 234 - background */ + protected static ColorUIResource secondary3; + /** White */ + protected final ColorUIResource secondary4 = new ColorUIResource(255, 255, 255); + + /** Black */ + protected static ColorUIResource black; + /** White */ + protected static ColorUIResource white; + + /** Background for mandatory fields */ + protected static ColorUIResource mandatory; + /** Background for fields in error */ + protected static ColorUIResource error; + /** Background for inactive fields */ + protected static ColorUIResource inactive; + /** Background for info fields */ + protected static ColorUIResource info; + + /** Foreground Text OK */ + protected static ColorUIResource txt_ok; + /** Foreground Text Error */ + protected static ColorUIResource txt_error; + + /** Control font */ + protected static FontUIResource controlFont; + /** System font */ + protected static FontUIResource systemFont; + /** User font */ + protected static FontUIResource userFont; + /** Small font */ + protected static FontUIResource smallFont; + /** Window Title font */ + protected static FontUIResource windowFont; + /** Menu font */ + protected static FontUIResource menuFont; + + /** Default Font */ + public static final String FONT_DEFAULT = "Dialog"; + /** Default Font Size */ + public static final int FONT_SIZE = 12; + + + /** + * Set Theme to current Metal Theme and copy it + */ + public static void setTheme () + { + log.fine(""); + AppContext context = AppContext.getAppContext(); + MetalTheme copyFrom = (MetalTheme)context.get("currentMetalTheme"); + boolean flat = Ini.isPropertyBool(Ini.P_UI_FLAT); + setTheme (copyFrom, flat); + } // setTheme + + /** + * Set Theme to current Metal Theme and copy it + * @param copyFrom theme + * @param flat flat colors + */ + public static void setTheme (MetalTheme copyFrom, boolean flat) + { + if (copyFrom == null || copyFrom instanceof CompiereTheme) + return; + log.fine(copyFrom.getName() + " - Flat=" + flat); + // May not be correct, if Themes overwrites default methods + primary1 = copyFrom.getPrimaryControlDarkShadow(); + primary2 = copyFrom.getPrimaryControlShadow(); + primary3 = copyFrom.getPrimaryControl(); + secondary1 = copyFrom.getControlDarkShadow(); + secondary2 = copyFrom.getControlShadow(); + secondary3 = copyFrom.getControl(); + AdempierePanelUI.setDefaultBackground(new AdempiereColor(secondary3, flat)); + white = copyFrom.getPrimaryControlHighlight(); + black = copyFrom.getPrimaryControlInfo(); + // + controlFont = copyFrom.getControlTextFont(); + systemFont = copyFrom.getSystemTextFont(); + userFont = copyFrom.getUserTextFont(); + smallFont = copyFrom.getSubTextFont(); + menuFont = copyFrom.getMenuTextFont(); + windowFont = copyFrom.getWindowTitleFont(); + } // setTheme + + + + /************************************************************************** + * Get Primary 1 (blue in default Metal Theme) + * @return color + */ + public ColorUIResource getPrimary1() + { + return ColorBlind.getDichromatColorUIResource(primary1); + } + public ColorUIResource getPrimary2() + { + return ColorBlind.getDichromatColorUIResource(primary2); + } + public ColorUIResource getPrimary3() + { + return ColorBlind.getDichromatColorUIResource(primary3); + } + + /** + * Get Seconary 1 (gray in default Metal Theme) + * @return color + */ + public ColorUIResource getSecondary0() + { + return ColorBlind.getDichromatColorUIResource(secondary0); + } + public ColorUIResource getSecondary1() + { + return ColorBlind.getDichromatColorUIResource(secondary1); + } + public ColorUIResource getSecondary2() + { + return ColorBlind.getDichromatColorUIResource(secondary2); + } + public ColorUIResource getSecondary3() + { + return ColorBlind.getDichromatColorUIResource(secondary3); + } + public ColorUIResource getSecondary4() + { + return ColorBlind.getDichromatColorUIResource(secondary4); + } + + public ColorUIResource getBlack() + { + return ColorBlind.getDichromatColorUIResource(black); + } + public ColorUIResource getWhite() + { + return ColorBlind.getDichromatColorUIResource(white); + } + + /** + * Control Font (plain) + * @return font + */ + protected static FontUIResource _getControlTextFont() + { + if (controlFont == null) + { + try + { + controlFont = new FontUIResource(Font.getFont("swing.plaf.metal.controlFont", + new Font(FONT_DEFAULT, Font.PLAIN, FONT_SIZE))); + } + catch (Exception e) + { + controlFont = new FontUIResource(FONT_DEFAULT, Font.PLAIN, FONT_SIZE); + } + } + return controlFont; + } + public FontUIResource getControlTextFont() {return _getControlTextFont();} + + /** + * System Font + * @return font + */ + protected static FontUIResource _getSystemTextFont() + { + if (systemFont == null) + { + try + { + systemFont = new FontUIResource(Font.getFont("swing.plaf.metal.systemFont", + new Font(FONT_DEFAULT, Font.PLAIN, FONT_SIZE))); + } + catch (Exception e) + { + systemFont = new FontUIResource(FONT_DEFAULT, Font.PLAIN, FONT_SIZE); + } + } + return systemFont; + } + public FontUIResource getSystemTextFont() {return _getSystemTextFont();} + + /** + * User Font + * @return font + */ + protected static FontUIResource _getUserTextFont() + { + if (userFont == null) + { + try + { + userFont = new FontUIResource(Font.getFont("swing.plaf.metal.userFont", + new Font(FONT_DEFAULT, Font.PLAIN, FONT_SIZE))); + } + catch (Exception e) + { + userFont = new FontUIResource(FONT_DEFAULT, Font.PLAIN, FONT_SIZE); + } + } + return userFont; + } + public FontUIResource getUserTextFont() {return _getUserTextFont();} + + /** + * Menu + * @return font + */ + protected static FontUIResource _getMenuTextFont() + { + if (menuFont == null) + { + try + { + menuFont = new FontUIResource(Font.getFont("swing.plaf.metal.menuFont", + new Font(FONT_DEFAULT, Font.PLAIN, FONT_SIZE))); + } + catch (Exception e) + { + menuFont = new FontUIResource(FONT_DEFAULT, Font.PLAIN, FONT_SIZE); + } + } + return menuFont; + } + public FontUIResource getMenuTextFont() {return _getMenuTextFont();} + + /** + * Window Title + * @return font + */ + protected static FontUIResource _getWindowTitleFont() + { + if (windowFont == null) + { + try + { + windowFont = new FontUIResource(Font.getFont("swing.plaf.metal.windowFont", + new Font(FONT_DEFAULT, Font.BOLD, FONT_SIZE+2))); + } + catch (Exception e) + { + windowFont = new FontUIResource(FONT_DEFAULT, Font.BOLD, FONT_SIZE+2); + } + } + return windowFont; + } + public FontUIResource getWindowTitleFont() {return _getWindowTitleFont();} + + /** + * Sub Text + * @return font + */ + protected static FontUIResource _getSubTextFont() + { + if (smallFont == null) + { + try + { + smallFont = new FontUIResource(Font.getFont("swing.plaf.metal.smallFont", + new Font(FONT_DEFAULT, Font.PLAIN, FONT_SIZE-2))); + } + catch (Exception e) + { + smallFont = new FontUIResource(FONT_DEFAULT, Font.PLAIN, FONT_SIZE-2); + } + } + return smallFont; + } + public FontUIResource getSubTextFont() {return _getSubTextFont();} + + // Static property info + + private static final String P_Primary1 = "#ColorPrimary1"; + private static final String P_Primary2 = "#ColorPrimary2"; + private static final String P_Primary3 = "#ColorPrimary3"; + private static final String P_Secondary1 = "#ColorSecondary1"; + private static final String P_Secondary2 = "#ColorSecondary2"; + private static final String P_Secondary3 = "#ColorSecondary3"; + private static final String P_Black = "#ColorBlack"; + private static final String P_White = "#ColorWhite"; + private static final String P_Error = "#ColorError"; + private static final String P_Info = "#ColorInfo"; + private static final String P_Mandatory = "#ColorMandatory"; + private static final String P_Inactive = "#ColorInactive"; + private static final String P_Txt_OK = "#ColorTextOK"; + private static final String P_Txt_Error = "#ColorTextError"; + // + private static final String P_Control = "#FontControl"; + private static final String P_System = "#FontSystem"; + private static final String P_User = "#FontUser"; + private static final String P_Small = "#FontSmall"; + private static final String P_Window = "#FontWindow"; + private static final String P_Menu = "#FontMenu"; + /** Background Color */ + protected static final String P_AdempiereColor = "#AdempiereColor"; + + /** + * Save information in Properties + */ + public static void save () + { + log.config(AdempiereColor.getDefaultBackground().toString()); + // + Ini.setProperty(P_Primary1, getColorAsString(primary1)); + Ini.setProperty(P_Primary2, getColorAsString(primary2)); + Ini.setProperty(P_Primary3, getColorAsString(primary3)); + Ini.setProperty(P_Secondary1, getColorAsString(secondary1)); + Ini.setProperty(P_Secondary2, getColorAsString(secondary2)); + Ini.setProperty(P_Secondary3, getColorAsString(secondary3)); + Ini.setProperty(P_Error, getColorAsString(error)); + Ini.setProperty(P_Info, getColorAsString(info)); + Ini.setProperty(P_Mandatory, getColorAsString(mandatory)); + Ini.setProperty(P_Inactive, getColorAsString(inactive)); + Ini.setProperty(P_White, getColorAsString(white)); + Ini.setProperty(P_Black, getColorAsString(black)); + Ini.setProperty(P_Txt_OK, getColorAsString(txt_ok)); + Ini.setProperty(P_Txt_Error, getColorAsString(txt_error)); + // + Ini.setProperty(P_Control, ((Font)controlFont).toString()); + Ini.setProperty(P_System, ((Font)systemFont).toString()); + Ini.setProperty(P_User, ((Font)userFont).toString()); + Ini.setProperty(P_Small, ((Font)smallFont).toString()); + Ini.setProperty(P_Window, ((Font)windowFont).toString()); + Ini.setProperty(P_Menu, ((Font)menuFont).toString()); + // + AdempiereColor cc = AdempiereColor.getDefaultBackground(); + Ini.setProperty(P_AdempiereColor, cc.toString()); + } // save + + + /** + * Parses Color into String representation. + * Required as SystemColors and Alpha Colors have different formats + * @param c Color + * @return [r=102,g=102,b=153,a=255] + * @see #parseColor + */ + public static String getColorAsString (Color c) + { + if (c == null) + c = SystemColor.control; + StringBuffer sb = new StringBuffer("[r=").append(c.getRed()) + .append(",g=").append(c.getGreen()) + .append(",b=").append(c.getBlue()) + .append(",a=").append(c.getAlpha()) + .append("]"); + // System.out.println(sb.toString()); + return sb.toString(); + } // getColorAsString + + /** + * Load Properties from Ini + */ + public static void load () + { + primary1 = parseColor (Ini.getProperty(P_Primary1), primary1); + primary2 = parseColor (Ini.getProperty(P_Primary2), primary2); + primary3 = parseColor (Ini.getProperty(P_Primary3), primary3); + secondary1 = parseColor (Ini.getProperty(P_Secondary1), secondary1); + secondary2 = parseColor (Ini.getProperty(P_Secondary2), secondary2); + secondary3 = parseColor (Ini.getProperty(P_Secondary3), secondary3); + error = parseColor(Ini.getProperty(P_Error), error); + info = parseColor(Ini.getProperty(P_Info), info); + mandatory = parseColor(Ini.getProperty(P_Mandatory), mandatory); + inactive = parseColor(Ini.getProperty(P_Inactive), inactive); + white = parseColor(Ini.getProperty(P_White), white); + black = parseColor(Ini.getProperty(P_Black), black); + txt_ok = parseColor(Ini.getProperty(P_Txt_OK), txt_ok); + txt_error = parseColor(Ini.getProperty(P_Txt_Error), txt_error); + // + controlFont = parseFont(Ini.getProperty(P_Control), controlFont); + systemFont = parseFont(Ini.getProperty(P_System), systemFont); + userFont = parseFont(Ini.getProperty(P_User), userFont); + smallFont = parseFont(Ini.getProperty(P_Small), smallFont); + windowFont = parseFont(Ini.getProperty(P_Window), windowFont); + menuFont = parseFont(Ini.getProperty(P_Menu), menuFont); + // + AdempiereColor cc = AdempiereColor.parse(Ini.getProperty(P_AdempiereColor)); + AdempiereColor.setDefaultBackground(cc); + } // load + + /** + * Reset Info in Properties + */ + public static void reset () + { +/** + Ini.remove (P_Primary1); + Ini.remove (P_Primary2); + Ini.remove (P_Primary3); + Ini.remove (P_Secondary1); + Ini.remove (P_Secondary2); + Ini.remove (P_Secondary3); + Ini.remove (P_Error); + Ini.remove (P_Info); + Ini.remove (P_Mandatory); + Ini.remove (P_Inactive); + Ini.remove (P_White); + Ini.remove (P_Black); + Ini.remove (P_Txt_OK); + Ini.remove (P_Txt_Error); + // + Ini.remove (P_Control); + Ini.remove (P_System); + Ini.remove (P_User); + Ini.remove (P_Small); + Ini.remove (P_Window); + Ini.remove (P_Menu); + // AdempiereColor + Ini.remove(P_AdempiereColor); +**/ + // Initialize + Ini.setProperty(Ini.P_UI_LOOK, CompiereLookAndFeel.NAME); + Ini.setProperty(Ini.P_UI_THEME, s_name); + // + if (s_theme != null) + s_theme.setDefault(); + + // Background + // AdempiereColor cc = new AdempiereColor(SystemColor.control); // flat Windows 212-208-200 + // AdempiereColor cc = new AdempiereColor(secondary3); // flat Metal 204-204-204 + AdempiereColor cc = new AdempiereColor(secondary3, false); + AdempiereColor.setDefaultBackground (cc); + // + save(); // save properties + } // reset + + /** + * Parse Color. + *

+ * Color - [r=102,g=102,b=153,a=0] + * + * @param information string information to be parsed + * @param stdColor color used if info cannot parsed + * @return color + * @see #getColorAsString + */ + protected static ColorUIResource parseColor (String information, ColorUIResource stdColor) + { + if (information == null + || information.length() == 0 + || information.trim().length() == 0) + return stdColor; + // System.out.print("ParseColor=" + info); + try + { + int r = Integer.parseInt(information.substring(information.indexOf("r=")+2, information.indexOf(",g="))); + int g = Integer.parseInt(information.substring(information.indexOf("g=")+2, information.indexOf(",b="))); + int b = 0; + int a = 255; + if (information.indexOf("a=") == -1) + b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf("]"))); + else + { + b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf(",a="))); + a = Integer.parseInt(information.substring(information.indexOf("a=")+2, information.indexOf("]"))); + } + ColorUIResource retValue = new ColorUIResource(new Color(r, g, b, a)); + // System.out.println(" - " + retValue.toString()); + return retValue; + } + catch (Exception e) + { + log.config(information + " - cannot parse: " + e.toString()); + } + return stdColor; + } // parseColor + + /** + * Parse Font + *

+ * javax.swing.plaf.FontUIResource[family=dialog.bold,name=Dialog,style=bold,size=12] + * + * @param information string information to be parsed + * @param stdFont font used if info cannot be parsed + * @return font + */ + private static FontUIResource parseFont(String information, FontUIResource stdFont) + { + if (information == null + || information.length() == 0 + || information.trim().length() == 0) + return stdFont; + // System.out.print("ParseFont=" + info); + try + { + String name = information.substring(information.indexOf("name=")+5, information.indexOf(",style=")); + String s = information.substring(information.indexOf("style=")+6, information.indexOf(",size=")); + int style = Font.PLAIN; + if (s.equals("bold")) + style = Font.BOLD; + else if (s.equals("italic")) + style = Font.ITALIC; + else if (s.equals("bolditalic")) + style = Font.BOLD | Font.ITALIC; + int size = Integer.parseInt(information.substring(information.indexOf(",size=")+6, information.lastIndexOf("]"))); + FontUIResource retValue = new FontUIResource(name,style,size); + // System.out.println(" - " + retValue.toString()); + return retValue; + } + catch (Exception e) + { + log.config(information + " - cannot parse: " + e.toString()); + } + return stdFont; + } // parseFont + +} // AdempiereTheme diff --git a/looks/src/org/compiere/plaf/CompiereThemeBlueMetal.java b/looks/src/org/compiere/plaf/CompiereThemeBlueMetal.java new file mode 100644 index 0000000000..c1d3e8cb18 --- /dev/null +++ b/looks/src/org/compiere/plaf/CompiereThemeBlueMetal.java @@ -0,0 +1,100 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import javax.swing.plaf.*; + +/** + * Adempiere default Blue Metal Color Theme + * + * @author Jorg Janke, Adam Michau + * @version $Id: AdempiereThemeBlueMetal.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CompiereThemeBlueMetal extends CompiereTheme +{ + /** + * Adempiere default Theme Blue Metal + */ + public CompiereThemeBlueMetal() + { + setDefault(); + s_theme = this; + s_name = NAME; + } // AdempiereThemeBlueMetal + + /** Name */ + public static final String NAME = "Compiere Theme"; + + /** + * Set Defaults + */ + protected void setDefault() + { + /** Blue 102, 102, 153 */ + primary1 = new ColorUIResource(102, 102, 153); + /** Blue 153, 153, 204 */ + primary2 = new ColorUIResource(153, 153, 204); + /** Blue 204, 204, 255 */ + primary3 = new ColorUIResource(204, 204, 255); + /** Gray 102, 102, 102 */ + secondary1 = new ColorUIResource(102, 102, 102); + /** Gray 153, 153, 153 */ + secondary2 = new ColorUIResource(153, 153, 153); + /** BlueGray 214, 224, 234 - background */ + secondary3 = new ColorUIResource(205, 215, 231); + + /** Black */ + black = new ColorUIResource(Color.black); + /** White */ + white = new ColorUIResource(Color.white); + + /** Background for mandatory fields */ + mandatory = new ColorUIResource(224, 224, 255); // blue-isch + /** Background for fields in error */ + error = new ColorUIResource(255, 204, 204); // red-isch + /** Background for inactive fields */ + inactive = new ColorUIResource(234, 234, 234); // light gray + /** Background for info fields */ + info = new ColorUIResource(253, 237, 207); // light yellow + + /** Foreground Text OK */ + txt_ok = new ColorUIResource(51, 51, 102); // dark blue + /** Foreground Text Error */ + txt_error = new ColorUIResource(204, 0, 0); // dark red + + /** Control font */ + controlFont = null; + _getControlTextFont(); + /** System font */ + systemFont = null; + _getSystemTextFont(); + /** User font */ + userFont = null; + _getUserTextFont(); + /** Small font */ + smallFont = null; + _getSubTextFont(); + /** Window Title font */ + windowFont = null; + _getWindowTitleFont(); + /** Menu font */ + menuFont = null; + _getMenuTextFont(); + } // setDefault + +} // AdempiereThemeBlueMetal diff --git a/looks/src/org/compiere/plaf/CompiereThemeIce.java b/looks/src/org/compiere/plaf/CompiereThemeIce.java new file mode 100644 index 0000000000..23d0c69f28 --- /dev/null +++ b/looks/src/org/compiere/plaf/CompiereThemeIce.java @@ -0,0 +1,100 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import javax.swing.plaf.*; + +/** + * Adempiere Theme Ice + * + * @author Jorg Janke, Adam Michau + * @version $Id: AdempiereThemeIce.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CompiereThemeIce extends CompiereTheme +{ + /** + * Adempiere Theme: Ice + */ + public CompiereThemeIce () + { + setDefault(); + s_theme = this; + s_name = NAME; + } // AdempiereThemeBlueMetal + + /** Name */ + public static final String NAME = "Compiere Ice"; + + /** + * Set Defaults + */ + protected void setDefault() + { + /** Blue 102, 102, 153 */ + primary1 = new ColorUIResource(210, 226, 239); + /** Blue 153, 153, 204 */ + primary2 = new ColorUIResource(233, 240, 248); + /** Blue 204, 204, 255 */ + primary3 = new ColorUIResource(167, 198, 227); + /** Gray 102, 102, 102 */ + secondary1 = new ColorUIResource(102, 102, 102); + /** Gray 153, 153, 153 */ + secondary2 = new ColorUIResource(153, 153, 153); + /** BlueGray 214, 224, 234 - background */ + secondary3 = new ColorUIResource(210, 226, 239); + + /** Black */ + black = new ColorUIResource(Color.black); + /** White */ + white = new ColorUIResource(Color.white); + + /** Background for mandatory fields */ + mandatory = new ColorUIResource(224, 224, 255); // blue-isch + /** Background for fields in error */ + error = new ColorUIResource(255, 204, 204); // red-isch + /** Background for inactive fields */ + inactive = new ColorUIResource(234, 234, 234); // light gray + /** Background for info fields */ + info = new ColorUIResource(253, 237, 207); // light yellow + + /** Foreground Text OK */ + txt_ok = new ColorUIResource(51, 51, 102); // dark blue + /** Foreground Text Error */ + txt_error = new ColorUIResource(204, 0, 0); // dark red + + /** Control font */ + controlFont = null; + _getControlTextFont(); + /** System font */ + systemFont = null; + _getSystemTextFont(); + /** User font */ + userFont = null; + _getUserTextFont(); + /** Small font */ + smallFont = null; + _getSubTextFont(); + /** Window Title font */ + windowFont = null; + _getWindowTitleFont(); + /** Menu font */ + menuFont = null; + _getMenuTextFont(); + } // setDefault + +} // AdempiereThemeIce diff --git a/looks/src/org/compiere/plaf/ContrastTheme.java b/looks/src/org/compiere/plaf/ContrastTheme.java new file mode 100644 index 0000000000..b2937c3241 --- /dev/null +++ b/looks/src/org/compiere/plaf/ContrastTheme.java @@ -0,0 +1,177 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +/* + * @(#)ContrastTheme.java 1.10 04/07/26 + */ +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; +import javax.swing.plaf.metal.*; +import javax.swing.*; +import javax.swing.border.*; + +/** + * This class describes a higher-contrast Metal Theme. + * + * @version 1.10 07/26/04 + * @author Michael C. Albers, Jorg Janke + */ +public class ContrastTheme extends DefaultMetalTheme +{ + + public String getName () + { + return "Contrast"; + } + + private final ColorUIResource primary1 + = new ColorUIResource (0, 0, 0); + + private final ColorUIResource primary2 + = new ColorUIResource (204, 204, 204); + + private final ColorUIResource primary3 + = new ColorUIResource (255, 255, 255); + + private final ColorUIResource primaryHighlight + = new ColorUIResource (102, 102, 102); + + private final ColorUIResource secondary2 + = new ColorUIResource (204, 204, 204); + + private final ColorUIResource secondary3 + = new ColorUIResource (255, 255, 255); + + private final ColorUIResource controlHighlight + = new ColorUIResource (102, 102, 102); + + protected ColorUIResource getPrimary1 () + { + return primary1; + } + + protected ColorUIResource getPrimary2 () + { + return primary2; + } + + protected ColorUIResource getPrimary3 () + { + return primary3; + } + + public ColorUIResource getPrimaryControlHighlight () + { + return primaryHighlight; + } + + protected ColorUIResource getSecondary2 () + { + return secondary2; + } + + protected ColorUIResource getSecondary3 () + { + return secondary3; + } + + public ColorUIResource getControlHighlight () + { + return super.getSecondary3 (); + } + + public ColorUIResource getFocusColor () + { + return getBlack (); + } + + public ColorUIResource getTextHighlightColor () + { + return getBlack (); + } + + public ColorUIResource getHighlightedTextColor () + { + return getWhite (); + } + + public ColorUIResource getMenuSelectedBackground () + { + return getBlack (); + } + + public ColorUIResource getMenuSelectedForeground () + { + return getWhite (); + } + + public ColorUIResource getAcceleratorForeground () + { + return getBlack (); + } + + public ColorUIResource getAcceleratorSelectedForeground () + { + return getWhite (); + } + + public void addCustomEntriesToTable (UIDefaults table) + { + Border blackLineBorder = new BorderUIResource + (new LineBorder(getBlack ())); + Border whiteLineBorder = new BorderUIResource( + new LineBorder(getWhite())); + // + Object textBorder = new BorderUIResource (new CompoundBorder + (blackLineBorder, new BasicBorders.MarginBorder())); + + // Enhancements + Object[] defaults = new Object[] + { + "ToolTip.border", blackLineBorder, + "TitledBorder.border", blackLineBorder, + "TextField.border", textBorder, + "PasswordField.border", textBorder, + "TextArea.border", textBorder, + "TextPane.border", textBorder, + "EditorPane.border", textBorder, + // + "ComboBox.background", getWindowBackground (), + "ComboBox.foreground", getUserTextColor (), + "ComboBox.selectionBackground", getTextHighlightColor (), + "ComboBox.selectionForeground", getHighlightedTextColor (), + "ProgressBar.foreground", getUserTextColor (), + "ProgressBar.background", getWindowBackground (), + "ProgressBar.selectionForeground", getWindowBackground (), + "ProgressBar.selectionBackground", getUserTextColor (), + "OptionPane.errorDialog.border.background", getPrimary1 (), + "OptionPane.errorDialog.titlePane.foreground", getPrimary3 (), + "OptionPane.errorDialog.titlePane.background", getPrimary1 (), + "OptionPane.errorDialog.titlePane.shadow", getPrimary2 (), + "OptionPane.questionDialog.border.background", getPrimary1 (), + "OptionPane.questionDialog.titlePane.foreground", getPrimary3 (), + "OptionPane.questionDialog.titlePane.background", getPrimary1 (), + "OptionPane.questionDialog.titlePane.shadow", getPrimary2 (), + "OptionPane.warningDialog.border.background", getPrimary1 (), + "OptionPane.warningDialog.titlePane.foreground", getPrimary3 (), + "OptionPane.warningDialog.titlePane.background", getPrimary1 (), + "OptionPane.warningDialog.titlePane.shadow", getPrimary2 (), + }; + table.putDefaults (defaults); + } +} diff --git a/looks/src/org/compiere/plaf/EmeraldTheme.java b/looks/src/org/compiere/plaf/EmeraldTheme.java new file mode 100644 index 0000000000..b1af55b8c8 --- /dev/null +++ b/looks/src/org/compiere/plaf/EmeraldTheme.java @@ -0,0 +1,58 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +/* + * @(#)EmeraldTheme.java 1.9 04/07/26 + */ + +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +/** + * This class describes a theme using glowing green colors. + * + * @version 1.9 07/26/04 + * @author Jeff Dinkins + */ +public class EmeraldTheme extends DefaultMetalTheme { + + public String getName() + { + return "Emerald"; + } + + private final ColorUIResource primary1 = new ColorUIResource(51, 142, 71); + private final ColorUIResource primary2 = new ColorUIResource(102, 193, 122); + private final ColorUIResource primary3 = new ColorUIResource(153, 244, 173); + + protected ColorUIResource getPrimary1 () + { + return primary1; + } + + protected ColorUIResource getPrimary2 () + { + return primary2; + } + + protected ColorUIResource getPrimary3 () + { + return primary3; + } + +} diff --git a/looks/src/org/compiere/plaf/FontChooser.java b/looks/src/org/compiere/plaf/FontChooser.java new file mode 100644 index 0000000000..346b50614b --- /dev/null +++ b/looks/src/org/compiere/plaf/FontChooser.java @@ -0,0 +1,306 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import org.compiere.swing.*; + +/** + * Font Chooser Dialog + * + * @author Jorg Janke + * @version $Id: FontChooser.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class FontChooser extends CDialog + implements ActionListener +{ + /** + * Show Dialog with initial font and return selected font + * @param owner Base window + * @param title Chooser Title + * @param initFont initial font + * @return selected font + */ + public static Font showDialog (Dialog owner, String title, Font initFont) + { + Font retValue = initFont; + FontChooser fc = new FontChooser(owner, title, initFont); + retValue = fc.getFont(); + fc = null; + return retValue; + } // showDialog + + + /************************************************************************** + * Constructor + * + * @param owner Base window + * @param title Chooser Title + * @param initFont Initial Font + */ + public FontChooser(Dialog owner, String title, Font initFont) + { + super(owner, title, true); + try + { + jbInit(); + dynInit(); + setFont(initFont); + AdempierePLAF.showCenterScreen(this); + } + catch(Exception ex) + { + System.err.println ("FontChooser"); + ex.printStackTrace(); + } + } // FontChooser + + /** + * IDE Constructor + */ + public FontChooser() + { + this (null, s_res.getString("FontChooser"), null); + } // FontChooser + + static ResourceBundle s_res = ResourceBundle.getBundle("org.compiere.plaf.PlafRes"); + + /** Static list of Styles */ + public static FontStyle[] s_list = { + new FontStyle(s_res.getString("Plain"), Font.PLAIN), + new FontStyle(s_res.getString("Italic"), Font.ITALIC), + new FontStyle(s_res.getString("Bold"), Font.BOLD), + new FontStyle(s_res.getString("BoldItalic"), Font.BOLD|Font.ITALIC)}; + + private Font m_font = super.getFont(); + private Font m_retFont = null; + + private boolean m_setting = false; + + private CPanel mainPanel = new CPanel(); + private BorderLayout mainLayout = new BorderLayout(); + private CPanel selectPanel = new CPanel(); + private CLabel nameLabel = new CLabel(); + private CComboBox fontName = new CComboBox(); + private CLabel sizeLabel = new CLabel(); + private CLabel styleLabel = new CLabel(); + private CComboBox fontStyle = new CComboBox(); + private CComboBox fontSize = new CComboBox(); + private JTextArea fontTest = new JTextArea(); + private JTextArea fontInfo = new JTextArea(); + private GridBagLayout selectLayout = new GridBagLayout(); + private CPanel confirmPanel = new CPanel(); + private CButton bCancel = AdempierePLAF.getCancelButton(); + private CButton bOK = AdempierePLAF.getOKButton(); + private FlowLayout confirmLayout = new FlowLayout(); + + /** + * Static Layout + * @throws Exception + */ + private void jbInit() throws Exception + { + mainPanel.setLayout(mainLayout); + nameLabel.setText(s_res.getString("Name")); + selectPanel.setLayout(selectLayout); + sizeLabel.setText(s_res.getString("Size")); + styleLabel.setText(s_res.getString("Style")); + fontTest.setText(s_res.getString("TestString")); + fontTest.setLineWrap(true); + fontTest.setWrapStyleWord(true); + fontTest.setBackground(AdempierePLAF.getFieldBackground_Inactive()); + fontTest.setBorder(BorderFactory.createLoweredBevelBorder()); + fontTest.setPreferredSize(new Dimension(220, 100)); + fontInfo.setText(s_res.getString("FontString")); + fontInfo.setLineWrap(true); + fontInfo.setWrapStyleWord(true); + fontInfo.setBackground(AdempierePLAF.getFieldBackground_Inactive()); + fontInfo.setOpaque(false); + fontInfo.setEditable(false); + confirmPanel.setLayout(confirmLayout); + confirmLayout.setAlignment(FlowLayout.RIGHT); + confirmPanel.setOpaque(false); + selectPanel.setOpaque(false); + getContentPane().add(mainPanel); + mainPanel.add(selectPanel, BorderLayout.CENTER); + selectPanel.add(nameLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + selectPanel.add(fontName, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + selectPanel.add(sizeLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + selectPanel.add(styleLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 + ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + selectPanel.add(fontStyle, new GridBagConstraints(1, 2, 2, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + selectPanel.add(fontSize, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0 + ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); + selectPanel.add(fontTest, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(20, 5, 5, 5), 0, 0)); + selectPanel.add(fontInfo, new GridBagConstraints(0, 4, 2, 1, 0.0, 0.0 + ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 5, 10, 5), 0, 0)); + // + mainPanel.add(confirmPanel, BorderLayout.SOUTH); + confirmPanel.add(bCancel, null); + confirmPanel.add(bOK, null); + bCancel.addActionListener(this); + bOK.addActionListener(this); + } // jbInit + + /** + * Dynamic Init + */ + private void dynInit() + { + String[] names = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); + Arrays.sort(names); + for (int i = 0; i < names.length; i++) + fontName.addItem(names[i]); + fontName.addActionListener(this); + // + for (int i = 6; i < 32; i++) + fontSize.addItem(String.valueOf(i)); + fontSize.addActionListener(this); + // + for (int i = 0; i < s_list.length; i++) + fontStyle.addItem(s_list[i]); + fontStyle.addActionListener(this); + } // dynInit + + /** + * Set Font - sets font for chooser - not the component font + * @param font + */ + public void setFont(Font font) + { + if (font == null) + return; + // Log.trace("FontChooser.setFont - " + font.toString()); + if (m_retFont == null) + m_retFont = font; + // + fontTest.setFont(font); + fontInfo.setFont(font); + fontInfo.setText(font.toString()); + // + m_setting = true; + fontName.setSelectedItem(font.getName()); + if (!fontName.getSelectedItem().equals(font.getName())) + System.err.println("FontChooser.setFont" + fontName.getSelectedItem().toString() + " <> " + font.getName()); + // + fontSize.setSelectedItem(String.valueOf(font.getSize())); + if (!fontSize.getSelectedItem().equals(String.valueOf(font.getSize()))) + System.err.println("FontChooser.setFont" + fontSize.getSelectedItem() + " <> " + font.getSize()); + // find style + for (int i = 0; i < s_list.length; i++) + if (s_list[i].getID() == font.getStyle()) + fontStyle.setSelectedItem(s_list[i]); + if (((FontStyle)fontStyle.getSelectedItem()).getID() != font.getStyle()) + System.err.println("FontChooser.setFont" + ((FontStyle)fontStyle.getSelectedItem()).getID() + " <> " + font.getStyle()); + // + m_font = font; + this.pack(); + m_setting = false; + } // setFont + + /** + * Return selected font + * @return font + */ + public Font getFont() + { + return m_retFont; + } // getFont + + /** + * ActionListener + * @param e + */ + public void actionPerformed(ActionEvent e) + { + if (m_setting) + return; + + if (e.getSource() == bOK) + { + m_retFont = m_font; + dispose(); + } + + else if (e.getSource() == bCancel) + dispose(); + + else if (e.getSource() == fontName) + { + String s = fontName.getSelectedItem().toString(); + m_font = new Font(s, m_font.getStyle(), m_font.getSize()); + } + else if (e.getSource() == fontSize) + { + String s = fontSize.getSelectedItem().toString(); + m_font = new Font(m_font.getName(), m_font.getStyle(), Integer.parseInt(s)); + } + else if (e.getSource() == fontStyle) + { + FontStyle fs = (FontStyle)fontStyle.getSelectedItem(); + m_font = new Font(m_font.getName(), fs.getID(), m_font.getSize()); + } + // System.out.println("NewFont - " + m_font.toString()); + setFont(m_font); + } // actionPerformed +} // FontChooser + +/** + * Font Style Value Object + */ +class FontStyle +{ + /** + * Create FontStyle + * @param name + * @param id + */ + public FontStyle(String name, int id) + { + m_name = name; + m_id = id; + } // FontStyle + + private String m_name; + private int m_id; + + /** + * Get Name + * @return name + */ + public String toString() + { + return m_name; + } // getName + + /** + * Get int value of Font Style + * @return id + */ + public int getID() + { + return m_id; + } // getID +} // FontStyle diff --git a/looks/src/org/compiere/plaf/PlafRes.java b/looks/src/org/compiere/plaf/PlafRes.java new file mode 100644 index 0000000000..7f4617afd5 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Jorg Janke + * @version $Id: PlafRes.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Background Color Type" }, + { "BackColType_Flat", "Flat" }, + { "BackColType_Gradient", "Gradient" }, + { "BackColType_Lines", "Lines" }, + { "BackColType_Texture", "Texture" }, + // + { "LookAndFeelEditor", "Look & Feel Editor" }, + { "LookAndFeel", "Look & Feel" }, + { "Theme", "Theme" }, + { "EditAdempiereTheme", "Edit Adempiere Theme" }, + { "SetDefault", "Default Background" }, + { "SetDefaultColor", "Background Color" }, + { "ColorBlind", "Color Deficiency" }, + { "Example", "Example" }, + { "Reset", "Reset" }, + { "OK", "OK" }, + { "Cancel", "Cancel" }, + // + { "AdempiereThemeEditor", "Adempiere Theme Editor" }, + { "MetalColors", "Metal Colors" }, + { "AdempiereColors", "Adempiere Colors" }, + { "AdempiereFonts", "Adempiere Fonts" }, + { "Primary1Info", "Shadow, Separator" }, + { "Primary1", "Primary 1" }, + { "Primary2Info", "Focus Line, Selected Menu" }, + { "Primary2", "Primary 2" }, + { "Primary3Info", "Table Selected Row, Selected Text, ToolTip Background" }, + { "Primary3", "Primary 3" }, + { "Secondary1Info", "Border Lines" }, + { "Secondary1", "Secondary 1" }, + { "Secondary2Info", "Inactive Tabs, Pressed Fields, Inactive Border + Text" }, + { "Secondary2", "Secondary 2" }, + { "Secondary3Info", "Background" }, + { "Secondary3", "Secondary 3" }, + // + { "ControlFontInfo", "Control Font" }, + { "ControlFont", "Label Font" }, + { "SystemFontInfo", "Tool Tip, Tree nodes" }, + { "SystemFont", "System Font" }, + { "UserFontInfo", "User Entered Data" }, + { "UserFont", "Field Font" }, +// { "SmallFontInfo", "Reports" }, + { "SmallFont", "Small Font" }, + { "WindowTitleFont", "Title Font" }, + { "MenuFont", "Menu Font" }, + // + { "MandatoryInfo", "Mandatory Field Background" }, + { "Mandatory", "Mandatory" }, + { "ErrorInfo", "Error Field Background" }, + { "Error", "Error" }, + { "InfoInfo", "Info Field Background" }, + { "Info", "Info" }, + { "WhiteInfo", "Lines" }, + { "White", "White" }, + { "BlackInfo", "Lines, Text" }, + { "Black", "Black" }, + { "InactiveInfo", "Inactive Field Background" }, + { "Inactive", "Inactive" }, + { "TextOKInfo", "OK Text Foreground" }, + { "TextOK", "Text - OK" }, + { "TextIssueInfo", "Error Text Foreground" }, + { "TextIssue", "Text - Error" }, + // + { "FontChooser", "Font Chooser" }, + { "Fonts", "Fonts" }, + { "Plain", "Plain" }, + { "Italic", "Italic" }, + { "Bold", "Bold" }, + { "BoldItalic", "Bold & Italic" }, + { "Name", "Name" }, + { "Size", "Size" }, + { "Style", "Style" }, + { "TestString", "This is just a Test! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Font" }, + // + { "AdempiereColorEditor", "Adempiere Color Editor" }, + { "AdempiereType", "Color Type" }, + { "GradientUpperColor", "Gradient Upper Color" }, + { "GradientLowerColor", "Gradient Lower Color" }, + { "GradientStart", "Gradient Start" }, + { "GradientDistance", "Gradient Distance" }, + { "TextureURL", "Texture URL" }, + { "TextureAlpha", "Texture Alpha" }, + { "TextureTaintColor", "Texture Taint Color" }, + { "LineColor", "Line Color" }, + { "LineBackColor", "Background Color" }, + { "LineWidth", "Line Width" }, + { "LineDistance", "Line Distance" }, + { "FlatColor", "Flat Color" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_ar.java b/looks/src/org/compiere/plaf/PlafRes_ar.java new file mode 100644 index 0000000000..724b6ae95a --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_ar.java @@ -0,0 +1,132 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * @author Nizar Khalifa Sallem - OXIA Tunisia + * @version $Id: PlafRes_ar.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_ar extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "\u0646\u0648\u0639 \u0644\u0648\u0646 \u0627\u0644\u062e\u0644\u0641\u064a\u0651\u064e\u0629" }, + { "BackColType_Flat", "\u0645\u0633\u0637\u0651\u064e\u062d" }, + { "BackColType_Gradient", "\u062a\u062f\u0631\u0651\u064f\u062c" }, + { "BackColType_Lines", "\u0623\u0633\u0637\u0631" }, + { "BackColType_Texture", "\u0646\u0633\u064a\u062c" }, + // + { "LookAndFeelEditor", "\u0645\u0639\u0650\u062f \u0623\u0646\u0638\u0631 \u0648 \u0623\u062d\u0633" }, + { "LookAndFeel", "\u0623\u0646\u0638\u0631 \u0648 \u0623\u062d\u0633" }, + { "Theme", "\u0633\u0645\u0629" }, + { "EditAdempiereTheme", "\u0623\u0639\u062f \u0633\u0645\u0629 \u0643\u0645\u0628\u064a\u0631" }, + { "SetDefault", "\u0627\u0644\u062e\u0644\u0641\u064a\u0651\u064e\u0629 \u0627\u0644\u0627\u0650\u0641\u062a\u0631\u0627\u0636\u064a\u0651\u064e\u0629" }, + { "SetDefaultColor", "\u0644\u0648\u0646 \u0627\u0644\u062e\u0644\u0641\u064a\u0651\u064e\u0629" }, + { "ColorBlind", "\u0639\u0645\u0649 \u0627\u0644\u0623\u0644\u0648\u0627\u0646" }, + { "Example", "\u0645\u062b\u0627\u0644" }, + { "Reset", "\u0625\u0639\u0627\u062f\u0629 \u0636\u0628\u0637" }, + { "OK", "\u0646\u0639\u0645" }, + { "Cancel", "\u0625\u0644\u063a\u0627\u0621" }, + // + { "AdempiereThemeEditor", "\u0645\u0639\u062f \u0633\u0645\u0629 \u0643\u0645\u0628\u064a\u0631" }, + { "MetalColors", "\u0623\u0644\u0648\u0627\u0646 \u0645\u0639\u062f\u0646\u064a\u0651\u064e\u0629" }, + { "AdempiereColors", "\u0623\u0644\u0648\u0627\u0646 \u0643\u0645\u0628\u064a\u0631" }, + { "AdempiereFonts", "\u062e\u0637\u0648\u0637 \u0643\u0645\u0628\u064a\u0631" }, + { "Primary1Info", "\u0638\u0644\u060c \u0641\u0627\u0635\u0644" }, + { "Primary1", "\u0623\u0648\u0651\u064e\u0644\u064a 1" }, + { "Primary2Info", "\u0633\u0637\u0631 \u0645\u0631\u0643\u0651\u064e\u0632 \u0639\u0644\u064a\u0647\u060c \u0642\u0627\u0626\u0645\u0629 \u0645\u062e\u062a\u0627\u0631\u0629" }, + { "Primary2", "\u0623\u0648\u0651\u064e\u0644\u064a 2" }, + { "Primary3Info", "\u0633\u0637\u0631 \u0645\u062e\u062a\u0627\u0631 \u0645\u0646 \u062c\u062f\u0648\u0644\u060c \u0646\u0635 \u0645\u062e\u062a\u0627\u0631\u060c \u062e\u0644\u0641\u064a\u0651\u064e\u0629 \u0646\u0635 \u0639\u0631\u0636\u064a" }, + { "Primary3", "\u0623\u0648\u0651\u064e\u0644\u064a 3" }, + { "Secondary1Info", "\u0623\u0633\u0637\u0631 \u062d\u062f" }, + { "Secondary1", "\u062b\u0627\u0646\u0648\u064a 1" }, + { "Secondary2Info", "\u062c\u062f\u0648\u0644\u0627\u062a \u062e\u0627\u0645\u0644\u0629\u060c \u062e\u0627\u0646\u0627\u062a \u0645\u0636\u063a\u0648\u0637\u0629\u060c \u062d\u062f \u062e\u0627\u0645\u0644 +\u0646\u0635" }, + { "Secondary2", "\u062b\u0627\u0646\u0648\u064a 2" }, + { "Secondary3Info", "\u062e\u0644\u0641\u064a\u0651\u064e\u0629" }, + { "Secondary3", "\u062b\u0627\u0646\u0648\u064a 3" }, + // + { "ControlFontInfo", "\u062e\u0637 \u0645\u0631\u0627\u0642\u0628\u0629" }, + { "ControlFont", "\u062e\u0637 \u062c\u0630\u0627\u0630\u0629" }, + { "SystemFontInfo", "\u0646\u0635 \u0639\u0631\u0636\u064a\u060c \u0639\u0642\u062f \u0634\u062c\u0631\u0629" }, + { "SystemFont", "\u062e\u0637 \u0627\u0644\u0646\u0638\u0627\u0645" }, + { "UserFontInfo", "\u0628\u064a\u0627\u0646\u0627\u062a \u0645\u062f\u062e\u0644\u0629 \u0645\u0646 \u0627\u0644\u0645\u0633\u062a\u0639\u0645\u0644" }, + { "UserFont", "\u062e\u0637 \u062d\u0642\u0644" }, +// { "SmallFontInfo", "\u062a\u0642\u0627\u0631\u064a\u0631" }, + { "SmallFont", "\u062e\u0637 \u0635\u063a\u064a\u0631" }, + { "WindowTitleFont", "\u062e\u0637 \u0639\u0646\u0648\u0627\u0646" }, + { "MenuFont", "\u062e\u0637 \u0642\u0627\u0626\u0645\u0629" }, + // + { "MandatoryInfo", "\u062e\u0644\u0641\u064a\u0651\u064e\u0629 \u062d\u0642\u0644 \u0625\u062c\u0628\u0627\u0631\u064a" }, + { "Mandatory", "\u0625\u062c\u0628\u0627\u0631\u064a" }, + { "ErrorInfo", "\u062e\u0644\u0641\u064a\u0651\u064e\u0629 \u062d\u0642\u0644 \u062e\u0627\u0637\u0626"}, + { "Error", "\u062e\u0637\u0623" }, + { "InfoInfo", "\u062e\u0644\u0641\u064a\u0651\u064e\u0629 \u062d\u0642\u0644 \u0628\u064a\u0627\u0646\u0627\u062a" }, + { "Info", "\u0628\u064a\u0627\u0646\u0627\u062a" }, + { "WhiteInfo", "\u0623\u0633\u0637\u0631" }, + { "White", "\u0623\u0628\u064a\u0636" }, + { "BlackInfo", "\u0623\u0633\u0637\u0631\u060c \u0646\u0635" }, + { "Black", "\u0623\u0633\u0648\u062f" }, + { "InactiveInfo", "\u062e\u0644\u0641\u064a\u0651\u064e\u0629 \u062d\u0642\u0644 \u062e\u0627\u0645\u0644" }, + { "Inactive", "\u062e\u0627\u0645\u0644" }, + { "TextOKInfo", "\u0623\u0645\u0627\u0645\u064a\u0651\u064e\u0629 \u0646\u0635 \u0635\u062d\u064a\u062d" }, + { "TextOK", "\u0646\u0635 - \u0635\u062d\u064a\u062d" }, + { "TextIssueInfo", "\u0623\u0645\u0627\u0645\u064a\u0651\u064e\u0629 \u0646\u0635 \u062e\u0627\u0637\u0626" }, + { "TextIssue", "\u0646\u0635 - \u062e\u0637\u0623" }, + // + { "FontChooser", "\u0645\u062e\u062a\u0627\u0631 \u0627\u0644\u062e\u0637" }, + { "Fonts", "\u062e\u0637\u0648\u0637" }, + { "Plain", "\u0645\u0644\u0622\u0646" }, + { "Italic", "\u0645\u0627\u0626\u0644" }, + { "Bold", "\u0633\u0645\u064a\u0643" }, + { "BoldItalic", "\u0633\u0645\u064a\u0643 \u0648 \u0645\u0627\u0626\u0644" }, + { "Name", "\u0627\u0650\u0633\u0645" }, + { "Size", "\u062d\u062c\u0645" }, + { "Style", "\u0645\u0638\u0647\u0631" }, + { "TestString", "\u0647\u0630\u0627 \u0627\u0650\u062e\u062a\u0628\u0627\u0631 \u0641\u0642\u0637\u060c \u0627\u0644\u062b\u0639\u0644\u0628 \u0627\u0644\u0628\u0646\u064a \u0627\u0644\u0633\u0631\u064a\u0639 \u0623\u0643\u0644 \u0634\u064a\u0626\u0627 \u0645\u0627. 12,3456789" }, + { "FontString", "\u062e\u0637" }, + // + { "AdempiereColorEditor", "\u0645\u0639\u062f \u0623\u0644\u0648\u0627\u0646 \u0643\u0645\u0628\u064a\u0631" }, + { "AdempiereType", "\u0646\u0648\u0639 \u0627\u0644\u0644\u0651\u064e\u0648\u0646" }, + { "GradientUpperColor", "\u0644\u0648\u0646 \u0627\u0644\u062a\u062f\u0631\u0651\u064f\u062c \u0627\u0644\u0639\u0644\u0648\u064a" }, + { "GradientLowerColor", "\u0644\u0648\u0646 \u0627\u0644\u062a\u062f\u0631\u0651\u064f\u062c \u0627\u0644\u0633\u0651\u064f\u0641\u0644\u064a" }, + { "GradientStart", "\u0628\u062f\u0627\u064a\u0629 \u0627\u0644\u062a\u062f\u0631\u0651\u064f\u062c" }, + { "GradientDistance", "\u062a\u0628\u0627\u0639\u062f \u0627\u0644\u062a\u062f\u0631\u0651\u064f\u062c" }, + { "TextureURL", "\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0646\u0633\u064a\u062c" }, + { "TextureAlpha", "\u0634\u0641\u0627\u0641\u064a\u0651\u064e\u0629 \u0627\u0644\u0646\u0633\u064a\u062c" }, + { "TextureTaintColor", "\u0644\u0648\u0646 \u0635\u0628\u063a\u0629 \u0627\u0644\u0646\u0633\u064a\u062c" }, + { "LineColor", "\u0644\u0648\u0646 \u0627\u0644\u0633\u0651\u064e\u0637\u0631" }, + { "LineBackColor", "\u0644\u0648\u0646 \u0627\u0644\u062e\u0644\u0641\u064a\u0651\u064e\u0629" }, + { "LineWidth", "\u0639\u0631\u0636 \u0627\u0644\u0633\u0637\u0631" }, + { "LineDistance", "\u062a\u0628\u0627\u0639\u062f \u0627\u0644\u0633\u0637\u0631" }, + { "FlatColor", "\u0644\u0648\u0646 \u0645\u0633\u0637\u0651\u064e\u062d" } + }; + + /** + * Get Contents + * @return contents + * @uml.property name="contents" + */ + public Object[][] getContents() + { + return contents; + } +} // Res_ar_TN + diff --git a/looks/src/org/compiere/plaf/PlafRes_bg.java b/looks/src/org/compiere/plaf/PlafRes_bg.java new file mode 100644 index 0000000000..df0df88c81 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_bg.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Plamen Niikolov + * @version $Id: PlafRes_bg.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_bg extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "\u0422\u0438\u043f \u043d\u0430 \u0446\u0432\u0435\u0442\u0430 \u043d\u0430 \u0444\u043e\u043d\u0430" }, + { "BackColType_Flat", "\u0420\u0430\u0432\u0435\u043d(\u041f\u043b\u044a\u0442\u0435\u043d)" }, + { "BackColType_Gradient", "\u041f\u0440\u0435\u043b\u0438\u0432\u0430\u0449" }, + { "BackColType_Lines", "\u041b\u0438\u043d\u0438\u0438" }, + { "BackColType_Texture", "\u041a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u044f" }, + // + { "LookAndFeelEditor", "\u0420\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043d\u0430 \u0432\u0438\u0434 \u043f\u043e\u0442\u0440\u0435\u0431.\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441" }, + { "LookAndFeel", "\u0412\u0438\u0434 \u043d\u0430 \u043f\u043e\u0442\u0440\u0435\u0431.\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441" }, + { "Theme", "\u0422\u0435\u043c\u0430" }, + { "EditAdempiereTheme", "\u0420\u0435\u0434\u0430\u043a\u0446\u0438\u044f \u043d\u0430 \u0442\u0435\u043c\u0430" }, + { "SetDefault", "\u041f\u043e\u0434\u0440\u0430\u0437\u0431" }, + { "SetDefaultColor", "\u0426\u0432\u044f\u0442 \u043d\u0430 \u0444\u043e\u043d\u0430" }, + { "ColorBlind", "\u0414\u043e\u043f\u044a\u043b\u0432\u0430\u0449 \u0446\u0432\u044f\u0442" }, + { "Example", "\u041f\u0440\u0438\u043c\u0435\u0440" }, + { "Reset", "\u041d\u0430\u0447\u0430\u043b\u043d\u043e \u0441\u044a\u0441\u0442\u043e\u044f\u043d\u0438\u0435" }, + { "OK", "\u0414\u0430" }, + { "Cancel", "\u041e\u0442\u043a\u0430\u0437" }, + // + { "AdempiereThemeEditor", "\u0420\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043d\u0430 \u0442\u0435\u043c\u0438" }, + { "MetalColors", "\u041c\u0435\u0442\u0430\u043b\u043d\u0438 \u0446\u0432\u0435\u0442\u043e\u0432\u0435" }, + { "AdempiereColors", "\u0426\u0432\u0435\u0442\u043e\u0432\u0435" }, + { "AdempiereFonts", "\u0428\u0440\u0438\u0444\u0442\u043e\u0432\u0435" }, + { "Primary1Info", "\u0421\u044f\u043d\u043a\u0430, \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b" }, + { "Primary1", "\u041e\u0441\u043d\u043e\u0432\u0435\u043d 1" }, + { "Primary2Info", "\u0424\u043e\u043a\u0443\u0441 \u043b\u0438\u043d\u0438\u044f, \u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0440\u0430\u043d\u043e \u043c\u0435\u043d\u044e" }, + { "Primary2", "\u041e\u0441\u043d\u043e\u0432\u0435\u043d 2" }, + { "Primary3Info", "\u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0440\u0430\u043d \u0440\u0435\u0434 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0421\u0435\u043b\u0435\u043a\u0442\u0438\u0440\u0430\u043d \u0442\u0435\u043a\u0441\u0442,\u0424\u043e\u043d \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u0430 \u043f\u043e\u043c\u043e\u0449" }, + { "Primary3", "\u041e\u0441\u043d\u043e\u0432\u0435\u043d 3" }, + { "Secondary1Info", "\u041b\u0438\u043d\u0438\u044f \u043d\u0430 \u0440\u0430\u043c\u043a\u0430\u0442\u0430" }, + { "Secondary1", "\u0421\u043f\u043e\u043c\u0430\u0433\u0430\u0442\u0435\u043b\u0435\u043d 1" }, + { "Secondary2Info", "\u041d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u0438 \u043f\u0430\u043d\u0435\u043b\u0438, \u041d\u0430\u0442\u0438\u0441\u043d\u0430\u0442\u0438 \u043f\u043e\u043b\u0435\u0442\u0430, \u041d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u0438 \u0440\u0430\u043c\u043a\u0438 \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0435" }, + { "Secondary2", "\u0421\u043f\u043e\u043c\u0430\u0433\u0430\u0442\u0435\u043b\u0435\u043d 2" }, + { "Secondary3Info", "\u0424\u043e\u043d" }, + { "Secondary3", "\u0421\u043f\u043e\u043c\u0430\u0433\u0430\u0442\u0435\u043b\u0435\u043d 3" }, + // + { "ControlFontInfo", "\u041a\u043e\u043d\u0442\u0440\u043e\u043b \u043d\u0430 \u0448\u0440\u0438\u0444\u0442\u043e\u0432\u0435\u0442\u0435" }, + { "ControlFont", "\u0428\u0440\u0438\u0444\u0442 \u043d\u0430 \u0435\u0442\u0438\u043a\u0435\u0442\u0438\u0442\u0435" }, + { "SystemFontInfo", "\u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u0430 \u043f\u043e\u043c\u043e\u0449, \u0434\u044a\u0440\u0432\u043e\u0432\u0438\u0434\u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430" }, + { "SystemFont", "\u0421\u0438\u0441\u0442\u0435\u043c\u0435\u043d \u0448\u0440\u0438\u0444\u0442" }, + { "UserFontInfo", "\u0414\u0430\u043d\u043d\u0438 \u0432\u044a\u0432\u0435\u0434\u0435\u043d\u0438 \u043e\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044f" }, + { "UserFont", "\u0428\u0440\u0438\u0444\u0442 \u043d\u0430 \u043f\u043e\u043b\u0435" }, +// { "SmallFontInfo", "Reports" }, + { "SmallFont", "\u041c\u0430\u043b\u044a\u043a \u0448\u0440\u0438\u0444\u0442" }, + { "WindowTitleFont", "\u0428\u0440\u0438\u0444\u0442 \u043d\u0430 \u0437\u0430\u0433\u043b\u0430\u0432\u0438\u0435\u0442\u043e" }, + { "MenuFont", "\u0428\u0440\u0438\u0444\u0442 \u043d\u0430 \u043c\u0435\u043d\u044e\u0442\u043e" }, + // + { "MandatoryInfo", "\u0424\u043e\u043d \u043d\u0430 \u0437\u0430\u0434\u044a\u043b\u0436\u0438\u0442\u0435\u043b\u043d\u043e\u0442\u043e \u043f\u043e\u043b\u0435" }, + { "Mandatory", "\u0417\u0430\u0434\u044a\u043b\u0436\u0438\u0442\u0435\u043b\u0435\u043d" }, + { "ErrorInfo", "\u0424\u043e\u043d \u043d\u0430 \u043f\u043e\u043b\u0435 \u0437\u0430 \u0433\u0440\u0435\u0448\u043a\u0430" }, + { "Error", "\u0413\u0440\u0435\u0448\u043a\u0430" }, + { "InfoInfo", "\u0424\u043e\u043d \u043d\u0430 \u043f\u043e\u043b\u0435\u0442\u043e \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f" }, + { "Info", "\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f" }, + { "WhiteInfo", "\u041b\u0438\u043d\u0438\u0438" }, + { "White", "\u0411\u044f\u043b" }, + { "BlackInfo", "\u041b\u0438\u043d\u0438\u0438, \u0442\u0435\u043a\u0441\u0442" }, + { "Black", "\u0427\u0435\u0440\u0435\u043d" }, + { "InactiveInfo", "\u0424\u043e\u043d \u043d\u0430 \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043b\u0435" }, + { "Inactive", "\u041d\u0435\u0430\u043a\u0442\u0438\u0432\u0435\u043d" }, + { "TextOKInfo", "\u0426\u0432\u044f\u0442 \u043d\u0430 \u0448\u0440\u0438\u0444\u0442\u0430 \u043f\u0440\u0438 \u041e\u041a" }, + { "TextOK", "\u0412\u0430\u043b\u0438\u0434\u0435\u043d \u0442\u0435\u043a\u0441\u0442" }, + { "TextIssueInfo", "\u0426\u0432\u044f\u0442 \u043d \u0430\u0448\u0440\u0438\u0444\u0442\u0430 \u043f\u0440\u0438 \u0433\u0440\u0435\u0448\u043a\u0430" }, + { "TextIssue", "\u0413\u0440\u0435\u0448\u0435\u043d \u0442\u0435\u043a\u0441\u0442" }, + // + { "FontChooser", "\u0418\u0437\u0431\u043e\u0440 \u043d\u0430 \u0448\u0440\u0438\u0444\u0442" }, + { "Fonts", "\u0428\u0440\u0438\u0444\u0442\u043e\u0432\u0435" }, + { "Plain", "\u041e\u0431\u0438\u043a\u043d\u043e\u0432\u0435\u043d" }, + { "Italic", "\u041d\u0430\u043a\u043b\u043e\u043d\u0435\u043d" }, + { "Bold", "\u0423\u0434\u0435\u0431\u0435\u043b\u0435\u043d" }, + { "BoldItalic", "\u0423\u0434\u0435\u0431\u0435\u043b\u0435\u043d \u0438 \u043d\u0430\u043a\u043b\u043e\u043d\u0435\u043d" }, + { "Name", "\u0418\u043c\u0435" }, + { "Size", "\u0420\u0430\u0437\u043c\u0435\u0440" }, + { "Style", "\u0421\u0442\u0438\u043b" }, + { "TestString", "\u0422\u043e\u0432\u0430 \u0435 \u0441\u0430\u043c\u043e \u0442\u0435\u0441\u0442! \u0411\u044a\u0440\u0437\u0430\u0442\u0430 \u043a\u0430\u0444\u044f\u0432\u0430 \u043b\u0438\u0441\u0438\u0446\u0430 \u043f\u0440\u0430\u0432\u0438 \u043d\u0435\u0449\u043e. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "\u0428\u0440\u0438\u0444\u0442" }, + // + { "AdempiereColorEditor", "\u0420\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u043d\u0430 \u0446\u0432\u0435\u0442\u043e\u0432\u0435" }, + { "AdempiereType", "\u0422\u0438\u043f \u043d\u0430 \u0446\u0432\u0435\u0442\u043e\u0432\u0435\u0442\u0435" }, + { "GradientUpperColor", "\u041f\u0440\u0435\u043b\u0438\u0432\u0430\u043d\u0435 \u0433\u043e\u0440\u0435\u043d \u0446\u0432\u044f\u0442" }, + { "GradientLowerColor", "\u041f\u0440\u0435\u043b\u0438\u0432\u0430\u043d\u0435 \u0434\u043e\u043b\u0435\u043d \u0446\u0432\u044f\u0442" }, + { "GradientStart", "\u041d\u0430\u0447\u0430\u043b\u043e \u043d\u0430 \u043f\u0440\u0435\u043b\u0438\u0432\u043a\u0430" }, + { "GradientDistance", "\u0414\u044a\u043b\u0436\u0438\u043d\u0430 \u043d\u0430 \u043f\u0440\u0435\u043b\u0438\u0432\u043a\u0430" }, + { "TextureURL", "\u041c\u0435\u0441\u0442\u043e\u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043d\u0430 \u043a\u043e\u0441\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0446\u0438\u044f\u0442\u0430" }, + { "TextureAlpha", "\u0422\u0435\u043a\u0441\u0442\u0443\u0440\u0430 \u0410\u043b\u0444\u0430" }, + { "TextureTaintColor", "\u0422\u0435\u043a\u0441\u0442\u0443\u0440\u0430 \u0446\u0432\u044f\u0442 - \u043f\u0435\u0442\u043d\u043e, \u0441\u043b\u0435\u0434\u0430" }, + { "LineColor", "\u0426\u0432\u044f\u0442 \u043d\u0430 \u043b\u0438\u043d\u0438\u044f" }, + { "LineBackColor", "\u0426\u0432\u044f\u0442 \u043d\u0430 \u0444\u043e\u043d\u0430" }, + { "LineWidth", "\u0414\u0435\u0431\u0435\u043b\u0438\u043d\u0430 \u043d\u0430 \u043b\u0438\u043d\u0438\u044f" }, + { "LineDistance", "\u0414\u044a\u043b\u0436\u0438\u043d\u0430 \u043d\u0430 \u043b\u0438\u043d\u0438\u044f" }, + { "FlatColor", "\u0420\u0430\u0432\u0435\u043d(\u041f\u043b\u044a\u0442\u0435\u043d) \u0446\u0432\u044f\u0442" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_ca.java b/looks/src/org/compiere/plaf/PlafRes_ca.java new file mode 100644 index 0000000000..47d674716f --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_ca.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Jaume Teixi + * @version $Id: PlafRes_ca.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class PlafRes_ca extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Tipus Color Fons" }, + { "BackColType_Flat", "Pla" }, + { "BackColType_Gradient", "Gradient" }, + { "BackColType_Lines", "L�nes" }, + { "BackColType_Texture", "Textura" }, + // + { "LookAndFeelEditor", "Editor Aparen�a i Comportament" }, + { "LookAndFeel", "Aparen�a i Comportament" }, + { "Theme", "Tema" }, + { "EditAdempiereTheme", "Editar Tema Adempiere" }, + { "SetDefault", "Fons Per Defecte" }, + { "SetDefaultColor", "Color Fons" }, + { "ColorBlind", "Defici�ncia Color" }, + { "Example", "Exemple" }, + { "Reset", "Reiniciar" }, + { "OK", "D'Acord" }, + { "Cancel", "Cancel.lar" }, + // + { "AdempiereThemeEditor", "Editor Tema Adempiere" }, + { "MetalColors", "Colors Metal" }, + { "AdempiereColors", "Colors Adempiere" }, + { "AdempiereFonts", "Fonts Adempiere" }, + { "Primary1Info", "Ombra, Separador" }, + { "Primary1", "Primari 1" }, + { "Primary2Info", "L�nia Focus, Men� Seleccionat" }, + { "Primary2", "Primari 2" }, + { "Primary3Info", "Taula Fila Seleccionada, Texte Seleccionat, Indicador Fons" }, + { "Primary3", "Primari 3" }, + { "Secondary1Info", "L�nies Marc" }, + { "Secondary1", "Secondari 1" }, + { "Secondary2Info", "Pestanyes Innactives, Camps Premuts, Texte + Marc Innactius" }, + { "Secondary2", "Secondari 2" }, + { "Secondary3Info", "Fons" }, + { "Secondary3", "Secondari 3" }, + // + { "ControlFontInfo", "Font Control" }, + { "ControlFont", "Font Etiqueta" }, + { "SystemFontInfo", "Indicador, Nodes Arbre" }, + { "SystemFont", "Font Sistema" }, + { "UserFontInfo", "Dades Entrades Per l'Usuari" }, + { "UserFont", "Font Camp" }, +// { "SmallFontInfo", "Informes" }, + { "SmallFont", "Font Petita" }, + { "WindowTitleFont", "Font T�tol" }, + { "MenuFont", "Font Men�" }, + // + { "MandatoryInfo", "Camp de Fons Obligatori" }, + { "Mandatory", "Obligatori" }, + { "ErrorInfo", "Camp de Fons Error" }, + { "Error", "Error" }, + { "InfoInfo", "Camp de Fons Informaci�" }, + { "Info", "Informaci�" }, + { "WhiteInfo", "L�nies" }, + { "White", "Blanc" }, + { "BlackInfo", "L�nies, Text" }, + { "Black", "Negre" }, + { "InactiveInfo", "Camp de Fons Innactiu" }, + { "Inactive", "Innactiu" }, + { "TextOKInfo", "Texte Superior OK" }, + { "TextOK", "Texte - OK" }, + { "TextIssueInfo", "Texte Superior Error" }, + { "TextIssue", "Texte - Error" }, + // + { "FontChooser", "Escollidor Font" }, + { "Fonts", "Fonts" }, + { "Plain", "Plana" }, + { "Italic", "It�lica" }, + { "Bold", "Negreta" }, + { "BoldItalic", "Negreta & It�lica" }, + { "Name", "Nom" }, + { "Size", "Tamany" }, + { "Style", "Estil" }, + { "TestString", "Aix� �s nom�s una Prova! La Guineu marr� r�pida �st� fent quelcom. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Font" }, + // + { "AdempiereColorEditor", "Editor Color Adempiere" }, + { "AdempiereType", "Tipus Color" }, + { "GradientUpperColor", "Color Dalt Degradat" }, + { "GradientLowerColor", "Color Baix Degradat" }, + { "GradientStart", "Inici Degradat" }, + { "GradientDistance", "Dist�ncia Degradat" }, + { "TextureURL", "Textura URL" }, + { "TextureAlpha", "Textura Alfa" }, + { "TextureTaintColor", "Textura Color Corrupci�" }, + { "LineColor", "Color L�nia" }, + { "LineBackColor", "Color Fons" }, + { "LineWidth", "Ampla L�nia" }, + { "LineDistance", "Dist�ncia L�nia" }, + { "FlatColor", "Color Pla" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_da.java b/looks/src/org/compiere/plaf/PlafRes_da.java new file mode 100644 index 0000000000..199c284d44 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_da.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Jorg Janke + * @version $Id: PlafRes_da.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class PlafRes_da extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Baggrund: Farvetype" }, + { "BackColType_Flat", "Fast" }, + { "BackColType_Gradient", "Farveforløb" }, + { "BackColType_Lines", "Linjer" }, + { "BackColType_Texture", "Struktur" }, + // + { "LookAndFeelEditor", "Redigér & udseende" }, + { "LookAndFeel", "Udseende" }, + { "Theme", "Tema" }, + { "EditAdempiereTheme", "Redigér Adempiere tema" }, + { "SetDefault", "Baggrund: Standard" }, + { "SetDefaultColor", "Baggrundsfarve" }, + { "ColorBlind", "Farvereduktion" }, + { "Example", "Eksempel" }, + { "Reset", "Gendan" }, + { "OK", "OK" }, + { "Cancel", "Annullér" }, + // + { "AdempiereThemeEditor", "Adempiere-tema: Redigér" }, + { "MetalColors", "Metal-farver" }, + { "AdempiereColors", "Adempiere-farver" }, + { "AdempiereFonts", "Adempiere-skrifttyper" }, + { "Primary1Info", "Skygge, Separator" }, + { "Primary1", "Primær 1" }, + { "Primary2Info", "Markeret element, Markeret menu" }, + { "Primary2", "Primær 2" }, + { "Primary3Info", "Markeret række i tabel, Markeret tekst, Værktøjstip - baggr." }, + { "Primary3", "Prim�r 3" }, + { "Secondary1Info", "Rammelinjer" }, + { "Secondary1", "Sekundær 1" }, + { "Secondary2Info", "Ikke-aktive faner, Markerede felter, Ikke-aktiv ramme + tekst" }, + { "Secondary2", "Sekundær 2" }, + { "Secondary3Info", "Baggrund" }, + { "Secondary3", "Sekundær 3" }, + // + { "ControlFontInfo", "Skrifttype: Knapper" }, + { "ControlFont", "Skrifttype: Etiket" }, + { "SystemFontInfo", "Værktøjstip, Strukturknuder" }, + { "SystemFont", "Skrifttype: System" }, + { "UserFontInfo", "Anvend" }, + { "UserFont", "Skrifttype: Felt" }, +// { "SmallFontInfo", "Rapporter" }, + { "SmallFont", "Lille" }, + { "WindowTitleFont", "Skrifttype: Titellinje" }, + { "MenuFont", "Skrifttype: Menu" }, + // + { "MandatoryInfo", "Tvungen feltbaggrund" }, + { "Mandatory", "Tvungen" }, + { "ErrorInfo", "Fejl: Feltbaggrund" }, + { "Error", "Fejl" }, + { "InfoInfo", "Info: Feltbaggrund" }, + { "Info", "Info" }, + { "WhiteInfo", "Linjer" }, + { "White", "Hvid" }, + { "BlackInfo", "Linjer, Tekst" }, + { "Black", "Sort" }, + { "InactiveInfo", "Inaktiv feltbaggrund" }, + { "Inactive", "Inaktiv" }, + { "TextOKInfo", "OK: Tekstforgrund" }, + { "TextOK", "Tekst: OK" }, + { "TextIssueInfo", "Fejl: Tekstforgrund" }, + { "TextIssue", "Tekst: Fejl" }, + // + { "FontChooser", "Skriftype" }, + { "Fonts", "Skrifttyper" }, + { "Plain", "Normal" }, + { "Italic", "Kursiv" }, + { "Bold", "Fed" }, + { "BoldItalic", "Fed & kursiv" }, + { "Name", "Navn" }, + { "Size", "Størrelse" }, + { "Style", "Type" }, + { "TestString", "Dette er en prøve! 12.3456,78 BogstavLEn = l1 BogstavONul = O0" }, + { "FontString", "Skrifttype" }, + // + { "AdempiereColorEditor", "Adempiere-farveeditor" }, + { "AdempiereType", "Farvetype" }, + { "GradientUpperColor", "Farveforløb: Farve 1" }, + { "GradientLowerColor", "Farveforløb: Farve 2" }, + { "GradientStart", "Farveforløb: Start" }, + { "GradientDistance", "Farveforløb: Afstand" }, + { "TextureURL", "Struktur: URL" }, + { "TextureAlpha", "Struktur: Alpha" }, + { "TextureTaintColor", "Struktur: Pletvis" }, + { "LineColor", "Linjefarve" }, + { "LineBackColor", "Baggrundsfarve" }, + { "LineWidth", "Linjebredde" }, + { "LineDistance", "Linjeafstand" }, + { "FlatColor", "Fast farve" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_de.java b/looks/src/org/compiere/plaf/PlafRes_de.java new file mode 100644 index 0000000000..7a1558b301 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_de.java @@ -0,0 +1,130 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel (German) + * + * @author Jorg Janke + * @version $Id: PlafRes_de.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class PlafRes_de extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Hintergrund Farbtyp" }, + { "BackColType_Flat", "Flach" }, + { "BackColType_Gradient", "Gradient" }, + { "BackColType_Lines", "Linie" }, + { "BackColType_Texture", "Textur" }, + // + { "LookAndFeelEditor", "Benutzeroberfl�che Editor" }, + { "LookAndFeel", "Oberfl�che" }, + { "Theme", "Thema" }, + { "EditAdempiereTheme", "Adempiere Thema bearbeiten" }, + { "SetDefault", "Standard Hintergrund" }, + { "SetDefaultColor", "Hintergrund Farbe" }, + { "ColorBlind", "Farbblindheit" }, + { "Example", "Beispiel" }, + { "Reset", "Zur�cksetzen" }, + { "OK", "Ja" }, + { "Cancel", "Abbruch" }, + // + { "AdempiereThemeEditor", "Adempiere Thema Editor" }, + { "MetalColors", "Metal Farben" }, + { "AdempiereColors", "Adempiere Farben" }, + { "AdempiereFonts", "Adempiere Schriften" }, + { "Primary1Info", "Schatten, Separator" }, + { "Primary1", "Prim�r 1" }, + { "Primary2Info", "Fokuslinien, Aktives Men�" }, + { "Primary2", "Prim�r 2" }, + { "Primary3Info", "Tabelle Selected Row, Selected Text, Tool Tip Hintergrund" }, + { "Primary3", "Prim�r 3" }, + { "Secondary1Info", "Rahmen Lines" }, + { "Secondary1", "Sekund�r 1" }, + { "Secondary2Info", "Inaktive Tabs, Pressed Felder, Inaktive Rahmen + Text" }, + { "Secondary2", "Sekund�r 2" }, + { "Secondary3Info", "Hintergrund" }, + { "Secundary3", "Sekund�r 3" }, + // + { "ControlFontInfo", "Labels" }, + { "ControlFont", "Standard Schrift" }, + { "SystemFontInfo", "Tool Tip" }, + { "SystemFont", "System Schrift" }, + { "UserFontInfo", "Entered Data" }, + { "UserFont", "Nutzer Schrift" }, + { "SmallFont", "Kleine Schrift" }, + { "WindowTitleFont", "Titel Schrift" }, + { "MenuFont", "Men� Schrift" }, + // + { "MandatoryInfo", "Erforderliches Feld Hintergrund" }, + { "Mandatory", "Erforderlich" }, + { "ErrorInfo", "Fehler Feld Hintergrund" }, + { "Error", "Fehler" }, + { "InfoInfo", "Info Feld Hintergrund" }, + { "Info", "Info" }, + { "WhiteInfo", "Linien" }, + { "White", "Wei�" }, + { "BlackInfo", "Linien, Text" }, + { "Black", "Schwarz" }, + { "InactiveInfo", "Inaktiv Feld Hintergrund" }, + { "Inactive", "Inaktiv" }, + { "TextOKInfo", "OK Text Fordergrund" }, + { "TextOK", "Text - OK" }, + { "TextIssueInfo", "Fehler Text Fordergrund" }, + { "TextIssue", "Text - Fehler" }, + // + { "FontChooser", "Schrift Auswahl" }, + { "Fonts", "Schriften" }, + { "Plain", "Normal" }, + { "Italic", "Italic" }, + { "Bold", "Fett" }, + { "BoldItalic", "Fett & Italic" }, + { "Name", "Name" }, + { "Size", "Gr��e" }, + { "Style", "Stil" }, + { "TestString", "Dies ist nur ein Test! The quick brown Fox is doing something. 12,3456.78 BuchstabeLEins = l1 BuchstabeONull = O0" }, + { "FontString", "Schrift" }, + // + { "AdempiereColorEditor", "Adempiere Farben Auswahl" }, + { "AdempiereType", "Farbtyp" }, + { "GradientUpperColor", "Gradient obere Farbe" }, + { "GradientLowerColor", "Gradient untere Farbe" }, + { "GradientStart", "Gradient Start" }, + { "GradientDistance", "Gradient Distanz" }, + { "TextureURL", "Textur URL" }, + { "TextureAlpha", "Textur Alpha" }, + { "TextureTaintColor", "Textur T�nung Farbe" }, + { "LineColor", "Linie Farbe" }, + { "LineBackColor", "Hintergrund Farbe" }, + { "LineWidth", "Linie Breite" }, + { "LineDistance", "Linie Distanz" }, + { "FlatColor", "Flache Farbe" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res_de diff --git a/looks/src/org/compiere/plaf/PlafRes_fa.java b/looks/src/org/compiere/plaf/PlafRes_fa.java new file mode 100644 index 0000000000..973a6d71b4 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_fa.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Jorg Janke + * @version $Id: PlafRes_fa.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_fa extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "\u0646\u0648\u0639 \u0631\u0646\u06af \u0632\u0645\u064a\u0646\u0647" }, + { "BackColType_Flat", "\u0645\u0633\u0637\u062d" }, + { "BackColType_Gradient", "\u0634\u064a\u0628 \u062f\u0627\u0631" }, + { "BackColType_Lines", "\u062e\u0637\u0648\u0637" }, + { "BackColType_Texture", "\u0634\u0627\u0644\u0648\u062f\u0647" }, + // + { "LookAndFeelEditor", "\u0648\u064a\u0631\u0627\u0633\u062a\u0627\u0631 \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0638\u0627\u0647\u0631 \u0648 \u0639\u0645\u0644" }, + { "LookAndFeel", "\u0638\u0627\u0647\u0631 \u0648 \u0639\u0645\u0644" }, + { "Theme", "\u062a\u0645" }, + { "EditAdempiereTheme", "\u0648\u064a\u0631\u0627\u064a\u0634 \u062a\u0645 \u06a9\u0627\u0645\u067e\u064a\u0631\u0647" }, + { "SetDefault", "\u0632\u0645\u064a\u0646\u0647 \u067e\u064a\u0634 \u0641\u0631\u0636" }, + { "SetDefaultColor", "\u0631\u0646\u06af \u0632\u0645\u064a\u0646\u0647" }, + { "ColorBlind", "\u0646\u0642\u0635 \u0631\u0646\u06af" }, + { "Example", "\u0645\u062b\u0627\u0644" }, + { "Reset", "\u0628\u0627\u0632\u0646\u0634\u0627\u0646\u062f\u0646" }, + { "OK", "\u062a\u0635\u0648\u064a\u0628" }, + { "Cancel", "\u0644\u063a\u0648" }, + // + { "AdempiereThemeEditor", "\u0648\u064a\u0631\u0627\u064a\u0633\u062a\u0627\u0631 \u062a\u0645 \u06a9\u0627\u0645\u067e\u064a\u0631\u0647" }, + { "MetalColors", "\u0631\u0646\u06af\u0647\u0627\u06cc \u0645\u062a\u0627\u0644" }, + { "AdempiereColors", "\u0631\u0646\u06af\u0647\u0627\u06cc \u06a9\u0627\u0645\u067e\u064a\u0631\u0647" }, + { "AdempiereFonts", "\u0641\u0648\u0646\u062a \u06a9\u0627\u0645\u067e\u064a\u0631\u0647" }, + { "Primary1Info", "\u0633\u0627\u064a\u0647\u060c \u062c\u062f\u0627\u06a9\u0646\u0646\u062f\u0647" }, + { "Primary1", "\u0627\u0648\u0644\u064a\u0647 1" }, + { "Primary2Info", "\u062e\u0637 \u0645\u0648\u0631\u062f \u062a\u0627\u06a9\u064a\u062f\u060c \u0645\u0646\u0648\u06cc \u0627\u0646\u062a\u062e\u0627\u0628 \u0634\u062f\u0647" }, + { "Primary2", "\u0627\u0648\u0644\u064a\u0647 2" }, + { "Primary3Info", "\u0631\u062f\u064a\u0641 \u062c\u062f\u0648\u0644 \u0627\u0646\u062a\u062e\u0627\u0628 \u0634\u062f\u0647\u060c \u0645\u062a\u0646 \u0627\u0646\u062a\u062e\u0627\u0628 \u0634\u062f\u0647\u060c \u0632\u0645\u064a\u0646\u0647 \u062a\u0648\u0644\u062a\u064a\u067e" }, + { "Primary3", "\u0627\u0648\u0644\u064a\u0647 3" }, + { "Secondary1Info", "\u062e\u0637\u0648\u0637 \u0645\u0631\u0632\u06cc" }, + { "Secondary1", "\u062b\u0627\u0646\u0648\u064a\u0647 1" }, + { "Secondary2Info", "\u062c\u062f\u0627\u0648\u0644 \u0639\u064a\u0631\u0641\u0639\u0627\u0644\u060c \u0641\u064a\u0644\u062f\u0647\u0627\u06cc \u0641\u0634\u0627\u0631 \u062f\u0627\u062f\u0647 \u0634\u062f\u0647\u060c \u0645\u0631\u0632 \u063a\u064a\u0631\u0641\u0639\u0627\u0644 \u0648 \u0645\u062a\u0646" }, + { "Secondary2", "\u062b\u0627\u0646\u0648\u064a\u0647 2" }, + { "Secondary3Info", "\u0632\u0645\u064a\u0646\u0647" }, + { "Secondary3", "\u062b\u0627\u0646\u0648\u064a\u0647 3" }, + // + { "ControlFontInfo", "\u0641\u0648\u0646\u062a \u06a9\u0646\u062a\u0631\u0644" }, + { "ControlFont", "\u0641\u0648\u0646\u062a \u0628\u0631\u0686\u0633\u0628" }, + { "SystemFontInfo", "\u062a\u0648\u0644\u062a\u064a\u067e\u060c \u0646\u062f\u0647\u0627\u06cc \u062f\u0631\u062e\u062a" }, + { "SystemFont", "\u0641\u0648\u0646\u062a \u0633\u064a\u0633\u062a\u0645" }, + { "UserFontInfo", "\u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u0648\u0627\u0631\u062f \u0634\u062f\u0647 \u0628\u0648\u0633\u064a\u0644\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u0646\u062f\u0647" }, + { "UserFont", "\u0641\u0648\u0646\u062a \u0641\u064a\u0644\u062f" }, +// { "SmallFontInfo", "\u06af\u0632\u0627\u0631\u0634\u0627\u062a" }, + { "SmallFont", "\u0641\u0648\u0646\u062a \u06a9\u0648\u0686\u06a9" }, + { "WindowTitleFont", "\u0641\u0648\u0646\u062a \u0639\u0646\u0648\u0627\u0646" }, + { "MenuFont", "\u0641\u0648\u0646\u062a \u0645\u0646\u0648" }, + // + { "MandatoryInfo", "\u0632\u0645\u064a\u0646\u0647 \u0641\u064a\u0644\u062f \u0627\u0644\u0632\u0627\u0645\u06cc" }, + { "Mandatory", "\u0627\u0644\u0632\u0627\u0645\u06cc" }, + { "ErrorInfo", "\u0632\u0645\u064a\u0646\u0647 \u0641\u064a\u0644\u062f \u062e\u0637\u0627" }, + { "Error", "\u062e\u0637\u0627" }, + { "InfoInfo", "\u0632\u0645\u064a\u0646\u0647 \u0641\u064a\u0644\u062f \u0627\u0637\u0644\u0627\u0639\u0627\u062a\u06cc" }, + { "Info", "\u0627\u0637\u0644\u0627\u0639\u0627\u062a\u06cc" }, + { "WhiteInfo", "\u062e\u0637\u0648\u0637" }, + { "White", "\u0633\u0641\u064a\u062f" }, + { "BlackInfo", "\u062e\u0637\u0648\u0637\u060c \u0645\u062a\u0646" }, + { "Black", "\u0633\u064a\u0627\u0647" }, + { "InactiveInfo", "\u0632\u0645\u064a\u0646\u0647 \u0641\u064a\u0644\u062f \u063a\u064a\u0631\u0641\u0639\u0627\u0644" }, + { "Inactive", "\u063a\u064a\u0631\u0641\u0639\u0627\u0644" }, + { "TextOKInfo", "\u0631\u0646\u06af \u0645\u062a\u0646 \u062a\u0635\u0648\u064a\u0628" }, + { "TextOK", "\u0645\u062a\u0646 - \u062a\u0635\u0648\u064a\u0628" }, + { "TextIssueInfo", "\u0631\u0646\u06af \u0645\u062a\u0646 \u062e\u0637\u0627" }, + { "TextIssue", "\u0645\u062a\u0646 - \u062e\u0637\u0627" }, + // + { "FontChooser", "\u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u0646\u062f\u0647 \u0641\u0648\u0646\u062a" }, + { "Fonts", "\u0641\u0648\u0646\u062a\u0647\u0627" }, + { "Plain", "\u0633\u0627\u062f\u0647" }, + { "Italic", "\u062d\u0631\u0648\u0641 \u06a9\u062c" }, + { "Bold", "\u0633\u064a\u0627\u0647" }, + { "BoldItalic", "\u0633\u064a\u0627\u0647 \u0648 \u06a9\u062c" }, + { "Name", "\u0646\u0627\u0645" }, + { "Size", "\u0627\u0646\u062f\u0627\u0632\u0647" }, + { "Style", "\u0633\u0628\u06a9" }, + { "TestString", "\u0627\u064a\u0646 \u064a\u06a9 \u062a\u0633\u062a \u0627\u0633\u062a! \u0631\u0648\u0628\u0627\u0647 \u0642\u0647\u0648\u0647 \u0627\u06cc \u062f\u0631 \u062d\u0627\u0644 \u0627\u0646\u062c\u0627\u0645 \u06a9\u0627\u0631\u06cc \u0627\u0633\u062a." }, + { "FontString", "\u0641\u0648\u0646\u062a" }, + // + { "AdempiereColorEditor", "\u0648\u064a\u0631\u0627\u0633\u062a\u0627\u0631 \u0631\u0646\u06af \u06a9\u0627\u0645\u067e\u064a\u0631\u0647" }, + { "AdempiereType", "\u0646\u0648\u0639 \u0631\u0646\u06af" }, + { "GradientUpperColor", "\u0631\u0646\u06af \u0628\u0627\u0644\u0627\u06cc \u0634\u064a\u0628" }, + { "GradientLowerColor", "\u0631\u0646\u06af \u067e\u0627\u064a\u064a\u0646 \u0634\u064a\u0628" }, + { "GradientStart", "\u0634\u0631\u0648\u0639 \u0634\u064a\u0628" }, + { "GradientDistance", "\u0645\u0633\u0627\u0641\u062a \u0634\u064a\u0628" }, + { "TextureURL", "\u064a\u0648 \u0622\u0631 \u0622\u0644 \u0628\u0627\u0641\u062a" }, + { "TextureAlpha", "\u0628\u0627\u0641\u062a \u0622\u0644\u0641\u0627" }, + { "TextureTaintColor", "\u0631\u0646\u06af \u0628\u0627\u0641\u062a \u0644\u06a9\u0647 \u062f\u0627\u0631" }, + { "LineColor", "\u0631\u0646\u06af \u062e\u0637" }, + { "LineBackColor", "\u0631\u0646\u06af \u0632\u0645\u064a\u0646\u0647" }, + { "LineWidth", "\u067e\u0647\u0646\u0627\u06cc \u062e\u0637" }, + { "LineDistance", "\u0641\u0627\u0635\u0644\u0647 \u062e\u0637" }, + { "FlatColor", "\u0631\u0646\u06af \u0645\u0633\u0637\u062d" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_fi.java b/looks/src/org/compiere/plaf/PlafRes_fi.java new file mode 100644 index 0000000000..db93cf2b3a --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_fi.java @@ -0,0 +1,134 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel for Finnish Language + * + * @author Petteri Soininen (petteri.soininen@netorek.fi) + * @version $Id: PlafRes_fi.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_fi extends ListResourceBundle +{ + /** + * Data + */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Taustan v�rityyppi" }, + { "BackColType_Flat", "Yksiv�ri" }, + { "BackColType_Gradient", "Gradientti" }, + { "BackColType_Lines", "Viiva" }, + { "BackColType_Texture", "Kuviointi" }, + // + { "LookAndFeelEditor", "K�ytt�tuntuman muokkaus" }, + { "LookAndFeel", "K�ytt�tuntuma" }, + { "Theme", "Teema" }, + { "EditAdempiereTheme", "Muokkaa Adempiere-teemaa" }, + { "SetDefault", "Oletustaustav�ri" }, + { "SetDefaultColor", "Taustav�ri" }, + { "ColorBlind", "V�risokeus" }, + { "Example", "Esimerkki" }, + { "Reset", "Nollaa" }, + { "OK", "Hyv�ksy" }, + { "Cancel", "Peruuta" }, + // + { "AdempiereThemeEditor", "Adempiere-teeman muokkaus" }, + { "MetalColors", "Metalliv�rit" }, + { "AdempiereColors", "Adempiere-v�rit" }, + { "AdempiereFonts", "Adempiere-kirjasimet" }, + { "Primary1Info", "Varjostin, Erotin" }, + { "Primary1", "Ensisijainen 1" }, + { "Primary2Info", "Focus-viiva, Valitty Valikko" }, + { "Primary2", "Ensisijainen 2" }, + { "Primary3Info", "Taulun Valittu Rivi, Valittu Teksti, ToolTip Tausta" }, + { "Primary3", "Ensisijainen 3" }, + { "Secondary1Info", "Reunaviivat" }, + { "Secondary1", "Toissijainen 1" }, + { "Secondary2Info", "Ei-aktiiviset Tabulaattorit, Painetut Kent�t, Ei-aktiivinen Reuna + Teksti" }, + { "Secondary2", "Toissijainen 2" }, + { "Secondary3Info", "Tausta" }, + { "Secondary3", "Toissijainen 3" }, + // + { "ControlFontInfo", "Kontrollikirjasin" }, + { "ControlFont", "Nimikekirjasin" }, + { "SystemFontInfo", "Tool Tip, Puun Solmut" }, + { "SystemFont", "J�rjestelm�kirjasin" }, + { "UserFontInfo", "K�ytt�j�n Sy�tt�m� Tieto" }, + { "UserFont", "Kentt�kirjasin" }, +// { "SmallFontInfo", "Raportit" }, + { "SmallFont", "Pieni Kirjasin" }, + { "WindowTitleFont", "Otsikkokirjasin" }, + { "MenuFont", "Valikkokirjasin" }, + // + { "MandatoryInfo", "Pakollinen Kentt�tausta" }, + { "Mandatory", "Pakollinen" }, + { "ErrorInfo", "Virhekent�n Tausta" }, + { "Error", "Virhe" }, + { "InfoInfo", "Tietokent�n Tausta" }, + { "Info", "Tieto" }, + { "WhiteInfo", "Viivat" }, + { "White", "Valkoinen" }, + { "BlackInfo", "Viivat, Teksti" }, + { "Black", "Musta" }, + { "InactiveInfo", "Ei-aktiivinen Kentt�tausta" }, + { "Inactive", "Ei-aktiivinen" }, + { "TextOKInfo", "Hyv�ksy Teksti Edusta" }, + { "TextOK", "Teksti - Hyv�ksy" }, + { "TextIssueInfo", "Virhetekstin Edusta" }, + { "TextIssue", "Teksti - Virhe" }, + // + { "FontChooser", "Kirjasimen Valitsin" }, + { "Fonts", "Kirjasimet" }, + { "Plain", "Tavallinen" }, + { "Italic", "Kursiivi" }, + { "Bold", "Lihavoitu" }, + { "BoldItalic", "Lihavoitu ja Kursiivi" }, + { "Name", "Nimi" }, + { "Size", "Koko" }, + { "Style", "Tyyli" }, + { "TestString", "T�m� on vain Testi! Nopea ruskea Kettu suorittaa jotain. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Kirjasin" }, + // + { "AdempiereColorEditor", "Adempiere-v�rimuokkaus" }, + { "AdempiereType", "V�rityyppi" }, + { "GradientUpperColor", "Gradientin Ylempi V�ri" }, + { "GradientLowerColor", "Gradientin Alempi V�ri" }, + { "GradientStart", "Gradientin Alku" }, + { "GradientDistance", "Gradientin Et�isyys" }, + { "TextureURL", "Kuvioinnin URL" }, + { "TextureAlpha", "Kuvioinnin Alpha" }, + { "TextureTaintColor", "Kuvioinnin Korvausv�ri" }, + { "LineColor", "Viivan V�ri" }, + { "LineBackColor", "Taustan V�ri" }, + { "LineWidth", "Viivan Paksuus" }, + { "LineDistance", "Viivan Et�isyys" }, + { "FlatColor", "Tavallinen V�ri" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res + diff --git a/looks/src/org/compiere/plaf/PlafRes_fr.java b/looks/src/org/compiere/plaf/PlafRes_fr.java new file mode 100644 index 0000000000..bbdf2e3e58 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_fr.java @@ -0,0 +1,124 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel (French) + * + * @author Jean-Luc SCHEIDEGGER + * @version $Id: PlafRes_fr.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class PlafRes_fr extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Type de Couleur de Fond" }, + { "BackColType_Flat", "Flat" }, + { "BackColType_Gradient", "Gradient" }, + { "BackColType_Lines", "Lignes" }, + { "BackColType_Texture", "Texture" }, + { "LookAndFeelEditor", "Look & Feel Editor" }, + { "LookAndFeel", "Look & Feel" }, + { "Theme", "Th\350me" }, + { "EditAdempiereTheme", "Editer Th\350me Adempiere" }, + { "SetDefault", "Couleur de Fond par D\351faut" }, + { "SetDefaultColor", "Couleur de Fond" }, + { "ColorBlind", "Couleur Deficiency" }, + { "Example", "Exemple" }, + { "Reset", "Remettre" }, + { "OK", "OK" }, + { "Cancel", "Annuler" }, + { "AdempiereThemeEditor", "Editeur de Th\350me Adempiere" }, + { "MetalColors", "Couleurs M\351tal" }, + { "AdempiereColors", "Couleurs Adempiere" }, + { "AdempiereFonts", "Polices Adempiere" }, + { "Primary1Info", "Label Text" }, + { "Primary1", "Primary 1" }, + { "Primary2Info", "Focus Line, Selected CheckBox" }, + { "Primary2", "Primary 2" }, + { "Primary3Info", "Table Selected Row, Selected Text, ToolTip Background" }, + { "Primary3", "Primary 3" }, + { "Secondary1Info", "Border Lines" }, + { "Secondary1", "Secondary 1" }, + { "Secondary2Info", "Inactive Tabs, Pressed Fields, Inactive Border + Text" }, + { "Secondary2", "Secondary 2" }, + { "Secondary3Info", "Background" }, + { "Secondary3", "Secondary 3" }, + { "ControlFontInfo", "Control Font" }, + { "ControlFont", "Label Font" }, + { "SystemFontInfo", "Tool Tip, Tree nodes" }, + { "SystemFont", "System Font" }, + { "UserFontInfo", "User Entered Data" }, + { "UserFont", "Field Font" }, + { "SmallFont", "Small Font" }, + { "WindowTitleFont", "Title Font" }, + { "MenuFont", "Menu Font" }, + { "MandatoryInfo", "Mandatory Field Background" }, + { "Mandatory", "Mandatory" }, + { "ErrorInfo", "Error Field Background" }, + { "Error", "Error" }, + { "InfoInfo", "Info Field Background" }, + { "Info", "Info" }, + { "WhiteInfo", "Lines" }, + { "White", "White" }, + { "BlackInfo", "Lines, Text" }, + { "Black", "Black" }, + { "InactiveInfo", "Inactive Field Background" }, + { "Inactive", "Inactive" }, + { "TextOKInfo", "OK Text Foreground" }, + { "TextOK", "Text - OK" }, + { "TextIssueInfo", "Error Text Foreground" }, + { "TextIssue", "Text - Error" }, + { "FontChooser", "Font Chooser" }, + { "Fonts", "Fonts" }, + { "Plain", "Plain" }, + { "Italic", "Italic" }, + { "Bold", "Bold" }, + { "BoldItalic", "Bold & Italic" }, + { "Name", "Name" }, + { "Size", "Size" }, + { "Style", "Style" }, + { "TestString", "This is just a Test! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Font" }, + { "AdempiereColorEditor", "Adempiere Couleur Editor" }, + { "AdempiereType", "Couleur Type" }, + { "GradientUpperColor", "Gradient Upper Couleur" }, + { "GradientLowerColor", "Gradient Lower Couleur" }, + { "GradientStart", "Gradient Start" }, + { "GradientDistance", "Gradient Distance" }, + { "TextureURL", "Texture URL" }, + { "TextureAlpha", "Texture Alpha" }, + { "TextureTaintColor", "Texture Taint Couleur" }, + { "LineColor", "Line Couleur" }, + { "LineBackColor", "Background Couleur" }, + { "LineWidth", "Line Width" }, + { "LineDistance", "Line Distance" }, + { "FlatColor", "Flat Couleur" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } // fetContents +} // PlafRes_fr diff --git a/looks/src/org/compiere/plaf/PlafRes_hr.java b/looks/src/org/compiere/plaf/PlafRes_hr.java new file mode 100644 index 0000000000..e870f401ee --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_hr.java @@ -0,0 +1,132 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Marko Bubalo + * @version $Id: PlafRes_hr.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_hr extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Tip pozadine" }, + { "BackColType_Flat", "Flat" }, + { "BackColType_Gradient", "Gradient" }, + { "BackColType_Lines", "Liije" }, + { "BackColType_Texture", "Teksture" }, + // + { "LookAndFeelEditor", "Urediva� izgleda" }, + { "LookAndFeel", "Izgled" }, + { "Theme", "Tema" }, + { "EditAdempiereTheme", "Ure�ivanje Adempiere teme" }, + { "SetDefault", "Uobi�ajena pozadina" }, + { "SetDefaultColor", "Boja pozadine" }, + { "ColorBlind", "Color Deficiency" }, + { "Example", "Primjer" }, + { "Reset", "Poni�titi" }, + { "OK", "U redu" }, + { "Cancel", "Otkazati" }, + // + { "AdempiereThemeEditor", "Ure�ivanje Adempiere teme" }, + { "MetalColors", "Metal Colors" }, + { "AdempiereColors", "Adempiere Colors" }, + { "AdempiereFonts", "Adempiere Fonts" }, + { "Primary1Info", "Shadow, Separator" }, + { "Primary1", "Primary 1" }, + { "Primary2Info", "Focus Line, Selected Menu" }, + { "Primary2", "Primary 2" }, + { "Primary3Info", "Table Selected Row, Selected Text, ToolTip Background" }, + { "Primary3", "Primary 3" }, + { "Secondary1Info", "Border Lines" }, + { "Secondary1", "Secondary 1" }, + { "Secondary2Info", "Inactive Tabs, Pressed Fields, Inactive Border + Text" }, + { "Secondary2", "Secondary 2" }, + { "Secondary3Info", "Background" }, + { "Secondary3", "Secondary 3" }, + // + { "ControlFontInfo", "Control Font" }, + { "ControlFont", "Label Font" }, + { "SystemFontInfo", "Tool Tip, Tree nodes" }, + { "SystemFont", "System Font" }, + { "UserFontInfo", "User Entered Data" }, + { "UserFont", "Field Font" }, +// { "SmallFontInfo", "Reports" }, + { "SmallFont", "Small Font" }, + { "WindowTitleFont", "Title Font" }, + { "MenuFont", "Menu Font" }, + // + { "MandatoryInfo", "Mandatory Field Background" }, + { "Mandatory", "Mandatory" }, + { "ErrorInfo", "Error Field Background" }, + { "Error", "Error" }, + { "InfoInfo", "Info Field Background" }, + { "Info", "Info" }, + { "WhiteInfo", "Lines" }, + { "White", "White" }, + { "BlackInfo", "Lines, Text" }, + { "Black", "Black" }, + { "InactiveInfo", "Inactive Field Background" }, + { "Inactive", "Inactive" }, + { "TextOKInfo", "OK Text Foreground" }, + { "TextOK", "Text - OK" }, + { "TextIssueInfo", "Error Text Foreground" }, + { "TextIssue", "Text - Error" }, + // + { "FontChooser", "Font Chooser" }, + { "Fonts", "Fonts" }, + { "Plain", "Plain" }, + { "Italic", "Italic" }, + { "Bold", "Bold" }, + { "BoldItalic", "Bold & Italic" }, + { "Name", "Name" }, + { "Size", "Size" }, + { "Style", "Style" }, + { "TestString", "This is just a Test! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Font" }, + // + { "AdempiereColorEditor", "Adempiere Color Editor" }, + { "AdempiereType", "Color Type" }, + { "GradientUpperColor", "Gradient Upper Color" }, + { "GradientLowerColor", "Gradient Lower Color" }, + { "GradientStart", "Gradient Start" }, + { "GradientDistance", "Gradient Distance" }, + { "TextureURL", "Texture URL" }, + { "TextureAlpha", "Texture Alpha" }, + { "TextureTaintColor", "Texture Taint Color" }, + { "LineColor", "Line Color" }, + { "LineBackColor", "Background Color" }, + { "LineWidth", "Line Width" }, + { "LineDistance", "Line Distance" }, + { "FlatColor", "Flat Color" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res + diff --git a/looks/src/org/compiere/plaf/PlafRes_in.java b/looks/src/org/compiere/plaf/PlafRes_in.java new file mode 100644 index 0000000000..206d0af1bb --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_in.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Halim Englen + * @version $Id: PlafRes_in.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_in extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Tipe Warna Latar Belakang" }, + { "BackColType_Flat", "Rata" }, + { "BackColType_Gradient", "Gradien" }, + { "BackColType_Lines", "Garis" }, + { "BackColType_Texture", "Textur" }, + // + { "LookAndFeelEditor", "Editor Look & Feel" }, + { "LookAndFeel", "Look & Feel" }, + { "Theme", "Tema" }, + { "EditAdempiereTheme", "Ubah Tema Adempiere" }, + { "SetDefault", "Latar Belakang Asal" }, + { "SetDefaultColor", "Warna Latar Belakang" }, + { "ColorBlind", "Defisiensi Warna" }, + { "Example", "Contoh" }, + { "Reset", "Reset" }, + { "OK", "OK" }, + { "Cancel", "Batal" }, + // + { "AdempiereThemeEditor", "Adempiere Tema Editor" }, + { "MetalColors", "Warna Metal" }, + { "AdempiereColors", "Warna Adempiere" }, + { "AdempiereFonts", "Adempiere Fonts" }, + { "Primary1Info", "Bayangan, Pemisah" }, + { "Primary1", "Utama 1" }, + { "Primary2Info", "Baris Fokus, Menu yang Dipilih" }, + { "Primary2", "Utama 2" }, + { "Primary3Info", "Table Selected Row, Selected Text, ToolTip Background" }, + { "Primary3", "Utama 3" }, + { "Secondary1Info", "Border Lines" }, + { "Secondary1", "Sekunder 1" }, + { "Secondary2Info", "Inactive Tabs, Pressed Fields, Inactive Border + Text" }, + { "Secondary2", "Sekunder 2" }, + { "Secondary3Info", "Background" }, + { "Secondary3", "Sekunder 3" }, + // + { "ControlFontInfo", "Control Font" }, + { "ControlFont", "Label Font" }, + { "SystemFontInfo", "Tool Tip, Tree nodes" }, + { "SystemFont", "System Font" }, + { "UserFontInfo", "User Entered Data" }, + { "UserFont", "Field Font" }, +// { "SmallFontInfo", "Reports" }, + { "SmallFont", "Small Font" }, + { "WindowTitleFont", "Title Font" }, + { "MenuFont", "Menu Font" }, + // + { "MandatoryInfo", "Mandatory Field Background" }, + { "Mandatory", "Mandatory" }, + { "ErrorInfo", "Error Field Background" }, + { "Error", "Error" }, + { "InfoInfo", "Info Field Background" }, + { "Info", "Info" }, + { "WhiteInfo", "Lines" }, + { "White", "Putih" }, + { "BlackInfo", "Lines, Text" }, + { "Black", "Hitam" }, + { "InactiveInfo", "Inactive Field Background" }, + { "Inactive", "Inactive" }, + { "TextOKInfo", "OK Text Foreground" }, + { "TextOK", "Text - OK" }, + { "TextIssueInfo", "Error Text Foreground" }, + { "TextIssue", "Text - Error" }, + // + { "FontChooser", "Font Chooser" }, + { "Fonts", "Fonts" }, + { "Plain", "Plain" }, + { "Italic", "Italic" }, + { "Bold", "Bold" }, + { "BoldItalic", "Bold & Italic" }, + { "Name", "Nama" }, + { "Size", "Ukuran" }, + { "Style", "Gaya" }, + { "TestString", "This is just a Test! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Font" }, + // + { "AdempiereColorEditor", "Editor Warna Adempiere" }, + { "AdempiereType", "Tipe Warna" }, + { "GradientUpperColor", "Warna Atas Gradien" }, + { "GradientLowerColor", "Warna Bawah Gradien" }, + { "GradientStart", "Mulai Gradien" }, + { "GradientDistance", "Jarak Gradien" }, + { "TextureURL", "Textur URL" }, + { "TextureAlpha", "Textur Alpha" }, + { "TextureTaintColor", "Textur Warna Taint" }, + { "LineColor", "Warna Baris" }, + { "LineBackColor", "Warna Latar Belakang" }, + { "LineWidth", "Lebar Baris" }, + { "LineDistance", "Jarak Baris" }, + { "FlatColor", "Warna Flat" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_it.java b/looks/src/org/compiere/plaf/PlafRes_it.java new file mode 100644 index 0000000000..131744a5fc --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_it.java @@ -0,0 +1,213 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Gabriele Vivinetto - gabriele.mailing@rvmgroup.it + * @version $Id: PlafRes_it.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_it extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + //{ "BackColType", "Background Color Type" }, + { "BackColType", "Tipo Colore di Sfondo" }, + //{ "BackColType_Flat", "Flat" }, + { "BackColType_Flat", "Piatto" }, + //{ "BackColType_Gradient", "Gradient" }, + { "BackColType_Gradient", "Gradiente" }, + //{ "BackColType_Lines", "Lines" }, + { "BackColType_Lines", "Linee" }, + //{ "BackColType_Texture", "Texture" }, //Need to be checked. How to translate "Texture" ? + { "BackColType_Texture", "Texture" }, + // + //{ "LookAndFeelEditor", "Look & Feel Editor" }, //Need to be checked + { "LookAndFeelEditor", "Editor aspetto" }, + //{ "LookAndFeel", "Look & Feel" }, + { "LookAndFeel", "Aspetto" }, + //{ "Theme", "Theme" }, + { "Theme", "Tema" }, + //{ "EditAdempiereTheme", "Edit Adempiere Theme" }, //Need to be checked + { "EditAdempiereTheme", "Modifica Tema di Adempiere" }, + //{ "SetDefault", "Default Background" }, + { "SetDefault", "Sfondo di Default" }, + //{ "SetDefaultColor", "Background Color" }, + { "SetDefaultColor", "Colore di Sfondo" }, + //{ "ColorBlind", "Color Deficiency" }, //Need to be checked + { "ColorBlind", "Mancanza di Colore" }, + //{ "Example", "Example" }, + { "Example", "Esempio" }, + //{ "Reset", "Reset" }, //Need to be checked + { "Reset", "Resetta" }, + //{ "OK", "OK" }, + { "OK", "OK" }, + //{ "Cancel", "Cancel" }, + { "Cancel", "Cancella" }, + // + //{ "AdempiereThemeEditor", "Adempiere Theme Editor" }, //Need to be checked + { "AdempiereThemeEditor", "Editor di Tema Adempiere" }, + //{ "MetalColors", "Metal Colors" }, + { "MetalColors", "Colori Metallici" }, + //{ "AdempiereColors", "Adempiere Colors" }, + { "AdempiereColors", "Colori di Adempiere" }, + //{ "AdempiereFonts", "Adempiere Fonts" }, //Need to be checked. Mantain the word "Font" ? + { "AdempiereFonts", "Caratteri di Adempiere" }, + //{ "Primary1Info", "Shadow, Separator" }, //Need to be checked + { "Primary1Info", "Ombra, Separatore" }, + //{ "Primary1", "Primary 1" }, + { "Primary1", "Primario 1" }, + //{ "Primary2Info", "Focus Line, Selected Menu" }, //Need to be checked + { "Primary2Info", "Linea di Selezione, Menu Selezionato" }, + //{ "Primary2", "Primary 2" }, + { "Primary2", "Primario 2" }, + //{ "Primary3Info", "Table Selected Row, Selected Text, ToolTip Background" }, //Need to be checked + { "Primary3Info", "Riga di Tabella Selezionata, Testo Selezionato, Sfondo ToolTip " }, + //{ "Primary3", "Primary 3" }, + { "Primary3", "Primario 3" }, + //{ "Secondary1Info", "Border Lines" }, + { "Secondary1Info", "Linee di Bordo" }, + //{ "Secondary1", "Secondary 1" }, + { "Secondary1", "Secondario 1" }, + //{ "Secondary2Info", "Inactive Tabs, Pressed Fields, Inactive Border + Text" }, //Need to be checked + { "Secondary2Info", "Tab inattive, Campi selezionati, Bordo + Testo inattivo" }, + //{ "Secondary2", "Secondary 2" }, + { "Secondary2", "Secondario 2" }, + //{ "Secondary3Info", "Background" }, + { "Secondary3Info", "Sfondo" }, + //{ "Secondary3", "Secondary 3" }, + { "Secondary3", "Secondario 3" }, + // + //{ "ControlFontInfo", "Control Font" }, //Need to be checked + { "ControlFontInfo", "Font di Controllo" }, + //{ "ControlFont", "Label Font" }, //Need to be checked + { "ControlFont", "Font di Etichetta" }, + //{ "SystemFontInfo", "Tool Tip, Tree nodes" }, //Need to be checked + { "SystemFontInfo", "Tool Tip, Nodi ad Albero" }, + //{ "SystemFont", "System Font" }, //Need to be checked + { "SystemFont", "Carattere di Sistema" }, + //{ "UserFontInfo", "User Entered Data" }, + { "UserFontInfo", "Dati immessi dall'utente" }, + //{ "UserFont", "Field Font" }, //Need to be checked + { "UserFont", "Carattere del Campo" }, +// { "SmallFontInfo", "Reports" }, + //{ "SmallFont", "Small Font" }, //Need to be checked + { "SmallFont", "Carattere piccolo" }, + //{ "WindowTitleFont", "Title Font" }, //Need to be checked + { "WindowTitleFont", "Carattere Titolo" }, + //{ "MenuFont", "Menu Font" }, //Need to be checked + { "MenuFont", "Carattere Menu" }, + // + //{ "MandatoryInfo", "Mandatory Field Background" }, + { "MandatoryInfo", "Sfondo Campo Obbligatorio" }, + //{ "Mandatory", "Mandatory" }, + { "Mandatory", "Obbligatorio" }, + //{ "ErrorInfo", "Error Field Background" }, + { "ErrorInfo", "Sfondo Campo di Errore" }, + //{ "Error", "Error" }, + { "Error", "Errore" }, + //{ "InfoInfo", "Info Field Background" }, //Need to be checked. Is it better "Informativo" ? What with the following ? + { "InfoInfo", "Sfondo Campo Informazione" }, + //{ "Info", "Info" }, + { "Info", "Informazione" }, + //{ "WhiteInfo", "Lines" }, + { "WhiteInfo", "Linee" }, + //{ "White", "White" }, + { "White", "Bianco" }, + //{ "BlackInfo", "Lines, Text" }, + { "BlackInfo", "Linee, Testo" }, + //{ "Black", "Black" }, + { "Black", "Nero" }, + //{ "InactiveInfo", "Inactive Field Background" }, + { "InactiveInfo", "Sfondo Campo Inattivo" }, + //{ "Inactive", "Inactive" }, + { "Inactive", "Inattivo" }, + //{ "TextOKInfo", "OK Text Foreground" }, //Need to be checked. How to translate Foreground ? + { "TextOKInfo", "Colore Testo OK" }, + //{ "TextOK", "Text - OK" }, //Need to be checked + { "TextOK", "Testo - OK" }, + //{ "TextIssueInfo", "Error Text Foreground" }, //Need to be checked + { "TextIssueInfo", "Colore Testo di Errore" }, + //{ "TextIssue", "Text - Error" }, + { "TextIssue", "Testo - Error" }, + // + //{ "FontChooser", "Font Chooser" }, //Need to be checked + { "FontChooser", "Selezionatore Carattere" }, + //{ "Fonts", "Fonts" }, //Need to be checked + { "Fonts", "Caratteri" }, + //{ "Plain", "Plain" }, //Need to be checked + { "Plain", "Normale" }, + //{ "Italic", "Italic" }, + { "Italic", "Corsivo" }, + //{ "Bold", "Bold" }, + { "Bold", "Grassetto" }, + //{ "BoldItalic", "Bold & Italic" }, + { "BoldItalic", "Grassetto & Corsivo" }, + //{ "Name", "Name" }, + { "Name", "Nome" }, + //{ "Size", "Size" }, + { "Size", "Dimensione" }, + //{ "Style", "Style" }, + { "Style", "Stile" }, + //{ "TestString", "This is just a Test! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "TestString", "Questo � solo un Test! La veloce volpe marrone st� facendo qualcosa. 12,3456.78 LetteraLUno = l1 LetteraOZero = O0" }, + //{ "FontString", "Font" }, + { "FontString", "Carattere" }, //Need to be checked + // + //{ "AdempiereColorEditor", "Adempiere Color Editor" }, //Need to be checked + { "AdempiereColorEditor", "Editor di Colori Adempiere" }, + //{ "AdempiereType", "Color Type" }, + { "AdempiereType", "Tipo Colore" }, + //{ "GradientUpperColor", "Gradient Upper Color" }, + { "GradientUpperColor", "Colore Gradiente Superiore" }, + //{ "GradientLowerColor", "Gradient Lower Color" }, + { "GradientLowerColor", "Colore Gradiente Inferiore" }, + //{ "GradientStart", "Gradient Start" }, + { "GradientStart", "Inizio Gradiente" }, + //{ "GradientDistance", "Gradient Distance" }, + { "GradientDistance", "Distanza Gradiente" }, + //{ "TextureURL", "Texture URL" }, //Need to be checked. How to translate "Texture" ? + { "TextureURL", "URL Texture" }, + //{ "TextureAlpha", "Texture Alpha" }, //Need to be checked. How to translate ? + { "TextureAlpha", "Texture Alpha" }, + //{ "TextureTaintColor", "Texture Taint Color" }, //Need to be checked. How to translate ? + { "TextureTaintColor", "Texture Taint Color" }, + //{ "LineColor", "Line Color" }, + { "LineColor", "Colore Linea" }, + //{ "LineBackColor", "Background Color" }, + { "LineBackColor", "Colore Sfondo" }, + //{ "LineWidth", "Line Width" }, + { "LineWidth", "Spessore Linea" }, + //{ "LineDistance", "Line Distance" }, + { "LineDistance", "Distanza Linea" }, + //{ "FlatColor", "Flat Color" } + { "FlatColor", "Colore Piatto" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_ja.java b/looks/src/org/compiere/plaf/PlafRes_ja.java new file mode 100644 index 0000000000..0b36db3767 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_ja.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Stefan Christians + * @version $Id: PlafRes_ja.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_ja extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "\u80cc\u666f\u306e\u30b9\u30bf\u30a4\u30eb" }, + { "BackColType_Flat", "\u5358\u8272" }, + { "BackColType_Gradient", "\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3" }, + { "BackColType_Lines", "\u30e9\u30a4\u30f3" }, + { "BackColType_Texture", "\u30c6\u30ad\u30b9\u30c1\u30e3\u30fc" }, + // + { "LookAndFeelEditor", "\u5916\u898b\u30fb\u30a8\u30c7\u30a3\u30bf" }, + { "LookAndFeel", "\u5916\u898b" }, + { "Theme", "\u30c6\u30fc\u30de" }, + { "EditAdempiereTheme", "\u30b3\u30f3\u30d4\u30a8\u30fc\u30ec\u306e\u30c6\u30fc\u30de\u30fb\u30a8\u30c7\u30a3\u30bf" }, + { "SetDefault", "\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u80cc\u666f" }, + { "SetDefaultColor", "\u80cc\u666f\u306e\u8272" }, + { "ColorBlind", "\u8272\u76f2\u76ee" }, + { "Example", "\u4f8b" }, + { "Reset", "\u30ea\u30bb\u30c3\u30c8" }, + { "OK", "OK" }, + { "Cancel", "\u30ad\u30e3\u30f3\u30bb\u30eb" }, + // + { "AdempiereThemeEditor", "\u30b3\u30f3\u30d4\u30a8\u30fc\u30ec\u30fb\u30c6\u30fc\u30de\u30fb\u30a8\u30c7\u30a3\u30bf" }, + { "MetalColors", "\u30e1\u30bf\u30eb\u8272" }, + { "AdempiereColors", "\u30b3\u30f3\u30d4\u30a8\u30fc\u30ec\u306e\u8272" }, + { "AdempiereFonts", "\u30b3\u30f3\u30d4\u30a8\u30fc\u30ec\u306e\u30d5\u30a9\u30f3\u30c8" }, + { "Primary1Info", "\u5f71\u3001\u30bb\u30d1\u30ec\u30fc\u30bf" }, + { "Primary1", "\u4e00\u756a\u76ee\u306e1" }, + { "Primary2Info", "\u30d5\u30a9\u30fc\u30ab\u30b9\u304c\u6709\u308b\u30e9\u30a4\u30f3\u3001\u9078\u629e\u3057\u305f\u30e1\u30cb\u30e5\u30fc" }, + { "Primary2", "\u4e00\u756a\u76ee\u306e2" }, + { "Primary3Info", "\u9078\u629e\u3057\u305f\u30c6\u30fc\u30d6\u30eb\u306e\u884c\u3001\u9078\u629e\u3057\u305f\u30c6\u30ad\u30b9\u30c8\u3001\u30c4\u30fc\u30eb\u30fb\u30c1\u30c3\u30d7\u306e\u80cc\u666f" }, + { "Primary3", "\u4e00\u756a\u76ee\u306e3" }, + { "Secondary1Info", "\u5883\u754c\u7dda" }, + { "Secondary1", "\u4e8c\u756a\u76ee\u306e1" }, + { "Secondary2Info", "\u4e0d\u6d3b\u6027\u30bf\u30d6\u3001\u62bc\u4e0b\u3057\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\u3001\u4e0d\u6d3b\u6027\u5883\u754c\u3068\u30c6\u30ad\u30b9\u30c8" }, + { "Secondary2", "\u4e8c\u756a\u76ee\u306e2" }, + { "Secondary3Info", "\u80cc\u666f" }, + { "Secondary3", "\u4e8c\u756a\u76ee\u306e3" }, + // + { "ControlFontInfo", "\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u30d5\u30a9\u30f3\u30c8" }, + { "ControlFont", "\u30e9\u30d9\u30eb\u306e\u30d5\u30a9\u30f3\u30c8" }, + { "SystemFontInfo", "\u30c4\u30fc\u30eb\u30fb\u30c1\u30c3\u30d7\u3001\u30c4\u30ea\u30fc" }, + { "SystemFont", "\u30b7\u30b9\u30c6\u30e0\u30d5\u30a9\u30f3\u30c8" }, + { "UserFontInfo", "\u30e6\u30fc\u30b6\u304c\u5165\u529b\u3057\u305f\u30c7\u30fc\u30bf" }, + { "UserFont", "\u30d5\u30a3\u30fc\u30eb\u30c9\u30d5\u30a9\u30f3\u30c8" }, +// { "SmallFontInfo", "\u30ec\u30dd\u30fc\u30c8" }, + { "SmallFont", "\u5c0f\u30d5\u30a9\u30f3\u30c8" }, + { "WindowTitleFont", "\u30bf\u30a4\u30c8\u30eb\u30d5\u30a9\u30f3\u30c8" }, + { "MenuFont", "\u30e1\u30cb\u30e5\u30fc\u30d5\u30a9\u30f3\u30c8" }, + // + { "MandatoryInfo", "\u5fc5\u9808\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u80cc\u666f" }, + { "Mandatory", "\u5fc5\u9808" }, + { "ErrorInfo", "\u30a8\u30e9\u30fc\u30fb\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u80cc\u666f" }, + { "Error", "\u30a8\u30e9\u30fc" }, + { "InfoInfo", "\u60c5\u5831\u30fb\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u80cc\u666f" }, + { "Info", "\u60c5\u5831" }, + { "WhiteInfo", "\u30e9\u30a4\u30f3" }, + { "White", "\u767d" }, + { "BlackInfo", "\u30e9\u30a4\u30f3\u3068\u30c6\u30ad\u30b9\u30c8" }, + { "Black", "\u9ed2" }, + { "InactiveInfo", "\u4e0d\u6d3b\u6027\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u80cc\u666f" }, + { "Inactive", "\u4e0d\u6d3b\u6027" }, + { "TextOKInfo", "OK\u30fb\u30c6\u30ad\u30b9\u30c8\u306e\u524d\u666f" }, + { "TextOK", "\u30c6\u30ad\u30b9\u30c8 - OK" }, + { "TextIssueInfo", "\u30a8\u30e9\u30fc\u30fb\u30c6\u30ad\u30b9\u30c8\u306e\u524d\u666f" }, + { "TextIssue", "\u30c6\u30ad\u30b9\u30c8 - \u30a8\u30e9\u30fc" }, + // + { "FontChooser", "\u30d5\u30a9\u30f3\u30c8\u306e\u9078\u629e" }, + { "Fonts", "\u30d5\u30a9\u30f3\u30c8" }, + { "Plain", "\u666e\u901a" }, + { "Italic", "\u659c\u4f53" }, + { "Bold", "\u592a\u5b57" }, + { "BoldItalic", "\u592a\u5b57\u3068\u659c\u4f53" }, + { "Name", "\u30d5\u30a1\u30df\u30ea" }, + { "Size", "\u30b5\u30a4\u30ba" }, + { "Style", "\u30b9\u30bf\u30a4\u30eb" }, + { "TestString", "This is just a Test! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "\u30d5\u30a9\u30f3\u30c8" }, + // + { "AdempiereColorEditor", "\u30b3\u30f3\u30d4\u30a8\u30fc\u30ec\u306e\u8272\u30fb\u30a8\u30c7\u30a3\u30bf" }, + { "AdempiereType", "\u8272\u578b" }, + { "GradientUpperColor", "\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u306e\u4e0a\u306e\u8272" }, + { "GradientLowerColor", "\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u306e\u4e0b\u306e\u8272" }, + { "GradientStart", "\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u306e" }, + { "GradientDistance", "\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u306e\u8ddd\u96e2" }, + { "TextureURL", "\u30c6\u30ad\u30b9\u30c1\u30e3\u30fc\u306eURL" }, + { "TextureAlpha", "\u30c6\u30ad\u30b9\u30c1\u30e3\u30fc\u306e\u03b1\u5024" }, + { "TextureTaintColor", "\u30c6\u30ad\u30b9\u30c1\u30e3\u30fc\u306e\u6c5a\u308c\u8272" }, + { "LineColor", "\u30e9\u30a4\u30f3\u306e\u8272" }, + { "LineBackColor", "\u30e9\u30a4\u30f3\u306e\u80cc\u666f\u8272" }, + { "LineWidth", "\u30e9\u30a4\u30f3\u306e\u5e45" }, + { "LineDistance", "\u30e9\u30a4\u30f3\u306e\u8ddd\u96e2" }, + { "FlatColor", "\u5358\u8272" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_ml.java b/looks/src/org/compiere/plaf/PlafRes_ml.java new file mode 100644 index 0000000000..601bb15228 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_ml.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Robin Hoo + * @version $Id: PlafRes_ml.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class PlafRes_ml extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Jenis Warna Latar Belakang" }, + { "BackColType_Flat", "Flat" }, + { "BackColType_Gradient", "Gradient" }, + { "BackColType_Lines", "Lines" }, + { "BackColType_Texture", "Texture" }, + // + { "LookAndFeelEditor", "Look & Feel Editor" }, + { "LookAndFeel", "Look & Feel" }, + { "Theme", "Theme" }, + { "EditAdempiereTheme", "Edit Adempiere Theme" }, + { "SetDefault", "Default Background" }, + { "SetDefaultColor", "Background Color" }, + { "ColorBlind", "Color Deficiency" }, + { "Example", "Example" }, + { "Reset", "Reset" }, + { "OK", "OK" }, + { "Cancel", "Batal" }, + // + { "AdempiereThemeEditor", "Adempiere Theme Editor" }, + { "MetalColors", "Metal Colors" }, + { "AdempiereColors", "Adempiere Colors" }, + { "AdempiereFonts", "Adempiere Fonts" }, + { "Primary1Info", "Shadow, Separator" }, + { "Primary1", "Primary 1" }, + { "Primary2Info", "Focus Line, Selected Menu" }, + { "Primary2", "Primary 2" }, + { "Primary3Info", "Table Selected Row, Selected Text, ToolTip Background" }, + { "Primary3", "Primary 3" }, + { "Secondary1Info", "Border Lines" }, + { "Secondary1", "Secondary 1" }, + { "Secondary2Info", "Inactive Tabs, Pressed Fields, Inactive Border + Text" }, + { "Secondary2", "Secondary 2" }, + { "Secondary3Info", "Background" }, + { "Secondary3", "Secondary 3" }, + // + { "ControlFontInfo", "Control Font" }, + { "ControlFont", "Label Font" }, + { "SystemFontInfo", "Tool Tip, Tree nodes" }, + { "SystemFont", "System Font" }, + { "UserFontInfo", "User Entered Data" }, + { "UserFont", "Field Font" }, +// { "SmallFontInfo", "Reports" }, + { "SmallFont", "Small Font" }, + { "WindowTitleFont", "Title Font" }, + { "MenuFont", "Menu Font" }, + // + { "MandatoryInfo", "Mandatory Field Background" }, + { "Mandatory", "Mandatory" }, + { "ErrorInfo", "Error Field Background" }, + { "Error", "Error" }, + { "InfoInfo", "Info Field Background" }, + { "Info", "Info" }, + { "WhiteInfo", "Lines" }, + { "White", "White" }, + { "BlackInfo", "Lines, Text" }, + { "Black", "Black" }, + { "InactiveInfo", "Inactive Field Background" }, + { "Inactive", "Inactive" }, + { "TextOKInfo", "OK Text Foreground" }, + { "TextOK", "Text - OK" }, + { "TextIssueInfo", "Error Text Foreground" }, + { "TextIssue", "Text - Error" }, + // + { "FontChooser", "Font Chooser" }, + { "Fonts", "Fonts" }, + { "Plain", "Plain" }, + { "Italic", "Italic" }, + { "Bold", "Bold" }, + { "BoldItalic", "Bold & Italic" }, + { "Name", "Name" }, + { "Size", "Size" }, + { "Style", "Style" }, + { "TestString", "This is just a Test! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Font" }, + // + { "AdempiereColorEditor", "Adempiere Color Editor" }, + { "AdempiereType", "Color Type" }, + { "GradientUpperColor", "Gradient Upper Color" }, + { "GradientLowerColor", "Gradient Lower Color" }, + { "GradientStart", "Gradient Start" }, + { "GradientDistance", "Gradient Distance" }, + { "TextureURL", "Texture URL" }, + { "TextureAlpha", "Texture Alpha" }, + { "TextureTaintColor", "Texture Taint Color" }, + { "LineColor", "Line Color" }, + { "LineBackColor", "Background Color" }, + { "LineWidth", "Line Width" }, + { "LineDistance", "Line Distance" }, + { "FlatColor", "Flat Color" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_nl.java b/looks/src/org/compiere/plaf/PlafRes_nl.java new file mode 100644 index 0000000000..94e9b47de3 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_nl.java @@ -0,0 +1,132 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Eldir Tomassen + * @version $Id: PlafRes_nl.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class PlafRes_nl extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Achtergrond Kleur Type" }, + { "BackColType_Flat", "Egaal" }, + { "BackColType_Gradient", "Verloop" }, + { "BackColType_Lines", "Lijnen" }, + { "BackColType_Texture", "Reli�f" }, + // + { "LookAndFeelEditor", "Look & Feel Editor" }, + { "LookAndFeel", "Look & Feel" }, + { "Theme", "Thema" }, + { "EditAdempiereTheme", "Adempiere Theme Bewerken" }, + { "SetDefault", "Standaard Achtergrond" }, + { "SetDefaultColor", "Achtergrond Kleur" }, + { "ColorBlind", "Kleur Verloop" }, + { "Example", "Voorbeeld" }, + { "Reset", "Ongedaan maken" }, + { "OK", "OK" }, + { "Cancel", "Annuleren" }, + // + { "AdempiereThemeEditor", "Adempiere Thema Editor" }, + { "MetalColors", "Metaal Kleuren" }, + { "AdempiereColors", "Adempiere Kleuren" }, + { "AdempiereFonts", "Adempiere Lettertypen" }, + { "Primary1Info", "Shaduw, Schijdingsteken" }, + { "Primary1", "Primair 1" }, + { "Primary2Info", "Schijdingslijn, Geselecteerd Menu" }, + { "Primary2", "Primair 2" }, + { "Primary3Info", "Tabel Geselecteerde Rij, Geselecteerde Tekst, ToolTip Achtergrond" }, + { "Primary3", "Primair 3" }, + { "Secondary1Info", "Begrenzing Lijnen" }, + { "Secondary1", "Secundair 2" }, + { "Secondary2Info", "Inactieve Tabs, Geselecteerde Velden, Inactieve Begrenzing + Tekst" }, + { "Secondary2", "Secundait 2" }, + { "Secondary3Info", "Achtergrond" }, + { "Secondary3", "Secondair 3" }, + // + { "ControlFontInfo", "Beheer Lettertype" }, + { "ControlFont", "Label Lettertype" }, + { "SystemFontInfo", "Tool Tip, Boom Iconen" }, + { "SystemFont", "Systeem Letterype" }, + { "UserFontInfo", "Door Gebruiker ingevoerde gegevens" }, + { "UserFont", "Veld Lettertype" }, +// { "SmallFontInfo", "Reports" }, + { "SmallFont", "Klein Lettertype" }, + { "WindowTitleFont", "Titel Lettertype" }, + { "MenuFont", "Menu Lettertype" }, + // + { "MandatoryInfo", "Verplicht Veld Achtergrond" }, + { "Mandatory", "Verplicht" }, + { "ErrorInfo", "Foutief Veld Achtergrond" }, + { "Error", "Foutief" }, + { "InfoInfo", "Informatie Veld Achtergrond" }, + { "Info", "Informatie" }, + { "WhiteInfo", "Lijnen" }, + { "White", "Wit" }, + { "BlackInfo", "Lijnen, Tekst" }, + { "Black", "Zwart" }, + { "InactiveInfo", "Inactief Veld Achtergrond" }, + { "Inactive", "Inactief" }, + { "TextOKInfo", "OK Tekst Voorgrond" }, + { "TextOK", "Tekst - OK" }, + { "TextIssueInfo", "Foutief Tekst Voorgrond" }, + { "TextIssue", "Tekst - Foutief" }, + // + { "FontChooser", "Lettertype Selecteren" }, + { "Fonts", "Lettertypen" }, + { "Plain", "Normaal" }, + { "Italic", "Schuin" }, + { "Bold", "Vet" }, + { "BoldItalic", "Vet & Schuin" }, + { "Name", "Naam" }, + { "Size", "Formaat" }, + { "Style", "Stijl" }, + { "TestString", "Dit is een test! De thema brwoser is bezig. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Lettertype" }, + // + { "AdempiereColorEditor", "Adempiere Kleur Editor" }, + { "AdempiereType", "Kleur Type" }, + { "GradientUpperColor", "Verloop Bovenste Kleur" }, + { "GradientLowerColor", "Verloop Onderste Kleur" }, + { "GradientStart", "Verloop Start" }, + { "GradientDistance", "Verloop Afstand" }, + { "TextureURL", "Textuur URL" }, + { "TextureAlpha", "Textuur Alpha" }, + { "TextureTaintColor", "Textuur Taint Kleur" }, + { "LineColor", "Lijn Kleur" }, + { "LineBackColor", "Achtergrond Kleur" }, + { "LineWidth", "Lijn Breedte" }, + { "LineDistance", "Lijn Reikwijdte" }, + { "FlatColor", "Egale Kleur" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res + diff --git a/looks/src/org/compiere/plaf/PlafRes_no.java b/looks/src/org/compiere/plaf/PlafRes_no.java new file mode 100644 index 0000000000..a2c41c4234 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_no.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Norwegian Translation Texts for Look & Feel + * + * @author Olaf Slazak L�ken + * @version $Id: PlafRes_no.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_no extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Bakgrunns Farge Type" }, + { "BackColType_Flat", "Flat" }, + { "BackColType_Gradient", "Gradient" }, + { "BackColType_Lines", "Linjer" }, + { "BackColType_Texture", "Texture" }, + // + { "LookAndFeelEditor", "Utseende Egenskaper" }, + { "LookAndFeel", "Utseende" }, + { "Theme", "Sjanger" }, + { "EditAdempiereTheme", "Rediger Adempiere Sjanger" }, + { "SetDefault", "Standard Bakgrunn" }, + { "SetDefaultColor", "Bakgrunn Farge" }, + { "ColorBlind", "Farge Deficiency" }, + { "Example", "Eksempel" }, + { "Reset", "Angre" }, + { "OK", "OK" }, + { "Cancel", "Avbryt" }, + // + { "AdempiereThemeEditor", "Rediger Adempiere Sjanger" }, + { "MetalColors", "Metal Farger" }, + { "AdempiereColors", "Adempiere Farger" }, + { "AdempiereFonts", "Adempiere Fonter" }, + { "Primary1Info", "Sygger, Separator" }, + { "Primary1", "Primary 1" }, + { "Primary2Info", "Fokus Linje, Valgte " }, + { "Primary2", "Primary 2" }, + { "Primary3Info", "Table Selected Row, Selected Text, ToolTip Background" }, + { "Primary3", "Primary 3" }, + { "Secondary1Info", "Border Lines" }, + { "Secondary1", "Secondary 1" }, + { "Secondary2Info", "Inactive Tabs, Pressed Fields, Inactive Border + Text" }, + { "Secondary2", "Secondary 2" }, + { "Secondary3Info", "Background" }, + { "Secondary3", "Secondary 3" }, + // + { "ControlFontInfo", "Kontrol Font" }, + { "ControlFont", "Label Font" }, + { "SystemFontInfo", "Systemets Font Info" }, + { "SystemFont", "Systemets Fonter" }, + { "UserFontInfo", "Bruker Innlagt Data" }, + { "UserFont", "Felt Fonter" }, +// { "SmallFontInfo", "Reports" }, + { "SmallFont", "Sm� Fonter" }, + { "WindowTitleFont", "Titell Fonter" }, + { "MenuFont", "Meny Fonter" }, + // + { "MandatoryInfo", "Mandatory Field Background" }, + { "Mandatory", "Mandatory" }, + { "ErrorInfo", "Error Field Background" }, + { "Error", "Error" }, + { "InfoInfo", "Info Field Background" }, + { "Info", "Info" }, + { "WhiteInfo", "Lines" }, + { "White", "White" }, + { "BlackInfo", "Lines, Text" }, + { "Black", "Black" }, + { "InactiveInfo", "Inactive Field Background" }, + { "Inactive", "Inactive" }, + { "TextOKInfo", "OK Text Foreground" }, + { "TextOK", "Text - OK" }, + { "TextIssueInfo", "Error Text Foreground" }, + { "TextIssue", "Text - Error" }, + // + { "FontChooser", "Font Chooser" }, + { "Fonts", "Fonts" }, + { "Plain", "Plain" }, + { "Italic", "Italic" }, + { "Bold", "Bold" }, + { "BoldItalic", "Bold & Italic" }, + { "Name", "Name" }, + { "Size", "Size" }, + { "Style", "Style" }, + { "TestString", "This is just a Test! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Font" }, + // + { "AdempiereColorEditor", "Adempiere Color Editor" }, + { "AdempiereType", "Color Type" }, + { "GradientUpperColor", "Gradient Upper Color" }, + { "GradientLowerColor", "Gradient Lower Color" }, + { "GradientStart", "Gradient Start" }, + { "GradientDistance", "Gradient Distance" }, + { "TextureURL", "Texture URL" }, + { "TextureAlpha", "Texture Alpha" }, + { "TextureTaintColor", "Texture Taint Color" }, + { "LineColor", "Line Color" }, + { "LineBackColor", "Background Color" }, + { "LineWidth", "Line Width" }, + { "LineDistance", "Line Distance" }, + { "FlatColor", "Flat Color" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_pl.java b/looks/src/org/compiere/plaf/PlafRes_pl.java new file mode 100644 index 0000000000..cd0bece3dd --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_pl.java @@ -0,0 +1,130 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Adam Bodurka + * @version $Id: PlafRes_pl.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_pl extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Typ koloru t\u0142a" }, + { "BackColType_Flat", "P\u0142aski" }, + { "BackColType_Gradient", "Stopniowany" }, + { "BackColType_Lines", "Linie" }, + { "BackColType_Texture", "Tekstura" }, + // + { "LookAndFeelEditor", "Edytor Wygl\u0105du" }, + { "LookAndFeel", "Wygl\u0105d" }, + { "Theme", "Temat" }, + { "EditAdempiereTheme", "Edytuj Temat Compiera" }, + { "SetDefault", "Domy\u015blne T\u0142o" }, + { "SetDefaultColor", "Domy\u015blny Kolor" }, + { "Example", "Przyk\u0142ad" }, + { "Reset", "Resetuj" }, + { "OK", "OK" }, + { "Cancel", "Anuluj" }, + // + { "AdempiereThemeEditor", "Edytor Tematu Compiera" }, + { "MetalColors", "Kolory Metalowe" }, + { "AdempiereColors", "Kolory Compiera" }, + { "AdempiereFonts", "Czcionki Compiera" }, + { "Primary1Info", "Tekst Etykiety" }, + { "Primary1", "Podstawowy 1" }, + { "Primary2Info", "Linia Fokusu, Wybrany CheckBox" }, + { "Primary2", "Podstawowy 2" }, + { "Primary3Info", "Wybrany Wiersz Tabeli, Wybrany Tekst, T\u0142o Podpowiedzi" }, + { "Primary3", "Podstawowy 3" }, + { "Secondary1Info", "Linie Obramowania" }, + { "Secondary1", "Drugorz\u0119dny 1" }, + { "Secondary2Info", "Nieaktywne Zak\u0142adki, Naci\u015bni\u0119te Pola, Nieaktywna Ramka + Tekst" }, + { "Secondary2", "Drugorz\u0119dny 2" }, + { "Secondary3Info", "T\u0142o" }, + { "Secondary3", "Drugorz\u0119dny 3" }, + // + { "ControlFontInfo", "Czcionka Kontrolki" }, + { "ControlFont", "Czcionka Etykiety" }, + { "SystemFontInfo", "Podpowiedzi, Ga\u0142\u0119zie drzewa" }, + { "SystemFont", "Czcionka Systemowa" }, + { "UserFontInfo", "Dane wprowadzone przez U\u017cytkownika" }, + { "UserFont", "Czcionka Pola" }, +// { "SmallFontInfo", "Raporty" }, + { "SmallFont", "Ma\u0142a Czcionka" }, + { "WindowTitleFont", "Czcionka Tytu\u0142u" }, + { "MenuFont", "Czcionka Menu" }, + // + { "MandatoryInfo", "Obowi\u0105zkowe T\u0142o Pola" }, + { "Mandatory", "Obowi\u0105zkowe" }, + { "ErrorInfo", "B\u0142\u0105d T\u0142a Pola" }, + { "Error", "B\u0142\u0105d" }, + { "InfoInfo", "Informacja T\u0142a Pola" }, + { "Info", "Informacja" }, + { "WhiteInfo", "Linie" }, + { "White", "Bia\u0142y" }, + { "BlackInfo", "Linie, Tekst" }, + { "Black", "Czarny" }, + { "InactiveInfo", "Nieaktywne T\u0142o Pola" }, + { "Inactive", "Nieaktywny" }, + { "TextOKInfo", "OK Pierwszoplanowy Tekst" }, + { "TextOK", "Tekst - OK" }, + { "TextIssueInfo", "B\u0142\u0105d Pierwszoplanowego Tekstu" }, + { "TextIssue", "Tekst - B\u0142\u0105d" }, + // + { "FontChooser", "Wyb\u00f3r Czcionki" }, + { "Fonts", "Czcionki" }, + { "Plain", "G\u0142adki" }, + { "Italic", "Kursywa" }, + { "Bold", "Pogrubiony" }, + { "BoldItalic", "Pogrubiony i Kursywa" }, + { "Name", "Nazwa" }, + { "Size", "Rozmiar" }, + { "Style", "Styl" }, + { "TestString", "To jest tylko test!" }, + { "FontString", "Czcionka" }, + // + { "AdempiereColorEditor", "Edytor Koloru Compiera" }, + { "AdempiereType", "Typ Koloru" }, + { "GradientUpperColor", "G\u00f3rny Kolor Stopniowania" }, + { "GradientLowerColor", "Dolny Kolor Stopniowania" }, + { "GradientStart", "Pocz\u0105tek Stopniowania" }, + { "GradientDistance", "Odst\u0119p Stopniowania" }, + { "TextureURL", "Tekstura URL" }, + { "TextureAlpha", "Tekstura Alpha" }, + { "TextureTaintColor", "Kolor t\u0142a Tekstury" }, + { "LineColor", "Kolor Linii" }, + { "LineBackColor", "Kolor T\u0142a" }, + { "LineWidth", "Grubo\u015b\u0107 Linii" }, + { "LineDistance", "Odst\u0119p Linii" }, + { "FlatColor", "Kolor P\u0142aski" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_pt.java b/looks/src/org/compiere/plaf/PlafRes_pt.java new file mode 100644 index 0000000000..48e4b1b79c --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_pt.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Jesse Jr + * @version $Id: PlafRes_pt.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_pt extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Tipo da Cor de Fundo" }, + { "BackColType_Flat", "Plano" }, + { "BackColType_Gradient", "D�grad�" }, + { "BackColType_Lines", "Linhas" }, + { "BackColType_Texture", "Textura" }, + // + { "LookAndFeelEditor", "Editor: Look & Feel" }, + { "LookAndFeel", "Look & Feel" }, + { "Theme", "Tema" }, + { "EditAdempiereTheme", "Editar Tema Adempiere" }, + { "SetDefault", "Fundo Padr�o" }, + { "SetDefaultColor", "Cor de Fundo" }, + { "ColorBlind", "Defici�ncia de Cor" }, + { "Example", "Exemplo" }, + { "Reset", "Reinicializar" }, + { "OK", "OK" }, + { "Cancel", "Cancelar" }, + // + { "AdempiereThemeEditor", "Adempiere: Editor de Temas" }, + { "MetalColors", "Cores Metal" }, + { "AdempiereColors", "Cores Adempiere" }, + { "AdempiereFonts", "Fontes Adempiere" }, + { "Primary1Info", "Sombra, Separador" }, + { "Primary1", "Prim�rio 1" }, + { "Primary2Info", "Linha de Foco, Menu Selecionado" }, + { "Primary2", "Prim�rio 2" }, + { "Primary3Info", "Linha da Tabele Selecionada, Texto Selecionado, Fundo Dicas" }, + { "Primary3", "Prim�rio 3" }, + { "Secondary1Info", "Bordas de Linhas" }, + { "Secondary1", "Secund�rio 1" }, + { "Secondary2Info", "Tabs Inativas, Campos Pressed, Borda Inativa + Texto" }, + { "Secondary2", "Secund�rio 2" }, + { "Secondary3Info", "�rea de Fundo" }, + { "Secondary3", "Secund�rio 3" }, + // + { "ControlFontInfo", "Controle de Fonte" }, + { "ControlFont", "R�tulo da Fonte" }, + { "SystemFontInfo", "Tool Tip, Tree nodes" }, + { "SystemFont", "System Font" }, + { "UserFontInfo", "Entrada de Dados pelo Usu�rio" }, + { "UserFont", "Fonte dos Campos" }, +// { "SmallFontInfo", "Relat�rios" }, + { "SmallFont", "Fonte pequena" }, + { "WindowTitleFont", "Fonte do T�tulo" }, + { "MenuFont", "Fonte do Menu" }, + // + { "MandatoryInfo", "Fundo de Campos Obrigat�rios" }, + { "Mandatory", "Obrigat�rio" }, + { "ErrorInfo", "Fundo de Campo de Erro" }, + { "Error", "Erro" }, + { "InfoInfo", "Fundo de Campos Informativos" }, + { "Info", "Info" }, + { "WhiteInfo", "Linhas" }, + { "White", "Branco" }, + { "BlackInfo", "Linhas, Texto" }, + { "Black", "Preto" }, + { "InactiveInfo", "Fundo de Campo Inativo" }, + { "Inactive", "Inativo" }, + { "TextOKInfo", "OK Fundo do Texto" }, + { "TextOK", "Texto - OK" }, + { "TextIssueInfo", "Fundo do Texto de Erro" }, + { "TextIssue", "Texto - Erro" }, + // + { "FontChooser", "Selecionar Fonte" }, + { "Fonts", "Fontes" }, + { "Plain", "Plano" }, + { "Italic", "It�lico" }, + { "Bold", "Negrito" }, + { "BoldItalic", "Negrito & It�lico" }, + { "Name", "Nome" }, + { "Size", "Tamanho" }, + { "Style", "Estilo" }, + { "TestString", "Somente teste! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Fonte" }, + // + { "AdempiereColorEditor", "Adempiere: Editor de Cores" }, + { "AdempiereType", "Tipo de Cor" }, + { "GradientUpperColor", "Cor D�grad� Superior" }, + { "GradientLowerColor", "Cor D�grad� Inferior" }, + { "GradientStart", "In�cio do D�grad�" }, + { "GradientDistance", "Dist�ncia do D�grad�" }, + { "TextureURL", "URL Textura" }, + { "TextureAlpha", "Alfa Textura" }, + { "TextureTaintColor", "Colora��o da Textura" }, + { "LineColor", "Cor da Linha" }, + { "LineBackColor", "Cores de Fundo" }, + { "LineWidth", "Largura da Linha" }, + { "LineDistance", "Dist�ncia das linhas" }, + { "FlatColor", "Cores Planas" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_ro.java b/looks/src/org/compiere/plaf/PlafRes_ro.java new file mode 100644 index 0000000000..2c4fccf587 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_ro.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Jorg Janke + * @version $Id: PlafRes_ro.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_ro extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Tip al culorii de fundal" }, + { "BackColType_Flat", "Plin" }, + { "BackColType_Gradient", "Gradient" }, + { "BackColType_Lines", "Linii" }, + { "BackColType_Texture", "Ha\u015fur\u0103" }, + // + { "LookAndFeelEditor", "Editor de aspect grafic" }, + { "LookAndFeel", "Aspect grafic" }, + { "Theme", "Tem\u0103" }, + { "EditAdempiereTheme", "Editare a temei Adempiere" }, + { "SetDefault", "Fundal implicit" }, + { "SetDefaultColor", "Culoare de fundal" }, + { "ColorBlind", "Deficien\u0163\u0103 cromatic\u0103" }, + { "Example", "Exemplu" }, + { "Reset", "Reini\u0163ializare" }, + { "OK", "OK" }, + { "Cancel", "Anulare" }, + // + { "AdempiereThemeEditor", "Editor de tem\u0103 grafic\u0103" }, + { "MetalColors", "Culori metalice" }, + { "AdempiereColors", "Culori Adempiere" }, + { "AdempiereFonts", "Font-uri Adempiere" }, + { "Primary1Info", "Umbr\u0103, separator" }, + { "Primary1", "Principal 1" }, + { "Primary2Info", "Linie curent\u0103, meniu selectat" }, + { "Primary2", "Principal 2" }, + { "Primary3Info", "R\u00e2nd de tabel selectat, text selectat, fundal pentru indica\u0163ii" }, + { "Primary3", "Principal 3" }, + { "Secondary1Info", "Margini" }, + { "Secondary1", "Secundar 1" }, + { "Secondary2Info", "File inactive, butoane ap\u0103sate, margini \u015fi text inactive" }, + { "Secondary2", "Secundar 2" }, + { "Secondary3Info", "Fundal" }, + { "Secondary3", "Secundar 3" }, + // + { "ControlFontInfo", "Font pentru obiecte grafice" }, + { "ControlFont", "Font pentru etichete" }, + { "SystemFontInfo", "Indica\u0163ii, noduri \u00een arborescen\u0163e" }, + { "SystemFont", "Font de sistem" }, + { "UserFontInfo", "Date introduse de utilizator" }, + { "UserFont", "Font pentru c\u00e2mpuri" }, +// { "SmallFontInfo", "Font pentru rapoarte" }, + { "SmallFont", "Font de dimensiune mic\u0103" }, + { "WindowTitleFont", "Font pentru titluri" }, + { "MenuFont", "Font de meniuri" }, + // + { "MandatoryInfo", "Fundal pentru c\u00e2mpuri obligatorii" }, + { "Mandatory", "Obligatoriu" }, + { "ErrorInfo", "Fundal pentru c\u00e2mpuri cu valori eronate" }, + { "Error", "Erori" }, + { "InfoInfo", "Fundal pentru c\u00e2mpuri de informare" }, + { "Info", "Informare" }, + { "WhiteInfo", "R\u00e2nduri goale" }, + { "White", "\"Alb\"" }, + { "BlackInfo", "Linii, text" }, + { "Black", "\"Negru\"" }, + { "InactiveInfo", "Fundal pentru c\u00e2mpuri inactive" }, + { "Inactive", "Inactiv" }, + { "TextOKInfo", "Culoare pentru mesaje de confirmare" }, + { "TextOK", "Text de confirmare" }, + { "TextIssueInfo", "Culoare pentru mesaje de eroare" }, + { "TextIssue", "Text de eroare" }, + // + { "FontChooser", "Selector de font-uri" }, + { "Fonts", "Font-uri" }, + { "Plain", "Normal" }, + { "Italic", "Cursiv" }, + { "Bold", "Aldin" }, + { "BoldItalic", "Aldin \u015fi cursiv" }, + { "Name", "Nume" }, + { "Size", "Dimensiune" }, + { "Style", "Stil" }, + { "TestString", "Acesta este un test! Ziua bun\u0103 se cunoa\u015fte de diminea\u0163\u0103. 123.456,78 Lunu = l1 Ozero = O0" }, + { "FontString", "Font" }, + // + { "AdempiereColorEditor", "Editor de culoare " }, + { "AdempiereType", "Tip de culoare" }, + { "GradientUpperColor", "Culoare superioar\u0103 pentru gradient" }, + { "GradientLowerColor", "Culoare inferioar\u0103 pentru gradient" }, + { "GradientStart", "\u00cenceput de gradient" }, + { "GradientDistance", "Distan\u0163\u0103 de gradient" }, + { "TextureURL", "URL pentru ha\u015fur\u0103" }, + { "TextureAlpha", "Masc\u0103 alpha pentru ha\u015fur\u0103" }, + { "TextureTaintColor", "Nuan\u0163\u0103 a ha\u015furii" }, + { "LineColor", "Culoare de desenare" }, + { "LineBackColor", "Culoare de fundal" }, + { "LineWidth", "L\u0103\u0163imea liniei" }, + { "LineDistance", "Distan\u0163a \u00eentre linii" }, + { "FlatColor", "Culoare plin\u0103" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_ru.java b/looks/src/org/compiere/plaf/PlafRes_ru.java new file mode 100644 index 0000000000..bff1a87b23 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_ru.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Vyacheslav Pedak + * @version $Id: PlafRes_ru.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_ru extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "\u0422\u0438\u043f \u0444\u043e\u043d\u043e\u0432\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430" }, + { "BackColType_Flat", "\u0417\u0430\u043b\u0438\u0432\u043a\u0430" }, + { "BackColType_Gradient", "\u0413\u0440\u0430\u0434\u0438\u0435\u043d\u0442" }, + { "BackColType_Lines", "\u041b\u0438\u043d\u0438\u0438" }, + { "BackColType_Texture", "\u0422\u0435\u043a\u0441\u0442\u0443\u0440\u0430" }, + // + { "LookAndFeelEditor", "\u0420\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0432\u0438\u0434\u0430" }, + { "LookAndFeel", "\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434" }, + { "Theme", "\u0422\u0435\u043c\u0430" }, + { "EditAdempiereTheme", "\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043c\u044b Adempiere" }, + { "SetDefault", "\u0424\u043e\u043d \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e" }, + { "SetDefaultColor", "\u0426\u0432\u0435\u0442 \u0444\u043e\u043d\u0430" }, + { "ColorBlind", "\u0420\u0430\u0437\u043c\u044b\u0442\u043e\u0441\u0442\u044c \u0446\u0432\u0435\u0442\u0430" }, + { "Example", "\u041f\u0440\u0438\u043c\u0435\u0440" }, + { "Reset", "\u0421\u0431\u0440\u043e\u0441" }, + { "OK", "\u0414\u0430" }, + { "Cancel", "\u041e\u0442\u043c\u0435\u043d\u0430" }, + // + { "AdempiereThemeEditor", "\u0420\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0442\u0435\u043c Adempiere" }, + { "MetalColors", "\u041c\u0435\u0442\u0430\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0446\u0432\u0435\u0442\u0430" }, + { "AdempiereColors", "\u0426\u0432\u0435\u0442\u0430 Adempiere" }, + { "AdempiereFonts", "\u0428\u0440\u0438\u0444\u0442\u044b Adempiere" }, + { "Primary1Info", "\u0422\u0435\u043d\u044c, \u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c" }, + { "Primary1", "\u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 1" }, + { "Primary2Info", "\u0424\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u043a\u0430, \u0412\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0435 \u043c\u0435\u043d\u044e" }, + { "Primary2", "\u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 2" }, + { "Primary3Info", "\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432 \u0442\u0430\u043b\u0438\u0446\u0435, \u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0446\u0432\u0435\u0442, \u0424\u043e\u043d ToolTip" }, + { "Primary3", "\u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 3" }, + { "Secondary1Info", "\u041b\u0438\u043d\u0438\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b" }, + { "Secondary1", "\u0412\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 1" }, + { "Secondary2Info", "\u041d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0438, \u041d\u0430\u0436\u0430\u0442\u044b\u0435 \u043f\u043e\u043b\u044f, \u041d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0433\u0440\u0430\u043d\u0438\u0446\u044b + \u0442\u0435\u043a\u0441\u0442" }, + { "Secondary2", "\u0412\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 2" }, + { "Secondary3Info", "\u0424\u043e\u043d" }, + { "Secondary3", "\u0412\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 3" }, + // + { "ControlFontInfo", "\u0428\u0440\u0438\u0444\u0442 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f" }, + { "ControlFont", "\u0428\u0440\u0438\u0444\u0442 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u043a" }, + { "SystemFontInfo", "Tool Tip, \u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u0435\u0440\u0435\u0432\u0430" }, + { "SystemFont", "\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0448\u0440\u0438\u0444\u0442" }, + { "UserFontInfo", "\u0412\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435" }, + { "UserFont", "\u0428\u0440\u0438\u0444\u0442 \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439 \u0432\u0432\u043e\u0434\u0430" }, +// { "SmallFontInfo", "\u041e\u0442\u0447\u0435\u0442\u044b" }, + { "SmallFont", "\u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0448\u0440\u0438\u0444\u0442" }, + { "WindowTitleFont", "\u0428\u0440\u0438\u0444\u0442 \u0434\u043b\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c" }, + { "MenuFont", "\u0428\u0440\u0438\u0444\u0442 \u0434\u043b\u044f \u043c\u0435\u043d\u044e" }, + // + { "MandatoryInfo", "\u0424\u043e\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u0432\u0432\u043e\u0434\u0430" }, + { "Mandatory", "\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439" }, + { "ErrorInfo", "\u0424\u043e\u043d \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439" }, + { "Error", "\u041e\u0448\u0438\u0431\u043a\u0430" }, + { "InfoInfo", "\u0424\u043e\u043d \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439" }, + { "Info", "\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f" }, + { "WhiteInfo", "\u041b\u0438\u043d\u0438\u0438" }, + { "White", "\u0411\u0435\u043b\u044b\u0439" }, + { "BlackInfo", "\u041b\u0438\u043d\u0438\u0438, \u0422\u0435\u043a\u0441\u0442" }, + { "Black", "\u0427\u0435\u0440\u043d\u044b\u0439" }, + { "InactiveInfo", "\u0424\u043e\u043d \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439" }, + { "Inactive", "\u041d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439" }, + { "TextOKInfo", "\u0426\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430 '\u0414\u0430'" }, + { "TextOK", "\u0422\u0435\u043a\u0441\u0442 - '\u0414\u0430'" }, + { "TextIssueInfo", "\u0426\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430 '\u041e\u0448\u0438\u0431\u043a\u0430'" }, + { "TextIssue", "\u0422\u0435\u043a\u0441\u0442 - '\u041e\u0448\u0438\u0431\u043a\u0430'" }, + // + { "FontChooser", "\u0412\u044b\u0431\u043e\u0440 \u0448\u0440\u0438\u0444\u0442\u043e\u0432" }, + { "Fonts", "\u0428\u0440\u0438\u0444\u0442\u044b" }, + { "Plain", "\u041e\u0431\u044b\u0447\u043d\u044b\u0439" }, + { "Italic", "\u041d\u0430\u043a\u043b\u043e\u043d\u043d\u044b\u0439" }, + { "Bold", "\u0416\u0438\u0440\u043d\u044b\u0439" }, + { "BoldItalic", "\u0416\u0438\u0440\u043d\u044b\u0439 \u0438 \u041d\u0430\u043a\u043b\u043e\u043d\u043d\u044b\u0439" }, + { "Name", "\u0418\u043c\u044f" }, + { "Size", "\u0420\u0430\u0437\u043c\u0435\u0440" }, + { "Style", "\u0421\u0442\u0438\u0442\u044c" }, + { "TestString", "\u042d\u0442\u043e \u0432\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0442\u0435\u0441\u0442! \u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430\u0434\u043f\u0438\u0441\u044c. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "\u0428\u0440\u0438\u0444\u0442" }, + // + { "AdempiereColorEditor", "\u0420\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0446\u0432\u0435\u0442\u043e\u0432 Adempiere" }, + { "AdempiereType", "\u0422\u0438\u043f \u0446\u0432\u0435\u0442\u0430" }, + { "GradientUpperColor", "\u0412\u0435\u0440\u0445\u043d\u0438\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442" }, + { "GradientLowerColor", "\u041d\u0438\u0436\u043d\u0438\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442" }, + { "GradientStart", "\u041d\u0430\u0447\u0430\u043b\u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430" }, + { "GradientDistance", "\u041f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430" }, + { "TextureURL", "URL \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b" }, + { "TextureAlpha", "Alpha \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b" }, + { "TextureTaintColor", "\u0426\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b" }, + { "LineColor", "\u0426\u0432\u0435\u0442 \u043b\u0438\u043d\u0438\u0438" }, + { "LineBackColor", "\u0426\u0432\u0435\u0442 \u0444\u043e\u043d\u0430" }, + { "LineWidth", "\u0428\u0438\u0440\u0438\u043d\u0430 \u043b\u0438\u043d\u0438\u0439" }, + { "LineDistance", "\u041f\u0440\u043e\u043c\u0435\u0436\u0434\u0443\u0442\u043e\u043a \u043c\u0435\u0436\u0434\u0443 \u043b\u0438\u043d\u0438\u044f\u043c\u0438" }, + { "FlatColor", "\u0426\u0432\u0435\u0442 \u0437\u0430\u043b\u0438\u0432\u043a\u0438" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_sl.java b/looks/src/org/compiere/plaf/PlafRes_sl.java new file mode 100644 index 0000000000..b5dd96e895 --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_sl.java @@ -0,0 +1,132 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Matja\u017e Godec + * @version $Id: PlafRes_sl.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_sl extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Tip ozadja" }, + { "BackColType_Flat", "Barva" }, + { "BackColType_Gradient", "Preliv" }, + { "BackColType_Lines", "\u010crte" }, + { "BackColType_Texture", "Tekstura" }, + // + { "LookAndFeelEditor", "Urejevalnik izgleda" }, + { "LookAndFeel", "Izgled" }, + { "Theme", "Tema" }, + { "EditAdempiereTheme", "Urejanje Adempiere teme" }, + { "SetDefault", "Privzeto ozadje" }, + { "SetDefaultColor", "Barva ozadja" }, + { "ColorBlind", "Color Deficiency" }, + { "Example", "Primer" }, + { "Reset", "Ponastavi" }, + { "OK", "V redu" }, + { "Cancel", "Prekli\u010di" }, + // + { "AdempiereThemeEditor", "Urejanje Adempiere teme" }, + { "MetalColors", "Barve Metal" }, + { "AdempiereColors", "Barve Adempiere" }, + { "AdempiereFonts", "Adempiere pisave" }, + { "Primary1Info", "Sen\u010denje, Lo\u010dilo" }, + { "Primary1", "Primarna 1" }, + { "Primary2Info", "\u010crta s fokusom, Izbran meni" }, + { "Primary2", "Primarna 2" }, + { "Primary3Info", "Izbrana vrstice tabele, Izbran tekst, Ozadje nasvetov" }, + { "Primary3", "Primarna 3" }, + { "Secondary1Info", "\u010crte okvirja" }, + { "Secondary1", "Sekundarno 1" }, + { "Secondary2Info", "Neaktivni zavihki, Izbrana (pritisnjena) polja, Neaktivne meje + tekst" }, + { "Secondary2", "Sekundarno 2" }, + { "Secondary3Info", "Ozadje" }, + { "Secondary3", "Sekundarno 3" }, + // + { "ControlFontInfo", "Pisava za kontrole" }, + { "ControlFont", "Pisava za oznake" }, + { "SystemFontInfo", "Nasveti, listi drevesa" }, + { "SystemFont", "Sistemska pisava" }, + { "UserFontInfo", "Uporabni\u0161ko vne\u0161eni podatki" }, + { "UserFont", "Pisava za polje" }, +// { "SmallFontInfo", "Reporti" }, + { "SmallFont", "Majhna pisava" }, + { "WindowTitleFont", "Pisava naslovov" }, + { "MenuFont", "Pisava menija" }, + // + { "MandatoryInfo", "Ozadje obveznega polja" }, + { "Mandatory", "Obvezno" }, + { "ErrorInfo", "Ozadje polja z napako" }, + { "Error", "Napaka" }, + { "InfoInfo", "Ozadje informacijskih polj" }, + { "Info", "Informacije" }, + { "WhiteInfo", "\u010crte" }, + { "White", "Belo" }, + { "BlackInfo", "\u010crte, tekst" }, + { "Black", "\u010crno" }, + { "InactiveInfo", "Ozadje neaktivnih polj" }, + { "Inactive", "Neaktivno" }, + { "TextOKInfo", "Barva pisave polja V redu" }, + { "TextOK", "Tekst - V redu" }, + { "TextIssueInfo", "Barva teksta napake" }, + { "TextIssue", "Tekst - Napaka" }, + // + { "FontChooser", "Font Chooser" }, + { "Fonts", "Fonts" }, + { "Plain", "Plain" }, + { "Italic", "Italic" }, + { "Bold", "Bold" }, + { "BoldItalic", "Bold & Italic" }, + { "Name", "Ime" }, + { "Size", "Velikost" }, + { "Style", "Stil" }, + { "TestString", "To je samo test. The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Font" }, + // + { "AdempiereColorEditor", "Adempiere Color Editor" }, + { "AdempiereType", "Color Type" }, + { "GradientUpperColor", "Gradient Upper Color" }, + { "GradientLowerColor", "Gradient Lower Color" }, + { "GradientStart", "Gradient Start" }, + { "GradientDistance", "Gradient Distance" }, + { "TextureURL", "Texture URL" }, + { "TextureAlpha", "Texture Alpha" }, + { "TextureTaintColor", "Texture Taint Color" }, + { "LineColor", "Line Color" }, + { "LineBackColor", "Background Color" }, + { "LineWidth", "Line Width" }, + { "LineDistance", "Line Distance" }, + { "FlatColor", "Flat Color" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res + diff --git a/looks/src/org/compiere/plaf/PlafRes_sv.java b/looks/src/org/compiere/plaf/PlafRes_sv.java new file mode 100644 index 0000000000..4212903cce --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_sv.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Swedish Translation Texts for Look & Feel + * + * @author Thomas Dilts + * @version $Id: PlafRes_sv.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_sv extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Bakgrundsf�rgtyp" }, + { "BackColType_Flat", "Platt" }, + { "BackColType_Gradient", "Toning" }, + { "BackColType_Lines", "Linjer" }, + { "BackColType_Texture", "Struktur" }, + // + { "LookAndFeelEditor", "Utseenderedigeringsprogram" }, + { "LookAndFeel", "Utseendet" }, + { "Theme", "Tema" }, + { "EditAdempiereTheme", "Redigera adempiere tema" }, + { "SetDefault", "Standardbakgrund" }, + { "SetDefaultColor", "Bakgrundsf�rg" }, + { "ColorBlind", "Bristf�lligf�rg" }, + { "Example", "Exempel" }, + { "Reset", "�terst�lla" }, + { "OK", "OK" }, + { "Cancel", "Avbryt" }, + // + { "AdempiereThemeEditor", "Adempiere temaredigeringsprogram" }, + { "MetalColors", "Metal f�rg" }, + { "AdempiereColors", "Adempiere f�rger" }, + { "AdempiereFonts", "Adempiere teckensnitt" }, + { "Primary1Info", "Skugga, avskiljare" }, + { "Primary1", "Prim�r 1" }, + { "Primary2Info", "Fokus linje, vald meny" }, + { "Primary2", "Prim�r 2" }, + { "Primary3Info", "Tabel vald rad, vald text, knappbeskrivning bakgrund" }, + { "Primary3", "Prim�r 3" }, + { "Secondary1Info", "Ram linjer" }, + { "Secondary1", "Sekund�r 1" }, + { "Secondary2Info", "Inactiv tabbar, nedtrycktf�lt, inactive ram + text" }, + { "Secondary2", "Sekund�r 2" }, + { "Secondary3Info", "Bakgrund" }, + { "Secondary3", "Sekund�r 3" }, + // + { "ControlFontInfo", "Kontrolteckensnitt" }, + { "ControlFont", "Textetiketter teckensnitt" }, + { "SystemFontInfo", "Knappbeskrivning, Tr�d gren" }, + { "SystemFont", "System teckensnitt" }, + { "UserFontInfo", "Anv�ndare angiven data" }, + { "UserFont", "F�lt teckensnitt" }, +// { "SmallFontInfo", "Reports" }, + { "SmallFont", "Liten teckensnitt" }, + { "WindowTitleFont", "Rubrik teckensnitt" }, + { "MenuFont", "Meny teckensnitt" }, + // + { "MandatoryInfo", "Obligatoriskt f�lt bakgrund" }, + { "Mandatory", "Obligatorisk" }, + { "ErrorInfo", "Fel f�lt bakgrund" }, + { "Error", "Fel" }, + { "InfoInfo", "Information f�lt bakgrund" }, + { "Info", "Information" }, + { "WhiteInfo", "Linjer" }, + { "White", "Vit" }, + { "BlackInfo", "Linjer, text" }, + { "Black", "Svart" }, + { "InactiveInfo", "Inactiv f�lt bakgrund" }, + { "Inactive", "Inactiv" }, + { "TextOKInfo", "OK text f�rgrund" }, + { "TextOK", "Text - OK" }, + { "TextIssueInfo", "Fel text f�rgrund" }, + { "TextIssue", "Text - Fel" }, + // + { "FontChooser", "Teckensnittv�ljare" }, + { "Fonts", "Teckensnitt" }, + { "Plain", "Oformaterad" }, + { "Italic", "Kursiv" }, + { "Bold", "Fet" }, + { "BoldItalic", "Fet & kursiv" }, + { "Name", "Namn" }, + { "Size", "Storlek" }, + { "Style", "Stil" }, + { "TestString", "Denna �r en test! ABCDEFG abcdefg ������. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "Teckensnitt" }, + // + { "AdempiereColorEditor", "Adempiere f�rgredigeringsprogram" }, + { "AdempiereType", "F�rgtyp" }, + { "GradientUpperColor", "Toning �verf�rg" }, + { "GradientLowerColor", "Toning underf�rg" }, + { "GradientStart", "Toning start" }, + { "GradientDistance", "Toning l�ngd" }, + { "TextureURL", "Struktur URL" }, + { "TextureAlpha", "Struktur Alpha" }, + { "TextureTaintColor", "Struktur fl�ckf�rg" }, + { "LineColor", "Linje f�rg" }, + { "LineBackColor", "Bakgrundsf�rg" }, + { "LineWidth", "Linje bred" }, + { "LineDistance", "Linje l�ngd" }, + { "FlatColor", "Mattf�rg" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_th.java b/looks/src/org/compiere/plaf/PlafRes_th.java new file mode 100644 index 0000000000..c8c020f7fe --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_th.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel (Thai) + * + * @author Sureeraya Limpaibul + * @version $Id: PlafRes_th.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_th extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e02\u0e2d\u0e07\u0e1e\u0e37\u0e49\u0e19\u0e2b\u0e25\u0e31\u0e07" }, + { "BackColType_Flat", "Flat" }, + { "BackColType_Gradient", "Gradient" }, + { "BackColType_Lines", "Lines" }, + { "BackColType_Texture", "Texture" }, + // + { "LookAndFeelEditor", "Look & Feel Editor" }, + { "LookAndFeel", "Look & Feel" }, + { "Theme", "Theme" }, + { "EditAdempiereTheme", "Edit Adempiere Theme" }, + { "SetDefault", "Default Background" }, + { "SetDefaultColor", "Background Color" }, + { "ColorBlind", "Color Deficiency" }, + { "Example", "\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07" }, + { "Reset", "Reset" }, + { "OK", "\u0e15\u0e01\u0e25\u0e07" }, + { "Cancel", "\u0e22\u0e01\u0e40\u0e25\u0e34\u0e01" }, + // + { "AdempiereThemeEditor", "Adempiere Theme Editor" }, + { "MetalColors", "Metal Colors" }, + { "AdempiereColors", "Adempiere Colors" }, + { "AdempiereFonts", "Adempiere Fonts" }, + { "Primary1Info", "Shadow, Separator" }, + { "Primary1", "Primary 1" }, + { "Primary2Info", "Focus Line, Selected Menu" }, + { "Primary2", "Primary 2" }, + { "Primary3Info", "Table Selected Row, Selected Text, ToolTip Background" }, + { "Primary3", "Primary 3" }, + { "Secondary1Info", "Border Lines" }, + { "Secondary1", "Secondary 1" }, + { "Secondary2Info", "Inactive Tabs, Pressed Fields, Inactive Border + Text" }, + { "Secondary2", "Secondary 2" }, + { "Secondary3Info", "Background" }, + { "Secondary3", "Secondary 3" }, + // + { "ControlFontInfo", "Control Font" }, + { "ControlFont", "Label Font" }, + { "SystemFontInfo", "Tool Tip, Tree nodes" }, + { "SystemFont", "System Font" }, + { "UserFontInfo", "User Entered Data" }, + { "UserFont", "Field Font" }, +// { "SmallFontInfo", "Reports" }, + { "SmallFont", "\u0e2d\u0e31\u0e01\u0e29\u0e23\u0e02\u0e19\u0e32\u0e14\u0e40\u0e25\u0e47\u0e01" }, + { "WindowTitleFont", "Title Font" }, + { "MenuFont", "\u0e40\u0e21\u0e19\u0e39\u0e2d\u0e31\u0e01\u0e29\u0e23" }, + // + { "MandatoryInfo", "Mandatory Field Background" }, + { "Mandatory", "Mandatory" }, + { "ErrorInfo", "Error Field Background" }, + { "Error", "Error" }, + { "InfoInfo", "Info Field Background" }, + { "Info", "Info" }, + { "WhiteInfo", "Lines" }, + { "White", "White" }, + { "BlackInfo", "Lines, Text" }, + { "Black", "Black" }, + { "InactiveInfo", "Inactive Field Background" }, + { "Inactive", "Inactive" }, + { "TextOKInfo", "OK Text Foreground" }, + { "TextOK", "Text - OK" }, + { "TextIssueInfo", "Error Text Foreground" }, + { "TextIssue", "Text - Error" }, + // + { "FontChooser", "\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e41\u0e1a\u0e1a\u0e2d\u0e31\u0e01\u0e29\u0e23" }, + { "Fonts", "\u0e15\u0e31\u0e27\u0e2d\u0e31\u0e01\u0e29\u0e23" }, + { "Plain", "\u0e18\u0e23\u0e23\u0e21\u0e14\u0e32" }, + { "Italic", "\u0e15\u0e31\u0e27\u0e40\u0e2d\u0e35\u0e22\u0e07" }, + { "Bold", "\u0e15\u0e31\u0e27\u0e2b\u0e19\u0e32" }, + { "BoldItalic", "\u0e15\u0e31\u0e27\u0e2b\u0e19\u0e32 \u0e15\u0e31\u0e27\u0e40\u0e2d\u0e35\u0e22\u0e07" }, + { "Name", "\u0e0a\u0e37\u0e48\u0e2d" }, + { "Size", "\u0e02\u0e19\u0e32\u0e14" }, + { "Style", "\u0e25\u0e31\u0e01\u0e29\u0e13\u0e30\u0e41\u0e1a\u0e1a\u0e2d\u0e31\u0e01\u0e29\u0e23" }, + { "TestString", "This is just a Test! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "\u0e15\u0e31\u0e27\u0e2d\u0e31\u0e01\u0e29\u0e23" }, + // + { "AdempiereColorEditor", "Adempiere Color Editor" }, + { "AdempiereType", "Color Type" }, + { "GradientUpperColor", "Gradient Upper Color" }, + { "GradientLowerColor", "Gradient Lower Color" }, + { "GradientStart", "Gradient Start" }, + { "GradientDistance", "Gradient Distance" }, + { "TextureURL", "Texture URL" }, + { "TextureAlpha", "Texture Alpha" }, + { "TextureTaintColor", "Texture Taint Color" }, + { "LineColor", "Line Color" }, + { "LineBackColor", "Background Color" }, + { "LineWidth", "Line Width" }, + { "LineDistance", "Line Distance" }, + { "FlatColor", "Flat Color" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_vi.java b/looks/src/org/compiere/plaf/PlafRes_vi.java new file mode 100644 index 0000000000..50e0f77ead --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_vi.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Bui Chi Trung + * @version $Id: PlafRes_vi.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class PlafRes_vi extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "Lo\u1EA1i m�u n\u1EC1n" }, + { "BackColType_Flat", "Ph\u1EB3ng" }, + { "BackColType_Gradient", "D\u1ED1c" }, + { "BackColType_Lines", "\u0110\u01B0\u1EDDng th\u1EB3ng" }, + { "BackColType_Texture", "\u0110an ch�o" }, + // + { "LookAndFeelEditor", "C�ng c\u1EE5 thay \u0111\u1ED5i V\u1EBB ngo�i v� C\u1EA3m nh\u1EADn" }, + { "LookAndFeel", "V\u1EBB ngo�i v� C\u1EA3m nh\u1EADn" }, + { "Theme", "Ch\u1EE7 \u0111\u1EC1" }, + { "EditAdempiereTheme", "Hi\u1EC7u ch\u1EC9nh ch\u1EE7 \u0111\u1EC1 C\u0103mpia-\u01A1" }, + { "SetDefault", "N\u1EC1n m\u1EB7c nhi�n" }, + { "SetDefaultColor", "M�u n\u1EC1n" }, + { "ColorBlind", "M� m�u" }, + { "Example", "V� d\u1EE5" }, + { "Reset", "C\u1EA5u h�nh l\u1EA1i" }, + { "OK", "\u0110\u1ED3ng �" }, + { "Cancel", "H\u1EE7y" }, + // + { "AdempiereThemeEditor", "C�ng c\u1EE5 thay \u0111\u1ED5i ch\u1EE7 \u0111\u1EC1 C\u0103mpia-\u01A1" }, + { "MetalColors", "B\u1ED9 m�u �nh kim" }, + { "AdempiereColors", "B\u1ED9 m�u C\u0103mpia-\u01A1" }, + { "AdempiereFonts", "B\u1ED9 Font C\u0103mpia-\u01A1" }, + { "Primary1Info", "B�ng, T�ch bi\u1EC7t" }, + { "Primary1", "Ch\u1EE7 \u0111\u1EA1o 1" }, + { "Primary2Info", "\u0110\u01B0\u1EDDng ti�u \u0111i\u1EC3m, Th\u1EF1c \u0111\u01A1n \u0111\u01B0\u1EE3c ch\u1ECDn" }, + { "Primary2", "Ch\u1EE7 \u0111\u1EA1o 2" }, + { "Primary3Info", "Table Selected Row, Selected Text, ToolTip Background" }, + { "Primary3", "Primary 3" }, + { "Secondary1Info", "\u0110\u01B0\u1EDDng bi�n" }, + { "Secondary1", "Ph\u1EE5 1" }, + { "Secondary2Info", "Inactive Tabs, Pressed Fields, Inactive Border + Text" }, + { "Secondary2", "Ph\u1EE5 2" }, + { "Secondary3Info", "N\u1EC1n" }, + { "Secondary3", "Ph\u1EE5 3" }, + // + { "ControlFontInfo", "Control Font" }, + { "ControlFont", "Label Font" }, + { "SystemFontInfo", "Tool Tip, Tree nodes" }, + { "SystemFont", "System Font" }, + { "UserFontInfo", "User Entered Data" }, + { "UserFont", "Field Font" }, +// { "SmallFontInfo", "Reports" }, + { "SmallFont", "Small Font" }, + { "WindowTitleFont", "Title Font" }, + { "MenuFont", "Menu Font" }, + // + { "MandatoryInfo", "N\u1EC1n c\u1EE7a tr\u01B0\u1EDDng b\u1EAFt bu\u1ED9c" }, + { "Mandatory", "B\u1EAFt bu\u1ED9c" }, + { "ErrorInfo", "N\u1EC1n c\u1EE7a tr\u01B0\u1EDDng b\u1ECB l\u1ED7i" }, + { "Error", "L\u1ED7i" }, + { "InfoInfo", "N\u1EC1n c\u1EE7a tr\u01B0\u1EDDng th�ng tin" }, + { "Info", "Th�ng tin" }, + { "WhiteInfo", "\u0110\u01B0\u1EDDng th\u1EB3ng" }, + { "White", "Tr\u1EAFng" }, + { "BlackInfo", "\u0110\u01B0\u1EDDng th\u1EB3ng, \u0110o\u1EA1n v\u0103n" }, + { "Black", "Black" }, + { "InactiveInfo", "Inactive Field Background" }, + { "Inactive", "Inactive" }, + { "TextOKInfo", "OK Text Foreground" }, + { "TextOK", "Text - OK" }, + { "TextIssueInfo", "Error Text Foreground" }, + { "TextIssue", "Text - Error" }, + // + { "FontChooser", "Ch\u1ECDn Font" }, + { "Fonts", "Fonts" }, + { "Plain", "Plain" }, + { "Italic", "Italic" }, + { "Bold", "Bold" }, + { "BoldItalic", "Bold & Italic" }, + { "Name", "T�n" }, + { "Size", "K�ch th\u01B0\u1EDBc" }, + { "Style", "Ki\u1EC3u" }, + { "TestString", "\u0110�y ch\u1EC9 l� ph\u1EA7n th\u1EED nghi\u1EC7m" }, + { "FontString", "Font" }, + // + { "AdempiereColorEditor", "C�ng c\u1EE5 thay \u0111\u1ED5i m�u C\u0103mpia-\u01A1" }, + { "AdempiereType", "Lo\u1EA1i m�u" }, + { "GradientUpperColor", "Gradient Upper Color" }, + { "GradientLowerColor", "Gradient Lower Color" }, + { "GradientStart", "Gradient Start" }, + { "GradientDistance", "Gradient Distance" }, + { "TextureURL", "Texture URL" }, + { "TextureAlpha", "Texture Alpha" }, + { "TextureTaintColor", "Texture Taint Color" }, + { "LineColor", "Line Color" }, + { "LineBackColor", "Background Color" }, + { "LineWidth", "Chi\u1EC1u r\u1ED9ng \u0111\u01B0\u1EDDng" }, + { "LineDistance", "Chi\u1EC1u xa \u0111\u01B0\u1EDDng" }, + { "FlatColor", "M�u ph\u1EB3ng" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_zh.java b/looks/src/org/compiere/plaf/PlafRes_zh.java new file mode 100644 index 0000000000..4ea7802ebd --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_zh.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author Kirin Lin + * @version $Id: PlafRes_zh.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class PlafRes_zh extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "\u80cc\u666f\u984f\u8272" }, + { "BackColType_Flat", "\u55ae\u8272" }, + { "BackColType_Gradient", "\u6f38\u5c64" }, + { "BackColType_Lines", "\u689d\u7d0b" }, + { "BackColType_Texture", "\u5716\u6848" }, + // + { "LookAndFeelEditor", "\u5916\u89c0\u7de8\u8f2f\u5668" }, + { "LookAndFeel", "\u5916\u89c0" }, + { "Theme", "\u4f48\u666f" }, + { "EditAdempiereTheme", "\u7de8\u8f2f Adempiere \u4f48\u666f" }, + { "SetDefault", "\u8a2d\u6210\u9810\u8a2d\u80cc\u666f" }, + { "SetDefaultColor", "\u80cc\u666f\u984f\u8272" }, + { "ColorBlind", "\u8272\u5dee" }, + { "Example", "\u7bc4\u4f8b" }, + { "Reset", "\u91cd\u7f6e" }, + { "OK", "\u78ba\u5b9a" }, + { "Cancel", "\u53d6\u6d88" }, + // + { "AdempiereThemeEditor", "Adempiere \u4f48\u666f\u7de8\u8f2f\u5668" }, + { "MetalColors", "\u91d1\u5c6c\u8272\u7cfb" }, + { "AdempiereColors", "Adempiere \u984f\u8272" }, + { "AdempiereFonts", "Adempiere \u5b57\u578b" }, + { "Primary1Info", "\u9670\u5f71, \u5206\u9694" }, + { "Primary1", "\u4e3b\u8981\u8272 1" }, + { "Primary2Info", "\u7126\u9ede\u7dda\u6846, \u9078\u55ae\u7126\u9ede" }, + { "Primary2", "\u4e3b\u8981\u8272 2" }, + { "Primary3Info", "\u9078\u53d6\u7684\u884c, \u9078\u53d6\u7684\u5b57, \u5de5\u5177\u63d0\u793a\u80cc\u666f" }, + { "Primary3", "\u4e3b\u8981\u8272 3" }, + { "Secondary1Info", "\u908a\u6846" }, + { "Secondary1", "\u6b21\u8981\u8272 1" }, + { "Secondary2Info", "\u975e\u6d3b\u52d5 Tabs, \u6309\u4e0b\u7684\u6309\u9215\u908a\u7de3, \u975e\u6d3b\u52d5\u5340\u908a\u6846 + \u6587\u5b57" }, + { "Secondary2", "\u6b21\u8981\u8272 2" }, + { "Secondary3Info", "\u80cc\u666f" }, + { "Secondary3", "\u6b21\u8981\u8272 3" }, + // + { "ControlFontInfo", "\u63a7\u5236\u8a0a\u606f\u5b57\u578b" }, + { "ControlFont", "\u6a19\u7c64\u5b57\u578b" }, + { "SystemFontInfo", "\u5de5\u5177\u63d0\u793a, \u6a39\u72c0\u76ee\u9304" }, + { "SystemFont", "\u7cfb\u7d71\u5b57\u578b" }, + { "UserFontInfo", "\u4f7f\u7528\u8005\u8f38\u5165\u8cc7\u6599" }, + { "UserFont", "\u6b04\u4f4d\u5b57\u578b" }, +// { "SmallFontInfo", "\u5831\u8868" }, + { "SmallFont", "\u5c0f\u5b57\u578b" }, + { "WindowTitleFont", "\u6a19\u984c\u5b57\u578b" }, + { "MenuFont", "\u9078\u55ae\u5b57\u578b" }, + // + { "MandatoryInfo", "\u9078\u9805\u6b04\u4f4d\u80cc\u666f" }, + { "Mandatory", "\u9078\u9805" }, + { "ErrorInfo", "\u932f\u8aa4\u8a0a\u606f\u80cc\u666f" }, + { "Error", "\u932f\u8aa4\u8a0a\u606f" }, + { "InfoInfo", "\u4e00\u822c\u8a0a\u606f\u6b04\u4f4d\u80cc\u666f" }, + { "Info", "\u4e00\u822c\u8a0a\u606f" }, + { "WhiteInfo", "\u7dda\u689d" }, + { "White", "\u767d" }, + { "BlackInfo", "\u7dda\u689d, \u6587\u5b57" }, + { "Black", "\u9ed1" }, + { "InactiveInfo", "\u975e\u6d3b\u52d5\u6b04\u4f4d\u80cc\u666f" }, + { "Inactive", "\u975e\u6d3b\u52d5" }, + { "TextOKInfo", "\u78ba\u5b9a\u9805\u524d\u666f\u8272" }, + { "TextOK", "\u6587\u5b57 - \u78ba\u5b9a" }, + { "TextIssueInfo", "\u932f\u8aa4\u9805\u524d\u666f\u8272" }, + { "TextIssue", "\u6587\u5b57 - \u932f\u8aa4" }, + // + { "FontChooser", "\u5b57\u578b\u8a2d\u5b9a" }, + { "Fonts", "\u5b57\u9ad4" }, + { "Plain", "\u4e00\u822c" }, + { "Italic", "\u659c\u9ad4" }, + { "Bold", "\u7c97\u9ad4" }, + { "BoldItalic", "\u7c97\u659c\u9ad4" }, + { "Name", "\u540d\u7a31" }, + { "Size", "\u5927\u5c0f" }, + { "Style", "\u98a8\u683c" }, + { "TestString", "\u9019\u662f\u6e2c\u8a66! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "\u5b57\u9ad4" }, + // + { "AdempiereColorEditor", "Adempiere \u984f\u8272\u7de8\u8f2f\u5668" }, + { "AdempiereType", "\u984f\u8272\u7a2e\u985e" }, + { "GradientUpperColor", "\u6f38\u5c64\u8272 1" }, + { "GradientLowerColor", "\u6f38\u5c64\u8272 2" }, + { "GradientStart", "\u6f38\u5c64\u65b9\u5411" }, + { "GradientDistance", "\u9593\u8ddd" }, + { "TextureURL", "\u5716\u6848 URL" }, + { "TextureAlpha", "\u5716\u6848\u900f\u660e\u5ea6" }, + { "TextureTaintColor", "\u5716\u6848\u8457\u8272" }, + { "LineColor", "\u7dda\u689d\u984f\u8272" }, + { "LineBackColor", "\u80cc\u666f\u984f\u8272" }, + { "LineWidth", "\u7dda\u689d\u5bec\u5ea6" }, + { "LineDistance", "\u7dda\u689d\u9593\u8ddd" }, + { "FlatColor", "\u55ae\u8272" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/PlafRes_zh_CN.java b/looks/src/org/compiere/plaf/PlafRes_zh_CN.java new file mode 100644 index 0000000000..fc1764e83c --- /dev/null +++ b/looks/src/org/compiere/plaf/PlafRes_zh_CN.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +import java.util.ListResourceBundle; + +/** + * Translation Texts for Look & Feel + * + * @author ZhaoXing Meng + * @version $Id: PlafRes_zh_CN.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class PlafRes_zh_CN extends ListResourceBundle +{ + /** The data */ + static final Object[][] contents = new String[][] + { + { "BackColType", "\u80cc\u666f\u989c\u8272" }, + { "BackColType_Flat", "\u5355\u8272" }, + { "BackColType_Gradient", "\u6e10\u53d8" }, + { "BackColType_Lines", "\u6761\u7eb9" }, + { "BackColType_Texture", "\u56fe\u6587" }, + // + { "LookAndFeelEditor", "\u5916\u89c2\u7f16\u8f91\u5668" }, + { "LookAndFeel", "\u5916\u89c2" }, + { "Theme", "\u5e03\u666f" }, + { "EditAdempiereTheme", "\u7f16\u8f91 Adempiere \u5e03\u666f" }, + { "SetDefault", "\u8bbe\u6210\u9884\u5b9a\u80cc\u666f" }, + { "SetDefaultColor", "\u80cc\u666f\u989c\u8272" }, + { "ColorBlind", "\u8272\u5dee" }, + { "Example", "\u8303\u4f8b" }, + { "Reset", "\u91cd\u8bbe" }, + { "OK", "\u786e\u8ba4" }, + { "Cancel", "\u64a4\u6d88" }, + // + { "AdempiereThemeEditor", "Adempiere \u5e03\u666f\u7f16\u8f91\u5668" }, + { "MetalColors", "\u91d1\u5c5e\u8272\u7cfb" }, + { "AdempiereColors", "Adempiere \u989c\u8272" }, + { "AdempiereFonts", "Adempiere \u5b57\u4f53" }, + { "Primary1Info", "\u9634\u5f71, \u5206\u9694" }, + { "Primary1", "\u4e3b\u8981\u8272 1" }, + { "Primary2Info", "\u7126\u70b9\u7ebf\u6846, \u83dc\u5355\u7126\u70b9" }, + { "Primary2", "\u4e3b\u8981\u8272 2" }, + { "Primary3Info", "\u9009\u62e9\u7684\u884c, \u9009\u62e9\u7684\u6587\u5b57, \u5de5\u5177\u63d0\u793a\u80cc\u666f" }, + { "Primary3", "\u4e3b\u8981\u8272 3" }, + { "Secondary1Info", "\u8fb9\u6846" }, + { "Secondary1", "\u6b21\u8981\u8272 1" }, + { "Secondary2Info", "\u975e\u6d3b\u52a8\u6807\u7b7e, \u6309\u4e0b\u7684\u6309\u94ae\u8fb9\u7f18, \u975e\u6d3b\u52a8\u533a\u8fb9\u6846 + \u6587\u5b57" }, + { "Secondary2", "\u6b21\u8981\u8272 2" }, + { "Secondary3Info", "\u80cc\u666f" }, + { "Secondary3", "\u6b21\u8981\u8272 3" }, + // + { "ControlFontInfo", "\u63a7\u5236\u4fe1\u606f\u5b57\u4f53" }, + { "ControlFont", "\u6807\u7b7e\u5b57\u4f53" }, + { "SystemFontInfo", "\u5de5\u5177\u63d0\u793a, \u6811\u72b6\u76ee\u5f55" }, + { "SystemFont", "\u7cfb\u7edf\u5b57\u4f53" }, + { "UserFontInfo", "\u4f7f\u7528\u8005\u8f93\u5165\u6570\u636e" }, + { "UserFont", "\u5b57\u6bb5\u5b57\u4f53" }, +// { "SmallFontInfo", "\u62a5\u8868" }, + { "SmallFont", "\u5c0f\u5b57\u4f53" }, + { "WindowTitleFont", "\u6807\u9898\u5b57\u4f53" }, + { "MenuFont", "\u83dc\u5355\u5b57\u4f53" }, + // + { "MandatoryInfo", "\u9009\u9879\u5b57\u6bb5\u80cc\u666f" }, + { "Mandatory", "\u9009\u9879" }, + { "ErrorInfo", "\u9519\u8bef\u5b57\u6bb5\u80cc\u666f" }, + { "Error", "\u9519\u8bef\u4fe1\u606f" }, + { "InfoInfo", "\u4e00\u822c\u4fe1\u606f\u5b57\u6bb5\u80cc\u666f" }, + { "Info", "\u4e00\u822c\u4fe1\u606f" }, + { "WhiteInfo", "\u7ebf\u6761" }, + { "White", "\u767d" }, + { "BlackInfo", "\u7ebf\u6761, \u6587\u5b57" }, + { "Black", "\u9ed1" }, + { "InactiveInfo", "\u975e\u6d3b\u52a8\u5b57\u6bb5\u80cc\u666f" }, + { "Inactive", "\u975e\u6d3b\u52a8" }, + { "TextOKInfo", "\u786e\u8ba4 - \u524d\u666f\u8272" }, + { "TextOK", "\u6587\u5b57 - \u786e\u8ba4" }, + { "TextIssueInfo", "\u9519\u8bef\u6587\u5b57\u524d\u666f\u8272" }, + { "TextIssue", "\u6587\u5b57 - \u9519\u8bef" }, + // + { "FontChooser", "\u5b57\u4f53\u9009\u62e9" }, + { "Fonts", "\u5b57\u4f53" }, + { "Plain", "\u666e\u901a" }, + { "Italic", "\u659c\u4f53" }, + { "Bold", "\u7c97\u4f53" }, + { "BoldItalic", "\u7c97\u659c\u4f53" }, + { "Name", "\u540d\u79f0" }, + { "Size", "\u5927\u5c0f" }, + { "Style", "\u7c7b\u578b" }, + { "TestString", "\u8fd9\u662f\u6d4b\u8bd5! The quick brown Fox is doing something. 12,3456.78 LetterLOne = l1 LetterOZero = O0" }, + { "FontString", "\u5b57\u4f53" }, + // + { "AdempiereColorEditor", "Adempiere \u989c\u8272\u7f16\u8f91\u5668" }, + { "AdempiereType", "\u989c\u8272\u79cd\u7c7b" }, + { "GradientUpperColor", "\u6e10\u589e\u8272 1" }, + { "GradientLowerColor", "\u6e10\u51cf\u8272 2" }, + { "GradientStart", "\u6e10\u589e\u65b9\u5411" }, + { "GradientDistance", "\u95f4\u8ddd" }, + { "TextureURL", "\u56fe\u6848 URL" }, + { "TextureAlpha", "\u56fe\u6848\u900f\u660e\u5ea6" }, + { "TextureTaintColor", "\u56fe\u6848\u7740\u8272" }, + { "LineColor", "\u7ebf\u6761\u989c\u8272" }, + { "LineBackColor", "\u80cc\u666f\u989c\u8272" }, + { "LineWidth", "\u7ebf\u6761\u5bbd\u5ea6" }, + { "LineDistance", "\u7ebf\u6761\u95f4\u8ddd" }, + { "FlatColor", "\u5355\u8272" } + }; + + /** + * Get Contents + * @return contents + */ + public Object[][] getContents() + { + return contents; + } +} // Res diff --git a/looks/src/org/compiere/plaf/RubyTheme.java b/looks/src/org/compiere/plaf/RubyTheme.java new file mode 100644 index 0000000000..cd804ea184 --- /dev/null +++ b/looks/src/org/compiere/plaf/RubyTheme.java @@ -0,0 +1,44 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.plaf; + +/* + * @(#)RubyTheme.java 1.9 04/07/26 + */ + +import javax.swing.plaf.*; +import javax.swing.plaf.metal.*; + +/** + * This class describes a theme using red colors. + * + * @version 1.9 07/26/04 + * @author Jeff Dinkins + */ +public class RubyTheme extends DefaultMetalTheme { + + public String getName() { return "Ruby"; } + + private final ColorUIResource primary1 = new ColorUIResource(80, 10, 22); + private final ColorUIResource primary2 = new ColorUIResource(193, 10, 44); + private final ColorUIResource primary3 = new ColorUIResource(244, 10, 66); + + protected ColorUIResource getPrimary1() { return primary1; } + protected ColorUIResource getPrimary2() { return primary2; } + protected ColorUIResource getPrimary3() { return primary3; } + +} diff --git a/looks/src/org/compiere/plaf/icons/CL16.gif b/looks/src/org/compiere/plaf/icons/CL16.gif new file mode 100644 index 0000000000..27d903c3e2 Binary files /dev/null and b/looks/src/org/compiere/plaf/icons/CL16.gif differ diff --git a/looks/src/org/compiere/plaf/icons/CL32.gif b/looks/src/org/compiere/plaf/icons/CL32.gif new file mode 100644 index 0000000000..c83d267cbd Binary files /dev/null and b/looks/src/org/compiere/plaf/icons/CL32.gif differ diff --git a/looks/src/org/compiere/plaf/icons/Cancel24.gif b/looks/src/org/compiere/plaf/icons/Cancel24.gif new file mode 100644 index 0000000000..d91a52dc0c Binary files /dev/null and b/looks/src/org/compiere/plaf/icons/Cancel24.gif differ diff --git a/looks/src/org/compiere/plaf/icons/Error.gif b/looks/src/org/compiere/plaf/icons/Error.gif new file mode 100644 index 0000000000..b2ac9f57b4 Binary files /dev/null and b/looks/src/org/compiere/plaf/icons/Error.gif differ diff --git a/looks/src/org/compiere/plaf/icons/Inform.gif b/looks/src/org/compiere/plaf/icons/Inform.gif new file mode 100644 index 0000000000..2ac57475c3 Binary files /dev/null and b/looks/src/org/compiere/plaf/icons/Inform.gif differ diff --git a/looks/src/org/compiere/plaf/icons/Ok24.gif b/looks/src/org/compiere/plaf/icons/Ok24.gif new file mode 100644 index 0000000000..027d18f531 Binary files /dev/null and b/looks/src/org/compiere/plaf/icons/Ok24.gif differ diff --git a/looks/src/org/compiere/plaf/icons/Question.gif b/looks/src/org/compiere/plaf/icons/Question.gif new file mode 100644 index 0000000000..dc19aa1706 Binary files /dev/null and b/looks/src/org/compiere/plaf/icons/Question.gif differ diff --git a/looks/src/org/compiere/plaf/icons/Warn.gif b/looks/src/org/compiere/plaf/icons/Warn.gif new file mode 100644 index 0000000000..a05e160c20 Binary files /dev/null and b/looks/src/org/compiere/plaf/icons/Warn.gif differ diff --git a/looks/src/org/compiere/plaf/package.html b/looks/src/org/compiere/plaf/package.html new file mode 100644 index 0000000000..bcca4ad220 --- /dev/null +++ b/looks/src/org/compiere/plaf/package.html @@ -0,0 +1,24 @@ + + + + + +

Provides for Pluggabe Look & Feel User Interface. +

+

Package Specification

+ +

The classes extend the Metal Look & Feel.

+

Related Documentation

+ +For overviews, tutorials, examples, guides, and tool documentation, please see +http://www.adempiere.org/looks + + diff --git a/looks/src/org/compiere/plaf/sounds/FrameClose.wav b/looks/src/org/compiere/plaf/sounds/FrameClose.wav new file mode 100644 index 0000000000..873285b1ef Binary files /dev/null and b/looks/src/org/compiere/plaf/sounds/FrameClose.wav differ diff --git a/looks/src/org/compiere/plaf/sounds/FrameMaximize.wav b/looks/src/org/compiere/plaf/sounds/FrameMaximize.wav new file mode 100644 index 0000000000..49905b8367 Binary files /dev/null and b/looks/src/org/compiere/plaf/sounds/FrameMaximize.wav differ diff --git a/looks/src/org/compiere/plaf/sounds/FrameMinimize.wav b/looks/src/org/compiere/plaf/sounds/FrameMinimize.wav new file mode 100644 index 0000000000..2dab1ce569 Binary files /dev/null and b/looks/src/org/compiere/plaf/sounds/FrameMinimize.wav differ diff --git a/looks/src/org/compiere/plaf/sounds/FrameRestoreDown.wav b/looks/src/org/compiere/plaf/sounds/FrameRestoreDown.wav new file mode 100644 index 0000000000..4363f479d3 Binary files /dev/null and b/looks/src/org/compiere/plaf/sounds/FrameRestoreDown.wav differ diff --git a/looks/src/org/compiere/plaf/sounds/FrameRestoreUp.wav b/looks/src/org/compiere/plaf/sounds/FrameRestoreUp.wav new file mode 100644 index 0000000000..d82b011188 Binary files /dev/null and b/looks/src/org/compiere/plaf/sounds/FrameRestoreUp.wav differ diff --git a/looks/src/org/compiere/plaf/sounds/MenuItemCommand.wav b/looks/src/org/compiere/plaf/sounds/MenuItemCommand.wav new file mode 100644 index 0000000000..487746c661 Binary files /dev/null and b/looks/src/org/compiere/plaf/sounds/MenuItemCommand.wav differ diff --git a/looks/src/org/compiere/plaf/sounds/OptionPaneError.wav b/looks/src/org/compiere/plaf/sounds/OptionPaneError.wav new file mode 100644 index 0000000000..55e39eb499 Binary files /dev/null and b/looks/src/org/compiere/plaf/sounds/OptionPaneError.wav differ diff --git a/looks/src/org/compiere/plaf/sounds/OptionPaneInformation.wav b/looks/src/org/compiere/plaf/sounds/OptionPaneInformation.wav new file mode 100644 index 0000000000..6dad743f1d Binary files /dev/null and b/looks/src/org/compiere/plaf/sounds/OptionPaneInformation.wav differ diff --git a/looks/src/org/compiere/plaf/sounds/OptionPaneQuestion.wav b/looks/src/org/compiere/plaf/sounds/OptionPaneQuestion.wav new file mode 100644 index 0000000000..82eccb4f76 Binary files /dev/null and b/looks/src/org/compiere/plaf/sounds/OptionPaneQuestion.wav differ diff --git a/looks/src/org/compiere/plaf/sounds/OptionPaneWarning.wav b/looks/src/org/compiere/plaf/sounds/OptionPaneWarning.wav new file mode 100644 index 0000000000..64ddda2aeb Binary files /dev/null and b/looks/src/org/compiere/plaf/sounds/OptionPaneWarning.wav differ diff --git a/looks/src/org/compiere/plaf/sounds/PopupMenuPopup.wav b/looks/src/org/compiere/plaf/sounds/PopupMenuPopup.wav new file mode 100644 index 0000000000..1eb388fced Binary files /dev/null and b/looks/src/org/compiere/plaf/sounds/PopupMenuPopup.wav differ diff --git a/looks/src/org/compiere/plaf/vincent.jpg b/looks/src/org/compiere/plaf/vincent.jpg new file mode 100644 index 0000000000..0ee8ede107 Binary files /dev/null and b/looks/src/org/compiere/plaf/vincent.jpg differ diff --git a/looks/src/org/compiere/swing/CButton.java b/looks/src/org/compiere/swing/CButton.java new file mode 100644 index 0000000000..739a00e221 --- /dev/null +++ b/looks/src/org/compiere/swing/CButton.java @@ -0,0 +1,295 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.*; +import javax.swing.*; +import org.compiere.plaf.*; +import org.compiere.util.*; + +/** + * Adempiere Button supporting colored Background + * + * @author Jorg Janke + * @version $Id: CButton.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CButton extends JButton implements CEditor +{ + /** + * Creates a button with no set text or icon. + */ + public CButton() + { + this (null, null); + } // CButton + + /** + * Creates a button with an icon. + * + * @param icon the Icon image to display on the button + */ + public CButton(Icon icon) + { + this (null, icon); + } // CButton + + /** + * Creates a button with text. + * + * @param text the text of the button + */ + public CButton(String text) + { + this (text, null); + } // CButton + + /** + * Creates a button where properties are taken from the + * Action supplied. + * + * @param a the Action used to specify the new button + * + * @since 1.3 + */ + public CButton (Action a) + { + super (a); + setContentAreaFilled(false); + setOpaque(false); + } // CButton + + /** + * Creates a button with initial text and an icon. + * + * @param text the text of the button + * @param icon the Icon image to display on the button + */ + public CButton(String text, Icon icon) + { + super (text, icon); + setContentAreaFilled(false); + setOpaque(false); + // + setFont(AdempierePLAF.getFont_Label()); + setForeground(AdempierePLAF.getTextColor_Label()); + } // CButton + + + /************************************************************************** + * Set Background - Differentiates between system & user call. + * If User Call, sets Opaque & ContextAreaFilled to true + * @param bg background color + */ + public void setBackground (Color bg) + { + if (bg.equals(getBackground())) + return; + super.setBackground (bg); + // ignore calls from javax.swing.LookAndFeel.installColors(LookAndFeel.java:61) + if (!Trace.getCallerClass(1).startsWith("javax")) + { + setOpaque(true); + setContentAreaFilled(true); + } + this.repaint(); + } // setBackground + + /** + * Set Background - NOP + * @param error error + */ + public void setBackground (boolean error) + { + } // setBackground + + /** + * Set Standard Background + */ + public void setBackgroundColor () + { + setBackgroundColor (null); + } // setBackground + + /** + * Set Background + * @param bg AdempiereColor for Background, if null set standard background + */ + public void setBackgroundColor (AdempiereColor bg) + { + if (bg == null) + bg = AdempiereColor.getDefaultBackground(); + setOpaque(true); + putClientProperty(AdempierePLAF.BACKGROUND, bg); + super.setBackground (bg.getFlatColor()); + this.repaint(); + } // setBackground + + /** + * Get Background + * @return Color for Background + */ + public AdempiereColor getBackgroundColor () + { + try + { + return (AdempiereColor)getClientProperty(AdempierePLAF.BACKGROUND); + } + catch (Exception e) + { + System.err.println("CButton - ClientProperty: " + e.getMessage()); + } + return null; + } // getBackgroundColor + + /** Mandatory (default false) */ + private boolean m_mandatory = false; + /** Read-Write */ + private boolean m_readWrite = true; + + /** + * Set Editor Mandatory + * @param mandatory true, if you have to enter data + */ + public void setMandatory (boolean mandatory) + { + m_mandatory = mandatory; + setBackground(false); + } // setMandatory + + /** + * Is Field mandatory + * @return true, if mandatory + */ + public boolean isMandatory() + { + return m_mandatory; + } // isMandatory + + /** + * Enable Editor + * @param rw true, if you can enter/select data + */ + public void setReadWrite (boolean rw) + { + if (isEnabled() != rw) + setEnabled(rw); + m_readWrite = rw; + } // setReadWrite + + /** + * Is it possible to edit + * @return true, if editable + */ + public boolean isReadWrite() + { + return m_readWrite; + } // isReadWrite + + /** + * Set Editor to value + * @param value value of the editor + */ + public void setValue (Object value) + { + if (value == null) + setText(""); + else + setText(value.toString()); + } // setValue + + /** + * Return Editor value + * @return current value + */ + public Object getValue() + { + return getText(); + } // getValue + + /** + * Return Display Value + * @return displayed String value + */ + public String getDisplay() + { + return getText(); + } // getDisplay + + /** + * Set Text & Mnemonic + * @param text text + */ + public void setText (String text) + { + if (text == null) + { + super.setText(text); + return; + } + int pos = text.indexOf("&"); + if (pos != -1) // We have a nemonic - creates ALT-_ + { + int mnemonic = text.toUpperCase().charAt(pos+1); + if (mnemonic != ' ') + { + setMnemonic(mnemonic); + text = text.substring(0, pos) + text.substring(pos+1); + } + } + super.setText (text); + if (getName() == null) + setName (text); + } // setText + + /** + * Set Tool Tip Text & Mnemonic + * @param text text + */ + public void setToolTipText (String text) + { + if (text == null) + { + super.setText(text); + return; + } + int pos = text.indexOf("&"); + if (pos != -1) // We have a nemonic - creates ALT-_ + { + int mnemonic = text.toUpperCase().charAt(pos+1); + if (mnemonic != ' ') + { + setMnemonic(mnemonic); + text = text.substring(0, pos) + text.substring(pos+1); + } + } + super.setToolTipText (text); + if (getName() == null) + setName (text); + } // setToolTipText + + /** + * Set Action Command + * @param actionCommand command + */ + public void setActionCommand (String actionCommand) + { + super.setActionCommand (actionCommand); + if (getName() == null && actionCommand != null && actionCommand.length() > 0) + setName(actionCommand); + } // setActionCommand + +} // CButton diff --git a/looks/src/org/compiere/swing/CCheckBox.java b/looks/src/org/compiere/swing/CCheckBox.java new file mode 100644 index 0000000000..0f2ad113ce --- /dev/null +++ b/looks/src/org/compiere/swing/CCheckBox.java @@ -0,0 +1,298 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.Color; + +import javax.swing.Action; +import javax.swing.Icon; +import javax.swing.JCheckBox; + +import org.compiere.plaf.AdempierePLAF; + +/** + * Adempiere CheckBox + * + * @author Jorg Janke + * @version $Id: CCheckBox.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CCheckBox extends JCheckBox implements CEditor +{ + /** + * Creates an initially unselected check box button with no text, no icon. + */ + public CCheckBox () + { + super (); + init(); + } + + /** + * Creates an initially unselected check box with an icon. + * + * @param icon the Icon image to display + */ + public CCheckBox(Icon icon) + { + super (icon); + init(); + } + + /** + * Creates a check box with an icon and specifies whether + * or not it is initially selected. + * + * @param icon the Icon image to display + * @param selected a boolean value indicating the initial selection + * state. If true the check box is selected + */ + public CCheckBox(Icon icon, boolean selected) + { + super (icon, selected); + init(); + } + + /** + * Creates an initially unselected check box with text. + * + * @param text the text of the check box. + */ + public CCheckBox (String text) + { + super (text); + init(); + } + + /** + * Creates a check box where properties are taken from the + * Action supplied. + * @param a + */ + public CCheckBox(Action a) + { + super (a); + init(); + } + + /** + * Creates a check box with text and specifies whether + * or not it is initially selected. + * + * @param text the text of the check box. + * @param selected a boolean value indicating the initial selection + * state. If true the check box is selected + */ + public CCheckBox (String text, boolean selected) + { + super (text, selected); + init(); + } + + /** + * Creates an initially unselected check box with + * the specified text and icon. + * + * @param text the text of the check box. + * @param icon the Icon image to display + */ + public CCheckBox(String text, Icon icon) + { + super (text, icon, false); + init(); + } + + /** + * Creates a check box with text and icon, + * and specifies whether or not it is initially selected. + * + * @param text the text of the check box. + * @param icon the Icon image to display + * @param selected a boolean value indicating the initial selection + * state. If true the check box is selected + */ + public CCheckBox (String text, Icon icon, boolean selected) + { + super (text, icon, selected); + init(); + } + + /** + * Common Init + */ + private void init() + { + setFont(AdempierePLAF.getFont_Label()); + setForeground(AdempierePLAF.getTextColor_Label()); + } // init + + /*************************************************************************/ + + /** Mandatory (default false) */ + private boolean m_mandatory = false; + /** Read-Write */ + private boolean m_readWrite = true; + + + /** + * Set Editor Mandatory + * @param mandatory true, if you have to enter data + */ + public void setMandatory (boolean mandatory) + { + m_mandatory = mandatory; + setBackground(false); + } // setMandatory + + /** + * Is Field mandatory + * @return true, if mandatory + */ + public boolean isMandatory() + { + return m_mandatory; + } // isMandatory + + /** + * Enable Editor + * @param rw true, if you can enter/select data + */ + public void setReadWrite (boolean rw) + { + if (super.isEnabled() != rw) + super.setEnabled (rw); + setBackground(false); + m_readWrite = rw; + } // setEditable + + /** + * Is it possible to edit + * @return true, if editable + */ + public boolean isReadWrite() + { + return m_readWrite; + } // isEditable + + /** + * Set Background based on editable/mandatory/error - ignored - + * @param error if true, set background to error color, otherwise mandatory/editable + */ + public void setBackground (boolean error) + { + } // setBackground + + /** + * Set Background + * @param bg + */ + public void setBackground (Color bg) + { + if (bg.equals(getBackground())) + return; + super.setBackground(bg); + } // setBackground + + + /** Retain value */ + private Object m_value = null; + + /** + * Set Editor to value. Interpret Y/N and Boolean + * @param value value of the editor + */ + public void setValue (Object value) + { + m_value = value; + boolean sel = false; + if (value == null) + sel = false; + else if (value.toString().equals("Y")) + sel = true; + else if (value.toString().equals("N")) + sel = false; + else if (value instanceof Boolean) + sel = ((Boolean)value).booleanValue(); + else + { + try + { + sel = Boolean.getBoolean(value.toString()); + } + catch (Exception e) + { + } + } + this.setSelected(sel); + } // setValue + + /** + * Return Editor value + * @return current value as String or Boolean + */ + public Object getValue() + { + if (m_value instanceof String) + return super.isSelected() ? "Y" : "N"; + return new Boolean (isSelected()); + } // getValue + + /** + * Return Display Value + * @return displayed String value + */ + public String getDisplay() + { + if (m_value instanceof String) + return super.isSelected() ? "Y" : "N"; + return Boolean.toString(super.isSelected()); + } // getDisplay + + /** + * Set Text + * @param mnemonicLabel text + */ + public void setText (String mnemonicLabel) + { + super.setText (createMnemonic(mnemonicLabel)); + } // setText + + /** + * Create Mnemonics of text containing "&". + * Based on MS notation of &Help => H is Mnemonics + * Creates ALT_ + * @param text test with Mnemonics + * @return text w/o & + */ + private String createMnemonic(String text) + { + if (text == null) + return text; + int pos = text.indexOf("&"); + if (pos != -1) // We have a nemonic + { + char ch = text.charAt(pos+1); + if (ch != ' ') // &_ - is the & character + { + setMnemonic(ch); + return text.substring(0, pos) + text.substring(pos+1); + } + } + return text; + } // createMnemonic + + +} // CCheckBox diff --git a/looks/src/org/compiere/swing/CCheckBoxMenuItem.java b/looks/src/org/compiere/swing/CCheckBoxMenuItem.java new file mode 100644 index 0000000000..017aa9faeb --- /dev/null +++ b/looks/src/org/compiere/swing/CCheckBoxMenuItem.java @@ -0,0 +1,91 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import javax.swing.*; + +/** + * Adempiere Check Box Menu Item + * + * @author Jorg Janke + * @version $Id: CCheckBoxMenuItem.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CCheckBoxMenuItem extends JCheckBoxMenuItem +{ + + public CCheckBoxMenuItem () + { + super (); + } // CCheckBoxMenuItem + + public CCheckBoxMenuItem (Icon icon) + { + super (icon); + } // CCheckBoxMenuItem + + public CCheckBoxMenuItem (String text) + { + super (text); + } // CCheckBoxMenuItem + + public CCheckBoxMenuItem (Action a) + { + super (a); + } // CCheckBoxMenuItem + + public CCheckBoxMenuItem (String text, Icon icon) + { + super (text, icon); + } // CCheckBoxMenuItem + + public CCheckBoxMenuItem (String text, boolean b) + { + super (text, b); + } // CCheckBoxMenuItem + + public CCheckBoxMenuItem (String text, Icon icon, boolean b) + { + super (text, icon, b); + } // CCheckBoxMenuItem + + /** + * Set Text + * @param text text + */ + public void setText (String text) + { + if (text == null) + { + super.setText(text); + return; + } + int pos = text.indexOf("&"); + if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_ + { + int mnemonic = text.toUpperCase().charAt(pos+1); + if (mnemonic != ' ') + { + setMnemonic(mnemonic); + text = text.substring(0, pos) + text.substring(pos+1); + } + } + super.setText (text); + if (getName() == null) + setName (text); + } // setText + +} // CCheckBoxMenuItem diff --git a/looks/src/org/compiere/swing/CComboBox.java b/looks/src/org/compiere/swing/CComboBox.java new file mode 100644 index 0000000000..91a3d89af2 --- /dev/null +++ b/looks/src/org/compiere/swing/CComboBox.java @@ -0,0 +1,335 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.plaf.*; +import org.compiere.plaf.*; +import org.compiere.util.*; + +/** + * Adempiere Colored Combo Box. + * + * @author Jorg Janke + * @version $Id: CComboBox.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CComboBox extends JComboBox + implements CEditor +{ + /** + * Creates a JComboBox that takes it's items from an + * existing ComboBoxModel. Since the + * ComboBoxModel is provided, a combo box created using + * this constructor does not create a default combo box model and + * may impact how the insert, remove and add methods behave. + * + * @param aModel the ComboBoxModel that provides the + * displayed list of items + * @see DefaultComboBoxModel + */ + public CComboBox(ComboBoxModel aModel) + { + super(aModel); + init(); + } // CComboBox + + /** + * Creates a JComboBox that contains the elements + * in the specified array. By default the first item in the array + * (and therefore the data model) becomes selected. + * + * @param items an array of objects to insert into the combo box + * @see DefaultComboBoxModel + */ + public CComboBox(final Object items[]) + { + super(items); + init(); + } // CComboBox + + /** + * Creates a JComboBox that contains the elements + * in the specified array. By default the first item in the array + * (and therefore the data model) becomes selected. + * + * @param items an array of objects to insert into the combo box + * @param key set selected if exists + * @see DefaultComboBoxModel + */ + public CComboBox(final Object items[], String key) + { + this(items); + if (key == null) + return; + for (int i = 0; i < 0; i++) + { + Object item = items[i]; + if (item == null) + continue; + boolean found = false; + if (item instanceof NamePair) + found = ((NamePair)item).getID().equals(key); + else + found = item.toString().equals(key); + if (found) + { + setSelectedIndex(i); + break; + } + } + } // CComboBox + + /** + * Creates a JComboBox that contains the elements + * in the specified Vector. By default the first item in the vector + * and therefore the data model) becomes selected. + * + * @param items an array of vectors to insert into the combo box + * @see DefaultComboBoxModel + */ + public CComboBox(Vector items) + { + super(items); + init(); + } // CComboBox + + /** + * Creates a JComboBox with a default data model. + * The default data model is an empty list of objects. + * Use addItem to add items. By default the first item + * in the data model becomes selected. + * + * @see DefaultComboBoxModel + */ + public CComboBox() + { + super(); + init(); + } // CComboBox + + /** Field Height */ + public static int FIELD_HIGHT = 0; + + /** + * Common Init + */ + private void init() + { + // overwrite - otherwise Label Font + setFont(AdempierePLAF.getFont_Field()); + setForeground(AdempierePLAF.getTextColor_Normal()); + setBackground(false); + FIELD_HIGHT = getPreferredSize().height; + } // init + + + /*************************************************************************/ + + /** Icon */ + private Icon m_icon = null; + + /** + * Set Icon of arrow button to icon + * @param defaultIcon Icon to be displayed + */ + public void setIcon (Icon defaultIcon) + { + if (getUI() instanceof AdempiereComboBoxUI) + ((AdempiereComboBoxUI)getUI()).setIcon(defaultIcon); + m_icon = defaultIcon; + } // setIcon + + /** + * Set UI and re-set Icon for arrow button + * @param ui + */ + public void setUI (ComboBoxUI ui) + { + super.setUI(ui); + if (m_icon != null && ui instanceof AdempiereComboBoxUI) + ((AdempiereComboBoxUI)getUI()).setIcon(m_icon); + } // setUI + + /** + * Display Popup. + * Called from AdempiereComboPopup and allows to implement + * alternative actions than showing the popup + * @return if true, the popup should be displayed + */ + public boolean displayPopup() + { + return true; + } // displayPopup + + /*************************************************************************/ + + /** Mandatory (default false) */ + private boolean m_mandatory = false; + + /** + * Set Editor Mandatory + * @param mandatory true, if you have to enter data + */ + public void setMandatory (boolean mandatory) + { + m_mandatory = mandatory; + setBackground(false); + } // setMandatory + + /** + * Is Field mandatory + * @return true, if mandatory + */ + public boolean isMandatory() + { + return m_mandatory; + } // isMandatory + + /** + * Enable Editor + * @param rw true, if you can enter/select data + */ + public void setReadWrite (boolean rw) + { + if (super.isEnabled() != rw) + super.setEnabled (rw); + setBackground(false); + } // setReadWrite + + /** + * Is it possible to edit + * @return true, if editable + */ + public boolean isReadWrite() + { + return super.isEnabled(); + } // isReadWrite + + /** + * Set Background based on editable / mandatory / error + * @param error if true, set background to error color, otherwise mandatory/editable + */ + public void setBackground (boolean error) + { + if (error) + setBackground(AdempierePLAF.getFieldBackground_Error()); + else if (!isReadWrite()) + setBackground(AdempierePLAF.getFieldBackground_Inactive()); + else if (m_mandatory) + setBackground(AdempierePLAF.getFieldBackground_Mandatory()); + else + setBackground(AdempierePLAF.getFieldBackground_Normal()); + } // setBackground + + /** + * Set Background + * @param bg + */ + public void setBackground (Color bg) + { + if (bg.equals(getBackground())) + return; + super.setBackground(bg); + } // setBackground + + /** + * Set Editor to value + * @param value value of the editor + */ + public void setValue (Object value) + { + super.setSelectedItem(value); + } // setValue + + /** + * Return Editor value + * @return current value + */ + public Object getValue() + { + return super.getSelectedItem(); + } // getValue + + /** + * Return Display Value + * @return displayed String value + */ + public String getDisplay() + { + Object o = super.getSelectedItem(); + if (o == null) + return ""; + return o.toString(); + } // getDisplay + + /** + * Add Mouse Listener - 1-4-0 Bug. + * Bug in 1.4.0 Metal: arrowButton gets Mouse Events, so add the JComboBox + * MouseListeners to the arrowButton - No context menu if right-click + * @see AdempiereComboBoxUI#installUI(JComponent) + * @param ml + */ + public void addMouseListener (MouseListener ml) + { + super.addMouseListener(ml); + // ignore calls from javax.swing.plaf.basic.BasicComboBoxUI.installListeners(BasicComboBoxUI.java:271) + if (getUI() instanceof AdempiereComboBoxUI && !Trace.getCallerClass(1).startsWith("javax")) + { + JButton b = ((AdempiereComboBoxUI)getUI()).getArrowButton(); + if (b != null) + b.addMouseListener(ml); + } + //begin vpj-cd e-evolution + if (getUI() instanceof org.adempiere.plaf.AdempiereComboBoxUI && !Trace.getCallerClass(1).startsWith("javax")) + { + JButton b = ((org.adempiere.plaf.AdempiereComboBoxUI)getUI()).getArrowButton(); + if (b != null) + b.addMouseListener(ml); + } + //end vpj-cd e-evolution + } // addMouseListener + + /** + * Remove Mouse Listener. + * @param ml + */ + public void removeMouseListener (MouseListener ml) + { + super.removeMouseListener(ml); + if (getUI() instanceof AdempiereComboBoxUI) + { + JButton b = ((AdempiereComboBoxUI)getUI()).getArrowButton(); + if (b != null) + b.removeMouseListener(ml); + } + } // removeMouseListener + + /** + * Set Action Command + * @param actionCommand command + */ + public void setActionCommand (String actionCommand) + { + super.setActionCommand (actionCommand); + if (getName() == null && actionCommand != null && actionCommand.length() > 0) + setName(actionCommand); + } // setActionCommand + +} // CComboBox diff --git a/looks/src/org/compiere/swing/CDialog.java b/looks/src/org/compiere/swing/CDialog.java new file mode 100644 index 0000000000..5804a35264 --- /dev/null +++ b/looks/src/org/compiere/swing/CDialog.java @@ -0,0 +1,285 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +import org.compiere.plaf.*; + +/** + * Conveniance Dialog Class. + * Adempiere Background + Dispose on Close + * Implementing empty Action and Mouse Listener + * + * @author Jorg Janke + * @version $Id: CDialog.java,v 1.3 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CDialog extends JDialog + implements ActionListener, MouseListener +{ + /** + * CDialog + * @throws HeadlessException + */ + public CDialog() throws HeadlessException + { + this((Frame)null, false); + } + /** + * CDialog + * @param owner + * @throws HeadlessException + */ + public CDialog(Frame owner) throws HeadlessException + { + this (owner, false); + } + /** + * CDialog + * @param owner + * @param modal + * @throws HeadlessException + */ + public CDialog(Frame owner, boolean modal) throws HeadlessException + { + this (owner, null, modal); + } + /** + * CDialog + * @param owner + * @param title + * @throws HeadlessException + */ + public CDialog(Frame owner, String title) throws HeadlessException + { + this (owner, title, false); + } + /** + * CDialog + * @param owner + * @param title + * @param modal + * @throws HeadlessException + */ + public CDialog(Frame owner, String title, boolean modal) throws HeadlessException + { + super(owner, title, modal); + } + /** + * CDialog + * @param owner + * @param title + * @param modal + * @param gc + */ + public CDialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc) + { + super(owner, title, modal, gc); + } + /** + * CDialog + * @param owner + * @throws HeadlessException + */ + public CDialog(Dialog owner) throws HeadlessException + { + this (owner, false); + } + /** + * CDialog + * @param owner + * @param modal + * @throws HeadlessException + */ + public CDialog(Dialog owner, boolean modal) throws HeadlessException + { + this(owner, null, modal); + } + /** + * CDialog + * @param owner + * @param title + * @throws HeadlessException + */ + public CDialog(Dialog owner, String title) throws HeadlessException + { + this(owner, title, false); + } + /** + * CDialog + * @param owner + * @param title + * @param modal + * @throws HeadlessException + */ + public CDialog(Dialog owner, String title, boolean modal) throws HeadlessException + { + super(owner, title, modal); + } + /** + * CDialog + * @param owner + * @param title + * @param modal + * @param gc + * @throws HeadlessException + */ + public CDialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc) throws HeadlessException + { + super(owner, title, modal, gc); + } + + /** + * Initialize. + * Install ALT-Pause + */ + protected void dialogInit() + { + super.dialogInit(); + AdempiereColor.setBackground(this); + setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + setTitle(getTitle()); // remove Mn + // + Container c = getContentPane(); + if (c instanceof JPanel) + { + JPanel panel = (JPanel)c; + panel.getActionMap().put(ACTION_DISPOSE, s_dialogAction); + panel.getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW).put(s_disposeKeyStroke, ACTION_DISPOSE); + } + } // init + + + /************************************************************************** + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * @param e + */ + public void actionPerformed(ActionEvent e) + { + } + + /** + * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) + * @param e + */ + public void mouseClicked(MouseEvent e) + { + } + + /** + * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent) + * @param e + */ + public void mouseEntered(MouseEvent e) + { + } + + /** + * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent) + * @param e + */ + public void mouseExited(MouseEvent e) + { + } + + /** + * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent) + * @param e + */ + public void mousePressed(MouseEvent e) + { + } + + /** + * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent) + * @param e + */ + public void mouseReleased(MouseEvent e) + { + } + + /** + * Set Title + * @param title title + */ + public void setTitle(String title) + { + if (title != null) + { + int pos = title.indexOf("&"); + if (pos != -1 && title.length() > pos) // We have a nemonic + { + int mnemonic = title.toUpperCase().charAt(pos+1); + if (mnemonic != ' ') + title = title.substring(0, pos) + title.substring(pos+1); + } + } + super.setTitle(title); + } // setTitle + + /** Dispose Action Name */ + protected static String ACTION_DISPOSE = "CDialogDispose"; + /** Action */ + protected static DialogAction s_dialogAction = new DialogAction(ACTION_DISPOSE); + /** ALT-EXCAPE */ + protected static KeyStroke s_disposeKeyStroke = + KeyStroke.getKeyStroke(KeyEvent.VK_PAUSE, InputEvent.ALT_MASK); + + /** + * Adempiere Dialog Action + * + * @author Jorg Janke + * @version $Id: CDialog.java,v 1.3 2006/07/30 00:52:24 jjanke Exp $ + */ + static class DialogAction extends AbstractAction + { + DialogAction (String actionName) + { + super(actionName); + putValue(AbstractAction.ACTION_COMMAND_KEY, actionName); + } // DialogAction + + /** + * Action Listener + * @param e event + */ + public void actionPerformed (ActionEvent e) + { + if (ACTION_DISPOSE.equals(e.getActionCommand())) + { + Object source = e.getSource(); + while (source != null) + { + if (source instanceof Window) + { + ((Window)source).dispose(); + return; + } + if (source instanceof Container) + source = ((Container)source).getParent(); + else + source = null; + } + } + else + System.out.println("Action: " + e); + } // actionPerformed + } // DialogAction + +} // CDialog diff --git a/looks/src/org/compiere/swing/CEditor.java b/looks/src/org/compiere/swing/CEditor.java new file mode 100644 index 0000000000..ecb198e754 --- /dev/null +++ b/looks/src/org/compiere/swing/CEditor.java @@ -0,0 +1,81 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +/** + * Adempiere Editor interface + * + * @author Jorg Janke + * @version $Id: CEditor.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public interface CEditor +{ + /** + * Enable Editor + * @param rw true, if you can enter/select data + */ + public void setReadWrite (boolean rw); + + /** + * Is it possible to edit + * @return true, if editable + */ + public boolean isReadWrite(); + + /** + * Set Editor Mandatory + * @param mandatory true, if you have to enter data + */ + public void setMandatory (boolean mandatory); + + /** + * Is Field mandatory + * @return true, if mandatory + */ + public boolean isMandatory(); + + /** + * Set Background based on editable / mandatory / error + * @param error if true, set background to error color, otherwise mandatory/editable + */ + public void setBackground (boolean error); + + /** + * Set Visible + * @param visible true if field is to be shown + */ + public void setVisible (boolean visible); + + /** + * Set Editor to value + * @param value value of the editor + */ + public void setValue (Object value); + + /** + * Return Editor value + * @return current value + */ + public Object getValue(); + + /** + * Return Display Value + * @return displayed String value + */ + public String getDisplay(); + +} // CEditor diff --git a/looks/src/org/compiere/swing/CField.java b/looks/src/org/compiere/swing/CField.java new file mode 100644 index 0000000000..0562712b3f --- /dev/null +++ b/looks/src/org/compiere/swing/CField.java @@ -0,0 +1,323 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.Color; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.lang.reflect.Constructor; +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.regex.Pattern; + +import javax.swing.Icon; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; +import javax.swing.plaf.TextUI; + +import org.compiere.plaf.AdempierePLAF; + +/** + * Adempiere Colored Field with external popup editor. + * It extends ComboBox for UI consistency purposes + * + * @author Jorg Janke + * @version $Id: CField.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CField extends JComboBox + implements CEditor, ActionListener +{ + + public static CField createNumeric(NumberFormat format) + { + return null; + } + public static CField createNumeric() + { + return createNumeric(new DecimalFormat()); + } + public static CField createDate(DateFormat format) + { + return null; + } + public static CField createDate() + { + return createDate(new SimpleDateFormat()); + } + public static CField createText(Pattern p) + { + return null; + } + public static CField createText(int length) + { + return null; + } + + /*************************************************************************/ + + public CField () + { + this (null, null, ""); + } + + /** + * Construct Adempiere Field with external popup editor + * + * @param editor the (validating) editor + * @param cFieldPopup the popup dialog + * @param title title for popup + */ + public CField (CFieldEditor editor, Class cFieldPopup, String title) + { + super(new Object[] {"1", "2"}); + if (editor != null) +// setEditor (editor); + setEditable(true); + m_title = title; + + // Check popup + if (cFieldPopup != null) + { + Class[] interfaces = cFieldPopup.getInterfaces(); + boolean found = false; + for (int i = 0; i < interfaces.length; i++) + { + if (interfaces[i].equals(CFieldPopup.class)) + { + found = true; + break; + } + } + if (!found) + throw new IllegalArgumentException ("Popup class must be CFieldPopup"); + } + super.addActionListener(this); + } // CField + + private CFieldEditor m_editor = null; + private Class m_popupClass = null; + private String m_title = null; + private Object m_oldValue = null; + + /*************************************************************************/ + + /** Icon */ + private Icon m_icon = null; + + /** + * Set Icon of arrow button to icon + * @param defaultIcon Icon to be displayed + */ + public void setIcon (Icon defaultIcon) + { + m_icon = defaultIcon; + } // setIcon + + /** + * Get Icon of arrow button to icon + * @return defaultIcon Icon to be displayed + */ + public Icon getIcon () + { + return m_icon; + } // getIcon + + + /** + * Set UI and re-set Icon for arrow button + * @param ui + */ + public void setUI (TextUI ui) + { + super.setUI(ui); + } // setUI + + /** + * Display Popup. + * Called from AdempiereComboPopup and allows to implement + * alternative actions than showing the popup + * @return if true, the popup should be displayed + */ + public boolean displayPopup() + { + if (m_popupClass == null) + return false; + // + try + { + // Get Owner & Create Popup Instance + Window win = SwingUtilities.getWindowAncestor(this); + CFieldPopup popup = null; + if (win instanceof Dialog) + { + Constructor constructor = m_popupClass.getConstructor + (new Class[] {Dialog.class, String.class, Boolean.class}); + popup = (CFieldPopup)constructor.newInstance(new Object[] + {(Dialog)win, m_title, new Boolean(true)}); + } + else if (win instanceof Frame) + { + Constructor constructor = m_popupClass.getConstructor + (new Class[] {Frame.class, String.class, Boolean.class}); + popup = (CFieldPopup)constructor.newInstance(new Object[] + {(Frame)win, m_title, new Boolean(true)}); + } + if (popup == null) + return false; + // Start Popup + popup.setValue (m_editor.getItem()); + popup.setFormat (m_editor.getFormat()); + popup.show(); + m_editor.setItem (popup.getValue()); + popup = null; + } + catch (Exception e) + { + notifyUser (e); + } + // + return false; + } // displayPopup + + /** + * Notify User of a Ptoblem with starting popup + * @param e Exception + */ + public void notifyUser (Exception e) + { + JOptionPane.showMessageDialog(this, e.toString(), "Field Error", JOptionPane.ERROR_MESSAGE); + } // notify User + + /*************************************************************************/ + + /** Mandatory (default false) */ + private boolean m_mandatory = false; + + /** + * Set Editor Mandatory + * @param mandatory true, if you have to enter data + */ + public void setMandatory (boolean mandatory) + { + m_mandatory = mandatory; + setBackground(false); + } // setMandatory + + /** + * Is Field mandatory + * @return true, if mandatory + */ + public boolean isMandatory() + { + return m_mandatory; + } // isMandatory + + /** + * Enable Editor + * @param rw true, if you can enter/select data + */ + public void setReadWrite (boolean rw) + { + if (super.isEnabled() != rw) + super.setEnabled (rw); + setBackground(false); + } // setReadWrite + + /** + * Is it possible to edit + * @return true, if editable + */ + public boolean isReadWrite() + { + return super.isEnabled(); + } // isReadWrite + + + /** + * Set Background based on editable / mandatory / error + * @param error if true, set background to error color, otherwise mandatory/editable + */ + public void setBackground (boolean error) + { + Color bg = null; + if (error) + bg = AdempierePLAF.getFieldBackground_Error(); + else if (!isReadWrite()) + bg = AdempierePLAF.getFieldBackground_Inactive(); + else if (m_mandatory) + bg = AdempierePLAF.getFieldBackground_Mandatory(); + else + bg = AdempierePLAF.getFieldBackground_Normal(); + if (bg.equals(m_editor.getBackground())) + return; + m_editor.setBackground(bg); + } // setBackground + + /** + * Set Editor to value + * @param value value of the editor + */ + public void setValue (Object value) + { + m_oldValue = value; + // super.setSelectedItem(value); + } // setValue + + /** + * Return Editor value + * @return current value + */ + public Object getValue() + { + return null;//super.getSelectedItem(); + } // getValue + + /** + * Return Display Value + * @return displayed String value + */ + public String getDisplay() + { + // if (super.getSelectedItem() == null) + return ""; + // return super.getSelectedItem().toString(); + } // getDisplay + + /*************************************************************************/ + + /** + * Action Listener + * @param e ActionEvent + */ + public void actionPerformed(ActionEvent e) + { + // Do er have a change? + Object newValue = getValue(); + if ((newValue != null && newValue.equals(m_oldValue)) + || (newValue == null && m_oldValue == null) ) + return; + super.firePropertyChange("DataChanged", m_oldValue, newValue); + m_oldValue = newValue; + } // // actionPerformed + +} // CField diff --git a/looks/src/org/compiere/swing/CFieldEditor.java b/looks/src/org/compiere/swing/CFieldEditor.java new file mode 100644 index 0000000000..897dff33b1 --- /dev/null +++ b/looks/src/org/compiere/swing/CFieldEditor.java @@ -0,0 +1,79 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.Component; + +import javax.swing.ComboBoxEditor; +import javax.swing.JTextField; + +/** + * Adempiere Field Editor. + * + * + * @author Jorg Janke + * @version $Id: CFieldEditor.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CFieldEditor extends JTextField implements ComboBoxEditor +{ + /** + * + */ + public CFieldEditor() + { + } + + /** + * Return the component that should be added to the tree hierarchy + * for this editor + */ + public Component getEditorComponent() + { + return this; + } // getEditorCimponent + + /** + * Set Editor + * @param anObject + */ + public void setItem (Object anObject) + { + if (anObject == null) + setText(""); + else + setText(anObject.toString()); + } // setItem + + /** + * Get edited item + * @return edited text + */ + public Object getItem() + { + return getText(); + } // getItem + + /** + * Returns format Info (for Popup) + * @return format + */ + public Object getFormat() + { + return null; + } // getFormat + +} // CFieldEditor diff --git a/looks/src/org/compiere/swing/CFieldPopup.java b/looks/src/org/compiere/swing/CFieldPopup.java new file mode 100644 index 0000000000..c19618b3ed --- /dev/null +++ b/looks/src/org/compiere/swing/CFieldPopup.java @@ -0,0 +1,57 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +/** + * Adempiere Field external popup Interface. + * The actual class must be a JDialog + * + * @author Jorg Janke + * @version $Id: CFieldPopup.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public interface CFieldPopup +{ + /** + * Show Popup + */ + public void show(); + + /** + * Set Value + * @param value + */ + public void setValue (Object value); + + /** + * Get Value + * @return value + */ + public Object getValue(); + + /** + * Set Format + * @param format + */ + public void setFormat (Object format); + + /** + * Get Format + * @return format + */ + public Object getFormat(); + +} // CFieldPopup diff --git a/looks/src/org/compiere/swing/CFrame.java b/looks/src/org/compiere/swing/CFrame.java new file mode 100644 index 0000000000..b565a08293 --- /dev/null +++ b/looks/src/org/compiere/swing/CFrame.java @@ -0,0 +1,136 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.*; +import javax.swing.*; +import org.compiere.plaf.*; + +/** + * Adempiere Frame + * + * @author Jorg Janke + * @version $Id: CFrame.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CFrame extends JFrame +{ + /** + * CFrame + * @throws HeadlessException + */ + public CFrame () throws HeadlessException + { + super (); + } // CFrame + + /** + * CFrame + * @param gc + */ + public CFrame (GraphicsConfiguration gc) + { + super (gc); + } // CFrame + + /** + * CFrame + * @param title + * @throws HeadlessException + */ + public CFrame (String title) throws HeadlessException + { + super (cleanup(title)); + } // CFrame + + /** + * CFrame + * @param title + * @param gc + */ + public CFrame (String title, GraphicsConfiguration gc) + { + super (cleanup(title), gc); + } // CFrame + + /** Window ID */ + private int p_AD_Window_ID = 0; + + /** + * Frame Init. + * Install ALT-Pause + */ + protected void frameInit () + { + super.frameInit (); + AdempiereColor.setBackground(this); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + // + Container c = getContentPane(); + if (c instanceof JPanel) + { + JPanel panel = (JPanel)c; + panel.getActionMap().put(CDialog.ACTION_DISPOSE, CDialog.s_dialogAction); + panel.getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW).put(CDialog.s_disposeKeyStroke, CDialog.ACTION_DISPOSE); + } + } // frameInit + + /** + * Cleanedup Title + * @param title title + * @return title w/o mn + */ + private static String cleanup (String title) + { + if (title != null) + { + int pos = title.indexOf("&"); + if (pos != -1 && title.length() > pos) // We have a nemonic + { + int mnemonic = title.toUpperCase().charAt(pos+1); + if (mnemonic != ' ') + title = title.substring(0, pos) + title.substring(pos+1); + } + } + return title; + } // getTitle + + /** + * Set Title + * @param title title + */ + public void setTitle(String title) + { + super.setTitle(cleanup(title)); + } // setTitle + + /** + * @return Returns the AD_Window_ID. + */ + public int getAD_Window_ID () + { + return p_AD_Window_ID; + } // getAD_Window_ID + + /** + * @param window_ID The AD_Window_ID to set. + */ + public void setAD_Window_ID (int window_ID) + { + p_AD_Window_ID = window_ID; + } // getAD_Window_ID + +} // CFrame diff --git a/looks/src/org/compiere/swing/CLabel.java b/looks/src/org/compiere/swing/CLabel.java new file mode 100644 index 0000000000..e917dbaa19 --- /dev/null +++ b/looks/src/org/compiere/swing/CLabel.java @@ -0,0 +1,284 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.*; + +import javax.swing.*; + +import org.compiere.plaf.*; + +/** + * Label with Mnemonics interpretation + * + * @author Jorg Janke + * @version $Id: CLabel.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CLabel extends JLabel +{ + public static int DEFAULT_ALIGNMENT = JLabel.TRAILING; + + /** + * Creates a Label instance with the specified + * text, image, and horizontal alignment. + * The label is centered vertically in its display area. + * The text is on the trailing edge of the image. + * + * @param text The text to be displayed by the label. + * @param icon The image to be displayed by the label. + * @param horizontalAlignment One of the following constants + * defined in SwingConstants: + * LEFT, + * CENTER, + * RIGHT, + * LEADING or + * TRAILING. + */ + public CLabel (String text, Icon icon, int horizontalAlignment) + { + super (text, icon, horizontalAlignment); + init(); + } + + /** + * Creates a Label instance with the specified + * text and horizontal alignment. + * The label is centered vertically in its display area. + * + * @param text The text to be displayed by the label. + * @param horizontalAlignment One of the following constants + * defined in SwingConstants: + * LEFT, + * CENTER, + * RIGHT, + * LEADING or + * TRAILING. + */ + public CLabel (String text, int horizontalAlignment) + { + super(text, horizontalAlignment); + init(); + } + + /** + * Creates a Label instance with the specified text. + * The label is aligned against the leading edge of its display area, + * and centered vertically. + * + * @param text The text to be displayed by the label. + */ + public CLabel (String text) + { + super(text, DEFAULT_ALIGNMENT); + init(); + } + + /** + * Creates a Label instance with the specified + * image and horizontal alignment. + * The label is centered vertically in its display area. + * + * @param image The image to be displayed by the label. + * @param horizontalAlignment One of the following constants + * defined in SwingConstants: + * LEFT, + * CENTER, + * RIGHT, + * LEADING or + * TRAILING. + */ + public CLabel (Icon image, int horizontalAlignment) + { + super (image, horizontalAlignment); + init(); + } + + /** + * Creates a Label instance with the specified image. + * The label is centered vertically and horizontally + * in its display area. + * + * @param image The image to be displayed by the label. + */ + public CLabel (Icon image) + { + super (image, DEFAULT_ALIGNMENT); + init(); + } + + /** + * Creates a JLabel instance with + * no image and with an empty string for the title. + * The label is centered vertically + * in its display area. + * The label's contents, once set, will be displayed on the leading edge + * of the label's display area. + */ + public CLabel () + { + super("", DEFAULT_ALIGNMENT); + init(); + } + + /** + * Creates a Label instance with the specified text. + * The label is aligned against the leading edge of its display area, + * and centered vertically. + * + * @param label The text to be displayed by the label. + * @param toolTip The optional Tooltip text + */ + public CLabel (String label, String toolTip) + { + super (label, DEFAULT_ALIGNMENT); + if (toolTip != null && toolTip.length() > 0) + super.setToolTipText(toolTip); + init(); + } // CLabel + + /** + * Trailing Label for Field + * @param label label + * @param field field + */ + public CLabel (String label, Component field) + { + this (label, TRAILING); + setLabelFor(field); + } // CLabel + + + /** Mnemonic saved */ + private char m_savedMnemonic = 0; + + /** + * Common init + */ + private void init() + { + setFocusable (false); + setOpaque(false); + if (getToolTipText() == null) // force Tool Tip + setToolTipText(getText()); + // + setForeground(AdempierePLAF.getTextColor_Label()); + setFont(AdempierePLAF.getFont_Label()); + } // init + + + /** + * Set Background + * @param bg background + */ + public void setBackground (Color bg) + { + if (bg.equals(getBackground())) + return; + super.setBackground(bg); + } // setBackground + + /** + * Set Font to Bold + * @param bold true bold false normal + */ + public void setFontBold (boolean bold) + { + Font font = getFont(); + if (bold != font.isBold()) + { + font = new Font (font.getName(), bold ? + Font.BOLD : Font.PLAIN, + font.getSize()); + setFont (font); + } + } // setFontBold + + /************************************************************************** + * Set label text - if it includes &, the next character is the Mnemonic + * @param mnemonicLabel Label containing Mnemonic + */ + public void setText (String mnemonicLabel) + { + String text = createMnemonic (mnemonicLabel); + super.setText (text); + if (text != null && getName() == null) + setName(text); + } // setText + + /** + * Create Mnemonics of text containing "&". + * Based on MS notation of &Help => H is Mnemonics + * @param text test with Mnemonics + * @return text w/o & + * @see JLabel#setLabelFor(java.awt.Component) + */ + private String createMnemonic(String text) + { + if (text == null) + return text; + int pos = text.indexOf("&"); + if (pos != -1) // We have a nemonic + { + char ch = text.charAt(pos+1); + if (ch != ' ') // &_ - is the & character + { + setDisplayedMnemonic(ch); + setSavedMnemonic(ch); + return text.substring(0, pos) + text.substring(pos+1); + } + } + return text; + } // createMnemonic + + /** + * Set ReadWrite + * @param rw enabled + */ + public void setReadWrite (boolean rw) + { + this.setEnabled(rw); + } // setReadWrite + + /** + * Set Label For + * @param c component + */ + public void setLabelFor (Component c) + { + super.setLabelFor (c); + if (c.getName() == null) + c.setName(getName()); + } // setLabelFor + + + /** + * @return Returns the savedMnemonic. + */ + public char getSavedMnemonic () + { + return m_savedMnemonic; + } // getSavedMnemonic + + /** + * @param savedMnemonic The savedMnemonic to set. + */ + public void setSavedMnemonic (char savedMnemonic) + { + m_savedMnemonic = savedMnemonic; + } // getSavedMnemonic + +} // CLabel diff --git a/looks/src/org/compiere/swing/CMenuItem.java b/looks/src/org/compiere/swing/CMenuItem.java new file mode 100644 index 0000000000..b5c2f4190c --- /dev/null +++ b/looks/src/org/compiere/swing/CMenuItem.java @@ -0,0 +1,86 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import javax.swing.*; + +/** + * Adempiere Menu Item + * + * @author Jorg Janke + * @version $Id: CMenuItem.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CMenuItem extends JMenuItem +{ + + public CMenuItem () + { + super (); + } // CMenuItem + + public CMenuItem (Icon icon) + { + super (icon); + } // CMenuItem + + public CMenuItem (String text) + { + super (text); + } // CMenuItem + + public CMenuItem (Action a) + { + super (a); + } // CMenuItem + + public CMenuItem (String text, Icon icon) + { + super (text, icon); + } // CMenuItem + + public CMenuItem (String text, int mnemonic) + { + super (text, mnemonic); + } // CMenuItem + + /** + * Set Text + * @param text text + */ + public void setText (String text) + { + if (text == null) + { + super.setText(text); + return; + } + int pos = text.indexOf("&"); + if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_ + { + int mnemonic = text.toUpperCase().charAt(pos+1); + if (mnemonic != ' ') + { + setMnemonic(mnemonic); + text = text.substring(0, pos) + text.substring(pos+1); + } + } + super.setText (text); + if (getName() == null) + setName (text); + } // setText + +} // CMenuItem diff --git a/looks/src/org/compiere/swing/CPanel.java b/looks/src/org/compiere/swing/CPanel.java new file mode 100644 index 0000000000..d747b8fe88 --- /dev/null +++ b/looks/src/org/compiere/swing/CPanel.java @@ -0,0 +1,195 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.*; +import javax.swing.*; +import org.compiere.plaf.*; +import org.compiere.util.*; + +/** + * Adempiere Panel supporting colored Backgrounds + * + * @author Jorg Janke + * @version $Id: CPanel.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CPanel extends JPanel +{ + /** + * Creates a new AdempierePanel with the specified layout manager + * and buffering strategy. + * @param layout the LayoutManager to use + * @param isDoubleBuffered a boolean, true for double-buffering, which + * uses additional memory space to achieve fast, flicker-free updates + */ + public CPanel (LayoutManager layout, boolean isDoubleBuffered) + { + super (layout, isDoubleBuffered); + init(); + } // CPanel + + /** + * Create a new buffered CPanel with the specified layout manager + * @param layout the LayoutManager to use + */ + public CPanel (LayoutManager layout) + { + super (layout); + init(); + } // CPanel + + /** + * Creates a new CPanel with FlowLayout + * and the specified buffering strategy. + * If isDoubleBuffered is true, the CPanel + * will use a double buffer. + * @param isDoubleBuffered a boolean, true for double-buffering, which + * uses additional memory space to achieve fast, flicker-free updates + */ + public CPanel (boolean isDoubleBuffered) + { + super (isDoubleBuffered); + init(); + } // CPanel + + /** + * Creates a new CPanel with a double buffer and a flow layout. + */ + public CPanel() + { + super (); + init(); + } // CPanel + + /** + * Creates a new CPanel with a double buffer and a flow layout. + * @param bc Initial Background Color + */ + public CPanel(AdempiereColor bc) + { + this (); + init(); + setBackgroundColor (bc); + } // CPanel + + /** + * Common init. + * Adempiere backround requires that for the base, background is set explictily. + * The additional panels should be transparent. + */ + private void init() + { + setOpaque(false); // transparent + } // init + + + /************************************************************************** + * Set Background - ignored by UI - + * @param bg ignored + */ + public void setBackground (Color bg) + { + if (bg.equals(getBackground())) + return; + super.setBackground (bg); + // ignore calls from javax.swing.LookAndFeel.installColors(LookAndFeel.java:61) + if (!Trace.getCallerClass(1).startsWith("javax")) + setBackgroundColor (new AdempiereColor(bg)); + } // setBackground + + /** + * Set Background + * @param bg AdempiereColor for Background, if null set standard background + */ + public void setBackgroundColor (AdempiereColor bg) + { + if (bg == null) + bg = AdempierePanelUI.getDefaultBackground(); + setOpaque(true); // not transparent + putClientProperty(AdempierePLAF.BACKGROUND, bg); + super.setBackground (bg.getFlatColor()); + } // setBackground + + /** + * Get Background + * @return Color for Background + */ + public AdempiereColor getBackgroundColor () + { + try + { + return (AdempiereColor)getClientProperty(AdempierePLAF.BACKGROUND); + } + catch (Exception e) + { + System.err.println("CPanel - ClientProperty: " + e.getMessage()); + } + return null; + } // getBackgroundColor + + /*************************************************************************/ + + /** + * Set Tab Hierarchy Level. + * Has only effect, if tabs are on left or right side + * + * @param level + */ + public void setTabLevel (int level) + { + if (level == 0) + putClientProperty(AdempierePLAF.TABLEVEL, null); + else + putClientProperty(AdempierePLAF.TABLEVEL, new Integer(level)); + } // setTabLevel + + /** + * Get Tab Hierarchy Level + * @return Tab Level + */ + public int getTabLevel() + { + try + { + Integer ll = (Integer)getClientProperty(AdempierePLAF.TABLEVEL); + if (ll != null) + return ll.intValue(); + } + catch (Exception e) + { + System.err.println("ClientProperty: " + e.getMessage()); + } + return 0; + } // getTabLevel + + + /************************************************************************** + * String representation + * @return String representation + */ + public String toString() + { + StringBuffer sb = new StringBuffer ("CPanel ["); + sb.append(super.toString()); + AdempiereColor bg = getBackgroundColor(); + if (bg != null) + sb.append(bg.toString()); + sb.append("]"); + return sb.toString(); + } // toString + +} // CPanel diff --git a/looks/src/org/compiere/swing/CPassword.java b/looks/src/org/compiere/swing/CPassword.java new file mode 100644 index 0000000000..5e4b9257a8 --- /dev/null +++ b/looks/src/org/compiere/swing/CPassword.java @@ -0,0 +1,216 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.Color; + +import javax.swing.JPasswordField; +import javax.swing.text.Document; + +import org.compiere.plaf.AdempierePLAF; + +/** + * Password Field + * + * @author Jorg Janke + * @version $Id: CPassword.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CPassword extends JPasswordField implements CEditor +{ + /** + * Constructs a new JPasswordField, + * with a default document, null starting + * text string, and 0 column width. + */ + public CPassword() + { + super(); + init(); + } + + /** + * Constructs a new JPasswordField initialized + * with the specified text. The document model is set to the + * default, and the number of columns to 0. + * + * @param text the text to be displayed, null if none + */ + public CPassword (String text) + { + super (text); + init(); + } + + /** + * Constructs a new empty JPasswordField with the specified + * number of columns. A default model is created, and the initial string + * is set to null. + * + * @param columns the number of columns >= 0 + */ + public CPassword (int columns) + { + super (columns); + init(); + } + + /** + * Constructs a new JPasswordField initialized with + * the specified text and columns. The document model is set to + * the default. + * + * @param text the text to be displayed, null if none + * @param columns the number of columns >= 0 + */ + public CPassword (String text, int columns) + { + super (text,columns); + init(); + } + + /** + * Constructs a new JPasswordField that uses the + * given text storage model and the given number of columns. + * This is the constructor through which the other constructors feed. + * The echo character is set to '*'. If the document model is + * null, a default one will be created. + * + * @param doc the text storage to use + * @param txt the text to be displayed, null if none + * @param columns the number of columns to use to calculate + * the preferred width >= 0; if columns is set to zero, the + * preferred width will be whatever naturally results from + * the component implementation + */ + public CPassword (Document doc, String txt, int columns) + { + super (doc, txt, columns); + init(); + } + + /** + * Common Init + */ + private void init() + { + setFont(AdempierePLAF.getFont_Field()); + setForeground(AdempierePLAF.getTextColor_Normal()); + } // init + + /*************************************************************************/ + + /** Mandatory (default false) */ + private boolean m_mandatory = false; + + /** + * Set Editor Mandatory + * @param mandatory true, if you have to enter data + */ + public void setMandatory (boolean mandatory) + { + m_mandatory = mandatory; + setBackground(false); + } // setMandatory + + /** + * Is Field mandatory + * @return true, if mandatory + */ + public boolean isMandatory() + { + return m_mandatory; + } // isMandatory + + /** + * Enable Editor + * @param rw true, if you can enter/select data + */ + public void setReadWrite (boolean rw) + { + if (super.isEditable() != rw) + super.setEditable (rw); + setBackground(false); + } // setEditable + + /** + * Is it possible to edit + * @return true, if editable + */ + public boolean isReadWrite() + { + return super.isEditable(); + } // isReadWrite + + /** + * Set Background based on editable / mandatory / error + * @param error if true, set background to error color, otherwise mandatory/editable + */ + public void setBackground (boolean error) + { + if (error) + setBackground(AdempierePLAF.getFieldBackground_Error()); + else if (!isReadWrite()) + setBackground(AdempierePLAF.getFieldBackground_Inactive()); + else if (m_mandatory) + setBackground(AdempierePLAF.getFieldBackground_Mandatory()); + else + setBackground(AdempierePLAF.getFieldBackground_Normal()); + } // setBackground + + /** + * Set Background + * @param bg + */ + public void setBackground (Color bg) + { + if (bg.equals(getBackground())) + return; + super.setBackground(bg); + } // setBackground + + /** + * Set Editor to value + * @param value value of the editor + */ + public void setValue (Object value) + { + if (value == null) + setText(""); + else + setText(value.toString()); + } // setValue + + /** + * Return Editor value + * @return current value + */ + public Object getValue() + { + return new String(super.getPassword()); + } // getValue + + /** + * Return Display Value + * @return displayed String value + */ + public String getDisplay() + { + return new String(super.getPassword()); + } // getDisplay + + +} diff --git a/looks/src/org/compiere/swing/CScrollPane.java b/looks/src/org/compiere/swing/CScrollPane.java new file mode 100644 index 0000000000..96ca3ac25b --- /dev/null +++ b/looks/src/org/compiere/swing/CScrollPane.java @@ -0,0 +1,91 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.*; + +import javax.swing.*; + +import org.compiere.plaf.*; + +/** + * Adempiere Srcoll Pane. + * + * @author Jorg Janke + * @version $Id: CScrollPane.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CScrollPane extends JScrollPane +{ + + /** + * Adempiere ScollPane + */ + public CScrollPane () + { + this (null, VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); + } // CScollPane + + /** + * Adempiere ScollPane + * @param vsbPolicy vertical policy + * @param hsbPolicy horizontal policy + */ + public CScrollPane (int vsbPolicy, int hsbPolicy) + { + this (null, vsbPolicy, hsbPolicy); + } // CScollPane + + /** + * Adempiere ScollPane + * @param view view + */ + public CScrollPane (Component view) + { + this (view, VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); + } // CScollPane + + /** + * Adempiere ScollPane + * @param view view + * @param vsbPolicy vertical policy + * @param hsbPolicy horizontal policy + */ + public CScrollPane (Component view, int vsbPolicy, int hsbPolicy) + { + super (view, vsbPolicy, hsbPolicy); + setBackgroundColor(null); + setOpaque(false); + getViewport().setOpaque(false); + } // CScollPane + + + /** + * Set Background + * @param bg AdempiereColor for Background, if null set standard background + */ + public void setBackgroundColor (AdempiereColor bg) + { + if (bg == null) + bg = AdempierePanelUI.getDefaultBackground(); + putClientProperty(AdempierePLAF.BACKGROUND, bg); + // super.setBackground(bg.getFlatColor()); + // getViewport().putClientProperty(AdempierePLAF.BACKGROUND, bg); + // getViewport().setBackground(bg.getFlatColor()); + // getViewport().setOpaque(true); + } // setBackground + +} // CScollPane diff --git a/looks/src/org/compiere/swing/CTabbedPane.java b/looks/src/org/compiere/swing/CTabbedPane.java new file mode 100644 index 0000000000..5a06572dd4 --- /dev/null +++ b/looks/src/org/compiere/swing/CTabbedPane.java @@ -0,0 +1,378 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; + +import javax.swing.*; + +import org.compiere.plaf.AdempiereColor; +import org.compiere.plaf.AdempierePLAF; +import org.compiere.plaf.AdempierePanelUI; +import org.compiere.util.Trace; +import sun.swing.*; + +/** + * Adempiere Color Tabbed Pane + * + * @author Jorg Janke + * @version $Id: CTabbedPane.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CTabbedPane extends JTabbedPane +{ + /** + * Creates an empty TabbedPane with a default + * tab placement of JTabbedPane.TOP and default + * tab layout policy of JTabbedPane.WRAP_TAB_LAYOUT. + */ + public CTabbedPane() + { + super(); + init(); + } // CTabbedPane + + /** + * Creates an empty TabbedPane with the specified tab placement + * of either: JTabbedPane.TOP, JTabbedPane.BOTTOM, + * JTabbedPane.LEFT, or JTabbedPane.RIGHT, and a + * default tab layout policy of JTabbedPane.WRAP_TAB_LAYOUT. + * + * @param tabPlacement the placement for the tabs relative to the content + */ + public CTabbedPane(int tabPlacement) + { + super(tabPlacement); + init(); + } // CTabbedPane + + /** + * Creates an empty TabbedPane with the specified tab placement + * and tab layout policy. Tab placement may be either: + * JTabbedPane.TOP, JTabbedPane.BOTTOM, + * JTabbedPane.LEFT, or JTabbedPane.RIGHT. + * Tab layout policy may be either: JTabbedPane.WRAP_TAB_LAYOUT + * or JTabbedPane.SCROLL_TAB_LAYOUT. + * + * @param tabPlacement the placement for the tabs relative to the content + * @param tabLayoutPolicy the policy for laying out tabs when all tabs will not fit on one run + * @exception IllegalArgumentException if tab placement or tab layout policy are not + * one of the above supported values + */ + public CTabbedPane(int tabPlacement, int tabLayoutPolicy) + { + super (tabPlacement, tabLayoutPolicy); + init(); + } // CTabbedPane + + /** + * Creates an empty TabbedPane with a defaults and Color + * @param bg Color + */ + public CTabbedPane (AdempiereColor bg) + { + super(); + init(); + setBackgroundColor (bg); + } // CTabbedPane + + /** + * Common Init + */ + private void init() + { + setOpaque(false); + setFont(AdempierePLAF.getFont_Label()); + setForeground(AdempierePLAF.getTextColor_Label()); + } // init + + + /************************************************************************** + * Set Background - ignored by UI - + * @param bg ignored + */ + public void setBackground (Color bg) + { + if (bg.equals(getBackground())) + return; + super.setBackground (bg); + // ignore calls from javax.swing.LookAndFeel.installColors(LookAndFeel.java:61) + if (!Trace.getCallerClass(1).startsWith("javax")) + setBackgroundColor (new AdempiereColor(bg)); + } // setBackground + + /** + * Set Standard Background + */ + public void setBackgroundColor () + { + setBackgroundColor (null); + } // setBackground + + /** + * Set Background + * @param bg AdempiereColor for Background, if null set standard background + */ + public void setBackgroundColor (AdempiereColor bg) + { + if (bg == null) + bg = AdempierePanelUI.getDefaultBackground(); + setOpaque(true); + putClientProperty(AdempierePLAF.BACKGROUND, bg); + super.setBackground (bg.getFlatColor()); + // + repaint(); + } // setBackground + + /** + * Get Background + * @return Color for Background + */ + public AdempiereColor getBackgroundColor () + { + try + { + return (AdempiereColor)getClientProperty(AdempierePLAF.BACKGROUND); + } + catch (Exception e) + { + System.err.println("ClientProperty: " + e.getMessage()); + } + return null; + } // getBackgroundColor + + + /************************************************************************** + * Insert tab. + * If the component is a JPanel, the backround is set to the default + * AdempiereColor (and Opaque) if nothing was defined. + * Redquired as otherwise a gray background would be pained. + *

+ * Inserts a component, at index, + * represented by a title and/or icon, + * either of which may be null. If icon + * is non-null and it implements + * ImageIcon a corresponding disabled icon will automatically + * be created and set on the tabbedpane. + * Uses java.util.Vector internally, see insertElementAt + * for details of insertion conventions. + * + * @param text the title with Mnemonic to be displayed in this tab + * @param icon the icon to be displayed in this tab + * @param component The component to be displayed when this tab is clicked. + * @param tip the tooltip to be displayed for this tab + * @param index the position to insert this new tab + */ + public void insertTab (String text, Icon icon, Component component, String tip, int index) + { + String title = text; + if (!title.startsWith("")) + { + int pos = title.indexOf("&"); + if (pos != -1) + title = title.substring(0, pos) + title.substring(pos+1); + } + // Enforce Tool Tip + if (tip == null || tip.length() == 0) + tip = title; + super.insertTab (title, icon, component, tip, index); + // Set component background + if (component instanceof JPanel) + { + JPanel p = (JPanel)component; + if (p.getClientProperty(AdempierePLAF.BACKGROUND) == null) + { + AdempiereColor.setBackground(p); + p.setOpaque(true); + } + } + // Set first + if (index == 0) + getActionMap().put(ACTION_SELECT, s_action); + // + if (!setMnemonicAt(index, text)) + { // Only one - set direct + if (index < 9) + setMnemonicAt(index, '1'+index); + else if (index == 9) + setMnemonicAt(index, '0'); + } + else // additional ALT-1..0 + { + if (index < 9) + getInputMap(WHEN_IN_FOCUSED_WINDOW) + .put(KeyStroke.getKeyStroke(KeyEvent.VK_1+index, Event.ALT_MASK), ACTION_SELECT); + else if (index == 9) + getInputMap(WHEN_IN_FOCUSED_WINDOW) + .put(KeyStroke.getKeyStroke(KeyEvent.VK_0, Event.ALT_MASK), ACTION_SELECT); + } + // + } // insertTab + + /** + * Set Title At + * @param index index + * @param text title with opt Mnemonic + */ + public void setTitleAt (int index, String text) + { + String title = text; + if (!title.startsWith("")) + { + int pos = title.indexOf("&"); + if (pos != -1) // We have a nemonic - creates ALT-_ + title = title.substring(0, pos) + title.substring(pos+1); + } + super.setTitleAt (index, title); + // setMnemonicAt(index, text); + } // setTitleAt + + + /** + * Set Mnemonic for Index based on text + * @param index for index + * @param text text + */ + public boolean setMnemonicAt (int index, String text) + { + // logistics - remove old + while (m_mnemonic.size() < index+1) + m_mnemonic.add((char)0); + char keyCode = m_mnemonic.get(index); + if (keyCode != 0) + getInputMap(WHEN_IN_FOCUSED_WINDOW) + .remove(KeyStroke.getKeyStroke(keyCode, Event.ALT_MASK)); + m_mnemonic.set(index, (char)0); + // + if (!text.startsWith("")) + { + int pos = text.indexOf("&"); + if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_ + { + keyCode = text.toUpperCase().charAt(pos+1); + if (keyCode != ' ') + { + setMnemonicAt(index, keyCode); + m_mnemonic.set(index, keyCode); + return true; + } + } + } + /** + keyCode = text.toUpperCase().charAt(0); + if (m_mnemonic.contains(keyCode)) + { + keyCode = 0; + // Beginning new word + int pos = text.indexOf(' '); + while (pos != -1 && text.length() > pos) + { + char c = text.toUpperCase().charAt(pos+1); + if (Character.isLetterOrDigit(c) && !m_mnemonic.contains(c)) + { + keyCode = c; + break; + } + pos = text.indexOf(' ', pos+1); + } + // Any character + if (keyCode == 0) + { + for (int i = 1; i < text.length(); i++) + { + char c = text.toUpperCase().charAt(i); + if (Character.isLetterOrDigit(c) && !m_mnemonic.contains(c)) + { + keyCode = c; + break; + } + } + } + // First character fallback + // if (mnemonic == 0) + // mnemonic = text.toUpperCase().charAt(0); + } + if (keyCode != 0) + { + setMnemonicAt(index, keyCode); + m_mnemonic.set(index, keyCode); + } + **/ + return false; + } // setMnemonicAt + + /** Used Mnemonics */ + private ArrayList m_mnemonic = new ArrayList(10); + + + /** + * String representation + * @return String representation + */ + public String toString() + { + StringBuffer sb = new StringBuffer ("CTabbedPane ["); + sb.append(super.toString()); + AdempiereColor bg = getBackgroundColor(); + if (bg != null) + sb.append(bg.toString()); + sb.append("]"); + return sb.toString(); + } // toString + + /** Select Action Text */ + private static final String ACTION_SELECT = "CAS"; + /** Select Action */ + private static CTAction s_action = new CTAction(ACTION_SELECT); + + /** + * Select Action + * + * @author Jorg Janke + * @version $Id: CTabbedPane.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ + private static class CTAction extends UIAction + { + /** + * Constructor + */ + public CTAction (String actionName) + { + super (actionName); + } // Action + + public void actionPerformed (ActionEvent e) + { + String key = getName(); + if (!key.equals(ACTION_SELECT) + || !(e.getSource() instanceof CTabbedPane)) + return; + CTabbedPane pane = (CTabbedPane)e.getSource(); + String command = e.getActionCommand(); + if (command == null || command.length() != 1) + return; + int index = command.charAt(0)-'1'; + if (index > -1 && index < pane.getTabCount()) + pane.setSelectedIndex(index); + else + System.out.println("Action: " + e); + } // actionPerformed + + } // Action + +} // CTabbedPane diff --git a/looks/src/org/compiere/swing/CTable.java b/looks/src/org/compiere/swing/CTable.java new file mode 100644 index 0000000000..e9db376cdb --- /dev/null +++ b/looks/src/org/compiere/swing/CTable.java @@ -0,0 +1,304 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import java.util.logging.*; +import javax.swing.*; +import javax.swing.event.*; +import javax.swing.table.*; +import org.compiere.util.*; + +/** + * Model Independent enhanced JTable. + * Provides sizing and sorting + * + * @author Jorg Janke + * @version $Id: CTable.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CTable extends JTable +{ + /** + * Default Constructor + */ + public CTable() + { + super(new DefaultTableModel()); + setColumnSelectionAllowed(false); + setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + getTableHeader().addMouseListener(new CTableMouseListener()); + setSurrendersFocusOnKeystroke(true); + } // CTable + + /** Last model index sorted */ + protected int p_lastSortIndex = -1; + /** Sort direction */ + protected boolean p_asc = true; + + /** Sizing: making sure it fits in a column */ + private final int SLACK = 15; + /** Sizing: max size in pt */ + private final int MAXSIZE = 250; + /** Model Index of Key Column */ + protected int p_keyColumnIndex = -1; + + /** Logger */ + private static Logger log = Logger.getLogger(CTable.class.getName()); + + + /** + * Set Model index of Key Column. + * Used for identifying previous selected row after fort complete to set as selected row. + * If not set, column 0 is used. + * @param keyColumnIndex model index + */ + public void setKeyColumnIndex (int keyColumnIndex) + { + p_keyColumnIndex = keyColumnIndex; + } // setKeyColumnIndex + + /** + * Get Model index of Key Column + * @return model index + */ + public int getKeyColumnIndex() + { + return p_keyColumnIndex; + } // getKeyColumnIndex + + /** + * Get Current Row Key Column Value + * @return value or null + */ + public Object getSelectedKeyColumnValue() + { + int row = getSelectedRow(); + if (row != -1 && p_keyColumnIndex != -1) + return getModel().getValueAt(row, p_keyColumnIndex); + return null; + } // getKeyColumnValue + + /** + * Get Selected Value or null + * @return value + */ + public Object getSelectedValue() + { + int row = getSelectedRow(); + int col = getSelectedColumn(); + if (row == -1 || col == -1) + return null; + return getValueAt(row, col); + } // getSelectedValue + + /** + * Stop Table Editors and remove focus + * @param saveValue save value + */ + public void stopEditor (boolean saveValue) + { + // MultiRow - remove editors + ChangeEvent ce = new ChangeEvent(this); + if (saveValue) + editingStopped(ce); + else + editingCanceled(ce); + // + if (getInputContext() != null) + getInputContext().endComposition(); + // change focus to next + transferFocus(); + } // stopEditor + + + /************************************************************************** + * Size Columns. + * @param useColumnIdentifier if false uses plain content - + * otherwise uses Column Identifier to indicate displayed columns + */ + public void autoSize (boolean useColumnIdentifier) + { + TableModel model = this.getModel(); + int size = model.getColumnCount(); + // for all columns + for (int c = 0; c < size; c++) + { + TableColumn column = getColumnModel().getColumn(c); + // Not displayed columns + if (useColumnIdentifier + && (column.getIdentifier() == null + || column.getMaxWidth() == 0 + || column.getIdentifier().toString().length() == 0)) + continue; + + int width = 0; + // Header + TableCellRenderer renderer = column.getHeaderRenderer(); + if (renderer == null) + renderer = new DefaultTableCellRenderer(); + Component comp = null; + if (renderer != null) + comp = renderer.getTableCellRendererComponent + (this, column.getHeaderValue(), false, false, 0, 0); + // + if (comp != null) + { + width = comp.getPreferredSize().width; + width = Math.max(width, comp.getWidth()); + + // Cells + int col = column.getModelIndex(); + int maxRow = Math.min(20, getRowCount()); + try + { + for (int row = 0; row < maxRow; row++) + { + renderer = getCellRenderer(row, col); + comp = renderer.getTableCellRendererComponent + (this, getValueAt(row, col), false, false, row, col); + int rowWidth = comp.getPreferredSize().width; + width = Math.max(width, rowWidth); + } + } + catch (Exception e) + { + log.log(Level.SEVERE, column.getIdentifier().toString(), e); + } + // Width not greater than 250 + width = Math.min(MAXSIZE, width + SLACK); + } + // + column.setPreferredWidth(width); + } // for all columns + } // autoSize + + + /** + * Sort Table + * @param modelColumnIndex model column sort index + */ + @SuppressWarnings("unchecked") + protected void sort (int modelColumnIndex) + { + int rows = getRowCount(); + if (rows == 0) + return; + // other column + if (modelColumnIndex != p_lastSortIndex) + p_asc = true; + else + p_asc = !p_asc; + p_lastSortIndex = modelColumnIndex; + // + log.config("#" + modelColumnIndex + " - rows=" + rows + ", asc=" + p_asc); + + // Selection + Object selected = null; + int selRow = getSelectedRow(); + int selCol = p_keyColumnIndex == -1 ? 0 : p_keyColumnIndex; // used to identify current row + if (getSelectedRow() >= 0) + selected = getValueAt(selRow, selCol); + + // Prepare sorting + DefaultTableModel model = (DefaultTableModel)getModel(); + MSort sort = new MSort(0, null); + sort.setSortAsc(p_asc); + // while something to sort + sorting: + while (true) + { + // Create sortList + ArrayList sortList = new ArrayList(rows); + // fill with data entity + for (int i = 0; i < rows; i++) + { + Object value = model.getValueAt(i, modelColumnIndex); + sortList.add(new MSort(i, value)); + } + // sort list it + Collections.sort(sortList, sort); + // move out of sequence row + for (int i = 0; i < rows; i++) + { + int index = ((MSort)sortList.get(i)).index; + if (i != index) + { + // log.config( "move " + i + " to " + index); + model.moveRow(i,i, index); + continue sorting; + } + } + // we are done + // log.config("done"); + break; + } // while something to sort + + // selection + clearSelection(); + if (selected != null) + { + for (int r = 0; r < rows; r++) + { + if (selected.equals(getValueAt(r, selCol))) + { + setRowSelectionInterval(r,r); + break; + } + } + } // selected != null + } // sort + + /** + * String Representation + * @return info + */ + public String toString() + { + return new StringBuffer("CTable[").append(getModel()).append("]").toString(); + } // toString + + + /************************************************************************** + * MouseListener + */ + class CTableMouseListener extends MouseAdapter + { + /** + * Constructor + */ + public CTableMouseListener() + { + super(); + } // CTableMouseListener + + /** + * Mouse clicked + * @param e event + */ + public void mouseClicked (MouseEvent e) + { + int vc = getColumnModel().getColumnIndexAtX(e.getX()); + // log.info( "Sort " + vc + "=" + getColumnModel().getColumn(vc).getHeaderValue()); + int mc = convertColumnIndexToModel(vc); + sort(mc); + } + } // CTableMouseListener + +} // CTable diff --git a/looks/src/org/compiere/swing/CTextArea.java b/looks/src/org/compiere/swing/CTextArea.java new file mode 100644 index 0000000000..36836c2bd3 --- /dev/null +++ b/looks/src/org/compiere/swing/CTextArea.java @@ -0,0 +1,463 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.*; +import java.awt.event.*; +import java.awt.im.*; + +import javax.swing.*; +import javax.swing.text.*; + +import org.compiere.plaf.*; + +/** + * Adempiere TextArea - A ScrollPane with a JTextArea. + * Manages visibility, opaque and color consistently + * + * @author Jorg Janke + * @version $Id: CTextArea.java,v 1.3 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CTextArea extends JScrollPane + implements CEditor +{ + /** + * Constructs a new TextArea. A default model is set, the initial string + * is null, and rows/columns are set to 0. + */ + public CTextArea() + { + this (new JTextArea()); + } // CText + + /** + * Constructs a new TextArea with the specified text displayed. + * A default model is created and rows/columns are set to 0. + * + * @param text the text to be displayed, or null + */ + public CTextArea (String text) + { + this (new JTextArea (text)); + } // CText + + /** + * Constructs a new empty TextArea with the specified number of + * rows and columns. A default model is created, and the initial + * string is null. + * + * @param rows the number of rows >= 0 + * @param columns the number of columns >= 0 + * @exception IllegalArgumentException if the rows or columns + * arguments are negative. + */ + public CTextArea (int rows, int columns) + { + this (new JTextArea (rows, columns)); + } // CText + + /** + * Constructs a new TextArea with the specified text and number + * of rows and columns. A default model is created. + * + * @param text the text to be displayed, or null + * @param rows the number of rows >= 0 + * @param columns the number of columns >= 0 + * @exception IllegalArgumentException if the rows or columns + * arguments are negative. + */ + public CTextArea (String text, int rows, int columns) + { + this (new JTextArea(text, rows, columns)); + } // CText + + /** + * Constructs a new JTextArea with the given document model, and defaults + * for all of the other arguments (null, 0, 0). + * + * @param doc the model to use + */ + public CTextArea (Document doc) + { + this (new JTextArea (doc)); + } // CText + + /** + * Constructs a new JTextArea with the specified number of rows + * and columns, and the given model. All of the constructors + * feed through this constructor. + * + * @param doc the model to use, or create a default one if null + * @param text the text to be displayed, null if none + * @param rows the number of rows >= 0 + * @param columns the number of columns >= 0 + * @exception IllegalArgumentException if the rows or columns + * arguments are negative. + */ + public CTextArea (Document doc, String text, int rows, int columns) + { + this (new JTextArea (doc, text, rows, columns)); + } // CTextArea + + + /** + * Create a JScrollArea with a JTextArea. + * (use Cpmpiere Colors, Line wrap) + * @param textArea + */ + public CTextArea (JTextArea textArea) + { + super (textArea); + m_textArea = textArea; + super.setOpaque(false); + super.getViewport().setOpaque(false); + m_textArea.setFont(AdempierePLAF.getFont_Field()); + m_textArea.setForeground(AdempierePLAF.getTextColor_Normal()); + m_textArea.setLineWrap(true); + m_textArea.setWrapStyleWord(true); + // Overwrite default Tab + m_textArea.firePropertyChange("editable", !isEditable(), isEditable()); + } // CTextArea + + /** Text Area */ + private JTextArea m_textArea = null; + + /*************************************************************************/ + + /** Mandatory (default false) */ + private boolean m_mandatory = false; + + /** + * Set Editor Mandatory + * @param mandatory true, if you have to enter data + */ + public void setMandatory (boolean mandatory) + { + m_mandatory = mandatory; + setBackground(false); + } // setMandatory + + /** + * Is Field mandatory + * @return true, if mandatory + */ + public boolean isMandatory() + { + return m_mandatory; + } // isMandatory + + /** + * Enable Editor + * @param rw true, if you can enter/select data + */ + public void setReadWrite (boolean rw) + { + if (m_textArea.isEditable() != rw) + m_textArea.setEditable (rw); + setBackground(false); + } // setReadWrite + + /** + * Is it possible to edit + * @return true, if editable + */ + public boolean isReadWrite() + { + return m_textArea.isEditable(); + } // isReadWrite + + /** + * Set Background based on editable / mandatory / error + * @param error if true, set background to error color, otherwise mandatory/editable + */ + public void setBackground (boolean error) + { + if (error) + setBackground(AdempierePLAF.getFieldBackground_Error()); + else if (!isReadWrite()) + setBackground(AdempierePLAF.getFieldBackground_Inactive()); + else if (m_mandatory) + setBackground(AdempierePLAF.getFieldBackground_Mandatory()); + else + setBackground(AdempierePLAF.getFieldBackground_Normal()); + } // setBackground + + /** + * Set Background color + * @param color color + */ + public void setBackground (Color color) + { + if (color.equals(getBackground())) + return; + if (m_textArea == null) // during init + super.setBackground(color); + else + m_textArea.setBackground(color); + } + /** + * Get Background color + * @return background + */ + public Color getBackground () + { + if (m_textArea == null) // during init + return super.getBackground(); + else + return m_textArea.getBackground(); + } + /** + * Set Foreground color + * @param color + */ + public void setForeground (Color color) + { + if (m_textArea == null) // during init + super.setForeground(color); + else + m_textArea.setForeground(color); + } + /** + * Get Foreground color + * @return color + */ + public Color getForeground () + { + if (m_textArea == null) // during init + return super.getForeground(); + else + return m_textArea.getForeground(); + } + + /** + * Set Editor to value + * @param value value of the editor + */ + public void setValue (Object value) + { + if (value == null) + m_textArea.setText(""); + else + m_textArea.setText(value.toString()); + } // setValue + + /** + * Return Editor value + * @return current value + */ + public Object getValue() + { + return m_textArea.getText(); + } // getValue + + /** + * Return Display Value + * @return displayed String value + */ + public String getDisplay() + { + return m_textArea.getText(); + } // getDisplay + + /************************************************************************* + * Set Text and position top + * @param text + */ + public void setText (String text) + { + m_textArea.setText(text); + m_textArea.setCaretPosition(0); + } + /** + * Get Text + * @return text + */ + public String getText() + { + return m_textArea.getText(); + } + /** + * Append text + * @param text + */ + public void append (String text) + { + m_textArea.append (text); + } + + /** + * Set Columns + * @param cols + */ + public void setColumns (int cols) + { + m_textArea.setColumns (cols); + } + /** + * Get Columns + * @return columns + */ + public int getColumns() + { + return m_textArea.getColumns(); + } + + /** + * Set Rows + * @param rows + */ + public void setRows (int rows) + { + m_textArea.setRows(rows); + } + /** + * Get Rows + * @return rows + */ + public int getRows() + { + return m_textArea.getRows(); + } + + /** + * Set Text Caret Position + * @param pos + */ + public void setCaretPosition (int pos) + { + m_textArea.setCaretPosition (pos); + } + /** + * Get Text Caret Position + * @return position + */ + public int getCaretPosition() + { + return m_textArea.getCaretPosition(); + } + + /** + * Set Text Editable + * @param edit + */ + public void setEditable (boolean edit) + { + m_textArea.setEditable(edit); + } + /** + * Is Text Editable + * @return true if editable + */ + public boolean isEditable() + { + return m_textArea.isEditable(); + } + + /** + * Set Text Line Wrap + * @param wrap + */ + public void setLineWrap (boolean wrap) + { + m_textArea.setLineWrap (wrap); + } + /** + * Set Text Wrap Style Word + * @param word + */ + public void setWrapStyleWord (boolean word) + { + m_textArea.setWrapStyleWord (word); + } + + /** + * Set Opaque + * @param isOpaque + */ + public void setOpaque (boolean isOpaque) + { + // JScrollPane & Viewport is always not Opaque + if (m_textArea == null) // during init of JScrollPane + super.setOpaque(isOpaque); + else + m_textArea.setOpaque(isOpaque); + } // setOpaque + + /** + * Set Text Margin + * @param m insets + */ + public void setMargin (Insets m) + { + if (m_textArea != null) + m_textArea.setMargin(m); + } // setMargin + + + /** + * AddFocusListener + * @param l + */ + public void addFocusListener (FocusListener l) + { + if (m_textArea == null) // during init + super.addFocusListener(l); + else + m_textArea.addFocusListener(l); + } + /** + * Add Text Mouse Listener + * @param l + */ + public void addMouseListener (MouseListener l) + { + m_textArea.addMouseListener(l); + } + /** + * Add Text Key Listener + * @param l + */ + public void addKeyListener (KeyListener l) + { + m_textArea.addKeyListener(l); + } + /** + * Add Text Input Method Listener + * @param l + */ + public void addInputMethodListener (InputMethodListener l) + { + m_textArea.addInputMethodListener(l); + } + /** + * Get text Input Method Requests + * @return requests + */ + public InputMethodRequests getInputMethodRequests() + { + return m_textArea.getInputMethodRequests(); + } + /** + * Set Text Input Verifier + * @param l + */ + public void setInputVerifier (InputVerifier l) + { + m_textArea.setInputVerifier(l); + } + +} // CTextArea diff --git a/looks/src/org/compiere/swing/CTextField.java b/looks/src/org/compiere/swing/CTextField.java new file mode 100644 index 0000000000..9e18caee65 --- /dev/null +++ b/looks/src/org/compiere/swing/CTextField.java @@ -0,0 +1,261 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.*; +import javax.swing.text.*; + +import org.compiere.plaf.*; + +/** + * Adempiere Text Field + * + * @author Jorg Janke + * @version $Id: CTextField.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CTextField extends JTextField + implements CEditor, KeyListener +{ + /** + * Constructs a new TextField. A default model is created, + * the initial string is null, + * and the number of columns is set to 0. + */ + public CTextField() + { + super(); + init(); + } // CTextField + + /** + * Constructs a new TextField initialized with the + * specified text. A default model is created and the number of + * columns is 0. + * + * @param text the text to be displayed, or null + */ + public CTextField (String text) + { + super (text); + init(); + } // CTextField + + /** + * Constructs a new empty TextField with the specified + * number of columns. + * A default model is created and the initial string is set to + * null. + * + * @param columns the number of columns to use to calculate + * the preferred width; if columns is set to zero, the + * preferred width will be whatever naturally results from + * the component implementation + */ + public CTextField (int columns) + { + super (columns); + init(); + } // CTextField + + /** + * Constructs a new TextField initialized with the + * specified text and columns. A default model is created. + * + * @param text the text to be displayed, or null + * @param columns the number of columns to use to calculate + * the preferred width; if columns is set to zero, the + * preferred width will be whatever naturally results from + * the component implementation + */ + public CTextField (String text, int columns) + { + super (text, columns); + init(); + } // CTextField + + /** + * Constructs a new JTextField that uses the given text + * storage model and the given number of columns. + * This is the constructor through which the other constructors feed. + * If the document is null, a default model is created. + * + * @param doc the text storage to use; if this is null, + * a default will be provided by calling the + * createDefaultModel method + * @param text the initial string to display, or null + * @param columns the number of columns to use to calculate + * the preferred width >= 0; if columns + * is set to zero, the preferred width will be whatever + * naturally results from the component implementation + * @exception IllegalArgumentException if columns < 0 + */ + public CTextField (Document doc, String text, int columns) + { + super (doc, text, columns); + init(); + } // CTextField + + /** + * Initialization + */ + private void init() + { + setFont(AdempierePLAF.getFont_Field()); + setForeground(AdempierePLAF.getTextColor_Normal()); + setBackground (false); + // Minimum Size + Dimension size = getPreferredSize(); + if (size != null) + size = new Dimension (20,10); + size.width = 30; + setMinimumSize(size); + } // init + + /*************************************************************************/ + + /** Mandatory (default false) */ + private boolean m_mandatory = false; + + /** + * Set Editor Mandatory + * @param mandatory true, if you have to enter data + */ + public void setMandatory (boolean mandatory) + { + m_mandatory = mandatory; + setBackground(false); + } // setMandatory + + /** + * Is Field mandatory + * @return true, if mandatory + */ + public boolean isMandatory() + { + return m_mandatory; + } // isMandatory + + /** + * Enable Editor + * @param rw true, if you can enter/select data + */ + public void setReadWrite (boolean rw) + { + if (super.isEditable() != rw) + super.setEditable (rw); + setBackground(false); + } // setEditable + + /** + * Is it possible to edit + * @return true, if editable + */ + public boolean isReadWrite() + { + return super.isEditable(); + } // isReadWrite + + + /** + * Set Background based on editable / mandatory / error + * @param error if true, set background to error color, otherwise mandatory/editable + */ + public void setBackground (boolean error) + { + if (error) + setBackground(AdempierePLAF.getFieldBackground_Error()); + else if (!isReadWrite()) + setBackground(AdempierePLAF.getFieldBackground_Inactive()); + else if (m_mandatory) + setBackground(AdempierePLAF.getFieldBackground_Mandatory()); + else + setBackground(AdempierePLAF.getFieldBackground_Normal()); + } // setBackground + + /** + * Set Background + * @param bg background + */ + public void setBackground (Color bg) + { + if (bg.equals(getBackground())) + return; + super.setBackground(bg); + } // setBackground + + /** + * Set Editor to value + * @param value value of the editor + */ + public void setValue (Object value) + { + if (value == null) + setText(""); + else + setText(value.toString()); + } // setValue + + /** + * Return Editor value + * @return current value + */ + public Object getValue() + { + return getText(); + } // getValue + + /** + * Return Display Value + * @return displayed String value + */ + public String getDisplay() + { + return getText(); + } // getDisplay + + + /** + * key Pressed + * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent) + * @param e + */ + public void keyPressed(KeyEvent e) + { + } // keyPressed + + /** + * key Released + * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent) + * @param e + */ + public void keyReleased(KeyEvent e) + { + } // keyReleased + + /** + * key Typed + * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent) + * @param e + */ + public void keyTyped(KeyEvent e) + { + } // keyTyped + +} // CTextField diff --git a/looks/src/org/compiere/swing/CTextPane.java b/looks/src/org/compiere/swing/CTextPane.java new file mode 100644 index 0000000000..d2fd84f9f6 --- /dev/null +++ b/looks/src/org/compiere/swing/CTextPane.java @@ -0,0 +1,351 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.*; +import java.awt.event.*; +import java.awt.im.*; + +import javax.swing.*; +import javax.swing.text.*; + +import org.compiere.plaf.*; + +/** + * Adempiere TextPane - A ScrollPane with a JTextPane. + * Manages visibility, opaque and color consistently * + * @author Jorg Janke + * @version $Id: CTextPane.java,v 1.3 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CTextPane extends JScrollPane + implements CEditor + +{ + /** + * Constructs a new TextPane (HTML) + */ + public CTextPane() + { + this (new JTextPane()); + } // CTextPane + + /** + * Constructs a new JTextPane with the given document + * @param doc the model to use + */ + public CTextPane (StyledDocument doc) + { + this (new JTextPane (doc)); + } // CTextPane + + /** + * Create a JScrollArea with a JTextEditor + * @param textPane + */ + public CTextPane (JTextPane textPane) + { + super (textPane); + m_textPane = textPane; + super.setOpaque(false); + super.getViewport().setOpaque(false); + m_textPane.setContentType("text/html"); + m_textPane.setFont(AdempierePLAF.getFont_Field()); + m_textPane.setForeground(AdempierePLAF.getTextColor_Normal()); + } // CTextPane + + private JTextPane m_textPane = null; + + /*************************************************************************/ + + /** Mandatory (default false) */ + private boolean m_mandatory = false; + + /** + * Set Editor Mandatory + * @param mandatory true, if you have to enter data + */ + public void setMandatory (boolean mandatory) + { + m_mandatory = mandatory; + setBackground(false); + } // setMandatory + + /** + * Is Field mandatory + * @return true, if mandatory + */ + public boolean isMandatory() + { + return m_mandatory; + } // isMandatory + + /** + * Enable Editor + * @param rw true, if you can enter/select data + */ + public void setReadWrite (boolean rw) + { + if (m_textPane.isEditable() != rw) + m_textPane.setEditable (rw); + setBackground(false); + } // setReadWrite + + /** + * Is it possible to edit + * @return true, if editable + */ + public boolean isReadWrite() + { + return m_textPane.isEditable(); + } // isReadWrite + + /** + * Set Background based on editable / mandatory / error + * @param error if true, set background to error color, otherwise mandatory/editable + */ + public void setBackground (boolean error) + { + if (error) + setBackground(AdempierePLAF.getFieldBackground_Error()); + else if (!isReadWrite()) + setBackground(AdempierePLAF.getFieldBackground_Inactive()); + else if (m_mandatory) + setBackground(AdempierePLAF.getFieldBackground_Mandatory()); + else + setBackground(AdempierePLAF.getFieldBackground_Normal()); + } // setBackground + + /** + * Set Background + * @param color color + */ + public void setBackground (Color color) + { + if (color.equals(getBackground())) + return; + if (m_textPane == null) // during init + super.setBackground(color); + else + m_textPane.setBackground(color); + } // setBackground + + /** + * Get Background + * @return color + */ + public Color getBackground () + { + if (m_textPane == null) // during init + return super.getBackground(); + else + return m_textPane.getBackground(); + } // getBackground + + /** + * Set Foreground + * @param color color + */ + public void setForeground (Color color) + { + if (m_textPane == null) // during init + super.setForeground(color); + else + m_textPane.setForeground(color); + } // setForeground + + /** + * Get Foreground + * @return color + */ + public Color getForeground () + { + if (m_textPane == null) // during init + return super.getForeground(); + else + return m_textPane.getForeground(); + } // getForeground + + /** + * Set Content Type + * @param type e.g. text/html + */ + public void setContentType (String type) + { + if (m_textPane != null) // during init + m_textPane.setContentType(type); + } // setContentType + + + /** + * Set Editor to value + * @param value value of the editor + */ + public void setValue (Object value) + { + if (value == null) + m_textPane.setText(""); + else + m_textPane.setText(value.toString()); + } // setValue + + /** + * Return Editor value + * @return current value + */ + public Object getValue() + { + return m_textPane.getText(); + } // getValue + + /** + * Return Display Value + * @return displayed String value + */ + public String getDisplay() + { + return m_textPane.getText(); + } // getDisplay + + + /************************************************************************** + * Set Text and position top + * @param text + */ + public void setText (String text) + { + m_textPane.setText(text); + m_textPane.setCaretPosition(0); + } + /** + * Get Text + * @return text + */ + public String getText() + { + return m_textPane.getText(); + } + + /** + * Set Caret Position + * @param pos pos + */ + public void setCaretPosition (int pos) + { + m_textPane.setCaretPosition (pos); + } + /** + * Get Caret Position + * @return position + */ + public int getCaretPosition() + { + return m_textPane.getCaretPosition(); + } + + /** + * Set Editable + * @param edit editable + */ + public void setEditable (boolean edit) + { + m_textPane.setEditable(edit); + } + /** + * Editable + * @return true if editable + */ + public boolean isEditable() + { + return m_textPane.isEditable(); + } + + /** + * Set Text Margin + * @param m insets + */ + public void setMargin (Insets m) + { + if (m_textPane != null) + m_textPane.setMargin(m); + } // setMargin + + /** + * Set Opaque + * @param isOpaque opaque + */ + public void setOpaque (boolean isOpaque) + { + // JScrollPane & Viewport is always not Opaque + if (m_textPane == null) // during init of JScrollPane + super.setOpaque(isOpaque); + else + m_textPane.setOpaque(isOpaque); + } // setOpaque + + /** + * Add Focus Listener + * @param l listener + */ + public void addFocusListener (FocusListener l) + { + if (m_textPane == null) // during init + super.addFocusListener(l); + else + m_textPane.addFocusListener(l); + } + /** + * Add Mouse Listener + * @param l listner + */ + public void addMouseListener (MouseListener l) + { + m_textPane.addMouseListener(l); + } + /** + * Add Key Listener + * @param l listner + */ + public void addKeyListener (KeyListener l) + { + m_textPane.addKeyListener(l); + } + /** + * Add Input Method Listener + * @param l listener + */ + public void addInputMethodListener (InputMethodListener l) + { + m_textPane.addInputMethodListener(l); + } + /** + * Get Input Method Requests + * @return requests + */ + public InputMethodRequests getInputMethodRequests() + { + return m_textPane.getInputMethodRequests(); + } + /** + * Set Input Verifier + * @param l verifyer + */ + public void setInputVerifier (InputVerifier l) + { + m_textPane.setInputVerifier(l); + } + +} // CTextPane diff --git a/looks/src/org/compiere/swing/CToggleButton.java b/looks/src/org/compiere/swing/CToggleButton.java new file mode 100644 index 0000000000..1097e1803d --- /dev/null +++ b/looks/src/org/compiere/swing/CToggleButton.java @@ -0,0 +1,272 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.swing; + +import java.awt.Color; + +import javax.swing.Action; +import javax.swing.Icon; +import javax.swing.JToggleButton; + +import org.compiere.plaf.AdempiereColor; +import org.compiere.plaf.AdempierePLAF; +import org.compiere.util.Trace; + +/** + * Adempiere Color Taggle Button + * + * @author Jorg Janke + * @version $Id: CToggleButton.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $ + */ +public class CToggleButton extends JToggleButton implements CEditor +{ + /** + * Creates an initially unselected toggle button + * without setting the text or image. + */ + public CToggleButton () + { + this(null, null, false); + } + + /** + * Creates an initially unselected toggle button + * with the specified image but no text. + * + * @param icon the image that the button should display + */ + public CToggleButton(Icon icon) + { + this(null, icon, false); + } + + /** + * Creates a toggle button with the specified image + * and selection state, but no text. + * + * @param icon the image that the button should display + * @param selected if true, the button is initially selected; + * otherwise, the button is initially unselected + */ + public CToggleButton(Icon icon, boolean selected) + { + this(null, icon, selected); + } + + /** + * Creates an unselected toggle button with the specified text. + * + * @param text the string displayed on the toggle button + */ + public CToggleButton (String text) + { + this(text, null, false); + } + + /** + * Creates a toggle button with the specified text + * and selection state. + * + * @param text the string displayed on the toggle button + * @param selected if true, the button is initially selected; + * otherwise, the button is initially unselected + */ + public CToggleButton (String text, boolean selected) + { + this(text, null, selected); + } + + /** + * Creates a toggle button where properties are taken from the + * Action supplied. + * @param a + */ + public CToggleButton(Action a) + { + this(null, null, false); + setAction(a); + } + + /** + * Creates a toggle button that has the specified text and image, + * and that is initially unselected. + * + * @param text the string displayed on the button + * @param icon the image that the button should display + */ + public CToggleButton(String text, Icon icon) + { + this(text, icon, false); + } + + /** + * Creates a toggle button with the specified text, image, and + * selection state. + * + * @param text the text of the toggle button + * @param icon the image that the button should display + * @param selected if true, the button is initially selected; + * otherwise, the button is initially unselected + */ + public CToggleButton (String text, Icon icon, boolean selected) + { + super(text, icon, selected); + setContentAreaFilled(false); + setOpaque(false); + // + setFont(AdempierePLAF.getFont_Label()); + setForeground(AdempierePLAF.getTextColor_Label()); + } + + /*************************************************************************/ + + /** + * Set Background - Differentiates between system & user call. + * If User Call, sets Opaque & ContextAreaFilled to true + * @param bg + */ + public void setBackground(Color bg) + { + if (bg.equals(getBackground())) + return; + super.setBackground( bg); + // ignore calls from javax.swing.LookAndFeel.installColors(LookAndFeel.java:61) + if (!Trace.getCallerClass(1).startsWith("javax")) + { + setOpaque(true); + setContentAreaFilled(true); + } + } // setBackground + + /** + * Set Background - NOP + * @param error + */ + public void setBackground (boolean error) + { + } // setBackground + + /** + * Set Standard Background + */ + public void setBackgroundColor () + { + setBackgroundColor (null); + } // setBackground + + /** + * Set Background + * @param bg AdempiereColor for Background, if null set standard background + */ + public void setBackgroundColor (AdempiereColor bg) + { + if (bg == null) + bg = AdempiereColor.getDefaultBackground(); + setOpaque(true); + putClientProperty(AdempierePLAF.BACKGROUND, bg); + super.setBackground (bg.getFlatColor()); + } // setBackground + + /** + * Get Background + * @return Color for Background + */ + public AdempiereColor getBackgroundColor () + { + try + { + return (AdempiereColor)getClientProperty(AdempierePLAF.BACKGROUND); + } + catch (Exception e) + { + System.err.println("CButton - ClientProperty: " + e.getMessage()); + } + return null; + } // getBackgroundColor + + /** Mandatory (default false) */ + private boolean m_mandatory = false; + + /** + * Set Editor Mandatory + * @param mandatory true, if you have to enter data + */ + public void setMandatory (boolean mandatory) + { + m_mandatory = mandatory; + setBackground(false); + } // setMandatory + + /** + * Is Field mandatory + * @return true, if mandatory + */ + public boolean isMandatory() + { + return m_mandatory; + } // isMandatory + + /** + * Enable Editor + * @param rw true, if you can enter/select data + */ + public void setReadWrite (boolean rw) + { + if (super.isEnabled() != rw) + super.setEnabled(rw); + } // setReadWrite + + /** + * Is it possible to edit + * @return true, if editable + */ + public boolean isReadWrite() + { + return super.isEnabled(); + } // isReadWrite + + /** + * Set Editor to value + * @param value value of the editor + */ + public void setValue (Object value) + { + if (value == null) + setText(""); + else + setText(value.toString()); + } // setValue + + /** + * Return Editor value + * @return current value + */ + public Object getValue() + { + return getText(); + } // getValue + + /** + * Return Display Value + * @return displayed String value + */ + public String getDisplay() + { + return getText(); + } // getDisplay + +} // CToggleButton diff --git a/looks/src/org/compiere/swing/package.html b/looks/src/org/compiere/swing/package.html new file mode 100644 index 0000000000..46380c5000 --- /dev/null +++ b/looks/src/org/compiere/swing/package.html @@ -0,0 +1,32 @@ + + + + + +

+Provides Swing components to utilize the Adempiere Looks. +

+

Package Specification

+

+In the standard implementation, panels and panes are opaque. +Adempiere Looks sets opaque to false for JViewport, JScrollPane, JSplitPane and JTabbedPane +but not for JPanel and JButton. +

+The Adempiere Swing extensions like CPanel, CButton are not opaque. +

+

Related Documentation

+

For overviews, tutorials, examples, guides, and tool documentation, please + see: http://www.adempiere.org/looks

+

+ +

+ + diff --git a/looks/src/org/compiere/util/Ini.java b/looks/src/org/compiere/util/Ini.java new file mode 100644 index 0000000000..2a276e4cf0 --- /dev/null +++ b/looks/src/org/compiere/util/Ini.java @@ -0,0 +1,663 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.awt.*; +import java.io.*; +import java.sql.*; +import java.util.*; +import java.util.logging.*; +import org.compiere.plaf.*; +import org.adempiere.plaf.*; + + +/** + * Load & Save INI Settings fopm property file + * Initiated in Adempiere.startup + * Settings activated in ALogin.getIni + * + * @author Jorg Janke + * @version $Id$ + */ +public final class Ini implements Serializable +{ + /** Property file name */ + public static final String ADEMPIERE_PROPERTY_FILE = "Adempiere.properties"; + + /** Apps User ID */ + public static final String P_UID = "ApplicationUserID"; + private static final String DEFAULT_UID = "System"; + /** Apps Password */ + public static final String P_PWD = "ApplicationPassword"; + private static final String DEFAULT_PWD = "System"; + /** Store Password */ + public static final String P_STORE_PWD = "StorePassword"; + private static final boolean DEFAULT_STORE_PWD = true; + /** Trace Level */ + public static final String P_TRACELEVEL = "TraceLevel"; + private static final String DEFAULT_TRACELEVEL = "WARNING"; + /** Trace to File */ + public static final String P_TRACEFILE = "TraceFile"; + private static final boolean DEFAULT_TRACEFILE = false; + /** Language */ + public static final String P_LANGUAGE = "Language"; + private static final String DEFAULT_LANGUAGE = Language.getName + (System.getProperty("user.language") + "_" + System.getProperty("user.country")); + /** Ini File Name */ + public static final String P_INI = "FileNameINI"; + private static final String DEFAULT_INI = ""; + /** Connection Details */ + public static final String P_CONNECTION = "Connection"; + private static final String DEFAULT_CONNECTION = ""; + /** Data Source */ + public static final String P_CONTEXT = "DataSource"; + private static final String DEFAULT_CONTEXT = "java:adempiereDB"; + /** Look & Feel */ + public static final String P_UI_LOOK = "UILookFeel"; + + private static final String DEFAULT_UI_LOOK = AdempiereLookAndFeel.NAME; + /** UI Theme */ + + private static final String DEFAULT_UI_THEME = AdempiereThemeInnova.NAME; + /** UI Theme */ + public static final String P_UI_THEME = "UITheme"; + /** Flat Color UI */ + public static final String P_UI_FLAT = "UIFlat"; + private static final boolean DEFAULT_UI_FLAT = false; + /** Auto Save */ + public static final String P_A_COMMIT = "AutoCommit"; + private static final boolean DEFAULT_A_COMMIT = true; + /** Auto Login */ + public static final String P_A_LOGIN = "AutoLogin"; + private static final boolean DEFAULT_A_LOGIN = false; + /** Auto New Record */ + public static final String P_A_NEW = "AutoNew"; + private static final boolean DEFAULT_A_NEW = false; + /** Dictonary Maintennace */ + public static final String P_ADEMPIERESYS = "AdempiereSys"; // Save system records + private static final boolean DEFAULT_ADEMPIERESYS = false; + /** Show Acct Tabs */ + public static final String P_SHOW_ACCT = "ShowAcct"; + private static final boolean DEFAULT_SHOW_ACCT = true; + /** Show Advanced Tabs */ + public static final String P_SHOW_ADVANCED = "ShowAdvanced"; + private static final boolean DEFAULT_SHOW_ADVANCED = true; + /** Show Translation Tabs */ + public static final String P_SHOW_TRL = "ShowTrl"; + private static final boolean DEFAULT_SHOW_TRL = false; + /** Cache Windows */ + public static final String P_CACHE_WINDOW = "CacheWindow"; + private static final boolean DEFAULT_CACHE_WINDOW = true; + /** Temp Directory */ + public static final String P_TEMP_DIR = "TempDir"; + private static final String DEFAULT_TEMP_DIR = ""; + /** Role */ + public static final String P_ROLE = "Role"; + private static final String DEFAULT_ROLE = ""; + /** Client Name */ + public static final String P_CLIENT = "Client"; + private static final String DEFAULT_CLIENT = ""; + /** Org Name */ + public static final String P_ORG = "Organization"; + private static final String DEFAULT_ORG = ""; + /** Printer Name */ + public static final String P_PRINTER = "Printer"; + private static final String DEFAULT_PRINTER = ""; + /** Warehouse Name */ + public static final String P_WAREHOUSE = "Warehouse"; + private static final String DEFAULT_WAREHOUSE = ""; + /** Current Date */ + public static final String P_TODAY = "CDate"; + private static final Timestamp DEFAULT_TODAY = new Timestamp(System.currentTimeMillis()); + /** Print Preview */ + public static final String P_PRINTPREVIEW = "PrintPreview"; + private static final boolean DEFAULT_PRINTPREVIEW = false; + // + private static final String P_WARNING = "Warning"; + private static final String DEFAULT_WARNING = "Do_not_change_any_of_the_data_as_they_will_have_undocumented_side_effects."; + private static final String P_WARNING_de = "WarningD"; + private static final String DEFAULT_WARNING_de ="Einstellungen_nicht_aendern,_da_diese_undokumentierte_Nebenwirkungen_haben."; + + /** Ini Properties */ + private static final String[] PROPERTIES = new String[] { + P_UID, P_PWD, P_TRACELEVEL, P_TRACEFILE, + P_LANGUAGE, P_INI, + P_CONNECTION, P_STORE_PWD, + P_UI_LOOK, P_UI_THEME, P_UI_FLAT, + P_A_COMMIT, P_A_LOGIN, P_A_NEW, + P_ADEMPIERESYS, P_SHOW_ACCT, P_SHOW_TRL, + P_SHOW_ADVANCED, P_CACHE_WINDOW, + P_CONTEXT, P_TEMP_DIR, + P_ROLE, P_CLIENT, P_ORG, P_PRINTER, P_WAREHOUSE, P_TODAY, + P_PRINTPREVIEW, + P_WARNING, P_WARNING_de + }; + /** Ini Property Values */ + private static final String[] VALUES = new String[] { + DEFAULT_UID, DEFAULT_PWD, DEFAULT_TRACELEVEL, DEFAULT_TRACEFILE?"Y":"N", + DEFAULT_LANGUAGE, DEFAULT_INI, + DEFAULT_CONNECTION, DEFAULT_STORE_PWD?"Y":"N", + DEFAULT_UI_LOOK, DEFAULT_UI_THEME, DEFAULT_UI_FLAT?"Y":"N", + DEFAULT_A_COMMIT?"Y":"N", DEFAULT_A_LOGIN?"Y":"N", DEFAULT_A_NEW?"Y":"N", + DEFAULT_ADEMPIERESYS?"Y":"N", DEFAULT_SHOW_ACCT?"Y":"N", DEFAULT_SHOW_TRL?"Y":"N", + DEFAULT_SHOW_ADVANCED?"Y":"N", DEFAULT_CACHE_WINDOW?"Y":"N", + DEFAULT_CONTEXT, DEFAULT_TEMP_DIR, + DEFAULT_ROLE, DEFAULT_CLIENT, DEFAULT_ORG, DEFAULT_PRINTER, DEFAULT_WAREHOUSE, DEFAULT_TODAY.toString(), + DEFAULT_PRINTPREVIEW?"Y":"N", + DEFAULT_WARNING, DEFAULT_WARNING_de + }; + + /** Container for Properties */ + private static Properties s_prop = new Properties(); + /** Logger */ + private static Logger log = Logger.getLogger(Ini.class.getName()); + + /** + * Save INI parameters to disk + * @param tryUserHome get user home first + */ + public static void saveProperties (boolean tryUserHome) + { + String fileName = getFileName (tryUserHome); + FileOutputStream fos = null; + try + { + File f = new File(fileName); + fos = new FileOutputStream(f); + s_prop.store(fos, "Adempiere"); + fos.flush(); + fos.close(); + } + catch (Exception e) + { + log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + e.toString()); + return; + } + catch (Throwable t) + { + log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + t.toString()); + return; + } + log.finer(fileName); + } // save + + /** + * Load INI parameters from disk + * @param reload reload + */ + public static void loadProperties (boolean reload) + { + if (reload || s_prop.size() == 0) + loadProperties(getFileName(s_client)); + } // loadProperties + + /** + * Load INI parameters from filename. + * Logger is on default level (INFO) + * @param filename to load + * @return true if first time + */ + public static boolean loadProperties (String filename) + { + boolean loadOK = true; + boolean firstTime = false; + s_prop = new Properties(); + FileInputStream fis = null; + try + { + fis = new FileInputStream(filename); + s_prop.load(fis); + fis.close(); + } + catch (FileNotFoundException e) + { + log.warning(filename + " not found"); + loadOK = false; + } + catch (Exception e) + { + log.log(Level.SEVERE, filename + " - " + e.toString()); + loadOK = false; + } + catch (Throwable t) + { + log.log(Level.SEVERE, filename + " - " + t.toString()); + loadOK = false; + } + if (!loadOK || s_prop.getProperty(P_TODAY, "").equals("")) + { + log.config(filename); + firstTime = true; + if (!IniDialog.accept()) + System.exit(-1); + } + + // Check/set properties defaults + for (int i = 0; i < PROPERTIES.length; i++) + { + if (VALUES[i].length() > 0) + checkProperty(PROPERTIES[i], VALUES[i]); + } + + // + String tempDir = System.getProperty("java.io.tmpdir"); + if (tempDir == null || tempDir.length() == 1) + tempDir = getAdempiereHome(); + if (tempDir == null) + tempDir = ""; + checkProperty(P_TEMP_DIR, tempDir); + + // Save if not exist or could not be read + if (!loadOK || firstTime) + saveProperties(true); + s_loaded = true; + log.info(filename + " #" + s_prop.size()); + return firstTime; + } // loadProperties + + /** + * Load property and set to default, if not existing + * + * @param key Key + * @param defaultValue Default Value + * @return Property + */ + private static String checkProperty (String key, String defaultValue) + { + String result = null; + if (key.equals(P_WARNING) || key.equals(P_WARNING_de)) + result = defaultValue; + else if (!isClient()) + result = s_prop.getProperty (key, SecureInterface.CLEARVALUE_START + defaultValue + SecureInterface.CLEARVALUE_END); + else + result = s_prop.getProperty (key, SecureEngine.encrypt(defaultValue)); + s_prop.setProperty (key, result); + return result; + } // checkProperty + + /** + * Return File Name of INI file + *
+	 *  Examples:
+	 *	    C:\WinNT\Profiles\jjanke\Adempiere.properties
+	 *      D:\Adempiere\Adempiere.properties
+	 *      Adempiere.properties
+	 *  
+ * Can be overwritten by -DPropertyFile=myFile allowing multiple + * configurations / property files. + * @param tryUserHome get user home first + * @return file name + */ + private static String getFileName (boolean tryUserHome) + { + if (System.getProperty("PropertyFile") != null) + return System.getProperty("PropertyFile"); + // + String base = null; + if (tryUserHome && s_client) + base = System.getProperty("user.home"); + // Server + if (!s_client || base == null || base.length() == 0) + { + String home = getAdempiereHome(); + if (home != null) + base = home; + } + if (base != null && !base.endsWith(File.separator)) + base += File.separator; + if (base == null) + base = ""; + // + return base + ADEMPIERE_PROPERTY_FILE; + } // getFileName + + + /************************************************************************** + * Set Property + * @param key Key + * @param value Value + */ + public static void setProperty (String key, String value) + { + // log.finer(key + "=" + value); + if (s_prop == null) + s_prop = new Properties(); + if (key.equals(P_WARNING) || key.equals(P_WARNING_de)) + s_prop.setProperty(key, value); + else if (!isClient()) + s_prop.setProperty(key, SecureInterface.CLEARVALUE_START + value + SecureInterface.CLEARVALUE_END); + else + { + if (value == null) + s_prop.setProperty(key, ""); + else + { + String eValue = SecureEngine.encrypt(value); + if (eValue == null) + s_prop.setProperty(key, ""); + else + s_prop.setProperty(key, eValue); + } + } + } // setProperty + + /** + * Set Property + * @param key Key + * @param value Value + */ + public static void setProperty (String key, boolean value) + { + setProperty (key, value ? "Y" : "N"); + } // setProperty + + /** + * Set Property + * @param key Key + * @param value Value + */ + public static void setProperty (String key, int value) + { + setProperty (key, String.valueOf(value)); + } // setProperty + + /** + * Get Propery + * @param key Key + * @return Value + */ + public static String getProperty (String key) + { + if (key == null) + return ""; + String retStr = s_prop.getProperty(key, ""); + if (retStr == null || retStr.length() == 0) + return ""; + // + String value = SecureEngine.decrypt(retStr); + // log.finer(key + "=" + value); + if (value == null) + return ""; + return value; + } // getProperty + + /** + * Get Propery as Boolean + * @param key Key + * @return Value + */ + public static boolean isPropertyBool (String key) + { + return getProperty (key).equals("Y"); + } // getProperty + + /** + * Cache Windows + * @return true if windows are cached + */ + public static boolean isCacheWindow() + { + return getProperty (P_CACHE_WINDOW).equals("Y"); + } // isCacheWindow + + /************************************************************************** + * Get Properties + * + * @return Ini properties + */ + public static Properties getProperties() + { + return s_prop; + } // getProperties + + /** + * toString + * @return String representation + */ + public static String getAsString() + { + StringBuffer buf = new StringBuffer ("Ini["); + Enumeration e = s_prop.keys(); + while (e.hasMoreElements()) + { + String key = (String)e.nextElement(); + buf.append(key).append("="); + buf.append(getProperty(key)).append("; "); + } + buf.append("]"); + return buf.toString(); + } // toString + + + /*************************************************************************/ + + /** System environment prefix */ + public static final String ENV_PREFIX = "env."; + /** System Property Value of ADEMPIERE_HOME */ + public static final String ADEMPIERE_HOME = "ADEMPIERE_HOME"; + + /** IsClient Internal marker */ + private static boolean s_client = true; + /** IsClient Internal marker */ + private static boolean s_loaded = false; + + /** + * Are we in Client Mode ? + * @return true if client + */ + public static boolean isClient() + { + return s_client; + } // isClient + + /** + * Set Client Mode + * @param client client + */ + public static void setClient (boolean client) + { + s_client = client; + } // setClient + + /** + * Are the properties loaded? + * @return true if properties loaded. + */ + public static boolean isLoaded() + { + return s_loaded; + } // isLoaded + + /** + * Get Adempiere Home from Environment + * @return AdempiereHome or null + */ + public static String getAdempiereHome() + { + String env = System.getProperty (ENV_PREFIX + ADEMPIERE_HOME); + if (env == null) + env = System.getProperty (ADEMPIERE_HOME); + if (env == null) // Fallback + env = File.separator + "Adempiere"; + return env; + } // getAdempiereHome + + /** + * Set Adempiere Home + * @param AdempiereHome ADEMPIERE_HOME + */ + public static void setAdempiereHome (String AdempiereHome) + { + if (AdempiereHome != null && AdempiereHome.length() > 0) + System.setProperty (ADEMPIERE_HOME, AdempiereHome); + } // setAdempiereHome + + /** + * Find Adempiere Home + * @return adempiere home or null + */ + public static String findAdempiereHome() + { + String ch = getAdempiereHome(); + if (ch != null) + return ch; + + File[] roots = File.listRoots(); + for (int i = 0; i < roots.length; i++) + { + if (roots[i].getAbsolutePath().startsWith("A:")) + continue; + File[] subs = roots[i].listFiles(); + if (subs == null) + continue; + for (int j = 0; j < subs.length; j++) + { + if (!subs[j].isDirectory()) + continue; + String fileName = subs[j].getAbsolutePath(); + // globalqss, it's leaving log in first directory with lib subdirectory. i.e. Oracle + // if (fileName.indexOf("Adempiere") != 1) + if (fileName.indexOf("Adempiere") != -1) + { + String libDir = fileName + File.separator + "lib"; + File lib = new File(libDir); + if (lib.exists() && lib.isDirectory()) + return fileName; + } + } + } + return ch; + } // findAdempiereHome + + /************************************************************************** + * Get Window Dimension + * @param AD_Window_ID window no + * @return dimension or null + */ + public static Dimension getWindowDimension(int AD_Window_ID) + { + String key = "WindowDim" + AD_Window_ID; + String value = (String)s_prop.get(key); + if (value == null || value.length() == 0) + return null; + int index = value.indexOf("|"); + if (index == -1) + return null; + try + { + String w = value.substring(0, index); + String h = value.substring(index+1); + return new Dimension(Integer.parseInt(w),Integer.parseInt(h)); + } + catch (Exception e) + { + } + return null; + } // getWindowDimension + + /** + * Set Window Dimension + * @param AD_Window_ID window + * @param windowDimension dimension - null to remove + */ + public static void setWindowDimension(int AD_Window_ID, Dimension windowDimension) + { + String key = "WindowDim" + AD_Window_ID; + if (windowDimension != null) + { + String value = windowDimension.width + "|" + windowDimension.height; + s_prop.put(key, value); + } + else + s_prop.remove(key); + } // setWindowDimension + + /** + * Get Window Location + * @param AD_Window_ID window id + * @return location or null + */ + public static Point getWindowLocation(int AD_Window_ID) + { + String key = "WindowLoc" + AD_Window_ID; + String value = (String)s_prop.get(key); + if (value == null || value.length() == 0) + return null; + int index = value.indexOf("|"); + if (index == -1) + return null; + try + { + String x = value.substring(0, index); + String y = value.substring(index+1); + return new Point(Integer.parseInt(x),Integer.parseInt(y)); + } + catch (Exception e) + { + } + return null; + } // getWindowLocation + + /** + * Set Window Location + * @param AD_Window_ID window + * @param windowLocation location - null to remove + */ + public static void setWindowLocation(int AD_Window_ID, Point windowLocation) + { + String key = "WindowLoc" + AD_Window_ID; + if (windowLocation != null) + { + String value = windowLocation.x + "|" + windowLocation.y; + s_prop.put(key, value); + } + else + s_prop.remove(key); + } // setWindowLocation + + /** + * Get Divider Location + * @return location + */ + public static int getDividerLocation() + { + String key = "Divider"; + String value = (String)s_prop.get(key); + if (value == null || value.length() == 0) + return 0; + try + { + return Integer.parseInt(value); + } + catch (Exception e) + { + } + return 0; + } // getDividerLocation + + /** + * Set Divider Location + * @param dividerLocation location + */ + public static void setDividerLocation(int dividerLocation) + { + String key = "Divider"; + String value = String.valueOf(dividerLocation); + s_prop.put(key, value); + } // setDividerLocation + +} // Ini diff --git a/looks/src/org/compiere/util/IniDialog.java b/looks/src/org/compiere/util/IniDialog.java new file mode 100644 index 0000000000..e941b59222 --- /dev/null +++ b/looks/src/org/compiere/util/IniDialog.java @@ -0,0 +1,181 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.awt.*; +import java.awt.event.*; +import java.net.*; +import java.util.*; +import java.util.logging.*; +import javax.swing.*; + +import org.compiere.swing.*; +import org.compiere.plaf.*; + +/** + * Init Dialog + * + * @author Jorg Janke + * @version $Id: IniDialog.java,v 1.3 2006/10/12 00:58:32 jjanke Exp $ + */ +public final class IniDialog extends JDialog implements ActionListener +{ + /** + * Constructor + */ + public IniDialog() + { + super(); + try + { + jbInit(); + String where = "org/compiere/license.html"; + URL url = null; + ClassLoader cl = getClass().getClassLoader(); + if (cl != null) // Bootstrap + url = cl.getResource(where); + if (url == null) + { + log.warning("No license in resource "); + url = new URL("http://www.adempiere.org/license.htm"); + } + if (url == null) + cmd_reject(); + // + licensePane.setPage(url); + AdempierePLAF.showCenterScreen(this); + } + catch (Exception ex) + { + log.log(Level.SEVERE, "init", ex); + cmd_reject(); + } + } // IniDialog + + /** Translation */ + static ResourceBundle s_res = ResourceBundle.getBundle("org.compiere.util.IniRes"); + private boolean m_accept = false; + /** Logger */ + private static Logger log = Logger.getLogger (IniDialog.class.getName()); + + + private CPanel mainPanel = new CPanel(); + private BorderLayout mainLayout = new BorderLayout(); + private JScrollPane scrollPane = new JScrollPane(); + private CPanel southPanel = new CPanel(); + private JButton bReject = AdempierePLAF.getCancelButton(); + private JButton bAccept = AdempierePLAF.getOKButton(); + private FlowLayout southLayout = new FlowLayout(); + private JLabel southLabel = new JLabel(); + private JEditorPane licensePane = new JEditorPane(); + + /** + * Static Layout + * @throws Exception + */ + private void jbInit() throws Exception + { + setTitle("Adempiere - " + s_res.getString("Adempiere_License")); + southLabel.setText(s_res.getString("Do_you_accept")); + bReject.setText(s_res.getString("No")); + bAccept.setText(s_res.getString("Yes_I_Understand")); + // + setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + setModal(true); + // + mainPanel.setLayout(mainLayout); + bReject.setForeground(Color.red); + bReject.addActionListener(this); + bAccept.addActionListener(this); + southPanel.setLayout(southLayout); + southLayout.setAlignment(FlowLayout.RIGHT); + licensePane.setEditable(false); + licensePane.setContentType("text/html"); + scrollPane.setPreferredSize(new Dimension(700, 400)); + southPanel.add(southLabel, null); + getContentPane().add(mainPanel); + mainPanel.add(scrollPane, BorderLayout.CENTER); + scrollPane.getViewport().add(licensePane, null); + mainPanel.add(southPanel, BorderLayout.SOUTH); + southPanel.add(bReject, null); + southPanel.add(bAccept, null); + } // jbInit + + /** + * ActionListener + * @param e event + */ + public final void actionPerformed(ActionEvent e) + { + if (e.getSource() == bAccept) + m_accept = true; + dispose(); + } // actionPerformed + + /** + * Dispose + */ + public final void dispose() + { + super.dispose(); + if (!m_accept) + cmd_reject(); + } // dispose + + /** + * Is Accepted + * @return true if accepted + */ + public final boolean isAccepted() + { + return m_accept; + } // isAccepted + + /** + * Reject License + */ + public final void cmd_reject() + { + String info = "License rejected or expired"; + try + { + info = s_res.getString("License_rejected"); + } + catch (Exception e) + { + } + log.severe(info); + System.exit(10); + } // cmd_reject + + /** + * Display License and exit if rejected + * @return true if acceptes + */ + public static final boolean accept() + { + IniDialog id = new IniDialog(); + if (id.isAccepted()) + { + log.info("License Accepted"); + return true; + } + System.exit(10); + return false; // never executed. + } // accpept + +} // IniDialog diff --git a/looks/src/org/compiere/util/IniRes.java b/looks/src/org/compiere/util/IniRes.java new file mode 100644 index 0000000000..7385e4fbb4 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Jorg Janke + * @version $Id: IniRes.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "License Agreement" }, + { "Do_you_accept", "Do you accept the License ?" }, + { "No", "No" }, + { "Yes_I_Understand", "Yes, I Understand and Accept" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "License rejected or expired" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_ar.java b/looks/src/org/compiere/util/IniRes_ar.java new file mode 100644 index 0000000000..d90eb515f2 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_ar.java @@ -0,0 +1,50 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * @author Jorg Janke + * @version $Id: IniRes_ar.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ + +public class IniRes_ar extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "\u0631\u062e\u0635\u0629 \u0643\u0645\u0628\u064a\u0631" }, + { "Do_you_accept", "\u0647\u0644 \u0623\u0646\u062a \u0645\u0648\u0627\u0641\u0642\u061f" }, + { "No", "\u0644\u0627" }, + { "Yes_I_Understand", "\u0646\u0639\u0645\u060c \u0623\u0641\u0647\u0645 \u0648 \u0623\u0648\u0627\u0641\u0642" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "\u0627\u0644\u0631\u0651\u064f\u062e\u0635\u0629 \u0645\u0631\u0641\u0648\u0636\u0629 \u0623\u0648 \u0645\u0646\u062a\u0647\u064a\u0629" } + }; + + /** + * Get Content + * @return Content + * @uml.property name="contents" + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes_ar_TN + diff --git a/looks/src/org/compiere/util/IniRes_bg.java b/looks/src/org/compiere/util/IniRes_bg.java new file mode 100644 index 0000000000..98e932ba2d --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_bg.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Plamen Niikolov + * @version $Id: IniRes_bg.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_bg extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "\u041b\u0438\u0446\u0435\u043d\u0437\u043d\u043e \u0441\u043f\u043e\u0440\u0430\u0437\u0443\u043c\u0435\u043d\u0438\u0435" }, + { "Do_you_accept", "\u0421\u044a\u0433\u043b\u0430\u0441\u043d\u0438 \u043b\u0438 \u0441\u0442\u0435 \u0441 \u043b\u0438\u0446\u0435\u043d\u0437\u043d\u043e\u0442\u043e \u0441\u043f\u043e\u0440\u0430\u0437\u0443\u043c\u0435\u043d\u0438\u0435 ?" }, + { "No", "\u041d\u0435" }, + { "Yes_I_Understand", "\u0414\u0430, \u0440\u0430\u0431\u0438\u0440\u0430\u043c \u0433\u043e \u0438 \u0433\u043e \u043f\u0440\u0438\u0435\u043c\u0430\u043c" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "\u041b\u0438\u0446\u0435\u043d\u0437\u0430 \u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u043d \u0438\u043b\u0438 \u0441\u0432\u044a\u0440\u0448\u0438\u043b" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_ca.java b/looks/src/org/compiere/util/IniRes_ca.java new file mode 100644 index 0000000000..24747b48f7 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_ca.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Jaume Teixi + * @version $Id: IniRes_ca.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_ca extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Acord de Llic�ncia" }, + { "Do_you_accept", "Accepteu la Llic�ncia ?" }, + { "No", "No" }, + { "Yes_I_Understand", "S�, l'Entenc i l'Accepto" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Llic�ncia Refusada o Expirada" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_da.java b/looks/src/org/compiere/util/IniRes_da.java new file mode 100644 index 0000000000..2380a45d01 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_da.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Jorg Janke + * @version $Id: IniRes_da.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_da extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Licensaftale" }, + { "Do_you_accept", "Accept�r licensbetingelser?" }, + { "No", "Nej" }, + { "Yes_I_Understand", "Ja, jeg accepterer" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Licens afvist eller udl�bet" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_de.java b/looks/src/org/compiere/util/IniRes_de.java new file mode 100644 index 0000000000..19b7ba7358 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_de.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation (German) + * + * @author Jorg Janke + * @version $Id: IniRes_de.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_de extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Lizenz Vereinbarung" }, + { "Do_you_accept", "Akzeptieren Sie die Lizenz Vereinbarung ?" }, + { "No", "Nein" }, + { "Yes_I_Understand", "Ja, ich verstehe und akzeptiere" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Lizenz abgelehnt oder abgelaufen" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes_de diff --git a/looks/src/org/compiere/util/IniRes_es.java b/looks/src/org/compiere/util/IniRes_es.java new file mode 100644 index 0000000000..8881ae8ace --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_es.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Erwin Cortes + * @version $Id: IniRes_es.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_es extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Terminos de Licencia" }, + { "Do_you_accept", "Acepta la Licencia?" }, + { "No", "No" }, + { "Yes_I_Understand", "SI, Entendi y Acepto" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Licencia refutada o Expirada" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_fa.java b/looks/src/org/compiere/util/IniRes_fa.java new file mode 100644 index 0000000000..e5348fe04c --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_fa.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author . + * @version $Id: IniRes_fa.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_fa extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "\u0642\u0628\u0648\u0644 \u0645\u062c\u0648\u0632 \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631" }, + { "Do_you_accept", "\u0622\u064a\u0627 \u0645\u062c\u0648\u0632 \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 \u0631\u0627 \u0642\u0628\u0648\u0644 \u062f\u0627\u0631\u064a\u062f\u061f" }, + { "No", "\u062e\u064a\u0631" }, + { "Yes_I_Understand", "\u0628\u0644\u0647 \u0645\u0646 \u0645\u062c\u0648\u0632 \u0631\u0627 \u0641\u0647\u0645\u064a\u062f\u0647 \u0648 \u0642\u0628\u0648\u0644 \u062f\u0627\u0631\u0645" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "\u0645\u062c\u0648\u0632 \u0645\u0648\u0631\u062f \u0642\u0628\u0648\u0644 \u0648\u0627\u0642\u0639 \u0646\u0634\u062f \u064a\u0627 \u0645\u0646\u0642\u0636\u06cc \u0634\u062f\u0647" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_fi.java b/looks/src/org/compiere/util/IniRes_fi.java new file mode 100644 index 0000000000..20df8bcefa --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_fi.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation for Finnish language + * + * @author Petteri Soininen (petteri.soininen@netorek.fi) + * @version $Id: IniRes_fi.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_fi extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Lisensointiehdot" }, + { "Do_you_accept", "Hyv�ksytk� lisenssin?" }, + { "No", "Ei" }, + { "Yes_I_Understand", "Kyll�, ymm�rr�n ja hyv�ksyn ehdot" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Lisenssi hyl�tty tai vanhentunut" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_fr.java b/looks/src/org/compiere/util/IniRes_fr.java new file mode 100644 index 0000000000..48fb25a4b6 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_fr.java @@ -0,0 +1,49 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation (French) + * + * @author Jean-Luc SCHEIDEGGER + * @version $Id: IniRes_fr.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_fr extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Licence Adempiere" }, + { "Do_you_accept", "Accepter vous?" }, + { "No", "Non" }, + { "Yes_I_Understand", "Oui, je comprend et j'accepte" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "License rejet�e ou expir�e" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent + +} // IniRes_fr diff --git a/looks/src/org/compiere/util/IniRes_hr.java b/looks/src/org/compiere/util/IniRes_hr.java new file mode 100644 index 0000000000..120cdd053f --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_hr.java @@ -0,0 +1,49 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Marko Bubalo + * @version $Id: IniRes_hr.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_hr extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Sporazum o licenci" }, + { "Do_you_accept", "Da li prihva�ate licencu" }, + { "No", "Ne" }, + { "Yes_I_Understand", "Da, razumijem i prihva�am" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Licenca odbijena ili istekla" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes + diff --git a/looks/src/org/compiere/util/IniRes_in.java b/looks/src/org/compiere/util/IniRes_in.java new file mode 100644 index 0000000000..c313a00cf4 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_in.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Halim Englen + * @version $Id: IniRes_in.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_in extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Persetujuan Lisensi" }, + { "Do_you_accept", "Apakah anda menerima persetujuan lisensi ini ?" }, + { "No", "Tidak" }, + { "Yes_I_Understand", "Ya, Saya Mengerti dan Menerima sepenuhnya" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Lisensi telah ditolak atau habis masa berlakunya" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_it.java b/looks/src/org/compiere/util/IniRes_it.java new file mode 100644 index 0000000000..5bdeb4d17d --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_it.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Gabriele Vivinetto - gabriele.mailing@rvmgroup.it + * @version $Id: IniRes_it.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_it extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + //{ "Adempiere_License", "License Agreement" }, + { "Adempiere_License", "Accordo di Licenza" }, + //{ "Do_you_accept", "Do you accept the License ?" }, + { "Do_you_accept", "Accettate la Licenza ?" }, + //{ "No", "No" }, + { "No", "No" }, + //{ "Yes_I_Understand", "Yes, I Understand and Accept" }, + { "Yes_I_Understand", "Si, comprendiamo ed accettiamo" }, + //{ "license_htm", "org/adempiere/license.htm" }, + { "license_htm", "org/adempiere/license.htm" }, + //{ "License_rejected", "License rejected or expired" } + { "License_rejected", "Licenza rifiutata o scaduta" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_ja.java b/looks/src/org/compiere/util/IniRes_ja.java new file mode 100644 index 0000000000..1b4d001fa1 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_ja.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Stefan Christians + * @version $Id: IniRes_ja.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_ja extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "\u30e9\u30a4\u30bb\u30f3\u30b9" }, + { "Do_you_accept", "\u4ed4\u306e\u30e9\u30a4\u30bb\u30f3\u30b9\u306b\u8cdb\u6210\u3057\u307e\u3059\u304b\uff1f" }, + { "No", "\u3044\u3048" }, + { "Yes_I_Understand", "\u306f\u3044" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "\u7121\u52b9\u306e\u30e9\u30a4\u30bb\u30f3\u30b9" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_ml.java b/looks/src/org/compiere/util/IniRes_ml.java new file mode 100644 index 0000000000..0273341d6c --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_ml.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Robin Hoo + * @version $Id: IniRes_ml.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_ml extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "License Agreement" }, + { "Do_you_accept", "Do you accept the License ?" }, + { "No", "No" }, + { "Yes_I_Understand", "Yes, I Understand and Accept" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "License rejected or expired" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_nl.java b/looks/src/org/compiere/util/IniRes_nl.java new file mode 100644 index 0000000000..1be996bf57 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_nl.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Eldir Tomassen + * @version $Id: IniRes_nl.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_nl extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Licentieovereenkomst" }, + { "Do_you_accept", "Accepteert u de licentieovereenkomst" }, + { "No", "Nee" }, + { "Yes_I_Understand", "Ja, Ik heb de licentieovereenkomst gelezen en ga hiermee accoord." }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Licentieovereenkomst afgewezen of verlopen." } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_no.java b/looks/src/org/compiere/util/IniRes_no.java new file mode 100644 index 0000000000..d5b3c28f11 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_no.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * Notwegian License Dialog Translation + * + * @author Olaf Slazak L�ken + * @version $Id: IniRes_no.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_no extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Lisense Avtale" }, + { "Do_you_accept", "Aksepterer du lisense avtalen ?" }, + { "No", "Nei" }, + { "Yes_I_Understand", "Ja, Jeg Forst�r og Aksepterer" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Lisensen avist eller utg�tt" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_pl.java b/looks/src/org/compiere/util/IniRes_pl.java new file mode 100644 index 0000000000..ae215736b8 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_pl.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Adam Bodurka + * @version $Id: IniRes_pl.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_pl extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Akceptacja Licencji" }, + { "Do_you_accept", "Czy akceptujesz licencj\u0119 ?" }, + { "No", "Nie" }, + { "Yes_I_Understand", "Tak, Rozumiem i akceptuj\u0119" }, + { "license_htm", "../license.htm" }, + { "License_rejected", "Licencja anulowana lub wygas\u0142a" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_pt.java b/looks/src/org/compiere/util/IniRes_pt.java new file mode 100644 index 0000000000..7fedc11e82 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_pt.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Jesse Jr + * @version $Id: IniRes_pt.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_pt extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Acordo de Licen�a" }, + { "Do_you_accept", "Voc� aceita os termos da Licen�a ?" }, + { "No", "N�o" }, + { "Yes_I_Understand", "Sim, eu Entendi e Aceito" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Licen�a rejeitada ou expirada" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes_pt diff --git a/looks/src/org/compiere/util/IniRes_ro.java b/looks/src/org/compiere/util/IniRes_ro.java new file mode 100644 index 0000000000..8e9148e2f7 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_ro.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Jorg Janke + * @version $Id: IniRes_ro.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_ro extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Licen\u0163iere" }, + { "Do_you_accept", "Accepta\u0163i termenii de licen\u0163iere?" }, + { "No", "Nu" }, + { "Yes_I_Understand", "Da, \u00een\u0163eleg \u015fi accept" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Licen\u0163a a fost respins\u0103 sau a expirat" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_ru.java b/looks/src/org/compiere/util/IniRes_ru.java new file mode 100644 index 0000000000..e82af8f3e8 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_ru.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Vyacheslav Pedak + * @version $Id: IniRes_ru.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_ru extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435" }, + { "Do_you_accept", "\u0412\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435?" }, + { "No", "\u041d\u0435\u0442" }, + { "Yes_I_Understand", "\u0414\u0430, \u042f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f \u043d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u0430 \u0438\u043b\u0438 \u0438\u0441\u0442\u0435\u043a \u0441\u0440\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_sl.java b/looks/src/org/compiere/util/IniRes_sl.java new file mode 100644 index 0000000000..9485853868 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_sl.java @@ -0,0 +1,49 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Matja\u017e Godec + * @version $Id: IniRes_sl.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_sl extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Sporazum o licenci" }, + { "Do_you_accept", "Ali se strinjate z licenco" }, + { "No", "Ne" }, + { "Yes_I_Understand", "Ja, licenco razumem in se z njo strinjam" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Licenca je zavr\u017eena ali potekla" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes + diff --git a/looks/src/org/compiere/util/IniRes_sv.java b/looks/src/org/compiere/util/IniRes_sv.java new file mode 100644 index 0000000000..df34e2adc8 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_sv.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * Swedish License Dialog Translation + * + * @author Thomas Dilts + * @version $Id: IniRes_sv.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_sv extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Licensavtal" }, + { "Do_you_accept", "Godk�nner du licensen ?" }, + { "No", "Nej" }, + { "Yes_I_Understand", "Ja, jag f�rst�r och godk�nner" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Licens inte godk�nd eller l�pt ut" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_th.java b/looks/src/org/compiere/util/IniRes_th.java new file mode 100644 index 0000000000..98687ed203 --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_th.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation (Thai) + * + * @author Sureeraya Limpaibul + * @version $Id: IniRes_th.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_th extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "\u0e02\u0e49\u0e2d\u0e15\u0e01\u0e25\u0e07\u0e17\u0e32\u0e07\u0e25\u0e34\u0e02\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c" }, + { "Do_you_accept", "\u0e17\u0e48\u0e32\u0e19\u0e44\u0e14\u0e49\u0e22\u0e2d\u0e21\u0e23\u0e31\u0e1a\u0e25\u0e34\u0e02\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c\u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48" }, + { "No", "\u0e44\u0e21\u0e48\u0e22\u0e2d\u0e21\u0e23\u0e31\u0e1a" }, + { "Yes_I_Understand", "\u0e22\u0e2d\u0e21\u0e23\u0e31\u0e1a, \u0e02\u0e49\u0e32\u0e1e\u0e40\u0e08\u0e49\u0e32\u0e21\u0e35\u0e04\u0e27\u0e32\u0e21\u0e40\u0e02\u0e49\u0e32\u0e43\u0e08\u0e41\u0e25\u0e30\u0e22\u0e2d\u0e21\u0e23\u0e31\u0e1a\u0e15\u0e32\u0e21\u0e02\u0e49\u0e2d\u0e15\u0e01\u0e25\u0e07\u0e17\u0e32\u0e07\u0e25\u0e34\u0e02\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c\u0e19\u0e35\u0e49" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "\u0e25\u0e34\u0e02\u0e2a\u0e34\u0e17\u0e18\u0e34\u0e4c" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_vi.java b/looks/src/org/compiere/util/IniRes_vi.java new file mode 100644 index 0000000000..725fb697ee --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_vi.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Bui Chi Trung + * @version $Id: IniRes_vi.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_vi extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "Gi\u1EA5y ph�p s\u1EED d\u1EE5ng" }, + { "Do_you_accept", "B\u1EA1n c� ch\u1EA5p nh\u1EADn gi\u1EA5y ph�p n�y kh�ng?" }, + { "No", "Kh�ng" }, + { "Yes_I_Understand", "V�ng, t�i hi\u1EC3u v� ch\u1EA5p nh\u1EADn gi\u1EA5p ph�p n�y" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "Gi\u1EA5y ph�p b\u1ECB kh\u01B0\u1EDBc t\u1EEB ho\u1EB7c h\u1EBFt h\u1EA1n" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_zh.java b/looks/src/org/compiere/util/IniRes_zh.java new file mode 100644 index 0000000000..5c2f79916e --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_zh.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author Kirin Lin + * @version $Id: IniRes_zh.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_zh extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "\u7248\u6b0a\u5ba3\u544a" }, + { "Do_you_accept", "\u60a8\u540c\u610f\u9019\u500b\u5ba3\u544a\u55ce?" }, + { "No", "\u4e0d" }, + { "Yes_I_Understand", "\u662f\u7684, \u6211\u540c\u610f\u4e26\u4e14\u63a5\u53d7" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "\u6388\u6b0a\u88ab\u62d2\u7d55\u6216\u5df2\u904e\u671f" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/IniRes_zh_CN.java b/looks/src/org/compiere/util/IniRes_zh_CN.java new file mode 100644 index 0000000000..ccd1f2b88b --- /dev/null +++ b/looks/src/org/compiere/util/IniRes_zh_CN.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.ListResourceBundle; + +/** + * License Dialog Translation + * + * @author ZhaoXing Meng + * @version $Id: IniRes_zh_CN.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class IniRes_zh_CN extends ListResourceBundle +{ + /** Translation Content */ + static final Object[][] contents = new String[][] + { + { "Adempiere_License", "\u6700\u7ec8\u7528\u6237\u8bb8\u53ef\u534f\u8bae" }, + { "Do_you_accept", "\u60a8\u540c\u610f\u6b64\u534f\u8bae\u5417\uff1f" }, + { "No", "\u4e0d" }, + { "Yes_I_Understand", "\u662f\uff0c\u6211\u540c\u610f\u5e76\u4e14\u63a5\u53d7" }, + { "license_htm", "org/adempiere/license.htm" }, + { "License_rejected", "\u6743\u9650\u88ab\u62d2\u7edd\u6216\u5df2\u8fc7\u671f" } + }; + + /** + * Get Content + * @return Content + */ + public Object[][] getContents() + { + return contents; + } // getContent +} // IniRes diff --git a/looks/src/org/compiere/util/KeyNamePair.java b/looks/src/org/compiere/util/KeyNamePair.java new file mode 100644 index 0000000000..2906d2f369 --- /dev/null +++ b/looks/src/org/compiere/util/KeyNamePair.java @@ -0,0 +1,91 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +/** + * (Numeric) Key Name Pair + * + * @author Jorg Janke + * @version $Id: KeyNamePair.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public final class KeyNamePair extends NamePair +{ + /** + * Constructor KeyValue Pair - + * @param key Key (-1 is considered as null) + * @param name string representation + */ + public KeyNamePair(int key, String name) + { + super(name); + m_key = key; + } // KeyNamePair + + /** The Key */ + private int m_key = 0; + + /** + * Get Key + * @return key + */ + public int getKey() + { + return m_key; + } // getKey + + /** + * Get ID (key as String) + * + * @return String value of key or null if -1 + */ + public String getID() + { + if (m_key == -1) + return null; + return String.valueOf(m_key); + } // getID + + + /** + * Equals + * @param obj object + * @return true if equal + */ + public boolean equals(Object obj) + { + if (obj instanceof KeyNamePair) + { + KeyNamePair pp = (KeyNamePair)obj; + if (pp.getKey() == m_key + && pp.getName() != null + && pp.getName().equals(getName())) + return true; + return false; + } + return false; + } // equals + + /** + * Return Hashcode of key + * @return hascode + */ + public int hashCode() + { + return m_key; + } // hashCode + +} // KeyNamePair diff --git a/looks/src/org/compiere/util/Language.java b/looks/src/org/compiere/util/Language.java new file mode 100644 index 0000000000..1bb9fd32ec --- /dev/null +++ b/looks/src/org/compiere/util/Language.java @@ -0,0 +1,714 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.awt.*; +import java.io.*; +import java.text.*; +import java.util.*; +import java.util.logging.*; +import javax.print.attribute.standard.*; + +/** + * Language Management. + * + * @author Jorg Janke + * @version $Id: Language.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class Language implements Serializable +{ + /************************************************************************** + * Languages + * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt + * Countries + * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html + *************************************************************************/ + + /** Base Language */ + public static final String AD_Language_en_US = "en_US"; + /** Additional Languages */ + private static final String AD_Language_en_GB = "en_GB"; + private static final String AD_Language_en_AU = "en_AU"; + private static final String AD_Language_ca_ES = "ca_ES"; + private static final String AD_Language_hr_HR = "hr_HR"; + private static final String AD_Language_de_DE = "de_DE"; + private static final String AD_Language_it_IT = "it_IT"; + private static final String AD_Language_es_ES = "es_ES"; + private static final String AD_Language_fr_FR = "fr_FR"; + private static final String AD_Language_bg_BG = "bg_BG"; + private static final String AD_Language_th_TH = "th_TH"; + private static final String AD_Language_pl_PL = "pl_PL"; + private static final String AD_Language_zh_TW = "zh_TW"; + private static final String AD_Language_nl_NL = "nl_NL"; + private static final String AD_Language_no_NO = "no_NO"; + private static final String AD_Language_pt_BR = "pt_BR"; + private static final String AD_Language_ru_RU = "ru_RU"; + private static final String AD_Language_sl_SI = "sl_SI"; + private static final String AD_Language_sv_SE = "sv_SE"; + private static final String AD_Language_vi_VN = "vi_VN"; + private static final String AD_Language_zh_CN = "zh_CN"; + private static final String AD_Language_da_DK = "da_DK"; + private static final String AD_Language_ml_ML = "ml_ML"; + private static final String AD_Language_fa_IR = "fa_IR"; + private static final String AD_Language_fi_FI = "fi_FI"; + private static final String AD_Language_ro_RO = "ro_RO"; + private static final String AD_Language_ja_JP = "ja_JP"; + private static final String AD_Language_in_ID = "in_ID"; + private static final String AD_Language_ar_TN = "ar_TN"; + + /*** + * System Languages. + * If you want to add a language, extend the array + * - or use the addLanguage() method. + **/ + static private Language[] s_languages = { + new Language ("English", + AD_Language_en_US, Locale.US, null, null, + MediaSize.NA.LETTER), // Base Language + // ordered by locale + // Not predefined Locales - need to define decimal Point and date pattern (not sure about time) + new Language ("\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D (AR)", + AD_Language_ar_TN, new Locale("ar","TN"), new Boolean(true), "dd.MM.yyyy", + MediaSize.ISO.A4), + new Language ("\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438 (BG)", + AD_Language_bg_BG, new Locale("bg","BG"), new Boolean(false), "dd/MM/yyyy", + MediaSize.ISO.A4), + new Language ("Catal\u00e0", + AD_Language_ca_ES, new Locale("ca", "ES"), null, "dd/MM/yyyy", + MediaSize.ISO.A4), + new Language ("Deutsch", + AD_Language_de_DE, Locale.GERMANY, null, null, + MediaSize.ISO.A4), + new Language ("Dansk", + AD_Language_da_DK, new Locale("da","DK"), new Boolean(false), "dd-MM-yyyy", + MediaSize.ISO.A4), + new Language ("English (AU)", + AD_Language_en_AU, new Locale("en","AU"), null, "dd/MM/yyyy", + MediaSize.ISO.A4), + new Language ("English (UK)", + AD_Language_en_GB, Locale.UK, null, null, + MediaSize.ISO.A4), + new Language ("Espa\u00f1ol", + AD_Language_es_ES, new Locale("es","ES"), new Boolean(false), "dd/MM/yyyy", + MediaSize.ISO.A4), + new Language ("Farsi", + AD_Language_fa_IR, new Locale("fa","IR"), new Boolean(false), "dd-MM-yyyy", + MediaSize.ISO.A4), + new Language ("Finnish", + AD_Language_fi_FI, new Locale("fi","FI"), new Boolean(true), "dd.MM.yyyy", + MediaSize.ISO.A4), + new Language ("Fran\u00e7ais", + AD_Language_fr_FR, Locale.FRANCE, null, null, // dd.MM.yy + MediaSize.ISO.A4), + new Language ("Hrvatski", + AD_Language_hr_HR, new Locale("hr", "HR"), null, "dd.MM.yyyy", + MediaSize.ISO.A4), + new Language ("Indonesia Bahasa", + AD_Language_in_ID, new Locale("in","ID"), new Boolean(false), "dd-MM-yyyy", + MediaSize.ISO.A4), + new Language ("Italiano", + AD_Language_it_IT, Locale.ITALY, null, null, // dd.MM.yy + MediaSize.ISO.A4), + new Language ("\u65e5\u672c\u8a9e (JP)", + AD_Language_ja_JP, Locale.JAPAN, null, null, + MediaSize.ISO.A4), + new Language ("Malay", + AD_Language_ml_ML, new Locale("ml","ML"), new Boolean(false), "dd-MM-yyyy", + MediaSize.ISO.A4), + new Language ("Nederlands", + AD_Language_nl_NL, new Locale("nl","NL"), new Boolean(false), "dd-MM-yyyy", + MediaSize.ISO.A4), + new Language ("Norsk", + AD_Language_no_NO, new Locale("no","NO"), new Boolean(false), "dd/MM/yyyy", + MediaSize.ISO.A4), + new Language ("Polski", + AD_Language_pl_PL, new Locale("pl","PL"), new Boolean(false), "dd-MM-yyyy", + MediaSize.ISO.A4), + new Language ("Portuguese (BR)", + AD_Language_pt_BR, new Locale("pt","BR"), new Boolean(false), "dd/MM/yyyy", + MediaSize.ISO.A4), + new Language ("Rom\u00e2n\u0103", + AD_Language_ro_RO, new Locale("ro","RO"), new Boolean(false), "dd.MM.yyyy", + MediaSize.ISO.A4), + new Language ("\u0420\u0443\u0441\u0441\u043a\u0438\u0439 (Russian)", + AD_Language_ru_RU, new Locale("ru","RU"), new Boolean(false), "dd-MM-yyyy", + MediaSize.ISO.A4), + new Language ("Slovenski", + AD_Language_sl_SI, new Locale("sl", "SI"), null, "dd.MM.yyyy", + MediaSize.ISO.A4), + new Language ("Svenska", + AD_Language_sv_SE, new Locale("sv","SE"), new Boolean(false), "dd.MM.yyyy", + MediaSize.ISO.A4), + new Language ("\u0e44\u0e17\u0e22 (TH)", + AD_Language_th_TH, new Locale("th","TH"), new Boolean(false), "dd/MM/yyyy", + MediaSize.ISO.A4), + new Language ("Vi\u1EC7t Nam", + AD_Language_vi_VN, new Locale("vi","VN"), new Boolean(false), "dd-MM-yyyy", + MediaSize.ISO.A4), + // Need to have (Windows) Asian Language Pack installed to view properly + new Language ("\u7b80\u4f53\u4e2d\u6587 (CN)", + AD_Language_zh_CN, Locale.CHINA, null, "yyyy-MM-dd", + MediaSize.ISO.A4), + new Language ("\u7e41\u9ad4\u4e2d\u6587 (TW)", + AD_Language_zh_TW, Locale.TAIWAN, null, null, // dd.MM.yy + MediaSize.ISO.A4) + + }; + /** Default Language */ + private static Language s_loginLanguage = s_languages[0]; + + /** Logger */ + private static Logger log = Logger.getLogger(Language.class.getName()); + + /** + * Get Number of Languages + * @return Language count + */ + public static int getLanguageCount() + { + return s_languages.length; + } // getLanguageCount + + /** + * Get Language + * @param index index + * @return Language + */ + public static Language getLanguage (int index) + { + if (index < 0 || index >= s_languages.length) + return s_loginLanguage; + return s_languages[index]; + } // getLanguage + + /** + * Add Language to supported Languages + * @param language new language + */ + public static void addLanguage (Language language) + { + if (language == null) + return; + ArrayList list = new ArrayList(Arrays.asList(s_languages)); + list.add(language); + s_languages = new Language[list.size()]; + list.toArray(s_languages); + } // addLanguage + + /************************************************************************** + * Get Language. + * If language does not exist, create it on the fly assuming taht it is valid + * @param langInfo either language (en) or locale (en-US) or display name + * @return Name (e.g. Deutsch) + */ + public static Language getLanguage (String langInfo) + { + String lang = langInfo; + if (lang == null || lang.length() == 0) + lang = System.getProperty("user.language", ""); + + // Search existing Languages + for (int i = 0; i < s_languages.length; i++) + { + if (lang.equals(s_languages[i].getName()) + || lang.equals(s_languages[i].getLanguageCode()) + || lang.equals(s_languages[i].getAD_Language())) + return s_languages[i]; + } + + // Create Language on the fly + if (lang.length() == 5) // standard format _ + { + String language = lang.substring(0,2); + String country = lang.substring(3); + Locale locale = new Locale(language, country); + log.info ("Adding Language=" + language + ", Country=" + country + ", Locale=" + locale); + Language ll = new Language (lang, lang, locale); + // Add to Languages + ArrayList list = new ArrayList(Arrays.asList(s_languages)); + list.add(ll); + s_languages = new Language [list.size()]; + list.toArray(s_languages); + // Return Language + return ll; + } + // Get the default one + return s_loginLanguage; + } // getLanguage + + /** + * Is it the base language + * @param langInfo either language (en) or locale (en-US) or display name + * @return true if base language + */ + public static boolean isBaseLanguage (String langInfo) + { + if (langInfo == null || langInfo.length() == 0 + || langInfo.equals(s_languages[0].getName()) + || langInfo.equals(s_languages[0].getLanguageCode()) + || langInfo.equals(s_languages[0].getAD_Language())) + return true; + return false; + } // isBaseLanguage + + /** + * Get Base Language + * @return Base Language + */ + public static Language getBaseLanguage() + { + return s_languages[0]; + } // getBase + + /** + * Get Base Language code. (e.g. en-US) + * @return Base Language + */ + public static String getBaseAD_Language() + { + return s_languages[0].getAD_Language(); + } // getBase + + /** + * Get Supported Locale + * @param langInfo either language (en) or locale (en-US) or display name + * @return Supported Locale + */ + public static Locale getLocale (String langInfo) + { + return getLanguage(langInfo).getLocale(); + } // getLocale + + /** + * Get Supported Language + * @param langInfo either language (en) or locale (en-US) or display name + * @return AD_Language (e.g. en-US) + */ + public static String getAD_Language (String langInfo) + { + return getLanguage(langInfo).getAD_Language(); + } // getAD_Language + + /** + * Get Supported Language + * @param locale Locale + * @return AD_Language (e.g. en-US) + */ + public static String getAD_Language (Locale locale) + { + if (locale != null) + { + for (int i = 0; i < s_languages.length; i++) + { + if (locale.equals(s_languages[i].getLocale())) + return s_languages[i].getAD_Language(); + } + } + return s_loginLanguage.getAD_Language(); + } // getLocale + + /** + * Get Language Name + * @param langInfo either language (en) or locale (en-US) or display name + * @return Langauge Name (e.g. English) + */ + public static String getName (String langInfo) + { + return getLanguage(langInfo).getName(); + } // getAD_Language + + /** + * Returns true if Decimal Point (not comma) + * @param langInfo either language (en) or locale (en-US) or display name + * @return use of decimal point + */ + public static boolean isDecimalPoint(String langInfo) + { + return getLanguage(langInfo).isDecimalPoint(); + } // getAD_Language + + /** + * Get Display names of supported languages + * @return Array of Language names + */ + public static String[] getNames() + { + String[] retValue = new String[s_languages.length]; + for (int i = 0; i < s_languages.length; i++) + retValue[i] = s_languages[i].getName(); + return retValue; + } // getNames + + + /************************************************************************** + * Get Default Login Language + * @return default Language + */ + public static Language getLoginLanguage () + { + return s_loginLanguage; + } // getLanguage + + /** + * Set Default Login Language + * @param language language + */ + public static void setLoginLanguage (Language language) + { + if (language != null) + { + s_loginLanguage = language; + log.config(s_loginLanguage.toString()); + } + } // setLanguage + + + /************************************************************************** + * Define Language + * @param name - displayed value, e.g. English + * @param AD_Language - the code of system supported langauge, e.g. en_US + * (might be different than Locale - i.e. if the system does not support the language) + * @param locale - the Locale, e.g. Locale.US + * @param decimalPoint true if Decimal Point - if null, derived from Locale + * @param javaDatePattern Java date pattern as not all locales are defined - if null, derived from Locale + * @param mediaSize default media size + */ + public Language (String name, String AD_Language, Locale locale, + Boolean decimalPoint, String javaDatePattern, MediaSize mediaSize) + { + if (name == null || AD_Language == null || locale == null) + throw new IllegalArgumentException ("Language - parameter is null"); + m_name = name; + m_AD_Language = AD_Language; + m_locale = locale; + // + m_decimalPoint = decimalPoint; + setDateFormat (javaDatePattern); + setMediaSize (mediaSize); + } // Language + + /** + * Define Language with A4 and default decimal point and date format + * @param name - displayed value, e.g. English + * @param AD_Language - the code of system supported langauge, e.g. en_US + * (might be different than Locale - i.e. if the system does not support the language) + * @param locale - the Locale, e.g. Locale.US + */ + public Language (String name, String AD_Language, Locale locale) + { + this (name, AD_Language, locale, null, null, null); + } // Language + + + /** Name */ + private String m_name; + /** Language (key) */ + private String m_AD_Language; + /** Locale */ + private Locale m_locale; + // + private Boolean m_decimalPoint; + private Boolean m_leftToRight; + private SimpleDateFormat m_dateFormat; + private MediaSize m_mediaSize = MediaSize.ISO.A4; + + /** + * Get Language Name. + * e.g. English + * @return name + */ + public String getName() + { + return m_name; + } // getName + + /** + * Get Application Dictionary Language (system supported). + * e.g. en-US + * @return AD_Language + */ + public String getAD_Language() + { + return m_AD_Language; + } // getAD_Language + + /** + * Set Application Dictionary Language (system supported). + * @param AD_Language e.g. en-US + */ + public void setAD_Language (String AD_Language) + { + if (AD_Language != null) + { + m_AD_Language = AD_Language; + log.config(toString()); + } + } // getAD_Language + + /** + * Get Locale + * @return locale + */ + public Locale getLocale() + { + return m_locale; + } // getLocale + + /** + * Overwrite Locale + * @param locale locale + */ + public void setLocale (Locale locale) + { + if (locale == null) + return; + m_locale = locale; + m_decimalPoint = null; // reset + } // getLocale + + /** + * Get Language Code. + * e.g. en - derived from Locale + * @return language code + */ + public String getLanguageCode() + { + return m_locale.getLanguage(); + } // getLanguageCode + + /** + * Component orientation is Left To Right + * @return true if left-to-right + */ + public boolean isLeftToRight() + { + if (m_leftToRight == null) + // returns true if language not iw, ar, fa, ur + m_leftToRight = new Boolean(ComponentOrientation.getOrientation(m_locale).isLeftToRight()); + return m_leftToRight.booleanValue(); + } // isLeftToRight + + /** + * Returns true if Decimal Point (not comma) + * @return use of decimal point + */ + public boolean isDecimalPoint() + { + if (m_decimalPoint == null) + { + DecimalFormatSymbols dfs = new DecimalFormatSymbols(m_locale); + m_decimalPoint = new Boolean(dfs.getDecimalSeparator() == '.'); + } + return m_decimalPoint.booleanValue(); + } // isDecimalPoint + + /** + * Is This the Base Language + * @return true if base Language + */ + public boolean isBaseLanguage() + { + return this.equals(getBaseLanguage()); + } // isBaseLanguage + + /** + * Set Date Pattern. + * The date format is not checked for correctness + * @param javaDatePattern for details see java.text.SimpleDateFormat, + * format must be able to be converted to database date format by + * using the upper case function. + * It also must have leading zero for day and month. + */ + public void setDateFormat (String javaDatePattern) + { + if (javaDatePattern == null) + return; + m_dateFormat = (SimpleDateFormat)DateFormat.getDateInstance + (DateFormat.SHORT, m_locale); + try + { + m_dateFormat.applyPattern(javaDatePattern); + } + catch (Exception e) + { + log.severe(javaDatePattern + " - " + e); + m_dateFormat = null; + } + } // setDateFormat + + /** + * Get (Short) Date Format. + * The date format must parseable by org.compiere.grid.ed.MDocDate + * i.e. leading zero for date and month + * @return date format MM/dd/yyyy - dd.MM.yyyy + */ + public SimpleDateFormat getDateFormat() + { + if (m_dateFormat == null) + { + m_dateFormat = (SimpleDateFormat)DateFormat.getDateInstance + (DateFormat.SHORT, m_locale); + String sFormat = m_dateFormat.toPattern(); + // some short formats have only one M and d (e.g. ths US) + if (sFormat.indexOf("MM") == -1 && sFormat.indexOf("dd") == -1) + { + String nFormat = ""; + for (int i = 0; i < sFormat.length(); i++) + { + if (sFormat.charAt(i) == 'M') + nFormat += "MM"; + else if (sFormat.charAt(i) == 'd') + nFormat += "dd"; + else + nFormat += sFormat.charAt(i); + } + // log.finer(sFormat + " => " + nFormat); + m_dateFormat.applyPattern(nFormat); + } + // Unknown short format => use JDBC + if (m_dateFormat.toPattern().length() != 8) + m_dateFormat.applyPattern("yyyy-MM-dd"); + + // 4 digit year + if (m_dateFormat.toPattern().indexOf("yyyy") == -1) + { + sFormat = m_dateFormat.toPattern(); + String nFormat = ""; + for (int i = 0; i < sFormat.length(); i++) + { + if (sFormat.charAt(i) == 'y') + nFormat += "yy"; + else + nFormat += sFormat.charAt(i); + } + m_dateFormat.applyPattern(nFormat); + } + m_dateFormat.setLenient(true); + } + return m_dateFormat; + } // getDateFormat + + /** + * Get Date Time Format. + * Used for Display only + * @return Date Time format MMM d, yyyy h:mm:ss a z -or- dd.MM.yyyy HH:mm:ss z + * -or- j nnn aaaa, H' ?????? 'm' ????' + */ + public SimpleDateFormat getDateTimeFormat() + { + SimpleDateFormat retValue = (SimpleDateFormat)DateFormat.getDateTimeInstance + (DateFormat.MEDIUM, DateFormat.LONG, m_locale); + // log.finer("Pattern=" + retValue.toLocalizedPattern() + ", Loc=" + retValue.toLocalizedPattern()); + return retValue; + } // getDateTimeFormat + + /** + * Get Time Format. + * Used for Display only + * @return Time format h:mm:ss z or HH:mm:ss z + */ + public SimpleDateFormat getTimeFormat() + { + return (SimpleDateFormat)DateFormat.getTimeInstance + (DateFormat.LONG, m_locale); + } // getTimeFormat + + /** + * Get Database Date Pattern. + * Derive from date pattern (make upper case) + * @return date pattern + */ + public String getDBdatePattern() + { + return getDateFormat().toPattern().toUpperCase(m_locale); + } // getDBdatePattern + + /** + * Get default MediaSize + * @return media size + */ + public MediaSize getMediaSize() + { + return m_mediaSize; + } // getMediaSize + + /** + * Set default MediaSize + * @param size media size + */ + public void setMediaSize (MediaSize size) + { + if (size != null) + m_mediaSize = size; + } // setMediaSize + + /** + * String Representation + * @return string representation + */ + public String toString() + { + StringBuffer sb = new StringBuffer("Language=["); + sb.append(m_name).append(",Locale=").append(m_locale.toString()) + .append(",AD_Language=").append(m_AD_Language) + .append(",DatePattern=").append(getDBdatePattern()) + .append(",DecimalPoint=").append(isDecimalPoint()) + .append("]"); + return sb.toString(); + } // toString + + /** + * Hash Code + * @return hashcode + */ + public int hashCode() + { + return m_AD_Language.hashCode(); + } // hashcode + + /** + * Equals. + * Two languages are equal, if they have the same AD_Language + * @param obj compare + * @return true if AD_Language is the same + */ + public boolean equals(Object obj) + { + if (obj instanceof Language) + { + Language cmp = (Language)obj; + if (cmp.getAD_Language().equals(m_AD_Language)) + return true; + } + return false; + } // equals + + + /************************************************************************** + * Test + * @param args ignored + */ + public static void main(String[] args) + { + System.out.println(Locale.TRADITIONAL_CHINESE); + System.out.println(Locale.TAIWAN); + System.out.println(Locale.SIMPLIFIED_CHINESE); + System.out.println(Locale.CHINESE); + System.out.println(Locale.PRC); + } + +} // Language diff --git a/looks/src/org/compiere/util/MSort.java b/looks/src/org/compiere/util/MSort.java new file mode 100644 index 0000000000..c0061d1c84 --- /dev/null +++ b/looks/src/org/compiere/util/MSort.java @@ -0,0 +1,157 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Comparator; + +/** + * Class to Sort Data + * + * @author Jorg Janke + * @version $Id: MSort.java,v 1.3 2006/10/06 00:43:09 jjanke Exp $ + */ +public final class MSort implements Comparator, Serializable +{ + /** + * Constructor - Sort Entity + * @param new_index index + * @param new_data data + */ + public MSort (int new_index, Object new_data) + { + index = new_index; + data = new_data; + } // MSort + + /** Direct access index */ + public int index; + /** The data */ + public Object data; + + /** Multiplier */ + private int m_multiplier = 1; // Asc by default + + /** + * Sort Ascending + * @param ascending if true sort ascending + */ + public void setSortAsc (boolean ascending) + { + if (ascending) + m_multiplier = 1; + else + m_multiplier = -1; + } // setSortAsc + + + /************************************************************************** + * Compare Data of two entities + * @param o1 object + * @param o2 object + * @return comparator + */ + public int compare (Object o1, Object o2) + { + // Get Objects to compare + Object cmp1 = null; + if (o1 instanceof MSort) + cmp1 = ((MSort)o1).data; + if (cmp1 instanceof NamePair) + cmp1 = ((NamePair)cmp1).getName(); + + Object cmp2 = o2; + if (o2 instanceof MSort) + cmp2 = ((MSort)o2).data; + if (cmp2 instanceof NamePair) + cmp2 = ((NamePair)cmp2).getName(); + + // Comparing Null values + if (cmp1 == null) + { + if (cmp2 == null) + return 0; + return -1; + } + if (cmp2 == null) + return 1; + + /** + * compare different data types + */ + + // String + if (cmp1 instanceof String && cmp2 instanceof String) + { + String s = (String)cmp1; + return s.compareTo((String)cmp2) * m_multiplier; + } + // Date + else if (cmp1 instanceof Timestamp && cmp2 instanceof Timestamp) + { + Timestamp t = (Timestamp)cmp1; + return t.compareTo((Timestamp)cmp2) * m_multiplier; + } + // BigDecimal + else if (cmp1 instanceof BigDecimal && cmp2 instanceof BigDecimal) + { + BigDecimal d = (BigDecimal)cmp1; + return d.compareTo((BigDecimal)cmp2) * m_multiplier; + } + // Integer + else if (cmp1 instanceof Integer && cmp2 instanceof Integer) + { + Integer d = (Integer)cmp1; + return d.compareTo((Integer)cmp2) * m_multiplier; + } + + // Convert to string value + String s = cmp1.toString(); + return s.compareTo(cmp2.toString()) * m_multiplier; + } // compare + + /** + * Equal (based on data, ignores index) + * @param obj object + * @return true if equal + */ + public boolean equals (Object obj) + { + if (obj instanceof MSort) + { + MSort ms = (MSort)obj; + if (data == ms.data) + return true; + } + return false; + } // equals + + /** + * String Representation + * @return info + */ + public String toString() + { + StringBuffer sb = new StringBuffer("MSort["); + sb.append("Index=").append(index).append(",Data=").append(data); + sb.append("]"); + return sb.toString(); + } // toString + +} // MSort diff --git a/looks/src/org/compiere/util/MiniBrowser.java b/looks/src/org/compiere/util/MiniBrowser.java new file mode 100644 index 0000000000..3f4b17b7d4 --- /dev/null +++ b/looks/src/org/compiere/util/MiniBrowser.java @@ -0,0 +1,112 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.net.URL; + +import javax.swing.JDialog; +import javax.swing.JEditorPane; +import javax.swing.JScrollPane; + +import org.compiere.plaf.AdempierePLAF; + +/** + * Mini Browser + * + * @author Jorg Janke + * @version $Id: MiniBrowser.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class MiniBrowser extends JDialog +{ + /** + * Default Constructor + */ + public MiniBrowser() + { + this (null); + } // MiniBrowser + + /** + * Create MiniBrowser with URL + * @param url + */ + public MiniBrowser(String url) + { + this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + try + { + jbInit(); + } + catch(Exception e) + { + e.printStackTrace(); + } + setURL (url); + AdempierePLAF.showCenterScreen(this); + } // MiniBrowser + + private JScrollPane scrollPane = new JScrollPane(); + private JEditorPane editorPane = new JEditorPane(); + + /** + * Static Init + * @throws Exception + */ + private void jbInit() throws Exception + { + scrollPane.setPreferredSize(new Dimension(500, 500)); + this.getContentPane().add(scrollPane, BorderLayout.CENTER); + scrollPane.getViewport().add(editorPane, null); + } // jbInit + + /** + * Set URL + * @param url + */ + private void setURL (String url) + { + String myURL = url; + if (url == null) + myURL = "http://www.adempiere.org"; + this.setTitle(myURL); + + // Set URL + URL realURL = null; + try + { + realURL = new URL(myURL); + } + catch (Exception e) + { + System.err.println("MiniBrowser.setURL (set) - " + e.toString()); + } + if (realURL == null) + return; + + // Open + try + { + editorPane.setPage(realURL); + } + catch (Exception e) + { + System.err.println("MiniBrowser.setURL (open) - " + e.toString()); + } + } // setURL +} // MiniBrowser diff --git a/looks/src/org/compiere/util/NamePair.java b/looks/src/org/compiere/util/NamePair.java new file mode 100644 index 0000000000..6547d12ba8 --- /dev/null +++ b/looks/src/org/compiere/util/NamePair.java @@ -0,0 +1,127 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.io.Serializable; +import java.util.Comparator; + +/** + * Name Pair Interface + * + * @author Jorg Janke + * @version $Id: NamePair.java,v 1.3 2006/07/30 00:52:23 jjanke Exp $ + */ +public abstract class NamePair implements Comparator, Serializable, Comparable +{ + /** + * Protected Constructor + * @param name (Display) Name of the Pair + */ + protected NamePair (String name) + { + m_name = name; + if (m_name == null) + m_name = ""; + } // NamePair + + /** The Name */ + private String m_name; + + /** + * Returns display value + * @return name + */ + public String getName() + { + return m_name; + } // getName + + /** + * Returns Key or Value as String + * @return String or null + */ + public abstract String getID(); + + /** + * Comparator Interface (based on toString value) + * @param o1 Object 1 + * @param o2 Object 2 + * @return compareTo value + */ + public int compare (Object o1, Object o2) + { + String s1 = o1 == null ? "" : o1.toString(); + String s2 = o2 == null ? "" : o2.toString(); + return s1.compareTo (s2); // sort order ?? + } // compare + + /** + * Comparator Interface (based on toString value) + * @param o1 Object 1 + * @param o2 Object 2 + * @return compareTo value + */ + public int compare (NamePair o1, NamePair o2) + { + String s1 = o1 == null ? "" : o1.toString(); + String s2 = o2 == null ? "" : o2.toString(); + return s1.compareTo (s2); // sort order ?? + } // compare + + /** + * Comparable Interface (based on toString value) + * @param o the Object to be compared. + * @return a negative integer, zero, or a positive integer as this object + * is less than, equal to, or greater than the specified object. + */ + public int compareTo (Object o) + { + return compare (this, o); + } // compareTo + + /** + * Comparable Interface (based on toString value) + * @param o the Object to be compared. + * @return a negative integer, zero, or a positive integer as this object + * is less than, equal to, or greater than the specified object. + */ + public int compareTo (NamePair o) + { + return compare (this, o); + } // compareTo + + /** + * To String - returns name + * @return Name + */ + public String toString() + { + return m_name; + } // toString + + /** + * To String - detail + * @return String in format ID=Name + */ + public String toStringX() + { + StringBuffer sb = new StringBuffer (getID()); + sb.append("=").append(m_name); + return sb.toString(); + } // toStringX + +} // NamePair diff --git a/looks/src/org/compiere/util/Secure.java b/looks/src/org/compiere/util/Secure.java new file mode 100644 index 0000000000..29763b37e4 --- /dev/null +++ b/looks/src/org/compiere/util/Secure.java @@ -0,0 +1,379 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.math.*; +import java.security.*; +import java.sql.Timestamp; +import java.util.logging.*; +import javax.crypto.*; + +/** + * Security Services. + * + * @author Jorg Janke + * @version $Id: Secure.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class Secure implements SecureInterface +{ + /************************************************************************** + * Hash checksum number + * @param key key + * @return checksum number + */ + public static int hash (String key) + { + long tableSize = 2147483647; // one less than max int + long hashValue = 0; + + for (int i = 0; i < key.length(); i++) + hashValue = (37 * hashValue) + (key.charAt(i) -31); + + hashValue %= tableSize; + if (hashValue < 0) + hashValue += tableSize; + + int retValue = (int)hashValue; + return retValue; + } // hash + + + /************************************************************************** + * Convert Byte Array to Hex String + * @param bytes bytes + * @return HexString + */ + public static String convertToHexString (byte[] bytes) + { + // see also Util.toHex + int size = bytes.length; + StringBuffer buffer = new StringBuffer(size*2); + for(int i=0; i " + encString); + return encString; + } + catch (Exception ex) + { + log.log(Level.INFO, value, ex); + } + } + // Fallback + return CLEARVALUE_START + value + CLEARVALUE_END; + } // encrypt + + /** + * Decryption. + * The methods must recognize clear text values + * @param value encrypted value + * @return decrypted String + */ + public String decrypt (String value) + { + if (value == null || value.length() == 0) + return value; + boolean isEncrypted = value.startsWith(ENCRYPTEDVALUE_START) && value.endsWith(ENCRYPTEDVALUE_END); + if (isEncrypted) + value = value.substring(ENCRYPTEDVALUE_START.length(), value.length()-ENCRYPTEDVALUE_END.length()); + // Needs to be hex String + byte[] data = convertHexString(value); + if (data == null) // cannot decrypt + { + if (isEncrypted) + { + log.info("Failed: " + value); + return null; + } + // assume not encrypted + return value; + } + // Init + if (m_cipher == null) + initCipher(); + + // Encrypt + if (m_cipher != null && value != null && value.length() > 0) + { + try + { + AlgorithmParameters ap = m_cipher.getParameters(); + m_cipher.init(Cipher.DECRYPT_MODE, m_key, ap); + byte[] out = m_cipher.doFinal(data); + String retValue = new String(out); + // globalqss - [ 1577737 ] Security Breach - show database password + // log.log (Level.ALL, value + " => " + retValue); + return retValue; + } + catch (Exception ex) + { + log.info("Failed: " + value + " - " + ex.toString()); + } + } + return null; + } // decrypt + + /** + * Encryption. + * The methods must recognize clear text values + * @param value clear value + * @return encrypted String + */ + public Integer encrypt (Integer value) + { + return value; + } // encrypt + + /** + * Decryption. + * The methods must recognize clear text values + * @param value encrypted value + * @return decrypted String + */ + public Integer decrypt (Integer value) + { + return value; + } // decrypt + + /** + * Encryption. + * The methods must recognize clear text values + * @param value clear value + * @return encrypted String + */ + public BigDecimal encrypt (BigDecimal value) + { + return value; + } // encrypt + + /** + * Decryption. + * The methods must recognize clear text values + * @param value encrypted value + * @return decrypted String + */ + public BigDecimal decrypt (BigDecimal value) + { + return value; + } // decrypt + + /** + * Encryption. + * The methods must recognize clear text values + * @param value clear value + * @return encrypted String + */ + public Timestamp encrypt (Timestamp value) + { + return value; + } // encrypt + + /** + * Decryption. + * The methods must recognize clear text values + * @param value encrypted value + * @return decrypted String + */ + public Timestamp decrypt (Timestamp value) + { + return value; + } // decrypt + + + /** + * Convert String to Digest. + * JavaScript version see - http://pajhome.org.uk/crypt/md5/index.html + * + * @param value message + * @return HexString of message (length = 32 characters) + */ + public String getDigest (String value) + { + if (m_md == null) + { + try + { + m_md = MessageDigest.getInstance("MD5"); + // m_md = MessageDigest.getInstance("SHA-1"); + } + catch (NoSuchAlgorithmException nsae) + { + nsae.printStackTrace(); + } + } + // Reset MessageDigest object + m_md.reset(); + // Convert String to array of bytes + byte[] input = value.getBytes(); + // feed this array of bytes to the MessageDigest object + m_md.update(input); + // Get the resulting bytes after the encryption process + byte[] output = m_md.digest(); + m_md.reset(); + // + return convertToHexString(output); + } // getDigest + + + /** + * Checks, if value is a valid digest + * @param value digest string + * @return true if valid digest + */ + public boolean isDigest (String value) + { + if (value == null || value.length() != 32) + return false; + // needs to be a hex string, so try to convert it + return (convertHexString(value) != null); + } // isDigest + + /** + * String Representation + * @return info + */ + public String toString () + { + StringBuffer sb = new StringBuffer ("Secure["); + sb.append(m_cipher) + .append ("]"); + return sb.toString (); + } // toString + +} // Secure diff --git a/looks/src/org/compiere/util/SecureEngine.java b/looks/src/org/compiere/util/SecureEngine.java new file mode 100644 index 0000000000..da5e242dfd --- /dev/null +++ b/looks/src/org/compiere/util/SecureEngine.java @@ -0,0 +1,312 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.*; +import java.util.logging.*; + +/** + * Security Engine + * + * @author Jorg Janke + * @version $Id: SecureEngine.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class SecureEngine +{ + /** + * Initialize Security + * @param ctx context with ADEMPIERE_SECURE class name + */ + public static void init (Properties ctx) + { + if (s_engine == null) + { + String className = ctx.getProperty(SecureInterface.ADEMPIERE_SECURE); + s_engine = new SecureEngine(className); + } + } // init + + /** + * Initialize/Test Security + * @param className class name + */ + public static void init (String className) + { + if (s_engine == null) + s_engine = new SecureEngine(className); + else if (className != null && !className.equals(getClassName())) + { + String msg = "Requested Security class = " + className + + " is not the same as the active class = " + getClassName() + + "\nMake sure to set the security class in the start script"; + log.severe(msg); + System.err.println(msg); + System.exit(10); + } + } // init + + /** + * Get Class Name + * @return class name + */ + public static String getClassName() + { + if (s_engine == null) + return null; + return s_engine.implementation.getClass().getName(); + } // getClassName + + /** + * Convert String to Digest. + * JavaScript version see - http://pajhome.org.uk/crypt/md5/index.html + * + * @param value message + * @return HexString of message (length = 32 characters) + */ + public static String getDigest (String value) + { + if (s_engine == null) + init(System.getProperties()); + return s_engine.implementation.getDigest(value); + } // getDigest + + /** + * Encryption. + * The methods must recognize clear text values + * @param value clear value + * @return encrypted String + */ + public static String encrypt (String value) + { + if (value == null || value.length() == 0) + return value; + if (s_engine == null) + init(System.getProperties()); + // + boolean inQuotes = value.startsWith("'") && value.endsWith("'"); + if (inQuotes) + value = value.substring(1, value.length()-1); + // + String retValue = s_engine.implementation.encrypt(value); + if (inQuotes) + return "'" + retValue + "'"; + return retValue; + } // encrypt + + /** + * Decryption. + * The methods must recognize clear text values + * @param value encrypted value + * @return decrypted String + */ + public static String decrypt (String value) + { + if (value == null) + return null; + if (s_engine == null) + init(System.getProperties()); + boolean inQuotes = value.startsWith("'") && value.endsWith("'"); + if (inQuotes) + value = value.substring(1, value.length()-1); + String retValue = null; + if (value.startsWith(SecureInterface.CLEARVALUE_START) && value.endsWith(SecureInterface.CLEARVALUE_END)) + retValue = value.substring(SecureInterface.CLEARVALUE_START.length(), value.length()-SecureInterface.CLEARVALUE_END.length()); + else + retValue = s_engine.implementation.decrypt(value); + if (inQuotes) + return "'" + retValue + "'"; + return retValue; + } // decrypt + + /** + * Encryption. + * The methods must recognize clear values + * @param value clear value + * @return encrypted String + */ + public static Object encrypt (Object value) + { + return value; + } // encrypt + + /** + * Decryption. + * The methods must recognize clear values + * @param value encrypted value + * @return decrypted String + */ + public static Object decrypt (Object value) + { + return value; + } // decrypt + + /** + * SecureEngine constructor + * @param className class name if null defaults to org.compiere.util.Secure + */ + private SecureEngine (String className) + { + String realClass = className; + if (realClass == null || realClass.length() == 0) + realClass = SecureInterface.ADEMPIERE_SECURE_DEFAULT; + Exception cause = null; + try + { + Class clazz = Class.forName(realClass); + implementation = (SecureInterface)clazz.newInstance(); + } + catch (Exception e) + { + cause = e; + } + if (implementation == null) + { + String msg = "Could not initialize: " + realClass + " - " + cause.toString() + + "\nCheck start script parameter ADEMPIERE_SECURE"; + log.severe(msg); + System.err.println(msg); + System.exit(10); + } + // See if it works + String testE = implementation.encrypt(TEST); + String testC = implementation.decrypt(testE); + if (!testC.equals(TEST)) + throw new IllegalStateException(realClass + + ": " + TEST + + "->" + testE + "->" + testC); + log.config (realClass + " initialized - " + implementation); + } // SecureEngine + + + /** Test String */ + private static final String TEST = "This is a 0123456789 .,; -= Test!"; + /** Secure Engine */ + private static SecureEngine s_engine = null; + + /** The real Engine */ + private SecureInterface implementation = null; + /** Logger */ + private static Logger log = Logger.getLogger (SecureEngine.class.getName()); + + + /** + * Test output + * @param test test value + * @param should target value + * @return info + */ + private static String test (Object test, Object should) + { + StringBuffer sb = new StringBuffer (); + sb.append(test); + if (test == null) + { + if (should == null) + sb.append(" - ok"); + else + sb.append(" [Should=").append(should).append("] - ERROR"); + } + else + { + if (test.equals(should)) + sb.append(" - ok"); + else + sb.append(" [Should=").append(should).append("] - ERROR"); + } + return sb.toString(); + } // test + + /************************************************************************** + * main + * @param args + */ + public static void main (String[] args) + { + init (System.getProperties()); + // Ini Test + String ini1 = SecureInterface.CLEARVALUE_START + "test" + SecureInterface.CLEARVALUE_END; + /** + log.info("Decrypt clear test =" + test(decrypt(ini1), "test")); + log.info("Decrypt clear 'test' =" + test(decrypt("'" + ini1 + "'"), "'test'")); + log.info("Decrypt '' =" + test(decrypt("''"), "''")); + log.info("Decrypt =" + test(decrypt(""), "")); + log.info("Decrypt null =" + test(decrypt(null), null)); + log.info("Decrypt test =" + test(decrypt("test"), "test")); + **/ + log.info("Decrypt {test} =" + test(decrypt("af2309f390afed74"), "test")); + log.info("Decrypt ~{test}~ =" + test(decrypt(SecureInterface.ENCRYPTEDVALUE_START + "af2309f390afed74" + SecureInterface.ENCRYPTEDVALUE_END), "test")); + + log.info("Encrypt test =" + test(encrypt("test"), "af2309f390afed74")); + + + + /** + + String[] testString = new String[] {"This is a test!", "", + "This is a verly long test string 1624$%"}; + String[] digestResult = new String[] { + "702edca0b2181c15d457eacac39de39b", + "d41d8cd98f00b204e9800998ecf8427e", + "934e7c5c6f5508ff50bc425770a10f45"}; + for (int i = 0; i < testString.length; i++) + { + String digestString = getDigest (testString[i]); + if (digestResult[i].equals (digestString)) + log.info ("OK - digest"); + else + log + .severe ("Digest=" + digestString + " <> " + + digestResult[i]); + } + log.info ("IsDigest true=" + isDigest (digestResult[0])); + log.info ("IsDigest false=" + + isDigest ("702edca0b2181c15d457eacac39DE39J")); + log.info ("IsDigest false=" + isDigest ("702e")); + // ----------------------------------------------------------------------- + // log.info(convertToHexString(new byte[]{Byte.MIN_VALUE, -1, 1, Byte.MAX_VALUE} )); + // + String in = "4115da655707807F00FF"; + byte[] bb = convertHexString (in); + String out = convertToHexString (bb); + if (in.equalsIgnoreCase (out)) + log.info ("OK - conversion"); + else + log.severe ("Conversion Error " + in + " <> " + out); + // ----------------------------------------------------------------------- + String test = "This is a test!!"; + String result = "28bd14203bcefba1c5eaef976e44f1746dc2facaa9e0623c"; + // + String test_1 = decrypt (result); + if (test.equals (test_1)) + log.info ("OK - dec_1"); + else + log.info ("TestDec=" + test_1 + " <> " + test); + // ----------------------------------------------------------------------- + String testEnc = encrypt (test); + if (result.equals (testEnc)) + log.info ("OK - enc"); + else + log.severe ("TestEnc=" + testEnc + " <> " + result); + String testDec = decrypt (testEnc); + if (test.equals (testDec)) + log.info ("OK - dec"); + else + log.info ("TestDec=" + testDec + " <> " + test); + **/ + } // main + +} // SecureEngine diff --git a/looks/src/org/compiere/util/SecureInterface.java b/looks/src/org/compiere/util/SecureInterface.java new file mode 100644 index 0000000000..fefc882f87 --- /dev/null +++ b/looks/src/org/compiere/util/SecureInterface.java @@ -0,0 +1,129 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.math.*; +import java.sql.*; + +/** + * Adempiere Security Interface. + * To enable your own class, you need to set the property ADEMPIERE_SECURE + * when starting the client or server. + * The setting for the default class would be: + * -DADEMPIERE_SECURE=org.compiere.util.Secure + * + * @author Jorg Janke + * @version $Id: SecureInterface.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public interface SecureInterface +{ + /** Class Name implementing SecureInterface */ + public static final String ADEMPIERE_SECURE = "ADEMPIERE_SECURE"; + /** Default Class Name implementing SecureInterface */ + public static final String ADEMPIERE_SECURE_DEFAULT = "org.compiere.util.Secure"; + + + /** Clear Text Indicator xyz */ + public static final String CLEARVALUE_START = "xyz"; + /** Clear Text Indicator */ + public static final String CLEARVALUE_END = ""; + /** Encrypted Text Indiactor ~ */ + public static final String ENCRYPTEDVALUE_START = "~"; + /** Encrypted Text Indiactor ~ */ + public static final String ENCRYPTEDVALUE_END = "~"; + + + /** + * Encryption. + * @param value clear value + * @return encrypted String + */ + public String encrypt (String value); + + /** + * Decryption. + * @param value encrypted value + * @return decrypted String + */ + public String decrypt (String value); + + /** + * Encryption. + * The methods must recognize clear text values + * @param value clear value + * @return encrypted String + */ + public Integer encrypt (Integer value); + + /** + * Decryption. + * The methods must recognize clear text values + * @param value encrypted value + * @return decrypted String + */ + public Integer decrypt (Integer value); + + /** + * Encryption. + * The methods must recognize clear text values + * @param value clear value + * @return encrypted String + */ + public BigDecimal encrypt (BigDecimal value); + + /** + * Decryption. + * The methods must recognize clear text values + * @param value encrypted value + * @return decrypted String + */ + public BigDecimal decrypt (BigDecimal value); + + /** + * Encryption. + * The methods must recognize clear text values + * @param value clear value + * @return encrypted String + */ + public Timestamp encrypt (Timestamp value); + + /** + * Decryption. + * The methods must recognize clear text values + * @param value encrypted value + * @return decrypted String + */ + public Timestamp decrypt (Timestamp value); + + + /** + * Convert String to Digest. + * JavaScript version see - http://pajhome.org.uk/crypt/md5/index.html + * + * @param value message + * @return HexString of message (length = 32 characters) + */ + public String getDigest (String value); + + /** + * Checks, if value is a valid digest + * @param value digest string + * @return true if valid digest + */ + public boolean isDigest (String value); + +} // SecureInterface diff --git a/looks/src/org/compiere/util/Trace.java b/looks/src/org/compiere/util/Trace.java new file mode 100644 index 0000000000..db01bffb93 --- /dev/null +++ b/looks/src/org/compiere/util/Trace.java @@ -0,0 +1,120 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.util.*; +import java.util.logging.*; + +/** + * Trace Information + * + * @author Jorg Janke + * @version $Id: Trace.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public class Trace +{ + /** + * Get Caller Array + * + * @param caller Optional Thowable/Exception + * @param maxNestLevel maximum call nesting level - 0 is all + * @return Array of class.method(file:line) + */ + public static String[] getCallerClasses (Throwable caller, int maxNestLevel) + { + int nestLevel = maxNestLevel; + if (nestLevel < 1) + nestLevel = 99; + // + ArrayList list = new ArrayList(); + Throwable t = caller; + if (t == null) + t = new Throwable(); + + StackTraceElement[] elements = t.getStackTrace(); + for (int i = 0; i < elements.length && list.size() <= maxNestLevel; i++) + { + String className = elements[i].getClassName(); + // System.out.println(list.size() + ": " + className); + if (!(className.startsWith("org.compiere.util.Trace") + || className.startsWith("java.lang.Throwable"))) + list.add(className); + } + + String[] retValue = new String[list.size()]; + list.toArray(retValue); + return retValue; + } // getCallerClasses + + /** + * Get Caller with nest Level + * @param nestLevel Nesting Level - 0=calling method, 1=previous, .. + * @return class name and line info of nesting level or "" if not exist + */ + public static String getCallerClass (int nestLevel) + { + String[] array = getCallerClasses (null, nestLevel); + if (array.length < nestLevel) + return ""; + return array[nestLevel]; + } // getCallerClass + + /** + * Is the caller Called From the class mentioned + * @param className calling class + * @return the caller was called from className + */ + public static boolean isCalledFrom (String className) + { + if (className == null || className.length() == 0) + return false; + return getCallerClass(1).indexOf(className) != -1; + } // isCalledFrom + + /** + * Print Stack Tace Info (raw) adempiereOnly - first9only + */ + public static void printStack() + { + printStack (true, true); + } // printStack + + /** + * Print Stack Tace Info (raw) + */ + public static void printStack (boolean adempiereOnly, boolean first9only) + { + Throwable t = new Throwable(); + // t.printStackTrace(); + int counter = 0; + StackTraceElement[] elements = t.getStackTrace(); + for (int i = 1; i < elements.length; i++) + { + if (elements[i].getClassName().indexOf("util.Trace") != -1) + continue; + if (!adempiereOnly + || (adempiereOnly && elements[i].getClassName().startsWith("org.compiere")) + ) + { + Logger.global.fine(i + ": " + elements[i]); + if (first9only && ++counter > 8) + break; + } + } + } // printStack + +} // Trace diff --git a/looks/src/org/compiere/util/Util.java b/looks/src/org/compiere/util/Util.java new file mode 100644 index 0000000000..d58c51f6c8 --- /dev/null +++ b/looks/src/org/compiere/util/Util.java @@ -0,0 +1,604 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +import java.awt.*; +import java.awt.font.*; +import java.io.*; +import java.text.*; +import java.util.*; +import java.util.logging.*; + +import javax.swing.*; + +/** + * General Utilities + * + * @author Jorg Janke + * @version $Id: Util.java,v 1.3 2006/07/30 00:52:23 jjanke Exp $ + */ +public class Util +{ + /** Logger */ + private static Logger log = Logger.getLogger(Util.class.getName()); + + /** + * Replace String values. + * @param value string to be processed + * @param oldPart old part + * @param newPart replacement - can be null or "" + * @return String with replaced values + */ + public static String replace (String value, String oldPart, String newPart) + { + if (value == null || value.length() == 0 + || oldPart == null || oldPart.length() == 0) + return value; + // + int oldPartLength = oldPart.length(); + String oldValue = value; + StringBuffer retValue = new StringBuffer(); + int pos = oldValue.indexOf(oldPart); + while (pos != -1) + { + retValue.append (oldValue.substring(0, pos)); + if (newPart != null && newPart.length() > 0) + retValue.append(newPart); + oldValue = oldValue.substring(pos+oldPartLength); + pos = oldValue.indexOf(oldPart); + } + retValue.append(oldValue); + // log.fine( "Env.replace - " + value + " - Old=" + oldPart + ", New=" + newPart + ", Result=" + retValue.toString()); + return retValue.toString(); + } // replace + + /** + * Remove CR / LF from String + * @param in input + * @return cleaned string + */ + public static String removeCRLF (String in) + { + char[] inArray = in.toCharArray(); + StringBuffer out = new StringBuffer (inArray.length); + for (int i = 0; i < inArray.length; i++) + { + char c = inArray[i]; + if (c == '\n' || c == '\r') + ; + else + out.append(c); + } + return out.toString(); + } // removeCRLF + + + /** + * Mask HTML content. + * i.e. replace characters with &values; + * CR is not masked + * @param content content + * @return masked content + */ + public static String maskHTML (String content) + { + return maskHTML (content, false); + } // maskHTML + + /** + * Mask HTML content. + * i.e. replace characters with &values; + * @param content content + * @param maskCR convert CR into
+ * @return masked content + */ + public static String maskHTML (String content, boolean maskCR) + { + if (content == null || content.length() == 0 || content.equals(" ")) + return " "; + // + StringBuffer out = new StringBuffer(); + char[] chars = content.toCharArray(); + for (int i = 0; i < chars.length; i++) + { + char c = chars[i]; + switch (c) + { + case '<': + out.append ("<"); + break; + case '>': + out.append (">"); + break; + case '&': + out.append ("&"); + break; + case '"': + out.append ("""); + break; + case '\'': + out.append ("'"); + break; + case '\n': + if (maskCR) + out.append ("
"); + // + default: + int ii = (int)c; + if (ii > 255) // Write Unicode + out.append("&#").append(ii).append(";"); + else + out.append(c); + break; + } + } + return out.toString(); + } // maskHTML + + /** + * Get the number of occurances of countChar in string. + * @param string String to be searched + * @param countChar to be counted character + * @return number of occurances + */ + public static int getCount (String string, char countChar) + { + if (string == null || string.length() == 0) + return 0; + int counter = 0; + char[] array = string.toCharArray(); + for (int i = 0; i < array.length; i++) + { + if (array[i] == countChar) + counter++; + } + return counter; + } // getCount + + /** + * Is String Empty + * @param str string + * @return true if >= 1 char + */ + public static boolean isEmpty (String str) + { + return (str == null || str.length() == 0); + } // isEmpty + + /************************************************************************** + * Find index of search character in str. + * This ignores content in () and 'texts' + * @param str string + * @param search search character + * @return index or -1 if not found + */ + public static int findIndexOf (String str, char search) + { + return findIndexOf(str, search, search); + } // findIndexOf + + /** + * Find index of search characters in str. + * This ignores content in () and 'texts' + * @param str string + * @param search1 first search character + * @param search2 second search character (or) + * @return index or -1 if not found + */ + public static int findIndexOf (String str, char search1, char search2) + { + if (str == null) + return -1; + // + int endIndex = -1; + int parCount = 0; + boolean ignoringText = false; + int size = str.length(); + while (++endIndex < size) + { + char c = str.charAt(endIndex); + if (c == '\'') + ignoringText = !ignoringText; + else if (!ignoringText) + { + if (parCount == 0 && (c == search1 || c == search2)) + return endIndex; + else if (c == ')') + parCount--; + else if (c == '(') + parCount++; + } + } + return -1; + } // findIndexOf + + /** + * Find index of search character in str. + * This ignores content in () and 'texts' + * @param str string + * @param search search character + * @return index or -1 if not found + */ + public static int findIndexOf (String str, String search) + { + if (str == null || search == null || search.length() == 0) + return -1; + // + int endIndex = -1; + int parCount = 0; + boolean ignoringText = false; + int size = str.length(); + while (++endIndex < size) + { + char c = str.charAt(endIndex); + if (c == '\'') + ignoringText = !ignoringText; + else if (!ignoringText) + { + if (parCount == 0 && c == search.charAt(0)) + { + if (str.substring(endIndex).startsWith(search)) + return endIndex; + } + else if (c == ')') + parCount--; + else if (c == '(') + parCount++; + } + } + return -1; + } // findIndexOf + + + /************************************************************************** + * Return Hex String representation of byte b + * @param b byte + * @return Hex + */ + static public String toHex (byte b) + { + char hexDigit[] = { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' + }; + char[] array = { hexDigit[(b >> 4) & 0x0f], hexDigit[b & 0x0f] }; + return new String(array); + } + + /** + * Return Hex String representation of char c + * @param c character + * @return Hex + */ + static public String toHex (char c) + { + byte hi = (byte) (c >>> 8); + byte lo = (byte) (c & 0xff); + return toHex(hi) + toHex(lo); + } // toHex + + + /************************************************************************** + * Init Cap Words With Spaces + * @param in string + * @return init cap + */ + public static String initCap (String in) + { + if (in == null || in.length() == 0) + return in; + // + boolean capitalize = true; + char[] data = in.toCharArray(); + for (int i = 0; i < data.length; i++) + { + if (data[i] == ' ' || Character.isWhitespace(data[i])) + capitalize = true; + else if (capitalize) + { + data[i] = Character.toUpperCase (data[i]); + capitalize = false; + } + else + data[i] = Character.toLowerCase (data[i]); + } + return new String (data); + } // initCap + + + /************************************************************************** + * Return a Iterator with only the relevant attributes. + * Fixes implementation in AttributedString, which returns everything + * @param aString attributed string + * @param relevantAttributes relevant attributes + * @return iterator + */ + static public AttributedCharacterIterator getIterator (AttributedString aString, + AttributedCharacterIterator.Attribute[] relevantAttributes) + { + AttributedCharacterIterator iter = aString.getIterator(); + Set set = iter.getAllAttributeKeys(); + // System.out.println("AllAttributeKeys=" + set); + if (set.size() == 0) + return iter; + // Check, if there are unwanted attributes + Set unwanted = new HashSet(iter.getAllAttributeKeys()); + for (int i = 0; i < relevantAttributes.length; i++) + unwanted.remove(relevantAttributes[i]); + if (unwanted.size() == 0) + return iter; + + // Create new String + StringBuffer sb = new StringBuffer(); + for (char c = iter.first(); c != AttributedCharacterIterator.DONE; c = iter.next()) + sb.append(c); + aString = new AttributedString(sb.toString()); + + // copy relevant attributes + Iterator it = iter.getAllAttributeKeys().iterator(); + while (it.hasNext()) + { + AttributedCharacterIterator.Attribute att = (AttributedCharacterIterator.Attribute)it.next(); + if (!unwanted.contains(att)) + { + for (char c = iter.first(); c != AttributedCharacterIterator.DONE; c = iter.next()) + { + Object value = iter.getAttribute(att); + if (value != null) + { + int start = iter.getRunStart(att); + int limit = iter.getRunLimit(att); + // System.out.println("Attribute=" + att + " Value=" + value + " Start=" + start + " Limit=" + limit); + aString.addAttribute(att, value, start, limit); + iter.setIndex(limit); + } + } + } + // else + // System.out.println("Unwanted: " + att); + } + return aString.getIterator(); + } // getIterator + + + /** + * Dump a Map (key=value) to out + * @param map Map + */ + static public void dump (Map map) + { + System.out.println("Dump Map - size=" + map.size()); + Iterator it = map.keySet().iterator(); + while (it.hasNext()) + { + Object key = it.next(); + Object value = map.get(key); + System.out.println(key + "=" + value); + } + } // dump (Map) + + /** + * Print Action and Input Map for component + * @param comp Component with ActionMap + */ + public static void printActionInputMap (JComponent comp) + { + // Action Map + ActionMap am = comp.getActionMap(); + Object[] amKeys = am.allKeys(); // including Parents + if (amKeys != null) + { + System.out.println("-------------------------"); + System.out.println("ActionMap for Component " + comp.toString()); + for (int i = 0; i < amKeys.length; i++) + { + Action a = am.get(amKeys[i]); + + StringBuffer sb = new StringBuffer("- "); + sb.append(a.getValue(Action.NAME)); + if (a.getValue(Action.ACTION_COMMAND_KEY) != null) + sb.append(", Cmd=").append(a.getValue(Action.ACTION_COMMAND_KEY)); + if (a.getValue(Action.SHORT_DESCRIPTION) != null) + sb.append(" - ").append(a.getValue(Action.SHORT_DESCRIPTION)); + System.out.println(sb.toString() + " - " + a); + } + } + /** Same as below + KeyStroke[] kStrokes = comp.getRegisteredKeyStrokes(); + if (kStrokes != null) + { + System.out.println("-------------------------"); + System.out.println("Registered Key Strokes - " + comp.toString()); + for (int i = 0; i < kStrokes.length; i++) + { + System.out.println("- " + kStrokes[i].toString()); + } + } + /** Focused */ + InputMap im = comp.getInputMap(JComponent.WHEN_FOCUSED); + KeyStroke[] kStrokes = im.allKeys(); + if (kStrokes != null) + { + System.out.println("-------------------------"); + System.out.println("InputMap for Component When Focused - " + comp.toString()); + for (int i = 0; i < kStrokes.length; i++) + { + System.out.println("- " + kStrokes[i].toString() + " - " + + im.get(kStrokes[i]).toString()); + } + } + /** Focused in Window */ + im = comp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); + kStrokes = im.allKeys(); + if (kStrokes != null) + { + System.out.println("-------------------------"); + System.out.println("InputMap for Component When Focused in Window - " + comp.toString()); + for (int i = 0; i < kStrokes.length; i++) + { + System.out.println("- " + kStrokes[i].toString() + " - " + + im.get(kStrokes[i]).toString()); + } + } + /** Focused when Ancester */ + im = comp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + kStrokes = im.allKeys(); + if (kStrokes != null) + { + System.out.println("-------------------------"); + System.out.println("InputMap for Component When Ancestor - " + comp.toString()); + for (int i = 0; i < kStrokes.length; i++) + { + System.out.println("- " + kStrokes[i].toString() + " - " + + im.get(kStrokes[i]).toString()); + } + } + System.out.println("-------------------------"); + } // printActionInputMap + + /** + * Is 8 Bit + * @param str string + * @return true if string contains chars > 255 + */ + public static boolean is8Bit (String str) + { + if (str == null || str.length() == 0) + return true; + char[] cc = str.toCharArray(); + for (int i = 0; i < cc.length; i++) + { + if (cc[i] > 255) + { + // System.out.println("Not 8 Bit - " + str); + return false; + } + } + return true; + } // is8Bit + + /** + * Clean Ampersand (used to indicate shortcut) + * @param in input + * @return cleaned string + */ + public static String cleanAmp (String in) + { + if (in == null) + return in; + int pos = in.indexOf('&'); + if (pos == -1) + return in; + // + if (pos+1 < in.length() && in.charAt(pos+1) != ' ') + in = in.substring(0, pos) + in.substring(pos+1); + return in; + } // cleanAmp + + /** + * Trim to max character length + * @param str string + * @param length max (incl) character length + * @return string + */ + public static String trimLength (String str, int length) + { + if (str == null) + return str; + if (length <= 0) + throw new IllegalArgumentException("Trim length invalid: " + length); + if (str.length() > length) + return str.substring(0, length); + return str; + } // trimLength + + /** + * Size of String in bytes + * @param str string + * @return size in bytes + */ + public static int size (String str) + { + if (str == null) + return 0; + int length = str.length(); + int size = length; + try + { + size = str.getBytes("UTF-8").length; + } + catch (UnsupportedEncodingException e) + { + log.log(Level.SEVERE, str, e); + } + return size; + } // size + + /** + * Trim to max byte size + * @param str string + * @param size max size in bytes + * @return string + */ + public static String trimSize (String str, int size) + { + if (str == null) + return str; + if (size <= 0) + throw new IllegalArgumentException("Trim size invalid: " + size); + // Assume two byte code + int length = str.length(); + if (length < size/2) + return str; + try + { + byte[] bytes = str.getBytes("UTF-8"); + if (bytes.length <= size) + return str; + // create new - may cut last character in half + byte[] result = new byte[size]; + System.arraycopy(bytes, 0, result, 0, size); + return new String(result, "UTF-8"); + } + catch (UnsupportedEncodingException e) + { + log.log(Level.SEVERE, str, e); + } + return str; + } // trimSize + + + /************************************************************************** + * Test + * @param args args + */ + public static void main (String[] args) + { + String str = "a�b�c?d?e?f?g?"; + System.out.println(str + " = " + str.length() + " - " + size(str)); + String str1 = trimLength(str, 10); + System.out.println(str1 + " = " + str1.length() + " - " + size(str1)); + String str2 = trimSize(str, 10); + System.out.println(str2 + " = " + str2.length() + " - " + size(str2)); + // + AttributedString aString = new AttributedString ("test test"); + aString.addAttribute(TextAttribute.FOREGROUND, Color.blue); + aString.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, 2, 4); + getIterator (aString, new AttributedCharacterIterator.Attribute[] {TextAttribute.UNDERLINE}); + } // main + +} // Util diff --git a/looks/src/org/compiere/util/ValueNamePair.java b/looks/src/org/compiere/util/ValueNamePair.java new file mode 100644 index 0000000000..eb669a1551 --- /dev/null +++ b/looks/src/org/compiere/util/ValueNamePair.java @@ -0,0 +1,89 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.util; + +/** + * (String) Value Name Pair + * + * @author Jorg Janke + * @version $Id: ValueNamePair.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $ + */ +public final class ValueNamePair extends NamePair +{ + /** + * Construct KeyValue Pair + * @param value value + * @param name string representation + */ + public ValueNamePair(String value, String name) + { + super(name); + m_value = value; + if (m_value == null) + m_value = ""; + } // ValueNamePair + + /** The Value */ + private String m_value = null; + + /** + * Get Value + * @return Value + */ + public String getValue() + { + return m_value; + } // getValue + + /** + * Get ID + * @return Value + */ + public String getID() + { + return m_value; + } // getID + + /** + * Equals + * @param obj Object + * @return true, if equal + */ + public boolean equals(Object obj) + { + if (obj instanceof ValueNamePair) + { + ValueNamePair pp = (ValueNamePair)obj; + if (pp.getName() != null && pp.getValue() != null && + pp.getName().equals(getName()) && pp.getValue().equals(m_value)) + return true; + return false; + } + return false; + } // equals + + /** + * Return Hashcode of value + * @return hascode + */ + public int hashCode() + { + return m_value.hashCode(); + } // hashCode + +} // KeyValuePair + diff --git a/looks/src/org/compiere/util/package.html b/looks/src/org/compiere/util/package.html new file mode 100644 index 0000000000..5120eda56c --- /dev/null +++ b/looks/src/org/compiere/util/package.html @@ -0,0 +1,25 @@ + + + + + +

Provides utility functions.

+

Package Specification

+

Utility.

+ +

Related Documentation

+

For overviews, tutorials, examples, guides, and tool documentation, please + see: http://www.adempiere.org

+

+ +

+ + diff --git a/looks/swing.properties b/looks/swing.properties new file mode 100644 index 0000000000..f7f80e07b3 --- /dev/null +++ b/looks/swing.properties @@ -0,0 +1,10 @@ +swing.defaultlaf=org.compiere.plaf.AdempiereLookAndFeel +swing.installedlafs=Metal,Motif,Windows,Adempiere +swing.installedlaf.Metal.class=javax.swing.plaf.metal.MetalLookAndFeel +swing.installedlaf.Metal.name=Metal +swing.installedlaf.Motif.class=com.sun.java.swing.plaf.motif.MotifLookAndFeel +swing.installedlaf.Motif.name=CDE/Motif +swing.installedlaf.Windows.class=com.sun.java.swing.plaf.windows.WindowsLookAndFeel +swing.installedlaf.Windows.name=MS Windows +swing.installedlaf.Adempiere.class=org.compiere.plaf.AdempiereLookAndFeel +swing.installedlaf.Adempiere.name=Adempiere