diff options
author | Denis Anisimov <denis@vaadin.com> | 2016-10-24 11:32:16 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-10-26 05:59:27 +0000 |
commit | 9abe01a5881ae7fb43d2706ca9302aa68cc0221b (patch) | |
tree | 97b3fabfd917c5513b4adbce20b37af1a78dac87 /compatibility-server/src/main | |
parent | 5bc31e8267230fc4abfef34dcaa77ce5eae447b3 (diff) | |
download | vaadin-framework-9abe01a5881ae7fb43d2706ca9302aa68cc0221b.tar.gz vaadin-framework-9abe01a5881ae7fb43d2706ca9302aa68cc0221b.zip |
Introduce "shouldWriteDefaultValues" property to DesignContext.
Change-Id: I979448e5af032333a6a2f7b99b11ab16c41d7b18
Diffstat (limited to 'compatibility-server/src/main')
14 files changed, 56 insertions, 41 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractColorPicker.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractColorPicker.java index 668ffd568a..9f2224bed3 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractColorPicker.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractColorPicker.java @@ -572,12 +572,14 @@ public abstract class AbstractColorPicker extends AbstractLegacyComponent Attributes attribute = design.attributes(); DesignAttributeHandler.writeAttribute("color", attribute, - color.getCSS(), Color.WHITE.getCSS(), String.class); + color.getCSS(), Color.WHITE.getCSS(), String.class, + designContext); DesignAttributeHandler.writeAttribute("popup-style", attribute, popupStyle == PopupStyle.POPUP_NORMAL ? "normal" : "simple", - "normal", String.class); + "normal", String.class, designContext); DesignAttributeHandler.writeAttribute("position", attribute, - positionX + "," + positionY, "0,0", String.class); + positionX + "," + positionY, "0,0", String.class, + designContext); } @Override diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractField.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractField.java index 8ac94f6592..eb6255e37a 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractField.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractField.java @@ -1802,7 +1802,8 @@ public abstract class AbstractField<T> extends AbstractLegacyComponent Attributes attr = design.attributes(); // handle readonly DesignAttributeHandler.writeAttribute("readonly", attr, - super.isReadOnly(), def.isReadOnly(), Boolean.class); + super.isReadOnly(), def.isReadOnly(), Boolean.class, + designContext); } private static final Logger getLogger() { diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractLegacyComponent.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractLegacyComponent.java index 11ac309089..28c1078de7 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractLegacyComponent.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractLegacyComponent.java @@ -99,7 +99,8 @@ public class AbstractLegacyComponent extends AbstractComponent { // handle immediate if (explicitImmediateValue != null) { DesignAttributeHandler.writeAttribute("immediate", attr, - explicitImmediateValue, def.isImmediate(), Boolean.class); + explicitImmediateValue, def.isImmediate(), Boolean.class, + designContext); } } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java index 55962df2cf..127bdf6e7b 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java @@ -2343,7 +2343,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements Resource icon = getItemIcon(itemId); if (icon != null) { DesignAttributeHandler.writeAttribute("icon", element.attributes(), - icon, null, Resource.class); + icon, null, Resource.class, context); } if (isSelected(itemId)) { diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java index 8a6b4849f8..482dd0b2af 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java @@ -806,7 +806,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements .getDefaultInstance(this); Attributes attr = design.attributes(); DesignAttributeHandler.writeAttribute("maxlength", attr, getMaxLength(), - def.getMaxLength(), Integer.class); + def.getMaxLength(), Integer.class, designContext); } } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/CheckBox.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/CheckBox.java index 779acb10ea..d3c7b1a50c 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/CheckBox.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/CheckBox.java @@ -252,7 +252,7 @@ public class CheckBox extends AbstractField<Boolean> { CheckBox def = (CheckBox) designContext.getDefaultInstance(this); Attributes attr = design.attributes(); DesignAttributeHandler.writeAttribute("checked", attr, getValue(), - def.getValue(), Boolean.class); + def.getValue(), Boolean.class, designContext); } @Override diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java index e213d7d585..db4d75bbfc 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java @@ -3143,7 +3143,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, if (section.grid.getDefaultHeaderRow() == this) { DesignAttributeHandler.writeAttribute("default", - trElement.attributes(), true, null, boolean.class); + trElement.attributes(), true, null, boolean.class, + designContext); } } @@ -4071,31 +4072,35 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, GridColumnState def = new GridColumnState(); DesignAttributeHandler.writeAttribute("property-id", attributes, - getPropertyId(), null, Object.class); + getPropertyId(), null, Object.class, designContext); // Sortable is a special attribute that depends on the container. DesignAttributeHandler.writeAttribute("sortable", attributes, - isSortable(), null, boolean.class); + isSortable(), null, boolean.class, designContext); DesignAttributeHandler.writeAttribute("editable", attributes, - isEditable(), def.editable, boolean.class); + isEditable(), def.editable, boolean.class, designContext); DesignAttributeHandler.writeAttribute("resizable", attributes, - isResizable(), def.resizable, boolean.class); + isResizable(), def.resizable, boolean.class, designContext); DesignAttributeHandler.writeAttribute("hidable", attributes, - isHidable(), def.hidable, boolean.class); + isHidable(), def.hidable, boolean.class, designContext); DesignAttributeHandler.writeAttribute("hidden", attributes, - isHidden(), def.hidden, boolean.class); + isHidden(), def.hidden, boolean.class, designContext); DesignAttributeHandler.writeAttribute("hiding-toggle-caption", - attributes, getHidingToggleCaption(), null, String.class); + attributes, getHidingToggleCaption(), null, String.class, + designContext); DesignAttributeHandler.writeAttribute("width", attributes, - getWidth(), def.width, Double.class); + getWidth(), def.width, Double.class, designContext); DesignAttributeHandler.writeAttribute("min-width", attributes, - getMinimumWidth(), def.minWidth, Double.class); + getMinimumWidth(), def.minWidth, Double.class, + designContext); DesignAttributeHandler.writeAttribute("max-width", attributes, - getMaximumWidth(), def.maxWidth, Double.class); + getMaximumWidth(), def.maxWidth, Double.class, + designContext); DesignAttributeHandler.writeAttribute("expand", attributes, - getExpandRatio(), def.expandRatio, Integer.class); + getExpandRatio(), def.expandRatio, Integer.class, + designContext); } /** @@ -7332,14 +7337,17 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, Grid def = context.getDefaultInstance(this); DesignAttributeHandler.writeAttribute("editable", attrs, - isEditorEnabled(), def.isEditorEnabled(), boolean.class); + isEditorEnabled(), def.isEditorEnabled(), boolean.class, + context); DesignAttributeHandler.writeAttribute("frozen-columns", attrs, - getFrozenColumnCount(), def.getFrozenColumnCount(), int.class); + getFrozenColumnCount(), def.getFrozenColumnCount(), int.class, + context); if (getHeightMode() == HeightMode.ROW) { DesignAttributeHandler.writeAttribute("rows", attrs, - getHeightByRows(), def.getHeightByRows(), double.class); + getHeightByRows(), def.getHeightByRows(), double.class, + context); } SelectionMode selectionMode = null; @@ -7357,7 +7365,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, + selectionModel.getClass().getName(); DesignAttributeHandler.writeAttribute("selection-mode", attrs, - selectionMode, getDefaultSelectionMode(), SelectionMode.class); + selectionMode, getDefaultSelectionMode(), SelectionMode.class, + context); if (columns.isEmpty()) { // Empty grid. Structure not needed. diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/PasswordField.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/PasswordField.java index 787e024cc6..cf00f64b8b 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/PasswordField.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/PasswordField.java @@ -112,7 +112,7 @@ public class PasswordField extends AbstractTextField { .getDefaultInstance(this); Attributes attr = design.attributes(); DesignAttributeHandler.writeAttribute("value", attr, getValue(), - def.getValue(), String.class); + def.getValue(), String.class, designContext); } @Override diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/ProgressBar.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/ProgressBar.java index 14831d7d81..12b0286577 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/ProgressBar.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/ProgressBar.java @@ -171,7 +171,7 @@ public class ProgressBar extends AbstractField<Float> Float defaultValue = ((ProgressBar) designContext .getDefaultInstance(this)).getValue(); DesignAttributeHandler.writeAttribute("value", design.attributes(), - getValue(), defaultValue, Float.class); + getValue(), defaultValue, Float.class, designContext); } @Override diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Slider.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Slider.java index 15b083e38d..a898773f7c 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Slider.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Slider.java @@ -387,7 +387,7 @@ public class Slider extends AbstractField<Double> { } Slider defaultSlider = context.getDefaultInstance(this); DesignAttributeHandler.writeAttribute(this, "value", - design.attributes(), defaultSlider); + design.attributes(), defaultSlider, context); } @Override diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java index dc7b762c13..bc8f2eada4 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java @@ -6327,14 +6327,14 @@ public class Table extends AbstractSelect implements Action.Container, Table def = context.getDefaultInstance(this); DesignAttributeHandler.writeAttribute("sortable", design.attributes(), - isSortEnabled(), def.isSortEnabled(), boolean.class); + isSortEnabled(), def.isSortEnabled(), boolean.class, context); Element table = null; boolean hasColumns = getVisibleColumns().length != 0; if (hasColumns) { table = design.appendElement("table"); - writeColumns(table, def); - writeHeader(table, def); + writeColumns(table, def, context); + writeHeader(table, def, context); } super.writeDesign(design, context); if (hasColumns) { @@ -6342,7 +6342,7 @@ public class Table extends AbstractSelect implements Action.Container, } } - private void writeColumns(Element table, Table def) { + private void writeColumns(Element table, Table def, DesignContext context) { Object[] columns = getVisibleColumns(); if (columns.length == 0) { return; @@ -6361,23 +6361,24 @@ public class Table extends AbstractSelect implements Action.Container, } DesignAttributeHandler.writeAttribute("width", col.attributes(), - getColumnWidth(id), def.getColumnWidth(null), int.class); + getColumnWidth(id), def.getColumnWidth(null), int.class, + context); DesignAttributeHandler.writeAttribute("expand", col.attributes(), getColumnExpandRatio(id), def.getColumnExpandRatio(null), - float.class); + float.class, context); DesignAttributeHandler.writeAttribute("collapsible", col.attributes(), isColumnCollapsible(id), - def.isColumnCollapsible(null), boolean.class); + def.isColumnCollapsible(null), boolean.class, context); DesignAttributeHandler.writeAttribute("collapsed", col.attributes(), isColumnCollapsed(id), def.isColumnCollapsed(null), - boolean.class); + boolean.class, context); } } - private void writeHeader(Element table, Table def) { + private void writeHeader(Element table, Table def, DesignContext context) { Object[] columns = getVisibleColumns(); if (columns.length == 0 || (columnIcons.isEmpty() && columnHeaders.isEmpty())) { @@ -6389,7 +6390,8 @@ public class Table extends AbstractSelect implements Action.Container, Element th = header.appendElement("th"); th.html(getColumnHeader(id)); DesignAttributeHandler.writeAttribute("icon", th.attributes(), - getColumnIcon(id), def.getColumnIcon(null), Resource.class); + getColumnIcon(id), def.getColumnIcon(null), Resource.class, + context); } } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/TextField.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/TextField.java index 2f958e629b..d7f9d07b0b 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/TextField.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/TextField.java @@ -135,7 +135,7 @@ public class TextField extends AbstractTextField { .getDefaultInstance(this); Attributes attr = design.attributes(); DesignAttributeHandler.writeAttribute("value", attr, getValue(), - def.getValue(), String.class); + def.getValue(), String.class, designContext); } /* diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java index 9a3403e3d4..9be95578b4 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java @@ -1944,7 +1944,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, Resource icon = getItemIcon(itemId); if (icon != null) { DesignAttributeHandler.writeAttribute("icon", element.attributes(), - icon, null, Resource.class); + icon, null, Resource.class, context); } if (isSelected(itemId)) { diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/TreeTable.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/TreeTable.java index 4192883098..e5b18472e8 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/TreeTable.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/TreeTable.java @@ -962,7 +962,7 @@ public class TreeTable extends Table implements Hierarchical { for (Object itemId : itemIds) { Element tr = writeItem(tbody, itemId, context); DesignAttributeHandler.writeAttribute("depth", tr.attributes(), - depth, 0, int.class); + depth, 0, int.class, context); if (getChildren(itemId) != null) { writeItems(tbody, getChildren(itemId), depth + 1, context); @@ -975,7 +975,7 @@ public class TreeTable extends Table implements Hierarchical { DesignContext context) { Element tr = super.writeItem(tbody, itemId, context); DesignAttributeHandler.writeAttribute("collapsed", tr.attributes(), - isCollapsed(itemId), true, boolean.class); + isCollapsed(itemId), true, boolean.class, context); return tr; } |