aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java74
1 files changed, 69 insertions, 5 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java b/src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java
index f5881e5..5b3db7d 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java
@@ -36,6 +36,10 @@ import java.io.Serializable;
* @see java.awt.Color
*/
public class Style implements Serializable {
+
+// 03.11.2010 changed by exthex - added valuevalign and valuehalign to allow separate layout for value and non-value cells.
+// Also the hardcoded default values for halign and valign were removed to allow proper inheritment.
+
/**
* SVUID.
*/
@@ -78,6 +82,15 @@ public class Style implements Serializable {
* valign key
*/
public final static String VALIGN = "valign";
+
+ /**
+ * halign key
+ */
+ public final static String VALUEHALIGN = "valuehalign";
+ /**
+ * valign key
+ */
+ public final static String VALUEVALIGN = "valuevalign";
/**
* padding key, default padding = 1
*/
@@ -159,13 +172,21 @@ public class Style implements Serializable {
*/
private float padding_ = DEFAULT_PADDING;
/**
- * The current halign value -> initialized with left
+ * The current halign value
*/
- private String hAlign_ = LEFT;
+ private String hAlign_ = null;
/**
- * The current valign value -> initialized with top
+ * The current valign value
*/
- private String vAlign_ = TOP;
+ private String vAlign_ = null;
+ /**
+ * The current valuehalign value
+ */
+ private String valueHAlign_ = null;
+ /**
+ * The current valuevalign value
+ */
+ private String valueVAlign_ = null;
/**
* The current border value -> initialized with the default border value
*/
@@ -217,6 +238,16 @@ public class Style implements Serializable {
vAlign_ = value;
}
}
+ if (VALUEHALIGN.equals(id)) {
+ if (LEFT.equals(value) || CENTER.equals(value) || RIGHT.equals(value)) {
+ valueHAlign_ = value;
+ }
+ }
+ if (VALUEVALIGN.equals(id)) {
+ if (TOP.equals(value) || MIDDLE.equals(value) || BOTTOM.equals(value)) {
+ valueVAlign_ = value;
+ }
+ }
if (PADDING.equals(id)) {
padding_ = Float.parseFloat(value);
}
@@ -339,7 +370,35 @@ public class Style implements Serializable {
this.valuefont_ = valuefont;
}
-
+ /**
+ * @param align The valueHAlign to set.
+ */
+ public void setValueHAlign(String align) {
+ valueHAlign_ = align;
+ }
+
+ /**
+ * Returns the value halign
+ * @return Returns the value halign
+ */
+ public String getValueHAlign() {
+ return valueHAlign_;
+ }
+
+ /**
+ * @param align The valueVAlign to set.
+ */
+ public void setValueVAlign(String align) {
+ valueVAlign_ = align;
+ }
+
+ /**
+ * Returns the value valign
+ * @return Returns the value valign
+ */
+ public String getValueVAlign() {
+ return valueVAlign_;
+ }
/**
* Returns the scaleToFit dimensions to be applied for image-cells.
@@ -378,6 +437,7 @@ public class Style implements Serializable {
*
* @param baseStyle the style object that serves as a primary style source.
* @param inheritStyle the style object that serves as a secondary style source in case a style attribute is not defined on the primary style source.
+ * @param isValue
* @return Returns a new Style object being fully equipped with styles.
*/
public static Style doInherit(Style baseStyle, Style inheritStyle) {
@@ -392,6 +452,8 @@ public class Style implements Serializable {
newStyle.setPadding(baseStyle.getPadding());
newStyle.setVAlign(baseStyle.getVAlign());
newStyle.setValueFont(baseStyle.getValueFont());
+ newStyle.setValueHAlign(baseStyle.getValueHAlign());
+ newStyle.setValueVAlign(baseStyle.getValueVAlign());
newStyle.setImageScaleToFit(baseStyle.getImageScaleToFit());
}
@@ -404,6 +466,8 @@ public class Style implements Serializable {
if (newStyle.getPadding() == DEFAULT_PADDING) { newStyle.setPadding(inheritStyle.getPadding()); }
if (newStyle.getVAlign() == null) { newStyle.setVAlign(inheritStyle.getVAlign()); }
if (newStyle.getValueFont() == null) { newStyle.setValueFont(inheritStyle.getValueFont()); }
+ if (newStyle.getValueHAlign() == null) { newStyle.setValueHAlign(inheritStyle.getValueHAlign()); }
+ if (newStyle.getValueVAlign() == null) { newStyle.setValueVAlign(inheritStyle.getValueVAlign()); }
if (newStyle.getImageScaleToFit() == null) { newStyle.setImageScaleToFit(inheritStyle.getImageScaleToFit()); }
}