[hg] main-silver: #216558: DataView table colors are not exposed...

  • From: Jaroslav Havlin < >
  • To:
  • Subject: [hg] main-silver: #216558: DataView table colors are not exposed...
  • Date: Fri, 08 Feb 2013 06:39:59 -0800

changeset 0af325a138a0 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/0af325a138a0
description:
        #216558: DataView table colors are not exposed in LNF Customization

diffstat:

 db.dataview/src/org/netbeans/modules/db/dataview/output/DataViewTableUI.java 
|  29 ++++++-
 db.dataview/src/org/netbeans/modules/db/dataview/table/JXTableDecorator.java 
|   2 +-
 db.dataview/src/org/netbeans/modules/db/dataview/table/ResultSetJXTable.java 
|   2 +-
 db.dataview/src/org/netbeans/modules/db/dataview/util/JXDateTimePicker.java  
|  37 +++++++++-
 4 files changed, 61 insertions(+), 9 deletions(-)

diffs (145 lines):

diff --git 
a/db.dataview/src/org/netbeans/modules/db/dataview/output/DataViewTableUI.java
 
b/db.dataview/src/org/netbeans/modules/db/dataview/output/DataViewTableUI.java
--- 
a/db.dataview/src/org/netbeans/modules/db/dataview/output/DataViewTableUI.java
+++ 
b/db.dataview/src/org/netbeans/modules/db/dataview/output/DataViewTableUI.java
@@ -62,6 +62,7 @@
 import javax.swing.JPopupMenu;
 import javax.swing.JTable;
 import javax.swing.RowFilter;
+import javax.swing.UIManager;
 import javax.swing.border.LineBorder;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
@@ -154,11 +155,29 @@
 
     private static class UpdatedResultSetCellRenderer extends 
