This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 25472 - NbTheme does not support all properties of MetalTheme in XML
Summary: NbTheme does not support all properties of MetalTheme in XML
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: PC All
: P3 blocker (vote)
Assignee: David Simonek
URL:
Keywords:
Depends on: 25589 25590 25866
Blocks: 25861
  Show dependency tree
 
Reported: 2002-07-09 19:51 UTC by _ tboudreau
Modified: 2008-12-22 20:40 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Patch - heavy rewrite of Themes support (22.56 KB, patch)
2002-07-12 17:30 UTC, _ tboudreau
Details | Diff
Example theme file (note change in filename capitalization - will not conflict) (4.12 KB, text/plain)
2002-07-12 17:34 UTC, _ tboudreau
Details
Binary patch file (put this in $NB_HOME/lib/patches and the themes.xml file in $NB_USER/system and you can try the patch) (120.88 KB, application/octet-stream)
2002-07-12 17:50 UTC, _ tboudreau
Details
Fixed theme file - first copy was corrupted (4.13 KB, text/plain)
2002-07-14 16:52 UTC, _ tboudreau
Details
Example theme file including insets support (4.30 KB, text/plain)
2002-07-14 17:13 UTC, _ tboudreau
Details
Revised source code patch including theme support & a fixing a couple missed //NOI18N's (23.63 KB, patch)
2002-07-14 17:15 UTC, _ tboudreau
Details | Diff
Revised binary patch including insets support (121.20 KB, application/octet-stream)
2002-07-14 17:15 UTC, _ tboudreau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2002-07-09 19:51:33 UTC
I would like to use theming to run NetBeans with
darker backgrounds and light text. 
org.netbeans.core.NbTheme supports primary colors
and font sizes, but does not support specifying
other properties of MetalTheme (which it inherits
from) in XML, e.g. UserFontColor, etc.  IMHO
NbTheme should allow access to all of the
properties available for Swing Metal L&F themes.
Comment 1 _ tboudreau 2002-07-12 17:30:09 UTC
Created attachment 6647 [details]
Patch - heavy rewrite of Themes support
Comment 2 _ tboudreau 2002-07-12 17:34:51 UTC
Created attachment 6648 [details]
Example theme file (note change in filename capitalization - will not conflict)
Comment 3 _ tboudreau 2002-07-12 17:48:14 UTC
The attached patch is a nearly complete rewrite of themes
functionality, making it much more flexible (if necessary, backward
compatibility can be kept with the old version, but I think nobody is
really using it and it was never offical API).

The following changes were made:
 - Redesign of the XML format
    - The old format hard-coded tags for each property of
      MetalTheme.  The new version uses a generic format,   
      e.g.
      <color key="primary1" r="204" g="204" b="204/>
 - All tags in the new theme format are lower case, not
   mixed case
 - The expected theme file name was changed from Themes.xml
   to themes.xml
 - The old version stored MetalTheme properties in private
   fields.  The new version stores them in UIDefaults.
 - The new version allows themes to address all contents
   of UIDefaults, not just those aspects exposed by 
   MetalTheme
 - Supports tags for fonts, colors, strings, dimensions,
   integers and booleans
 - An exception thrown on startup when a theme file 
   is not present was eliminated
 - Multiple themes may be active at the same time.  This 
   allows for separate sections covering things like 
   font and scrollbar sizes, different sets of colors
   for different controls, etc.  See the attached
   themes.xml file for an example.

Anyway, I hope you will accept this revision to themes support!  I am
already enjoying it :-)
Comment 4 _ tboudreau 2002-07-12 17:50:42 UTC
Created attachment 6649 [details]
Binary patch file (put this in $NB_HOME/lib/patches and the themes.xml file in $NB_USER/system and you can try the patch)
Comment 5 _ tboudreau 2002-07-12 17:54:36 UTC
Note - the above binary patch also contains patches for:

org/openide/explorer/propertysheet/PropertyPanel
org/openide/explorer/view/TableSheetCell
org/openide/awt/SplittedPanel
org/openide/explorer/propertysheet/PropertySheet
org/openide/explorer/propertysheet/SheetButton

because these classes were getting their color settings from
java.awt.SystemColor rather than javax.swing.UIManager (see
issues 25589 and 25590).
Comment 6 Jesse Glick 2002-07-12 21:18:14 UTC
There is a typo in the example theme (check XML).
Comment 7 Jesse Glick 2002-07-12 21:32:12 UTC
You forgot to add insets support. Needed to e.g. kill some of the
useless space on JTabbedPane tabs.
Comment 8 _ tboudreau 2002-07-14 16:52:13 UTC
Created attachment 6653 [details]
Fixed theme file - first copy was corrupted
Comment 9 _ tboudreau 2002-07-14 17:13:58 UTC
Created attachment 6654 [details]
Example theme file including insets support
Comment 10 _ tboudreau 2002-07-14 17:15:03 UTC
Created attachment 6655 [details]
Revised source code patch including theme support & a fixing a couple missed //NOI18N's
Comment 11 _ tboudreau 2002-07-14 17:15:52 UTC
Created attachment 6656 [details]
Revised binary patch including insets support
Comment 12 Marek Grummich 2002-07-22 08:30:46 UTC
Target milestone was changed from '3.4' to TBD.
Comment 13 Marek Grummich 2002-07-22 08:34:57 UTC
Target milestone was changed from '3.4' to TBD.
Comment 14 Peter Zavadsky 2002-07-25 15:01:02 UTC
When will be the patch put in? 
I'm using it over a week, and works fine. Really cool thing.
Comment 15 David Simonek 2002-07-30 12:16:14 UTC
Ok Peter, you're using it, knows more about it then me, so please
integrate. I can do code review if you want. Thanks.
Comment 16 Peter Zavadsky 2002-07-30 13:55:43 UTC
Well, it's no problem for me to integrate it. 

But let me to have a little question first:
Isn't it better to do by somebody who will maintain the code
afterwards? I don't know whom this part belongs.
I also don't know much about this issue, I'm just enjoying it like an
ordinary user.
Comment 17 David Simonek 2002-07-30 14:10:54 UTC
Yes, I agree - however this piece of code belongs to nobody (in past
it was maintained by ui team). But ok, core/AWT/Swing is assigned to
me, so it's fair to take it back. Will try to review the code and
integrate changes soon.
Comment 18 Jesse Glick 2002-07-30 15:31:19 UTC
By the way, possible longer-term enhancements we could make:

1. Permit each theme file to be in a separate XML file, with one XML
file for the master theme config. Thus allow modules to add theme
pieces, more or less like toolbars.

2. Provide a GUI (Options) for turning on and off themes
interactively. Could update UI for some sample JPanel with typical
components (not live IDE - too many problems).

3. Provide a GUI for editing particular themes - not clear how
exactly, but ability to add new properties to the configured list, and
use of standard property editors for the values (font chooser etc.).
Comment 19 David Simonek 2002-09-02 11:55:10 UTC
patch integrated in main trunk, together with patches for 25589 and
25590. Thanks for support.