diff options
Diffstat (limited to 'server/src/com/vaadin/ui')
55 files changed, 505 insertions, 1229 deletions
diff --git a/server/src/com/vaadin/ui/AbsoluteLayout.java b/server/src/com/vaadin/ui/AbsoluteLayout.java index a3bc577fe3..56bbd19852 100644 --- a/server/src/com/vaadin/ui/AbsoluteLayout.java +++ b/server/src/com/vaadin/ui/AbsoluteLayout.java @@ -61,7 +61,7 @@ public class AbsoluteLayout extends AbstractLayout implements } @Override - public AbsoluteLayoutState getState() { + protected AbsoluteLayoutState getState() { return (AbsoluteLayoutState) super.getState(); } @@ -153,7 +153,7 @@ public class AbsoluteLayout extends AbstractLayout implements internalRemoveComponent(c); throw e; } - requestRepaint(); + markAsDirty(); } /** @@ -197,7 +197,7 @@ public class AbsoluteLayout extends AbstractLayout implements public void removeComponent(Component c) { internalRemoveComponent(c); super.removeComponent(c); - requestRepaint(); + markAsDirty(); } /** @@ -245,7 +245,7 @@ public class AbsoluteLayout extends AbstractLayout implements private void internalSetPosition(Component component, ComponentPosition position) { componentToCoordinates.put(component, position); - requestRepaint(); + markAsDirty(); } /** @@ -322,7 +322,7 @@ public class AbsoluteLayout extends AbstractLayout implements } } } - requestRepaint(); + markAsDirty(); } /** @@ -363,7 +363,7 @@ public class AbsoluteLayout extends AbstractLayout implements public void setTop(Float topValue, Unit topUnits) { this.topValue = topValue; this.topUnits = topUnits; - requestRepaint(); + markAsDirty(); } /** @@ -379,7 +379,7 @@ public class AbsoluteLayout extends AbstractLayout implements public void setRight(Float rightValue, Unit rightUnits) { this.rightValue = rightValue; this.rightUnits = rightUnits; - requestRepaint(); + markAsDirty(); } /** @@ -395,7 +395,7 @@ public class AbsoluteLayout extends AbstractLayout implements public void setBottom(Float bottomValue, Unit bottomUnits) { this.bottomValue = bottomValue; this.bottomUnits = bottomUnits; - requestRepaint(); + markAsDirty(); } /** @@ -411,7 +411,7 @@ public class AbsoluteLayout extends AbstractLayout implements public void setLeft(Float leftValue, Unit leftUnits) { this.leftValue = leftValue; this.leftUnits = leftUnits; - requestRepaint(); + markAsDirty(); } /** @@ -422,7 +422,7 @@ public class AbsoluteLayout extends AbstractLayout implements */ public void setZIndex(int zIndex) { this.zIndex = zIndex; - requestRepaint(); + markAsDirty(); } /** @@ -434,7 +434,7 @@ public class AbsoluteLayout extends AbstractLayout implements */ public void setTopValue(Float topValue) { this.topValue = topValue; - requestRepaint(); + markAsDirty(); } /** @@ -468,7 +468,7 @@ public class AbsoluteLayout extends AbstractLayout implements */ public void setRightValue(Float rightValue) { this.rightValue = rightValue; - requestRepaint(); + markAsDirty(); } /** @@ -492,7 +492,7 @@ public class AbsoluteLayout extends AbstractLayout implements */ public void setBottomValue(Float bottomValue) { this.bottomValue = bottomValue; - requestRepaint(); + markAsDirty(); } /** @@ -516,7 +516,7 @@ public class AbsoluteLayout extends AbstractLayout implements */ public void setLeftValue(Float leftValue) { this.leftValue = leftValue; - requestRepaint(); + markAsDirty(); } /** @@ -538,7 +538,7 @@ public class AbsoluteLayout extends AbstractLayout implements */ public void setTopUnits(Unit topUnits) { this.topUnits = topUnits; - requestRepaint(); + markAsDirty(); } /** @@ -560,7 +560,7 @@ public class AbsoluteLayout extends AbstractLayout implements */ public void setRightUnits(Unit rightUnits) { this.rightUnits = rightUnits; - requestRepaint(); + markAsDirty(); } /** @@ -582,7 +582,7 @@ public class AbsoluteLayout extends AbstractLayout implements */ public void setBottomUnits(Unit bottomUnits) { this.bottomUnits = bottomUnits; - requestRepaint(); + markAsDirty(); } /** @@ -604,7 +604,7 @@ public class AbsoluteLayout extends AbstractLayout implements */ public void setLeftUnits(Unit leftUnits) { this.leftUnits = leftUnits; - requestRepaint(); + markAsDirty(); } /** diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index cde5217ca1..b1393488f7 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -121,34 +121,6 @@ public abstract class AbstractComponent extends AbstractClientConnector return getState().getDebugId(); } - /** - * Gets style for component. Multiple styles are joined with spaces. - * - * @return the component's styleValue of property style. - * @deprecated Use getStyleName() instead; renamed for consistency and to - * indicate that "style" should not be used to switch client - * side implementation, only to style the component. - */ - @Deprecated - public String getStyle() { - return getStyleName(); - } - - /** - * Sets and replaces all previous style names of the component. This method - * will trigger a {@link RepaintRequestEvent}. - * - * @param style - * the new style of the component. - * @deprecated Use setStyleName() instead; renamed for consistency and to - * indicate that "style" should not be used to switch client - * side implementation, only to style the component. - */ - @Deprecated - public void setStyle(String style) { - setStyleName(style); - } - /* * Gets the component's style. Don't add a JavaDoc comment here, we use the * default documentation from implemented interface. @@ -176,7 +148,6 @@ public abstract class AbstractComponent extends AbstractClientConnector public void setStyleName(String style) { if (style == null || "".equals(style)) { getState().setStyles(null); - requestRepaint(); return; } if (getState().getStyles() == null) { @@ -190,7 +161,6 @@ public abstract class AbstractComponent extends AbstractClientConnector styles.add(part); } } - requestRepaint(); } @Override @@ -212,7 +182,6 @@ public abstract class AbstractComponent extends AbstractClientConnector List<String> styles = getState().getStyles(); if (!styles.contains(style)) { styles.add(style); - requestRepaint(); } } @@ -225,7 +194,6 @@ public abstract class AbstractComponent extends AbstractClientConnector getState().getStyles().remove(part); } } - requestRepaint(); } } @@ -249,7 +217,6 @@ public abstract class AbstractComponent extends AbstractClientConnector @Override public void setCaption(String caption) { getState().setCaption(caption); - requestRepaint(); } /* @@ -295,7 +262,7 @@ public abstract class AbstractComponent extends AbstractClientConnector this.locale = locale; // FIXME: Reload value if there is a converter - requestRepaint(); + markAsDirty(); } /* @@ -317,7 +284,6 @@ public abstract class AbstractComponent extends AbstractClientConnector @Override public void setIcon(Resource icon) { getState().setIcon(ResourceReference.create(icon)); - requestRepaint(); } /* @@ -337,10 +303,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public void setEnabled(boolean enabled) { - if (getState().isEnabled() != enabled) { - getState().setEnabled(enabled); - requestRepaint(); - } + getState().setEnabled(enabled); } /* @@ -383,7 +346,6 @@ public abstract class AbstractComponent extends AbstractClientConnector */ public void setImmediate(boolean immediate) { getState().setImmediate(immediate); - requestRepaint(); } /* @@ -408,11 +370,10 @@ public abstract class AbstractComponent extends AbstractClientConnector } getState().setVisible(visible); - requestRepaint(); if (getParent() != null) { // Must always repaint the parent (at least the hierarchy) when // visibility of a child component changes. - getParent().requestRepaint(); + getParent().markAsDirty(); } } @@ -491,7 +452,6 @@ public abstract class AbstractComponent extends AbstractClientConnector */ public void setDescription(String description) { getState().setDescription(description); - requestRepaint(); } /* @@ -575,7 +535,7 @@ public abstract class AbstractComponent extends AbstractClientConnector public void setComponentError(ErrorMessage componentError) { this.componentError = componentError; fireComponentErrorEvent(); - requestRepaint(); + markAsDirty(); } /* @@ -594,7 +554,6 @@ public abstract class AbstractComponent extends AbstractClientConnector @Override public void setReadOnly(boolean readOnly) { getState().setReadOnly(readOnly); - requestRepaint(); } /* @@ -713,7 +672,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * @return updated component shared state */ @Override - public ComponentState getState() { + protected ComponentState getState() { return (ComponentState) super.getState(); } @@ -746,17 +705,6 @@ public abstract class AbstractComponent extends AbstractClientConnector } } - /* Documentation copied from interface */ - @Override - public void requestRepaint() { - // Invisible components (by flag in this particular component) do not - // need repaints - if (!getState().isVisible()) { - return; - } - super.requestRepaint(); - } - /* General event framework */ private static final Method COMPONENT_EVENT_METHOD = ReflectTools @@ -803,7 +751,6 @@ public abstract class AbstractComponent extends AbstractClientConnector if (needRepaint) { getState().addRegisteredEventListener(eventIdentifier); - requestRepaint(); } } @@ -852,7 +799,6 @@ public abstract class AbstractComponent extends AbstractClientConnector eventRouter.removeListener(eventType, target); if (!eventRouter.hasListeners(eventType)) { getState().removeRegisteredEventListener(eventIdentifier); - requestRepaint(); } } } @@ -1159,7 +1105,7 @@ public abstract class AbstractComponent extends AbstractClientConnector } this.height = height; heightUnit = unit; - requestRepaint(); + markAsDirty(); // ComponentSizeValidator.setHeightLocation(this); } @@ -1197,7 +1143,7 @@ public abstract class AbstractComponent extends AbstractClientConnector } this.width = width; widthUnit = unit; - requestRepaint(); + markAsDirty(); // ComponentSizeValidator.setWidthLocation(this); } diff --git a/server/src/com/vaadin/ui/AbstractComponentContainer.java b/server/src/com/vaadin/ui/AbstractComponentContainer.java index 7450c76fda..4939eb1265 100644 --- a/server/src/com/vaadin/ui/AbstractComponentContainer.java +++ b/server/src/com/vaadin/ui/AbstractComponentContainer.java @@ -212,7 +212,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent // If the visibility state is toggled it might affect all children // aswell, e.g. make container visible should make children visible if // they were only hidden because the container was hidden. - requestRepaintAll(); + markAsDirtyRecursive(); } @Override @@ -306,12 +306,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent private void repaintChildTrees(Collection<Component> dirtyChildren) { for (Component c : dirtyChildren) { - if (c instanceof ComponentContainer) { - ComponentContainer cc = (ComponentContainer) c; - cc.requestRepaintAll(); - } else { - c.requestRepaint(); - } + c.markAsDirtyRecursive(); } } diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java index 67a1826100..5123d08da9 100644 --- a/server/src/com/vaadin/ui/AbstractField.java +++ b/server/src/com/vaadin/ui/AbstractField.java @@ -97,14 +97,9 @@ public abstract class AbstractField<T> extends AbstractComponent implements private LinkedList<Validator> validators = null; /** - * Auto commit mode. + * True if field is in buffered mode, false otherwise */ - private boolean writeThroughMode = true; - - /** - * Reads the value from data-source, when it is not modified. - */ - private boolean readThroughMode = true; + private boolean buffered; /** * Flag to indicate that the field is currently committing its value to the @@ -306,7 +301,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements // Sets the buffering state currentBufferedSourceException = new Buffered.SourceException( this, e); - requestRepaint(); + markAsDirty(); // Throws the source exception throw currentBufferedSourceException; @@ -321,7 +316,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements fireValueChange(false); } else if (wasModified) { // If the value did not change, but the modification status did - requestRepaint(); + markAsDirty(); } } } @@ -345,7 +340,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements */ private T getFieldValue() { // Give the value from abstract buffers if the field if possible - if (dataSource == null || !isReadThrough() || isModified()) { + if (dataSource == null || isBuffered() || isModified()) { return getInternalValue(); } @@ -365,92 +360,6 @@ public abstract class AbstractField<T> extends AbstractComponent implements private void setModified(boolean modified) { getState().setModified(modified); - requestRepaint(); - } - - /* - * Tests if the field is in write-through mode. Don't add a JavaDoc comment - * here, we use the default documentation from the implemented interface. - */ - @Override - public boolean isWriteThrough() { - return writeThroughMode; - } - - /** - * Sets the field's write-through mode to the specified status. When - * switching the write-through mode on, a {@link #commit()} will be - * performed. - * - * @see #setBuffered(boolean) for an easier way to control read through and - * write through modes - * - * @param writeThrough - * Boolean value to indicate if the object should be in - * write-through mode after the call. - * @throws SourceException - * If the operation fails because of an exception is thrown by - * the data source. - * @throws InvalidValueException - * If the implicit commit operation fails because of a - * validation error. - * @deprecated Use {@link #setBuffered(boolean)} instead. Note that - * setReadThrough(true), setWriteThrough(true) equals - * setBuffered(false) - */ - @Override - @Deprecated - public void setWriteThrough(boolean writeThrough) - throws Buffered.SourceException, InvalidValueException { - if (writeThroughMode == writeThrough) { - return; - } - writeThroughMode = writeThrough; - if (writeThroughMode) { - commit(); - } - } - - /* - * Tests if the field is in read-through mode. Don't add a JavaDoc comment - * here, we use the default documentation from the implemented interface. - */ - @Override - public boolean isReadThrough() { - return readThroughMode; - } - - /** - * Sets the field's read-through mode to the specified status. When - * switching read-through mode on, the object's value is updated from the - * data source. - * - * @see #setBuffered(boolean) for an easier way to control read through and - * write through modes - * - * @param readThrough - * Boolean value to indicate if the object should be in - * read-through mode after the call. - * - * @throws SourceException - * If the operation fails because of an exception is thrown by - * the data source. The cause is included in the exception. - * @deprecated Use {@link #setBuffered(boolean)} instead. Note that - * setReadThrough(true), setWriteThrough(true) equals - * setBuffered(false) - */ - @Override - @Deprecated - public void setReadThrough(boolean readThrough) - throws Buffered.SourceException { - if (readThroughMode == readThrough) { - return; - } - readThroughMode = readThrough; - if (!isModified() && readThroughMode && getPropertyDataSource() != null) { - setInternalValue(convertFromDataSource(getDataSourceValue())); - fireValueChange(false); - } } /** @@ -460,34 +369,35 @@ public abstract class AbstractField<T> extends AbstractComponent implements * property data source until {@link #commit()} is called. * </p> * <p> - * Changing buffered mode will change the read through and write through - * state for the field. + * Setting buffered mode from true to false will commit any pending changes. * </p> * <p> - * Mixing calls to {@link #setBuffered(boolean)} and - * {@link #setReadThrough(boolean)} or {@link #setWriteThrough(boolean)} is - * generally a bad idea. + * * </p> * + * @since 7.0.0 * @param buffered * true if buffered mode should be turned on, false otherwise */ @Override public void setBuffered(boolean buffered) { - setReadThrough(!buffered); - setWriteThrough(!buffered); + if (this.buffered == buffered) { + return; + } + this.buffered = buffered; + if (!buffered) { + commit(); + } } /** * Checks the buffered mode of this Field. - * <p> - * This method only returns true if both read and write buffering is used. * * @return true if buffered mode is on, false otherwise */ @Override public boolean isBuffered() { - return !isReadThrough() && !isWriteThrough(); + return buffered; } /* Property interface implementation */ @@ -607,8 +517,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements setModified(dataSource != null); valueWasModifiedByDataSourceDuringCommit = false; - // In write through mode , try to commit - if (isWriteThrough() && dataSource != null + // In not buffering, try to commit + if (!isBuffered() && dataSource != null && (isInvalidCommitted() || isValid())) { try { @@ -625,7 +535,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements // Sets the buffering state currentBufferedSourceException = new Buffered.SourceException( this, e); - requestRepaint(); + markAsDirty(); // Throws the source exception throw currentBufferedSourceException; @@ -895,7 +805,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements validators = new LinkedList<Validator>(); } validators.add(validator); - requestRepaint(); + markAsDirty(); } /** @@ -923,7 +833,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements if (validators != null) { validators.remove(validator); } - requestRepaint(); + markAsDirty(); } /** @@ -933,7 +843,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements if (validators != null) { validators.clear(); } - requestRepaint(); + markAsDirty(); } /** @@ -1160,7 +1070,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements protected void fireValueChange(boolean repaintIsNotNeeded) { fireEvent(new AbstractField.ValueChangeEvent(this)); if (!repaintIsNotNeeded) { - requestRepaint(); + markAsDirty(); } } @@ -1190,7 +1100,6 @@ public abstract class AbstractField<T> extends AbstractComponent implements @Override public void readOnlyStatusChange(Property.ReadOnlyStatusChangeEvent event) { getState().setPropertyReadOnly(event.getProperty().isReadOnly()); - requestRepaint(); } /** @@ -1267,7 +1176,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements */ @Override public void valueChange(Property.ValueChangeEvent event) { - if (isReadThrough()) { + if (!isBuffered()) { if (committingValueToDataSource) { boolean propertyNotifiesOfTheBufferedValue = equals(event .getProperty().getValue(), getInternalValue()); @@ -1322,7 +1231,6 @@ public abstract class AbstractField<T> extends AbstractComponent implements @Override public void setTabIndex(int tabIndex) { getState().setTabIndex(tabIndex); - requestRepaint(); } /** @@ -1356,7 +1264,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements protected void setInternalValue(T newValue) { value = newValue; if (validators != null && !validators.isEmpty()) { - requestRepaint(); + markAsDirty(); } } @@ -1371,7 +1279,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements if (!isListeningToPropertyEvents) { addPropertyListeners(); - if (!isModified() && isReadThrough()) { + if (!isModified() && !isBuffered()) { // Update value from data source discard(); } @@ -1425,7 +1333,6 @@ public abstract class AbstractField<T> extends AbstractComponent implements @Override public void setRequired(boolean required) { getState().setRequired(required); - requestRepaint(); } /** @@ -1440,7 +1347,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements @Override public void setRequiredError(String requiredMessage) { requiredError = requiredMessage; - requestRepaint(); + markAsDirty(); } @Override @@ -1468,7 +1375,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements */ public void setConversionError(String valueConversionError) { this.conversionError = valueConversionError; - requestRepaint(); + markAsDirty(); } /** @@ -1510,7 +1417,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements */ public void setValidationVisible(boolean validateAutomatically) { if (validationVisible != validateAutomatically) { - requestRepaint(); + markAsDirty(); validationVisible = validateAutomatically; } } @@ -1523,7 +1430,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements public void setCurrentBufferedSourceException( Buffered.SourceException currentBufferedSourceException) { this.currentBufferedSourceException = currentBufferedSourceException; - requestRepaint(); + markAsDirty(); } /** @@ -1611,11 +1518,11 @@ public abstract class AbstractField<T> extends AbstractComponent implements */ public void setConverter(Converter<T, ?> converter) { this.converter = (Converter<T, Object>) converter; - requestRepaint(); + markAsDirty(); } @Override - public AbstractFieldState getState() { + protected AbstractFieldState getState() { return (AbstractFieldState) super.getState(); } diff --git a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java index c442bf2204..e19bdf1b2b 100644 --- a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java +++ b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java @@ -34,9 +34,10 @@ import com.vaadin.terminal.JavaScriptCallbackHelper; * , then <code>com_example_SuperComponent</code> will also be attempted if * <code>com_example_MyComponent</code> has not been defined. * <p> - * JavaScript components have a very simple GWT widget ({@link JavaScriptWidget} - * ) just consisting of a <code>div</code> element to which the JavaScript code - * should initialize its own user interface. + * JavaScript components have a very simple GWT widget ( + * {@link com.vaadin.terminal.gwt.client.ui.JavaScriptWidget} ) just consisting + * of a <code>div</code> element to which the JavaScript code should initialize + * its own user interface. * <p> * The initialization function will be called with <code>this</code> pointing to * a connector wrapper object providing integration to Vaadin with the following @@ -79,7 +80,8 @@ import com.vaadin.terminal.JavaScriptCallbackHelper; * functions is described bellow.</li> * <li><code>translateVaadinUri(uri)</code> - Translates a Vaadin URI to a URL * that can be used in the browser. This is just way of accessing - * {@link ApplicationConnection#translateVaadinUri(String)}</li> + * {@link com.vaadin.terminal.gwt.client.ApplicationConnection#translateVaadinUri(String)} + * </li> * </ul> * The connector wrapper also supports these special functions: * <ul> @@ -90,9 +92,8 @@ import com.vaadin.terminal.JavaScriptCallbackHelper; * {@link #addFunction(String, JavaScriptFunction)} on the server will * automatically be present as a function that triggers the registered function * on the server.</li> - * <li>Any field name referred to using - * {@link #callFunction(String, Object...)} on the server will be called if a - * function has been assigned to the field.</li> + * <li>Any field name referred to using {@link #callFunction(String, Object...)} + * on the server will be called if a function has been assigned to the field.</li> * </ul> * <p> * @@ -168,7 +169,7 @@ public abstract class AbstractJavaScriptComponent extends AbstractComponent { } @Override - public JavaScriptComponentState getState() { + protected JavaScriptComponentState getState() { return (JavaScriptComponentState) super.getState(); } } diff --git a/server/src/com/vaadin/ui/AbstractLayout.java b/server/src/com/vaadin/ui/AbstractLayout.java index c26812f3fc..6743b09211 100644 --- a/server/src/com/vaadin/ui/AbstractLayout.java +++ b/server/src/com/vaadin/ui/AbstractLayout.java @@ -17,7 +17,6 @@ package com.vaadin.ui; import com.vaadin.shared.ui.AbstractLayoutState; -import com.vaadin.ui.Layout.MarginHandler; /** * An abstract class that defines default implementation for the {@link Layout} @@ -26,62 +25,12 @@ import com.vaadin.ui.Layout.MarginHandler; * @author Vaadin Ltd. * @since 5.0 */ -@SuppressWarnings("serial") public abstract class AbstractLayout extends AbstractComponentContainer - implements Layout, MarginHandler { - - protected MarginInfo margins = new MarginInfo(false); + implements Layout { @Override - public AbstractLayoutState getState() { + protected AbstractLayoutState getState() { return (AbstractLayoutState) super.getState(); } - /* - * (non-Javadoc) - * - * @see com.vaadin.ui.Layout#setMargin(boolean) - */ - @Override - public void setMargin(boolean enabled) { - margins.setMargins(enabled); - getState().setMarginsBitmask(margins.getBitMask()); - requestRepaint(); - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.ui.Layout.MarginHandler#getMargin() - */ - @Override - public MarginInfo getMargin() { - return margins; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.ui.Layout.MarginHandler#setMargin(MarginInfo) - */ - @Override - public void setMargin(MarginInfo marginInfo) { - margins.setMargins(marginInfo); - getState().setMarginsBitmask(margins.getBitMask()); - requestRepaint(); - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.ui.Layout#setMargin(boolean, boolean, boolean, boolean) - */ - @Override - public void setMargin(boolean topEnabled, boolean rightEnabled, - boolean bottomEnabled, boolean leftEnabled) { - margins.setMargins(topEnabled, rightEnabled, bottomEnabled, leftEnabled); - getState().setMarginsBitmask(margins.getBitMask()); - requestRepaint(); - } - } diff --git a/server/src/com/vaadin/ui/AbstractMedia.java b/server/src/com/vaadin/ui/AbstractMedia.java index 51a3bcd2be..77c12ac045 100644 --- a/server/src/com/vaadin/ui/AbstractMedia.java +++ b/server/src/com/vaadin/ui/AbstractMedia.java @@ -33,7 +33,7 @@ import com.vaadin.terminal.gwt.server.ResourceReference; public abstract class AbstractMedia extends AbstractComponent { @Override - public AbstractMediaState getState() { + protected AbstractMediaState getState() { return (AbstractMediaState) super.getState(); } @@ -66,7 +66,6 @@ public abstract class AbstractMedia extends AbstractComponent { if (source != null) { getState().getSources().add(new ResourceReference(source)); getState().getSourceTypes().add(source.getMIMEType()); - requestRepaint(); } } @@ -103,7 +102,6 @@ public abstract class AbstractMedia extends AbstractComponent { */ public void setShowControls(boolean showControls) { getState().setShowControls(showControls); - requestRepaint(); } /** @@ -126,7 +124,6 @@ public abstract class AbstractMedia extends AbstractComponent { */ public void setAltText(String altText) { getState().setAltText(altText); - requestRepaint(); } /** @@ -145,7 +142,6 @@ public abstract class AbstractMedia extends AbstractComponent { */ public void setHtmlContentAllowed(boolean htmlContentAllowed) { getState().setHtmlContentAllowed(htmlContentAllowed); - requestRepaint(); } /** @@ -164,7 +160,6 @@ public abstract class AbstractMedia extends AbstractComponent { */ public void setAutoplay(boolean autoplay) { getState().setAutoplay(autoplay); - requestRepaint(); } /** @@ -181,7 +176,6 @@ public abstract class AbstractMedia extends AbstractComponent { */ public void setMuted(boolean muted) { getState().setMuted(muted); - requestRepaint(); } /** diff --git a/server/src/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/com/vaadin/ui/AbstractOrderedLayout.java index a7cc780414..596bbb7ee2 100644 --- a/server/src/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/com/vaadin/ui/AbstractOrderedLayout.java @@ -25,6 +25,7 @@ import com.vaadin.event.LayoutEvents.LayoutClickNotifier; import com.vaadin.shared.Connector; import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.MarginInfo; import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutServerRpc; import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutState; import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutState.ChildComponentData; @@ -32,7 +33,8 @@ import com.vaadin.terminal.Sizeable; @SuppressWarnings("serial") public abstract class AbstractOrderedLayout extends AbstractLayout implements - Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier { + Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier, + Layout.MarginHandler { private AbstractOrderedLayoutServerRpc rpc = new AbstractOrderedLayoutServerRpc() { @@ -61,7 +63,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements } @Override - public AbstractOrderedLayoutState getState() { + protected AbstractOrderedLayoutState getState() { return (AbstractOrderedLayoutState) super.getState(); } @@ -142,13 +144,10 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements private void componentRemoved(Component c) { getState().getChildData().remove(c); - requestRepaint(); } private void componentAdded(Component c) { getState().getChildData().put(c, new ChildComponentData()); - requestRepaint(); - } /** @@ -226,23 +225,10 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements components.add(newLocation, oldComponent); } - requestRepaint(); + markAsDirty(); } } - /* - * (non-Javadoc) - * - * @see com.vaadin.ui.Layout.AlignmentHandler#setComponentAlignment(com - * .vaadin.ui.Component, int, int) - */ - @Override - public void setComponentAlignment(Component childComponent, - int horizontalAlignment, int verticalAlignment) { - Alignment a = new Alignment(horizontalAlignment + verticalAlignment); - setComponentAlignment(childComponent, a); - } - @Override public void setComponentAlignment(Component childComponent, Alignment alignment) { @@ -251,7 +237,6 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements if (childData != null) { // Alignments are bit masks childData.setAlignmentBitmask(alignment.getBitMask()); - requestRepaint(); } else { throw new IllegalArgumentException( "Component must be added to layout before using setComponentAlignment()"); @@ -285,7 +270,6 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements @Override public void setSpacing(boolean spacing) { getState().setSpacing(spacing); - requestRepaint(); } /* @@ -335,8 +319,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements } childData.setExpandRatio(ratio); - requestRepaint(); - }; + } /** * Returns the expand ratio of given component. @@ -392,4 +375,28 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements return components.get(index); } + @Override + public void setMargin(boolean enabled) { + setMargin(new MarginInfo(enabled)); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.Layout.MarginHandler#getMargin() + */ + @Override + public MarginInfo getMargin() { + return new MarginInfo(getState().getMarginsBitmask()); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.Layout.MarginHandler#setMargin(MarginInfo) + */ + @Override + public void setMargin(MarginInfo marginInfo) { + getState().setMarginsBitmask(marginInfo.getBitMask()); + } } diff --git a/server/src/com/vaadin/ui/AbstractSelect.java b/server/src/com/vaadin/ui/AbstractSelect.java index 19a74782c4..21ff7ba948 100644 --- a/server/src/com/vaadin/ui/AbstractSelect.java +++ b/server/src/com/vaadin/ui/AbstractSelect.java @@ -462,7 +462,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements if (!isNullSelectionAllowed() && (id == null || id == getNullSelectionItemId())) { // skip empty selection if nullselection is not allowed - requestRepaint(); + markAsDirty(); } else if (id != null && containsId(id)) { acceptedSelections.add(id); } @@ -470,7 +470,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements if (!isNullSelectionAllowed() && acceptedSelections.size() < 1) { // empty selection not allowed, keep old value - requestRepaint(); + markAsDirty(); return; } @@ -498,7 +498,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements if (!isNullSelectionAllowed() && (clientSideSelectedKeys.length == 0 || clientSideSelectedKeys[0] == null || clientSideSelectedKeys[0] == getNullSelectionItemId())) { - requestRepaint(); + markAsDirty(); return; } if (clientSideSelectedKeys.length == 0) { @@ -513,7 +513,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements final Object id = itemIdMapper .get(clientSideSelectedKeys[0]); if (!isNullSelectionAllowed() && id == null) { - requestRepaint(); + markAsDirty(); } else if (id != null && id.equals(getNullSelectionItemId())) { setValue(null, true); @@ -975,7 +975,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements */ setValue(null); - requestRepaint(); + markAsDirty(); } } @@ -1042,7 +1042,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements } } - requestRepaint(); + markAsDirty(); } } @@ -1071,7 +1071,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements this.allowNewOptions = allowNewOptions; - requestRepaint(); + markAsDirty(); } } @@ -1087,7 +1087,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements public void setItemCaption(Object itemId, String caption) { if (itemId != null) { itemCaptions.put(itemId, caption); - requestRepaint(); + markAsDirty(); } } @@ -1173,7 +1173,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements } else { itemIcons.put(itemId, icon); } - requestRepaint(); + markAsDirty(); } } @@ -1239,7 +1239,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements public void setItemCaptionMode(ItemCaptionMode mode) { if (mode != null) { itemCaptionMode = mode; - requestRepaint(); + markAsDirty(); } } @@ -1302,13 +1302,13 @@ public abstract class AbstractSelect extends AbstractField<Object> implements if (propertyId != null) { itemCaptionPropertyId = propertyId; setItemCaptionMode(ITEM_CAPTION_MODE_PROPERTY); - requestRepaint(); + markAsDirty(); } else { itemCaptionPropertyId = null; if (getItemCaptionMode() == ITEM_CAPTION_MODE_PROPERTY) { setItemCaptionMode(ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID); } - requestRepaint(); + markAsDirty(); } } @@ -1360,7 +1360,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements throw new IllegalArgumentException( "Property type must be assignable to Resource"); } - requestRepaint(); + markAsDirty(); } /** @@ -1579,7 +1579,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements .containerPropertySetChange(event); } } - requestRepaint(); + markAsDirty(); } /** @@ -1594,7 +1594,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements .containerItemSetChange(event); } } - requestRepaint(); + markAsDirty(); } /** @@ -1665,7 +1665,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements public void setNullSelectionAllowed(boolean nullSelectionAllowed) { if (nullSelectionAllowed != this.nullSelectionAllowed) { this.nullSelectionAllowed = nullSelectionAllowed; - requestRepaint(); + markAsDirty(); } } @@ -1824,13 +1824,13 @@ public abstract class AbstractSelect extends AbstractField<Object> implements @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { - requestRepaint(); + markAsDirty(); } @Override public void itemPropertySetChange( com.vaadin.data.Item.PropertySetChangeEvent event) { - requestRepaint(); + markAsDirty(); } } diff --git a/server/src/com/vaadin/ui/AbstractSplitPanel.java b/server/src/com/vaadin/ui/AbstractSplitPanel.java index 03e8a2dfb6..8b7499115c 100644 --- a/server/src/com/vaadin/ui/AbstractSplitPanel.java +++ b/server/src/com/vaadin/ui/AbstractSplitPanel.java @@ -154,8 +154,6 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { if (c != null) { super.addComponent(c); } - - requestRepaint(); } /** @@ -179,7 +177,6 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { if (c != null) { super.addComponent(c); } - requestRepaint(); } /** @@ -217,7 +214,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { } else if (c == getSecondComponent()) { getState().setSecondChild(null); } - requestRepaint(); + markAsDirty(); } /* @@ -259,7 +256,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { } else if (oldComponent == getSecondComponent()) { setSecondComponent(newComponent); } - requestRepaint(); + markAsDirty(); } /** @@ -329,8 +326,6 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { splitterState.setPositionUnit(unit.getSymbol()); splitterState.setPositionReversed(reverse); posUnit = unit; - - requestRepaint(); } /** @@ -452,8 +447,6 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { state.setMaxPosition(maxPos); state.setMaxPositionUnit(maxPosUnit.getSymbol()); posMaxUnit = maxPosUnit; - - requestRepaint(); } /** @@ -465,7 +458,6 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { */ public void setLocked(boolean locked) { getSplitterState().setLocked(locked); - requestRepaint(); } /** @@ -520,7 +512,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { } @Override - public AbstractSplitPanelState getState() { + protected AbstractSplitPanelState getState() { return (AbstractSplitPanelState) super.getState(); } diff --git a/server/src/com/vaadin/ui/AbstractTextField.java b/server/src/com/vaadin/ui/AbstractTextField.java index 86315f801f..1bd61023a4 100644 --- a/server/src/com/vaadin/ui/AbstractTextField.java +++ b/server/src/com/vaadin/ui/AbstractTextField.java @@ -92,7 +92,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements } @Override - public AbstractTextFieldState getState() { + protected AbstractTextFieldState getState() { return (AbstractTextFieldState) super.getState(); } @@ -184,7 +184,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements // If the modified status changes, or if we have a // formatter, repaint is needed after all. if (wasModified != isModified()) { - requestRepaint(); + markAsDirty(); } } } @@ -271,7 +271,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements */ public void setNullRepresentation(String nullRepresentation) { this.nullRepresentation = nullRepresentation; - requestRepaint(); + markAsDirty(); } /** @@ -297,7 +297,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements */ public void setNullSettingAllowed(boolean nullSettingAllowed) { this.nullSettingAllowed = nullSettingAllowed; - requestRepaint(); + markAsDirty(); } @Override @@ -324,7 +324,6 @@ public abstract class AbstractTextField extends AbstractField<String> implements */ public void setMaxLength(int maxLength) { getState().setMaxLength(maxLength); - requestRepaint(); } /** @@ -351,7 +350,6 @@ public abstract class AbstractTextField extends AbstractField<String> implements columns = 0; } getState().setColumns(columns); - requestRepaint(); } /** @@ -372,7 +370,6 @@ public abstract class AbstractTextField extends AbstractField<String> implements */ public void setInputPrompt(String inputPrompt) { getState().setInputPrompt(inputPrompt); - requestRepaint(); } /* ** Text Change Events ** */ @@ -443,7 +440,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements */ if (lastKnownTextContent != null) { lastKnownTextContent = null; - requestRepaint(); + markAsDirty(); } } @@ -468,7 +465,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements */ public void setTextChangeEventMode(TextChangeEventMode inputEventMode) { textChangeEventMode = inputEventMode; - requestRepaint(); + markAsDirty(); } /** @@ -539,7 +536,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements */ public void setTextChangeTimeout(int timeout) { textChangeEventTimeout = timeout; - requestRepaint(); + markAsDirty(); } /** @@ -630,7 +627,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements selectionPosition = pos; selectionLength = length; focus(); - requestRepaint(); + markAsDirty(); } /** diff --git a/server/src/com/vaadin/ui/Button.java b/server/src/com/vaadin/ui/Button.java index f568d770e8..8546d8f830 100644 --- a/server/src/com/vaadin/ui/Button.java +++ b/server/src/com/vaadin/ui/Button.java @@ -478,7 +478,6 @@ public class Button extends AbstractComponent implements */ public void setDisableOnClick(boolean disableOnClick) { getState().setDisableOnClick(disableOnClick); - requestRepaint(); } /* @@ -499,7 +498,6 @@ public class Button extends AbstractComponent implements @Override public void setTabIndex(int tabIndex) { getState().setTabIndex(tabIndex); - requestRepaint(); } @Override @@ -509,7 +507,7 @@ public class Button extends AbstractComponent implements } @Override - public ButtonState getState() { + protected ButtonState getState() { return (ButtonState) super.getState(); } @@ -526,10 +524,7 @@ public class Button extends AbstractComponent implements * <code>false</code> otherwise */ public void setHtmlContentAllowed(boolean htmlContentAllowed) { - if (getState().isHtmlContentAllowed() != htmlContentAllowed) { - getState().setHtmlContentAllowed(htmlContentAllowed); - requestRepaint(); - } + getState().setHtmlContentAllowed(htmlContentAllowed); } /** diff --git a/server/src/com/vaadin/ui/CheckBox.java b/server/src/com/vaadin/ui/CheckBox.java index 158c9d0032..6da86b9711 100644 --- a/server/src/com/vaadin/ui/CheckBox.java +++ b/server/src/com/vaadin/ui/CheckBox.java @@ -106,7 +106,7 @@ public class CheckBox extends AbstractField<Boolean> { } @Override - public CheckBoxState getState() { + protected CheckBoxState getState() { return (CheckBoxState) super.getState(); } diff --git a/server/src/com/vaadin/ui/ComboBox.java b/server/src/com/vaadin/ui/ComboBox.java index e2655be405..af19ca5b96 100644 --- a/server/src/com/vaadin/ui/ComboBox.java +++ b/server/src/com/vaadin/ui/ComboBox.java @@ -81,7 +81,7 @@ public class ComboBox extends Select { */ public void setInputPrompt(String inputPrompt) { this.inputPrompt = inputPrompt; - requestRepaint(); + markAsDirty(); } @Override @@ -110,7 +110,7 @@ public class ComboBox extends Select { */ public void setTextInputAllowed(boolean textInputAllowed) { this.textInputAllowed = textInputAllowed; - requestRepaint(); + markAsDirty(); } /** diff --git a/server/src/com/vaadin/ui/Component.java b/server/src/com/vaadin/ui/Component.java index ff7ed47930..89e282d4e1 100644 --- a/server/src/com/vaadin/ui/Component.java +++ b/server/src/com/vaadin/ui/Component.java @@ -23,7 +23,6 @@ import java.util.Locale; import com.vaadin.Application; import com.vaadin.event.FieldEvents; -import com.vaadin.shared.ComponentState; import com.vaadin.terminal.ErrorMessage; import com.vaadin.terminal.Resource; import com.vaadin.terminal.Sizeable; @@ -624,19 +623,6 @@ public interface Component extends ClientConnector, Sizeable, Serializable { public Locale getLocale(); /** - * Returns the current shared state bean for the component. The state (or - * changes to it) is communicated from the server to the client. - * - * Subclasses can use a more specific return type for this method. - * - * @return The state object for the component - * - * @since 7.0 - */ - @Override - public ComponentState getState(); - - /** * Adds an unique id for component that get's transferred to terminal for * testing purposes. Keeping identifiers unique is the responsibility of the * programmer. diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java index 2afe7f9025..72879e0a25 100644 --- a/server/src/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/com/vaadin/ui/ConnectorTracker.java @@ -385,4 +385,8 @@ public class ConnectorTracker implements Serializable { diffStates.put(connector, diffState); } + public boolean isDirty(ClientConnector connector) { + return dirtyConnectors.contains(connector); + } + } diff --git a/server/src/com/vaadin/ui/CssLayout.java b/server/src/com/vaadin/ui/CssLayout.java index 0192debc4a..b16bcf31df 100644 --- a/server/src/com/vaadin/ui/CssLayout.java +++ b/server/src/com/vaadin/ui/CssLayout.java @@ -102,7 +102,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { components.add(c); try { super.addComponent(c); - requestRepaint(); + markAsDirty(); } catch (IllegalArgumentException e) { components.remove(c); throw e; @@ -125,7 +125,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { components.addFirst(c); try { super.addComponent(c); - requestRepaint(); + markAsDirty(); } catch (IllegalArgumentException e) { components.remove(c); throw e; @@ -154,7 +154,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { components.add(index, c); try { super.addComponent(c); - requestRepaint(); + markAsDirty(); } catch (IllegalArgumentException e) { components.remove(c); throw e; @@ -171,7 +171,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { public void removeComponent(Component c) { components.remove(c); super.removeComponent(c); - requestRepaint(); + markAsDirty(); } /** @@ -211,7 +211,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { } @Override - public CssLayoutState getState() { + protected CssLayoutState getState() { return (CssLayoutState) super.getState(); } @@ -276,7 +276,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { components.add(newLocation, oldComponent); } - requestRepaint(); + markAsDirty(); } } diff --git a/server/src/com/vaadin/ui/CustomComponent.java b/server/src/com/vaadin/ui/CustomComponent.java index 88f7b162c1..b67fa89ecb 100644 --- a/server/src/com/vaadin/ui/CustomComponent.java +++ b/server/src/com/vaadin/ui/CustomComponent.java @@ -100,7 +100,7 @@ public class CustomComponent extends AbstractComponentContainer { super.addComponent(compositionRoot); } root = compositionRoot; - requestRepaint(); + markAsDirty(); } } diff --git a/server/src/com/vaadin/ui/CustomField.java b/server/src/com/vaadin/ui/CustomField.java index 794e472dae..9ac5e2defb 100644 --- a/server/src/com/vaadin/ui/CustomField.java +++ b/server/src/com/vaadin/ui/CustomField.java @@ -120,13 +120,13 @@ public abstract class CustomField<T> extends AbstractField<T> implements @Override public void setHeight(float height, Unit unit) { super.setHeight(height, unit); - requestRepaintAll(); + markAsDirtyRecursive(); } @Override public void setWidth(float height, Unit unit) { super.setWidth(height, unit); - requestRepaintAll(); + markAsDirtyRecursive(); } // ComponentContainer methods diff --git a/server/src/com/vaadin/ui/CustomLayout.java b/server/src/com/vaadin/ui/CustomLayout.java index 2da443bfa5..54308b99c3 100644 --- a/server/src/com/vaadin/ui/CustomLayout.java +++ b/server/src/com/vaadin/ui/CustomLayout.java @@ -123,7 +123,7 @@ public class CustomLayout extends AbstractLayout implements Vaadin6Component { } @Override - public CustomLayoutState getState() { + protected CustomLayoutState getState() { return (CustomLayoutState) super.getState(); } @@ -145,7 +145,6 @@ public class CustomLayout extends AbstractLayout implements Vaadin6Component { getState().getChildLocations().put(c, location); c.setParent(this); fireComponentAttachEvent(c); - requestRepaint(); } /** @@ -176,7 +175,6 @@ public class CustomLayout extends AbstractLayout implements Vaadin6Component { slots.values().remove(c); getState().getChildLocations().remove(c); super.removeComponent(c); - requestRepaint(); } /** @@ -251,7 +249,6 @@ public class CustomLayout extends AbstractLayout implements Vaadin6Component { slots.put(oldLocation, newComponent); getState().getChildLocations().put(newComponent, oldLocation); getState().getChildLocations().put(oldComponent, newLocation); - requestRepaint(); } } @@ -277,7 +274,6 @@ public class CustomLayout extends AbstractLayout implements Vaadin6Component { public void setTemplateName(String templateName) { getState().setTemplateName(templateName); getState().setTemplateContents(null); - requestRepaint(); } /** @@ -288,34 +284,6 @@ public class CustomLayout extends AbstractLayout implements Vaadin6Component { public void setTemplateContents(String templateContents) { getState().setTemplateContents(templateContents); getState().setTemplateName(null); - requestRepaint(); - } - - /** - * Although most layouts support margins, CustomLayout does not. The - * behaviour of this layout is determined almost completely by the actual - * template. - * - * @throws UnsupportedOperationException - */ - @Override - public void setMargin(boolean enabled) { - throw new UnsupportedOperationException( - "CustomLayout does not support margins."); - } - - /** - * Although most layouts support margins, CustomLayout does not. The - * behaviour of this layout is determined almost completely by the actual - * template. - * - * @throws UnsupportedOperationException - */ - @Override - public void setMargin(boolean topEnabled, boolean rightEnabled, - boolean bottomEnabled, boolean leftEnabled) { - throw new UnsupportedOperationException( - "CustomLayout does not support margins."); } @Override diff --git a/server/src/com/vaadin/ui/DateField.java b/server/src/com/vaadin/ui/DateField.java index 5130d665eb..828fa3b21d 100644 --- a/server/src/com/vaadin/ui/DateField.java +++ b/server/src/com/vaadin/ui/DateField.java @@ -131,7 +131,7 @@ public class DateField extends AbstractField<Date> implements /** * Resolution identifier: seconds. * - * @deprecated Use {@link Resolution#SECOND} + * @deprecated As of 7.0, use {@link Resolution#SECOND} */ @Deprecated public static final Resolution RESOLUTION_SEC = Resolution.SECOND; @@ -139,7 +139,7 @@ public class DateField extends AbstractField<Date> implements /** * Resolution identifier: minutes. * - * @deprecated Use {@link Resolution#MINUTE} + * @deprecated As of 7.0, use {@link Resolution#MINUTE} */ @Deprecated public static final Resolution RESOLUTION_MIN = Resolution.MINUTE; @@ -147,7 +147,7 @@ public class DateField extends AbstractField<Date> implements /** * Resolution identifier: hours. * - * @deprecated Use {@link Resolution#HOUR} + * @deprecated As of 7.0, use {@link Resolution#HOUR} */ @Deprecated public static final Resolution RESOLUTION_HOUR = Resolution.HOUR; @@ -155,7 +155,7 @@ public class DateField extends AbstractField<Date> implements /** * Resolution identifier: days. * - * @deprecated Use {@link Resolution#DAY} + * @deprecated As of 7.0, use {@link Resolution#DAY} */ @Deprecated public static final Resolution RESOLUTION_DAY = Resolution.DAY; @@ -163,7 +163,7 @@ public class DateField extends AbstractField<Date> implements /** * Resolution identifier: months. * - * @deprecated Use {@link Resolution#MONTH} + * @deprecated As of 7.0, use {@link Resolution#MONTH} */ @Deprecated public static final Resolution RESOLUTION_MONTH = Resolution.MONTH; @@ -171,7 +171,7 @@ public class DateField extends AbstractField<Date> implements /** * Resolution identifier: years. * - * @deprecated Use {@link Resolution#YEAR} + * @deprecated As of 7.0, use {@link Resolution#YEAR} */ @Deprecated public static final Resolution RESOLUTION_YEAR = Resolution.YEAR; @@ -429,7 +429,7 @@ public class DateField extends AbstractField<Date> implements * if handleUnparsableDateString throws an exception. In * this case the invalid text remains in the DateField. */ - requestRepaint(); + markAsDirty(); } catch (Converter.ConversionException e) { /* @@ -471,7 +471,7 @@ public class DateField extends AbstractField<Date> implements * change and form depends on this implementation detail. */ notifyFormOfValidityChange(); - requestRepaint(); + markAsDirty(); } } else if (newDate != oldDate && (newDate == null || !newDate.equals(oldDate))) { @@ -562,7 +562,7 @@ public class DateField extends AbstractField<Date> implements * this. */ notifyFormOfValidityChange(); - requestRepaint(); + markAsDirty(); return; } @@ -588,7 +588,7 @@ public class DateField extends AbstractField<Date> implements * thing as form does in its value change listener that * it registers to all fields. */ - f.requestRepaint(); + f.markAsDirty(); formFound = true; break; } @@ -639,7 +639,7 @@ public class DateField extends AbstractField<Date> implements */ public void setResolution(Resolution resolution) { this.resolution = resolution; - requestRepaint(); + markAsDirty(); } /** @@ -699,7 +699,7 @@ public class DateField extends AbstractField<Date> implements */ public void setDateFormat(String dateFormat) { this.dateFormat = dateFormat; - requestRepaint(); + markAsDirty(); } /** @@ -725,7 +725,7 @@ public class DateField extends AbstractField<Date> implements */ public void setLenient(boolean lenient) { this.lenient = lenient; - requestRepaint(); + markAsDirty(); } /** @@ -781,7 +781,7 @@ public class DateField extends AbstractField<Date> implements */ public void setShowISOWeekNumbers(boolean showWeekNumbers) { showISOWeekNumbers = showWeekNumbers; - requestRepaint(); + markAsDirty(); } /** @@ -850,7 +850,7 @@ public class DateField extends AbstractField<Date> implements */ public void setTimeZone(TimeZone timeZone) { this.timeZone = timeZone; - requestRepaint(); + markAsDirty(); } /** diff --git a/server/src/com/vaadin/ui/DragAndDropWrapper.java b/server/src/com/vaadin/ui/DragAndDropWrapper.java index 3fd94210d8..ec805ecf46 100644 --- a/server/src/com/vaadin/ui/DragAndDropWrapper.java +++ b/server/src/com/vaadin/ui/DragAndDropWrapper.java @@ -60,7 +60,7 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, String id = (String) rawVariables.get("fi" + i); files[i] = file; receivers.put(id, file); - requestRepaint(); // paint Receivers + markAsDirty(); // paint Receivers } } } @@ -156,22 +156,6 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, .valueOf((String) getData("horizontalLocation")); } - /** - * @deprecated use {@link #getVerticalDropLocation()} instead - */ - @Deprecated - public VerticalDropLocation verticalDropLocation() { - return getVerticalDropLocation(); - } - - /** - * @deprecated use {@link #getHorizontalDropLocation()} instead - */ - @Deprecated - public HorizontalDropLocation horizontalDropLocation() { - return getHorizontalDropLocation(); - } - } public enum DragStartMode { @@ -223,7 +207,7 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, */ public void setHTML5DataFlavor(String type, Object value) { html5DataFlavors.put(type, value); - requestRepaint(); + markAsDirty(); } @Override @@ -270,7 +254,7 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, public void setDropHandler(DropHandler dropHandler) { this.dropHandler = dropHandler; - requestRepaint(); + markAsDirty(); } @Override @@ -286,7 +270,7 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, public void setDragStartMode(DragStartMode dragStartMode) { this.dragStartMode = dragStartMode; - requestRepaint(); + markAsDirty(); } public DragStartMode getDragStartMode() { diff --git a/server/src/com/vaadin/ui/Embedded.java b/server/src/com/vaadin/ui/Embedded.java index d019ea3b0b..41b93d0b27 100644 --- a/server/src/com/vaadin/ui/Embedded.java +++ b/server/src/com/vaadin/ui/Embedded.java @@ -196,7 +196,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { if (altText != this.altText || (altText != null && !altText.equals(this.altText))) { this.altText = altText; - requestRepaint(); + markAsDirty(); } } @@ -222,7 +222,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { */ public void setParameter(String name, String value) { parameters.put(name, value); - requestRepaint(); + markAsDirty(); } /** @@ -244,7 +244,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { */ public void removeParameter(String name) { parameters.remove(name); - requestRepaint(); + markAsDirty(); } /** @@ -307,7 +307,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { if (codebase != this.codebase || (codebase != null && !codebase.equals(this.codebase))) { this.codebase = codebase; - requestRepaint(); + markAsDirty(); } } @@ -325,7 +325,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { if (codetype != this.codetype || (codetype != null && !codetype.equals(this.codetype))) { this.codetype = codetype; - requestRepaint(); + markAsDirty(); } } @@ -350,7 +350,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { setParameter("wmode", "transparent"); } } - requestRepaint(); + markAsDirty(); } } @@ -365,7 +365,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { if (standby != this.standby || (standby != null && !standby.equals(this.standby))) { this.standby = standby; - requestRepaint(); + markAsDirty(); } } @@ -390,7 +390,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { if (classId != this.classId || (classId != null && !classId.equals(this.classId))) { this.classId = classId; - requestRepaint(); + markAsDirty(); } } @@ -443,7 +443,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { } else { // Keep previous type } - requestRepaint(); + markAsDirty(); } } @@ -467,7 +467,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { } if (type != this.type) { this.type = type; - requestRepaint(); + markAsDirty(); } } @@ -502,7 +502,7 @@ public class Embedded extends AbstractComponent implements Vaadin6Component { if (archive != this.archive || (archive != null && !archive.equals(this.archive))) { this.archive = archive; - requestRepaint(); + markAsDirty(); } } diff --git a/server/src/com/vaadin/ui/Form.java b/server/src/com/vaadin/ui/Form.java index a1ec0f9917..55404b2e6b 100644 --- a/server/src/com/vaadin/ui/Form.java +++ b/server/src/com/vaadin/ui/Form.java @@ -99,14 +99,9 @@ public class Form extends AbstractField<Object> implements Item.Editor, private Buffered.SourceException currentBufferedSourceException = null; /** - * Is the form in write trough mode. + * Is the form in buffered mode. */ - private boolean writeThrough = true; - - /** - * Is the form in read trough mode. - */ - private boolean readThrough = true; + private boolean buffered = false; /** * Mapping from propertyName to corresponding field. @@ -138,7 +133,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, private final ValueChangeListener fieldValueChangeListener = new ValueChangeListener() { @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { - requestRepaint(); + markAsDirty(); } }; @@ -200,7 +195,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, } @Override - public FormState getState() { + protected FormState getState() { return (FormState) super.getState(); } @@ -347,7 +342,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, if (problems == null) { if (currentBufferedSourceException != null) { currentBufferedSourceException = null; - requestRepaint(); + markAsDirty(); } return; } @@ -362,7 +357,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, final Buffered.SourceException e = new Buffered.SourceException(this, causes); currentBufferedSourceException = e; - requestRepaint(); + markAsDirty(); throw e; } @@ -391,7 +386,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, if (problems == null) { if (currentBufferedSourceException != null) { currentBufferedSourceException = null; - requestRepaint(); + markAsDirty(); } return; } @@ -406,7 +401,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, final Buffered.SourceException e = new Buffered.SourceException(this, causes); currentBufferedSourceException = e; - requestRepaint(); + markAsDirty(); throw e; } @@ -427,50 +422,15 @@ public class Form extends AbstractField<Object> implements Item.Editor, } /* - * Is the editor in a read-through mode? Don't add a JavaDoc comment here, - * we use the default one from the interface. - */ - @Override - @Deprecated - public boolean isReadThrough() { - return readThrough; - } - - /* - * Is the editor in a write-through mode? Don't add a JavaDoc comment here, - * we use the default one from the interface. - */ - @Override - @Deprecated - public boolean isWriteThrough() { - return writeThrough; - } - - /* - * Sets the editor's read-through mode to the specified status. Don't add a + * Sets the editor's buffered mode to the specified status. Don't add a * JavaDoc comment here, we use the default one from the interface. */ @Override - public void setReadThrough(boolean readThrough) { - if (readThrough != this.readThrough) { - this.readThrough = readThrough; + public void setBuffered(boolean buffered) { + if (buffered != this.buffered) { + this.buffered = buffered; for (final Iterator<Object> i = propertyIds.iterator(); i.hasNext();) { - (fields.get(i.next())).setReadThrough(readThrough); - } - } - } - - /* - * Sets the editor's read-through mode to the specified status. Don't add a - * JavaDoc comment here, we use the default one from the interface. - */ - @Override - public void setWriteThrough(boolean writeThrough) throws SourceException, - InvalidValueException { - if (writeThrough != this.writeThrough) { - this.writeThrough = writeThrough; - for (final Iterator<Object> i = propertyIds.iterator(); i.hasNext();) { - (fields.get(i.next())).setWriteThrough(writeThrough); + (fields.get(i.next())).setBuffered(buffered); } } } @@ -531,7 +491,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, public void addField(Object propertyId, Field<?> field) { registerField(propertyId, field); attachField(propertyId, field); - requestRepaint(); + markAsDirty(); } /** @@ -560,11 +520,10 @@ public class Form extends AbstractField<Object> implements Item.Editor, propertyIds.addLast(propertyId); } - // Update the read and write through status and immediate to match the + // Update the buffered mode and immediate to match the // form. // Should this also include invalidCommitted (#3993)? - field.setReadThrough(readThrough); - field.setWriteThrough(writeThrough); + field.setBuffered(buffered); if (isImmediate() && field instanceof AbstractComponent) { ((AbstractComponent) field).setImmediate(true); } @@ -761,7 +720,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, // If the new datasource is null, just set null datasource if (itemDatasource == null) { - requestRepaint(); + markAsDirty(); return; } @@ -861,10 +820,6 @@ public class Form extends AbstractField<Object> implements Item.Editor, // Replace the previous layout layout.setParent(this); getState().setLayout(layout); - - // Hierarchy has changed so we need to repaint (this could be a - // hierarchy repaint only) - requestRepaint(); } /** @@ -949,8 +904,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, : new Select(); newField.setCaption(oldField.getCaption()); newField.setReadOnly(oldField.isReadOnly()); - newField.setReadThrough(oldField.isReadThrough()); - newField.setWriteThrough(oldField.isWriteThrough()); + newField.setBuffered(oldField.isBuffered()); // Creates the options list newField.addContainerProperty("desc", String.class, ""); @@ -1281,11 +1235,6 @@ public class Form extends AbstractField<Object> implements Item.Editor, getState().setFooter(footer); footer.setParent(this); - - // Hierarchy has changed so we need to repaint (this could be a - // hierarchy repaint only) - requestRepaint(); - } @Override @@ -1295,7 +1244,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, // some ancestor still disabled, don't update children return; } else { - getLayout().requestRepaintAll(); + getLayout().markAsDirtyRecursive(); } } diff --git a/server/src/com/vaadin/ui/FormLayout.java b/server/src/com/vaadin/ui/FormLayout.java index c4ba4665ea..15ea478597 100644 --- a/server/src/com/vaadin/ui/FormLayout.java +++ b/server/src/com/vaadin/ui/FormLayout.java @@ -16,6 +16,8 @@ package com.vaadin.ui; +import com.vaadin.shared.ui.MarginInfo; + /** * FormLayout is used by {@link Form} to layout fields. It may also be used * separately without {@link Form}. @@ -36,7 +38,7 @@ public class FormLayout extends AbstractOrderedLayout { public FormLayout() { super(); setSpacing(true); - setMargin(true, false, true, false); + setMargin(new MarginInfo(true, false, true, false)); setWidth(100, UNITS_PERCENTAGE); } diff --git a/server/src/com/vaadin/ui/GridLayout.java b/server/src/com/vaadin/ui/GridLayout.java index 5a748c04f6..3870b71611 100644 --- a/server/src/com/vaadin/ui/GridLayout.java +++ b/server/src/com/vaadin/ui/GridLayout.java @@ -30,6 +30,7 @@ import com.vaadin.event.LayoutEvents.LayoutClickNotifier; import com.vaadin.shared.Connector; import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.MarginInfo; import com.vaadin.shared.ui.gridlayout.GridLayoutServerRpc; import com.vaadin.shared.ui.gridlayout.GridLayoutState; import com.vaadin.terminal.LegacyPaint; @@ -63,8 +64,8 @@ import com.vaadin.terminal.Vaadin6Component; */ @SuppressWarnings("serial") public class GridLayout extends AbstractLayout implements - Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier, - Vaadin6Component { + Layout.AlignmentHandler, Layout.SpacingHandler, Layout.MarginHandler, + LayoutClickNotifier, Vaadin6Component { private GridLayoutServerRpc rpc = new GridLayoutServerRpc() { @@ -140,7 +141,7 @@ public class GridLayout extends AbstractLayout implements } @Override - public GridLayoutState getState() { + protected GridLayoutState getState() { return (GridLayoutState) super.getState(); } @@ -253,7 +254,7 @@ public class GridLayout extends AbstractLayout implements } } - requestRepaint(); + markAsDirty(); } /** @@ -399,7 +400,7 @@ public class GridLayout extends AbstractLayout implements super.removeComponent(component); - requestRepaint(); + markAsDirty(); } /** @@ -805,14 +806,6 @@ public class GridLayout extends AbstractLayout implements } /** - * @deprecated Use {@link #getColumn1()} instead. - */ - @Deprecated - public int getX1() { - return getColumn1(); - } - - /** * Gets the column of the top-left corner cell. * * @return the column of the top-left corner cell. @@ -822,14 +815,6 @@ public class GridLayout extends AbstractLayout implements } /** - * @deprecated Use {@link #getColumn2()} instead. - */ - @Deprecated - public int getX2() { - return getColumn2(); - } - - /** * Gets the column of the bottom-right corner cell. * * @return the column of the bottom-right corner cell. @@ -839,14 +824,6 @@ public class GridLayout extends AbstractLayout implements } /** - * @deprecated Use {@link #getRow1()} instead. - */ - @Deprecated - public int getY1() { - return getRow1(); - } - - /** * Gets the row of the top-left corner cell. * * @return the row of the top-left corner cell. @@ -856,14 +833,6 @@ public class GridLayout extends AbstractLayout implements } /** - * @deprecated Use {@link #getRow2()} instead. - */ - @Deprecated - public int getY2() { - return getRow2(); - } - - /** * Gets the row of the bottom-right corner cell. * * @return the row of the bottom-right corner cell. @@ -993,8 +962,6 @@ public class GridLayout extends AbstractLayout implements } getState().setColumns(columns); - - requestRepaint(); } /** @@ -1037,8 +1004,6 @@ public class GridLayout extends AbstractLayout implements } getState().setRows(rows); - - requestRepaint(); } /** @@ -1131,7 +1096,7 @@ public class GridLayout extends AbstractLayout implements } else { oldLocation.setComponent(newComponent); newLocation.setComponent(oldComponent); - requestRepaint(); + markAsDirty(); } } @@ -1148,25 +1113,11 @@ public class GridLayout extends AbstractLayout implements cursorY = 0; } - /* - * (non-Javadoc) - * - * @see com.vaadin.ui.Layout.AlignmentHandler#setComponentAlignment(com - * .vaadin.ui.Component, int, int) - */ - @Override - public void setComponentAlignment(Component childComponent, - int horizontalAlignment, int verticalAlignment) { - componentToAlignment.put(childComponent, new Alignment( - horizontalAlignment + verticalAlignment)); - requestRepaint(); - } - @Override public void setComponentAlignment(Component childComponent, Alignment alignment) { componentToAlignment.put(childComponent, alignment); - requestRepaint(); + markAsDirty(); } /* @@ -1177,7 +1128,6 @@ public class GridLayout extends AbstractLayout implements @Override public void setSpacing(boolean spacing) { getState().setSpacing(spacing); - requestRepaint(); } /* @@ -1223,7 +1173,7 @@ public class GridLayout extends AbstractLayout implements setRows(getRows() + 1); structuralChange = true; - requestRepaint(); + markAsDirty(); } /** @@ -1282,7 +1232,7 @@ public class GridLayout extends AbstractLayout implements } structuralChange = true; - requestRepaint(); + markAsDirty(); } @@ -1307,7 +1257,7 @@ public class GridLayout extends AbstractLayout implements */ public void setColumnExpandRatio(int columnIndex, float ratio) { columnExpandRatio.put(columnIndex, ratio); - requestRepaint(); + markAsDirty(); } /** @@ -1345,7 +1295,7 @@ public class GridLayout extends AbstractLayout implements */ public void setRowExpandRatio(int rowIndex, float ratio) { rowExpandRatio.put(rowIndex, ratio); - requestRepaint(); + markAsDirty(); } /** @@ -1416,4 +1366,36 @@ public class GridLayout extends AbstractLayout implements LayoutClickEvent.class, listener); } + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.Layout.MarginHandler#setMargin(boolean) + */ + @Override + public void setMargin(boolean enabled) { + setMargin(new MarginInfo(enabled)); + } + + /* + * (non-Javadoc) + * + * @see + * com.vaadin.ui.Layout.MarginHandler#setMargin(com.vaadin.shared.ui.MarginInfo + * ) + */ + @Override + public void setMargin(MarginInfo marginInfo) { + getState().setMarginsBitmask(marginInfo.getBitMask()); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.Layout.MarginHandler#getMargin() + */ + @Override + public MarginInfo getMargin() { + return new MarginInfo(getState().getMarginsBitmask()); + } + } diff --git a/server/src/com/vaadin/ui/JavaScript.java b/server/src/com/vaadin/ui/JavaScript.java index 35cc1893f6..e34ccae82a 100644 --- a/server/src/com/vaadin/ui/JavaScript.java +++ b/server/src/com/vaadin/ui/JavaScript.java @@ -66,7 +66,7 @@ public class JavaScript extends AbstractExtension { } @Override - public JavaScriptManagerState getState() { + protected JavaScriptManagerState getState() { return (JavaScriptManagerState) super.getState(); } @@ -93,9 +93,7 @@ public class JavaScript extends AbstractExtension { */ public void addFunction(String name, JavaScriptFunction function) { functions.put(name, function); - if (getState().getNames().add(name)) { - requestRepaint(); - } + getState().getNames().add(name); } /** @@ -111,9 +109,7 @@ public class JavaScript extends AbstractExtension { */ public void removeFunction(String name) { functions.remove(name); - if (getState().getNames().remove(name)) { - requestRepaint(); - } + getState().getNames().remove(name); } /** diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java index 668b99a74c..81a343e937 100644 --- a/server/src/com/vaadin/ui/Label.java +++ b/server/src/com/vaadin/ui/Label.java @@ -151,7 +151,7 @@ public class Label extends AbstractComponent implements Property<String>, } @Override - public LabelState getState() { + protected LabelState getState() { return (LabelState) super.getState(); } @@ -168,7 +168,7 @@ public class Label extends AbstractComponent implements Property<String>, public String getValue() { if (getPropertyDataSource() == null) { // Use internal value if we are running without a data source - return getState().getText(); + return getState().text; } return ConverterUtil.convertFromModel(getPropertyDataSource() .getValue(), String.class, getConverter(), getLocale()); @@ -189,8 +189,7 @@ public class Label extends AbstractComponent implements Property<String>, + String.class.getName()); } if (getPropertyDataSource() == null) { - getState().setText((String) newStringValue); - requestRepaint(); + getState().text = (String) newStringValue; } else { throw new IllegalStateException( "Label is only a Property.Viewer and cannot update its data source"); @@ -266,7 +265,7 @@ public class Label extends AbstractComponent implements Property<String>, .isAssignableFrom(dataSource.getClass())) { ((Property.ValueChangeNotifier) dataSource).addListener(this); } - requestRepaint(); + markAsDirty(); } /** @@ -277,7 +276,7 @@ public class Label extends AbstractComponent implements Property<String>, * @see ContentMode */ public ContentMode getContentMode() { - return getState().getContentMode(); + return getState().contentMode; } /** @@ -293,8 +292,7 @@ public class Label extends AbstractComponent implements Property<String>, throw new IllegalArgumentException("Content mode can not be null"); } - getState().setContentMode(contentMode); - requestRepaint(); + getState().contentMode = contentMode; } /* Value change events */ @@ -384,8 +382,7 @@ public class Label extends AbstractComponent implements Property<String>, @Override public void valueChange(Property.ValueChangeEvent event) { // Update the internal value from the data source - getState().setText(getValue()); - requestRepaint(); + getState().text = getValue(); fireValueChange(); } @@ -485,7 +482,7 @@ public class Label extends AbstractComponent implements Property<String>, */ public void setConverter(Converter<String, ?> converter) { this.converter = (Converter<String, Object>) converter; - requestRepaint(); + markAsDirty(); } } diff --git a/server/src/com/vaadin/ui/Layout.java b/server/src/com/vaadin/ui/Layout.java index 6a95d23f8c..b32cf8c47d 100644 --- a/server/src/com/vaadin/ui/Layout.java +++ b/server/src/com/vaadin/ui/Layout.java @@ -18,8 +18,7 @@ package com.vaadin.ui; import java.io.Serializable; -import com.vaadin.shared.ui.VMarginInfo; -import com.vaadin.shared.ui.AlignmentInfo.Bits; +import com.vaadin.shared.ui.MarginInfo; /** * Extension to the {@link ComponentContainer} interface which adds the @@ -33,104 +32,12 @@ import com.vaadin.shared.ui.AlignmentInfo.Bits; public interface Layout extends ComponentContainer, Serializable { /** - * Enable layout margins. Affects all four sides of the layout. This will - * tell the client-side implementation to leave extra space around the - * layout. The client-side implementation decides the actual amount, and it - * can vary between themes. - * - * @param enabled - */ - public void setMargin(boolean enabled); - - /** - * Enable specific layout margins. This will tell the client-side - * implementation to leave extra space around the layout in specified edges, - * clockwise from top (top, right, bottom, left). The client-side - * implementation decides the actual amount, and it can vary between themes. - * - * @param top - * @param right - * @param bottom - * @param left - */ - public void setMargin(boolean top, boolean right, boolean bottom, - boolean left); - - /** * AlignmentHandler is most commonly an advanced {@link Layout} that can * align its components. */ public interface AlignmentHandler extends Serializable { /** - * Contained component should be aligned horizontally to the left. - * - * @deprecated Use of {@link Alignment} class and its constants - */ - @Deprecated - public static final int ALIGNMENT_LEFT = Bits.ALIGNMENT_LEFT; - - /** - * Contained component should be aligned horizontally to the right. - * - * @deprecated Use of {@link Alignment} class and its constants - */ - @Deprecated - public static final int ALIGNMENT_RIGHT = Bits.ALIGNMENT_RIGHT; - - /** - * Contained component should be aligned vertically to the top. - * - * @deprecated Use of {@link Alignment} class and its constants - */ - @Deprecated - public static final int ALIGNMENT_TOP = Bits.ALIGNMENT_TOP; - - /** - * Contained component should be aligned vertically to the bottom. - * - * @deprecated Use of {@link Alignment} class and its constants - */ - @Deprecated - public static final int ALIGNMENT_BOTTOM = Bits.ALIGNMENT_BOTTOM; - - /** - * Contained component should be horizontally aligned to center. - * - * @deprecated Use of {@link Alignment} class and its constants - */ - @Deprecated - public static final int ALIGNMENT_HORIZONTAL_CENTER = Bits.ALIGNMENT_HORIZONTAL_CENTER; - - /** - * Contained component should be vertically aligned to center. - * - * @deprecated Use of {@link Alignment} class and its constants - */ - @Deprecated - public static final int ALIGNMENT_VERTICAL_CENTER = Bits.ALIGNMENT_VERTICAL_CENTER; - - /** - * Set alignment for one contained component in this layout. Alignment - * is calculated as a bit mask of the two passed values. - * - * @deprecated Use {@link #setComponentAlignment(Component, Alignment)} - * instead - * - * @param childComponent - * the component to align within it's layout cell. - * @param horizontalAlignment - * the horizontal alignment for the child component (left, - * center, right). Use ALIGNMENT constants. - * @param verticalAlignment - * the vertical alignment for the child component (top, - * center, bottom). Use ALIGNMENT constants. - */ - @Deprecated - public void setComponentAlignment(Component childComponent, - int horizontalAlignment, int verticalAlignment); - - /** * Set alignment for one contained component in this layout. Use * predefined alignments from Alignment class. * @@ -197,6 +104,19 @@ public interface Layout extends ComponentContainer, Serializable { * its components). */ public interface MarginHandler extends Serializable { + + /** + * Enable layout margins. Affects all four sides of the layout. This + * will tell the client-side implementation to leave extra space around + * the layout. The client-side implementation decides the actual amount, + * and it can vary between themes. + * + * @param enabled + * true if margins should be enabled on all sides, false to + * disable all margins + */ + public void setMargin(boolean enabled); + /** * Enable margins for this layout. * @@ -224,16 +144,4 @@ public interface Layout extends ComponentContainer, Serializable { public MarginInfo getMargin(); } - @SuppressWarnings("serial") - public static class MarginInfo extends VMarginInfo implements Serializable { - - public MarginInfo(boolean enabled) { - super(enabled, enabled, enabled, enabled); - } - - public MarginInfo(boolean top, boolean right, boolean bottom, - boolean left) { - super(top, right, bottom, left); - } - } } diff --git a/server/src/com/vaadin/ui/Link.java b/server/src/com/vaadin/ui/Link.java index 57f2088054..f98a2b0d2d 100644 --- a/server/src/com/vaadin/ui/Link.java +++ b/server/src/com/vaadin/ui/Link.java @@ -18,7 +18,7 @@ package com.vaadin.ui; import java.util.Map; -import com.vaadin.terminal.Page; +import com.vaadin.shared.ui.BorderStyle; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; import com.vaadin.terminal.Resource; @@ -34,19 +34,22 @@ import com.vaadin.terminal.Vaadin6Component; public class Link extends AbstractComponent implements Vaadin6Component { /* Target window border type constant: No window border */ - public static final int TARGET_BORDER_NONE = Page.BORDER_NONE; + @Deprecated + public static final BorderStyle TARGET_BORDER_NONE = BorderStyle.NONE; /* Target window border type constant: Minimal window border */ - public static final int TARGET_BORDER_MINIMAL = Page.BORDER_MINIMAL; + @Deprecated + public static final BorderStyle TARGET_BORDER_MINIMAL = BorderStyle.MINIMAL; /* Target window border type constant: Default window border */ - public static final int TARGET_BORDER_DEFAULT = Page.BORDER_DEFAULT; + @Deprecated + public static final BorderStyle TARGET_BORDER_DEFAULT = BorderStyle.DEFAULT; private Resource resource = null; private String targetName; - private int targetBorder = TARGET_BORDER_DEFAULT; + private BorderStyle targetBorder = BorderStyle.DEFAULT; private int targetWidth = -1; @@ -89,7 +92,7 @@ public class Link extends AbstractComponent implements Vaadin6Component { * */ public Link(String caption, Resource resource, String targetName, - int width, int height, int border) { + int width, int height, BorderStyle border) { setCaption(caption); this.resource = resource; setTargetName(targetName); @@ -131,10 +134,10 @@ public class Link extends AbstractComponent implements Vaadin6Component { // Target window border switch (getTargetBorder()) { - case TARGET_BORDER_MINIMAL: + case MINIMAL: target.addAttribute("border", "minimal"); break; - case TARGET_BORDER_NONE: + case NONE: target.addAttribute("border", "none"); break; } @@ -145,7 +148,7 @@ public class Link extends AbstractComponent implements Vaadin6Component { * * @return the target window border. */ - public int getTargetBorder() { + public BorderStyle getTargetBorder() { return targetBorder; } @@ -183,13 +186,9 @@ public class Link extends AbstractComponent implements Vaadin6Component { * @param targetBorder * the targetBorder to set. */ - public void setTargetBorder(int targetBorder) { - if (targetBorder == TARGET_BORDER_DEFAULT - || targetBorder == TARGET_BORDER_MINIMAL - || targetBorder == TARGET_BORDER_NONE) { - this.targetBorder = targetBorder; - requestRepaint(); - } + public void setTargetBorder(BorderStyle targetBorder) { + this.targetBorder = targetBorder; + markAsDirty(); } /** @@ -200,7 +199,7 @@ public class Link extends AbstractComponent implements Vaadin6Component { */ public void setTargetHeight(int targetHeight) { this.targetHeight = targetHeight; - requestRepaint(); + markAsDirty(); } /** @@ -211,7 +210,7 @@ public class Link extends AbstractComponent implements Vaadin6Component { */ public void setTargetName(String targetName) { this.targetName = targetName; - requestRepaint(); + markAsDirty(); } /** @@ -222,7 +221,7 @@ public class Link extends AbstractComponent implements Vaadin6Component { */ public void setTargetWidth(int targetWidth) { this.targetWidth = targetWidth; - requestRepaint(); + markAsDirty(); } /** @@ -242,7 +241,7 @@ public class Link extends AbstractComponent implements Vaadin6Component { */ public void setResource(Resource resource) { this.resource = resource; - requestRepaint(); + markAsDirty(); } @Override diff --git a/server/src/com/vaadin/ui/ListSelect.java b/server/src/com/vaadin/ui/ListSelect.java index eb54183164..da78e24fa8 100644 --- a/server/src/com/vaadin/ui/ListSelect.java +++ b/server/src/com/vaadin/ui/ListSelect.java @@ -62,7 +62,7 @@ public class ListSelect extends AbstractSelect { } if (this.columns != columns) { this.columns = columns; - requestRepaint(); + markAsDirty(); } } @@ -88,7 +88,7 @@ public class ListSelect extends AbstractSelect { } if (this.rows != rows) { this.rows = rows; - requestRepaint(); + markAsDirty(); } } diff --git a/server/src/com/vaadin/ui/LoginForm.java b/server/src/com/vaadin/ui/LoginForm.java index c8634ea81a..bb7767084c 100644 --- a/server/src/com/vaadin/ui/LoginForm.java +++ b/server/src/com/vaadin/ui/LoginForm.java @@ -99,6 +99,9 @@ public class LoginForm extends CustomComponent { throws IOException { String requestPathInfo = request.getRequestPathInfo(); if ("/loginHandler".equals(requestPathInfo)) { + // Ensure Root.getCurrent() works in listeners + Root.setCurrent(getRoot()); + response.setCacheTime(-1); response.setContentType("text/html; charset=utf-8"); response.getWriter() diff --git a/server/src/com/vaadin/ui/MenuBar.java b/server/src/com/vaadin/ui/MenuBar.java index 37728ee69b..51c06cf934 100644 --- a/server/src/com/vaadin/ui/MenuBar.java +++ b/server/src/com/vaadin/ui/MenuBar.java @@ -223,7 +223,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { } MenuItem newItem = new MenuItem(caption, icon, command); menuItems.add(newItem); - requestRepaint(); + markAsDirty(); return newItem; @@ -259,7 +259,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { menuItems.add(newItem); } - requestRepaint(); + markAsDirty(); return newItem; } @@ -283,7 +283,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { if (item != null) { menuItems.remove(item); } - requestRepaint(); + markAsDirty(); } /** @@ -291,7 +291,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { */ public void removeItems() { menuItems.clear(); - requestRepaint(); + markAsDirty(); } /** @@ -318,7 +318,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { } else { moreItem = new MenuItem("", null, null); } - requestRepaint(); + markAsDirty(); } /** @@ -345,7 +345,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { public void setAutoOpen(boolean autoOpenTopLevelMenu) { if (autoOpenTopLevelMenu != openRootOnHover) { openRootOnHover = autoOpenTopLevelMenu; - requestRepaint(); + markAsDirty(); } } @@ -373,7 +373,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { */ public void setHtmlContentAllowed(boolean htmlContentAllowed) { this.htmlContentAllowed = htmlContentAllowed; - requestRepaint(); + markAsDirty(); } /** @@ -521,7 +521,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { newItem.setParent(this); itsChildren.add(newItem); - requestRepaint(); + markAsDirty(); return newItem; } @@ -560,7 +560,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { newItem = addItem(caption, icon, command); } - requestRepaint(); + markAsDirty(); return newItem; } @@ -651,7 +651,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { */ public void setIcon(Resource icon) { itsIcon = icon; - requestRepaint(); + markAsDirty(); } /** @@ -664,7 +664,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { if (text != null) { itsText = text; } - requestRepaint(); + markAsDirty(); } /** @@ -679,7 +679,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { if (itsChildren.isEmpty()) { itsChildren = null; } - requestRepaint(); + markAsDirty(); } } @@ -690,7 +690,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { if (itsChildren != null) { itsChildren.clear(); itsChildren = null; - requestRepaint(); + markAsDirty(); } } @@ -706,7 +706,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { public void setEnabled(boolean enabled) { this.enabled = enabled; - requestRepaint(); + markAsDirty(); } public boolean isEnabled() { @@ -715,7 +715,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { public void setVisible(boolean visible) { this.visible = visible; - requestRepaint(); + markAsDirty(); } public boolean isVisible() { @@ -724,7 +724,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { private void setSeparator(boolean isSeparator) { this.isSeparator = isSeparator; - requestRepaint(); + markAsDirty(); } public boolean isSeparator() { @@ -733,7 +733,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { public void setStyleName(String styleName) { this.styleName = styleName; - requestRepaint(); + markAsDirty(); } public String getStyleName() { @@ -750,7 +750,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { */ public void setDescription(String description) { this.description = description; - requestRepaint(); + markAsDirty(); } /** @@ -855,7 +855,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { "A menu item with children cannot be checkable"); } this.checkable = checkable; - requestRepaint(); + markAsDirty(); } /** @@ -897,7 +897,7 @@ public class MenuBar extends AbstractComponent implements Vaadin6Component { */ public void setChecked(boolean checked) { this.checked = checked; - requestRepaint(); + markAsDirty(); } }// class MenuItem diff --git a/server/src/com/vaadin/ui/NativeSelect.java b/server/src/com/vaadin/ui/NativeSelect.java index 53c225a256..c2969874b0 100644 --- a/server/src/com/vaadin/ui/NativeSelect.java +++ b/server/src/com/vaadin/ui/NativeSelect.java @@ -64,7 +64,7 @@ public class NativeSelect extends AbstractSelect { } if (this.columns != columns) { this.columns = columns; - requestRepaint(); + markAsDirty(); } } diff --git a/server/src/com/vaadin/ui/Notification.java b/server/src/com/vaadin/ui/Notification.java index d408889519..22ad31dffe 100644 --- a/server/src/com/vaadin/ui/Notification.java +++ b/server/src/com/vaadin/ui/Notification.java @@ -18,6 +18,7 @@ package com.vaadin.ui; import java.io.Serializable; +import com.vaadin.shared.Position; import com.vaadin.terminal.Page; import com.vaadin.terminal.Resource; @@ -61,18 +62,33 @@ import com.vaadin.terminal.Resource; * */ public class Notification implements Serializable { - public static final int TYPE_HUMANIZED_MESSAGE = 1; - public static final int TYPE_WARNING_MESSAGE = 2; - public static final int TYPE_ERROR_MESSAGE = 3; - public static final int TYPE_TRAY_NOTIFICATION = 4; - - public static final int POSITION_CENTERED = 1; - public static final int POSITION_CENTERED_TOP = 2; - public static final int POSITION_CENTERED_BOTTOM = 3; - public static final int POSITION_TOP_LEFT = 4; - public static final int POSITION_TOP_RIGHT = 5; - public static final int POSITION_BOTTOM_LEFT = 6; - public static final int POSITION_BOTTOM_RIGHT = 7; + public enum Type { + HUMANIZED_MESSAGE, WARNING_MESSAGE, ERROR_MESSAGE, TRAY_NOTIFICATION; + } + + @Deprecated + public static final Type TYPE_HUMANIZED_MESSAGE = Type.HUMANIZED_MESSAGE; + @Deprecated + public static final Type TYPE_WARNING_MESSAGE = Type.WARNING_MESSAGE; + @Deprecated + public static final Type TYPE_ERROR_MESSAGE = Type.ERROR_MESSAGE; + @Deprecated + public static final Type TYPE_TRAY_NOTIFICATION = Type.TRAY_NOTIFICATION; + + @Deprecated + public static final Position POSITION_CENTERED = Position.MIDDLE_CENTER; + @Deprecated + public static final Position POSITION_CENTERED_TOP = Position.TOP_CENTER; + @Deprecated + public static final Position POSITION_CENTERED_BOTTOM = Position.BOTTOM_CENTER; + @Deprecated + public static final Position POSITION_TOP_LEFT = Position.TOP_LEFT; + @Deprecated + public static final Position POSITION_TOP_RIGHT = Position.TOP_RIGHT; + @Deprecated + public static final Position POSITION_BOTTOM_LEFT = Position.BOTTOM_LEFT; + @Deprecated + public static final Position POSITION_BOTTOM_RIGHT = Position.BOTTOM_RIGHT; public static final int DELAY_FOREVER = -1; public static final int DELAY_NONE = 0; @@ -80,7 +96,7 @@ public class Notification implements Serializable { private String caption; private String description; private Resource icon; - private int position = POSITION_CENTERED; + private Position position = Position.MIDDLE_CENTER; private int delayMsec = 0; private String styleName; private boolean htmlContentAllowed; @@ -107,7 +123,7 @@ public class Notification implements Serializable { * @param type * The type of message */ - public Notification(String caption, int type) { + public Notification(String caption, Type type) { this(caption, null, type); } @@ -141,7 +157,7 @@ public class Notification implements Serializable { * @param type * The type of message */ - public Notification(String caption, String description, int type) { + public Notification(String caption, String description, Type type) { this(caption, description, type, false); } @@ -161,7 +177,7 @@ public class Notification implements Serializable { * Whether html in the caption and description should be * displayed as html or as plain text */ - public Notification(String caption, String description, int type, + public Notification(String caption, String description, Type type, boolean htmlContentAllowed) { this.caption = caption; this.description = description; @@ -169,22 +185,22 @@ public class Notification implements Serializable { setType(type); } - private void setType(int type) { + private void setType(Type type) { switch (type) { - case TYPE_WARNING_MESSAGE: + case WARNING_MESSAGE: delayMsec = 1500; styleName = "warning"; break; - case TYPE_ERROR_MESSAGE: + case ERROR_MESSAGE: delayMsec = -1; styleName = "error"; break; - case TYPE_TRAY_NOTIFICATION: + case TRAY_NOTIFICATION: delayMsec = 3000; - position = POSITION_BOTTOM_RIGHT; + position = Position.BOTTOM_RIGHT; styleName = "tray"; - case TYPE_HUMANIZED_MESSAGE: + case HUMANIZED_MESSAGE: default: break; } @@ -233,7 +249,7 @@ public class Notification implements Serializable { * * @return The position */ - public int getPosition() { + public Position getPosition() { return position; } @@ -243,7 +259,7 @@ public class Notification implements Serializable { * @param position * The desired notification position */ - public void setPosition(int position) { + public void setPosition(Position position) { this.position = position; } @@ -373,7 +389,7 @@ public class Notification implements Serializable { * @param type * The message type */ - public static void show(String caption, int type) { + public static void show(String caption, Type type) { new Notification(caption, type).show(Page.getCurrent()); } }
\ No newline at end of file diff --git a/server/src/com/vaadin/ui/OptionGroup.java b/server/src/com/vaadin/ui/OptionGroup.java index dfb5019331..12507442c9 100644 --- a/server/src/com/vaadin/ui/OptionGroup.java +++ b/server/src/com/vaadin/ui/OptionGroup.java @@ -125,14 +125,14 @@ public class OptionGroup extends AbstractSelect implements Set<?> newValueSet = (Set<?>) newValue; for (Object itemId : currentValueSet) { if (!isItemEnabled(itemId) && !newValueSet.contains(itemId)) { - requestRepaint(); + markAsDirty(); return; } } for (Object itemId : newValueSet) { if (!isItemEnabled(itemId) && !currentValueSet.contains(itemId)) { - requestRepaint(); + markAsDirty(); return; } } @@ -141,7 +141,7 @@ public class OptionGroup extends AbstractSelect implements newValue = getNullSelectionItemId(); } if (!isItemEnabled(newValue)) { - requestRepaint(); + markAsDirty(); return; } } @@ -169,7 +169,7 @@ public class OptionGroup extends AbstractSelect implements } else { disabledItemIds.add(itemId); } - requestRepaint(); + markAsDirty(); } } @@ -200,7 +200,7 @@ public class OptionGroup extends AbstractSelect implements */ public void setHtmlContentAllowed(boolean htmlContentAllowed) { this.htmlContentAllowed = htmlContentAllowed; - requestRepaint(); + markAsDirty(); } /** diff --git a/server/src/com/vaadin/ui/Panel.java b/server/src/com/vaadin/ui/Panel.java index ba68238707..00810b83db 100644 --- a/server/src/com/vaadin/ui/Panel.java +++ b/server/src/com/vaadin/ui/Panel.java @@ -176,7 +176,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable, .addListener((ComponentContainer.ComponentDetachListener) this); content = newContent; - requestRepaint(); + markAsDirty(); } /** @@ -318,7 +318,6 @@ public class Panel extends AbstractComponentContainer implements Scrollable, "Scroll offset must be at least 0"); } getState().setScrollLeft(scrollLeft); - requestRepaint(); } /* @@ -333,7 +332,6 @@ public class Panel extends AbstractComponentContainer implements Scrollable, "Scroll offset must be at least 0"); } getState().setScrollTop(scrollTop); - requestRepaint(); } /* Documented in superclass */ @@ -465,7 +463,6 @@ public class Panel extends AbstractComponentContainer implements Scrollable, @Override public void setTabIndex(int tabIndex) { getState().setTabIndex(tabIndex); - requestRepaint(); } /** @@ -489,7 +486,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable, } @Override - public PanelState getState() { + protected PanelState getState() { return (PanelState) super.getState(); } diff --git a/server/src/com/vaadin/ui/PopupDateField.java b/server/src/com/vaadin/ui/PopupDateField.java index a4304faaf9..acff49a142 100644 --- a/server/src/com/vaadin/ui/PopupDateField.java +++ b/server/src/com/vaadin/ui/PopupDateField.java @@ -84,7 +84,7 @@ public class PopupDateField extends DateField { */ public void setInputPrompt(String inputPrompt) { this.inputPrompt = inputPrompt; - requestRepaint(); + markAsDirty(); } } diff --git a/server/src/com/vaadin/ui/PopupView.java b/server/src/com/vaadin/ui/PopupView.java index 4a5814f660..786257c240 100644 --- a/server/src/com/vaadin/ui/PopupView.java +++ b/server/src/com/vaadin/ui/PopupView.java @@ -147,7 +147,7 @@ public class PopupView extends AbstractComponentContainer implements throw new IllegalArgumentException("Content must not be null"); } content = newContent; - requestRepaint(); + markAsDirty(); } /** @@ -160,22 +160,6 @@ public class PopupView extends AbstractComponentContainer implements } /** - * @deprecated Use {@link #setPopupVisible()} instead. - */ - @Deprecated - public void setPopupVisibility(boolean visible) { - setPopupVisible(visible); - } - - /** - * @deprecated Use {@link #isPopupVisible()} instead. - */ - @Deprecated - public boolean getPopupVisibility() { - return isPopupVisible(); - } - - /** * Set the visibility of the popup. Does not hide the minimal * representation. * @@ -195,7 +179,7 @@ public class PopupView extends AbstractComponentContainer implements visibleComponent = null; } fireEvent(new PopupVisibilityEvent(this)); - requestRepaint(); + markAsDirty(); } } diff --git a/server/src/com/vaadin/ui/ProgressIndicator.java b/server/src/com/vaadin/ui/ProgressIndicator.java index d3e292a3e1..528c404ab9 100644 --- a/server/src/com/vaadin/ui/ProgressIndicator.java +++ b/server/src/com/vaadin/ui/ProgressIndicator.java @@ -226,7 +226,7 @@ public class ProgressIndicator extends AbstractField<Number> implements */ public void setIndeterminate(boolean newValue) { indeterminate = newValue; - requestRepaint(); + markAsDirty(); } /** @@ -246,7 +246,7 @@ public class ProgressIndicator extends AbstractField<Number> implements */ public void setPollingInterval(int newValue) { pollingInterval = newValue; - requestRepaint(); + markAsDirty(); } /** diff --git a/server/src/com/vaadin/ui/RichTextArea.java b/server/src/com/vaadin/ui/RichTextArea.java index e3d1168559..51caa82136 100644 --- a/server/src/com/vaadin/ui/RichTextArea.java +++ b/server/src/com/vaadin/ui/RichTextArea.java @@ -16,7 +16,6 @@ package com.vaadin.ui; -import java.text.Format; import java.util.Map; import com.vaadin.data.Property; @@ -35,12 +34,6 @@ public class RichTextArea extends AbstractField<String> implements Vaadin6Component { /** - * Value formatter used to format the string contents. - */ - @Deprecated - private Format format; - - /** * Null representation. */ private String nullRepresentation = "null"; @@ -123,7 +116,7 @@ public class RichTextArea extends AbstractField<String> implements } // Adds the content as variable - String value = getFormattedValue(); + String value = getValue(); if (value == null) { value = getNullRepresentation(); } @@ -164,38 +157,7 @@ public class RichTextArea extends AbstractField<String> implements */ selectAll = true; focus(); - requestRepaint(); - } - - /** - * Gets the formatted string value. Sets the field value by using the - * assigned Format. - * - * @return the Formatted value. - * @see #setFormat(Format) - * @see Format - * @deprecated - */ - @Deprecated - protected String getFormattedValue() { - Object v = getValue(); - if (v == null) { - return null; - } - return v.toString(); - } - - @Override - public String getValue() { - String v = super.getValue(); - if (format == null || v == null) { - return v; - } - try { - return format.format(v); - } catch (final IllegalArgumentException e) { - return v; - } + markAsDirty(); } @Override @@ -207,7 +169,7 @@ public class RichTextArea extends AbstractField<String> implements // has been updated String newValue = (String) variables.get("text"); - final String oldValue = getFormattedValue(); + final String oldValue = getValue(); if (newValue != null && (oldValue == null || isNullSettingAllowed()) && newValue.equals(getNullRepresentation())) { @@ -218,10 +180,10 @@ public class RichTextArea extends AbstractField<String> implements boolean wasModified = isModified(); setValue(newValue, true); - // If the modified status changes, or if we have a formatter, + // If the modified status changes, // repaint is needed after all. - if (format != null || wasModified != isModified()) { - requestRepaint(); + if (wasModified != isModified()) { + markAsDirty(); } } } @@ -323,31 +285,6 @@ public class RichTextArea extends AbstractField<String> implements this.nullSettingAllowed = nullSettingAllowed; } - /** - * Gets the value formatter of TextField. - * - * @return the Format used to format the value. - * @deprecated replaced by {@link com.vaadin.data.util.PropertyFormatter} - */ - @Deprecated - public Format getFormat() { - return format; - } - - /** - * Gets the value formatter of TextField. - * - * @param format - * the Format used to format the value. Null disables the - * formatting. - * @deprecated replaced by {@link com.vaadin.data.util.PropertyFormatter} - */ - @Deprecated - public void setFormat(Format format) { - this.format = format; - requestRepaint(); - } - @Override protected boolean isEmpty() { return super.isEmpty() || getValue().length() == 0; diff --git a/server/src/com/vaadin/ui/Root.java b/server/src/com/vaadin/ui/Root.java index b37005a16e..67f2e04a65 100644 --- a/server/src/com/vaadin/ui/Root.java +++ b/server/src/com/vaadin/ui/Root.java @@ -34,6 +34,7 @@ import com.vaadin.event.MouseEvents.ClickEvent; import com.vaadin.event.MouseEvents.ClickListener; import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.BorderStyle; import com.vaadin.shared.ui.root.RootConstants; import com.vaadin.shared.ui.root.RootServerRpc; import com.vaadin.shared.ui.root.RootState; @@ -283,13 +284,12 @@ public abstract class Root extends AbstractComponentContainer implements * @param height * the height of the window in pixels * @param border - * the border style of the window. See {@link #BORDER_NONE - * Window.BORDER_* constants} + * the border style of the window. * @deprecated As of 7.0, use getPage().open instead */ @Deprecated public void open(Resource resource, String windowName, int width, - int height, int border) { + int height, BorderStyle border) { getPage().open(resource, windowName, width, height, border); } @@ -498,7 +498,7 @@ public abstract class Root extends AbstractComponentContainer implements } @Override - public RootState getState() { + protected RootState getState() { return (RootState) super.getState(); } @@ -723,7 +723,7 @@ public abstract class Root extends AbstractComponentContainer implements private void attachWindow(Window w) { windows.add(w); w.setParent(this); - requestRepaint(); + markAsDirty(); } /** @@ -746,7 +746,7 @@ public abstract class Root extends AbstractComponentContainer implements } window.setParent(null); window.fireClose(); - requestRepaint(); + markAsDirty(); return true; } @@ -788,7 +788,7 @@ public abstract class Root extends AbstractComponentContainer implements */ public void setFocusedComponent(Focusable focusable) { pendingFocus = focusable; - requestRepaint(); + markAsDirty(); } /** @@ -808,7 +808,7 @@ public abstract class Root extends AbstractComponentContainer implements "The component where to scroll must belong to this root."); } scrollIntoView = component; - requestRepaint(); + markAsDirty(); } /** @@ -860,8 +860,6 @@ public abstract class Root extends AbstractComponentContainer implements if (content != null) { super.addComponent(content); } - - requestRepaint(); } /** @@ -1015,7 +1013,7 @@ public abstract class Root extends AbstractComponentContainer implements */ public void setResizeLazy(boolean resizeLazy) { this.resizeLazy = resizeLazy; - requestRepaint(); + markAsDirty(); } /** @@ -1126,7 +1124,7 @@ public abstract class Root extends AbstractComponentContainer implements * Notification.show does not allow HTML. */ @Deprecated - public void showNotification(String caption, int type) { + public void showNotification(String caption, Notification.Type type) { Notification notification = new Notification(caption, type); notification.setHtmlContentAllowed(true);// Backwards compatibility getPage().showNotification(notification); @@ -1181,7 +1179,8 @@ public abstract class Root extends AbstractComponentContainer implements * be aware that HTML by default not allowed. */ @Deprecated - public void showNotification(String caption, String description, int type) { + public void showNotification(String caption, String description, + Notification.Type type) { Notification notification = new Notification(caption, description, type); notification.setHtmlContentAllowed(true);// Backwards compatibility getPage().showNotification(notification); @@ -1212,8 +1211,8 @@ public abstract class Root extends AbstractComponentContainer implements * @deprecated As of 7.0, use new Notification(...).show(Page). */ @Deprecated - public void showNotification(String caption, String description, int type, - boolean htmlContentAllowed) { + public void showNotification(String caption, String description, + Notification.Type type, boolean htmlContentAllowed) { getPage() .showNotification( new Notification(caption, description, type, diff --git a/server/src/com/vaadin/ui/Select.java b/server/src/com/vaadin/ui/Select.java index 698350cb30..20345b55e0 100644 --- a/server/src/com/vaadin/ui/Select.java +++ b/server/src/com/vaadin/ui/Select.java @@ -676,15 +676,21 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering, } @Override + @Deprecated public void requestRepaint() { - super.requestRepaint(); + markAsDirty(); + } + + @Override + public void markAsDirty() { + super.markAsDirty(); optionRequest = false; prevfilterstring = filterstring; filterstring = null; } private void optionRepaint() { - super.requestRepaint(); + super.markAsDirty(); } @Override @@ -697,40 +703,6 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering, return filteringMode; } - /** - * Note, one should use more generic setWidth(String) method instead of - * this. This now days actually converts columns to width with em css unit. - * - * Sets the number of columns in the editor. If the number of columns is set - * 0, the actual number of displayed columns is determined implicitly by the - * adapter. - * - * @deprecated - * - * @param columns - * the number of columns to set. - */ - @Deprecated - public void setColumns(int columns) { - if (columns < 0) { - columns = 0; - } - if (this.columns != columns) { - this.columns = columns; - setWidth(columns, Select.UNITS_EM); - requestRepaint(); - } - } - - /** - * @deprecated see setter function - * @return - */ - @Deprecated - public int getColumns() { - return columns; - } - @Override public void addListener(BlurListener listener) { addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener, diff --git a/server/src/com/vaadin/ui/Slider.java b/server/src/com/vaadin/ui/Slider.java index f7672f617c..d4e2db4853 100644 --- a/server/src/com/vaadin/ui/Slider.java +++ b/server/src/com/vaadin/ui/Slider.java @@ -174,7 +174,7 @@ public class Slider extends AbstractField<Double> implements Vaadin6Component { if (getValue() > max) { setValue(max); } - requestRepaint(); + markAsDirty(); } /** @@ -198,7 +198,7 @@ public class Slider extends AbstractField<Double> implements Vaadin6Component { if (getValue() < min) { setValue(min); } - requestRepaint(); + markAsDirty(); } /** @@ -220,7 +220,7 @@ public class Slider extends AbstractField<Double> implements Vaadin6Component { */ public void setOrientation(int orientation) { this.orientation = orientation; - requestRepaint(); + markAsDirty(); } /** @@ -244,7 +244,7 @@ public class Slider extends AbstractField<Double> implements Vaadin6Component { return; } this.resolution = resolution; - requestRepaint(); + markAsDirty(); } /** diff --git a/server/src/com/vaadin/ui/TabSheet.java b/server/src/com/vaadin/ui/TabSheet.java index 5a1aa02845..82faedcc41 100644 --- a/server/src/com/vaadin/ui/TabSheet.java +++ b/server/src/com/vaadin/ui/TabSheet.java @@ -176,7 +176,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, fireSelectedTabChange(); } } - requestRepaint(); + markAsDirty(); } } @@ -301,7 +301,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, fireSelectedTabChange(); } super.addComponent(c); - requestRepaint(); + markAsDirty(); return tab; } } @@ -361,8 +361,9 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, String caption = null; Resource icon = null; if (TabSheet.class.isAssignableFrom(source.getClass())) { - caption = ((TabSheet) source).getTabCaption(c); - icon = ((TabSheet) source).getTabIcon(c); + Tab tab = ((TabSheet) source).getTab(c); + caption = tab.getCaption(); + icon = tab.getIcon(); } source.removeComponent(c); addTab(c, caption, icon); @@ -474,83 +475,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, */ public void hideTabs(boolean tabsHidden) { this.tabsHidden = tabsHidden; - requestRepaint(); - } - - /** - * Gets tab caption. The tab is identified by the tab content component. - * - * @param c - * the component in the tab - * @deprecated Use {@link #getTab(Component)} and {@link Tab#getCaption()} - * instead. - */ - @Deprecated - public String getTabCaption(Component c) { - Tab info = tabs.get(c); - if (info == null) { - return ""; - } else { - return info.getCaption(); - } - } - - /** - * Sets tab caption. The tab is identified by the tab content component. - * - * @param c - * the component in the tab - * @param caption - * the caption to set. - * @deprecated Use {@link #getTab(Component)} and - * {@link Tab#setCaption(String)} instead. - */ - @Deprecated - public void setTabCaption(Component c, String caption) { - Tab info = tabs.get(c); - if (info != null) { - info.setCaption(caption); - requestRepaint(); - } - } - - /** - * Gets the icon for a tab. The tab is identified by the tab content - * component. - * - * @param c - * the component in the tab - * @deprecated Use {@link #getTab(Component)} and {@link Tab#getIcon()} - * instead. - */ - @Deprecated - public Resource getTabIcon(Component c) { - Tab info = tabs.get(c); - if (info == null) { - return null; - } else { - return info.getIcon(); - } - } - - /** - * Sets icon for the given component. The tab is identified by the tab - * content component. - * - * @param c - * the component in the tab - * @param icon - * the icon to set - * @deprecated Use {@link #getTab(Component)} and - * {@link Tab#setIcon(Resource)} instead. - */ - @Deprecated - public void setTabIcon(Component c, Resource icon) { - Tab info = tabs.get(c); - if (info != null) { - info.setIcon(icon); - requestRepaint(); - } + markAsDirty(); } /** @@ -594,7 +519,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, setSelected(c); updateSelection(); fireSelectedTabChange(); - requestRepaint(); + markAsDirty(); } } @@ -612,13 +537,13 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, // "cached" update even though the client knows nothing about the // connector if (selected instanceof ComponentContainer) { - ((ComponentContainer) selected).requestRepaintAll(); + ((ComponentContainer) selected).markAsDirtyRecursive(); } else if (selected instanceof Table) { // Workaround until there's a generic way of telling a component // that there is no client side state to rely on. See #8642 ((Table) selected).refreshRowCache(); } else if (selected != null) { - selected.requestRepaint(); + selected.markAsDirty(); } } @@ -791,7 +716,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, copyTabMetadata(oldTab, newTab); copyTabMetadata(tmp, oldTab); - requestRepaint(); + markAsDirty(); } } @@ -1103,7 +1028,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, @Override public void setCaption(String caption) { this.caption = caption; - requestRepaint(); + markAsDirty(); } @Override @@ -1114,7 +1039,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, @Override public void setIcon(Resource icon) { this.icon = icon; - requestRepaint(); + markAsDirty(); } @Override @@ -1128,7 +1053,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, if (updateSelection()) { fireSelectedTabChange(); } - requestRepaint(); + markAsDirty(); } @Override @@ -1142,7 +1067,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, if (updateSelection()) { fireSelectedTabChange(); } - requestRepaint(); + markAsDirty(); } @Override @@ -1153,7 +1078,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, @Override public void setClosable(boolean closable) { this.closable = closable; - requestRepaint(); + markAsDirty(); } public void close() { @@ -1168,7 +1093,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, @Override public void setDescription(String description) { this.description = description; - requestRepaint(); + markAsDirty(); } @Override @@ -1179,7 +1104,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, @Override public void setComponentError(ErrorMessage componentError) { this.componentError = componentError; - requestRepaint(); + markAsDirty(); } @Override @@ -1195,7 +1120,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, @Override public void setStyleName(String styleName) { this.styleName = styleName; - requestRepaint(); + markAsDirty(); } @Override @@ -1255,7 +1180,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, int oldPosition = getTabPosition(tab); components.remove(oldPosition); components.add(position, tab.getComponent()); - requestRepaint(); + markAsDirty(); } /** @@ -1282,7 +1207,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, @Override public void setTabIndex(int tabIndex) { this.tabIndex = tabIndex; - requestRepaint(); + markAsDirty(); } @Override diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java index 6f7f88f883..8fc3fc2572 100644 --- a/server/src/com/vaadin/ui/Table.java +++ b/server/src/com/vaadin/ui/Table.java @@ -729,7 +729,7 @@ public class Table extends AbstractSelect implements Action.Container, this.columnHeaders.put(it.next(), columnHeaders[i]); } - requestRepaint(); + markAsDirty(); } /** @@ -788,7 +788,7 @@ public class Table extends AbstractSelect implements Action.Container, this.columnIcons.put(it.next(), columnIcons[i]); } - requestRepaint(); + markAsDirty(); } /** @@ -888,7 +888,7 @@ public class Table extends AbstractSelect implements Action.Container, } else { columnWidths.put(propertyId, Integer.valueOf(width)); } - requestRepaint(); + markAsDirty(); } /** @@ -1026,7 +1026,7 @@ public class Table extends AbstractSelect implements Action.Container, } if (this.cacheRate != cacheRate) { this.cacheRate = cacheRate; - requestRepaint(); + markAsDirty(); } } @@ -1158,7 +1158,7 @@ public class Table extends AbstractSelect implements Action.Container, columnIcons.put(propertyId, icon); } - requestRepaint(); + markAsDirty(); } /** @@ -1198,7 +1198,7 @@ public class Table extends AbstractSelect implements Action.Container, columnHeaders.put(propertyId, header); } - requestRepaint(); + markAsDirty(); } /** @@ -1361,7 +1361,7 @@ public class Table extends AbstractSelect implements Action.Container, public void setColumnReorderingAllowed(boolean columnReorderingAllowed) { if (columnReorderingAllowed != this.columnReorderingAllowed) { this.columnReorderingAllowed = columnReorderingAllowed; - requestRepaint(); + markAsDirty(); } } @@ -1507,31 +1507,6 @@ public class Table extends AbstractSelect implements Action.Container, } /** - * Getter for property pageBuffering. - * - * @deprecated functionality is not needed in ajax rendering model - * - * @return the Value of property pageBuffering. - */ - @Deprecated - public boolean isPageBufferingEnabled() { - return true; - } - - /** - * Setter for property pageBuffering. - * - * @deprecated functionality is not needed in ajax rendering model - * - * @param pageBuffering - * the New value of property pageBuffering. - */ - @Deprecated - public void setPageBufferingEnabled(boolean pageBuffering) { - - } - - /** * Getter for property selectable. * * <p> @@ -1557,7 +1532,7 @@ public class Table extends AbstractSelect implements Action.Container, public void setSelectable(boolean selectable) { if (this.selectable != selectable) { this.selectable = selectable; - requestRepaint(); + markAsDirty(); } } @@ -1583,7 +1558,7 @@ public class Table extends AbstractSelect implements Action.Container, } if (columnHeaderMode != this.columnHeaderMode) { this.columnHeaderMode = columnHeaderMode; - requestRepaint(); + markAsDirty(); } } @@ -1652,7 +1627,7 @@ public class Table extends AbstractSelect implements Action.Container, } setRowCacheInvalidated(true); - requestRepaint(); + markAsDirty(); } /** @@ -1661,17 +1636,39 @@ public class Table extends AbstractSelect implements Action.Container, * Note that a {@code Table} does not necessarily repaint its contents when * this method has been called. See {@link #refreshRowCache()} for forcing * an update of the contents. + * + * @deprecated As of 7.0.0, use {@link #markAsDirty()} instead */ + @Deprecated @Override public void requestRepaint() { + markAsDirty(); + } + + /** + * Requests that the Table should be repainted as soon as possible. + * + * Note that a {@code Table} does not necessarily repaint its contents when + * this method has been called. See {@link #refreshRowCache()} for forcing + * an update of the contents. + */ + + @Override + public void markAsDirty() { // Overridden only for javadoc - super.requestRepaint(); + super.markAsDirty(); } + @Deprecated @Override public void requestRepaintAll() { - super.requestRepaintAll(); + markAsDirtyRecursive(); + } + + @Override + public void markAsDirtyRecursive() { + super.markAsDirtyRecursive(); // Avoid sending a partial repaint (#8714) refreshRowCache(); @@ -2230,16 +2227,6 @@ public class Table extends AbstractSelect implements Action.Container, } /** - * Refreshes the current page contents. - * - * @deprecated should not need to be used - */ - @Deprecated - public void refreshCurrentPage() { - - } - - /** * Sets the row header mode. * <p> * The mode can be one of the following ones: @@ -2471,7 +2458,7 @@ public class Table extends AbstractSelect implements Action.Container, if (!isNullSelectionAllowed() && (id == null || id == getNullSelectionItemId())) { // skip empty selection if nullselection is not allowed - requestRepaint(); + markAsDirty(); } else if (id != null && containsId(id)) { newValue.add(id); renderedButNotSelectedItemIds.remove(id); @@ -2498,7 +2485,7 @@ public class Table extends AbstractSelect implements Action.Container, if (!isNullSelectionAllowed() && newValue.isEmpty()) { // empty selection not allowed, keep old value - requestRepaint(); + markAsDirty(); return; } @@ -2837,7 +2824,7 @@ public class Table extends AbstractSelect implements Action.Container, if (refreshContent) { refreshRenderedCells(); // Ensure that client gets a response - requestRepaint(); + markAsDirty(); } } @@ -3786,7 +3773,7 @@ public class Table extends AbstractSelect implements Action.Container, refreshRowCache(); containerChangeToBeRendered = true; } - requestRepaint(); + markAsDirty(); } /** @@ -4470,7 +4457,7 @@ public class Table extends AbstractSelect implements Action.Container, * would support this. * * @return True iff sorting is disabled. - * @deprecated Use {@link #isSortEnabled()} instead + * @deprecated As of 7.0, use {@link #isSortEnabled()} instead */ @Deprecated public boolean isSortDisabled() { @@ -4491,7 +4478,7 @@ public class Table extends AbstractSelect implements Action.Container, * * @param sortDisabled * True iff sorting is disabled. - * @deprecated Use {@link #setSortEnabled(boolean)} instead + * @deprecated As of 7.0, use {@link #setSortEnabled(boolean)} instead */ @Deprecated public void setSortDisabled(boolean sortDisabled) { @@ -4511,7 +4498,7 @@ public class Table extends AbstractSelect implements Action.Container, public void setSortEnabled(boolean sortEnabled) { if (this.sortEnabled != sortEnabled) { this.sortEnabled = sortEnabled; - requestRepaint(); + markAsDirty(); } } @@ -4608,7 +4595,7 @@ public class Table extends AbstractSelect implements Action.Container, // some ancestor still disabled, don't update children return; } else { - requestRepaintAll(); + markAsDirtyRecursive(); } } @@ -4620,7 +4607,7 @@ public class Table extends AbstractSelect implements Action.Container, */ public void setDragMode(TableDragMode newDragMode) { dragMode = newDragMode; - requestRepaint(); + markAsDirty(); } /** @@ -4704,7 +4691,7 @@ public class Table extends AbstractSelect implements Action.Container, */ public void setMultiSelectMode(MultiSelectMode mode) { multiSelectMode = mode; - requestRepaint(); + markAsDirty(); } /** @@ -5012,7 +4999,7 @@ public class Table extends AbstractSelect implements Action.Container, columnFooters.put(propertyId, footer); } - requestRepaint(); + markAsDirty(); } /** @@ -5028,7 +5015,7 @@ public class Table extends AbstractSelect implements Action.Container, public void setFooterVisible(boolean visible) { if (visible != columnFootersVisible) { columnFootersVisible = visible; - requestRepaint(); + markAsDirty(); } } diff --git a/server/src/com/vaadin/ui/TextArea.java b/server/src/com/vaadin/ui/TextArea.java index fed06b561a..0dc9722eb3 100644 --- a/server/src/com/vaadin/ui/TextArea.java +++ b/server/src/com/vaadin/ui/TextArea.java @@ -81,7 +81,7 @@ public class TextArea extends AbstractTextField { } @Override - public TextAreaState getState() { + protected TextAreaState getState() { return (TextAreaState) super.getState(); } @@ -96,7 +96,6 @@ public class TextArea extends AbstractTextField { rows = 0; } getState().setRows(rows); - requestRepaint(); } /** @@ -117,7 +116,6 @@ public class TextArea extends AbstractTextField { */ public void setWordwrap(boolean wordwrap) { getState().setWordwrap(wordwrap); - requestRepaint(); } /** diff --git a/server/src/com/vaadin/ui/Tree.java b/server/src/com/vaadin/ui/Tree.java index dda0a78aff..2d6673a67d 100644 --- a/server/src/com/vaadin/ui/Tree.java +++ b/server/src/com/vaadin/ui/Tree.java @@ -184,7 +184,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, */ public boolean expandItem(Object itemId) { boolean success = expandItem(itemId, true); - requestRepaint(); + markAsDirty(); return success; } @@ -215,7 +215,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, expandedItemId = itemId; if (initialPaint) { - requestRepaint(); + markAsDirty(); } else if (sendChildTree) { requestPartialRepaint(); } @@ -225,13 +225,13 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, } @Override - public void requestRepaint() { - super.requestRepaint(); + public void markAsDirty() { + super.markAsDirty(); partialUpdate = false; } private void requestPartialRepaint() { - super.requestRepaint(); + super.markAsDirty(); partialUpdate = true; } @@ -262,7 +262,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, todo.addAll(getChildren(id)); } } - requestRepaint(); + markAsDirty(); return result; } @@ -282,7 +282,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, // Collapse expanded.remove(itemId); - requestRepaint(); + markAsDirty(); fireCollapseEvent(itemId); return true; @@ -349,7 +349,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, public void setSelectable(boolean selectable) { if (this.selectable != selectable) { this.selectable = selectable; - requestRepaint(); + markAsDirty(); } } @@ -362,7 +362,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, public void setMultiselectMode(MultiSelectMode mode) { if (multiSelectMode != mode && mode != null) { multiSelectMode = mode; - requestRepaint(); + markAsDirty(); } } @@ -478,7 +478,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, if (!isNullSelectionAllowed() && (id == null || id == getNullSelectionItemId())) { // skip empty selection if nullselection is not allowed - requestRepaint(); + markAsDirty(); } else if (id != null && containsId(id)) { s.add(id); } @@ -486,7 +486,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, if (!isNullSelectionAllowed() && s.size() < 1) { // empty selection not allowed, keep old value - requestRepaint(); + markAsDirty(); return; } @@ -796,7 +796,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, final boolean success = ((Container.Hierarchical) items) .setChildrenAllowed(itemId, areChildrenAllowed); if (success) { - requestRepaint(); + markAsDirty(); } return success; } @@ -812,7 +812,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, final boolean success = ((Container.Hierarchical) items).setParent( itemId, newParentId); if (success) { - requestRepaint(); + markAsDirty(); } return success; } @@ -1036,7 +1036,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, if (!actionHandlers.contains(actionHandler)) { actionHandlers.add(actionHandler); - requestRepaint(); + markAsDirty(); } } } @@ -1058,7 +1058,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, actionMapper = null; } - requestRepaint(); + markAsDirty(); } } @@ -1068,7 +1068,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, public void removeAllActionHandlers() { actionHandlers = null; actionMapper = null; - requestRepaint(); + markAsDirty(); } /** @@ -1182,7 +1182,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, public void setItemStyleGenerator(ItemStyleGenerator itemStyleGenerator) { if (this.itemStyleGenerator != itemStyleGenerator) { this.itemStyleGenerator = itemStyleGenerator; - requestRepaint(); + markAsDirty(); } } @@ -1342,7 +1342,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, */ public void setDragMode(TreeDragMode dragMode) { this.dragMode = dragMode; - requestRepaint(); + markAsDirty(); } /** @@ -1601,7 +1601,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, public void setItemDescriptionGenerator(ItemDescriptionGenerator generator) { if (generator != itemDescriptionGenerator) { itemDescriptionGenerator = generator; - requestRepaint(); + markAsDirty(); } } diff --git a/server/src/com/vaadin/ui/TreeTable.java b/server/src/com/vaadin/ui/TreeTable.java index 7548a4840b..05757a6d09 100644 --- a/server/src/com/vaadin/ui/TreeTable.java +++ b/server/src/com/vaadin/ui/TreeTable.java @@ -463,7 +463,7 @@ public class TreeTable extends Table implements Hierarchical { // been processed clearFocusedRowPending = true; } - requestRepaint(); + markAsDirty(); } @Override @@ -561,7 +561,7 @@ public class TreeTable extends Table implements Hierarchical { } if (containerSupportsPartialUpdates && !forceFullRefresh) { - requestRepaint(); + markAsDirty(); } else { // For containers that do not send item set change events, always do // full repaint instead of partial row update. @@ -826,7 +826,7 @@ public class TreeTable extends Table implements Hierarchical { */ public void setAnimationsEnabled(boolean animationsEnabled) { this.animationsEnabled = animationsEnabled; - requestRepaint(); + markAsDirty(); } private static final Logger getLogger() { diff --git a/server/src/com/vaadin/ui/TwinColSelect.java b/server/src/com/vaadin/ui/TwinColSelect.java index 80f4ae49c8..891e695a5f 100644 --- a/server/src/com/vaadin/ui/TwinColSelect.java +++ b/server/src/com/vaadin/ui/TwinColSelect.java @@ -79,7 +79,7 @@ public class TwinColSelect extends AbstractSelect { } if (this.columns != columns) { this.columns = columns; - requestRepaint(); + markAsDirty(); } } @@ -111,7 +111,7 @@ public class TwinColSelect extends AbstractSelect { } if (this.rows != rows) { this.rows = rows; - requestRepaint(); + markAsDirty(); } } @@ -159,7 +159,7 @@ public class TwinColSelect extends AbstractSelect { */ public void setRightColumnCaption(String rightColumnCaption) { this.rightColumnCaption = rightColumnCaption; - requestRepaint(); + markAsDirty(); } /** @@ -179,7 +179,7 @@ public class TwinColSelect extends AbstractSelect { */ public void setLeftColumnCaption(String leftColumnCaption) { this.leftColumnCaption = leftColumnCaption; - requestRepaint(); + markAsDirty(); } /** diff --git a/server/src/com/vaadin/ui/Upload.java b/server/src/com/vaadin/ui/Upload.java index c4f15ebea9..619db07eea 100644 --- a/server/src/com/vaadin/ui/Upload.java +++ b/server/src/com/vaadin/ui/Upload.java @@ -138,7 +138,7 @@ public class Upload extends AbstractComponent implements Component.Focusable, int id = (Integer) variables.get("pollForStart"); if (!isUploading && id == nextid) { notStarted = true; - requestRepaint(); + markAsDirty(); } else { } } @@ -829,7 +829,7 @@ public class Upload extends AbstractComponent implements Component.Focusable, isUploading = false; contentLength = -1; interrupted = false; - requestRepaint(); + markAsDirty(); } public boolean isUploading() { @@ -856,33 +856,6 @@ public class Upload extends AbstractComponent implements Component.Focusable, } /** - * This method is deprecated, use addListener(ProgressListener) instead. - * - * @deprecated Use addListener(ProgressListener) instead. - * @param progressListener - */ - @Deprecated - public void setProgressListener(ProgressListener progressListener) { - addListener(progressListener); - } - - /** - * This method is deprecated. - * - * @deprecated Replaced with addListener/removeListener - * @return listener - * - */ - @Deprecated - public ProgressListener getProgressListener() { - if (progressListeners == null || progressListeners.isEmpty()) { - return null; - } else { - return progressListeners.iterator().next(); - } - } - - /** * ProgressListener receives events to track progress of upload. */ public interface ProgressListener extends Serializable { @@ -928,7 +901,7 @@ public class Upload extends AbstractComponent implements Component.Focusable, */ public void setButtonCaption(String buttonCaption) { this.buttonCaption = buttonCaption; - requestRepaint(); + markAsDirty(); } /** @@ -949,14 +922,14 @@ public class Upload extends AbstractComponent implements Component.Focusable, * fired. */ public void submitUpload() { - requestRepaint(); + markAsDirty(); forceSubmit = true; } @Override - public void requestRepaint() { + public void markAsDirty() { forceSubmit = false; - super.requestRepaint(); + super.markAsDirty(); } /* @@ -1009,7 +982,7 @@ public class Upload extends AbstractComponent implements Component.Focusable, fireUploadSuccess(event.getFileName(), event.getMimeType(), event.getContentLength()); endUpload(); - requestRepaint(); + markAsDirty(); } @Override diff --git a/server/src/com/vaadin/ui/Video.java b/server/src/com/vaadin/ui/Video.java index 95a38c59d5..b54d404da6 100644 --- a/server/src/com/vaadin/ui/Video.java +++ b/server/src/com/vaadin/ui/Video.java @@ -44,7 +44,7 @@ import com.vaadin.terminal.gwt.server.ResourceReference; public class Video extends AbstractMedia { @Override - public VideoState getState() { + protected VideoState getState() { return (VideoState) super.getState(); } @@ -80,7 +80,6 @@ public class Video extends AbstractMedia { */ public void setPoster(Resource poster) { getState().setPoster(ResourceReference.create(poster)); - requestRepaint(); } /** diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java index d1d2c25d8b..d79588cc63 100644 --- a/server/src/com/vaadin/ui/Window.java +++ b/server/src/com/vaadin/ui/Window.java @@ -174,14 +174,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, final int x = positionx.intValue(); // This is information from the client so it is already using the // position. No need to repaint. - setPositionX(x < 0 ? -1 : x, false); + setPositionX(x < 0 ? -1 : x); } final Integer positiony = (Integer) variables.get("positiony"); if (positiony != null) { final int y = positiony.intValue(); // This is information from the client so it is already using the // position. No need to repaint. - setPositionY(y < 0 ? -1 : y, false); + setPositionY(y < 0 ? -1 : y); } if (isClosable()) { @@ -255,26 +255,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @since 4.0.0 */ public void setPositionX(int positionX) { - setPositionX(positionX, true); - } - - /** - * Sets the distance of Window left border in pixels from left border of the - * containing (main window). - * - * @param positionX - * the Distance of Window left border in pixels from left border - * of the containing (main window). or -1 if unspecified. - * @param repaintRequired - * true if the window needs to be repainted, false otherwise - * @since 6.3.4 - */ - private void setPositionX(int positionX, boolean repaintRequired) { getState().setPositionX(positionX); getState().setCentered(false); - if (repaintRequired) { - requestRepaint(); - } } /** @@ -301,27 +283,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @since 4.0.0 */ public void setPositionY(int positionY) { - setPositionY(positionY, true); - } - - /** - * Sets the distance of Window top border in pixels from top border of the - * containing (main window). - * - * @param positionY - * the Distance of Window top border in pixels from top border of - * the containing (main window). or -1 if unspecified - * @param repaintRequired - * true if the window needs to be repainted, false otherwise - * - * @since 6.3.4 - */ - private void setPositionY(int positionY, boolean repaintRequired) { getState().setPositionY(positionY); getState().setCentered(false); - if (repaintRequired) { - requestRepaint(); - } } private static final Method WINDOW_CLOSE_METHOD; @@ -530,7 +493,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, } } bringToFront = Integer.valueOf(maxBringToFront + 1); - requestRepaint(); + markAsDirty(); } /** @@ -543,7 +506,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, public void setModal(boolean modal) { getState().setModal(modal); center(); - requestRepaint(); } /** @@ -561,7 +523,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, */ public void setResizable(boolean resizable) { getState().setResizable(resizable); - requestRepaint(); } /** @@ -595,7 +556,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, */ public void setResizeLazy(boolean resizeLazy) { getState().setResizeLazy(resizeLazy); - requestRepaint(); } /** @@ -609,7 +569,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, */ public void center() { getState().setCentered(true); - requestRepaint(); } /** @@ -674,7 +633,6 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, */ public void setDraggable(boolean draggable) { getState().setDraggable(draggable); - requestRepaint(); } /* @@ -838,7 +796,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, } @Override - public WindowState getState() { + protected WindowState getState() { return (WindowState) super.getState(); } } diff --git a/server/src/com/vaadin/ui/themes/BaseTheme.java b/server/src/com/vaadin/ui/themes/BaseTheme.java index bdb0087d2e..9e95627eec 100644 --- a/server/src/com/vaadin/ui/themes/BaseTheme.java +++ b/server/src/com/vaadin/ui/themes/BaseTheme.java @@ -45,18 +45,6 @@ public class BaseTheme { public static final String BUTTON_LINK = "link"; /** - * Removes extra decorations from the panel. - * - * @deprecated Base theme does not implement this style, but it is defined - * here since it has been a part of the framework before - * multiple themes were available. Use the constant provided by - * the theme you're using instead, e.g. - * {@link Reindeer#PANEL_LIGHT} or {@link Runo#PANEL_LIGHT}. - */ - @Deprecated - public static final String PANEL_LIGHT = "light"; - - /** * Adds the connector lines between a parent node and its child nodes to * indicate the tree hierarchy better. */ diff --git a/server/src/com/vaadin/ui/themes/Reindeer.java b/server/src/com/vaadin/ui/themes/Reindeer.java index 7bc6720465..037f59d7b4 100644 --- a/server/src/com/vaadin/ui/themes/Reindeer.java +++ b/server/src/com/vaadin/ui/themes/Reindeer.java @@ -48,12 +48,6 @@ public class Reindeer extends BaseTheme { */ public static final String LABEL_SMALL = "light"; - /** - * @deprecated Use {@link #LABEL_SMALL} instead. - */ - @Deprecated - public static final String LABEL_LIGHT = "small"; - /*************************************************************************** * * Button styles @@ -68,12 +62,6 @@ public class Reindeer extends BaseTheme { public static final String BUTTON_DEFAULT = "primary"; /** - * @deprecated Use {@link #BUTTON_DEFAULT} instead - */ - @Deprecated - public static final String BUTTON_PRIMARY = BUTTON_DEFAULT; - - /** * Small sized button, use for context specific actions for example */ public static final String BUTTON_SMALL = "small"; @@ -129,12 +117,6 @@ public class Reindeer extends BaseTheme { public static final String TABSHEET_SMALL = "bar"; /** - * @deprecated Use {@link #TABSHEET_SMALL} instead. - */ - @Deprecated - public static final String TABSHEET_BAR = TABSHEET_SMALL; - - /** * Removes borders and background color from the tab sheet. The tabs are * presented with minimal lines indicating the selected tab. */ |