ResultSetCellRenderer {
         static int borderThickness = 1;
-        static Color green = new Color(0, 128, 0);
-        static Color gray = new Color(245, 245, 245);
+        static Color emptyNullForeground;
+        static Color selectedForeground;
+        static Color unselectedForeground;
         private JComponent holder = new JComponent() {};
         DataView dataView;
 
+        static {
+            Color emptyNullFromMngr = UIManager.getColor(
+                    
"nb.dataview.tablecell.edited.selected.emptyNull.foreground"); //NOI18N
+            emptyNullForeground = emptyNullFromMngr != null
+                    ? emptyNullFromMngr
+                    : new Color(245, 245, 245); // gray color
+            Color selectedFgFromMngr = UIManager.getColor(
+                    "nb.dataview.tablecell.edited.selected.foreground"); 
//NOI18N
+            selectedForeground = selectedFgFromMngr != null
+                    ? selectedFgFromMngr
+                    : Color.ORANGE;
+            Color unselectedFgFromMngr = UIManager.getColor(
+                    "nb.dataview.tablecell.edited.unselected.foreground"); 
//NOI18N
+            unselectedForeground = unselectedFgFromMngr != null
+                    ? unselectedFgFromMngr
+                    : new Color(0, 128, 0); // green color
+        }
         public UpdatedResultSetCellRenderer(DataView dView) {
             dataView = dView;
             holder.setLayout(new BorderLayout());
@@ -176,17 +195,17 @@
 
             if (isSelected) {
                 if ((obj == null && value == null) || (obj != null && value 
!= null && value.equals(obj))) {
-                    color = gray;
+                    color = emptyNullForeground;
                     override = true;
                 } else {
-                    color = Color.ORANGE;
+                    color = selectedForeground;
                     override = true;
                 }
             } else {
                 if ((obj == null && value == null) || (obj != null && value 
!= null && value.equals(obj))) {
                     color = table.getForeground();
                 } else {
-                    color = green;
+                    color = unselectedForeground;
                     override = true;
                 }
             }
diff --git 
a/db.dataview/src/org/netbeans/modules/db/dataview/table/JXTableDecorator.java
 
b/db.dataview/src/org/netbeans/modules/db/dataview/table/JXTableDecorator.java
--- 
a/db.dataview/src/org/netbeans/modules/db/dataview/table/JXTableDecorator.java
+++ 
b/db.dataview/src/org/netbeans/modules/db/dataview/table/JXTableDecorator.java
@@ -60,7 +60,7 @@
     public static final Color ROW_COLOR = 
UIManager.getColor("nb.dataview.table.background") != null ? 
UIManager.getColor("nb.dataview.table.background") : Color.WHITE;
     public static final Color ALTERNATE_ROW_COLOR = 
UIManager.getColor("nb.dataview.table.altbackground") != null ? 
UIManager.getColor("nb.dataview.table.altbackground") : new Color(0.92F, 
0.95F, 0.99F);
     public static final Color GRID_COLOR = 
UIManager.getColor("nb.dataview.table.gridbackground") != null ? 
UIManager.getColor("nb.dataview.table.gridbackground") : new Color(14277081);
-    public static final Color ROLLOVER_ROW_COLOR = 
UIManager.getColor("nb.dataview.table.altbackground") != null ? 
UIManager.getColor("nb.dataview.table.altbackground") : new Color(0.94F, 
0.96F, 0.96F);
+    public static final Color ROLLOVER_ROW_COLOR = 
UIManager.getColor("nb.dataview.table.rollOverRowBackground") != null ? 
UIManager.getColor("nb.dataview.table.rollOverRowBackground") : new 
Color(0.94F, 0.96F, 0.96F);
 
     JXTableDecorator() {
         super();
diff --git 
a/db.dataview/src/org/netbeans/modules/db/dataview/table/ResultSetJXTable.java
 
b/db.dataview/src/org/netbeans/modules/db/dataview/table/ResultSetJXTable.java
--- 
a/db.dataview/src/org/netbeans/modules/db/dataview/table/ResultSetJXTable.java
+++ 
b/db.dataview/src/org/netbeans/modules/db/dataview/table/ResultSetJXTable.java
@@ -124,7 +124,7 @@
         setAutoResizeMode(JXTable.AUTO_RESIZE_OFF);
         setFillsViewportHeight(true);
 
-        
setHighlighters(HighlighterFactory.createAlternateStriping(Color.WHITE, 
ALTERNATE_ROW_COLOR));
+        
setHighlighters(HighlighterFactory.createAlternateStriping(ROW_COLOR, 
ALTERNATE_ROW_COLOR));
         addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, 
ROLLOVER_ROW_COLOR, null));
 
         setDefaultCellRenderers();
diff --git 
a/db.dataview/src/org/netbeans/modules/db/dataview/util/JXDateTimePicker.java 
b/db.dataview/src/org/netbeans/modules/db/dataview/util/JXDateTimePicker.java
--- 
a/db.dataview/src/org/netbeans/modules/db/dataview/util/JXDateTimePicker.java
+++ 
b/db.dataview/src/org/netbeans/modules/db/dataview/util/JXDateTimePicker.java
@@ -358,6 +358,31 @@
         _monthView = new JXMonthView();
 //        _monthView.setSelectionModel(new SingleDaySelectionModel());
         _monthView.setTraversable(true);
+
+        if (UIManager.getColor("nb.dataview.jxdatetimepicker.background") != 
null) { //NOI18N
+            
_monthView.setBackground(UIManager.getColor("nb.dataview.jxdatetimepicker.background"));
 //NOI18N
+        }
+        if (UIManager.getColor("nb.dataview.jxdatetimepicker.foreground") != 
null) { //NOI18N
+            
_monthView.setForeground(UIManager.getColor("nb.dataview.jxdatetimepicker.foreground"));
 //NOI18N
+        }
+        if 
(UIManager.getColor("nb.dataview.jxdatetimepicker.selectedBackground") != 
null) { //NOI18N
+            
_monthView.setSelectionBackground(UIManager.getColor("nb.dataview.jxdatetimepicker.selectedBackground"));
 //NOI18N
+        }
+        if 
(UIManager.getColor("nb.dataview.jxdatetimepicker.selectedForeground") != 
null) { //NOI18N
+            
_monthView.setSelectionForeground(UIManager.getColor("nb.dataview.jxdatetimepicker.selectedForeground"));
 //NOI18N
+        }
+        if 
(UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringBackground") != 
null) {
+            
_monthView.setMonthStringBackground(UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringBackground"));
 //NOI18N
+        }
+        if 
(UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringForeground") != 
null) { //NOI18N
+            
_monthView.setMonthStringForeground(UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringForeground"));
 //NOI18N
+        }
+        if 
(UIManager.getColor("nb.dataview.jxdatetimepicker.daysOfTheWeekForeground") 
!= null) { //NOI18N
+            
_monthView.setMonthStringForeground(UIManager.getColor("nb.dataview.jxdatetimepicker.daysOfTheWeekForeground"));
 //NOI18N
+        }
+        if 
(UIManager.getColor("nb.dataview.jxdatetimepicker.todayBackground") != null) 
{ //NOI18N
+            
_monthView.setMonthStringForeground(UIManager.getColor("nb.dataview.jxdatetimepicker.todayBackground"));
 //NOI18N
+        }
         _monthView.addPropertyChangeListener(getMonthViewListener());
     }
 
@@ -918,11 +943,19 @@
         @SuppressWarnings("rawtypes")
         TodayPanel() {
             super(new FlowLayout());
-            setBackgroundPainter(new MattePainter(new GradientPaint(0, 0, 
new Color(238, 238, 238), 0, 1, Color.WHITE)));
+            Color gradientStart = 
UIManager.getColor("nb.dataview.jxdatetimepicker.todayPanel.background.gradient.start")
 != null //NOI18N
+                    ? 
UIManager.getColor("nb.dataview.jxdatetimepicker.todayPanel.background.gradient.start")
 //NOI18N
+                    : new Color(238, 238, 238);
+            Color gradientEnd = 
UIManager.getColor("nb.dataview.jxdatetimepicker.todayPanel.background.gradient.end")
 != null //NOI18N
+                    ? 
UIManager.getColor("nb.dataview.jxdatetimepicker.todayPanel.background.gradient.end")
 //NOI18N
+                    : Color.WHITE;
+            setBackgroundPainter(new MattePainter(new GradientPaint(0, 0, 
gradientStart, 0, 1, gradientEnd)));
             todayAction = new TodayAction();
             todayLink = new JXHyperlink(todayAction);
             todayLink.addMouseListener(createDoubleClickListener());
-            Color textColor = new Color(16, 66, 104);
+            Color textColor = 
UIManager.getColor("nb.dataview.jxdatetimepicker.todayPanel.linkForeground") 
!= null //NOI18N
+                    ? 
UIManager.getColor("nb.dataview.jxdatetimepicker.todayPanel.linkForeground") 
//NOI18N
+                    : new Color(16, 66, 104);
             todayLink.setUnclickedColor(textColor);
             todayLink.setClickedColor(textColor);
             add(todayLink);

[hg] main-silver: #216558: DataView table colors are not exposed...

Jaroslav Havlin 02/08/2013

Project Features

About this Project

DB was started in November 2009, is owned by Antonin Nebuzelsky, and has 113 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close