You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/03/22 19:07:28 UTC
svn commit: r926230 - in
/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra:
TerraListViewSkin.java TerraTableViewSkin.java
Author: gbrown
Date: Mon Mar 22 18:07:27 2010
New Revision: 926230
URL: http://svn.apache.org/viewvc?rev=926230&view=rev
Log:
Add alternateItemColor style and indexed color setters to TerraListViewSkin.
Modified:
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java?rev=926230&r1=926229&r2=926230&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java Mon Mar 22 18:07:27 2010
@@ -58,8 +58,8 @@ public class TerraListViewSkin extends C
private Color selectionBackgroundColor;
private Color inactiveSelectionColor;
private Color inactiveSelectionBackgroundColor;
- private Color highlightColor;
private Color highlightBackgroundColor;
+ private Color alternateItemColor;
private boolean showHighlight;
private boolean variableItemHeight;
private Insets checkboxPadding = new Insets(2, 2, 2, 0);
@@ -86,8 +86,8 @@ public class TerraListViewSkin extends C
selectionBackgroundColor = theme.getColor(13);
inactiveSelectionColor = theme.getColor(1);
inactiveSelectionBackgroundColor = theme.getColor(9);
- highlightColor = theme.getColor(1);
highlightBackgroundColor = theme.getColor(10);
+ alternateItemColor = null;
showHighlight = true;
}
@@ -302,6 +302,19 @@ public class TerraListViewSkin extends C
}
}
+ // Paint the item background
+ if (alternateItemColor != null) {
+ for (int itemIndex = itemStart; itemIndex <= itemEnd; itemIndex++) {
+ int itemY = getItemY(itemIndex);
+ int rowHeight = getItemHeight(itemIndex);
+ if (itemIndex % 2 > 0) {
+ graphics.setPaint(alternateItemColor);
+ graphics.fillRect(0, itemY, width, rowHeight + 1);
+ }
+ }
+ }
+
+ // Paint the item content
for (int itemIndex = itemStart; itemIndex <= itemEnd; itemIndex++) {
Object item = listData.get(itemIndex);
boolean highlighted = (itemIndex == highlightedIndex
@@ -490,6 +503,11 @@ public class TerraListViewSkin extends C
setColor(GraphicsUtilities.decodeColor(color));
}
+ public final void setColor(int color) {
+ TerraTheme theme = (TerraTheme)Theme.getTheme();
+ setColor(theme.getColor(color));
+ }
+
public Color getDisabledColor() {
return disabledColor;
}
@@ -511,6 +529,11 @@ public class TerraListViewSkin extends C
setDisabledColor(GraphicsUtilities.decodeColor(disabledColor));
}
+ public final void setDisabledColor(int disabledColor) {
+ TerraTheme theme = (TerraTheme)Theme.getTheme();
+ setDisabledColor(theme.getColor(disabledColor));
+ }
+
public Color getBackgroundColor() {
return backgroundColor;
}
@@ -528,6 +551,10 @@ public class TerraListViewSkin extends C
setBackgroundColor(GraphicsUtilities.decodeColor(backgroundColor));
}
+ public final void setBackgroundColor(int backgroundColor) {
+ TerraTheme theme = (TerraTheme)Theme.getTheme();
+ setBackgroundColor(theme.getColor(backgroundColor));
+ }
public Color getSelectionColor() {
return selectionColor;
@@ -550,6 +577,11 @@ public class TerraListViewSkin extends C
setSelectionColor(GraphicsUtilities.decodeColor(selectionColor));
}
+ public final void setSelectionColor(int selectionColor) {
+ TerraTheme theme = (TerraTheme)Theme.getTheme();
+ setSelectionColor(theme.getColor(selectionColor));
+ }
+
public Color getSelectionBackgroundColor() {
return selectionBackgroundColor;
}
@@ -571,6 +603,11 @@ public class TerraListViewSkin extends C
setSelectionBackgroundColor(GraphicsUtilities.decodeColor(selectionBackgroundColor));
}
+ public final void setSelectionBackgroundColor(int selectionBackgroundColor) {
+ TerraTheme theme = (TerraTheme)Theme.getTheme();
+ setSelectionBackgroundColor(theme.getColor(selectionBackgroundColor));
+ }
+
public Color getInactiveSelectionColor() {
return inactiveSelectionColor;
}
@@ -592,6 +629,11 @@ public class TerraListViewSkin extends C
setInactiveSelectionColor(GraphicsUtilities.decodeColor(inactiveSelectionColor));
}
+ public final void setInactiveSelectionColor(int inactiveSelectionColor) {
+ TerraTheme theme = (TerraTheme)Theme.getTheme();
+ setInactiveSelectionColor(theme.getColor(inactiveSelectionColor));
+ }
+
public Color getInactiveSelectionBackgroundColor() {
return inactiveSelectionBackgroundColor;
}
@@ -613,25 +655,9 @@ public class TerraListViewSkin extends C
setInactiveSelectionBackgroundColor(GraphicsUtilities.decodeColor(inactiveSelectionBackgroundColor));
}
- public Color getHighlightColor() {
- return highlightColor;
- }
-
- public void setHighlightColor(Color highlightColor) {
- if (highlightColor == null) {
- throw new IllegalArgumentException("highlightColor is null.");
- }
-
- this.highlightColor = highlightColor;
- repaintComponent();
- }
-
- public final void setHighlightColor(String highlightColor) {
- if (highlightColor == null) {
- throw new IllegalArgumentException("highlightColor is null.");
- }
-
- setHighlightColor(GraphicsUtilities.decodeColor(highlightColor));
+ public final void setInactiveSelectionBackgroundColor(int inactiveSelectionBackgroundColor) {
+ TerraTheme theme = (TerraTheme)Theme.getTheme();
+ setInactiveSelectionBackgroundColor(theme.getColor(inactiveSelectionBackgroundColor));
}
public Color getHighlightBackgroundColor() {
@@ -655,6 +681,33 @@ public class TerraListViewSkin extends C
setHighlightBackgroundColor(GraphicsUtilities.decodeColor(highlightBackgroundColor));
}
+ public final void setHighlightBackgroundColor(int highlightBackgroundColor) {
+ TerraTheme theme = (TerraTheme)Theme.getTheme();
+ setHighlightBackgroundColor(theme.getColor(highlightBackgroundColor));
+ }
+
+ public Color getAlternateItemColor() {
+ return alternateItemColor;
+ }
+
+ public void setAlternateItemColor(Color alternateItemColor) {
+ this.alternateItemColor = alternateItemColor;
+ repaintComponent();
+ }
+
+ public final void setAlternateItemColor(String alternateItemColor) {
+ if (alternateItemColor == null) {
+ throw new IllegalArgumentException("alternateItemColor is null.");
+ }
+
+ setAlternateItemColor(GraphicsUtilities.decodeColor(alternateItemColor));
+ }
+
+ public final void setAlternateItemColor(int alternateItemColor) {
+ TerraTheme theme = (TerraTheme)Theme.getTheme();
+ setAlternateItemColor(theme.getColor(alternateItemColor));
+ }
+
public boolean getShowHighlight() {
return showHighlight;
}
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java?rev=926230&r1=926229&r2=926230&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java Mon Mar 22 18:07:27 2010
@@ -344,7 +344,7 @@ public class TerraTableViewSkin extends
}
}
- // Paint the row backgrounds
+ // Paint the row background
if (alternateRowColor != null) {
for (int rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {
int rowY = getRowY(rowIndex);
@@ -378,7 +378,7 @@ public class TerraTableViewSkin extends
}
}
- // Paint the table contents
+ // Paint the row content
for (int rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {
Object rowData = tableData.get(rowIndex);
boolean rowHighlighted = (rowIndex == highlightedIndex