diff options
author | Henri Sara <henri.sara@itmill.com> | 2010-05-31 11:14:51 +0000 |
---|---|---|
committer | Henri Sara <henri.sara@itmill.com> | 2010-05-31 11:14:51 +0000 |
commit | 33a4901c775cf3df4ce92a2ce922e0d527628ae8 (patch) | |
tree | 1f8355cb22dd7daa24fe95e78c098d36bbf9c8c7 /src | |
parent | 1449ab2f4122daff5f0d18205868b1c269cbc311 (diff) | |
parent | 12b497721d9bf44f33c611d07d5327eb815ca708 (diff) | |
download | vaadin-framework-33a4901c775cf3df4ce92a2ce922e0d527628ae8.tar.gz vaadin-framework-33a4901c775cf3df4ce92a2ce922e0d527628ae8.zip |
Merged changes from 6.3 to 6.4
svn changeset:13432/svn branch:6.4
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java | 22 | ||||
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VWindow.java | 2 | ||||
-rw-r--r-- | src/com/vaadin/ui/AbstractField.java | 21 | ||||
-rw-r--r-- | src/com/vaadin/ui/Accordion.java | 11 | ||||
-rw-r--r-- | src/com/vaadin/ui/Select.java | 15 | ||||
-rw-r--r-- | src/com/vaadin/ui/TabSheet.java | 251 | ||||
-rw-r--r-- | src/com/vaadin/ui/Window.java | 47 |
7 files changed, 277 insertions, 92 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java index 32b2323f95..eb8dc85705 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelect.java @@ -200,24 +200,24 @@ public class VFilterSelect extends Composite implements Paintable, Field, topPosition += tb.getOffsetHeight(); setPopupPosition(x, topPosition); - final int first = currentPage * pageLength - + (nullSelectionAllowed && currentPage > 0 ? 0 : 1); - final int last = first + currentSuggestions.size() - 1; - final int matches = totalSuggestions - - (nullSelectionAllowed ? 1 : 0); + int nullOffset = (nullSelectionAllowed && "".equals(lastFilter) ? 1 + : 0); + boolean firstPage = (currentPage == 0); + final int first = currentPage * pageLength + 1 + - (firstPage ? 0 : nullOffset); + final int last = first + currentSuggestions.size() - 1 + - (firstPage && "".equals(lastFilter) ? nullOffset : 0); + final int matches = totalSuggestions - nullOffset; if (last > 0) { // nullsel not counted, as requested by user - DOM.setInnerText(status, (matches == 0 ? 0 : first) - + "-" - + ("".equals(lastFilter) && nullSelectionAllowed - && currentPage == 0 ? last - 1 : last) + "/" - + matches); + DOM.setInnerText(status, (matches == 0 ? 0 : first) + "-" + + last + "/" + matches); } else { DOM.setInnerText(status, ""); } // We don't need to show arrows or statusbar if there is only one // page - if (matches <= pageLength) { + if (totalSuggestions <= pageLength || pageLength == 0) { setPagingEnabled(false); } else { setPagingEnabled(true); diff --git a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java index ecb499fdf8..4cf3f5fc80 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java @@ -459,7 +459,7 @@ public class VWindow extends VOverlay implements Container, ScrollListener { */ int h = contents.getOffsetHeight() + getExtraHeight(); - int w = contents.getOffsetWidth(); + int w = getElement().getOffsetWidth(); client.updateVariable(id, "height", h, false); client.updateVariable(id, "width", w, true); diff --git a/src/com/vaadin/ui/AbstractField.java b/src/com/vaadin/ui/AbstractField.java index 17e82e86e4..f7d1ddd79e 100644 --- a/src/com/vaadin/ui/AbstractField.java +++ b/src/com/vaadin/ui/AbstractField.java @@ -55,6 +55,7 @@ import com.vaadin.terminal.PaintTarget; */ @SuppressWarnings("serial") public abstract class AbstractField extends AbstractComponent implements Field, + Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Action.ShortcutNotifier { /* Private members */ @@ -571,6 +572,12 @@ public abstract class AbstractField extends AbstractComponent implements Field, .isAssignableFrom(dataSource.getClass())) { ((Property.ValueChangeNotifier) dataSource).removeListener(this); } + if (dataSource != null + && Property.ReadOnlyStatusChangeNotifier.class + .isAssignableFrom(dataSource.getClass())) { + ((Property.ReadOnlyStatusChangeNotifier) dataSource) + .removeListener(this); + } // Sets the new data source dataSource = newDataSource; @@ -592,6 +599,10 @@ public abstract class AbstractField extends AbstractComponent implements Field, if (dataSource instanceof Property.ValueChangeNotifier) { ((Property.ValueChangeNotifier) dataSource).addListener(this); } + if (dataSource instanceof Property.ReadOnlyStatusChangeNotifier) { + ((Property.ReadOnlyStatusChangeNotifier) dataSource) + .addListener(this); + } // Copy the validators from the data source if (dataSource instanceof Validatable) { @@ -893,6 +904,16 @@ public abstract class AbstractField extends AbstractComponent implements Field, } /** + * React to read only status changes of the property by requesting a + * repaint. + * + * @see Property.ReadOnlyStatusChangeListener + */ + public void readOnlyStatusChange(Property.ReadOnlyStatusChangeEvent event) { + requestRepaint(); + } + + /** * An <code>Event</code> object specifying the Property whose read-only * status has changed. * diff --git a/src/com/vaadin/ui/Accordion.java b/src/com/vaadin/ui/Accordion.java index 1c0165ed26..1f31009f91 100644 --- a/src/com/vaadin/ui/Accordion.java +++ b/src/com/vaadin/ui/Accordion.java @@ -5,6 +5,17 @@ package com.vaadin.ui; import com.vaadin.terminal.gwt.client.ui.VAccordion; +/** + * An accordion is a component similar to a {@link TabSheet}, but with a + * vertical orientation and the selected component presented between tabs. + * + * Closable tabs are not supported by the accordion. + * + * The {@link Accordion} can be styled with the .v-accordion, .v-accordion-item, + * .v-accordion-item-first and .v-accordion-item-caption styles. + * + * @see TabSheet + */ @SuppressWarnings("serial") @ClientWidget(VAccordion.class) public class Accordion extends TabSheet { diff --git a/src/com/vaadin/ui/Select.java b/src/com/vaadin/ui/Select.java index 4e4ab74215..0f33529714 100644 --- a/src/com/vaadin/ui/Select.java +++ b/src/com/vaadin/ui/Select.java @@ -165,11 +165,14 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering, } List options = getFilteredOptions(); - options = sanitetizeList(options, needNullSelectOption); + boolean nullFilteredOut = filterstring != null + && !"".equals(filterstring) + && filteringMode != FILTERINGMODE_OFF; + options = sanitetizeList(options, needNullSelectOption + && !nullFilteredOut); final boolean paintNullSelection = needNullSelectOption - && (currentPage == 0 && (getFilteringMode() == FILTERINGMODE_OFF - || filterstring == null || filterstring.equals(""))); + && currentPage == 0 && !nullFilteredOut; if (paintNullSelection) { target.startTag("so"); @@ -218,7 +221,7 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering, + (needNullSelectOption ? 1 : 0)); if (filteredOptions != null) { target.addAttribute("totalMatches", filteredOptions.size() - + (needNullSelectOption ? 1 : 0)); + + (needNullSelectOption && !nullFilteredOut ? 1 : 0)); } // Paint variables @@ -258,7 +261,9 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering, */ private List sanitetizeList(List options, boolean needNullSelectOption) { - if (options.size() > pageLength) { + if (pageLength != 0 && options.size() > pageLength) { + // Not all options are visible, find out which ones are on the + // current "page". int first = currentPage * pageLength; int last = first + pageLength; if (needNullSelectOption) { diff --git a/src/com/vaadin/ui/TabSheet.java b/src/com/vaadin/ui/TabSheet.java index a69e89ee17..02af64a5fe 100644 --- a/src/com/vaadin/ui/TabSheet.java +++ b/src/com/vaadin/ui/TabSheet.java @@ -7,6 +7,7 @@ package com.vaadin.ui; import java.io.Serializable; import java.lang.reflect.Method; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -20,9 +21,32 @@ import com.vaadin.terminal.PaintTarget; import com.vaadin.terminal.Resource; import com.vaadin.terminal.gwt.client.ui.VTabsheet; import com.vaadin.terminal.gwt.server.CommunicationManager; +import com.vaadin.ui.themes.Reindeer; +import com.vaadin.ui.themes.Runo; /** - * Tabsheet component. + * TabSheet component. + * + * Tabs are typically identified by the component contained on the tab (see + * {@link ComponentContainer}), and tab metadata (including caption, icon, + * visibility, enabledness, closability etc.) is kept in separate {@link Tab} + * instances. + * + * Tabs added with {@link #addComponent(Component)} get the caption and the icon + * of the component at the time when the component is created, and these are not + * automatically updated after tab creation. + * + * A tab sheet can have multiple tab selection listeners and one tab close + * handler ({@link CloseHandler}), which by default removes the tab from the + * TabSheet. + * + * The {@link TabSheet} can be styled with the .v-tabsheet, .v-tabsheet-tabs and + * .v-tabsheet-content styles. Themes may also have pre-defined variations of + * the tab sheet presentation, such as {@link Reindeer#TABSHEET_BORDERLESS}, + * {@link Runo#TABSHEET_SMALL} and several other styles in {@link Reindeer}. + * + * The current implementation does not load the tabs to the UI before the first + * time they are shown, but this may change in future releases. * * @author IT Mill Ltd. * @version @@ -34,7 +58,9 @@ import com.vaadin.terminal.gwt.server.CommunicationManager; public class TabSheet extends AbstractComponentContainer { /** - * Linked list of component tabs. + * List of component tabs (tab contents). In addition to being on this list, + * there is a {@link Tab} object in tabs for each tab with meta-data about + * the tab. */ private final LinkedList<Component> components = new LinkedList<Component>(); @@ -44,23 +70,34 @@ public class TabSheet extends AbstractComponentContainer { private final HashMap<Component, Tab> tabs = new HashMap<Component, Tab>(); /** - * Selected tab. + * Selected tab content component. */ private Component selected = null; + /** + * Mapper between server-side component instances (tab contents) and keys + * given to the client that identify tabs. + */ private final KeyMapper keyMapper = new KeyMapper(); /** - * Holds the value of property tabsHIdden. + * When true, the tab selection area is not displayed to the user. */ private boolean tabsHidden; + /** + * Tabs that have been shown to the user (have been painted as selected). + */ private HashSet<Component> paintedTabs = new HashSet<Component>(); + /** + * Handler to be called when a tab is closed. + */ private CloseHandler closeHandler; /** - * Constructs a new Tabsheet. Tabsheet is immediate by default. + * Constructs a new Tabsheet. Tabsheet is immediate by default, and the + * default close handler removes the tab being closed. */ public TabSheet() { super(); @@ -75,17 +112,20 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Gets the component container iterator for going trough all the components - * in the container. + * Gets the component container iterator for going through all the + * components (tab contents). * - * @return the Iterator of the components inside the container. + * @return the unmodifiable Iterator of the tab content components */ public Iterator<Component> getComponentIterator() { - return java.util.Collections.unmodifiableList(components).iterator(); + return Collections.unmodifiableList(components).iterator(); } /** - * Removes the component from this container. + * Removes a component and its corresponding tab. + * + * If the tab was selected, the first eligible (visible and enabled) + * remaining tab is selected. * * @param c * the component to be removed. @@ -111,8 +151,10 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Adds a new tab into TabSheet. Components caption and icon are rendered - * into tab. + * Adds a new tab into TabSheet. Component caption and icon are copied to + * the tab metadata at creation time. + * + * @see #addTab(Component) * * @param c * the component to be added. @@ -125,18 +167,32 @@ public class TabSheet extends AbstractComponentContainer { /** * Adds a new tab into TabSheet. * + * The first tab added to a tab sheet is automatically selected and a tab + * selection event is fired. + * + * If the component is already present in the tab sheet, changes its caption + * and icon and returns the corresponding (old) tab, preserving other tab + * metadata. + * * @param c - * the component to be added onto tab. + * the component to be added onto tab - should not be null. * @param caption * the caption to be set for the component and used rendered in * tab bar * @param icon * the icon to be set for the component and used rendered in tab * bar - * @return the created tab + * @return the created {@link Tab} */ public Tab addTab(Component c, String caption, Resource icon) { - if (c != null) { + if (c == null) { + return null; + } else if (tabs.containsKey(c)) { + Tab tab = tabs.get(c); + tab.setCaption(caption); + tab.setIcon(icon); + return tab; + } else { components.addLast(c); Tab tab = new TabSheetTabImpl(caption, icon); @@ -148,30 +204,36 @@ public class TabSheet extends AbstractComponentContainer { super.addComponent(c); requestRepaint(); return tab; - } else { - return null; } } /** - * Adds a new tab into TabSheet. Components caption and icon are rendered - * into tab. + * Adds a new tab into TabSheet. Component caption and icon are copied to + * the tab metadata at creation time. + * + * If the tab sheet already contains the component, its tab is returned. * * @param c - * the component to be added onto tab. - * @return the created tab + * the component to be added onto tab - should not be null. + * @return the created {@link Tab} */ public Tab addTab(Component c) { - if (c != null) { + if (c == null) { + return null; + } else if (tabs.containsKey(c)) { + return tabs.get(c); + } else { return addTab(c, c.getCaption(), c.getIcon()); } - return null; } /** * Moves all components from another container to this container. The * components are removed from the other container. * + * If the source container is a {@link TabSheet}, component captions and + * icons are copied from it. + * * @param source * the container components are removed from. */ @@ -195,8 +257,8 @@ public class TabSheet extends AbstractComponentContainer { /** * Paints the content of this component. * - * @param event - * the Paint Event. + * @param target + * the paint target * @throws PaintException * if the paint operation failed. */ @@ -276,19 +338,19 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Are tabs hidden. + * Are the tab selection parts ("tabs") hidden. * - * @return the Property visibility. + * @return true if the tabs are hidden in the UI */ public boolean areTabsHidden() { return tabsHidden; } /** - * Setter for property tabsHidden. + * Hides or shows the tab selection parts ("tabs"). * * @param tabsHidden - * True if the tabs should be hidden. + * true if the tabs should be hidden */ public void hideTabs(boolean tabsHidden) { this.tabsHidden = tabsHidden; @@ -296,10 +358,10 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Gets the caption for a component. + * Gets tab caption. The tab is identified by the tab content component. * * @param c - * the component. + * the component in the tab * @deprecated Use {@link #getTab(Component)} and {@link Tab#getCaption()} * instead. */ @@ -314,10 +376,10 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Sets tabs captions. + * Sets tab caption. The tab is identified by the tab content component. * * @param c - * the component. + * the component in the tab * @param caption * the caption to set. * @deprecated Use {@link #getTab(Component)} and @@ -333,10 +395,11 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Gets the icon for a component. + * Gets the icon for a tab. The tab is identified by the tab content + * component. * * @param c - * the component. + * the component in the tab * @deprecated Use {@link #getTab(Component)} and {@link Tab#getIcon()} * instead. */ @@ -351,12 +414,11 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Sets icon for the given component. - * - * Normally TabSheet uses icon from component + * Sets icon for the given component. The tab is identified by the tab + * content component. * * @param c - * the component + * the component in the tab * @param icon * the icon to set * @deprecated Use {@link #getTab(Component)} and @@ -372,8 +434,8 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Returns the Tab for the component. The Tab object can be used for setting - * caption,icon, etc for the tab. + * Returns the {@link Tab} (metadata) for a component. The {@link Tab} + * object can be used for setting caption,icon, etc for the tab. * * @param c * the component @@ -384,7 +446,8 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Sets the selected tab. + * Sets the selected tab. The tab is identified by the tab content + * component. * * @param c */ @@ -399,7 +462,9 @@ public class TabSheet extends AbstractComponentContainer { /** * Checks if the current selection is valid, and updates the selection if - * the previously selected component is not visible and enabled. + * the previously selected component is not visible and enabled. The first + * visible and enabled tab is selected if the current selection is empty or + * invalid. * * This method does not fire tab change events, but the caller should do so * if appropriate. @@ -430,6 +495,7 @@ public class TabSheet extends AbstractComponentContainer { // it if (tab.isEnabled() && tab.isVisible()) { selected = component; + break; } else { /* * The current selection is not valid but this tab cannot be @@ -443,20 +509,15 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Gets the selected tab. + * Gets the selected tab content component. * - * @return the selected tab. + * @return the selected tab contents */ public Component getSelectedTab() { return selected; } - /** - * Invoked when the value of a variable has changed. - * - * @see com.vaadin.ui.AbstractComponent#changeVariables(java.lang.Object, - * java.util.Map) - */ + // inherits javadoc @Override public void changeVariables(Object source, Map variables) { if (variables.containsKey("selected")) { @@ -472,7 +533,23 @@ public class TabSheet extends AbstractComponentContainer { } } - /* Documented in superclass */ + /** + * Replaces a component (tab content) with another. This can be used to + * change tab contents or to rearrange tabs. The tab position and some + * metadata are preserved when moving components within the same + * {@link TabSheet}. + * + * If the oldComponent is not present in the tab sheet, the new one is added + * at the end. + * + * If the oldComponent is already in the tab sheet but the newComponent + * isn't, the old tab is replaced with a new one, and the caption and icon + * of the old one are copied to the new tab. + * + * If both old and new components are present, their positions are swapped. + * + * {@inheritDoc} + */ public void replaceComponent(Component oldComponent, Component newComponent) { if (selected == oldComponent) { @@ -574,8 +651,8 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Selected Tab Change event. This event is thrown, when the selected tab in - * the tab sheet is changed. + * Selected tab change event. This event is sent when the selected (shown) + * tab in the tab sheet is changed. * * @author IT Mill Ltd. * @version @@ -605,7 +682,9 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Selected Tab Change Event listener + * Selected tab change event listener. The listener is called whenever + * another tab is selected, including when adding the first tab to a + * tabsheet. * * @author IT Mill Ltd. * @@ -616,16 +695,16 @@ public class TabSheet extends AbstractComponentContainer { public interface SelectedTabChangeListener extends Serializable { /** - * Visible tab in tab sheet has has been changed. + * Selected (shown) tab in tab sheet has has been changed. * * @param event - * the Selected tab change event. + * the selected tab change event. */ public void selectedTabChange(SelectedTabChangeEvent event); } /** - * Adds the selected tab change listener + * Adds a tab selection listener * * @param listener * the Listener to be added. @@ -636,7 +715,7 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Removes the selected tab change listener + * Removes a tab selection listener * * @param listener * the Listener to be removed. @@ -647,7 +726,7 @@ public class TabSheet extends AbstractComponentContainer { } /** - * Emits the options change event. + * Sends an event that the currently selected tab has changed. */ protected void fireSelectedTabChange() { fireEvent(new SelectedTabChangeEvent(this)); @@ -664,18 +743,28 @@ public class TabSheet extends AbstractComponentContainer { } /** - * + * Tab meta-data for a component in a {@link TabSheet}. + * + * The meta-data includes the tab caption, icon, visibility and enabledness, + * closability, description (tooltip) and an optional component error shown + * in the tab. + * + * Tabs are identified by the component contained on them in most cases, and + * the meta-data can be obtained with {@link TabSheet#getTab(Component)}. */ public interface Tab extends Serializable { /** - * Returns the visible status for the tab. + * Returns the visible status for the tab. An invisible tab is not shown + * in the tab bar and cannot be selected. * * @return true for visible, false for hidden */ public boolean isVisible(); /** - * Sets the visible status for the tab. + * Sets the visible status for the tab. An invisible tab is not shown in + * the tab bar and cannot be selected, selection is changed + * automatically when there is an attempt to select an invisible tab. * * @param visible * true for visible, false for hidden @@ -705,14 +794,16 @@ public class TabSheet extends AbstractComponentContainer { public void setClosable(boolean closable); /** - * Returns the enabled status for the tab. + * Returns the enabled status for the tab. A disabled tab is shown as + * such in the tab bar and cannot be selected. * * @return true for enabled, false for disabled */ public boolean isEnabled(); /** - * Sets the enabled status for the tab. + * Sets the enabled status for the tab. A disabled tab is shown as such + * in the tab bar and cannot be selected. * * @param enabled * true for enabled, false for disabled @@ -729,13 +820,11 @@ public class TabSheet extends AbstractComponentContainer { /** * Gets the caption for the tab. - * */ public String getCaption(); /** * Gets the icon for the tab. - * */ public Resource getIcon(); @@ -749,29 +838,49 @@ public class TabSheet extends AbstractComponentContainer { /** * Gets the description for the tab. The description can be used to - * briefly describe the state of the tab to the user. + * briefly describe the state of the tab to the user, and is typically + * shown as a tooltip when hovering over the tab. * * @return the description for the tab */ public String getDescription(); /** - * Sets the description for the tab. + * Sets the description for the tab. The description can be used to + * briefly describe the state of the tab to the user, and is typically + * shown as a tooltip when hovering over the tab. * * @param description * the new description string for the tab. */ public void setDescription(String description); + /** + * Sets an error indicator to be shown in the tab. This can be used e.g. + * to communicate to the user that there is a problem in the contents of + * the tab. + * + * @see AbstractComponent#setComponentError(ErrorMessage) + * + * @param componentError + * error message or null for none + */ public void setComponentError(ErrorMessage componentError); + /** + * Gets the curent error message shown for the tab. + * + * @see AbstractComponent#setComponentError(ErrorMessage) + * + * @param error + * message or null if none + */ public ErrorMessage getComponentError(); } /** - * TabSheet's implementation of Tab - * + * TabSheet's implementation of {@link Tab} - tab metadata. */ public class TabSheetTabImpl implements Tab { diff --git a/src/com/vaadin/ui/Window.java b/src/com/vaadin/ui/Window.java index 5eb66261e6..266cafa484 100644 --- a/src/com/vaadin/ui/Window.java +++ b/src/com/vaadin/ui/Window.java @@ -995,12 +995,16 @@ public class Window extends Panel implements URIHandler, ParameterHandler { final Integer positionx = (Integer) variables.get("positionx"); if (positionx != null) { final int x = positionx.intValue(); - setPositionX(x < 0 ? -1 : x); + // This is information from the client so it is already using the + // position. No need to repaint. + setPositionX(x < 0 ? -1 : x, false); } final Integer positiony = (Integer) variables.get("positiony"); if (positiony != null) { final int y = positiony.intValue(); - setPositionY(y < 0 ? -1 : y); + // This is information from the client so it is already using the + // position. No need to repaint. + setPositionY(y < 0 ? -1 : y, false); } if (isClosable()) { @@ -1069,9 +1073,26 @@ public class Window extends Panel implements URIHandler, ParameterHandler { * @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) { this.positionX = positionX; centerRequested = false; - requestRepaint(); + if (repaintRequired) { + requestRepaint(); + } } /** @@ -1098,9 +1119,27 @@ public class Window extends Panel implements URIHandler, ParameterHandler { * @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) { this.positionY = positionY; centerRequested = false; - requestRepaint(); + if (repaintRequired) { + requestRepaint(); + } } private static final Method WINDOW_CLOSE_METHOD; |