Adempiere 3.1.2
This commit is contained in:
parent
b4c4d18be1
commit
110f14a7f5
|
|
@ -64,6 +64,15 @@ public final class AdempierePLAF
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static Logger log = Logger.getLogger(AdempierePLAF.class.getName());
|
private static Logger log = Logger.getLogger(AdempierePLAF.class.getName());
|
||||||
|
|
||||||
|
/** Version tag */
|
||||||
|
public static final String VERSION = "R1.4.0";
|
||||||
|
/** Key of Client Property to paint in CompiereColor */
|
||||||
|
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";
|
||||||
|
|
||||||
/****** Background *******************************************************/
|
/****** Background *******************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class CompiereColor implements Serializable
|
||||||
*/
|
*/
|
||||||
public static void setBackground (JComponent c)
|
public static void setBackground (JComponent c)
|
||||||
{
|
{
|
||||||
setBackground (c, new CompiereColor(AdempierePLAF.getFormBackground()));
|
setBackground (c, CompierePanelUI.getDefaultBackground());
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -114,7 +114,7 @@ public class CompiereColor implements Serializable
|
||||||
*/
|
*/
|
||||||
public static void setBackground (JComponent c, CompiereColor cc)
|
public static void setBackground (JComponent c, CompiereColor cc)
|
||||||
{
|
{
|
||||||
c.putClientProperty(CompiereLookAndFeel.BACKGROUND, cc);
|
c.putClientProperty(AdempierePLAF.BACKGROUND, cc);
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -127,7 +127,7 @@ public class CompiereColor implements Serializable
|
||||||
CompiereColor bg = null;
|
CompiereColor bg = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bg = (CompiereColor)c.getClientProperty(CompiereLookAndFeel.BACKGROUND);
|
bg = (CompiereColor)c.getClientProperty(AdempierePLAF.BACKGROUND);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -142,7 +142,7 @@ public class CompiereColor implements Serializable
|
||||||
*/
|
*/
|
||||||
public static void setBackground (Window win)
|
public static void setBackground (Window win)
|
||||||
{
|
{
|
||||||
setBackground (win, new CompiereColor(AdempierePLAF.getFormBackground()));
|
setBackground (win, CompierePanelUI.getDefaultBackground());
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -154,21 +154,31 @@ public class CompiereColor implements Serializable
|
||||||
{
|
{
|
||||||
if (win instanceof JDialog)
|
if (win instanceof JDialog)
|
||||||
{
|
{
|
||||||
((JPanel)((JDialog)win).getContentPane()).putClientProperty(CompiereLookAndFeel.BACKGROUND, cc);
|
((JPanel)((JDialog)win).getContentPane()).putClientProperty(AdempierePLAF.BACKGROUND, cc);
|
||||||
// ((JPanel)((JDialog)win).getContentPane()).setName("contentPane");
|
// ((JPanel)((JDialog)win).getContentPane()).setName("contentPane");
|
||||||
}
|
}
|
||||||
else if (win instanceof JFrame)
|
else if (win instanceof JFrame)
|
||||||
{
|
{
|
||||||
((JPanel)((JFrame)win).getContentPane()).putClientProperty(CompiereLookAndFeel.BACKGROUND, cc);
|
((JPanel)((JFrame)win).getContentPane()).putClientProperty(AdempierePLAF.BACKGROUND, cc);
|
||||||
// ((JPanel)((JFrame)win).getContentPane()).setName("contentPane");
|
// ((JPanel)((JFrame)win).getContentPane()).setName("contentPane");
|
||||||
}
|
}
|
||||||
else if (win instanceof JWindow)
|
else if (win instanceof JWindow)
|
||||||
{
|
{
|
||||||
((JPanel)((JWindow)win).getContentPane()).putClientProperty(CompiereLookAndFeel.BACKGROUND, cc);
|
((JPanel)((JWindow)win).getContentPane()).putClientProperty(AdempierePLAF.BACKGROUND, cc);
|
||||||
// ((JPanel)((JWindow)win).getContentPane()).setName("contentPane");
|
// ((JPanel)((JWindow)win).getContentPane()).setName("contentPane");
|
||||||
}
|
}
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Default Background
|
||||||
|
* @param bg Background Color
|
||||||
|
* @see CompierePanelUI#setDefaultBackground
|
||||||
|
*/
|
||||||
|
public static void setDefaultBackground (CompiereColor bg)
|
||||||
|
{
|
||||||
|
CompierePanelUI.setDefaultBackground(bg);
|
||||||
|
} // setDefaultBackground
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Default Background
|
* Get Default Background
|
||||||
* @return Background
|
* @return Background
|
||||||
|
|
@ -176,11 +186,31 @@ public class CompiereColor implements Serializable
|
||||||
*/
|
*/
|
||||||
public static CompiereColor getDefaultBackground()
|
public static CompiereColor getDefaultBackground()
|
||||||
{
|
{
|
||||||
return new CompiereColor(AdempierePLAF.getFormBackground());
|
return CompierePanelUI.getDefaultBackground();
|
||||||
} // getDefaultBackground
|
} // getDefaultBackground
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse attributes and return AdempiereColor
|
* Set Default Background
|
||||||
|
* @param setDefault if true, the background will be set to the default color
|
||||||
|
* @see CompierePanelUI#setSetDefault
|
||||||
|
*/
|
||||||
|
public static void setSetDefault (boolean setDefault)
|
||||||
|
{
|
||||||
|
CompierePanelUI.setSetDefault(setDefault);
|
||||||
|
} // setSetDefault
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the Default Background set by default
|
||||||
|
* @return true if default background is set
|
||||||
|
* @see CompierePanelUI#isSetDefault
|
||||||
|
*/
|
||||||
|
public static boolean isSetDefault()
|
||||||
|
{
|
||||||
|
return CompierePanelUI.isSetDefault();
|
||||||
|
} // isSetDefault
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse attributes and return CompiereColor
|
||||||
* @param attributes attributes
|
* @param attributes attributes
|
||||||
* @return AdempiereColor
|
* @return AdempiereColor
|
||||||
*/
|
*/
|
||||||
|
|
@ -920,23 +950,23 @@ public class CompiereColor implements Serializable
|
||||||
StringBuffer sb = new StringBuffer ("AdempiereColor[");
|
StringBuffer sb = new StringBuffer ("AdempiereColor[");
|
||||||
if (isFlat())
|
if (isFlat())
|
||||||
sb.append("Flat")
|
sb.append("Flat")
|
||||||
.append(" ").append(ThemeUtils.getColorAsString(getFlatColor()));
|
.append(" ").append(CompiereTheme.getColorAsString(getFlatColor()));
|
||||||
else if (isGradient())
|
else if (isGradient())
|
||||||
sb.append("Gradient")
|
sb.append("Gradient")
|
||||||
.append(" Upper=").append(ThemeUtils.getColorAsString(getGradientUpperColor()))
|
.append(" Upper=").append(CompiereTheme.getColorAsString(getGradientUpperColor()))
|
||||||
.append(",Lower=").append(ThemeUtils.getColorAsString(getGradientLowerColor()))
|
.append(",Lower=").append(CompiereTheme.getColorAsString(getGradientLowerColor()))
|
||||||
.append(",Start=").append(getGradientStartPoint())
|
.append(",Start=").append(getGradientStartPoint())
|
||||||
.append(",RDistance=").append(getGradientRepeatDistance());
|
.append(",RDistance=").append(getGradientRepeatDistance());
|
||||||
else if (isLine())
|
else if (isLine())
|
||||||
sb.append("Line")
|
sb.append("Line")
|
||||||
.append(" Color=").append(ThemeUtils.getColorAsString(getLineColor()))
|
.append(" Color=").append(CompiereTheme.getColorAsString(getLineColor()))
|
||||||
.append(",BackColor=").append(ThemeUtils.getColorAsString(getLineBackColor()))
|
.append(",BackColor=").append(CompiereTheme.getColorAsString(getLineBackColor()))
|
||||||
.append(",Width=").append(getLineWidth())
|
.append(",Width=").append(getLineWidth())
|
||||||
.append(",Distance=").append(getLineDistance());
|
.append(",Distance=").append(getLineDistance());
|
||||||
else if (isTexture())
|
else if (isTexture())
|
||||||
sb.append("Texture")
|
sb.append("Texture")
|
||||||
.append(" GraphURL=").append(getTextureURL())
|
.append(" GraphURL=").append(getTextureURL())
|
||||||
.append(",Taint=").append(ThemeUtils.getColorAsString(getTextureTaintColor()))
|
.append(",Taint=").append(CompiereTheme.getColorAsString(getTextureTaintColor()))
|
||||||
.append(",Alpha=").append(getTextureCompositeAlpha());
|
.append(",Alpha=").append(getTextureCompositeAlpha());
|
||||||
sb.append("]");
|
sb.append("]");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
@ -951,15 +981,15 @@ public class CompiereColor implements Serializable
|
||||||
if (str.indexOf("[Flat ") != -1)
|
if (str.indexOf("[Flat ") != -1)
|
||||||
{
|
{
|
||||||
m_type = TYPE_FLAT;
|
m_type = TYPE_FLAT;
|
||||||
m_primaryColor = ThemeUtils.parseColor(str,
|
m_primaryColor = CompiereTheme.parseColor(str,
|
||||||
new ColorUIResource(m_primaryColor));
|
new ColorUIResource(m_primaryColor));
|
||||||
}
|
}
|
||||||
else if (str.indexOf("[Gradient ") != -1)
|
else if (str.indexOf("[Gradient ") != -1)
|
||||||
{
|
{
|
||||||
m_type = TYPE_GRADIENT;
|
m_type = TYPE_GRADIENT;
|
||||||
m_primaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(" Upper=")+7, str.indexOf(",Lower=")),
|
m_primaryColor = CompiereTheme.parseColor(str.substring(str.indexOf(" Upper=")+7, str.indexOf(",Lower=")),
|
||||||
new ColorUIResource(m_primaryColor));
|
new ColorUIResource(m_primaryColor));
|
||||||
m_secondaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",Lower=")+7, str.indexOf(",Start=")),
|
m_secondaryColor = CompiereTheme.parseColor(str.substring(str.indexOf(",Lower=")+7, str.indexOf(",Start=")),
|
||||||
new ColorUIResource(m_secondaryColor));
|
new ColorUIResource(m_secondaryColor));
|
||||||
m_startPoint = Integer.parseInt(str.substring(str.indexOf(",Start=")+7, str.indexOf(",RDistance=")));
|
m_startPoint = Integer.parseInt(str.substring(str.indexOf(",Start=")+7, str.indexOf(",RDistance=")));
|
||||||
setGradientRepeatDistance(str.substring(str.indexOf(",RDistance=")+11, str.lastIndexOf("]")));
|
setGradientRepeatDistance(str.substring(str.indexOf(",RDistance=")+11, str.lastIndexOf("]")));
|
||||||
|
|
@ -967,9 +997,9 @@ public class CompiereColor implements Serializable
|
||||||
else if (str.indexOf("[Line ") != -1)
|
else if (str.indexOf("[Line ") != -1)
|
||||||
{
|
{
|
||||||
m_type = TYPE_LINES;
|
m_type = TYPE_LINES;
|
||||||
m_primaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(" Color=")+7, str.indexOf(",BackColor=")),
|
m_primaryColor = CompiereTheme.parseColor(str.substring(str.indexOf(" Color=")+7, str.indexOf(",BackColor=")),
|
||||||
new ColorUIResource(m_primaryColor));
|
new ColorUIResource(m_primaryColor));
|
||||||
m_secondaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",BackColor=")+11, str.indexOf(",Width=")),
|
m_secondaryColor = CompiereTheme.parseColor(str.substring(str.indexOf(",BackColor=")+11, str.indexOf(",Width=")),
|
||||||
new ColorUIResource(m_secondaryColor));
|
new ColorUIResource(m_secondaryColor));
|
||||||
setLineWidth(str.substring(str.indexOf(",Width=")+7, str.indexOf(",Distance=")));
|
setLineWidth(str.substring(str.indexOf(",Width=")+7, str.indexOf(",Distance=")));
|
||||||
setLineDistance(str.substring(str.indexOf(",Distance=")+10, str.lastIndexOf("]")));
|
setLineDistance(str.substring(str.indexOf(",Distance=")+10, str.lastIndexOf("]")));
|
||||||
|
|
@ -978,7 +1008,7 @@ public class CompiereColor implements Serializable
|
||||||
{
|
{
|
||||||
m_type = TYPE_TEXTURE;
|
m_type = TYPE_TEXTURE;
|
||||||
setTextureURL (str.substring(str.indexOf(" GraphURL=")+10, str.indexOf(",Taint=")));
|
setTextureURL (str.substring(str.indexOf(" GraphURL=")+10, str.indexOf(",Taint=")));
|
||||||
m_primaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",Taint=")+7, str.indexOf(",Alpha=")),
|
m_primaryColor = CompiereTheme.parseColor(str.substring(str.indexOf(",Taint=")+7, str.indexOf(",Alpha=")),
|
||||||
new ColorUIResource(m_primaryColor));
|
new ColorUIResource(m_primaryColor));
|
||||||
setTextureCompositeAlpha (str.substring(str.indexOf(",Alpha=")+7, str.lastIndexOf("]")));
|
setTextureCompositeAlpha (str.substring(str.indexOf(",Alpha=")+7, str.lastIndexOf("]")));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,16 +55,6 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
|
||||||
/** Paint Round Corners */
|
/** Paint Round Corners */
|
||||||
protected static boolean ROUND = false;
|
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
|
* The Name
|
||||||
* @return Name
|
* @return Name
|
||||||
|
|
@ -99,6 +89,7 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
|
||||||
*/
|
*/
|
||||||
public UIDefaults getDefaults()
|
public UIDefaults getDefaults()
|
||||||
{
|
{
|
||||||
|
// System.out.println("CompiereLookAndFeel.getDefaults");
|
||||||
// Theme already created/set
|
// Theme already created/set
|
||||||
MetalLookAndFeel.setCurrentTheme(s_theme);
|
MetalLookAndFeel.setCurrentTheme(s_theme);
|
||||||
UIDefaults defaults = super.getDefaults(); // calls init..Defaults
|
UIDefaults defaults = super.getDefaults(); // calls init..Defaults
|
||||||
|
|
@ -114,6 +105,7 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
|
||||||
*/
|
*/
|
||||||
protected void initClassDefaults(UIDefaults table)
|
protected void initClassDefaults(UIDefaults table)
|
||||||
{
|
{
|
||||||
|
// System.out.println("CompiereLookAndFeel.initClassDefaults");
|
||||||
super.initClassDefaults( table);
|
super.initClassDefaults( table);
|
||||||
// Overwrite
|
// Overwrite
|
||||||
putDefault (table, "PanelUI");
|
putDefault (table, "PanelUI");
|
||||||
|
|
@ -163,7 +155,11 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
|
||||||
*/
|
*/
|
||||||
protected void initSystemColorDefaults (UIDefaults table)
|
protected void initSystemColorDefaults (UIDefaults table)
|
||||||
{
|
{
|
||||||
|
// System.out.println("CompiereLookAndFeel.initSystemColorDefaults");
|
||||||
super.initSystemColorDefaults( table);
|
super.initSystemColorDefaults( table);
|
||||||
|
|
||||||
|
// we made the color a bit darker
|
||||||
|
// table.put("textHighlight", CompiereUtils.getTranslucentColor(getTextHighlightColor(), 128));
|
||||||
} // initSystemColorDefaults
|
} // initSystemColorDefaults
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -172,6 +168,7 @@ public class CompiereLookAndFeel extends MetalLookAndFeel
|
||||||
*/
|
*/
|
||||||
protected void initComponentDefaults (UIDefaults table)
|
protected void initComponentDefaults (UIDefaults table)
|
||||||
{
|
{
|
||||||
|
// System.out.println("CompiereLookAndFeel.initComponentDefaults");
|
||||||
super.initComponentDefaults( table);
|
super.initComponentDefaults( table);
|
||||||
|
|
||||||
// ComboBox defaults
|
// ComboBox defaults
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ public class CompierePanelUI extends BasicPanelUI
|
||||||
CompiereColor bg = null;
|
CompiereColor bg = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bg = (CompiereColor)c.getClientProperty(CompiereLookAndFeel.BACKGROUND);
|
bg = (CompiereColor)c.getClientProperty(AdempierePLAF.BACKGROUND);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -132,5 +132,48 @@ public class CompierePanelUI extends BasicPanelUI
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
|
/** Default Background */
|
||||||
|
private static CompiereColor s_default = new CompiereColor();
|
||||||
|
/** Set Background to default setting */
|
||||||
|
private static boolean s_setDefault = false;
|
||||||
|
|
||||||
} // AdempierePanel
|
|
||||||
|
/**
|
||||||
|
* Set Default Background
|
||||||
|
* @param bg Background Color
|
||||||
|
*/
|
||||||
|
public static void setDefaultBackground (CompiereColor bg)
|
||||||
|
{
|
||||||
|
if (bg == null)
|
||||||
|
return;
|
||||||
|
s_default.setColor(bg);
|
||||||
|
} // setBackground
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Default Background
|
||||||
|
* @return Background
|
||||||
|
*/
|
||||||
|
public static CompiereColor 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
|
||||||
|
|
||||||
|
} // CompierePanel
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ public class CompiereTabbedPaneUI extends MetalTabbedPaneUI
|
||||||
JPanel jp = (JPanel)comp;
|
JPanel jp = (JPanel)comp;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bg = (CompiereColor)jp.getClientProperty(CompiereLookAndFeel.BACKGROUND);
|
bg = (CompiereColor)jp.getClientProperty(AdempierePLAF.BACKGROUND);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -373,7 +373,7 @@ public class CompiereTabbedPaneUI extends MetalTabbedPaneUI
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (jc != null)
|
if (jc != null)
|
||||||
bg = (CompiereColor)jc.getClientProperty(CompiereLookAndFeel.BACKGROUND);
|
bg = (CompiereColor)jc.getClientProperty(AdempierePLAF.BACKGROUND);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -382,7 +382,7 @@ public class CompiereTabbedPaneUI extends MetalTabbedPaneUI
|
||||||
if (bg == null)
|
if (bg == null)
|
||||||
{
|
{
|
||||||
bg = new CompiereColor(jc.getBackground());
|
bg = new CompiereColor(jc.getBackground());
|
||||||
jc.putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
|
jc.putClientProperty(AdempierePLAF.BACKGROUND, bg);
|
||||||
}
|
}
|
||||||
bg.paintRect(g, jc, x,y, w,h);
|
bg.paintRect(g, jc, x,y, w,h);
|
||||||
}
|
}
|
||||||
|
|
@ -1023,7 +1023,7 @@ public class CompiereTabbedPaneUI extends MetalTabbedPaneUI
|
||||||
JComponent jc = (JComponent)comp;
|
JComponent jc = (JComponent)comp;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Integer ll = (Integer)jc.getClientProperty(CompiereLookAndFeel.TABLEVEL);
|
Integer ll = (Integer)jc.getClientProperty(AdempierePLAF.TABLEVEL);
|
||||||
if (ll != null)
|
if (ll != null)
|
||||||
level = ll.intValue();
|
level = ll.intValue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import java.awt.Graphics2D;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.plaf.ComponentUI;
|
import javax.swing.plaf.ComponentUI;
|
||||||
import javax.swing.plaf.basic.BasicTableHeaderUI;
|
import javax.swing.plaf.basic.BasicTableHeaderUI;
|
||||||
|
import org.adempiere.plaf.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table Header UI
|
* Table Header UI
|
||||||
|
|
@ -52,8 +53,8 @@ public class CompiereTableHeaderUI extends BasicTableHeaderUI
|
||||||
super.installUI(c);
|
super.installUI(c);
|
||||||
// TableHeader is in JViewpoiunt, which is Opaque
|
// TableHeader is in JViewpoiunt, which is Opaque
|
||||||
// When UI created, TableHeader not added to viewpoint
|
// When UI created, TableHeader not added to viewpoint
|
||||||
//c.setOpaque(true);
|
c.setOpaque(true);
|
||||||
//c.putClientProperty(AdempierePLAF.BACKGROUND_FILL, "Y");
|
c.putClientProperty(AdempierePLAF.BACKGROUND_FILL, "Y");
|
||||||
} // installUI
|
} // installUI
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,49 @@ public class CompiereTheme extends MetalTheme
|
||||||
public static final int FONT_SIZE = 12;
|
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();
|
||||||
|
CompierePanelUI.setDefaultBackground(new CompiereColor(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)
|
* Get Primary 1 (blue in default Metal Theme)
|
||||||
* @return color
|
* @return color
|
||||||
|
|
@ -324,22 +367,241 @@ public class CompiereTheme extends MetalTheme
|
||||||
}
|
}
|
||||||
public FontUIResource getSubTextFont() {return _getSubTextFont();}
|
public FontUIResource getSubTextFont() {return _getSubTextFont();}
|
||||||
|
|
||||||
@Override
|
// Static property info
|
||||||
public void addCustomEntriesToTable(UIDefaults table) {
|
|
||||||
super.addCustomEntriesToTable(table);
|
private static final String P_Primary1 = "#ColorPrimary1";
|
||||||
Object[] defaults =
|
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_CompiereColor = "#CompiereColor";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save information in Properties
|
||||||
|
*/
|
||||||
|
public static void save ()
|
||||||
|
{
|
||||||
|
log.config(CompiereColor.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());
|
||||||
|
//
|
||||||
|
CompiereColor cc = CompiereColor.getDefaultBackground();
|
||||||
|
Ini.setProperty(P_CompiereColor, cc.toString());
|
||||||
|
} // save
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses Color into String representation.
|
||||||
|
* Required as SystemColors and Alpha Colors have different formats
|
||||||
|
* @param c Color
|
||||||
|
* @return [r=102,g=102,b=153,a=255]
|
||||||
|
* @see #parseColor
|
||||||
|
*/
|
||||||
|
public static String getColorAsString (Color c)
|
||||||
|
{
|
||||||
|
if (c == null)
|
||||||
|
c = SystemColor.control;
|
||||||
|
StringBuffer sb = new StringBuffer("[r=").append(c.getRed())
|
||||||
|
.append(",g=").append(c.getGreen())
|
||||||
|
.append(",b=").append(c.getBlue())
|
||||||
|
.append(",a=").append(c.getAlpha())
|
||||||
|
.append("]");
|
||||||
|
// System.out.println(sb.toString());
|
||||||
|
return sb.toString();
|
||||||
|
} // getColorAsString
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load Properties from Ini
|
||||||
|
*/
|
||||||
|
public static void load ()
|
||||||
|
{
|
||||||
|
primary1 = parseColor (Ini.getProperty(P_Primary1), primary1);
|
||||||
|
primary2 = parseColor (Ini.getProperty(P_Primary2), primary2);
|
||||||
|
primary3 = parseColor (Ini.getProperty(P_Primary3), primary3);
|
||||||
|
secondary1 = parseColor (Ini.getProperty(P_Secondary1), secondary1);
|
||||||
|
secondary2 = parseColor (Ini.getProperty(P_Secondary2), secondary2);
|
||||||
|
secondary3 = parseColor (Ini.getProperty(P_Secondary3), secondary3);
|
||||||
|
error = parseColor(Ini.getProperty(P_Error), error);
|
||||||
|
info = parseColor(Ini.getProperty(P_Info), info);
|
||||||
|
mandatory = parseColor(Ini.getProperty(P_Mandatory), mandatory);
|
||||||
|
inactive = parseColor(Ini.getProperty(P_Inactive), inactive);
|
||||||
|
white = parseColor(Ini.getProperty(P_White), white);
|
||||||
|
black = parseColor(Ini.getProperty(P_Black), black);
|
||||||
|
txt_ok = parseColor(Ini.getProperty(P_Txt_OK), txt_ok);
|
||||||
|
txt_error = parseColor(Ini.getProperty(P_Txt_Error), txt_error);
|
||||||
|
//
|
||||||
|
controlFont = parseFont(Ini.getProperty(P_Control), controlFont);
|
||||||
|
systemFont = parseFont(Ini.getProperty(P_System), systemFont);
|
||||||
|
userFont = parseFont(Ini.getProperty(P_User), userFont);
|
||||||
|
smallFont = parseFont(Ini.getProperty(P_Small), smallFont);
|
||||||
|
windowFont = parseFont(Ini.getProperty(P_Window), windowFont);
|
||||||
|
menuFont = parseFont(Ini.getProperty(P_Menu), menuFont);
|
||||||
|
//
|
||||||
|
CompiereColor cc = CompiereColor.parse(Ini.getProperty(P_CompiereColor));
|
||||||
|
CompiereColor.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);
|
||||||
|
// CompiereColor
|
||||||
|
Ini.remove(P_CompiereColor);
|
||||||
|
**/
|
||||||
|
// 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
|
||||||
|
// CompiereColor cc = new CompiereColor(SystemColor.control); // flat Windows 212-208-200
|
||||||
|
// CompiereColor cc = new CompiereColor(secondary3); // flat Metal 204-204-204
|
||||||
|
CompiereColor cc = new CompiereColor(secondary3, false);
|
||||||
|
CompiereColor.setDefaultBackground (cc);
|
||||||
|
//
|
||||||
|
save(); // save properties
|
||||||
|
} // reset
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse Color.
|
||||||
|
* <p>
|
||||||
|
* 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
|
||||||
{
|
{
|
||||||
ExtendedTheme.ERROR_BG_KEY,
|
int r = Integer.parseInt(information.substring(information.indexOf("r=")+2, information.indexOf(",g=")));
|
||||||
error,
|
int g = Integer.parseInt(information.substring(information.indexOf("g=")+2, information.indexOf(",b=")));
|
||||||
ExtendedTheme.ERROR_FG_KEY,
|
int b = 0;
|
||||||
txt_error,
|
int a = 255;
|
||||||
ExtendedTheme.INACTIVE_BG_KEY,
|
if (information.indexOf("a=") == -1)
|
||||||
inactive,
|
b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf("]")));
|
||||||
ExtendedTheme.INFO_BG_KEY,
|
else
|
||||||
info,
|
{
|
||||||
ExtendedTheme.MANDATORY_BG_KEY,
|
b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf(",a=")));
|
||||||
mandatory
|
a = Integer.parseInt(information.substring(information.indexOf("a=")+2, information.indexOf("]")));
|
||||||
};
|
}
|
||||||
table.putDefaults(defaults);
|
ColorUIResource retValue = new ColorUIResource(new Color(r, g, b, a));
|
||||||
}
|
// System.out.println(" - " + retValue.toString());
|
||||||
} // AdempiereTheme
|
return retValue;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.config(information + " - cannot parse: " + e.toString());
|
||||||
|
}
|
||||||
|
return stdColor;
|
||||||
|
} // parseColor
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse Font
|
||||||
|
* <p>
|
||||||
|
* 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
|
||||||
|
|
||||||
|
} // CompiereTheme
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,10 @@ public class CompiereUtils
|
||||||
{
|
{
|
||||||
// Paint in AdempiereColor?
|
// Paint in AdempiereColor?
|
||||||
CompiereColor cc = null;
|
CompiereColor cc = null;
|
||||||
boolean stdCC = c.getClientProperty(CompiereLookAndFeel.BACKGROUND_FILL) != null;
|
boolean stdCC = c.getClientProperty(AdempierePLAF.BACKGROUND_FILL) != null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cc = (CompiereColor)c.getClientProperty(CompiereLookAndFeel.BACKGROUND);
|
cc = (CompiereColor)c.getClientProperty(AdempierePLAF.BACKGROUND);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -458,7 +458,7 @@ public class CompiereUtils
|
||||||
c.setName("C" + String.valueOf(s_no++));
|
c.setName("C" + String.valueOf(s_no++));
|
||||||
System.out.print(c.getName());
|
System.out.print(c.getName());
|
||||||
System.out.print(" - " + c.getClass().getName());
|
System.out.print(" - " + c.getClass().getName());
|
||||||
System.out.println (" ** " + c.isOpaque() + " bg=" + (c.getClientProperty(CompiereLookAndFeel.BACKGROUND) != null));
|
System.out.println (" ** " + c.isOpaque() + " bg=" + (c.getClientProperty(AdempierePLAF.BACKGROUND) != null));
|
||||||
//
|
//
|
||||||
Container container = c.getParent();
|
Container container = c.getParent();
|
||||||
while (container != null)
|
while (container != null)
|
||||||
|
|
@ -466,7 +466,7 @@ public class CompiereUtils
|
||||||
System.out.print (" - " + container.getName() + " " + container.getClass().getName()
|
System.out.print (" - " + container.getName() + " " + container.getClass().getName()
|
||||||
+ " ** " + container.isOpaque());
|
+ " ** " + container.isOpaque());
|
||||||
if (container instanceof JComponent)
|
if (container instanceof JComponent)
|
||||||
System.out.print (" bg=" + (((JComponent)container).getClientProperty(CompiereLookAndFeel.BACKGROUND) != null));
|
System.out.print (" bg=" + (((JComponent)container).getClientProperty(AdempierePLAF.BACKGROUND) != null));
|
||||||
System.out.println ();
|
System.out.println ();
|
||||||
container = container.getParent();
|
container = container.getParent();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,8 @@ public class CButton extends JButton implements CEditor
|
||||||
public CButton (Action a)
|
public CButton (Action a)
|
||||||
{
|
{
|
||||||
super (a);
|
super (a);
|
||||||
|
setContentAreaFilled(false);
|
||||||
|
setOpaque(false);
|
||||||
} // CButton
|
} // CButton
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -81,6 +83,11 @@ public class CButton extends JButton implements CEditor
|
||||||
public CButton(String text, Icon icon)
|
public CButton(String text, Icon icon)
|
||||||
{
|
{
|
||||||
super (text, icon);
|
super (text, icon);
|
||||||
|
setContentAreaFilled(false);
|
||||||
|
setOpaque(false);
|
||||||
|
//
|
||||||
|
setFont(AdempierePLAF.getFont_Label());
|
||||||
|
setForeground(AdempierePLAF.getTextColor_Label());
|
||||||
} // CButton
|
} // CButton
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -94,7 +101,12 @@ public class CButton extends JButton implements CEditor
|
||||||
if (bg.equals(getBackground()))
|
if (bg.equals(getBackground()))
|
||||||
return;
|
return;
|
||||||
super.setBackground (bg);
|
super.setBackground (bg);
|
||||||
setBackgroundColor(new CompiereColor(bg));
|
// ignore calls from javax.swing.LookAndFeel.installColors(LookAndFeel.java:61)
|
||||||
|
if (!Trace.getCallerClass(1).startsWith("javax"))
|
||||||
|
{
|
||||||
|
setOpaque(true);
|
||||||
|
setContentAreaFilled(true);
|
||||||
|
}
|
||||||
this.repaint();
|
this.repaint();
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
||||||
|
|
@ -121,8 +133,9 @@ public class CButton extends JButton implements CEditor
|
||||||
public void setBackgroundColor (CompiereColor bg)
|
public void setBackgroundColor (CompiereColor bg)
|
||||||
{
|
{
|
||||||
if (bg == null)
|
if (bg == null)
|
||||||
bg = new CompiereColor(AdempierePLAF.getFormBackground());
|
bg = CompiereColor.getDefaultBackground();
|
||||||
putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
|
setOpaque(true);
|
||||||
|
putClientProperty(AdempierePLAF.BACKGROUND, bg);
|
||||||
super.setBackground (bg.getFlatColor());
|
super.setBackground (bg.getFlatColor());
|
||||||
this.repaint();
|
this.repaint();
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
@ -135,7 +148,7 @@ public class CButton extends JButton implements CEditor
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (CompiereColor)getClientProperty(CompiereLookAndFeel.BACKGROUND);
|
return (CompiereColor)getClientProperty(AdempierePLAF.BACKGROUND);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,8 @@ public class CCheckBox extends JCheckBox implements CEditor
|
||||||
*/
|
*/
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
//Default to transparent, works better under windows look and feel
|
setFont(AdempierePLAF.getFont_Label());
|
||||||
setOpaque(false);
|
setForeground(AdempierePLAF.getTextColor_Label());
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,10 @@ public class CComboBox extends JComboBox
|
||||||
*/
|
*/
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
|
// overwrite - otherwise Label Font
|
||||||
|
setFont(AdempierePLAF.getFont_Field());
|
||||||
|
setForeground(AdempierePLAF.getTextColor_Normal());
|
||||||
|
setBackground(false);
|
||||||
FIELD_HIGHT = getPreferredSize().height;
|
FIELD_HIGHT = getPreferredSize().height;
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,7 @@ public class CDialog extends JDialog
|
||||||
protected void dialogInit()
|
protected void dialogInit()
|
||||||
{
|
{
|
||||||
super.dialogInit();
|
super.dialogInit();
|
||||||
|
CompiereColor.setBackground(this);
|
||||||
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||||
setTitle(getTitle()); // remove Mn
|
setTitle(getTitle()); // remove Mn
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ public class CFrame extends JFrame
|
||||||
protected void frameInit ()
|
protected void frameInit ()
|
||||||
{
|
{
|
||||||
super.frameInit ();
|
super.frameInit ();
|
||||||
|
CompiereColor.setBackground(this);
|
||||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
//
|
//
|
||||||
Container c = getContentPane();
|
Container c = getContentPane();
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import java.awt.*;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import org.compiere.plaf.*;
|
import org.compiere.plaf.*;
|
||||||
|
import org.adempiere.plaf.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Label with Mnemonics interpretation
|
* Label with Mnemonics interpretation
|
||||||
|
|
@ -174,6 +175,9 @@ public class CLabel extends JLabel
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
if (getToolTipText() == null) // force Tool Tip
|
if (getToolTipText() == null) // force Tool Tip
|
||||||
setToolTipText(getText());
|
setToolTipText(getText());
|
||||||
|
//
|
||||||
|
setForeground(AdempierePLAF.getTextColor_Label());
|
||||||
|
setFont(AdempierePLAF.getFont_Label());
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,8 +109,8 @@ public class CPanel extends JPanel
|
||||||
return;
|
return;
|
||||||
super.setBackground (bg);
|
super.setBackground (bg);
|
||||||
// ignore calls from javax.swing.LookAndFeel.installColors(LookAndFeel.java:61)
|
// ignore calls from javax.swing.LookAndFeel.installColors(LookAndFeel.java:61)
|
||||||
//if (!Trace.getCallerClass(1).startsWith("javax"))
|
if (!Trace.getCallerClass(1).startsWith("javax"))
|
||||||
setBackgroundColor (new CompiereColor(bg));
|
setBackgroundColor (new CompiereColor(bg));
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -120,9 +120,9 @@ public class CPanel extends JPanel
|
||||||
public void setBackgroundColor (CompiereColor bg)
|
public void setBackgroundColor (CompiereColor bg)
|
||||||
{
|
{
|
||||||
if (bg == null)
|
if (bg == null)
|
||||||
bg = new CompiereColor(AdempierePLAF.getFormBackground());
|
bg = CompierePanelUI.getDefaultBackground();
|
||||||
setOpaque(true); // not transparent
|
setOpaque(true); // not transparent
|
||||||
putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
|
putClientProperty(AdempierePLAF.BACKGROUND, bg);
|
||||||
super.setBackground (bg.getFlatColor());
|
super.setBackground (bg.getFlatColor());
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
||||||
|
|
@ -134,7 +134,7 @@ public class CPanel extends JPanel
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (CompiereColor)getClientProperty(CompiereLookAndFeel.BACKGROUND);
|
return (CompiereColor)getClientProperty(AdempierePLAF.BACKGROUND);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -154,9 +154,9 @@ public class CPanel extends JPanel
|
||||||
public void setTabLevel (int level)
|
public void setTabLevel (int level)
|
||||||
{
|
{
|
||||||
if (level == 0)
|
if (level == 0)
|
||||||
putClientProperty(CompiereLookAndFeel.TABLEVEL, null);
|
putClientProperty(AdempierePLAF.TABLEVEL, null);
|
||||||
else
|
else
|
||||||
putClientProperty(CompiereLookAndFeel.TABLEVEL, new Integer(level));
|
putClientProperty(AdempierePLAF.TABLEVEL, new Integer(level));
|
||||||
} // setTabLevel
|
} // setTabLevel
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -167,7 +167,7 @@ public class CPanel extends JPanel
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Integer ll = (Integer)getClientProperty(CompiereLookAndFeel.TABLEVEL);
|
Integer ll = (Integer)getClientProperty(AdempierePLAF.TABLEVEL);
|
||||||
if (ll != null)
|
if (ll != null)
|
||||||
return ll.intValue();
|
return ll.intValue();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,8 @@ public class CPassword extends JPasswordField implements CEditor
|
||||||
*/
|
*/
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
|
setFont(AdempierePLAF.getFont_Field());
|
||||||
|
setForeground(AdempierePLAF.getTextColor_Normal());
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ public class CScrollPane extends JScrollPane
|
||||||
public CScrollPane (Component view, int vsbPolicy, int hsbPolicy)
|
public CScrollPane (Component view, int vsbPolicy, int hsbPolicy)
|
||||||
{
|
{
|
||||||
super (view, vsbPolicy, hsbPolicy);
|
super (view, vsbPolicy, hsbPolicy);
|
||||||
|
setBackgroundColor(null);
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
getViewport().setOpaque(false);
|
getViewport().setOpaque(false);
|
||||||
} // CScollPane
|
} // CScollPane
|
||||||
|
|
@ -80,8 +81,12 @@ public class CScrollPane extends JScrollPane
|
||||||
public void setBackgroundColor (CompiereColor bg)
|
public void setBackgroundColor (CompiereColor bg)
|
||||||
{
|
{
|
||||||
if (bg == null)
|
if (bg == null)
|
||||||
bg = new CompiereColor(AdempierePLAF.getFormBackground());
|
bg = CompierePanelUI.getDefaultBackground();
|
||||||
putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
|
putClientProperty(AdempierePLAF.BACKGROUND, bg);
|
||||||
|
// super.setBackground(bg.getFlatColor());
|
||||||
|
// getViewport().putClientProperty(CompierePLAF.BACKGROUND, bg);
|
||||||
|
// getViewport().setBackground(bg.getFlatColor());
|
||||||
|
// getViewport().setOpaque(true);
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
||||||
} // CScollPane
|
} // CScollPane
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,9 @@ public class CTabbedPane extends JTabbedPane
|
||||||
*/
|
*/
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
|
setOpaque(false);
|
||||||
|
setFont(AdempierePLAF.getFont_Label());
|
||||||
|
setForeground(AdempierePLAF.getTextColor_Label());
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -109,7 +112,9 @@ public class CTabbedPane extends JTabbedPane
|
||||||
if (bg.equals(getBackground()))
|
if (bg.equals(getBackground()))
|
||||||
return;
|
return;
|
||||||
super.setBackground (bg);
|
super.setBackground (bg);
|
||||||
setBackgroundColor (new CompiereColor(bg));
|
// ignore calls from javax.swing.LookAndFeel.installColors(LookAndFeel.java:61)
|
||||||
|
if (!Trace.getCallerClass(1).startsWith("javax"))
|
||||||
|
setBackgroundColor (new CompiereColor(bg));
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -127,8 +132,9 @@ public class CTabbedPane extends JTabbedPane
|
||||||
public void setBackgroundColor (CompiereColor bg)
|
public void setBackgroundColor (CompiereColor bg)
|
||||||
{
|
{
|
||||||
if (bg == null)
|
if (bg == null)
|
||||||
bg = new CompiereColor(AdempierePLAF.getFormBackground());
|
bg = CompierePanelUI.getDefaultBackground();
|
||||||
putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
|
setOpaque(true);
|
||||||
|
putClientProperty(AdempierePLAF.BACKGROUND, bg);
|
||||||
super.setBackground (bg.getFlatColor());
|
super.setBackground (bg.getFlatColor());
|
||||||
//
|
//
|
||||||
repaint();
|
repaint();
|
||||||
|
|
@ -142,7 +148,7 @@ public class CTabbedPane extends JTabbedPane
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (CompiereColor)getClientProperty(CompiereLookAndFeel.BACKGROUND);
|
return (CompiereColor)getClientProperty(AdempierePLAF.BACKGROUND);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -190,10 +196,10 @@ public class CTabbedPane extends JTabbedPane
|
||||||
if (component instanceof JPanel)
|
if (component instanceof JPanel)
|
||||||
{
|
{
|
||||||
JPanel p = (JPanel)component;
|
JPanel p = (JPanel)component;
|
||||||
if (p.getClientProperty(CompiereLookAndFeel.BACKGROUND) == null)
|
if (p.getClientProperty(AdempierePLAF.BACKGROUND) == null)
|
||||||
{
|
{
|
||||||
//AdempiereColor.setBackground(p);
|
CompiereColor.setBackground(p);
|
||||||
//p.setOpaque(true);
|
p.setOpaque(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Set first
|
// Set first
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Compiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -45,8 +45,6 @@ public class CTable extends JTable
|
||||||
setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
||||||
getTableHeader().addMouseListener(new CTableMouseListener());
|
getTableHeader().addMouseListener(new CTableMouseListener());
|
||||||
setSurrendersFocusOnKeystroke(true);
|
setSurrendersFocusOnKeystroke(true);
|
||||||
//Default row height too narrow
|
|
||||||
setRowHeight(getFont().getSize() + 8);
|
|
||||||
} // CTable
|
} // CTable
|
||||||
|
|
||||||
/** Last model index sorted */
|
/** Last model index sorted */
|
||||||
|
|
@ -303,12 +301,4 @@ public class CTable extends JTable
|
||||||
}
|
}
|
||||||
} // CTableMouseListener
|
} // CTableMouseListener
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFont(Font font) {
|
|
||||||
super.setFont(font);
|
|
||||||
//Update row height
|
|
||||||
setRowHeight(getFont().getSize() + 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // CTable
|
} // CTable
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,8 @@ public class CTextArea extends JScrollPane
|
||||||
m_textArea = textArea;
|
m_textArea = textArea;
|
||||||
super.setOpaque(false);
|
super.setOpaque(false);
|
||||||
super.getViewport().setOpaque(false);
|
super.getViewport().setOpaque(false);
|
||||||
|
m_textArea.setFont(AdempierePLAF.getFont_Field());
|
||||||
|
m_textArea.setForeground(AdempierePLAF.getTextColor_Normal());
|
||||||
m_textArea.setLineWrap(true);
|
m_textArea.setLineWrap(true);
|
||||||
m_textArea.setWrapStyleWord(true);
|
m_textArea.setWrapStyleWord(true);
|
||||||
// Overwrite default Tab
|
// Overwrite default Tab
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,15 @@ public class CTextField extends JTextField
|
||||||
*/
|
*/
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
|
setFont(AdempierePLAF.getFont_Field());
|
||||||
|
setForeground(AdempierePLAF.getTextColor_Normal());
|
||||||
setBackground (false);
|
setBackground (false);
|
||||||
|
// Minimum Size
|
||||||
|
Dimension size = getPreferredSize();
|
||||||
|
if (size != null)
|
||||||
|
size = new Dimension (20,10);
|
||||||
|
size.width = 30;
|
||||||
|
setMinimumSize(size);
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,8 @@ public class CTextPane extends JScrollPane
|
||||||
super.setOpaque(false);
|
super.setOpaque(false);
|
||||||
super.getViewport().setOpaque(false);
|
super.getViewport().setOpaque(false);
|
||||||
m_textPane.setContentType("text/html");
|
m_textPane.setContentType("text/html");
|
||||||
|
m_textPane.setFont(AdempierePLAF.getFont_Field());
|
||||||
|
m_textPane.setForeground(AdempierePLAF.getTextColor_Normal());
|
||||||
} // CTextPane
|
} // CTextPane
|
||||||
|
|
||||||
private JTextPane m_textPane = null;
|
private JTextPane m_textPane = null;
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,11 @@ public class CToggleButton extends JToggleButton implements CEditor
|
||||||
public CToggleButton (String text, Icon icon, boolean selected)
|
public CToggleButton (String text, Icon icon, boolean selected)
|
||||||
{
|
{
|
||||||
super(text, icon, selected);
|
super(text, icon, selected);
|
||||||
|
setContentAreaFilled(false);
|
||||||
|
setOpaque(false);
|
||||||
|
//
|
||||||
|
setFont(AdempierePLAF.getFont_Label());
|
||||||
|
setForeground(AdempierePLAF.getTextColor_Label());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
@ -140,6 +145,12 @@ public class CToggleButton extends JToggleButton implements CEditor
|
||||||
if (bg.equals(getBackground()))
|
if (bg.equals(getBackground()))
|
||||||
return;
|
return;
|
||||||
super.setBackground( bg);
|
super.setBackground( bg);
|
||||||
|
// ignore calls from javax.swing.LookAndFeel.installColors(LookAndFeel.java:61)
|
||||||
|
if (!Trace.getCallerClass(1).startsWith("javax"))
|
||||||
|
{
|
||||||
|
setOpaque(true);
|
||||||
|
setContentAreaFilled(true);
|
||||||
|
}
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -165,9 +176,9 @@ public class CToggleButton extends JToggleButton implements CEditor
|
||||||
public void setBackgroundColor (CompiereColor bg)
|
public void setBackgroundColor (CompiereColor bg)
|
||||||
{
|
{
|
||||||
if (bg == null)
|
if (bg == null)
|
||||||
bg = new CompiereColor(AdempierePLAF.getFormBackground());
|
bg = CompiereColor.getDefaultBackground();
|
||||||
setOpaque(true);
|
setOpaque(true);
|
||||||
putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
|
putClientProperty(AdempierePLAF.BACKGROUND, bg);
|
||||||
super.setBackground (bg.getFlatColor());
|
super.setBackground (bg.getFlatColor());
|
||||||
} // setBackground
|
} // setBackground
|
||||||
|
|
||||||
|
|
@ -179,7 +190,7 @@ public class CToggleButton extends JToggleButton implements CEditor
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (CompiereColor)getClientProperty(CompiereLookAndFeel.BACKGROUND);
|
return (CompiereColor)getClientProperty(AdempierePLAF.BACKGROUND);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,9 @@ public final class Ini implements Serializable
|
||||||
/** UI Theme */
|
/** UI Theme */
|
||||||
public static final String P_UI_THEME = "UITheme";
|
public static final String P_UI_THEME = "UITheme";
|
||||||
|
|
||||||
/** Flat Color UI
|
/** Flat Color UI*/
|
||||||
public static final String P_UI_FLAT = "UIFlat";
|
public static final String P_UI_FLAT = "UIFlat";
|
||||||
private static final boolean DEFAULT_UI_FLAT = false;
|
/*private static final boolean DEFAULT_UI_FLAT = false;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Auto Save */
|
/** Auto Save */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue