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.
- *
- * :
- * 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 $
+ * Adempiere Look & Feel, based on JGoodies look and feel
*/
public class AdempiereLookAndFeel extends com.jgoodies.looks.plastic.PlasticLookAndFeel
{
@@ -86,10 +81,7 @@ public class AdempiereLookAndFeel extends com.jgoodies.looks.plastic.PlasticLook
*/
public UIDefaults getDefaults()
{
- // System.out.println("CompiereLookAndFeel.getDefaults");
- // Theme already created/set
- //MetalLookAndFeel.setCurrentTheme(s_theme);
- com.jgoodies.looks.plastic.PlasticLookAndFeel.setCurrentTheme(s_theme);
+ //com.jgoodies.looks.plastic.PlasticLookAndFeel.setCurrentTheme(s_theme);
UIDefaults defaults = super.getDefaults(); // calls init..Defaults
return defaults;
} // getDefaults
@@ -153,11 +145,7 @@ public class AdempiereLookAndFeel extends com.jgoodies.looks.plastic.PlasticLook
*/
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
/**
@@ -166,7 +154,6 @@ public class AdempiereLookAndFeel extends com.jgoodies.looks.plastic.PlasticLook
*/
protected void initComponentDefaults (UIDefaults table)
{
- // System.out.println("CompiereLookAndFeel.initComponentDefaults");
super.initComponentDefaults( table);
// ComboBox defaults
@@ -199,7 +186,7 @@ public class AdempiereLookAndFeel extends com.jgoodies.looks.plastic.PlasticLook
{
if (theme != null)
s_theme = theme;
- MetalLookAndFeel.setCurrentTheme(s_theme);
+ PlasticLookAndFeel.setCurrentTheme(s_theme);
} // setCurrentTheme
/**
@@ -244,4 +231,4 @@ public class AdempiereLookAndFeel extends com.jgoodies.looks.plastic.PlasticLook
super.provideErrorFeedback (component);
} // provideErrorFeedback
-} // CompiereLookAndFeel
+} // AdempiereLookAndFeel
diff --git a/looks/src/org/compiere/plaf/AdempierePLAF.java b/looks/src/org/adempiere/plaf/AdempierePLAF.java
similarity index 60%
rename from looks/src/org/compiere/plaf/AdempierePLAF.java
rename to looks/src/org/adempiere/plaf/AdempierePLAF.java
index 4d72e0ebd0..14341883f1 100644
--- a/looks/src/org/compiere/plaf/AdempierePLAF.java
+++ b/looks/src/org/adempiere/plaf/AdempierePLAF.java
@@ -14,18 +14,44 @@
* 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;
+package org.adempiere.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.*;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Insets;
+import java.awt.Toolkit;
+import java.awt.Window;
+import java.awt.event.WindowEvent;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+import javax.swing.ImageIcon;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.LookAndFeel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.plaf.metal.MetalTheme;
+
+import org.compiere.plaf.CompiereLookAndFeel;
+import org.compiere.plaf.CompiereThemeBlueMetal;
+import org.compiere.plaf.CompiereThemeIce;
+import org.compiere.swing.CButton;
+import org.compiere.swing.CFrame;
+import org.compiere.swing.ColorBlind;
+import org.compiere.swing.ExtendedTheme;
+import org.compiere.util.Ini;
+import org.compiere.util.ValueNamePair;
+
+import com.jgoodies.looks.plastic.PlasticLookAndFeel;
+import com.jgoodies.looks.plastic.PlasticTheme;
/**
* Variable Pluggable Look And Feel.
@@ -33,18 +59,12 @@ import org.compiere.util.*;
*
* @author Jorg Janke
* @version $Id: AdempierePLAF.java,v 1.3 2006/07/30 00:52:23 jjanke Exp $
+ *
+ * @author Low Heng Sin
+ * @version 2006-11-27
*/
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());
@@ -62,30 +82,40 @@ public final class AdempierePLAF
} // getFieldBackground_Normal
/**
- * Return Error field background (AdempiereTheme)
+ * Return Error field background
* @return Color
*/
public static Color getFieldBackground_Error()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.error);
+ Color c = UIManager.getColor(ExtendedTheme.ERROR_BG_KEY);
+ if (c == null)
+ c = ExtendedTheme.DEFAULT_ERROR_BG;
+ return ColorBlind.getDichromatColor(c);
} // getFieldBackground_Error
/**
- * Return Mandatory field background color (AdempiereTheme)
+ * Return Mandatory field background color
* @return Color
*/
public static Color getFieldBackground_Mandatory()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.mandatory);
+ Color c = UIManager.getColor(ExtendedTheme.MANDATORY_BG_KEY);
+ if (c == null)
+ c = ExtendedTheme.DEFAULT_MANDATORY_BG;
+ return ColorBlind.getDichromatColor(c);
} // getFieldBackground_Mandatory
/**
- * Return Inactive field background color (AdempiereTheme)
+ * Return Inactive field background color
* @return Color
*/
public static Color getFieldBackground_Inactive()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.inactive);
+ Color c = UIManager.getColor(ExtendedTheme.INACTIVE_BG_KEY);
+ if ( c != null )
+ return ColorBlind.getDichromatColor(c);
+ else
+ return getFieldBackground_Normal();
} // getFieldBackground_Inactive
/**
@@ -105,7 +135,10 @@ public final class AdempierePLAF
*/
public static Color getInfoBackground()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.info);
+ Color c = UIManager.getColor(ExtendedTheme.INFO_BG_KEY);
+ if (c == null)
+ c = UIManager.getColor("info");
+ return ColorBlind.getDichromatColor(c);
} // getInfoBackground
@@ -127,7 +160,7 @@ public final class AdempierePLAF
*/
public static Color getTextColor_OK()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.txt_ok);
+ return getTextColor_Normal();
} // getText_OK
/**
@@ -136,7 +169,10 @@ public final class AdempierePLAF
*/
public static Color getTextColor_Issue()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.txt_error);
+ Color c = UIManager.getColor(ExtendedTheme.ERROR_FG_KEY);
+ if (c == null)
+ c = ExtendedTheme.DEFAULT_ERROR_FG;
+ return ColorBlind.getDichromatColor(c);
} // getText_Issue
/**
@@ -155,7 +191,7 @@ public final class AdempierePLAF
*/
public static Color getPrimary1()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.primary1);
+ return ColorBlind.getDichromatColor(MetalLookAndFeel.getCurrentTheme().getPrimaryControlDarkShadow());
}
/**
* Get Primary2
@@ -163,7 +199,7 @@ public final class AdempierePLAF
*/
public static Color getPrimary2()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.primary2);
+ return ColorBlind.getDichromatColor(MetalLookAndFeel.getCurrentTheme().getPrimaryControlShadow());
}
/**
* Get Primary3
@@ -171,7 +207,7 @@ public final class AdempierePLAF
*/
public static Color getPrimary3()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.primary3);
+ return ColorBlind.getDichromatColor(MetalLookAndFeel.getCurrentTheme().getPrimaryControl());
}
/**
* Get Secondary 1
@@ -179,7 +215,7 @@ public final class AdempierePLAF
*/
public static Color getSecondary1()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.secondary1);
+ return ColorBlind.getDichromatColor(MetalLookAndFeel.getCurrentTheme().getControlDarkShadow());
}
/**
* Get Secondary 2
@@ -187,7 +223,7 @@ public final class AdempierePLAF
*/
public static Color getSecondary2()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.secondary2);
+ return ColorBlind.getDichromatColor(MetalLookAndFeel.getCurrentTheme().getControlShadow());
}
/**
* Get Secondary 3
@@ -195,20 +231,19 @@ public final class AdempierePLAF
*/
public static Color getSecondary3()
{
- return ColorBlind.getDichromatColor(AdempiereThemeInnova.secondary3);
+ return ColorBlind.getDichromatColor(MetalLookAndFeel.getCurrentTheme().getControl());
}
/****** Fonts ************************************************************/
/**
- * Get Header Font (window/label font)
+ * Get Header Font (window title font)
* @return font
*/
public static Font getFont_Header()
{
- return CompiereTheme.windowFont;
- // return UIManager.getFont("Label.font");
+ return MetalLookAndFeel.getWindowTitleFont();
} // getFont_Header
/**
@@ -217,8 +252,7 @@ public final class AdempierePLAF
*/
public static Font getFont_Field()
{
- return CompiereTheme.userFont;
- // return UIManager.getFont("TextField.font");
+ return UIManager.getFont("TextField.font");
} // getFont_Field
/**
@@ -227,8 +261,7 @@ public final class AdempierePLAF
*/
public static Font getFont_Label()
{
- return CompiereTheme.controlFont;
- // return UIManager.getFont("Label.font");
+ return UIManager.getFont("Label.font");
} // setFont_Label
/**
@@ -237,7 +270,7 @@ public final class AdempierePLAF
*/
public static Font getFont_Small()
{
- return CompiereTheme.smallFont;
+ return MetalLookAndFeel.getSubTextFont();
} // setFont_Small
/****** Available L&F ****************************************************/
@@ -247,20 +280,17 @@ public final class AdempierePLAF
/** Default PLAF */
private static ValueNamePair s_defaultPLAF = null;
/** Availablle Themes */
- private static ValueNamePair[] s_themes = null;
+ private static ValueNamePair[] s_metalThemes = null;
+ private static ValueNamePair[] s_plasticThemes = null;
- private static ValueNamePair s_vp_adempiereTheme = null;
+ //default theme
+ private static ValueNamePair s_vp_compiereTheme = null;
private static ValueNamePair s_vp_metalTheme = null;
- private static ValueNamePair s_vp_kunststoffTheme = null;
+ private static ValueNamePair s_vp_plasticTheme = null;
//e-evolution vpj-cd 19102006
- private static ValueNamePair s_vp_jgoodiesTheme = null;
+ private static ValueNamePair s_vp_adempiereTheme = 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
@@ -270,55 +300,50 @@ public final class AdempierePLAF
ArrayList- * 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
-
//-----------------------------------------------------
@@ -630,9 +375,17 @@ public class AdempiereTheme extends com.jgoodies.looks.plastic.theme.DesertBluer
PlasticScrollBarUI.MAX_BUMPS_WIDTH_KEY, new Integer(30),
//"TabbedPane.selected", getWhite(),
"TabbedPane.selectHighlight", new ColorUIResource(231, 218, 188),
- };
-
+ ExtendedTheme.ERROR_BG_KEY,
+ error,
+ ExtendedTheme.ERROR_FG_KEY,
+ txt_error,
+ ExtendedTheme.INACTIVE_BG_KEY,
+ inactive,
+ ExtendedTheme.INFO_BG_KEY,
+ info,
+ ExtendedTheme.MANDATORY_BG_KEY,
+ mandatory
+ };
table.putDefaults(uiDefaults);
}
-
}
diff --git a/looks/src/org/compiere/plaf/AdempiereThemeInnova.java b/looks/src/org/adempiere/plaf/AdempiereThemeInnova.java
similarity index 96%
rename from looks/src/org/compiere/plaf/AdempiereThemeInnova.java
rename to looks/src/org/adempiere/plaf/AdempiereThemeInnova.java
index 5dcec2db4a..d3b28ebba7 100644
--- a/looks/src/org/compiere/plaf/AdempiereThemeInnova.java
+++ b/looks/src/org/adempiere/plaf/AdempiereThemeInnova.java
@@ -14,7 +14,7 @@
* 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;
+package org.adempiere.plaf;
import java.awt.*;
import javax.swing.plaf.*;
diff --git a/looks/src/org/compiere/plaf/AdempierePLAFEditor.java b/looks/src/org/adempiere/plaf/PLAFEditor.java
similarity index 80%
rename from looks/src/org/compiere/plaf/AdempierePLAFEditor.java
rename to looks/src/org/adempiere/plaf/PLAFEditor.java
index 2885e41e32..08eda25409 100644
--- a/looks/src/org/compiere/plaf/AdempierePLAFEditor.java
+++ b/looks/src/org/adempiere/plaf/PLAFEditor.java
@@ -14,7 +14,7 @@
* 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;
+package org.adempiere.plaf;
import java.awt.*;
import java.awt.event.*;
@@ -23,8 +23,13 @@ import java.util.logging.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.plaf.metal.*;
+
+import org.compiere.plaf.CompiereColor;
+import org.compiere.plaf.CompiereLookAndFeel;
+import org.compiere.plaf.CompiereThemeEditor;
import org.compiere.swing.*;
import org.compiere.util.*;
+
import sun.awt.*;
/**
@@ -35,53 +40,53 @@ import sun.awt.*;
* @author Jorg Janke
* @version $Id: AdempierePLAFEditor.java,v 1.3 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempierePLAFEditor extends JDialog
+public class PLAFEditor extends JDialog
implements ActionListener
{
/**
* Default Constructor
* Don't Show Example
*/
- public AdempierePLAFEditor()
+ public PLAFEditor()
{
super();
init(false);
- } // AdempierePLAFEditor
+ } // PLAFEditor
/**
* Constructor
* @param showExample if true, show Example
*/
- public AdempierePLAFEditor (boolean showExample)
+ public PLAFEditor (boolean showExample)
{
super();
- init(showExample);
- } // AdempierePLAFEditor
+ init(true);
+ } // PLAFEditor
/**
* Modal Dialog Constructor
* @param owner
* @param showExample if true, show Example
*/
- public AdempierePLAFEditor(Dialog owner, boolean showExample)
+ public PLAFEditor(Dialog owner, boolean showExample)
{
super(owner, "", true);
- init(showExample);
- } // AdempierePLAFEditor
+ init(true);
+ } // PLAFEditor
/**
* Modal Frame Constructor
* @param owner
* @param showExample if true, show Example
*/
- public AdempierePLAFEditor(Frame owner, boolean showExample)
+ public PLAFEditor(Frame owner, boolean showExample)
{
super(owner, "", true);
- init(showExample);
- } // AdempierePLAFEditor
+ init(true);
+ } // PLAFEditor
/** Logger */
- private static Logger log = Logger.getLogger(AdempierePLAFEditor.class.getName());
+ private static Logger log = Logger.getLogger(PLAFEditor.class.getName());
/**************************************************************************
@@ -105,7 +110,6 @@ public class AdempierePLAFEditor extends JDialog
{
log.log(Level.SEVERE, "", e);
}
- // AdempiereUtils.setNotBuffered(this);
} // PLAFEditor
/** Diable Theme Field */
@@ -135,13 +139,9 @@ public class AdempierePLAFEditor extends JDialog
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();
//
@@ -168,10 +168,10 @@ public class AdempierePLAFEditor extends JDialog
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 CPanel jPanelFlat = new CPanel(new CompiereColor(new Color(255,205,255), true));
+ private CPanel jPanelGradient = new CPanel(new CompiereColor(new Color(233,210,210), new Color(217,210,233)));
+ private CPanel jPanelTexture = new CPanel(new CompiereColor(CompiereColor.class.getResource("vincent.jpg"), Color.lightGray, 0.7f));
+ private CPanel jPanelLines = new CPanel(new CompiereColor(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();
@@ -200,7 +200,7 @@ public class AdempierePLAFEditor extends JDialog
private void jbInit() throws Exception
{
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- this.setTitle(s_res.getString("LookAndFeelEditor") + " " + AdempierePLAF.VERSION);
+ this.setTitle(s_res.getString("LookAndFeelEditor"));
mainPanel.setLayout(mainLayout);
mainLayout.setHgap(5);
mainLayout.setVgap(5);
@@ -216,25 +216,15 @@ public class AdempierePLAFEditor extends JDialog
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);
@@ -282,16 +272,8 @@ public class AdempierePLAFEditor extends JDialog
,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
@@ -366,7 +348,7 @@ public class AdempierePLAFEditor extends JDialog
*/
private void dynInit()
{
- // setLFSelection();
+ setLFSelection();
//
jPanelGradient.setTabLevel(1);
jPanelTexture.setTabLevel(2);
@@ -383,7 +365,6 @@ public class AdempierePLAFEditor extends JDialog
jButtonTexture.addActionListener(this);
jButtonLines.addActionListener(this);
//
- AdempierePLAF.setPLAF(this);
} // dynInit
/**
@@ -451,7 +432,6 @@ public class AdempierePLAFEditor extends JDialog
// OK - Save & Finish
if (e.getSource() == bOK)
{
- CompiereTheme.save();
Ini.saveProperties(true);
dispose();
}
@@ -470,58 +450,28 @@ public class AdempierePLAFEditor extends JDialog
{
m_setting = true; // disable Theme setting
// set new theme
- AdempierePLAF.setPLAF((ValueNamePair)lfField.getSelectedItem(), null, this);
+ AdempierePLAF.setPLAF((ValueNamePair)lfField.getSelectedItem(), null, true);
+ AdempierePLAF.updateUI(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();
+ AdempierePLAF.setPLAF((ValueNamePair)lfField.getSelectedItem(), (ValueNamePair)themeField.getSelectedItem(),true);
+ AdempierePLAF.updateUI(this);
}
// Reset PLAFs
else if (e.getSource() == rButton)
{
- AdempierePLAF.reset(this);
+ AdempierePLAF.reset();
+ AdempierePLAF.updateUI(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)
{
@@ -542,7 +492,6 @@ public class AdempierePLAFEditor extends JDialog
}
ColorBlind.setColorType(sel);
AdempierePLAF.updateUI(this);
- AdempierePLAF.setPLAF(this); // twice (??)
}
}
@@ -585,7 +534,6 @@ public class AdempierePLAFEditor extends JDialog
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
@@ -600,20 +548,6 @@ public class AdempierePLAFEditor extends JDialog
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
diff --git a/looks/src/org/adempiere/plaf/PLAFEditorPanel.java b/looks/src/org/adempiere/plaf/PLAFEditorPanel.java
new file mode 100644
index 0000000000..acbf0cd4d2
--- /dev/null
+++ b/looks/src/org/adempiere/plaf/PLAFEditorPanel.java
@@ -0,0 +1,445 @@
+/******************************************************************************
+ * 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.adempiere.plaf;
+
+import java.awt.BorderLayout;
+import java.awt.Cursor;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.Insets;
+import java.awt.event.FocusAdapter;
+import java.awt.event.KeyAdapter;
+import java.awt.event.MouseAdapter;
+import java.awt.image.BufferedImage;
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JRadioButton;
+import javax.swing.JRootPane;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTable;
+import javax.swing.JTree;
+import javax.swing.LookAndFeel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.plaf.SplitPaneUI;
+import javax.swing.plaf.basic.BasicSplitPaneUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.plaf.metal.MetalTheme;
+
+import org.compiere.swing.CButton;
+import org.compiere.swing.CCheckBox;
+import org.compiere.swing.CComboBox;
+import org.compiere.swing.CLabel;
+import org.compiere.swing.CPanel;
+import org.compiere.swing.CTabbedPane;
+import org.compiere.swing.CTextField;
+import org.compiere.util.ValueNamePair;
+
+import sun.awt.AppContext;
+
+/**
+ * Look and feel selection panel.
+ * @author Low Heng Sin
+ * @version 2006-11-27
+ */
+public class PLAFEditorPanel extends CPanel {
+ /** Logger */
+ private static Logger log = Logger.getLogger(PLAFEditor.class.getName());
+
+ static ResourceBundle s_res = ResourceBundle.getBundle("org.compiere.plaf.PlafRes");
+ static Object[] s_columns = new Object[] {"-0-", "-1-"};
+ static Object[][] s_data = new Object[][] {
+ {"-00-", "-01-"},
+ {"-10-", "-11-"},
+ {"-20-", "-21-"},
+ {"-30-", "-31-"},
+ {"-O0-", "-O1-"},
+ {"-l0-", "-l1-"}};
+
+ private PreviewPanel previewPanel = new PreviewPanel();
+ private JList lookList = new JList(AdempierePLAF.getPLAFs());
+ private JList themeList = new JList();
+
+ /**
+ * Instance variable to disable list event handling when updating list with value
+ * from UIManager
+ */
+ private boolean m_setting;
+
+ //preview components
+ private CTextField error = new CTextField(s_res.getString("Error"));
+ private CTextField mandatory = new CTextField(s_res.getString("Mandatory"));
+ CButton button = new CButton("Button");
+ CPanel tabPage1 = new CPanel();
+
+ public PLAFEditorPanel() {
+ init();
+ }
+
+ private void init() {
+ setupUI();
+ setupPreview();
+ setLFSelection();
+ }
+
+ /**
+ * Create and layout UI components
+ */
+ private void setupUI() {
+ this.setLayout(new BorderLayout());
+
+ //splitpane for the selection and preview panel
+ JSplitPane splitPane = new JSplitPane();
+ splitPane.setBorder(BorderFactory.createEmptyBorder());
+ splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
+ add(splitPane, BorderLayout.CENTER);
+
+ CPanel selectionPanel = new CPanel();
+ CPanel previewPart = new CPanel();
+
+ splitPane.setTopComponent(selectionPanel);
+ splitPane.setBottomComponent(previewPart);
+ splitPane.setDividerLocation(0.50);
+ splitPane.setDividerSize(0);
+ //disable divider
+ SplitPaneUI splitPaneUI = splitPane.getUI();
+ if (splitPaneUI instanceof BasicSplitPaneUI) {
+ ((BasicSplitPaneUI)splitPaneUI).getDivider().setEnabled(false);
+ }
+
+ //setup look and theme selection component
+ selectionPanel.setLayout(new GridBagLayout());
+ CLabel label = new CLabel(s_res.getString("LookAndFeel"));
+ label.setForeground(AdempierePLAF.getPrimary1());
+ label.setFont(label.getFont().deriveFont(Font.BOLD));
+ selectionPanel.add(label, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
+ label = new CLabel(s_res.getString("Theme"));
+ label.setForeground(AdempierePLAF.getPrimary1());
+ label.setFont(label.getFont().deriveFont(Font.BOLD));
+ selectionPanel.add(label, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
+
+ lookList.setVisibleRowCount(12);
+ JScrollPane scrollPane = new JScrollPane(lookList);
+ scrollPane.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
+ selectionPanel.add(scrollPane, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
+ GridBagConstraints.NORTHWEST, GridBagConstraints.VERTICAL, new Insets(0, 5, 2, 2), 100, 0));
+
+ themeList.setVisibleRowCount(12);
+ scrollPane = new JScrollPane(themeList);
+ scrollPane.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
+ selectionPanel.add(scrollPane, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 2, 2, 5), 0, 0));
+
+ previewPart.setBorder(BorderFactory.createEmptyBorder());
+ previewPart.setLayout(new GridBagLayout());
+ label = new CLabel(s_res.getString("Preview"));
+ label.setForeground(AdempierePLAF.getPrimary1());
+ label.setFont(label.getFont().deriveFont(Font.BOLD));
+ previewPart.add(label, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0));
+ previewPart.add(previewPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0,
+ GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
+
+ lookList.addListSelectionListener(new ListSelectionListener() {
+ public void valueChanged(ListSelectionEvent e) {
+ lookAndFeelSelectionChanged(e);
+ }
+
+ });
+ themeList.addListSelectionListener(new ListSelectionListener() {
+ public void valueChanged(ListSelectionEvent e) {
+ themeSelectionChanged(e);
+ }
+
+ });
+ }
+
+ protected void themeSelectionChanged(ListSelectionEvent e) {
+ if (m_setting) return;
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ ValueNamePair laf = (ValueNamePair)lookList.getSelectedValue();
+ ValueNamePair theme = (ValueNamePair)themeList.getSelectedValue();
+ LookAndFeel currentLaf = UIManager.getLookAndFeel();
+ MetalTheme currentTheme = MetalLookAndFeel.getCurrentTheme();
+ AdempierePLAF.setPLAF(laf, theme, false);
+ previewPanel.refresh(currentLaf,currentTheme);
+ SwingUtilities.updateComponentTreeUI(previewPanel);
+ updatePreviewComponents();
+ setLFSelection();
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ this.repaint();
+ }
+
+ /**
+ * Handle look and feel selection changed
+ * @param e
+ */
+ protected void lookAndFeelSelectionChanged(ListSelectionEvent e) {
+ if (m_setting) return;
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ ValueNamePair laf = (ValueNamePair)lookList.getSelectedValue();
+ LookAndFeel currentLaf = UIManager.getLookAndFeel();
+ MetalTheme currentTheme = MetalLookAndFeel.getCurrentTheme();
+ AdempierePLAF.setPLAF(laf, null, false);
+ previewPanel.refresh(currentLaf,currentTheme);
+ SwingUtilities.updateComponentTreeUI(previewPanel);
+ updatePreviewComponents();
+ setLFSelection();
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ this.repaint();
+ }
+
+ private void updatePreviewComponents() {
+ error.setBackground(true);
+ mandatory.setMandatory(true);
+ button.setOpaque(true);
+ tabPage1.setOpaque(false);
+ }
+
+ /**
+ * Create the preview UI components
+ */
+ private void setupPreview() {
+ JRootPane rootPane = new JRootPane();
+ previewPanel.setLayout(new BorderLayout());
+ previewPanel.add(rootPane, BorderLayout.CENTER);
+ previewPanel.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
+ GridLayout gridLayout = new GridLayout(1, 3);
+ gridLayout.setHgap(4);
+ rootPane.getContentPane().setLayout(gridLayout);
+ rootPane.setGlassPane(new GlassPane());
+ rootPane.getGlassPane().setVisible(true);
+ CPanel column1 = new CPanel();
+ rootPane.getContentPane().add(column1);
+ CPanel column2 = new CPanel();
+ rootPane.getContentPane().add(column2);
+ CPanel column3 = new CPanel();
+ rootPane.getContentPane().add(column3);
+
+ column1.setLayout(new GridBagLayout());
+ JTree jtree = new JTree();
+ jtree.setFocusable(false);
+ jtree.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
+ column1.add(jtree, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
+ GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5,5,2,2),0,0));
+ CTextField normal = new CTextField("Text Field");
+ normal.setFocusable(false);
+ column1.add(normal, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2,5,5,2),0,0));
+ error.setBackground(true);
+ error.setFocusable(false);
+ column1.add(error, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2,2,5,2),0,0));
+
+ column2.setLayout(new GridBagLayout());
+ JTable jtable = new JTable(s_data, s_columns);
+ JScrollPane scrollPane = new JScrollPane(jtable);
+ jtable.setFocusable(false);
+ scrollPane.setPreferredSize(jtable.getPreferredSize());
+ column2.add(scrollPane, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
+ GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5,2,2,2),0,0));
+ mandatory.setMandatory(true);
+ mandatory.setFocusable(false);
+ column2.add(mandatory, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2,2,5,2),0,0));
+ CTextField inactive = new CTextField(s_res.getString("Inactive"));
+ inactive.setEnabled(false);
+ column2.add(inactive, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2,2,5,2),0,0));
+
+ column3.setLayout(new GridBagLayout());
+ CTabbedPane tab = new CTabbedPane();
+ column3.add(tab, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
+ GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5,2,2,5),0,0));
+ CComboBox editable = new CComboBox(new Object[]{"Editable"});
+ editable.setEditable(true);
+ editable.setFocusable(false);
+ column3.add(editable, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2,2,5,2),0,0));
+ CComboBox choice = new CComboBox(new Object[]{"Choice"});
+ choice.setEditable(false);
+ choice.setFocusable(false);
+ column3.add(choice, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2,2,5,5),0,0));
+
+ tabPage1.setLayout(new BoxLayout(tabPage1, BoxLayout.Y_AXIS));
+ JRadioButton radio = new JRadioButton("Radio");
+ radio.setSelected(true);
+ radio.setMargin(new Insets(5,5,5,5));
+ radio.setFocusable(false);
+ radio.setOpaque(false);
+ tabPage1.add(radio);
+ CCheckBox checkBox = new CCheckBox("Checkbox");
+ checkBox.setSelected(true);
+ checkBox.setMargin(new Insets(5,5,5,5));
+ checkBox.setFocusable(false);
+ tabPage1.add(checkBox);
+ CLabel label = new CLabel("Label");
+ label.setHorizontalAlignment(JLabel.LEFT);
+ label.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+ tabPage1.add(label);
+ button.setMargin(new Insets(5,5,5,5));
+ button.setFocusable(false);
+ tabPage1.add(button);
+ tab.add(tabPage1, "tab1");
+ tab.add(new CPanel(), "tab2");
+ }
+
+ /**
+ * Update the look list and theme list to show the current selection
+ */
+ 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)
+ lookList.setSelectedValue(plaf, true);
+
+
+ // Search for Theme
+ MetalTheme metalTheme = null;
+ ValueNamePair theme = null;
+ boolean metal = UIManager.getLookAndFeel() instanceof MetalLookAndFeel;
+ themeList.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)
+ themeList.setSelectedValue(theme, true);
+ }
+ m_setting = false;
+ log.info(lookFeel + " - " + metalTheme);
+ } // setLFSelection
+
+ /**
+ * Get look and feel selected by user
+ * @return selected look and feel
+ */
+ public ValueNamePair getSelectedLook() {
+ return (ValueNamePair)lookList.getSelectedValue();
+ }
+
+ /**
+ * Get theme selected by user
+ * @return selected theme
+ */
+ public ValueNamePair getSelectedTheme() {
+ return (ValueNamePair)themeList.getSelectedValue();
+ }
+}
+
+/**
+ * Glass pane to block input and mouse event from the preview components
+ * @author Low Heng Sin
+ */
+class GlassPane extends JComponent {
+ GlassPane() {
+ addMouseListener(new MouseAdapter() {});
+ addKeyListener(new KeyAdapter() {});
+ addFocusListener(new FocusAdapter() {});
+ }
+}
+
+/**
+ * A custom panel, only repaint when look and feel or theme changed.
+ * @author Low Heng Sin
+ */
+class PreviewPanel extends CPanel {
+ private boolean capture = true;
+ private LookAndFeel laf = null;
+ private MetalTheme theme = null;
+ private BufferedImage image;
+
+ @Override
+ public void paint(Graphics g) {
+ if (capture) {
+ //capture preview image
+ image = (BufferedImage)createImage(this.getWidth(),this.getHeight());
+ super.paint(image.createGraphics());
+ g.drawImage(image, 0, 0, null);
+ capture = false;
+ if (laf != null) {
+ //reset to origianl setting
+ if (laf instanceof MetalLookAndFeel)
+ AdempierePLAF.setCurrentMetalTheme((MetalLookAndFeel)laf, theme);
+ try {
+ UIManager.setLookAndFeel(laf);
+ } catch (UnsupportedLookAndFeelException e) {
+ }
+ }
+ } else {
+ //draw preview image
+ if (image != null)
+ g.drawImage(image, 0, 0, null);
+ }
+ }
+
+ /**
+ * Refresh look and feel preview, reset to original setting after
+ * refresh.
+ * @param currentLaf Current Look and feel
+ * @param currentTheme Current Theme
+ */
+ public void refresh(LookAndFeel currentLaf, MetalTheme currentTheme) {
+ this.laf = currentLaf;
+ this.theme = currentTheme;
+ capture = true;
+ }
+}
\ No newline at end of file
diff --git a/looks/src/org/compiere/plaf/AdempiereButtonListener.java b/looks/src/org/compiere/plaf/CompiereButtonListener.java
similarity index 94%
rename from looks/src/org/compiere/plaf/AdempiereButtonListener.java
rename to looks/src/org/compiere/plaf/CompiereButtonListener.java
index daade5c4c5..fdc220db89 100644
--- a/looks/src/org/compiere/plaf/AdempiereButtonListener.java
+++ b/looks/src/org/compiere/plaf/CompiereButtonListener.java
@@ -28,13 +28,13 @@ import javax.swing.plaf.basic.*;
* @author Jorg Janke
* @version $Id: AdempiereButtonListener.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereButtonListener extends BasicButtonListener
+public class CompiereButtonListener extends BasicButtonListener
{
/**
* Adempiere Button Listener
* @param b button
*/
- public AdempiereButtonListener (AbstractButton b)
+ public CompiereButtonListener (AbstractButton b)
{
super (b);
} // AdempiereButtonListener
diff --git a/looks/src/org/compiere/plaf/AdempiereButtonUI.java b/looks/src/org/compiere/plaf/CompiereButtonUI.java
similarity index 89%
rename from looks/src/org/compiere/plaf/AdempiereButtonUI.java
rename to looks/src/org/compiere/plaf/CompiereButtonUI.java
index 141b07b175..2109dbb939 100644
--- a/looks/src/org/compiere/plaf/AdempiereButtonUI.java
+++ b/looks/src/org/compiere/plaf/CompiereButtonUI.java
@@ -28,7 +28,7 @@ import javax.swing.plaf.metal.*;
* @author Jorg Janke
* @version $Id: AdempiereButtonUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereButtonUI extends MetalButtonUI
+public class CompiereButtonUI extends MetalButtonUI
{
/**
* Static Create UI
@@ -41,7 +41,7 @@ public class AdempiereButtonUI extends MetalButtonUI
} // createUI
/** UI shared */
- private static AdempiereButtonUI s_buttonUI = new AdempiereButtonUI();
+ private static CompiereButtonUI s_buttonUI = new CompiereButtonUI();
/**************************************************************************
@@ -73,7 +73,7 @@ public class AdempiereButtonUI extends MetalButtonUI
{
// System.out.println(c.getClass() + " ** " + ((JButton)c).getText() + " ** " + c.isOpaque());
if (c.isOpaque())
- AdempiereUtils.fillRectange((Graphics2D)g, c, CompiereLookAndFeel.ROUND);
+ CompiereUtils.fillRectange((Graphics2D)g, c, CompiereLookAndFeel.ROUND);
paint (g, c);
} // update
@@ -90,7 +90,7 @@ public class AdempiereButtonUI extends MetalButtonUI
boolean in = model.isPressed() || model.isSelected();
//
if (b.isBorderPainted())
- AdempiereUtils.paint3Deffect((Graphics2D)g, c, CompiereLookAndFeel.ROUND, !in);
+ CompiereUtils.paint3Deffect((Graphics2D)g, c, CompiereLookAndFeel.ROUND, !in);
} // paint
/**
@@ -126,7 +126,7 @@ public class AdempiereButtonUI extends MetalButtonUI
*/
protected BasicButtonListener createButtonListener (AbstractButton b)
{
- return new AdempiereButtonListener(b);
+ return new CompiereButtonListener(b);
} // createButtonListener
} // AdempiereButtonUI
diff --git a/looks/src/org/compiere/plaf/AdempiereCheckBoxMenuItemUI.java b/looks/src/org/compiere/plaf/CompiereCheckBoxMenuItemUI.java
similarity index 92%
rename from looks/src/org/compiere/plaf/AdempiereCheckBoxMenuItemUI.java
rename to looks/src/org/compiere/plaf/CompiereCheckBoxMenuItemUI.java
index 9315c9e741..570255797d 100644
--- a/looks/src/org/compiere/plaf/AdempiereCheckBoxMenuItemUI.java
+++ b/looks/src/org/compiere/plaf/CompiereCheckBoxMenuItemUI.java
@@ -26,7 +26,7 @@ import javax.swing.plaf.basic.*;
* @author Jorg Janke
* @version $Id: AdempiereCheckBoxMenuItemUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI
+public class CompiereCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI
{
/**
* Create own instance
@@ -35,7 +35,7 @@ public class AdempiereCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI
*/
public static ComponentUI createUI(JComponent c)
{
- return new AdempiereMenuItemUI();
+ return new CompiereMenuItemUI();
} // createUI
/**
diff --git a/looks/src/org/compiere/plaf/AdempiereCheckBoxUI.java b/looks/src/org/compiere/plaf/CompiereCheckBoxUI.java
similarity index 90%
rename from looks/src/org/compiere/plaf/AdempiereCheckBoxUI.java
rename to looks/src/org/compiere/plaf/CompiereCheckBoxUI.java
index f39e6595b7..e155355995 100644
--- a/looks/src/org/compiere/plaf/AdempiereCheckBoxUI.java
+++ b/looks/src/org/compiere/plaf/CompiereCheckBoxUI.java
@@ -28,7 +28,7 @@ import javax.swing.plaf.metal.MetalCheckBoxUI;
* @author Jorg Janke
* @version $Id: AdempiereCheckBoxUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereCheckBoxUI extends MetalCheckBoxUI
+public class CompiereCheckBoxUI extends MetalCheckBoxUI
{
/**
* Create UI
@@ -41,7 +41,7 @@ public class AdempiereCheckBoxUI extends MetalCheckBoxUI
} // createUI
/** UI shared */
- private static AdempiereCheckBoxUI s_checkBoxUI = new AdempiereCheckBoxUI();
+ private static CompiereCheckBoxUI s_checkBoxUI = new CompiereCheckBoxUI();
/**************************************************************************
@@ -61,7 +61,7 @@ public class AdempiereCheckBoxUI extends MetalCheckBoxUI
*/
protected BasicButtonListener createButtonListener (AbstractButton b)
{
- return new AdempiereButtonListener(b);
+ return new CompiereButtonListener(b);
} // createButtonListener
} // AdempiereCheckBoxUI
diff --git a/looks/src/org/compiere/plaf/AdempiereColor.java b/looks/src/org/compiere/plaf/CompiereColor.java
similarity index 85%
rename from looks/src/org/compiere/plaf/AdempiereColor.java
rename to looks/src/org/compiere/plaf/CompiereColor.java
index 5236e0ac23..ff35fe6117 100644
--- a/looks/src/org/compiere/plaf/AdempiereColor.java
+++ b/looks/src/org/compiere/plaf/CompiereColor.java
@@ -24,6 +24,10 @@ import java.util.*;
import java.util.logging.*;
import javax.swing.*;
import javax.swing.plaf.*;
+
+import org.adempiere.plaf.AdempierePLAF;
+import org.compiere.swing.ColorBlind;
+import org.compiere.swing.ThemeUtils;
import org.compiere.util.*;
/**
@@ -32,7 +36,7 @@ import org.compiere.util.*;
* @author Jorg Janke
* @version $Id: AdempiereColor.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereColor implements Serializable
+public class CompiereColor implements Serializable
{
/** Background type Flat */
public static final String TYPE_FLAT = "F";
@@ -100,7 +104,7 @@ public class AdempiereColor implements Serializable
*/
public static void setBackground (JComponent c)
{
- setBackground (c, AdempierePanelUI.getDefaultBackground());
+ setBackground (c, new CompiereColor(AdempierePLAF.getFormBackground()));
} // setBackground
/**
@@ -108,9 +112,9 @@ public class AdempiereColor implements Serializable
* @param c Component
* @param cc Color
*/
- public static void setBackground (JComponent c, AdempiereColor cc)
+ public static void setBackground (JComponent c, CompiereColor cc)
{
- c.putClientProperty(AdempierePLAF.BACKGROUND, cc);
+ c.putClientProperty(CompiereLookAndFeel.BACKGROUND, cc);
} // setBackground
/**
@@ -118,12 +122,12 @@ public class AdempiereColor implements Serializable
* @param c JComponent
* @return Color
*/
- public static AdempiereColor getBackground (JComponent c)
+ public static CompiereColor getBackground (JComponent c)
{
- AdempiereColor bg = null;
+ CompiereColor bg = null;
try
{
- bg = (AdempiereColor)c.getClientProperty(AdempierePLAF.BACKGROUND);
+ bg = (CompiereColor)c.getClientProperty(CompiereLookAndFeel.BACKGROUND);
}
catch (Exception e)
{
@@ -138,7 +142,7 @@ public class AdempiereColor implements Serializable
*/
public static void setBackground (Window win)
{
- setBackground (win, AdempierePanelUI.getDefaultBackground());
+ setBackground (win, new CompiereColor(AdempierePLAF.getFormBackground()));
} // setBackground
/**
@@ -146,73 +150,43 @@ public class AdempiereColor implements Serializable
* @param win window
* @param cc adempiere color
*/
- public static void setBackground (Window win, AdempiereColor cc)
+ public static void setBackground (Window win, CompiereColor cc)
{
if (win instanceof JDialog)
{
- ((JPanel)((JDialog)win).getContentPane()).putClientProperty(AdempierePLAF.BACKGROUND, cc);
+ ((JPanel)((JDialog)win).getContentPane()).putClientProperty(CompiereLookAndFeel.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()).putClientProperty(CompiereLookAndFeel.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()).putClientProperty(CompiereLookAndFeel.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
+ * @see CompierePanelUI#getDefaultBackground
*/
- public static AdempiereColor getDefaultBackground()
+ public static CompiereColor getDefaultBackground()
{
- return AdempierePanelUI.getDefaultBackground();
+ return new CompiereColor(AdempierePLAF.getFormBackground());
} // 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)
+ public static CompiereColor parse (String attributes)
{
- AdempiereColor cc = new AdempiereColor ();
+ CompiereColor cc = new CompiereColor ();
try
{
if (attributes != null && attributes.length() > 0)
@@ -229,7 +203,7 @@ public class AdempiereColor implements Serializable
/*************************************************************************
* Create Gradient Background Color (Window System Color - White)
*/
- public AdempiereColor()
+ public CompiereColor()
{
this (TYPE_GRADIENT);
} // AdempiereColor
@@ -238,7 +212,7 @@ public class AdempiereColor implements Serializable
* Create Default Background Colors of Type
* @param type Background type (see constants TYPE_*)
*/
- public AdempiereColor (String type)
+ public CompiereColor (String type)
{
if (type == null)
new java.lang.IllegalArgumentException (EXCEPTION_TEXT);
@@ -255,7 +229,7 @@ public class AdempiereColor implements Serializable
* Create Flat Background Color
* @param bg background
*/
- public AdempiereColor (Color bg)
+ public CompiereColor (Color bg)
{
this (bg, true);
} // AdempiereColor
@@ -265,7 +239,7 @@ public class AdempiereColor implements Serializable
* @param bg Color
* @param flat if true create Flat color otherwise Gradient color with white lower color
*/
- public AdempiereColor (Color bg, boolean flat)
+ public CompiereColor (Color bg, boolean flat)
{
if (bg == null)
new java.lang.IllegalArgumentException (EXCEPTION_TEXT);
@@ -280,7 +254,7 @@ public class AdempiereColor implements Serializable
* @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)
+ public CompiereColor (Color upperColor, Color lowerColor, int startPoint, int repeatDistance)
{
if (upperColor == null || lowerColor == null)
new java.lang.IllegalArgumentException (EXCEPTION_TEXT);
@@ -297,7 +271,7 @@ public class AdempiereColor implements Serializable
* @param upperColor upper color
* @param lowerColor lower color
*/
- public AdempiereColor (Color upperColor, Color lowerColor)
+ public CompiereColor (Color upperColor, Color lowerColor)
{
this (upperColor, lowerColor, SwingConstants.NORTH_WEST, 100);
} // AdempiereColor
@@ -309,7 +283,7 @@ public class AdempiereColor implements Serializable
* @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)
+ public CompiereColor (URL textureURL, Color taint, float compositeAlpha)
{
if (textureURL == null || taint == null)
new java.lang.IllegalArgumentException (EXCEPTION_TEXT);
@@ -326,7 +300,7 @@ public class AdempiereColor implements Serializable
* @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)
+ public CompiereColor (String textureURL, Color taint, float compositeAlpha)
{
if (textureURL == null || taint == null)
new java.lang.IllegalArgumentException (EXCEPTION_TEXT);
@@ -344,7 +318,7 @@ public class AdempiereColor implements Serializable
* @param lineWidth Stroke width in point
* @param lineDistance Distance between lines in points
*/
- public AdempiereColor (Color lineColor, Color backColor, float lineWidth, int lineDistance)
+ public CompiereColor (Color lineColor, Color backColor, float lineWidth, int lineDistance)
{
if (lineColor == null || backColor == null)
new java.lang.IllegalArgumentException (EXCEPTION_TEXT);
@@ -359,7 +333,7 @@ public class AdempiereColor implements Serializable
* Copy Color
* @param cc color
*/
- public AdempiereColor (AdempiereColor cc)
+ public CompiereColor (CompiereColor cc)
{
if (cc == null)
return;
@@ -401,7 +375,7 @@ public class AdempiereColor implements Serializable
/** Diry marker for repaining Background */
private boolean m_dirty = true;
/** Logger */
- private static Logger log = Logger.getLogger(AdempiereColor.class.getName());
+ private static Logger log = Logger.getLogger(CompiereColor.class.getName());
/**************************************************************************
* Get BackgroundType (Flat, Gradient, Lines, Texture)
@@ -596,7 +570,7 @@ public class AdempiereColor implements Serializable
if (!isTexture())
return null;
if (m_textureURL == null)
- m_textureURL = AdempiereColor.class.getResource("Adempiere00x100.gif");
+ m_textureURL = CompiereColor.class.getResource("Adempiere00x100.gif");
return m_textureURL;
} // getTextureURL
@@ -609,7 +583,7 @@ public class AdempiereColor implements Serializable
if (m_image == null)
{
URL url = getTextureURL();
- m_image = AdempiereUtils.loadBufferedImage(url, BufferedImage.TYPE_INT_ARGB_PRE);
+ m_image = CompiereUtils.loadBufferedImage(url, BufferedImage.TYPE_INT_ARGB_PRE);
}
return m_image;
} // getTextureImage
@@ -856,7 +830,7 @@ public class AdempiereColor implements Serializable
* Set AdempiereColor from AdempiereColor
* @param cc AdempiereColor
*/
- public void setColor (AdempiereColor cc)
+ public void setColor (CompiereColor cc)
{
if (cc == null)
return;
@@ -946,23 +920,23 @@ public class AdempiereColor implements Serializable
StringBuffer sb = new StringBuffer ("AdempiereColor[");
if (isFlat())
sb.append("Flat")
- .append(" ").append(CompiereTheme.getColorAsString(getFlatColor()));
+ .append(" ").append(ThemeUtils.getColorAsString(getFlatColor()));
else if (isGradient())
sb.append("Gradient")
- .append(" Upper=").append(CompiereTheme.getColorAsString(getGradientUpperColor()))
- .append(",Lower=").append(CompiereTheme.getColorAsString(getGradientLowerColor()))
+ .append(" Upper=").append(ThemeUtils.getColorAsString(getGradientUpperColor()))
+ .append(",Lower=").append(ThemeUtils.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(" Color=").append(ThemeUtils.getColorAsString(getLineColor()))
+ .append(",BackColor=").append(ThemeUtils.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(",Taint=").append(ThemeUtils.getColorAsString(getTextureTaintColor()))
.append(",Alpha=").append(getTextureCompositeAlpha());
sb.append("]");
return sb.toString();
@@ -977,15 +951,15 @@ public class AdempiereColor implements Serializable
if (str.indexOf("[Flat ") != -1)
{
m_type = TYPE_FLAT;
- m_primaryColor = CompiereTheme.parseColor(str,
+ m_primaryColor = ThemeUtils.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=")),
+ m_primaryColor = ThemeUtils.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=")),
+ m_secondaryColor = ThemeUtils.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("]")));
@@ -993,9 +967,9 @@ public class AdempiereColor implements Serializable
else if (str.indexOf("[Line ") != -1)
{
m_type = TYPE_LINES;
- m_primaryColor = CompiereTheme.parseColor(str.substring(str.indexOf(" Color=")+7, str.indexOf(",BackColor=")),
+ m_primaryColor = ThemeUtils.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=")),
+ m_secondaryColor = ThemeUtils.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("]")));
@@ -1004,7 +978,7 @@ public class AdempiereColor implements Serializable
{
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=")),
+ m_primaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",Taint=")+7, str.indexOf(",Alpha=")),
new ColorUIResource(m_primaryColor));
setTextureCompositeAlpha (str.substring(str.indexOf(",Alpha=")+7, str.lastIndexOf("]")));
}
diff --git a/looks/src/org/compiere/plaf/AdempiereComboBoxUI.java b/looks/src/org/compiere/plaf/CompiereComboBoxUI.java
similarity index 92%
rename from looks/src/org/compiere/plaf/AdempiereComboBoxUI.java
rename to looks/src/org/compiere/plaf/CompiereComboBoxUI.java
index d5f1b842e9..57e64879e1 100644
--- a/looks/src/org/compiere/plaf/AdempiereComboBoxUI.java
+++ b/looks/src/org/compiere/plaf/CompiereComboBoxUI.java
@@ -30,7 +30,7 @@ import javax.swing.plaf.metal.*;
* @author Jorg Janke
* @version $Id: AdempiereComboBoxUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereComboBoxUI extends MetalComboBoxUI
+public class CompiereComboBoxUI extends MetalComboBoxUI
{
/**
* Create UI
@@ -39,7 +39,7 @@ public class AdempiereComboBoxUI extends MetalComboBoxUI
*/
public static ComponentUI createUI(JComponent c)
{
- return new AdempiereComboBoxUI();
+ return new CompiereComboBoxUI();
} // CreateUI
/*************************************************************************/
@@ -102,7 +102,7 @@ public class AdempiereComboBoxUI extends MetalComboBoxUI
*/
protected ComboPopup createPopup()
{
- AdempiereComboPopup newPopup = new AdempiereComboPopup( comboBox );
+ CompiereComboPopup newPopup = new CompiereComboPopup( comboBox );
newPopup.getAccessibleContext().setAccessibleParent(comboBox);
return newPopup;
} // createPopup
diff --git a/looks/src/org/compiere/plaf/AdempiereComboPopup.java b/looks/src/org/compiere/plaf/CompiereComboPopup.java
similarity index 93%
rename from looks/src/org/compiere/plaf/AdempiereComboPopup.java
rename to looks/src/org/compiere/plaf/CompiereComboPopup.java
index 637b4fd8ff..49621d0c3a 100644
--- a/looks/src/org/compiere/plaf/AdempiereComboPopup.java
+++ b/looks/src/org/compiere/plaf/CompiereComboPopup.java
@@ -26,13 +26,13 @@ import org.compiere.swing.*;
* @author Jorg Janke
* @version $Id: AdempiereComboPopup.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereComboPopup extends BasicComboPopup
+public class CompiereComboPopup extends BasicComboPopup
{
/**
* Constructor
* @param combo
*/
- public AdempiereComboPopup(JComboBox combo)
+ public CompiereComboPopup(JComboBox combo)
{
super(combo);
} // AdempiereComboPopup
diff --git a/looks/src/org/compiere/plaf/AdempiereLabelUI.java b/looks/src/org/compiere/plaf/CompiereLabelUI.java
similarity index 92%
rename from looks/src/org/compiere/plaf/AdempiereLabelUI.java
rename to looks/src/org/compiere/plaf/CompiereLabelUI.java
index 3b7c3e7d60..cf844413aa 100644
--- a/looks/src/org/compiere/plaf/AdempiereLabelUI.java
+++ b/looks/src/org/compiere/plaf/CompiereLabelUI.java
@@ -30,17 +30,17 @@ import sun.swing.*;
* @author Jorg Janke
* @version $Id: AdempiereLabelUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereLabelUI extends MetalLabelUI
+public class CompiereLabelUI extends MetalLabelUI
{
/** Singleton */
- protected static AdempiereLabelUI adempiereLabelUI = new AdempiereLabelUI();
+ protected static CompiereLabelUI adempiereLabelUI = new CompiereLabelUI();
/**
* Create UI
* @param c component
* @return singleton
*/
- public static AdempiereLabelUI createUI(JComponent c)
+ public static CompiereLabelUI createUI(JComponent c)
{
return adempiereLabelUI;
} // createUI
diff --git a/looks/src/org/compiere/plaf/CompiereLookAndFeel.java b/looks/src/org/compiere/plaf/CompiereLookAndFeel.java
index 90e56d8206..c5ce52a437 100644
--- a/looks/src/org/compiere/plaf/CompiereLookAndFeel.java
+++ b/looks/src/org/compiere/plaf/CompiereLookAndFeel.java
@@ -22,7 +22,7 @@ import javax.swing.*;
import javax.swing.plaf.metal.*;
/**
- * Adempiere Look & Feel.
+ * Compiere Look & Feel.
* We wanted a nice UI not the battleship gray based stuff.
* I guess a matter of taste.
*
- * 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
+ @Override
+ public void addCustomEntriesToTable(UIDefaults table) {
+ super.addCustomEntriesToTable(table);
+ Object[] defaults =
{
- 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
-
+ ExtendedTheme.ERROR_BG_KEY,
+ error,
+ ExtendedTheme.ERROR_FG_KEY,
+ txt_error,
+ ExtendedTheme.INACTIVE_BG_KEY,
+ inactive,
+ ExtendedTheme.INFO_BG_KEY,
+ info,
+ ExtendedTheme.MANDATORY_BG_KEY,
+ mandatory
+ };
+ table.putDefaults(defaults);
+ }
} // AdempiereTheme
diff --git a/looks/src/org/compiere/plaf/CompiereThemeBlueMetal.java b/looks/src/org/compiere/plaf/CompiereThemeBlueMetal.java
index c1d3e8cb18..ec94d7704f 100644
--- a/looks/src/org/compiere/plaf/CompiereThemeBlueMetal.java
+++ b/looks/src/org/compiere/plaf/CompiereThemeBlueMetal.java
@@ -17,6 +17,8 @@
package org.compiere.plaf;
import java.awt.*;
+
+import javax.swing.UIDefaults;
import javax.swing.plaf.*;
/**
@@ -96,5 +98,5 @@ public class CompiereThemeBlueMetal extends CompiereTheme
menuFont = null;
_getMenuTextFont();
} // setDefault
-
+
} // AdempiereThemeBlueMetal
diff --git a/looks/src/org/compiere/plaf/AdempiereThemeEditor.java b/looks/src/org/compiere/plaf/CompiereThemeEditor.java
similarity index 96%
rename from looks/src/org/compiere/plaf/AdempiereThemeEditor.java
rename to looks/src/org/compiere/plaf/CompiereThemeEditor.java
index dbf6317f09..e7d9addc4e 100644
--- a/looks/src/org/compiere/plaf/AdempiereThemeEditor.java
+++ b/looks/src/org/compiere/plaf/CompiereThemeEditor.java
@@ -25,6 +25,7 @@ import javax.swing.border.*;
import javax.swing.plaf.*;
import javax.swing.plaf.metal.*;
+import org.adempiere.plaf.AdempierePLAF;
import org.compiere.swing.*;
/**
@@ -35,14 +36,14 @@ import org.compiere.swing.*;
* @author Jorg Janke
* @version $Id: AdempiereThemeEditor.java,v 1.3 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereThemeEditor extends CDialog
+public class CompiereThemeEditor extends CDialog
implements ActionListener
{
/**
* Constructor
* @param owner Frame owner
*/
- public AdempiereThemeEditor (JDialog owner)
+ public CompiereThemeEditor (JDialog owner)
{
super(owner, s_res.getString("AdempiereThemeEditor"), true);
try
@@ -291,7 +292,7 @@ public class AdempiereThemeEditor extends CDialog
// Confirm
if (e.getSource() == bOK)
{
- CompiereTheme.save();
+ //CompiereTheme.save();
dispose();
return;
}
diff --git a/looks/src/org/compiere/plaf/AdempiereToggleButtonUI.java b/looks/src/org/compiere/plaf/CompiereToggleButtonUI.java
similarity index 89%
rename from looks/src/org/compiere/plaf/AdempiereToggleButtonUI.java
rename to looks/src/org/compiere/plaf/CompiereToggleButtonUI.java
index e846d8685e..1f24e4c3cc 100644
--- a/looks/src/org/compiere/plaf/AdempiereToggleButtonUI.java
+++ b/looks/src/org/compiere/plaf/CompiereToggleButtonUI.java
@@ -27,7 +27,7 @@ import javax.swing.plaf.metal.*;
* @author Jorg Janke
* @version $Id: AdempiereToggleButtonUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereToggleButtonUI extends MetalToggleButtonUI
+public class CompiereToggleButtonUI extends MetalToggleButtonUI
{
/**
* Static Create UI
@@ -40,7 +40,7 @@ public class AdempiereToggleButtonUI extends MetalToggleButtonUI
} // createUI
/** UI shared */
- private static AdempiereToggleButtonUI s_toggleButtonUI = new AdempiereToggleButtonUI();
+ private static CompiereToggleButtonUI s_toggleButtonUI = new CompiereToggleButtonUI();
/**************************************************************************
@@ -72,7 +72,7 @@ public class AdempiereToggleButtonUI extends MetalToggleButtonUI
{
if (c.isOpaque()) // flat background
// AdempiereColor.getDefaultBackground().paint(g, c);
- AdempiereUtils.fillRectange((Graphics2D)g, c, CompiereLookAndFeel.ROUND);
+ CompiereUtils.fillRectange((Graphics2D)g, c, CompiereLookAndFeel.ROUND);
paint (g, c);
} // update
@@ -88,7 +88,7 @@ public class AdempiereToggleButtonUI extends MetalToggleButtonUI
ButtonModel model = b.getModel();
boolean in = model.isPressed() || model.isSelected();
//
- AdempiereUtils.paint3Deffect((Graphics2D)g, c, CompiereLookAndFeel.ROUND, !in);
+ CompiereUtils.paint3Deffect((Graphics2D)g, c, CompiereLookAndFeel.ROUND, !in);
} // paint
/**
diff --git a/looks/src/org/compiere/plaf/AdempiereToolBarUI.java b/looks/src/org/compiere/plaf/CompiereToolBarUI.java
similarity index 93%
rename from looks/src/org/compiere/plaf/AdempiereToolBarUI.java
rename to looks/src/org/compiere/plaf/CompiereToolBarUI.java
index 50f47ff30e..74a713469a 100644
--- a/looks/src/org/compiere/plaf/AdempiereToolBarUI.java
+++ b/looks/src/org/compiere/plaf/CompiereToolBarUI.java
@@ -26,7 +26,7 @@ import javax.swing.plaf.metal.*;
* @author Jorg Janke
* @version $Id: AdempiereToolBarUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereToolBarUI extends MetalToolBarUI
+public class CompiereToolBarUI extends MetalToolBarUI
{
/**
* Create UI (own instance)
@@ -35,7 +35,7 @@ public class AdempiereToolBarUI extends MetalToolBarUI
*/
public static ComponentUI createUI (JComponent c)
{
- return new AdempiereToolBarUI();
+ return new CompiereToolBarUI();
} // createUI
diff --git a/looks/src/org/compiere/plaf/AdempiereToolTipUI.java b/looks/src/org/compiere/plaf/CompiereToolTipUI.java
similarity index 93%
rename from looks/src/org/compiere/plaf/AdempiereToolTipUI.java
rename to looks/src/org/compiere/plaf/CompiereToolTipUI.java
index 83722b5c44..0488ca4825 100644
--- a/looks/src/org/compiere/plaf/AdempiereToolTipUI.java
+++ b/looks/src/org/compiere/plaf/CompiereToolTipUI.java
@@ -29,7 +29,7 @@ import javax.swing.plaf.metal.*;
* @author Jorg Janke
* @version $Id: AdempiereToolTipUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereToolTipUI extends MetalToolTipUI
+public class CompiereToolTipUI extends MetalToolTipUI
{
public static ComponentUI createUI(JComponent c)
@@ -37,7 +37,7 @@ public class AdempiereToolTipUI extends MetalToolTipUI
return sharedInstance;
}
- static AdempiereToolTipUI sharedInstance = new AdempiereToolTipUI();
+ static CompiereToolTipUI sharedInstance = new CompiereToolTipUI();
private JToolTip tip;
diff --git a/looks/src/org/compiere/plaf/AdempiereUtils.java b/looks/src/org/compiere/plaf/CompiereUtils.java
similarity index 93%
rename from looks/src/org/compiere/plaf/AdempiereUtils.java
rename to looks/src/org/compiere/plaf/CompiereUtils.java
index fd30b68dc6..2f1423893e 100644
--- a/looks/src/org/compiere/plaf/AdempiereUtils.java
+++ b/looks/src/org/compiere/plaf/CompiereUtils.java
@@ -23,6 +23,9 @@ import java.io.*;
import java.net.*;
import java.util.logging.*;
import javax.swing.*;
+
+import org.adempiere.plaf.AdempierePLAF;
+
import com.sun.image.codec.jpeg.*;
/**
@@ -31,11 +34,11 @@ import com.sun.image.codec.jpeg.*;
* @author Jorg Janke
* @version $Id: AdempiereUtils.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
*/
-public class AdempiereUtils
+public class CompiereUtils
{
/** Logger */
- private static Logger log = Logger.getLogger(AdempiereUtils.class.getName());
+ private static Logger log = Logger.getLogger(CompiereUtils.class.getName());
/**
* Fill Background with Color.
@@ -48,18 +51,18 @@ public class AdempiereUtils
public static void fillRectange(Graphics2D g2D, JComponent c, boolean round)
{
// Paint in AdempiereColor?
- AdempiereColor cc = null;
- boolean stdCC = c.getClientProperty(AdempierePLAF.BACKGROUND_FILL) != null;
+ CompiereColor cc = null;
+ boolean stdCC = c.getClientProperty(CompiereLookAndFeel.BACKGROUND_FILL) != null;
try
{
- cc = (AdempiereColor)c.getClientProperty(AdempierePLAF.BACKGROUND);
+ cc = (CompiereColor)c.getClientProperty(CompiereLookAndFeel.BACKGROUND);
}
catch (Exception e)
{
stdCC = true;
}
if (stdCC)
- cc = AdempiereColor.getDefaultBackground();
+ cc = CompiereColor.getDefaultBackground();
// Paint AdempiereColor
if (cc != null)
@@ -455,7 +458,7 @@ public class AdempiereUtils
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));
+ System.out.println (" ** " + c.isOpaque() + " bg=" + (c.getClientProperty(CompiereLookAndFeel.BACKGROUND) != null));
//
Container container = c.getParent();
while (container != null)
@@ -463,7 +466,7 @@ public class AdempiereUtils
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.print (" bg=" + (((JComponent)container).getClientProperty(CompiereLookAndFeel.BACKGROUND) != null));
System.out.println ();
container = container.getParent();
}
diff --git a/looks/src/org/compiere/plaf/AdempiereViewportUI.java b/looks/src/org/compiere/plaf/CompiereViewportUI.java
similarity index 93%
rename from looks/src/org/compiere/plaf/AdempiereViewportUI.java
rename to looks/src/org/compiere/plaf/CompiereViewportUI.java
index 2a8dbed456..db23dffa16 100644
--- a/looks/src/org/compiere/plaf/AdempiereViewportUI.java
+++ b/looks/src/org/compiere/plaf/CompiereViewportUI.java
@@ -27,7 +27,7 @@ import javax.swing.plaf.basic.BasicViewportUI;
* @author Jorg Janke
* @version $Id: AdempiereViewportUI.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
*/
-public class AdempiereViewportUI extends BasicViewportUI
+public class CompiereViewportUI extends BasicViewportUI
{
/** Shared UI object */
private static ViewportUI viewportUI;
@@ -40,7 +40,7 @@ public class AdempiereViewportUI extends BasicViewportUI
public static ComponentUI createUI (JComponent c)
{
if (viewportUI == null)
- viewportUI = new AdempiereViewportUI();
+ viewportUI = new CompiereViewportUI();
return viewportUI;
} // createUI
diff --git a/looks/src/org/compiere/plaf/PlafRes.java b/looks/src/org/compiere/plaf/PlafRes.java
index 7f4617afd5..4cb571f5f2 100644
--- a/looks/src/org/compiere/plaf/PlafRes.java
+++ b/looks/src/org/compiere/plaf/PlafRes.java
@@ -117,7 +117,9 @@ public class PlafRes extends ListResourceBundle
{ "LineBackColor", "Background Color" },
{ "LineWidth", "Line Width" },
{ "LineDistance", "Line Distance" },
- { "FlatColor", "Flat Color" }
+ { "FlatColor", "Flat Color" },
+ { "UITheme", "User Interface Theme" },
+ { "Preview", "Preview" }
};
/**
diff --git a/looks/src/org/compiere/swing/CButton.java b/looks/src/org/compiere/swing/CButton.java
index 739a00e221..0145a2cc78 100644
--- a/looks/src/org/compiere/swing/CButton.java
+++ b/looks/src/org/compiere/swing/CButton.java
@@ -18,6 +18,8 @@ package org.compiere.swing;
import java.awt.*;
import javax.swing.*;
+
+import org.adempiere.plaf.AdempierePLAF;
import org.compiere.plaf.*;
import org.compiere.util.*;
@@ -68,8 +70,6 @@ public class CButton extends JButton implements CEditor
public CButton (Action a)
{
super (a);
- setContentAreaFilled(false);
- setOpaque(false);
} // CButton
/**
@@ -81,11 +81,6 @@ public class CButton extends JButton implements CEditor
public CButton(String text, Icon icon)
{
super (text, icon);
- setContentAreaFilled(false);
- setOpaque(false);
- //
- setFont(AdempierePLAF.getFont_Label());
- setForeground(AdempierePLAF.getTextColor_Label());
} // CButton
@@ -99,12 +94,7 @@ public class CButton extends JButton implements CEditor
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);
- }
+ setBackgroundColor(new CompiereColor(bg));
this.repaint();
} // setBackground
@@ -128,12 +118,11 @@ public class CButton extends JButton implements CEditor
* Set Background
* @param bg AdempiereColor for Background, if null set standard background
*/
- public void setBackgroundColor (AdempiereColor bg)
+ public void setBackgroundColor (CompiereColor bg)
{
if (bg == null)
- bg = AdempiereColor.getDefaultBackground();
- setOpaque(true);
- putClientProperty(AdempierePLAF.BACKGROUND, bg);
+ bg = new CompiereColor(AdempierePLAF.getFormBackground());
+ putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
super.setBackground (bg.getFlatColor());
this.repaint();
} // setBackground
@@ -142,11 +131,11 @@ public class CButton extends JButton implements CEditor
* Get Background
* @return Color for Background
*/
- public AdempiereColor getBackgroundColor ()
+ public CompiereColor getBackgroundColor ()
{
try
{
- return (AdempiereColor)getClientProperty(AdempierePLAF.BACKGROUND);
+ return (CompiereColor)getClientProperty(CompiereLookAndFeel.BACKGROUND);
}
catch (Exception e)
{
diff --git a/looks/src/org/compiere/swing/CCheckBox.java b/looks/src/org/compiere/swing/CCheckBox.java
index 0f2ad113ce..24646bac32 100644
--- a/looks/src/org/compiere/swing/CCheckBox.java
+++ b/looks/src/org/compiere/swing/CCheckBox.java
@@ -22,7 +22,7 @@ import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JCheckBox;
-import org.compiere.plaf.AdempierePLAF;
+import org.adempiere.plaf.AdempierePLAF;
/**
* Adempiere CheckBox
@@ -135,8 +135,8 @@ public class CCheckBox extends JCheckBox implements CEditor
*/
private void init()
{
- setFont(AdempierePLAF.getFont_Label());
- setForeground(AdempierePLAF.getTextColor_Label());
+ //Default to transparent, works better under windows look and feel
+ setOpaque(false);
} // init
/*************************************************************************/
diff --git a/looks/src/org/compiere/swing/CComboBox.java b/looks/src/org/compiere/swing/CComboBox.java
index 91a3d89af2..4e5bb5cee1 100644
--- a/looks/src/org/compiere/swing/CComboBox.java
+++ b/looks/src/org/compiere/swing/CComboBox.java
@@ -21,6 +21,8 @@ import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.plaf.*;
+
+import org.adempiere.plaf.AdempierePLAF;
import org.compiere.plaf.*;
import org.compiere.util.*;
@@ -132,10 +134,6 @@ public class CComboBox extends JComboBox
*/
private void init()
{
- // overwrite - otherwise Label Font
- setFont(AdempierePLAF.getFont_Field());
- setForeground(AdempierePLAF.getTextColor_Normal());
- setBackground(false);
FIELD_HIGHT = getPreferredSize().height;
} // init
@@ -151,8 +149,8 @@ public class CComboBox extends JComboBox
*/
public void setIcon (Icon defaultIcon)
{
- if (getUI() instanceof AdempiereComboBoxUI)
- ((AdempiereComboBoxUI)getUI()).setIcon(defaultIcon);
+ if (getUI() instanceof CompiereComboBoxUI)
+ ((CompiereComboBoxUI)getUI()).setIcon(defaultIcon);
m_icon = defaultIcon;
} // setIcon
@@ -163,8 +161,8 @@ public class CComboBox extends JComboBox
public void setUI (ComboBoxUI ui)
{
super.setUI(ui);
- if (m_icon != null && ui instanceof AdempiereComboBoxUI)
- ((AdempiereComboBoxUI)getUI()).setIcon(m_icon);
+ if (m_icon != null && ui instanceof CompiereComboBoxUI)
+ ((CompiereComboBoxUI)getUI()).setIcon(m_icon);
} // setUI
/**
@@ -283,16 +281,16 @@ public class CComboBox extends JComboBox
* 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)
+ * @see CompiereComboBoxUI#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"))
+ if (getUI() instanceof CompiereComboBoxUI && !Trace.getCallerClass(1).startsWith("javax"))
{
- JButton b = ((AdempiereComboBoxUI)getUI()).getArrowButton();
+ JButton b = ((CompiereComboBoxUI)getUI()).getArrowButton();
if (b != null)
b.addMouseListener(ml);
}
@@ -313,9 +311,9 @@ public class CComboBox extends JComboBox
public void removeMouseListener (MouseListener ml)
{
super.removeMouseListener(ml);
- if (getUI() instanceof AdempiereComboBoxUI)
+ if (getUI() instanceof CompiereComboBoxUI)
{
- JButton b = ((AdempiereComboBoxUI)getUI()).getArrowButton();
+ JButton b = ((CompiereComboBoxUI)getUI()).getArrowButton();
if (b != null)
b.removeMouseListener(ml);
}
diff --git a/looks/src/org/compiere/swing/CDialog.java b/looks/src/org/compiere/swing/CDialog.java
index 5804a35264..dd3a478f9e 100644
--- a/looks/src/org/compiere/swing/CDialog.java
+++ b/looks/src/org/compiere/swing/CDialog.java
@@ -152,7 +152,6 @@ public class CDialog extends JDialog
protected void dialogInit()
{
super.dialogInit();
- AdempiereColor.setBackground(this);
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setTitle(getTitle()); // remove Mn
//
diff --git a/looks/src/org/compiere/swing/CField.java b/looks/src/org/compiere/swing/CField.java
index 0562712b3f..39d6a8ee70 100644
--- a/looks/src/org/compiere/swing/CField.java
+++ b/looks/src/org/compiere/swing/CField.java
@@ -35,7 +35,7 @@ import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.plaf.TextUI;
-import org.compiere.plaf.AdempierePLAF;
+import org.adempiere.plaf.AdempierePLAF;
/**
* Adempiere Colored Field with external popup editor.
diff --git a/looks/src/org/compiere/swing/CFrame.java b/looks/src/org/compiere/swing/CFrame.java
index b565a08293..1dff8a2c1a 100644
--- a/looks/src/org/compiere/swing/CFrame.java
+++ b/looks/src/org/compiere/swing/CFrame.java
@@ -76,7 +76,6 @@ public class CFrame extends JFrame
protected void frameInit ()
{
super.frameInit ();
- AdempiereColor.setBackground(this);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
//
Container c = getContentPane();
diff --git a/looks/src/org/compiere/swing/CLabel.java b/looks/src/org/compiere/swing/CLabel.java
index e917dbaa19..acaa279f30 100644
--- a/looks/src/org/compiere/swing/CLabel.java
+++ b/looks/src/org/compiere/swing/CLabel.java
@@ -174,9 +174,6 @@ public class CLabel extends JLabel
setOpaque(false);
if (getToolTipText() == null) // force Tool Tip
setToolTipText(getText());
- //
- setForeground(AdempierePLAF.getTextColor_Label());
- setFont(AdempierePLAF.getFont_Label());
} // init
diff --git a/looks/src/org/compiere/swing/CPanel.java b/looks/src/org/compiere/swing/CPanel.java
index d747b8fe88..cac704ee6d 100644
--- a/looks/src/org/compiere/swing/CPanel.java
+++ b/looks/src/org/compiere/swing/CPanel.java
@@ -18,6 +18,8 @@ package org.compiere.swing;
import java.awt.*;
import javax.swing.*;
+
+import org.adempiere.plaf.AdempierePLAF;
import org.compiere.plaf.*;
import org.compiere.util.*;
@@ -79,7 +81,7 @@ public class CPanel extends JPanel
* Creates a new
+ * 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
+ */
+ public 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
+ */
+ public 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
+
+ // Static property info
+ public static final String P_Primary1 = "#ColorPrimary1";
+ public static final String P_Primary2 = "#ColorPrimary2";
+ public static final String P_Primary3 = "#ColorPrimary3";
+ public static final String P_Secondary1 = "#ColorSecondary1";
+ public static final String P_Secondary2 = "#ColorSecondary2";
+ public static final String P_Secondary3 = "#ColorSecondary3";
+ public static final String P_Black = "#ColorBlack";
+ public static final String P_White = "#ColorWhite";
+ public static final String P_Error = "#ColorError";
+ public static final String P_Info = "#ColorInfo";
+ public static final String P_Mandatory = "#ColorMandatory";
+ public static final String P_Inactive = "#ColorInactive";
+ public static final String P_Txt_OK = "#ColorTextOK";
+ public static final String P_Txt_Error = "#ColorTextError";
+ //
+ public static final String P_Control = "#FontControl";
+ public static final String P_System = "#FontSystem";
+ public static final String P_User = "#FontUser";
+ public static final String P_Small = "#FontSmall";
+ public static final String P_Window = "#FontWindow";
+ public static final String P_Menu = "#FontMenu";
+
+ /**
+ * Save information in Properties
+ */
+ public static void save (Properties properties, MetalTheme theme)
+ {
+ log.config(CompiereColor.getDefaultBackground().toString());
+ //
+ properties.setProperty(P_Primary1, getColorAsString(theme.getPrimaryControlDarkShadow()));
+ properties.setProperty(P_Primary2, getColorAsString(theme.getPrimaryControlShadow()));
+ properties.setProperty(P_Primary3, getColorAsString(theme.getPrimaryControl()));
+ properties.setProperty(P_Secondary1, getColorAsString(theme.getControlDarkShadow()));
+ properties.setProperty(P_Secondary2, getColorAsString(theme.getControlShadow()));
+ properties.setProperty(P_Secondary3, getColorAsString(theme.getControl()));
+ properties.setProperty(P_Txt_OK, getColorAsString(theme.getUserTextColor()));
+
+ if ( theme instanceof ExtendedTheme ) {
+ ExtendedTheme e = (ExtendedTheme)theme;
+ properties.setProperty(P_Error, getColorAsString(e.getErrorBackground()));
+ properties.setProperty(P_Txt_Error, getColorAsString(e.getErrorForeground()));
+ properties.setProperty(P_Mandatory, getColorAsString(e.getMandatoryBackground()));
+ properties.setProperty(P_Inactive, getColorAsString(e.getInactiveBackground()));
+ properties.setProperty(P_White, getColorAsString(e.getWhite()));
+ properties.setProperty(P_Black, getColorAsString(e.getBlack()));
+ properties.setProperty(P_Info, getColorAsString(e.getInfoBackground()));
+ } else {
+ properties.setProperty(P_White, getColorAsString(Color.white));
+ properties.setProperty(P_Black, getColorAsString(Color.black));
+ properties.setProperty(P_Error, getColorAsString(ExtendedTheme.DEFAULT_ERROR_BG));
+ properties.setProperty(P_Txt_Error, getColorAsString(ExtendedTheme.DEFAULT_ERROR_FG));
+ properties.setProperty(P_Mandatory, getColorAsString(ExtendedTheme.DEFAULT_MANDATORY_BG));
+ properties.setProperty(P_Inactive, getColorAsString(ExtendedTheme.DEFAULT_INACTIVE_BG));
+ properties.setProperty(P_Info, getColorAsString(theme.getPrimaryControl()));
+ }
+
+ //
+ properties.setProperty(P_Control, (theme.getControlTextFont()).toString());
+ properties.setProperty(P_System, (theme.getSystemTextFont()).toString());
+ properties.setProperty(P_User, (theme.getUserTextFont()).toString());
+ properties.setProperty(P_Small, (theme.getSubTextFont()).toString());
+ properties.setProperty(P_Window, (theme.getWindowTitleFont()).toString());
+ properties.setProperty(P_Menu, (theme.getMenuTextFont()).toString());
+
+ } // save
+
+
+ /**
+ * Load Properties from properties
+ */
+ public static void load (Properties properties, ExtendedTheme theme)
+ {
+ Map
@@ -49,12 +49,22 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
public static final String NAME = "Compiere";
/** The Theme */
- private static CompiereTheme s_adempiereTheme = new CompiereThemeBlueMetal();
- private static MetalTheme s_theme = s_adempiereTheme;
+ private static CompiereTheme s_compiereTheme = new CompiereThemeBlueMetal();
+ private static MetalTheme s_theme = s_compiereTheme;
/** Paint Round Corners */
protected static boolean ROUND = false;
-
+
+ /** Key of Client Property to paint in CompiereColor */
+ public static final String BACKGROUND = "CompiereBackground";
+ /** Key of Client Property for Rectangle Items - if exists, the standard background is used */
+ public static final String BACKGROUND_FILL = "CompiereBackgroundFill";
+ /** Key of Client Property for CPanel */
+ public static final String TABLEVEL = "CompiereTabLevel";
+
+ /** Version tag */
+ public static final String VERSION = "R1.4.0";
+
/**
* The Name
* @return Name
@@ -79,7 +89,7 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
*/
public String getDescription()
{
- return "Adempiere Look & Feel - (c) 2001-2005 Jorg Janke";
+ return "Compiere Look & Feel - (c) 2001-2005 Jorg Janke";
} // getDescription
@@ -89,7 +99,6 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
*/
public UIDefaults getDefaults()
{
- // System.out.println("AdempiereLookAndFeel.getDefaults");
// Theme already created/set
MetalLookAndFeel.setCurrentTheme(s_theme);
UIDefaults defaults = super.getDefaults(); // calls init..Defaults
@@ -105,7 +114,6 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
*/
protected void initClassDefaults(UIDefaults table)
{
- // System.out.println("AdempiereLookAndFeel.initClassDefaults");
super.initClassDefaults( table);
// Overwrite
putDefault (table, "PanelUI");
@@ -140,7 +148,7 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
{
try
{
- String className = "org.compiere.plaf.Adempiere" + uiKey;
+ String className = "org.compiere.plaf.Compiere" + uiKey;
table.put(uiKey, className);
}
catch (Exception ex)
@@ -155,11 +163,7 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
*/
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
/**
@@ -168,7 +172,6 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
*/
protected void initComponentDefaults (UIDefaults table)
{
- // System.out.println("AdempiereLookAndFeel.initComponentDefaults");
super.initComponentDefaults( table);
// ComboBox defaults
@@ -207,12 +210,12 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
} // getCurrentTheme
/**
- * Get Adempiere Theme
+ * Get Compiere Theme
* @return Metal Theme
*/
- public static CompiereTheme getAdempiereTheme()
+ public static CompiereTheme getCompiereTheme()
{
- return s_adempiereTheme;
+ return s_compiereTheme;
} // getCurrentTheme
/**
diff --git a/looks/src/org/compiere/plaf/AdempiereMenuBarUI.java b/looks/src/org/compiere/plaf/CompiereMenuBarUI.java
similarity index 90%
rename from looks/src/org/compiere/plaf/AdempiereMenuBarUI.java
rename to looks/src/org/compiere/plaf/CompiereMenuBarUI.java
index 1da07ed041..d3929a80c7 100644
--- a/looks/src/org/compiere/plaf/AdempiereMenuBarUI.java
+++ b/looks/src/org/compiere/plaf/CompiereMenuBarUI.java
@@ -28,7 +28,7 @@ import javax.swing.plaf.metal.*;
* @author Jorg Janke
* @version $Id: AdempiereMenuBarUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereMenuBarUI extends MetalMenuBarUI
+public class CompiereMenuBarUI extends MetalMenuBarUI
{
/**
* Create own instance
@@ -37,7 +37,7 @@ public class AdempiereMenuBarUI extends MetalMenuBarUI
*/
public static ComponentUI createUI (JComponent x)
{
- return new AdempiereMenuBarUI();
+ return new CompiereMenuBarUI();
} // createUI
/**
@@ -60,7 +60,7 @@ public class AdempiereMenuBarUI extends MetalMenuBarUI
if (c.isOpaque())
{
// Get AdempiereColor
- AdempiereColor bg = AdempiereColor.getDefaultBackground();
+ CompiereColor bg = CompiereColor.getDefaultBackground();
bg.paint (g, c);
}
else
diff --git a/looks/src/org/compiere/plaf/AdempiereMenuItemUI.java b/looks/src/org/compiere/plaf/CompiereMenuItemUI.java
similarity index 89%
rename from looks/src/org/compiere/plaf/AdempiereMenuItemUI.java
rename to looks/src/org/compiere/plaf/CompiereMenuItemUI.java
index 57a7220e0c..5a665e8f82 100644
--- a/looks/src/org/compiere/plaf/AdempiereMenuItemUI.java
+++ b/looks/src/org/compiere/plaf/CompiereMenuItemUI.java
@@ -27,7 +27,7 @@ import javax.swing.plaf.basic.*;
* @author Jorg Janke
* @version $Id: AdempiereMenuItemUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereMenuItemUI extends BasicMenuItemUI
+public class CompiereMenuItemUI extends BasicMenuItemUI
{
/**
* Create own instance
@@ -36,7 +36,7 @@ public class AdempiereMenuItemUI extends BasicMenuItemUI
*/
public static ComponentUI createUI(JComponent c)
{
- return new AdempiereMenuItemUI();
+ return new CompiereMenuItemUI();
} // createUI
/**
@@ -58,7 +58,7 @@ public class AdempiereMenuItemUI extends BasicMenuItemUI
{
if (c.isOpaque())
{
- AdempiereColor bg = AdempiereColor.getDefaultBackground();
+ CompiereColor bg = CompiereColor.getDefaultBackground();
bg.paint (g, c);
//
// g.setColor(c.getBackground());
@@ -80,7 +80,7 @@ public class AdempiereMenuItemUI extends BasicMenuItemUI
super.paintBackground (g, menuItem, bgColor);
else
{
- AdempiereColor bg = AdempiereColor.getDefaultBackground();
+ CompiereColor bg = CompiereColor.getDefaultBackground();
bg.paint (g, menuItem);
}
} // paintBackground
diff --git a/looks/src/org/compiere/plaf/AdempiereMenuUI.java b/looks/src/org/compiere/plaf/CompiereMenuUI.java
similarity index 93%
rename from looks/src/org/compiere/plaf/AdempiereMenuUI.java
rename to looks/src/org/compiere/plaf/CompiereMenuUI.java
index cbf8fe6950..87b93545a1 100644
--- a/looks/src/org/compiere/plaf/AdempiereMenuUI.java
+++ b/looks/src/org/compiere/plaf/CompiereMenuUI.java
@@ -27,7 +27,7 @@ import javax.swing.plaf.basic.BasicMenuUI;
* @author Jorg Janke
* @version $Id: AdempiereMenuUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereMenuUI extends BasicMenuUI
+public class CompiereMenuUI extends BasicMenuUI
{
/**
* Create own instance
@@ -36,7 +36,7 @@ public class AdempiereMenuUI extends BasicMenuUI
*/
public static ComponentUI createUI(JComponent x)
{
- return new AdempiereMenuUI();
+ return new CompiereMenuUI();
} // createUI
/**
diff --git a/looks/src/org/compiere/plaf/AdempierePanelUI.java b/looks/src/org/compiere/plaf/CompierePanelUI.java
similarity index 75%
rename from looks/src/org/compiere/plaf/AdempierePanelUI.java
rename to looks/src/org/compiere/plaf/CompierePanelUI.java
index 074088f981..60b537de41 100644
--- a/looks/src/org/compiere/plaf/AdempierePanelUI.java
+++ b/looks/src/org/compiere/plaf/CompierePanelUI.java
@@ -21,6 +21,8 @@ import javax.swing.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
+import org.adempiere.plaf.AdempierePLAF;
+
/**
* Panel UI.
* The default properties can be set via
@@ -37,7 +39,7 @@ import javax.swing.plaf.basic.*;
* @author Jorg Janke
* @version $Id: AdempierePanelUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempierePanelUI extends BasicPanelUI
+public class CompierePanelUI extends BasicPanelUI
{
/**
* Static Create UI
@@ -51,7 +53,7 @@ public class AdempierePanelUI extends BasicPanelUI
} // createUI
/** UI */
- private static AdempierePanelUI s_panelUI = new AdempierePanelUI();
+ private static CompierePanelUI s_panelUI = new CompierePanelUI();
/**************************************************************************
@@ -104,10 +106,10 @@ public class AdempierePanelUI extends BasicPanelUI
// System.out.print(" - Background: ");
// Get AdempiereColor
- AdempiereColor bg = null;
+ CompiereColor bg = null;
try
{
- bg = (AdempiereColor)c.getClientProperty(AdempierePLAF.BACKGROUND);
+ bg = (CompiereColor)c.getClientProperty(CompiereLookAndFeel.BACKGROUND);
}
catch (Exception e)
{
@@ -130,48 +132,5 @@ public class AdempierePanelUI extends BasicPanelUI
/*************************************************************************/
- /** 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/CompiereRadioButtonUI.java
similarity index 90%
rename from looks/src/org/compiere/plaf/AdempiereRadioButtonUI.java
rename to looks/src/org/compiere/plaf/CompiereRadioButtonUI.java
index 38fdae696c..c9198dbbe4 100644
--- a/looks/src/org/compiere/plaf/AdempiereRadioButtonUI.java
+++ b/looks/src/org/compiere/plaf/CompiereRadioButtonUI.java
@@ -26,7 +26,7 @@ import javax.swing.plaf.metal.*;
* @author Jorg Janke
* @version $Id: AdempiereRadioButtonUI.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
*/
-public class AdempiereRadioButtonUI extends MetalRadioButtonUI
+public class CompiereRadioButtonUI extends MetalRadioButtonUI
{
/**
* Create UI
@@ -39,7 +39,7 @@ public class AdempiereRadioButtonUI extends MetalRadioButtonUI
} // createUI
/** UI */
- private static final AdempiereRadioButtonUI s_radioButtonUI = new AdempiereRadioButtonUI();
+ private static final CompiereRadioButtonUI s_radioButtonUI = new CompiereRadioButtonUI();
/**************************************************************************
diff --git a/looks/src/org/compiere/plaf/AdempiereRootPaneUI.java b/looks/src/org/compiere/plaf/CompiereRootPaneUI.java
similarity index 94%
rename from looks/src/org/compiere/plaf/AdempiereRootPaneUI.java
rename to looks/src/org/compiere/plaf/CompiereRootPaneUI.java
index bba7b073e6..0835a26cbe 100644
--- a/looks/src/org/compiere/plaf/AdempiereRootPaneUI.java
+++ b/looks/src/org/compiere/plaf/CompiereRootPaneUI.java
@@ -24,7 +24,7 @@ import javax.swing.plaf.metal.MetalRootPaneUI;
* @author Jorg Janke
* @version $Id: AdempiereRootPaneUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereRootPaneUI extends MetalRootPaneUI
+public class CompiereRootPaneUI extends MetalRootPaneUI
{
/**
* MetalTitlePane does the Layout & Painting of the Window including System MenuBar
diff --git a/looks/src/org/compiere/plaf/AdempiereScrollPaneUI.java b/looks/src/org/compiere/plaf/CompiereScrollPaneUI.java
similarity index 92%
rename from looks/src/org/compiere/plaf/AdempiereScrollPaneUI.java
rename to looks/src/org/compiere/plaf/CompiereScrollPaneUI.java
index 6b5a619907..1e9ebc33b4 100644
--- a/looks/src/org/compiere/plaf/AdempiereScrollPaneUI.java
+++ b/looks/src/org/compiere/plaf/CompiereScrollPaneUI.java
@@ -26,7 +26,7 @@ import javax.swing.plaf.metal.*;
* @author Jorg Janke
* @version $Id: AdempiereScrollPaneUI.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
*/
-public class AdempiereScrollPaneUI extends MetalScrollPaneUI
+public class CompiereScrollPaneUI extends MetalScrollPaneUI
{
/**
* Create UI (not shared)
@@ -35,7 +35,7 @@ public class AdempiereScrollPaneUI extends MetalScrollPaneUI
*/
public static ComponentUI createUI(JComponent x)
{
- return new AdempiereScrollPaneUI();
+ return new CompiereScrollPaneUI();
} // createUI
/**
diff --git a/looks/src/org/compiere/plaf/AdempiereSplitPaneDivider.java b/looks/src/org/compiere/plaf/CompiereSplitPaneDivider.java
similarity index 92%
rename from looks/src/org/compiere/plaf/AdempiereSplitPaneDivider.java
rename to looks/src/org/compiere/plaf/CompiereSplitPaneDivider.java
index 6ef6f38f96..f15cfd4e5e 100644
--- a/looks/src/org/compiere/plaf/AdempiereSplitPaneDivider.java
+++ b/looks/src/org/compiere/plaf/CompiereSplitPaneDivider.java
@@ -25,13 +25,13 @@ import javax.swing.plaf.basic.*;
* @author Jorg Janke
* @version $Id: AdempiereSplitPaneDivider.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-class AdempiereSplitPaneDivider extends BasicSplitPaneDivider
+class CompiereSplitPaneDivider extends BasicSplitPaneDivider
{
/**
* Constructor
* @param ui
*/
- public AdempiereSplitPaneDivider (BasicSplitPaneUI ui)
+ public CompiereSplitPaneDivider (BasicSplitPaneUI ui)
{
super (ui);
// BasicBorders$SplitPaneDividerBorder - ignored set after constructor
diff --git a/looks/src/org/compiere/plaf/AdempiereSplitPaneUI.java b/looks/src/org/compiere/plaf/CompiereSplitPaneUI.java
similarity index 91%
rename from looks/src/org/compiere/plaf/AdempiereSplitPaneUI.java
rename to looks/src/org/compiere/plaf/CompiereSplitPaneUI.java
index db50024d39..0410672185 100644
--- a/looks/src/org/compiere/plaf/AdempiereSplitPaneUI.java
+++ b/looks/src/org/compiere/plaf/CompiereSplitPaneUI.java
@@ -27,7 +27,7 @@ import javax.swing.plaf.basic.*;
* @author Jorg Janke
* @version $Id: AdempiereSplitPaneUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereSplitPaneUI extends BasicSplitPaneUI
+public class CompiereSplitPaneUI extends BasicSplitPaneUI
{
/**
* Creates a new MetalSplitPaneUI instance
@@ -36,7 +36,7 @@ public class AdempiereSplitPaneUI extends BasicSplitPaneUI
*/
public static ComponentUI createUI (JComponent x)
{
- return new AdempiereSplitPaneUI();
+ return new CompiereSplitPaneUI();
} // createUI
/**
@@ -45,7 +45,7 @@ public class AdempiereSplitPaneUI extends BasicSplitPaneUI
*/
public BasicSplitPaneDivider createDefaultDivider()
{
- return new AdempiereSplitPaneDivider (this);
+ return new CompiereSplitPaneDivider (this);
}
/**
diff --git a/looks/src/org/compiere/plaf/AdempiereTabbedPaneUI.java b/looks/src/org/compiere/plaf/CompiereTabbedPaneUI.java
similarity index 93%
rename from looks/src/org/compiere/plaf/AdempiereTabbedPaneUI.java
rename to looks/src/org/compiere/plaf/CompiereTabbedPaneUI.java
index de81523b13..40540e8470 100644
--- a/looks/src/org/compiere/plaf/AdempiereTabbedPaneUI.java
+++ b/looks/src/org/compiere/plaf/CompiereTabbedPaneUI.java
@@ -22,15 +22,17 @@ import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import javax.swing.plaf.metal.*;
+import org.adempiere.plaf.AdempierePLAF;
+
/**
* Same implementation detail as in AdempierePanelUI.
* Additional handling of dwawing tabs.
- * @see AdempierePanelUI
+ * @see CompierePanelUI
*
* @author Jorg Janke
* @version $Id: AdempiereTabbedPaneUI.java,v 1.3 2006/07/30 00:52:23 jjanke Exp $
*/
-public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
+public class CompiereTabbedPaneUI extends MetalTabbedPaneUI
{
/**
* Static Create UI
@@ -39,7 +41,7 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
*/
public static ComponentUI createUI(JComponent c)
{
- return new AdempiereTabbedPaneUI();
+ return new CompiereTabbedPaneUI();
} // createUI
/**
@@ -82,7 +84,7 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
// System.out.println("Tab: Bounds=" + c.getBounds() + " - " + c.getClass().getName());
if (c.isOpaque())
- AdempierePanelUI.updateIt (g, c); // tabAreaBackground
+ CompierePanelUI.updateIt (g, c); // tabAreaBackground
paint (g, c);
} // update
@@ -172,13 +174,13 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
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();
+ CompiereColor bg = CompiereColor.getDefaultBackground();
if (comp instanceof JPanel)
{
JPanel jp = (JPanel)comp;
try
{
- bg = (AdempiereColor)jp.getClientProperty(AdempierePLAF.BACKGROUND);
+ bg = (CompiereColor)jp.getClientProperty(CompiereLookAndFeel.BACKGROUND);
}
catch (Exception e)
{
@@ -188,7 +190,7 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
if (bg == null) // No Background
{
- if (AdempiereUtils.isLeftToRight(tabPane))
+ if (CompiereUtils.isLeftToRight(tabPane))
{
switch (tabPlacement)
{
@@ -236,7 +238,7 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
}
else // we have a background
{
- if (AdempiereUtils.isLeftToRight(tabPane))
+ if (CompiereUtils.isLeftToRight(tabPane))
{
switch (tabPlacement)
{
@@ -298,8 +300,8 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
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);
+ x, y, CompiereUtils.COL_1TOP,
+ x, y+(h/2), CompiereUtils.COL_1END);
g2D.setPaint(paint);
g2D.fill(top);
}
@@ -314,8 +316,8 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
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);
+ x, y+(h/2), CompiereUtils.COL_2TOP,
+ x, y+h, CompiereUtils.COL_2END);
g2D.setPaint(paint);
g2D.fill(end);
}
@@ -367,11 +369,11 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
if (comp != null && comp instanceof JComponent)
{
JComponent jc = (JComponent)comp;
- AdempiereColor bg = null;
+ CompiereColor bg = null;
try
{
if (jc != null)
- bg = (AdempiereColor)jc.getClientProperty(AdempierePLAF.BACKGROUND);
+ bg = (CompiereColor)jc.getClientProperty(CompiereLookAndFeel.BACKGROUND);
}
catch (Exception e)
{
@@ -379,8 +381,8 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
}
if (bg == null)
{
- bg = new AdempiereColor(jc.getBackground());
- jc.putClientProperty(AdempierePLAF.BACKGROUND, bg);
+ bg = new CompiereColor(jc.getBackground());
+ jc.putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
}
bg.paintRect(g, jc, x,y, w,h);
}
@@ -444,7 +446,7 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
protected void paintContentBorderBottomEdge (Graphics g, int tabPlacement,
int selectedIndex, int x, int y, int w, int h)
{
- boolean leftToRight = AdempiereUtils.isLeftToRight(tabPane);
+ boolean leftToRight = CompiereUtils.isLeftToRight(tabPane);
int bottom = y + h - 1;
int right = x + w - 1;
Rectangle selRect = selectedIndex < 0 ? null : getTabBounds(selectedIndex, calcRect);
@@ -566,7 +568,7 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
int currentRun = getRunForTab( tabPane.getTabCount(), tabIndex );
int lastIndex = lastTabInRun( tabPane.getTabCount(), currentRun );
int firstIndex = tabRuns[ currentRun ];
- boolean leftToRight = AdempiereUtils.isLeftToRight(tabPane);
+ boolean leftToRight = CompiereUtils.isLeftToRight(tabPane);
int bottom = h - 1;
int right = w - 1;
@@ -1021,7 +1023,7 @@ public class AdempiereTabbedPaneUI extends MetalTabbedPaneUI
JComponent jc = (JComponent)comp;
try
{
- Integer ll = (Integer)jc.getClientProperty(AdempierePLAF.TABLEVEL);
+ Integer ll = (Integer)jc.getClientProperty(CompiereLookAndFeel.TABLEVEL);
if (ll != null)
level = ll.intValue();
}
diff --git a/looks/src/org/compiere/plaf/AdempiereTableHeaderUI.java b/looks/src/org/compiere/plaf/CompiereTableHeaderUI.java
similarity index 87%
rename from looks/src/org/compiere/plaf/AdempiereTableHeaderUI.java
rename to looks/src/org/compiere/plaf/CompiereTableHeaderUI.java
index 8d4d61ab52..1c65d1785c 100644
--- a/looks/src/org/compiere/plaf/AdempiereTableHeaderUI.java
+++ b/looks/src/org/compiere/plaf/CompiereTableHeaderUI.java
@@ -30,7 +30,7 @@ import javax.swing.plaf.basic.BasicTableHeaderUI;
* @author Jorg Janke
* @version $Id: AdempiereTableHeaderUI.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereTableHeaderUI extends BasicTableHeaderUI
+public class CompiereTableHeaderUI extends BasicTableHeaderUI
{
/**
* Static Create UI
@@ -39,7 +39,7 @@ public class AdempiereTableHeaderUI extends BasicTableHeaderUI
*/
public static ComponentUI createUI(JComponent c)
{
- return new AdempiereTableHeaderUI();
+ return new CompiereTableHeaderUI();
} // createUI
@@ -52,8 +52,8 @@ public class AdempiereTableHeaderUI extends BasicTableHeaderUI
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");
+ //c.setOpaque(true);
+ //c.putClientProperty(AdempierePLAF.BACKGROUND_FILL, "Y");
} // installUI
@@ -76,7 +76,7 @@ public class AdempiereTableHeaderUI extends BasicTableHeaderUI
{
// AdempiereUtils.printParents (c); // Parent is JViewpoint
if (c.isOpaque()) // flat
- AdempiereUtils.fillRectange((Graphics2D)g, c, CompiereLookAndFeel.ROUND);
+ CompiereUtils.fillRectange((Graphics2D)g, c, CompiereLookAndFeel.ROUND);
//
paint (g, c);
} // update
@@ -89,7 +89,7 @@ public class AdempiereTableHeaderUI extends BasicTableHeaderUI
public void paint(Graphics g, JComponent c)
{
super.paint( g, c);
- AdempiereUtils.paint3Deffect((Graphics2D)g, c, CompiereLookAndFeel.ROUND, true);
+ CompiereUtils.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/CompiereTextAreaUI.java
similarity index 93%
rename from looks/src/org/compiere/plaf/AdempiereTextAreaUI.java
rename to looks/src/org/compiere/plaf/CompiereTextAreaUI.java
index e5aad468c0..25a3e3c26a 100644
--- a/looks/src/org/compiere/plaf/AdempiereTextAreaUI.java
+++ b/looks/src/org/compiere/plaf/CompiereTextAreaUI.java
@@ -26,7 +26,7 @@ import javax.swing.plaf.basic.*;
import javax.swing.text.*;
-public class AdempiereTextAreaUI extends BasicTextAreaUI
+public class CompiereTextAreaUI extends BasicTextAreaUI
{
/**
* Creates a UI for a JTextArea.
@@ -37,14 +37,14 @@ public class AdempiereTextAreaUI extends BasicTextAreaUI
*/
public static ComponentUI createUI(JComponent ta)
{
- return new AdempiereTextAreaUI(ta);
+ return new CompiereTextAreaUI(ta);
}
/**
* Constructor
* @param ta text area
*/
- public AdempiereTextAreaUI (JComponent ta)
+ public CompiereTextAreaUI (JComponent ta)
{
if (ta instanceof JTextComponent)
m_editor = (JTextComponent)ta;
diff --git a/looks/src/org/compiere/plaf/CompiereTheme.java b/looks/src/org/compiere/plaf/CompiereTheme.java
index 70c8d4c1c9..73eef28db1 100644
--- a/looks/src/org/compiere/plaf/CompiereTheme.java
+++ b/looks/src/org/compiere/plaf/CompiereTheme.java
@@ -18,13 +18,19 @@ package org.compiere.plaf;
import java.awt.*;
import java.util.logging.*;
+
+import javax.swing.UIDefaults;
import javax.swing.plaf.*;
import javax.swing.plaf.metal.*;
+
+import org.compiere.swing.ColorBlind;
+import org.compiere.swing.ExtendedTheme;
import org.compiere.util.*;
+
import sun.awt.*;
/**
- * Adempiere User definable Theme (if used in Metal L&F).
+ * Compiere User definable Theme (if used in Metal L&F).
* In other Environments, it provides UI extensions (e.g. Error Color)
*
* @author Jorg Janke
@@ -135,49 +141,6 @@ public class CompiereTheme extends MetalTheme
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
@@ -361,241 +324,22 @@ public class CompiereTheme extends MetalTheme
}
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.
- *
CPanel
with a double buffer and a flow layout.
* @param bc Initial Background Color
*/
- public CPanel(AdempiereColor bc)
+ public CPanel(CompiereColor bc)
{
this ();
init();
@@ -107,20 +109,20 @@ public class CPanel extends JPanel
return;
super.setBackground (bg);
// ignore calls from javax.swing.LookAndFeel.installColors(LookAndFeel.java:61)
- if (!Trace.getCallerClass(1).startsWith("javax"))
- setBackgroundColor (new AdempiereColor(bg));
+ //if (!Trace.getCallerClass(1).startsWith("javax"))
+ setBackgroundColor (new CompiereColor(bg));
} // setBackground
/**
* Set Background
* @param bg AdempiereColor for Background, if null set standard background
*/
- public void setBackgroundColor (AdempiereColor bg)
+ public void setBackgroundColor (CompiereColor bg)
{
if (bg == null)
- bg = AdempierePanelUI.getDefaultBackground();
+ bg = new CompiereColor(AdempierePLAF.getFormBackground());
setOpaque(true); // not transparent
- putClientProperty(AdempierePLAF.BACKGROUND, bg);
+ putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
super.setBackground (bg.getFlatColor());
} // setBackground
@@ -128,11 +130,11 @@ public class CPanel extends JPanel
* Get Background
* @return Color for Background
*/
- public AdempiereColor getBackgroundColor ()
+ public CompiereColor getBackgroundColor ()
{
try
{
- return (AdempiereColor)getClientProperty(AdempierePLAF.BACKGROUND);
+ return (CompiereColor)getClientProperty(CompiereLookAndFeel.BACKGROUND);
}
catch (Exception e)
{
@@ -152,9 +154,9 @@ public class CPanel extends JPanel
public void setTabLevel (int level)
{
if (level == 0)
- putClientProperty(AdempierePLAF.TABLEVEL, null);
+ putClientProperty(CompiereLookAndFeel.TABLEVEL, null);
else
- putClientProperty(AdempierePLAF.TABLEVEL, new Integer(level));
+ putClientProperty(CompiereLookAndFeel.TABLEVEL, new Integer(level));
} // setTabLevel
/**
@@ -165,7 +167,7 @@ public class CPanel extends JPanel
{
try
{
- Integer ll = (Integer)getClientProperty(AdempierePLAF.TABLEVEL);
+ Integer ll = (Integer)getClientProperty(CompiereLookAndFeel.TABLEVEL);
if (ll != null)
return ll.intValue();
}
@@ -185,7 +187,7 @@ public class CPanel extends JPanel
{
StringBuffer sb = new StringBuffer ("CPanel [");
sb.append(super.toString());
- AdempiereColor bg = getBackgroundColor();
+ CompiereColor bg = getBackgroundColor();
if (bg != null)
sb.append(bg.toString());
sb.append("]");
diff --git a/looks/src/org/compiere/swing/CPassword.java b/looks/src/org/compiere/swing/CPassword.java
index 5e4b9257a8..9ba5a487c1 100644
--- a/looks/src/org/compiere/swing/CPassword.java
+++ b/looks/src/org/compiere/swing/CPassword.java
@@ -21,7 +21,7 @@ import java.awt.Color;
import javax.swing.JPasswordField;
import javax.swing.text.Document;
-import org.compiere.plaf.AdempierePLAF;
+import org.adempiere.plaf.AdempierePLAF;
/**
* Password Field
@@ -107,8 +107,6 @@ public class CPassword extends JPasswordField implements CEditor
*/
private void init()
{
- setFont(AdempierePLAF.getFont_Field());
- setForeground(AdempierePLAF.getTextColor_Normal());
} // init
/*************************************************************************/
diff --git a/looks/src/org/compiere/swing/CScrollPane.java b/looks/src/org/compiere/swing/CScrollPane.java
index 96ca3ac25b..0f1f6df1c4 100644
--- a/looks/src/org/compiere/swing/CScrollPane.java
+++ b/looks/src/org/compiere/swing/CScrollPane.java
@@ -20,6 +20,7 @@ import java.awt.*;
import javax.swing.*;
+import org.adempiere.plaf.AdempierePLAF;
import org.compiere.plaf.*;
/**
@@ -67,7 +68,6 @@ public class CScrollPane extends JScrollPane
public CScrollPane (Component view, int vsbPolicy, int hsbPolicy)
{
super (view, vsbPolicy, hsbPolicy);
- setBackgroundColor(null);
setOpaque(false);
getViewport().setOpaque(false);
} // CScollPane
@@ -77,15 +77,11 @@ public class CScrollPane extends JScrollPane
* Set Background
* @param bg AdempiereColor for Background, if null set standard background
*/
- public void setBackgroundColor (AdempiereColor bg)
+ public void setBackgroundColor (CompiereColor 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);
+ bg = new CompiereColor(AdempierePLAF.getFormBackground());
+ putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
} // setBackground
} // CScollPane
diff --git a/looks/src/org/compiere/swing/CTabbedPane.java b/looks/src/org/compiere/swing/CTabbedPane.java
index 5a06572dd4..8695404ac4 100644
--- a/looks/src/org/compiere/swing/CTabbedPane.java
+++ b/looks/src/org/compiere/swing/CTabbedPane.java
@@ -22,9 +22,10 @@ import java.util.*;
import javax.swing.*;
-import org.compiere.plaf.AdempiereColor;
-import org.compiere.plaf.AdempierePLAF;
-import org.compiere.plaf.AdempierePanelUI;
+import org.adempiere.plaf.AdempierePLAF;
+import org.compiere.plaf.CompiereColor;
+import org.compiere.plaf.CompiereLookAndFeel;
+import org.compiere.plaf.CompierePanelUI;
import org.compiere.util.Trace;
import sun.swing.*;
@@ -84,7 +85,7 @@ public class CTabbedPane extends JTabbedPane
* Creates an empty TabbedPane
with a defaults and Color
* @param bg Color
*/
- public CTabbedPane (AdempiereColor bg)
+ public CTabbedPane (CompiereColor bg)
{
super();
init();
@@ -96,9 +97,6 @@ public class CTabbedPane extends JTabbedPane
*/
private void init()
{
- setOpaque(false);
- setFont(AdempierePLAF.getFont_Label());
- setForeground(AdempierePLAF.getTextColor_Label());
} // init
@@ -111,9 +109,7 @@ public class CTabbedPane extends JTabbedPane
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));
+ setBackgroundColor (new CompiereColor(bg));
} // setBackground
/**
@@ -128,12 +124,11 @@ public class CTabbedPane extends JTabbedPane
* Set Background
* @param bg AdempiereColor for Background, if null set standard background
*/
- public void setBackgroundColor (AdempiereColor bg)
+ public void setBackgroundColor (CompiereColor bg)
{
if (bg == null)
- bg = AdempierePanelUI.getDefaultBackground();
- setOpaque(true);
- putClientProperty(AdempierePLAF.BACKGROUND, bg);
+ bg = new CompiereColor(AdempierePLAF.getFormBackground());
+ putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
super.setBackground (bg.getFlatColor());
//
repaint();
@@ -143,11 +138,11 @@ public class CTabbedPane extends JTabbedPane
* Get Background
* @return Color for Background
*/
- public AdempiereColor getBackgroundColor ()
+ public CompiereColor getBackgroundColor ()
{
try
{
- return (AdempiereColor)getClientProperty(AdempierePLAF.BACKGROUND);
+ return (CompiereColor)getClientProperty(CompiereLookAndFeel.BACKGROUND);
}
catch (Exception e)
{
@@ -195,10 +190,10 @@ public class CTabbedPane extends JTabbedPane
if (component instanceof JPanel)
{
JPanel p = (JPanel)component;
- if (p.getClientProperty(AdempierePLAF.BACKGROUND) == null)
+ if (p.getClientProperty(CompiereLookAndFeel.BACKGROUND) == null)
{
- AdempiereColor.setBackground(p);
- p.setOpaque(true);
+ //AdempiereColor.setBackground(p);
+ //p.setOpaque(true);
}
}
// Set first
@@ -328,7 +323,7 @@ public class CTabbedPane extends JTabbedPane
{
StringBuffer sb = new StringBuffer ("CTabbedPane [");
sb.append(super.toString());
- AdempiereColor bg = getBackgroundColor();
+ CompiereColor bg = getBackgroundColor();
if (bg != null)
sb.append(bg.toString());
sb.append("]");
diff --git a/looks/src/org/compiere/swing/CTable.java b/looks/src/org/compiere/swing/CTable.java
index e9db376cdb..ed628d76e8 100644
--- a/looks/src/org/compiere/swing/CTable.java
+++ b/looks/src/org/compiere/swing/CTable.java
@@ -45,6 +45,8 @@ public class CTable extends JTable
setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
getTableHeader().addMouseListener(new CTableMouseListener());
setSurrendersFocusOnKeystroke(true);
+ //Default row height too narrow
+ setRowHeight(getFont().getSize() + 8);
} // CTable
/** Last model index sorted */
@@ -301,4 +303,12 @@ public class CTable extends JTable
}
} // CTableMouseListener
+
+ @Override
+ public void setFont(Font font) {
+ super.setFont(font);
+ //Update row height
+ setRowHeight(getFont().getSize() + 8);
+ }
+
} // CTable
diff --git a/looks/src/org/compiere/swing/CTextArea.java b/looks/src/org/compiere/swing/CTextArea.java
index 36836c2bd3..f7d5f9df53 100644
--- a/looks/src/org/compiere/swing/CTextArea.java
+++ b/looks/src/org/compiere/swing/CTextArea.java
@@ -23,6 +23,7 @@ import java.awt.im.*;
import javax.swing.*;
import javax.swing.text.*;
+import org.adempiere.plaf.AdempierePLAF;
import org.compiere.plaf.*;
/**
@@ -125,8 +126,6 @@ public class CTextArea extends JScrollPane
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
diff --git a/looks/src/org/compiere/swing/CTextField.java b/looks/src/org/compiere/swing/CTextField.java
index 9e18caee65..ddd0cb917b 100644
--- a/looks/src/org/compiere/swing/CTextField.java
+++ b/looks/src/org/compiere/swing/CTextField.java
@@ -22,6 +22,7 @@ import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
+import org.adempiere.plaf.AdempierePLAF;
import org.compiere.plaf.*;
/**
@@ -117,8 +118,6 @@ public class CTextField extends JTextField
*/
private void init()
{
- setFont(AdempierePLAF.getFont_Field());
- setForeground(AdempierePLAF.getTextColor_Normal());
setBackground (false);
// Minimum Size
Dimension size = getPreferredSize();
diff --git a/looks/src/org/compiere/swing/CTextPane.java b/looks/src/org/compiere/swing/CTextPane.java
index d2fd84f9f6..99700a2893 100644
--- a/looks/src/org/compiere/swing/CTextPane.java
+++ b/looks/src/org/compiere/swing/CTextPane.java
@@ -23,6 +23,7 @@ import java.awt.im.*;
import javax.swing.*;
import javax.swing.text.*;
+import org.adempiere.plaf.AdempierePLAF;
import org.compiere.plaf.*;
/**
@@ -63,8 +64,6 @@ public class CTextPane extends JScrollPane
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;
diff --git a/looks/src/org/compiere/swing/CToggleButton.java b/looks/src/org/compiere/swing/CToggleButton.java
index 1097e1803d..2e596c1544 100644
--- a/looks/src/org/compiere/swing/CToggleButton.java
+++ b/looks/src/org/compiere/swing/CToggleButton.java
@@ -22,8 +22,9 @@ import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JToggleButton;
-import org.compiere.plaf.AdempiereColor;
-import org.compiere.plaf.AdempierePLAF;
+import org.adempiere.plaf.AdempierePLAF;
+import org.compiere.plaf.CompiereColor;
+import org.compiere.plaf.CompiereLookAndFeel;
import org.compiere.util.Trace;
/**
@@ -125,11 +126,6 @@ public class CToggleButton extends JToggleButton implements CEditor
public CToggleButton (String text, Icon icon, boolean selected)
{
super(text, icon, selected);
- setContentAreaFilled(false);
- setOpaque(false);
- //
- setFont(AdempierePLAF.getFont_Label());
- setForeground(AdempierePLAF.getTextColor_Label());
}
/*************************************************************************/
@@ -144,12 +140,6 @@ public class CToggleButton extends JToggleButton implements CEditor
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
/**
@@ -172,12 +162,12 @@ public class CToggleButton extends JToggleButton implements CEditor
* Set Background
* @param bg AdempiereColor for Background, if null set standard background
*/
- public void setBackgroundColor (AdempiereColor bg)
+ public void setBackgroundColor (CompiereColor bg)
{
if (bg == null)
- bg = AdempiereColor.getDefaultBackground();
+ bg = new CompiereColor(AdempierePLAF.getFormBackground());
setOpaque(true);
- putClientProperty(AdempierePLAF.BACKGROUND, bg);
+ putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
super.setBackground (bg.getFlatColor());
} // setBackground
@@ -185,11 +175,11 @@ public class CToggleButton extends JToggleButton implements CEditor
* Get Background
* @return Color for Background
*/
- public AdempiereColor getBackgroundColor ()
+ public CompiereColor getBackgroundColor ()
{
try
{
- return (AdempiereColor)getClientProperty(AdempierePLAF.BACKGROUND);
+ return (CompiereColor)getClientProperty(CompiereLookAndFeel.BACKGROUND);
}
catch (Exception e)
{
diff --git a/looks/src/org/compiere/plaf/ColorBlind.java b/looks/src/org/compiere/swing/ColorBlind.java
similarity index 96%
rename from looks/src/org/compiere/plaf/ColorBlind.java
rename to looks/src/org/compiere/swing/ColorBlind.java
index 3767aff90f..21dea3a5d6 100644
--- a/looks/src/org/compiere/plaf/ColorBlind.java
+++ b/looks/src/org/compiere/swing/ColorBlind.java
@@ -14,7 +14,7 @@
* 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;
+package org.compiere.swing;
import java.awt.Color;
import java.util.logging.*;
diff --git a/looks/src/org/compiere/plaf/AdempiereColorEditor.java b/looks/src/org/compiere/swing/ColorEditor.java
similarity index 89%
rename from looks/src/org/compiere/plaf/AdempiereColorEditor.java
rename to looks/src/org/compiere/swing/ColorEditor.java
index a825c757a6..38abeb0473 100644
--- a/looks/src/org/compiere/plaf/AdempiereColorEditor.java
+++ b/looks/src/org/compiere/swing/ColorEditor.java
@@ -14,13 +14,16 @@
* 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;
+package org.compiere.swing;
import java.awt.*;
import java.awt.event.*;
import java.beans.*;
import java.util.*;
import javax.swing.*;
+
+import org.adempiere.plaf.AdempierePLAF;
+import org.compiere.plaf.CompiereColor;
import org.compiere.swing.*;
import org.compiere.util.*;
@@ -30,7 +33,7 @@ import org.compiere.util.*;
* @author Jorg Janke
* @version $Id: AdempiereColorEditor.java,v 1.2 2006/07/30 00:52:24 jjanke Exp $
*/
-public class AdempiereColorEditor extends CDialog
+public class ColorEditor extends CDialog
implements ActionListener, PropertyEditor
{
/**
@@ -39,9 +42,9 @@ public class AdempiereColorEditor extends CDialog
* @param color optional initial color
* @return AdempiereColor
*/
- public static AdempiereColor showDialog (Frame owner, AdempiereColor color)
+ public static CompiereColor showDialog (Frame owner, CompiereColor color)
{
- AdempiereColorEditor cce = new AdempiereColorEditor (owner, color);
+ ColorEditor cce = new ColorEditor (owner, color);
if (cce.isSaved())
return cce.getColor();
return color;
@@ -53,9 +56,9 @@ public class AdempiereColorEditor extends CDialog
* @param color optional initial color
* @return AdempiereColor
*/
- public static AdempiereColor showDialog (Dialog owner, AdempiereColor color)
+ public static CompiereColor showDialog (Dialog owner, CompiereColor color)
{
- AdempiereColorEditor cce = new AdempiereColorEditor (owner, color);
+ ColorEditor cce = new ColorEditor (owner, color);
if (cce.isSaved())
return cce.getColor();
return color;
@@ -68,7 +71,7 @@ public class AdempiereColorEditor extends CDialog
* @param owner owner
* @param color Start Color
*/
- public AdempiereColorEditor (Frame owner, AdempiereColor color)
+ public ColorEditor (Frame owner, CompiereColor color)
{
super(owner, "", true);
init (color);
@@ -79,7 +82,7 @@ public class AdempiereColorEditor extends CDialog
* @param owner owner
* @param color Start Color
*/
- public AdempiereColorEditor (Dialog owner, AdempiereColor color)
+ public ColorEditor (Dialog owner, CompiereColor color)
{
super(owner, "", true);
init (color);
@@ -89,7 +92,7 @@ public class AdempiereColorEditor extends CDialog
* Init Dialog
* @param color Start Color
*/
- private void init (AdempiereColor color)
+ private void init (CompiereColor color)
{
try
{
@@ -119,13 +122,13 @@ public class AdempiereColorEditor extends CDialog
if (color == null)
setColor (m_cc);
else
- setColor (new AdempiereColor(color));
+ setColor (new CompiereColor(color));
AdempierePLAF.showCenterScreen(this);
} // init
private static ResourceBundle res = ResourceBundle.getBundle("org.compiere.plaf.PlafRes");
- private AdempiereColor m_cc = null;
+ private CompiereColor m_cc = null;
private boolean m_saved = false;
private boolean m_setting = false;
@@ -137,7 +140,7 @@ public class AdempiereColorEditor extends CDialog
private FlowLayout southLayout = new FlowLayout();
private GridBagLayout northLayout = new GridBagLayout();
private CLabel typeLabel = new CLabel();
- private CComboBox typeField = new CComboBox(AdempiereColor.TYPES);
+ private CComboBox typeField = new CComboBox(CompiereColor.TYPES);
private CButton gradientUpper = new CButton();
private CButton gradientLower = new CButton();
private CLabel urlLabel = new CLabel();
@@ -153,7 +156,7 @@ public class AdempiereColorEditor extends CDialog
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 CComboBox gradientStartField = new CComboBox(CompiereColor.GRADIENT_SP);
private CTextField gradientDistanceField = new CTextField(10);
private CLabel gradientStartLabel = new CLabel();
private CLabel gradientDistanceLabel = new CLabel();
@@ -312,14 +315,14 @@ public class AdempiereColorEditor extends CDialog
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);
+ if (vp.getValue().equals(CompiereColor.TYPE_FLAT))
+ m_cc = new CompiereColor(CompiereColor.TYPE_FLAT);
+ else if (vp.getValue().equals(CompiereColor.TYPE_GRADIENT))
+ m_cc = new CompiereColor(CompiereColor.TYPE_GRADIENT);
+ else if (vp.getValue().equals(CompiereColor.TYPE_TEXTURE))
+ m_cc = new CompiereColor(CompiereColor.TYPE_TEXTURE);
+ else if (vp.getValue().equals(CompiereColor.TYPE_LINES))
+ m_cc = new CompiereColor(CompiereColor.TYPE_LINES);
setColor (m_cc);
} // cmd_type
@@ -327,7 +330,7 @@ public class AdempiereColorEditor extends CDialog
* Set Color and update UI
* @param color color
*/
- public void setColor (AdempiereColor color)
+ public void setColor (CompiereColor color)
{
if (color == null && m_cc != null)
return;
@@ -335,7 +338,7 @@ public class AdempiereColorEditor extends CDialog
// System.out.println("AdempiereColorEditor.setColor " + color);
m_cc = color;
if (m_cc == null)
- m_cc = AdempierePanelUI.getDefaultBackground();
+ m_cc = CompiereColor.getDefaultBackground();
// update display
updateFields();
@@ -350,11 +353,11 @@ public class AdempiereColorEditor extends CDialog
{
m_setting = true;
// Type
- for (int i = 0; i < AdempiereColor.TYPES.length; i++)
+ for (int i = 0; i < CompiereColor.TYPES.length; i++)
{
- if (m_cc.getType().equals(AdempiereColor.TYPE_VALUES[i]))
+ if (m_cc.getType().equals(CompiereColor.TYPE_VALUES[i]))
{
- typeField.setSelectedItem(AdempiereColor.TYPES[i]);
+ typeField.setSelectedItem(CompiereColor.TYPES[i]);
break;
}
}
@@ -406,11 +409,11 @@ public class AdempiereColorEditor extends CDialog
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++)
+ for (int i = 0; i < CompiereColor.GRADIENT_SP.length; i++)
{
- if (m_cc.getGradientStartPoint() == AdempiereColor.GRADIENT_SP_VALUES[i])
+ if (m_cc.getGradientStartPoint() == CompiereColor.GRADIENT_SP_VALUES[i])
{
- gradientStartField.setSelectedItem(AdempiereColor.GRADIENT_SP[i]);
+ gradientStartField.setSelectedItem(CompiereColor.GRADIENT_SP[i]);
break;
}
}
@@ -473,7 +476,7 @@ public class AdempiereColorEditor extends CDialog
* Get Color
* @return Color, when saved - else null
*/
- public AdempiereColor getColor()
+ public CompiereColor getColor()
{
return m_cc;
} // getColor
@@ -501,8 +504,8 @@ public class AdempiereColorEditor extends CDialog
*/
public void setValue(Object value)
{
- if (value != null && value instanceof AdempiereColor)
- setColor (new AdempiereColor((AdempiereColor)value));
+ if (value != null && value instanceof CompiereColor)
+ setColor (new CompiereColor((CompiereColor)value));
else
throw new IllegalArgumentException("AdempiereColorEditor.setValue requires AdempiereColor");
} // setValue
diff --git a/looks/src/org/compiere/swing/ExtendedTheme.java b/looks/src/org/compiere/swing/ExtendedTheme.java
new file mode 100644
index 0000000000..694e51a966
--- /dev/null
+++ b/looks/src/org/compiere/swing/ExtendedTheme.java
@@ -0,0 +1,30 @@
+package org.compiere.swing;
+
+import java.util.Map;
+
+import javax.swing.plaf.ColorUIResource;
+
+public interface ExtendedTheme {
+
+ public ColorUIResource getWhite();
+ public ColorUIResource getBlack();
+ public ColorUIResource getErrorForeground();
+ public ColorUIResource getErrorBackground();
+ public ColorUIResource getInactiveBackground();
+ public ColorUIResource getMandatoryBackground();
+ public ColorUIResource getInfoBackground();
+
+ public final static ColorUIResource DEFAULT_MANDATORY_BG = new ColorUIResource(224, 224, 255); // blue-isch
+ public final static ColorUIResource DEFAULT_ERROR_BG = new ColorUIResource(255, 204, 204); // red-isch
+ public final static ColorUIResource DEFAULT_ERROR_FG = new ColorUIResource(204, 0, 0); // dark red
+ public final static ColorUIResource DEFAULT_INACTIVE_BG = new ColorUIResource(234, 234, 234); // light gray
+ public final static ColorUIResource DEFAULT_INFO_BG = new ColorUIResource(253, 237, 207); // light yellow
+
+ public void setUIProperties(Map propertyMap);
+
+ public final static String ERROR_BG_KEY = "TextField.errorBackground";
+ public final static String ERROR_FG_KEY = "TextField.errorForeground";
+ public final static String MANDATORY_BG_KEY = "TextField.mandatoryBackground";
+ public final static String INACTIVE_BG_KEY = "TextField.inactiveBackground";
+ public final static String INFO_BG_KEY = "Info.background";
+}
diff --git a/looks/src/org/compiere/plaf/FontChooser.java b/looks/src/org/compiere/swing/FontChooser.java
similarity index 96%
rename from looks/src/org/compiere/plaf/FontChooser.java
rename to looks/src/org/compiere/swing/FontChooser.java
index 346b50614b..b6c4318463 100644
--- a/looks/src/org/compiere/plaf/FontChooser.java
+++ b/looks/src/org/compiere/swing/FontChooser.java
@@ -14,12 +14,14 @@
* 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;
+package org.compiere.swing;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
+
+import org.adempiere.plaf.AdempierePLAF;
import org.compiere.swing.*;
/**
diff --git a/looks/src/org/compiere/swing/ThemeUtils.java b/looks/src/org/compiere/swing/ThemeUtils.java
new file mode 100644
index 0000000000..2612600bd3
--- /dev/null
+++ b/looks/src/org/compiere/swing/ThemeUtils.java
@@ -0,0 +1,220 @@
+package org.compiere.swing;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.SystemColor;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import javax.swing.plaf.ColorUIResource;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.plaf.metal.MetalTheme;
+
+import org.compiere.plaf.CompiereColor;
+
+public final class ThemeUtils {
+
+ /** Logger */
+ private static Logger log = Logger.getLogger(ThemeUtils.class.getName());
+
+ /**
+ * 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
+
+ /**
+ * Parse Color.
+ *