@@ -120,8 +120,8 @@ public class BeanFieldGroup<T> extends FieldGroup { | |||
super.configureField(field); | |||
// Add Bean validators if there are annotations | |||
if (isBeanValidationImplementationAvailable()) { | |||
BeanValidator validator = new BeanValidator( | |||
beanType, getPropertyId(field).toString()); | |||
BeanValidator validator = new BeanValidator(beanType, | |||
getPropertyId(field).toString()); | |||
field.addValidator(validator); | |||
if (field.getLocale() != null) { | |||
validator.setLocale(field.getLocale()); |
@@ -29,7 +29,8 @@ public class DoubleRangeValidator extends RangeValidator<Double> { | |||
* @param maxValue | |||
* The maximum value to accept or null for no limit | |||
*/ | |||
public DoubleRangeValidator(String errorMessage, Double minValue, Double maxValue) { | |||
public DoubleRangeValidator(String errorMessage, Double minValue, | |||
Double maxValue) { | |||
super(errorMessage, Double.class, minValue, maxValue); | |||
} | |||
@@ -62,8 +62,12 @@ public class RegexpValidator extends AbstractStringValidator { | |||
this.complete = complete; | |||
} | |||
/* (non-Javadoc) | |||
* @see com.vaadin.data.validator.AbstractValidator#isValidValue(java.lang.Object) | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see | |||
* com.vaadin.data.validator.AbstractValidator#isValidValue(java.lang.Object | |||
* ) | |||
*/ | |||
@Override | |||
protected boolean isValidValue(String value) { |
@@ -2,16 +2,19 @@ package com.vaadin.external.json; | |||
/** | |||
* The JSONException is thrown by the JSON.org classes when things are amiss. | |||
* | |||
* @author JSON.org | |||
* @version 2010-12-24 | |||
*/ | |||
public class JSONException extends Exception { | |||
private static final long serialVersionUID = 0; | |||
private Throwable cause; | |||
private static final long serialVersionUID = 0; | |||
private Throwable cause; | |||
/** | |||
* Constructs a JSONException with an explanatory message. | |||
* @param message Detail about the reason for the exception. | |||
* | |||
* @param message | |||
* Detail about the reason for the exception. | |||
*/ | |||
public JSONException(String message) { | |||
super(message); |
@@ -1,58 +1,62 @@ | |||
package com.vaadin.external.json; | |||
/* | |||
Copyright (c) 2006 JSON.org | |||
Copyright (c) 2006 JSON.org | |||
Permission is hereby granted, free of charge, to any person obtaining a copy | |||
of this software and associated documentation files (the "Software"), to deal | |||
in the Software without restriction, including without limitation the rights | |||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
copies of the Software, and to permit persons to whom the Software is | |||
furnished to do so, subject to the following conditions: | |||
Permission is hereby granted, free of charge, to any person obtaining a copy | |||
of this software and associated documentation files (the "Software"), to deal | |||
in the Software without restriction, including without limitation the rights | |||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
copies of the Software, and to permit persons to whom the Software is | |||
furnished to do so, subject to the following conditions: | |||
The above copyright notice and this permission notice shall be included in all | |||
copies or substantial portions of the Software. | |||
The above copyright notice and this permission notice shall be included in all | |||
copies or substantial portions of the Software. | |||
The Software shall be used for Good, not Evil. | |||
The Software shall be used for Good, not Evil. | |||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
SOFTWARE. | |||
*/ | |||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
SOFTWARE. | |||
*/ | |||
import java.io.StringWriter; | |||
/** | |||
* JSONStringer provides a quick and convenient way of producing JSON text. | |||
* The texts produced strictly conform to JSON syntax rules. No whitespace is | |||
* added, so the results are ready for transmission or storage. Each instance of | |||
* JSONStringer provides a quick and convenient way of producing JSON text. The | |||
* texts produced strictly conform to JSON syntax rules. No whitespace is added, | |||
* so the results are ready for transmission or storage. Each instance of | |||
* JSONStringer can produce one JSON text. | |||
* <p> | |||
* A JSONStringer instance provides a <code>value</code> method for appending | |||
* values to the | |||
* text, and a <code>key</code> | |||
* method for adding keys before values in objects. There are <code>array</code> | |||
* and <code>endArray</code> methods that make and bound array values, and | |||
* <code>object</code> and <code>endObject</code> methods which make and bound | |||
* object values. All of these methods return the JSONWriter instance, | |||
* permitting cascade style. For example, <pre> | |||
* myString = new JSONStringer() | |||
* .object() | |||
* .key("JSON") | |||
* .value("Hello, World!") | |||
* .endObject() | |||
* .toString();</pre> which produces the string <pre> | |||
* {"JSON":"Hello, World!"}</pre> | |||
* values to the text, and a <code>key</code> method for adding keys before | |||
* values in objects. There are <code>array</code> and <code>endArray</code> | |||
* methods that make and bound array values, and <code>object</code> and | |||
* <code>endObject</code> methods which make and bound object values. All of | |||
* these methods return the JSONWriter instance, permitting cascade style. For | |||
* example, | |||
* | |||
* <pre> | |||
* myString = new JSONStringer().object().key("JSON").value("Hello, World!") | |||
* .endObject().toString(); | |||
* </pre> | |||
* | |||
* which produces the string | |||
* | |||
* <pre> | |||
* {"JSON":"Hello, World!"} | |||
* </pre> | |||
* <p> | |||
* The first method called must be <code>array</code> or <code>object</code>. | |||
* There are no methods for adding commas or colons. JSONStringer adds them for | |||
* you. Objects and arrays can be nested up to 20 levels deep. | |||
* <p> | |||
* This can sometimes be easier than using a JSONObject to build a string. | |||
* | |||
* @author JSON.org | |||
* @version 2008-09-18 | |||
*/ | |||
@@ -70,6 +74,7 @@ public class JSONStringer extends JSONWriter { | |||
* problem in the construction of the JSON text (such as the calls to | |||
* <code>array</code> were not properly balanced with calls to | |||
* <code>endArray</code>). | |||
* | |||
* @return The JSON text. | |||
*/ | |||
public String toString() { |
@@ -64,11 +64,11 @@ public class BrowserInfo { | |||
browserDetails.setIEMode(documentMode); | |||
} | |||
} | |||
if (browserDetails.isChrome()) { | |||
touchDevice = detectChromeTouchDevice(); | |||
touchDevice = detectChromeTouchDevice(); | |||
} else { | |||
touchDevice = detectTouchDevice(); | |||
touchDevice = detectTouchDevice(); | |||
} | |||
} | |||
@@ -76,7 +76,7 @@ public class BrowserInfo { | |||
/*-{ | |||
try { document.createEvent("TouchEvent");return true;} catch(e){return false;}; | |||
}-*/; | |||
private native boolean detectChromeTouchDevice() | |||
/*-{ | |||
return ("ontouchstart" in window); |
@@ -96,8 +96,8 @@ public class ComponentLocator { | |||
// If we found a Paintable then we use that as reference. We should | |||
// find the Paintable for all but very special cases (like | |||
// overlays). | |||
w = ((ComponentConnector) ConnectorMap.get(client).getConnector(pid)) | |||
.getWidget(); | |||
w = ((ComponentConnector) ConnectorMap.get(client) | |||
.getConnector(pid)).getWidget(); | |||
/* | |||
* Still if the Paintable contains a widget that implements | |||
@@ -376,8 +376,8 @@ public class ComponentLocator { | |||
return ""; | |||
} else if (w instanceof VWindow) { | |||
VWindow win = (VWindow) w; | |||
ArrayList<VWindow> subWindowList = client.getView() | |||
.getWidget().getSubWindowList(); | |||
ArrayList<VWindow> subWindowList = client.getView().getWidget() | |||
.getSubWindowList(); | |||
int indexOfSubWindow = subWindowList.indexOf(win); | |||
return PARENTCHILD_SEPARATOR + "VWindow[" + indexOfSubWindow + "]"; | |||
} else if (w instanceof RootPanel) { | |||
@@ -440,8 +440,8 @@ public class ComponentLocator { | |||
w = client.getView().getWidget(); | |||
} else if (w == null) { | |||
// Must be static pid (PID_S*) | |||
w = ((ComponentConnector) ConnectorMap.get(client).getConnector( | |||
part)).getWidget(); | |||
w = ((ComponentConnector) ConnectorMap.get(client) | |||
.getConnector(part)).getWidget(); | |||
} else if (part.startsWith("domChild[")) { | |||
// The target widget has been found and the rest identifies the | |||
// element | |||
@@ -522,8 +522,8 @@ public class ComponentLocator { | |||
* compatibility | |||
*/ | |||
if (widgetClassName.equals("VWindow")) { | |||
iterator = client.getView().getWidget() | |||
.getSubWindowList().iterator(); | |||
iterator = client.getView().getWidget().getSubWindowList() | |||
.iterator(); | |||
} else if (widgetClassName.equals("VContextMenu")) { | |||
return client.getContextMenu(); | |||
} else { |
@@ -40,8 +40,8 @@ import com.google.gwt.event.shared.HandlerRegistration; | |||
*/ | |||
public class EventHelper { | |||
public static HandlerRegistration updateFocusHandler(ComponentConnector paintable, | |||
ApplicationConnection client, | |||
public static HandlerRegistration updateFocusHandler( | |||
ComponentConnector paintable, ApplicationConnection client, | |||
HandlerRegistration handlerRegistration) { | |||
if (client.hasEventListeners(paintable, FOCUS)) { | |||
if (handlerRegistration == null) { | |||
@@ -57,8 +57,8 @@ public class EventHelper { | |||
return null; | |||
} | |||
public static HandlerRegistration updateBlurHandler(ComponentConnector paintable, | |||
ApplicationConnection client, | |||
public static HandlerRegistration updateBlurHandler( | |||
ComponentConnector paintable, ApplicationConnection client, | |||
HandlerRegistration handlerRegistration) { | |||
if (client.hasEventListeners(paintable, BLUR)) { | |||
if (handlerRegistration == null) { |
@@ -97,8 +97,7 @@ public class Util { | |||
List<ApplicationConnection> runningApplications = ApplicationConfiguration | |||
.getRunningApplications(); | |||
for (ApplicationConnection applicationConnection : runningApplications) { | |||
ConnectorMap paintableMap = applicationConnection | |||
.getConnectorMap(); | |||
ConnectorMap paintableMap = applicationConnection.getConnectorMap(); | |||
ComponentConnector paintable = paintableMap.getConnector(widget); | |||
if (paintable == null) { | |||
continue; | |||
@@ -698,8 +697,8 @@ public class Util { | |||
* @param element | |||
* the element to start from | |||
*/ | |||
public static ComponentConnector findPaintable(ApplicationConnection client, | |||
Element element) { | |||
public static ComponentConnector findPaintable( | |||
ApplicationConnection client, Element element) { | |||
Widget widget = Util.findWidget(element, null); | |||
ConnectorMap vPaintableMap = ConnectorMap.get(client); | |||
while (widget != null && !vPaintableMap.isConnector(widget)) { | |||
@@ -834,8 +833,9 @@ public class Util { | |||
// TODO paintables inside lists/maps get rendered as | |||
// components in the debug console | |||
String formattedValue = value instanceof Connector ? c | |||
.getConnectorMap().getConnectorId((Connector) value) | |||
: String.valueOf(value); | |||
.getConnectorMap() | |||
.getConnectorId((Connector) value) : String | |||
.valueOf(value); | |||
formattedParams = parameters[0] + " : " + formattedValue; | |||
} | |||
if (null == formattedParams) { |
@@ -8,8 +8,8 @@ import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.HTML; | |||
import com.vaadin.terminal.gwt.client.ui.Icon; | |||
import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ui.Icon; | |||
import com.vaadin.terminal.gwt.client.ui.TabsheetBaseConnector; | |||
public class VCaption extends HTML { | |||
@@ -78,7 +78,8 @@ public class VCaption extends HTML { | |||
owner = component; | |||
if (client != null && owner != null) { | |||
setOwnerPid(getElement(), ConnectorMap.get(client).getConnectorId(owner)); | |||
setOwnerPid(getElement(), | |||
ConnectorMap.get(client).getConnectorId(owner)); | |||
} | |||
setStyleName(CLASSNAME); |
@@ -90,14 +90,15 @@ public class VDebugConsole extends VOverlay implements Console { | |||
for (ApplicationConnection a : ApplicationConfiguration | |||
.getRunningApplications()) { | |||
ComponentConnector paintable = Util.getPaintableForElement(a, | |||
a.getView().getWidget(), eventTarget); | |||
ComponentConnector paintable = Util.getPaintableForElement( | |||
a, a.getView().getWidget(), eventTarget); | |||
if (paintable == null) { | |||
paintable = Util.getPaintableForElement(a, | |||
RootPanel.get(), eventTarget); | |||
} | |||
if (paintable != null) { | |||
String pid = ConnectorMap.get(a).getConnectorId(paintable); | |||
String pid = ConnectorMap.get(a).getConnectorId( | |||
paintable); | |||
VUIDLBrowser.highlight(paintable); | |||
label.setText("Currently focused :" | |||
+ paintable.getClass() + " ID:" + pid); | |||
@@ -119,8 +120,8 @@ public class VDebugConsole extends VOverlay implements Console { | |||
.getClientY()); | |||
for (ApplicationConnection a : ApplicationConfiguration | |||
.getRunningApplications()) { | |||
ComponentConnector paintable = Util.getPaintableForElement(a, | |||
a.getView().getWidget(), eventTarget); | |||
ComponentConnector paintable = Util.getPaintableForElement( | |||
a, a.getView().getWidget(), eventTarget); | |||
if (paintable == null) { | |||
paintable = Util.getPaintableForElement(a, | |||
RootPanel.get(), eventTarget); | |||
@@ -521,7 +522,8 @@ public class VDebugConsole extends VOverlay implements Console { | |||
} | |||
private void printClientSideDetectedIssues( | |||
Set<ComponentConnector> zeroHeightComponents, ApplicationConnection ac) { | |||
Set<ComponentConnector> zeroHeightComponents, | |||
ApplicationConnection ac) { | |||
for (final ComponentConnector paintable : zeroHeightComponents) { | |||
final Widget layout = paintable.getParent().getWidget(); | |||
@@ -566,8 +568,7 @@ public class VDebugConsole extends VOverlay implements Console { | |||
emphasisInUi.addClickHandler(new ClickHandler() { | |||
public void onClick(ClickEvent event) { | |||
if (paintable != null) { | |||
Element element2 = paintable.getWidget() | |||
.getElement(); | |||
Element element2 = paintable.getWidget().getElement(); | |||
Widget.setStyleName(element2, "invalidlayout", | |||
emphasisInUi.getValue()); | |||
} |
@@ -207,7 +207,8 @@ public class VTooltip extends VOverlay { | |||
} | |||
public void handleTooltipEvent(Event event, ComponentConnector owner, Object key) { | |||
public void handleTooltipEvent(Event event, ComponentConnector owner, | |||
Object key) { | |||
final int type = DOM.eventGetType(event); | |||
if ((VTooltip.TOOLTIP_EVENTS & type) == type) { | |||
if (type == Event.ONMOUSEOVER) { |
@@ -42,8 +42,7 @@ public class JsonDecoder { | |||
* mapper between connector ID and {@link Connector} objects | |||
* @return converted value (does not contain JSON types) | |||
*/ | |||
public static Object convertValue(JSONArray jsonArray, | |||
ConnectorMap idMapper) { | |||
public static Object convertValue(JSONArray jsonArray, ConnectorMap idMapper) { | |||
String type = ((JSONString) jsonArray.get(0)).stringValue(); | |||
return convertValue(type, jsonArray.get(1), idMapper); | |||
} |
@@ -22,8 +22,8 @@ public interface ServerRpc extends Serializable { | |||
/** | |||
* Initialization support for client to server RPC interfaces. | |||
* | |||
* This is in a separate interface instead of {@link ServerRpc} | |||
* because otherwise also server side proxies would have to implement the | |||
* This is in a separate interface instead of {@link ServerRpc} because | |||
* otherwise also server side proxies would have to implement the | |||
* initialization method. | |||
* | |||
* @since 7.0 |
@@ -15,14 +15,14 @@ import com.google.gwt.event.shared.HandlerRegistration; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.DirectionalManagedLayout; | |||
import com.vaadin.terminal.gwt.client.EventId; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ui.VAbsoluteLayout.AbsoluteWrapper; | |||
public class AbsoluteLayoutConnector extends AbstractComponentContainerConnector | |||
implements DirectionalManagedLayout { | |||
public class AbsoluteLayoutConnector extends | |||
AbstractComponentContainerConnector implements DirectionalManagedLayout { | |||
private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler( | |||
this, EventId.LAYOUT_CLICK) { | |||
@@ -73,8 +73,8 @@ public class AbsoluteLayoutConnector extends AbstractComponentContainerConnector | |||
} | |||
public void updateCaption(ComponentConnector component, UIDL uidl) { | |||
AbsoluteWrapper parent2 = (AbsoluteWrapper) (component | |||
.getWidget()).getParent(); | |||
AbsoluteWrapper parent2 = (AbsoluteWrapper) (component.getWidget()) | |||
.getParent(); | |||
parent2.updateCaption(uidl); | |||
} | |||
@@ -9,9 +9,9 @@ import java.util.Collection; | |||
import com.google.gwt.user.client.ui.HasOneWidget; | |||
import com.google.gwt.user.client.ui.HasWidgets; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ComponentContainerConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
public abstract class AbstractComponentContainerConnector extends | |||
AbstractComponentConnector implements ComponentContainerConnector { |
@@ -36,8 +36,7 @@ public class AbstractDateFieldConnector extends AbstractComponentConnector { | |||
getWidget().dts.setLocale(locale); | |||
getWidget().currentLocale = locale; | |||
} catch (final LocaleNotLoadedException e) { | |||
getWidget().currentLocale = getWidget().dts | |||
.getLocale(); | |||
getWidget().currentLocale = getWidget().dts.getLocale(); | |||
VConsole.error("Tried to use an unloaded locale \"" + locale | |||
+ "\". Using default locale (" | |||
+ getWidget().currentLocale + ")."); | |||
@@ -91,8 +90,8 @@ public class AbstractDateFieldConnector extends AbstractComponentConnector { | |||
// Construct new date for this datefield (only if not null) | |||
if (year > -1) { | |||
getWidget().setCurrentDate( | |||
new Date((long) getWidget().getTime(year, | |||
month, day, hour, min, sec, 0))); | |||
new Date((long) getWidget().getTime(year, month, day, hour, | |||
min, sec, 0))); | |||
} else { | |||
getWidget().setCurrentDate(null); | |||
} |
@@ -18,8 +18,8 @@ import com.vaadin.terminal.gwt.client.LayoutManager; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.VCaption; | |||
import com.vaadin.terminal.gwt.client.ValueMap; | |||
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot; | |||
import com.vaadin.terminal.gwt.client.ui.layout.ComponentConnectorLayoutSlot; | |||
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot; | |||
public abstract class AbstractOrderedLayoutConnector extends | |||
AbstractComponentContainerConnector implements DirectionalManagedLayout { |
@@ -8,8 +8,8 @@ import java.util.Iterator; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ui.VAccordion.StackItem; | |||
public class AccordionConnector extends TabsheetBaseConnector implements | |||
@@ -28,28 +28,25 @@ public class AccordionConnector extends TabsheetBaseConnector implements | |||
getWidget().selectedUIDLItemIndex); | |||
UIDL selectedTabUIDL = getWidget().lazyUpdateMap | |||
.remove(selectedItem); | |||
getWidget().open( | |||
getWidget().selectedUIDLItemIndex); | |||
getWidget().open(getWidget().selectedUIDLItemIndex); | |||
selectedItem.setContent(selectedTabUIDL); | |||
} else if (isRealUpdate(uidl) | |||
&& getWidget().openTab != null) { | |||
} else if (isRealUpdate(uidl) && getWidget().openTab != null) { | |||
getWidget().close(getWidget().openTab); | |||
} | |||
getWidget().iLayout(); | |||
// finally render possible hidden tabs | |||
if (getWidget().lazyUpdateMap.size() > 0) { | |||
for (Iterator iterator = getWidget().lazyUpdateMap | |||
.keySet().iterator(); iterator.hasNext();) { | |||
for (Iterator iterator = getWidget().lazyUpdateMap.keySet() | |||
.iterator(); iterator.hasNext();) { | |||
StackItem item = (StackItem) iterator.next(); | |||
item.setContent(getWidget().lazyUpdateMap.get(item)); | |||
} | |||
getWidget().lazyUpdateMap.clear(); | |||
} | |||
getWidget().renderInformation | |||
.updateSize(getWidget().getElement()); | |||
getWidget().renderInformation.updateSize(getWidget().getElement()); | |||
} | |||
@Override |
@@ -59,12 +59,10 @@ public class ButtonConnector extends AbstractComponentConnector { | |||
return; | |||
} | |||
getWidget().focusHandlerRegistration = EventHelper | |||
.updateFocusHandler(this, client, | |||
getWidget().focusHandlerRegistration); | |||
getWidget().blurHandlerRegistration = EventHelper | |||
.updateBlurHandler(this, client, | |||
getWidget().blurHandlerRegistration); | |||
getWidget().focusHandlerRegistration = EventHelper.updateFocusHandler( | |||
this, client, getWidget().focusHandlerRegistration); | |||
getWidget().blurHandlerRegistration = EventHelper.updateBlurHandler( | |||
this, client, getWidget().blurHandlerRegistration); | |||
// Save details | |||
getWidget().client = client; | |||
@@ -78,40 +76,33 @@ public class ButtonConnector extends AbstractComponentConnector { | |||
// handle error | |||
if (uidl.hasAttribute("error")) { | |||
if (getWidget().errorIndicatorElement == null) { | |||
getWidget().errorIndicatorElement = DOM | |||
.createSpan(); | |||
getWidget().errorIndicatorElement = DOM.createSpan(); | |||
getWidget().errorIndicatorElement | |||
.setClassName("v-errorindicator"); | |||
} | |||
getWidget().wrapper.insertBefore( | |||
getWidget().errorIndicatorElement, | |||
getWidget().wrapper.insertBefore(getWidget().errorIndicatorElement, | |||
getWidget().captionElement); | |||
} else if (getWidget().errorIndicatorElement != null) { | |||
getWidget().wrapper | |||
.removeChild(getWidget().errorIndicatorElement); | |||
getWidget().wrapper.removeChild(getWidget().errorIndicatorElement); | |||
getWidget().errorIndicatorElement = null; | |||
} | |||
if (uidl.hasAttribute(ATTRIBUTE_ICON)) { | |||
if (getWidget().icon == null) { | |||
getWidget().icon = new Icon(client); | |||
getWidget().wrapper.insertBefore( | |||
getWidget().icon.getElement(), | |||
getWidget().wrapper.insertBefore(getWidget().icon.getElement(), | |||
getWidget().captionElement); | |||
} | |||
getWidget().icon.setUri(uidl | |||
.getStringAttribute(ATTRIBUTE_ICON)); | |||
getWidget().icon.setUri(uidl.getStringAttribute(ATTRIBUTE_ICON)); | |||
} else { | |||
if (getWidget().icon != null) { | |||
getWidget().wrapper | |||
.removeChild(getWidget().icon.getElement()); | |||
getWidget().wrapper.removeChild(getWidget().icon.getElement()); | |||
getWidget().icon = null; | |||
} | |||
} | |||
getWidget().clickShortcut = getState() | |||
.getClickShortcutKeyCode(); | |||
getWidget().clickShortcut = getState().getClickShortcutKeyCode(); | |||
} | |||
@Override |
@@ -31,34 +31,27 @@ public class CheckBoxConnector extends AbstractComponentConnector { | |||
return; | |||
} | |||
getWidget().focusHandlerRegistration = EventHelper | |||
.updateFocusHandler(this, client, | |||
getWidget().focusHandlerRegistration); | |||
getWidget().blurHandlerRegistration = EventHelper | |||
.updateBlurHandler(this, client, | |||
getWidget().blurHandlerRegistration); | |||
getWidget().focusHandlerRegistration = EventHelper.updateFocusHandler( | |||
this, client, getWidget().focusHandlerRegistration); | |||
getWidget().blurHandlerRegistration = EventHelper.updateBlurHandler( | |||
this, client, getWidget().blurHandlerRegistration); | |||
if (uidl.hasAttribute("error")) { | |||
if (getWidget().errorIndicatorElement == null) { | |||
getWidget().errorIndicatorElement = DOM | |||
.createSpan(); | |||
getWidget().errorIndicatorElement | |||
.setInnerHTML(" "); | |||
DOM.setElementProperty( | |||
getWidget().errorIndicatorElement, | |||
getWidget().errorIndicatorElement = DOM.createSpan(); | |||
getWidget().errorIndicatorElement.setInnerHTML(" "); | |||
DOM.setElementProperty(getWidget().errorIndicatorElement, | |||
"className", "v-errorindicator"); | |||
DOM.appendChild(getWidget().getElement(), | |||
getWidget().errorIndicatorElement); | |||
DOM.sinkEvents(getWidget().errorIndicatorElement, | |||
VTooltip.TOOLTIP_EVENTS | Event.ONCLICK); | |||
} else { | |||
DOM.setStyleAttribute( | |||
getWidget().errorIndicatorElement, | |||
DOM.setStyleAttribute(getWidget().errorIndicatorElement, | |||
"display", ""); | |||
} | |||
} else if (getWidget().errorIndicatorElement != null) { | |||
DOM.setStyleAttribute( | |||
getWidget().errorIndicatorElement, "display", | |||
DOM.setStyleAttribute(getWidget().errorIndicatorElement, "display", | |||
"none"); | |||
} | |||
@@ -71,12 +64,10 @@ public class CheckBoxConnector extends AbstractComponentConnector { | |||
getWidget().icon = new Icon(client); | |||
DOM.insertChild(getWidget().getElement(), | |||
getWidget().icon.getElement(), 1); | |||
getWidget().icon | |||
.sinkEvents(VTooltip.TOOLTIP_EVENTS); | |||
getWidget().icon.sinkEvents(VTooltip.TOOLTIP_EVENTS); | |||
getWidget().icon.sinkEvents(Event.ONCLICK); | |||
} | |||
getWidget().icon.setUri(uidl | |||
.getStringAttribute(ATTRIBUTE_ICON)); | |||
getWidget().icon.setUri(uidl.getStringAttribute(ATTRIBUTE_ICON)); | |||
} else if (getWidget().icon != null) { | |||
// detach icon | |||
DOM.removeChild(getWidget().getElement(), | |||
@@ -86,9 +77,8 @@ public class CheckBoxConnector extends AbstractComponentConnector { | |||
// Set text | |||
getWidget().setText(getState().getCaption()); | |||
getWidget() | |||
.setValue( | |||
uidl.getBooleanVariable(getWidget().VARIABLE_STATE)); | |||
getWidget().setValue( | |||
uidl.getBooleanVariable(getWidget().VARIABLE_STATE)); | |||
getWidget().immediate = getState().isImmediate(); | |||
} | |||
@@ -18,9 +18,9 @@ import com.google.gwt.event.shared.EventHandler; | |||
import com.google.gwt.event.shared.HandlerRegistration; | |||
import com.google.gwt.user.client.Element; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.MouseEventDetails; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.MouseEventDetails; | |||
public abstract class ClickEventHandler implements DoubleClickHandler, | |||
ContextMenuHandler, MouseUpHandler { | |||
@@ -82,8 +82,8 @@ public abstract class ClickEventHandler implements DoubleClickHandler, | |||
protected void fireClick(NativeEvent event) { | |||
ApplicationConnection client = getApplicationConnection(); | |||
String pid = ConnectorMap.get(getApplicationConnection()).getConnectorId( | |||
paintable); | |||
String pid = ConnectorMap.get(getApplicationConnection()) | |||
.getConnectorId(paintable); | |||
MouseEventDetails mouseDetails = new MouseEventDetails(event, | |||
getRelativeToElement()); |
@@ -49,29 +49,24 @@ public class ComboBoxConnector extends AbstractComponentConnector implements | |||
// not a FocusWidget -> needs own tabindex handling | |||
if (uidl.hasAttribute("tabindex")) { | |||
getWidget().tb.setTabIndex(uidl | |||
.getIntAttribute("tabindex")); | |||
getWidget().tb.setTabIndex(uidl.getIntAttribute("tabindex")); | |||
} | |||
if (uidl.hasAttribute("filteringmode")) { | |||
getWidget().filteringmode = uidl | |||
.getIntAttribute("filteringmode"); | |||
getWidget().filteringmode = uidl.getIntAttribute("filteringmode"); | |||
} | |||
getWidget().immediate = getState().isImmediate(); | |||
getWidget().nullSelectionAllowed = uidl | |||
.hasAttribute("nullselect"); | |||
getWidget().nullSelectionAllowed = uidl.hasAttribute("nullselect"); | |||
getWidget().nullSelectItem = uidl | |||
.hasAttribute("nullselectitem") | |||
getWidget().nullSelectItem = uidl.hasAttribute("nullselectitem") | |||
&& uidl.getBooleanAttribute("nullselectitem"); | |||
getWidget().currentPage = uidl.getIntVariable("page"); | |||
if (uidl.hasAttribute("pagelength")) { | |||
getWidget().pageLength = uidl | |||
.getIntAttribute("pagelength"); | |||
getWidget().pageLength = uidl.getIntAttribute("pagelength"); | |||
} | |||
if (uidl.hasAttribute(VFilterSelect.ATTR_INPUTPROMPT)) { | |||
@@ -82,11 +77,9 @@ public class ComboBoxConnector extends AbstractComponentConnector implements | |||
getWidget().inputPrompt = ""; | |||
} | |||
getWidget().suggestionPopup.updateStyleNames(uidl, | |||
getState()); | |||
getWidget().suggestionPopup.updateStyleNames(uidl, getState()); | |||
getWidget().allowNewItem = uidl | |||
.hasAttribute("allownewitem"); | |||
getWidget().allowNewItem = uidl.hasAttribute("allownewitem"); | |||
getWidget().lastNewItemString = null; | |||
getWidget().currentSuggestions.clear(); | |||
@@ -109,8 +102,7 @@ public class ComboBoxConnector extends AbstractComponentConnector implements | |||
final UIDL options = uidl.getChildUIDL(0); | |||
if (uidl.hasAttribute("totalMatches")) { | |||
getWidget().totalMatches = uidl | |||
.getIntAttribute("totalMatches"); | |||
getWidget().totalMatches = uidl.getIntAttribute("totalMatches"); | |||
} else { | |||
getWidget().totalMatches = 0; | |||
} | |||
@@ -141,8 +133,7 @@ public class ComboBoxConnector extends AbstractComponentConnector implements | |||
} | |||
} | |||
getWidget().currentSuggestion = suggestion; | |||
getWidget().setSelectedItemIcon( | |||
suggestion.getIconUri()); | |||
getWidget().setSelectedItemIcon(suggestion.getIconUri()); | |||
} | |||
// Collect captions so we can calculate minimum width for textarea | |||
@@ -180,19 +171,16 @@ public class ComboBoxConnector extends AbstractComponentConnector implements | |||
&& getWidget().lastFilter.toLowerCase().equals( | |||
uidl.getStringVariable("filter"))) { | |||
getWidget().suggestionPopup.showSuggestions( | |||
getWidget().currentSuggestions, | |||
getWidget().currentPage, | |||
getWidget().currentSuggestions, getWidget().currentPage, | |||
getWidget().totalMatches); | |||
getWidget().waitingForFilteringResponse = false; | |||
if (!getWidget().popupOpenerClicked | |||
&& getWidget().selectPopupItemWhenResponseIsReceived != VFilterSelect.Select.NONE) { | |||
// we're paging w/ arrows | |||
if (getWidget().selectPopupItemWhenResponseIsReceived == VFilterSelect.Select.LAST) { | |||
getWidget().suggestionPopup.menu | |||
.selectLastItem(); | |||
getWidget().suggestionPopup.menu.selectLastItem(); | |||
} else { | |||
getWidget().suggestionPopup.menu | |||
.selectFirstItem(); | |||
getWidget().suggestionPopup.menu.selectFirstItem(); | |||
} | |||
// This is used for paging so we update the keyboard selection | |||
@@ -203,8 +191,7 @@ public class ComboBoxConnector extends AbstractComponentConnector implements | |||
.setKeyboardSelectedItem(activeMenuItem); | |||
// Update text field to contain the correct text | |||
getWidget() | |||
.setTextboxText(activeMenuItem.getText()); | |||
getWidget().setTextboxText(activeMenuItem.getText()); | |||
getWidget().tb.setSelectionRange( | |||
getWidget().lastFilter.length(), | |||
activeMenuItem.getText().length() | |||
@@ -219,8 +206,7 @@ public class ComboBoxConnector extends AbstractComponentConnector implements | |||
} | |||
// Calculate minumum textarea width | |||
getWidget().suggestionPopupMinWidth = getWidget() | |||
.minWidth(captions); | |||
getWidget().suggestionPopupMinWidth = getWidget().minWidth(captions); | |||
getWidget().popupOpenerClicked = false; | |||
@@ -10,9 +10,9 @@ import com.google.gwt.event.shared.HandlerRegistration; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.EventId; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
public class CssLayoutConnector extends AbstractComponentContainerConnector { | |||
@@ -6,9 +6,9 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
public class CustomComponentConnector extends | |||
AbstractComponentContainerConnector { |
@@ -11,8 +11,8 @@ import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
public class CustomLayoutConnector extends AbstractComponentContainerConnector | |||
implements SimpleManagedLayout { | |||
@@ -91,7 +91,6 @@ public class CustomLayoutConnector extends AbstractComponentContainerConnector | |||
} | |||
public void layout() { | |||
getWidget().iLayoutJS( | |||
DOM.getFirstChild(getWidget().getElement())); | |||
getWidget().iLayoutJS(DOM.getFirstChild(getWidget().getElement())); | |||
} | |||
} |
@@ -45,12 +45,10 @@ public class EmbeddedConnector extends AbstractComponentConnector { | |||
if (uidl.hasAttribute("type")) { | |||
getWidget().type = uidl.getStringAttribute("type"); | |||
if (getWidget().type.equals("image")) { | |||
getWidget().addStyleName( | |||
VEmbedded.CLASSNAME + "-image"); | |||
getWidget().addStyleName(VEmbedded.CLASSNAME + "-image"); | |||
Element el = null; | |||
boolean created = false; | |||
NodeList<Node> nodes = getWidget().getElement() | |||
.getChildNodes(); | |||
NodeList<Node> nodes = getWidget().getElement().getChildNodes(); | |||
if (nodes != null && nodes.getLength() == 1) { | |||
Node n = nodes.getItem(0); | |||
if (n.getNodeType() == Node.ELEMENT_NODE) { | |||
@@ -72,8 +70,8 @@ public class EmbeddedConnector extends AbstractComponentConnector { | |||
style.setProperty("width", getState().getWidth()); | |||
style.setProperty("height", getState().getHeight()); | |||
DOM.setElementProperty(el, "src", getWidget() | |||
.getSrc(uidl, client)); | |||
DOM.setElementProperty(el, "src", | |||
getWidget().getSrc(uidl, client)); | |||
if (created) { | |||
// insert in dom late | |||
@@ -87,36 +85,31 @@ public class EmbeddedConnector extends AbstractComponentConnector { | |||
getWidget().sinkEvents(VTooltip.TOOLTIP_EVENTS); | |||
} else if (getWidget().type.equals("browser")) { | |||
getWidget().addStyleName( | |||
VEmbedded.CLASSNAME + "-browser"); | |||
getWidget().addStyleName(VEmbedded.CLASSNAME + "-browser"); | |||
if (getWidget().browserElement == null) { | |||
getWidget().setHTML( | |||
"<iframe width=\"100%\" height=\"100%\" frameborder=\"0\"" | |||
+ " allowTransparency=\"true\" src=\"\"" | |||
+ " name=\"" + uidl.getId() | |||
+ "\"></iframe>"); | |||
getWidget().browserElement = DOM | |||
.getFirstChild(getWidget().getElement()); | |||
getWidget().browserElement = DOM.getFirstChild(getWidget() | |||
.getElement()); | |||
} | |||
DOM.setElementAttribute(getWidget().browserElement, | |||
"src", getWidget().getSrc(uidl, client)); | |||
DOM.setElementAttribute(getWidget().browserElement, "src", | |||
getWidget().getSrc(uidl, client)); | |||
clearBrowserElement = false; | |||
} else { | |||
VConsole.log("Unknown Embedded type '" | |||
+ getWidget().type + "'"); | |||
VConsole.log("Unknown Embedded type '" + getWidget().type + "'"); | |||
} | |||
} else if (uidl.hasAttribute("mimetype")) { | |||
final String mime = uidl.getStringAttribute("mimetype"); | |||
if (mime.equals("application/x-shockwave-flash")) { | |||
// Handle embedding of Flash | |||
getWidget().addStyleName( | |||
VEmbedded.CLASSNAME + "-flash"); | |||
getWidget().setHTML( | |||
getWidget().createFlashEmbed(uidl)); | |||
getWidget().addStyleName(VEmbedded.CLASSNAME + "-flash"); | |||
getWidget().setHTML(getWidget().createFlashEmbed(uidl)); | |||
} else if (mime.equals("image/svg+xml")) { | |||
getWidget().addStyleName( | |||
VEmbedded.CLASSNAME + "-svg"); | |||
getWidget().addStyleName(VEmbedded.CLASSNAME + "-svg"); | |||
String data; | |||
Map<String, String> parameters = VEmbedded.getParameters(uidl); | |||
if (parameters.get("data") == null) { |
@@ -8,12 +8,12 @@ import com.google.gwt.dom.client.Style.Unit; | |||
import com.google.gwt.event.dom.client.KeyDownEvent; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
public class FormConnector extends AbstractComponentContainerConnector implements | |||
SimpleManagedLayout { | |||
public class FormConnector extends AbstractComponentContainerConnector | |||
implements SimpleManagedLayout { | |||
@Override | |||
public void init() { | |||
@@ -38,8 +38,7 @@ public class FormConnector extends AbstractComponentContainerConnector implement | |||
boolean legendEmpty = true; | |||
if (getState().getCaption() != null) { | |||
getWidget().caption.setInnerText(getState() | |||
.getCaption()); | |||
getWidget().caption.setInnerText(getState().getCaption()); | |||
legendEmpty = false; | |||
} else { | |||
getWidget().caption.setInnerText(""); | |||
@@ -47,16 +46,13 @@ public class FormConnector extends AbstractComponentContainerConnector implement | |||
if (uidl.hasAttribute(ATTRIBUTE_ICON)) { | |||
if (getWidget().icon == null) { | |||
getWidget().icon = new Icon(client); | |||
getWidget().legend | |||
.insertFirst(getWidget().icon.getElement()); | |||
getWidget().legend.insertFirst(getWidget().icon.getElement()); | |||
} | |||
getWidget().icon.setUri(uidl | |||
.getStringAttribute(ATTRIBUTE_ICON)); | |||
getWidget().icon.setUri(uidl.getStringAttribute(ATTRIBUTE_ICON)); | |||
legendEmpty = false; | |||
} else { | |||
if (getWidget().icon != null) { | |||
getWidget().legend | |||
.removeChild(getWidget().icon.getElement()); | |||
getWidget().legend.removeChild(getWidget().icon.getElement()); | |||
} | |||
} | |||
if (legendEmpty) { | |||
@@ -74,18 +70,15 @@ public class FormConnector extends AbstractComponentContainerConnector implement | |||
} | |||
if (getState().hasDescription()) { | |||
getWidget().desc.setInnerHTML(getState() | |||
.getDescription()); | |||
getWidget().desc.setInnerHTML(getState().getDescription()); | |||
if (getWidget().desc.getParentElement() == null) { | |||
getWidget().fieldSet.insertAfter( | |||
getWidget().desc, | |||
getWidget().fieldSet.insertAfter(getWidget().desc, | |||
getWidget().legend); | |||
} | |||
} else { | |||
getWidget().desc.setInnerHTML(""); | |||
if (getWidget().desc.getParentElement() != null) { | |||
getWidget().fieldSet | |||
.removeChild(getWidget().desc); | |||
getWidget().fieldSet.removeChild(getWidget().desc); | |||
} | |||
} | |||
@@ -124,16 +117,14 @@ public class FormConnector extends AbstractComponentContainerConnector implement | |||
if (getWidget().lo == null) { | |||
// Layout not rendered before | |||
getWidget().lo = newLayoutWidget; | |||
getWidget().add(newLayoutWidget, | |||
getWidget().fieldContainer); | |||
getWidget().add(newLayoutWidget, getWidget().fieldContainer); | |||
} else if (getWidget().lo != newLayoutWidget) { | |||
// Layout has changed | |||
client.unregisterPaintable(ConnectorMap.get(getConnection()) | |||
.getConnector(getWidget().lo)); | |||
getWidget().remove(getWidget().lo); | |||
getWidget().lo = newLayoutWidget; | |||
getWidget().add(newLayoutWidget, | |||
getWidget().fieldContainer); | |||
getWidget().add(newLayoutWidget, getWidget().fieldContainer); | |||
} | |||
newLayout.updateFromUIDL(layoutUidl, client); | |||
@@ -149,11 +140,9 @@ public class FormConnector extends AbstractComponentContainerConnector implement | |||
getWidget().shortcutHandler = new ShortcutActionHandler( | |||
getId(), client); | |||
getWidget().keyDownRegistration = getWidget() | |||
.addDomHandler(getWidget(), | |||
KeyDownEvent.getType()); | |||
.addDomHandler(getWidget(), KeyDownEvent.getType()); | |||
} | |||
getWidget().shortcutHandler | |||
.updateActionMap(childUidl); | |||
getWidget().shortcutHandler.updateActionMap(childUidl); | |||
} | |||
} else if (getWidget().shortcutHandler != null) { | |||
getWidget().keyDownRegistration.removeHandler(); |
@@ -6,8 +6,8 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
public class FormLayoutConnector extends AbstractComponentContainerConnector { | |||
@Override |
@@ -13,12 +13,12 @@ import com.google.gwt.event.shared.HandlerRegistration; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.DirectionalManagedLayout; | |||
import com.vaadin.terminal.gwt.client.EventId; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.VCaption; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ui.VGridLayout.Cell; | |||
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot; | |||
@@ -127,8 +127,7 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector | |||
public void updateCaption(ComponentConnector paintable, UIDL uidl) { | |||
VGridLayout layout = getWidget(); | |||
if (VCaption.isNeeded(uidl, paintable.getState())) { | |||
Cell cell = layout.widgetToCell.get(paintable | |||
.getWidget()); | |||
Cell cell = layout.widgetToCell.get(paintable.getWidget()); | |||
VLayoutSlot layoutSlot = cell.slot; | |||
VCaption caption = layoutSlot.getCaption(); | |||
if (caption == null) { |
@@ -19,18 +19,15 @@ public class InlineDateFieldConnector extends AbstractDateFieldConnector { | |||
@SuppressWarnings("deprecation") | |||
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { | |||
super.updateFromUIDL(uidl, client); | |||
getWidget().calendarPanel | |||
.setShowISOWeekNumbers(getWidget() | |||
.isShowISOWeekNumbers()); | |||
getWidget().calendarPanel | |||
.setDateTimeService(getWidget() | |||
.getDateTimeService()); | |||
getWidget().calendarPanel | |||
.setResolution(getWidget().getCurrentResolution()); | |||
getWidget().calendarPanel.setShowISOWeekNumbers(getWidget() | |||
.isShowISOWeekNumbers()); | |||
getWidget().calendarPanel.setDateTimeService(getWidget() | |||
.getDateTimeService()); | |||
getWidget().calendarPanel.setResolution(getWidget() | |||
.getCurrentResolution()); | |||
Date currentDate = getWidget().getCurrentDate(); | |||
if (currentDate != null) { | |||
getWidget().calendarPanel.setDate(new Date(currentDate | |||
.getTime())); | |||
getWidget().calendarPanel.setDate(new Date(currentDate.getTime())); | |||
} else { | |||
getWidget().calendarPanel.setDate(null); | |||
} | |||
@@ -44,8 +41,8 @@ public class InlineDateFieldConnector extends AbstractDateFieldConnector { | |||
// date currently null, use the value from | |||
// calendarPanel | |||
// (~ client time at the init of the widget) | |||
d = (Date) getWidget().calendarPanel | |||
.getDate().clone(); | |||
d = (Date) getWidget().calendarPanel.getDate() | |||
.clone(); | |||
} | |||
d.setHours(hour); | |||
d.setMinutes(min); | |||
@@ -73,8 +70,7 @@ public class InlineDateFieldConnector extends AbstractDateFieldConnector { | |||
*/ | |||
date2.setYear(date.getYear()); | |||
date2.setMonth(date.getMonth()); | |||
getWidget().calendarPanel | |||
.setDate(date2); | |||
getWidget().calendarPanel.setDate(date2); | |||
/* | |||
* Then update the value from panel to server | |||
*/ |
@@ -9,9 +9,9 @@ import java.util.Map; | |||
import com.google.gwt.dom.client.NativeEvent; | |||
import com.google.gwt.user.client.Element; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.MouseEventDetails; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.MouseEventDetails; | |||
public abstract class LayoutClickEventHandler extends ClickEventHandler { | |||
@@ -25,8 +25,8 @@ public abstract class LayoutClickEventHandler extends ClickEventHandler { | |||
@Override | |||
protected void fireClick(NativeEvent event) { | |||
ApplicationConnection client = getApplicationConnection(); | |||
String pid = ConnectorMap.get(getApplicationConnection()).getConnectorId( | |||
paintable); | |||
String pid = ConnectorMap.get(getApplicationConnection()) | |||
.getConnectorId(paintable); | |||
MouseEventDetails mouseDetails = new MouseEventDetails(event, | |||
getRelativeToElement()); |
@@ -34,14 +34,12 @@ public class LinkConnector extends AbstractComponentConnector { | |||
if (uidl.hasAttribute("name")) { | |||
getWidget().target = uidl.getStringAttribute("name"); | |||
getWidget().anchor.setAttribute("target", | |||
getWidget().target); | |||
getWidget().anchor.setAttribute("target", getWidget().target); | |||
} | |||
if (uidl.hasAttribute("src")) { | |||
getWidget().src = client.translateVaadinUri(uidl | |||
.getStringAttribute("src")); | |||
getWidget().anchor.setAttribute("href", | |||
getWidget().src); | |||
getWidget().anchor.setAttribute("href", getWidget().src); | |||
} | |||
if (uidl.hasAttribute("border")) { | |||
@@ -54,41 +52,35 @@ public class LinkConnector extends AbstractComponentConnector { | |||
getWidget().borderStyle = VLink.BORDER_STYLE_DEFAULT; | |||
} | |||
getWidget().targetHeight = uidl | |||
.hasAttribute("targetHeight") ? uidl | |||
getWidget().targetHeight = uidl.hasAttribute("targetHeight") ? uidl | |||
.getIntAttribute("targetHeight") : -1; | |||
getWidget().targetWidth = uidl.hasAttribute("targetWidth") ? uidl | |||
.getIntAttribute("targetWidth") : -1; | |||
// Set link caption | |||
getWidget().captionElement.setInnerText(getState() | |||
.getCaption()); | |||
getWidget().captionElement.setInnerText(getState().getCaption()); | |||
// handle error | |||
if (uidl.hasAttribute("error")) { | |||
if (getWidget().errorIndicatorElement == null) { | |||
getWidget().errorIndicatorElement = DOM.createDiv(); | |||
DOM.setElementProperty( | |||
getWidget().errorIndicatorElement, | |||
DOM.setElementProperty(getWidget().errorIndicatorElement, | |||
"className", "v-errorindicator"); | |||
} | |||
DOM.insertChild(getWidget().getElement(), | |||
getWidget().errorIndicatorElement, 0); | |||
} else if (getWidget().errorIndicatorElement != null) { | |||
DOM.setStyleAttribute( | |||
getWidget().errorIndicatorElement, "display", | |||
DOM.setStyleAttribute(getWidget().errorIndicatorElement, "display", | |||
"none"); | |||
} | |||
if (uidl.hasAttribute(ATTRIBUTE_ICON)) { | |||
if (getWidget().icon == null) { | |||
getWidget().icon = new Icon(client); | |||
getWidget().anchor.insertBefore( | |||
getWidget().icon.getElement(), | |||
getWidget().anchor.insertBefore(getWidget().icon.getElement(), | |||
getWidget().captionElement); | |||
} | |||
getWidget().icon.setUri(uidl | |||
.getStringAttribute(ATTRIBUTE_ICON)); | |||
getWidget().icon.setUri(uidl.getStringAttribute(ATTRIBUTE_ICON)); | |||
} | |||
} |
@@ -73,10 +73,8 @@ public class MenuBarConnector extends AbstractComponentConnector implements | |||
getWidget().moreItem.setHTML(itemHTML.toString()); | |||
getWidget().moreItem.setCommand(VMenuBar.emptyCommand); | |||
getWidget().collapsedRootItems = new VMenuBar(true, | |||
getWidget()); | |||
getWidget().moreItem | |||
.setSubMenu(getWidget().collapsedRootItems); | |||
getWidget().collapsedRootItems = new VMenuBar(true, getWidget()); | |||
getWidget().moreItem.setSubMenu(getWidget().collapsedRootItems); | |||
getWidget().moreItem.addStyleName(VMenuBar.CLASSNAME | |||
+ "-more-menuitem"); | |||
} | |||
@@ -106,8 +104,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements | |||
// item's id-number | |||
cmd = new Command() { | |||
public void execute() { | |||
getWidget().hostReference | |||
.onMenuClick(itemId); | |||
getWidget().hostReference.onMenuClick(itemId); | |||
} | |||
}; | |||
} |
@@ -11,9 +11,9 @@ import com.google.gwt.event.shared.EventHandler; | |||
import com.google.gwt.event.shared.HandlerRegistration; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.LayoutManager; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
public class PanelConnector extends AbstractComponentContainerConnector | |||
implements SimpleManagedLayout, PostLayoutListener { | |||
@@ -57,12 +57,10 @@ public class PanelConnector extends AbstractComponentContainerConnector | |||
// Affects size calculations | |||
// Restore default stylenames | |||
getWidget().contentNode.setClassName(VPanel.CLASSNAME | |||
+ "-content"); | |||
getWidget().bottomDecoration | |||
.setClassName(VPanel.CLASSNAME + "-deco"); | |||
getWidget().captionNode.setClassName(VPanel.CLASSNAME | |||
+ "-caption"); | |||
getWidget().contentNode.setClassName(VPanel.CLASSNAME + "-content"); | |||
getWidget().bottomDecoration.setClassName(VPanel.CLASSNAME | |||
+ "-deco"); | |||
getWidget().captionNode.setClassName(VPanel.CLASSNAME + "-caption"); | |||
boolean hasCaption = false; | |||
if (getState().getCaption() != null | |||
&& !"".equals(getState().getCaption())) { | |||
@@ -70,8 +68,8 @@ public class PanelConnector extends AbstractComponentContainerConnector | |||
hasCaption = true; | |||
} else { | |||
getWidget().setCaption(""); | |||
getWidget().captionNode | |||
.setClassName(VPanel.CLASSNAME + "-nocaption"); | |||
getWidget().captionNode.setClassName(VPanel.CLASSNAME | |||
+ "-nocaption"); | |||
} | |||
// Add proper stylenames for all elements. This way we can prevent | |||
@@ -118,8 +116,7 @@ public class PanelConnector extends AbstractComponentContainerConnector | |||
if (getWidget().layout != null) { | |||
client.unregisterPaintable(getWidget().layout); | |||
} | |||
getWidget() | |||
.setWidget(newLayout.getWidget()); | |||
getWidget().setWidget(newLayout.getWidget()); | |||
getWidget().layout = newLayout; | |||
} | |||
getWidget().layout.updateFromUIDL(layoutUidl, client); | |||
@@ -134,8 +131,7 @@ public class PanelConnector extends AbstractComponentContainerConnector | |||
getWidget().shortcutHandler = new ShortcutActionHandler( | |||
getId(), client); | |||
} | |||
getWidget().shortcutHandler | |||
.updateActionMap(childUidl); | |||
getWidget().shortcutHandler.updateActionMap(childUidl); | |||
} | |||
} | |||
} | |||
@@ -156,8 +152,8 @@ public class PanelConnector extends AbstractComponentContainerConnector | |||
// And apply tab index | |||
if (uidl.hasVariable("tabindex")) { | |||
getWidget().contentNode.setTabIndex(uidl | |||
.getIntVariable("tabindex")); | |||
getWidget().contentNode | |||
.setTabIndex(uidl.getIntVariable("tabindex")); | |||
} | |||
} | |||
@@ -6,10 +6,10 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.VCaption; | |||
import com.vaadin.terminal.gwt.client.VCaptionWrapper; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
public class PopupViewConnector extends AbstractComponentContainerConnector { | |||
@@ -67,9 +67,8 @@ public class PopupViewConnector extends AbstractComponentContainerConnector { | |||
} | |||
getWidget().popup.setStyleName(styleBuf.toString()); | |||
} else { | |||
getWidget().popup | |||
.setStyleName(getWidget().popup | |||
.getStylePrimaryName()); | |||
getWidget().popup.setStyleName(getWidget().popup | |||
.getStylePrimaryName()); | |||
} | |||
getWidget().showPopup(getWidget().popup); | |||
@@ -82,15 +81,12 @@ public class PopupViewConnector extends AbstractComponentContainerConnector { | |||
public void updateCaption(ComponentConnector component, UIDL uidl) { | |||
if (VCaption.isNeeded(uidl, component.getState())) { | |||
if (getWidget().popup.captionWrapper != null) { | |||
getWidget().popup.captionWrapper | |||
.updateCaption(uidl); | |||
getWidget().popup.captionWrapper.updateCaption(uidl); | |||
} else { | |||
getWidget().popup.captionWrapper = new VCaptionWrapper( | |||
component, getConnection()); | |||
getWidget().popup | |||
.setWidget(getWidget().popup.captionWrapper); | |||
getWidget().popup.captionWrapper | |||
.updateCaption(uidl); | |||
getWidget().popup.setWidget(getWidget().popup.captionWrapper); | |||
getWidget().popup.captionWrapper.updateCaption(uidl); | |||
} | |||
} else { | |||
if (getWidget().popup.captionWrapper != null) { |
@@ -25,8 +25,7 @@ public class ProgressIndicatorConnector extends AbstractComponentConnector { | |||
// Save details | |||
getWidget().client = client; | |||
getWidget().indeterminate = uidl | |||
.getBooleanAttribute("indeterminate"); | |||
getWidget().indeterminate = uidl.getBooleanAttribute("indeterminate"); | |||
if (getWidget().indeterminate) { | |||
String basename = VProgressIndicator.CLASSNAME + "-indeterminate"; | |||
@@ -41,17 +40,15 @@ public class ProgressIndicatorConnector extends AbstractComponentConnector { | |||
final float f = Float.parseFloat(uidl | |||
.getStringAttribute("state")); | |||
final int size = Math.round(100 * f); | |||
DOM.setStyleAttribute(getWidget().indicator, | |||
"width", size + "%"); | |||
DOM.setStyleAttribute(getWidget().indicator, "width", size | |||
+ "%"); | |||
} catch (final Exception e) { | |||
} | |||
} | |||
if (!getState().isDisabled()) { | |||
getWidget().interval = uidl | |||
.getIntAttribute("pollinginterval"); | |||
getWidget().poller | |||
.scheduleRepeating(getWidget().interval); | |||
getWidget().interval = uidl.getIntAttribute("pollinginterval"); | |||
getWidget().poller.scheduleRepeating(getWidget().interval); | |||
} | |||
} | |||
@@ -17,9 +17,9 @@ import com.google.gwt.user.client.ui.KeyboardListener; | |||
import com.google.gwt.user.client.ui.KeyboardListenerCollection; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ui.richtextarea.VRichTextArea; | |||
/** | |||
@@ -49,9 +49,9 @@ public class ShortcutActionHandler { | |||
} | |||
/** | |||
* A focusable {@link ComponentConnector} implementing this interface will be | |||
* notified before shortcut actions are handled if it will be the target of | |||
* the action (most commonly means it is the focused component during the | |||
* A focusable {@link ComponentConnector} implementing this interface will | |||
* be notified before shortcut actions are handled if it will be the target | |||
* of the action (most commonly means it is the focused component during the | |||
* keyboard combination is triggered by the user). | |||
*/ | |||
public interface BeforeShortcutActionListener extends ComponentConnector { |
@@ -3,7 +3,6 @@ | |||
*/ | |||
package com.vaadin.terminal.gwt.client.ui; | |||
public interface SimpleManagedLayout extends ManagedLayout { | |||
public void layout(); | |||
} |
@@ -34,18 +34,15 @@ public class SliderConnector extends AbstractComponentConnector { | |||
String style = getState().getStyle(); | |||
if (getWidget().vertical) { | |||
getWidget().addStyleName( | |||
VSlider.CLASSNAME + "-vertical"); | |||
getWidget().addStyleName(VSlider.CLASSNAME + "-vertical"); | |||
} else { | |||
getWidget().removeStyleName( | |||
VSlider.CLASSNAME + "-vertical"); | |||
getWidget().removeStyleName(VSlider.CLASSNAME + "-vertical"); | |||
} | |||
getWidget().min = uidl.getDoubleAttribute("min"); | |||
getWidget().max = uidl.getDoubleAttribute("max"); | |||
getWidget().resolution = uidl.getIntAttribute("resolution"); | |||
getWidget().value = new Double( | |||
uidl.getDoubleVariable("value")); | |||
getWidget().value = new Double(uidl.getDoubleVariable("value")); | |||
getWidget().setFeedbackValue(getWidget().value); | |||
@@ -56,14 +53,12 @@ public class SliderConnector extends AbstractComponentConnector { | |||
Scheduler.get().scheduleDeferred(new Command() { | |||
public void execute() { | |||
getWidget().buildHandle(); | |||
getWidget().setValue( | |||
getWidget().value, false); | |||
getWidget().setValue(getWidget().value, false); | |||
} | |||
}); | |||
} else { | |||
getWidget().buildHandle(); | |||
getWidget().setValue(getWidget().value, | |||
false); | |||
getWidget().setValue(getWidget().value, false); | |||
} | |||
} | |||
@@ -10,10 +10,10 @@ import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.DirectionalManagedLayout; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
public class TableConnector extends AbstractComponentContainerConnector | |||
implements DirectionalManagedLayout { | |||
@@ -44,12 +44,10 @@ public class TableConnector extends AbstractComponentContainerConnector | |||
* the space available. | |||
*/ | |||
if (uidl.hasAttribute("colfooters")) { | |||
getWidget().showColFooters = uidl | |||
.getBooleanAttribute("colfooters"); | |||
getWidget().showColFooters = uidl.getBooleanAttribute("colfooters"); | |||
} | |||
getWidget().tFoot | |||
.setVisible(getWidget().showColFooters); | |||
getWidget().tFoot.setVisible(getWidget().showColFooters); | |||
super.updateFromUIDL(uidl, client); | |||
if (!isRealUpdate(uidl)) { | |||
@@ -84,8 +82,7 @@ public class TableConnector extends AbstractComponentContainerConnector | |||
getWidget().updateSelectionProperties(uidl, getState()); | |||
if (uidl.hasAttribute("alb")) { | |||
getWidget().bodyActionKeys = uidl | |||
.getStringArrayAttribute("alb"); | |||
getWidget().bodyActionKeys = uidl.getStringArrayAttribute("alb"); | |||
} else { | |||
// Need to clear the actions if the action handlers have been | |||
// removed | |||
@@ -94,8 +91,7 @@ public class TableConnector extends AbstractComponentContainerConnector | |||
getWidget().setCacheRateFromUIDL(uidl); | |||
getWidget().recalcWidths = uidl | |||
.hasAttribute("recalcWidths"); | |||
getWidget().recalcWidths = uidl.hasAttribute("recalcWidths"); | |||
if (getWidget().recalcWidths) { | |||
getWidget().tHead.clear(); | |||
getWidget().tFoot.clear(); | |||
@@ -105,10 +101,8 @@ public class TableConnector extends AbstractComponentContainerConnector | |||
getWidget().updateFirstVisibleAndScrollIfNeeded(uidl); | |||
getWidget().showRowHeaders = uidl | |||
.getBooleanAttribute("rowheaders"); | |||
getWidget().showColHeaders = uidl | |||
.getBooleanAttribute("colheaders"); | |||
getWidget().showRowHeaders = uidl.getBooleanAttribute("rowheaders"); | |||
getWidget().showColHeaders = uidl.getBooleanAttribute("colheaders"); | |||
getWidget().updateSortingProperties(uidl); | |||
@@ -152,10 +146,8 @@ public class TableConnector extends AbstractComponentContainerConnector | |||
uidl.getIntAttribute("firstrow"), | |||
uidl.getIntAttribute("rows")); | |||
if (getWidget().headerChangedDuringUpdate) { | |||
getWidget().triggerLazyColumnAdjustment( | |||
true); | |||
} else if (!getWidget() | |||
.isScrollPositionVisible() | |||
getWidget().triggerLazyColumnAdjustment(true); | |||
} else if (!getWidget().isScrollPositionVisible() | |||
|| totalRowsChanged | |||
|| getWidget().lastRenderedHeight != getWidget().scrollBody | |||
.getOffsetHeight()) { | |||
@@ -180,12 +172,11 @@ public class TableConnector extends AbstractComponentContainerConnector | |||
} | |||
if (!getWidget().isSelectable()) { | |||
getWidget().scrollBody | |||
.addStyleName(VScrollTable.CLASSNAME + "-body-noselection"); | |||
getWidget().scrollBody.addStyleName(VScrollTable.CLASSNAME | |||
+ "-body-noselection"); | |||
} else { | |||
getWidget().scrollBody | |||
.removeStyleName(VScrollTable.CLASSNAME | |||
+ "-body-noselection"); | |||
getWidget().scrollBody.removeStyleName(VScrollTable.CLASSNAME | |||
+ "-body-noselection"); | |||
} | |||
getWidget().hideScrollPositionAnnotation(); |
@@ -38,8 +38,8 @@ public class TextFieldConnector extends AbstractComponentConnector implements | |||
getWidget().immediate = getState().isImmediate(); | |||
getWidget().listenTextChangeEvents = client | |||
.hasEventListeners(this, "ie"); | |||
getWidget().listenTextChangeEvents = client.hasEventListeners(this, | |||
"ie"); | |||
if (getWidget().listenTextChangeEvents) { | |||
getWidget().textChangeEventMode = uidl | |||
.getStringAttribute(VTextField.ATTR_TEXTCHANGE_EVENTMODE); | |||
@@ -56,8 +56,7 @@ public class TextFieldConnector extends AbstractComponentConnector implements | |||
} | |||
} | |||
getWidget().sinkEvents(VTextField.TEXTCHANGE_EVENTS); | |||
getWidget().attachCutEventListener( | |||
getWidget().getElement()); | |||
getWidget().attachCutEventListener(getWidget().getElement()); | |||
} | |||
if (uidl.hasAttribute("cols")) { |
@@ -22,8 +22,7 @@ public class TextualDateConnector extends AbstractDateFieldConnector { | |||
getWidget().formatStr = null; | |||
} | |||
if (uidl.hasAttribute("format")) { | |||
getWidget().formatStr = uidl | |||
.getStringAttribute("format"); | |||
getWidget().formatStr = uidl.getStringAttribute("format"); | |||
} | |||
getWidget().inputPrompt = uidl | |||
@@ -34,8 +33,7 @@ public class TextualDateConnector extends AbstractDateFieldConnector { | |||
getWidget().buildDate(); | |||
// not a FocusWidget -> needs own tabindex handling | |||
if (uidl.hasAttribute("tabindex")) { | |||
getWidget().text.setTabIndex(uidl | |||
.getIntAttribute("tabindex")); | |||
getWidget().text.setTabIndex(uidl.getIntAttribute("tabindex")); | |||
} | |||
if (getWidget().readonly) { |
@@ -53,8 +53,7 @@ public class TreeConnector extends AbstractComponentConnector { | |||
.getBooleanAttribute("nullselect"); | |||
if (uidl.hasAttribute("alb")) { | |||
getWidget().bodyActionKeys = uidl | |||
.getStringArrayAttribute("alb"); | |||
getWidget().bodyActionKeys = uidl.getStringArrayAttribute("alb"); | |||
} | |||
getWidget().body.clear(); | |||
@@ -91,21 +90,19 @@ public class TreeConnector extends AbstractComponentConnector { | |||
.getIntAttribute("multiselectmode"); | |||
} | |||
getWidget().selectedIds = uidl | |||
.getStringArrayVariableAsSet("selected"); | |||
getWidget().selectedIds = uidl.getStringArrayVariableAsSet("selected"); | |||
// Update lastSelection and focusedNode to point to *actual* nodes again | |||
// after the old ones have been cleared from the body. This fixes focus | |||
// and keyboard navigation issues as described in #7057 and other | |||
// tickets. | |||
if (getWidget().lastSelection != null) { | |||
getWidget().lastSelection = getWidget() | |||
.getNodeByKey(getWidget().lastSelection.key); | |||
getWidget().lastSelection = getWidget().getNodeByKey( | |||
getWidget().lastSelection.key); | |||
} | |||
if (getWidget().focusedNode != null) { | |||
getWidget().setFocusedNode( | |||
getWidget().getNodeByKey( | |||
getWidget().focusedNode.key)); | |||
getWidget().getNodeByKey(getWidget().focusedNode.key)); | |||
} | |||
if (getWidget().lastSelection == null | |||
@@ -113,8 +110,7 @@ public class TreeConnector extends AbstractComponentConnector { | |||
&& !getWidget().selectedIds.isEmpty()) { | |||
getWidget().setFocusedNode( | |||
getWidget().getNodeByKey( | |||
getWidget().selectedIds.iterator() | |||
.next())); | |||
getWidget().selectedIds.iterator().next())); | |||
getWidget().focusedNode.setFocused(false); | |||
} | |||
@@ -36,8 +36,7 @@ public class UnknownComponentConnector extends AbstractComponentConnector { | |||
getWidget().uidlTree.removeFromParent(); | |||
} | |||
getWidget().uidlTree = new VUIDLBrowser(uidl, | |||
client.getConfiguration()); | |||
getWidget().uidlTree = new VUIDLBrowser(uidl, client.getConfiguration()); | |||
getWidget().uidlTree.open(true); | |||
getWidget().uidlTree.setText("Unrendered UIDL"); | |||
getWidget().panel.add(getWidget().uidlTree); |
@@ -39,8 +39,7 @@ public class UploadConnector extends AbstractComponentConnector { | |||
} else { | |||
getWidget().submitButton.setVisible(false); | |||
} | |||
getWidget().fu.setName(getWidget().paintableId | |||
+ "_file"); | |||
getWidget().fu.setName(getWidget().paintableId + "_file"); | |||
if (getState().isDisabled() || getState().isReadOnly()) { | |||
getWidget().disableUpload(); |
@@ -15,11 +15,11 @@ import com.google.gwt.user.client.ui.ComplexPanel; | |||
import com.google.gwt.user.client.ui.SimplePanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VCaption; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
public class VAbsoluteLayout extends ComplexPanel { | |||
@@ -143,8 +143,7 @@ public class VAbsoluteLayout extends ComplexPanel { | |||
// child may need relative size adjustment if wrapper details | |||
// have changed this could be optimized (check if wrapper size | |||
// has changed) | |||
client.handleComponentRelativeSize(paintable | |||
.getWidget()); | |||
client.handleComponentRelativeSize(paintable.getWidget()); | |||
} | |||
} | |||
@@ -15,12 +15,12 @@ import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.ComplexPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.RenderInformation; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VCaption; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
public class VAccordion extends VTabsheetBase { | |||
@@ -411,7 +411,8 @@ public class VAccordion extends VTabsheetBase { | |||
} | |||
public void setContent(UIDL contentUidl) { | |||
final ComponentConnector newPntbl = client.getPaintable(contentUidl); | |||
final ComponentConnector newPntbl = client | |||
.getPaintable(contentUidl); | |||
Widget newWidget = newPntbl.getWidget(); | |||
if (getChildWidget() == null) { | |||
add(newWidget, content); | |||
@@ -425,8 +426,7 @@ public class VAccordion extends VTabsheetBase { | |||
* The size of a cached, relative sized component must be | |||
* updated to report correct size. | |||
*/ | |||
client.handleComponentRelativeSize(newPntbl | |||
.getWidget()); | |||
client.handleComponentRelativeSize(newPntbl.getWidget()); | |||
} | |||
if (isOpen() && isDynamicHeight()) { | |||
setHeightFromWidget(); |
@@ -44,8 +44,8 @@ public class VContextMenu extends VOverlay implements SubPartAware { | |||
private int top; | |||
private VLazyExecutor delayedImageLoadExecutioner = new VLazyExecutor( | |||
100, new ScheduledCommand() { | |||
private VLazyExecutor delayedImageLoadExecutioner = new VLazyExecutor(100, | |||
new ScheduledCommand() { | |||
public void execute() { | |||
imagesLoaded(); | |||
} |
@@ -17,13 +17,13 @@ import com.google.gwt.user.client.ui.SimplePanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.StyleConstants; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VCaption; | |||
import com.vaadin.terminal.gwt.client.VConsole; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ValueMap; | |||
public class VCssLayout extends SimplePanel { |
@@ -16,12 +16,12 @@ import com.google.gwt.user.client.ui.ComplexPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VCaption; | |||
import com.vaadin.terminal.gwt.client.VCaptionWrapper; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
/** | |||
* Custom Layout implements complex layout defined with HTML template. |
@@ -23,14 +23,14 @@ import com.google.gwt.user.client.ui.Widget; | |||
import com.google.gwt.xhr.client.ReadyStateChangeHandler; | |||
import com.google.gwt.xhr.client.XMLHttpRequest; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.Connector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.MouseEventDetails; | |||
import com.vaadin.terminal.gwt.client.RenderInformation; | |||
import com.vaadin.terminal.gwt.client.RenderInformation.Size; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VConsole; | |||
import com.vaadin.terminal.gwt.client.Connector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.VTooltip; | |||
import com.vaadin.terminal.gwt.client.ValueMap; | |||
import com.vaadin.terminal.gwt.client.ui.dd.DDUtil; |
@@ -14,11 +14,11 @@ import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.HTML; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VConsole; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
public class VEmbedded extends HTML { | |||
public static String CLASSNAME = "v-embedded"; |
@@ -46,14 +46,14 @@ import com.google.gwt.user.client.ui.SuggestOracle.Suggestion; | |||
import com.google.gwt.user.client.ui.TextBox; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ComponentState; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.EventId; | |||
import com.vaadin.terminal.gwt.client.Focusable; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VConsole; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.VTooltip; | |||
/** |
@@ -20,12 +20,12 @@ import com.google.gwt.user.client.ui.SimplePanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ComponentState; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.Focusable; | |||
import com.vaadin.terminal.gwt.client.StyleConstants; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.VTooltip; | |||
/** | |||
@@ -179,13 +179,11 @@ public class VFormLayout extends SimplePanel { | |||
} | |||
public void updateCaption(ComponentConnector paintable, UIDL uidl) { | |||
final Caption c = widgetToCaption.get(paintable | |||
.getWidget()); | |||
final Caption c = widgetToCaption.get(paintable.getWidget()); | |||
if (c != null) { | |||
c.updateCaption(uidl, paintable.getState()); | |||
} | |||
final ErrorFlag e = widgetToError.get(paintable | |||
.getWidget()); | |||
final ErrorFlag e = widgetToError.get(paintable.getWidget()); | |||
if (e != null) { | |||
e.updateFromUIDL(uidl, paintable); | |||
} | |||
@@ -234,7 +232,8 @@ public class VFormLayout extends SimplePanel { | |||
* return null | |||
* @param client | |||
*/ | |||
public Caption(ComponentConnector component, ApplicationConnection client) { | |||
public Caption(ComponentConnector component, | |||
ApplicationConnection client) { | |||
super(); | |||
this.client = client; | |||
owner = component; |
@@ -17,14 +17,14 @@ import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.ui.ComplexPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.LayoutManager; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VCaption; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot; | |||
import com.vaadin.terminal.gwt.client.ui.layout.ComponentConnectorLayoutSlot; | |||
import com.vaadin.terminal.gwt.client.ui.layout.VLayoutSlot; | |||
public class VGridLayout extends ComplexPanel { | |||
@@ -554,7 +554,8 @@ public class VGridLayout extends ComplexPanel { | |||
ComponentConnector paintable = client.getPaintable(childUidl); | |||
if (slot == null || slot.getPaintable() != paintable) { | |||
slot = new ComponentConnectorLayoutSlot(CLASSNAME, paintable); | |||
slot = new ComponentConnectorLayoutSlot(CLASSNAME, | |||
paintable); | |||
Element slotWrapper = slot.getWrapperElement(); | |||
getElement().appendChild(slotWrapper); | |||
@@ -13,9 +13,9 @@ import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.SimplePanel; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.Focusable; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; | |||
public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner, |
@@ -24,13 +24,13 @@ import com.google.gwt.user.client.ui.PopupPanel; | |||
import com.google.gwt.user.client.ui.RootPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.Container; | |||
import com.vaadin.terminal.gwt.client.RenderInformation.Size; | |||
import com.vaadin.terminal.gwt.client.RenderSpace; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VCaptionWrapper; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.VTooltip; | |||
import com.vaadin.terminal.gwt.client.ui.richtextarea.VRichTextArea; | |||
@@ -59,15 +59,15 @@ import com.google.gwt.user.client.ui.UIObject; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ComponentState; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.Focusable; | |||
import com.vaadin.terminal.gwt.client.MouseEventDetails; | |||
import com.vaadin.terminal.gwt.client.TooltipInfo; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VConsole; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.VTooltip; | |||
import com.vaadin.terminal.gwt.client.ui.VScrollTable.VScrollTableBody.VScrollTableRow; | |||
import com.vaadin.terminal.gwt.client.ui.dd.DDUtil; | |||
@@ -1112,8 +1112,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
void purgeUnregistryBag() { | |||
for (Iterator<Panel> iterator = lazyUnregistryBag.iterator(); iterator | |||
.hasNext();) { | |||
ConnectorMap.get(client) | |||
.unregisterChildConnectors(iterator.next()); | |||
ConnectorMap.get(client).unregisterChildConnectors(iterator.next()); | |||
} | |||
lazyUnregistryBag.clear(); | |||
} | |||
@@ -2266,8 +2265,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
handleCaptionEvent(event); | |||
boolean stopPropagation = true; | |||
if (event.getTypeInt() == Event.ONCONTEXTMENU | |||
&& !client.hasEventListeners( | |||
VScrollTable.this, HEADER_CLICK_EVENT_ID)) { | |||
&& !client.hasEventListeners(VScrollTable.this, | |||
HEADER_CLICK_EVENT_ID)) { | |||
// Prevent showing the browser's context menu only when | |||
// there is a header click listener. | |||
stopPropagation = false; | |||
@@ -4128,8 +4127,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
final VScrollTableRow toBeRemoved = (VScrollTableRow) renderedRows | |||
.get(index); | |||
// Unregister row tooltip | |||
client.registerTooltip(VScrollTable.this, | |||
toBeRemoved.getElement(), null); | |||
client.registerTooltip(VScrollTable.this, toBeRemoved.getElement(), | |||
null); | |||
for (int i = 0; i < toBeRemoved.getElement().getChildCount(); i++) { | |||
// Unregister cell tooltips | |||
Element td = toBeRemoved.getElement().getChild(i).cast(); | |||
@@ -4391,12 +4390,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
String rowDescription = uidl.getStringAttribute("rowdescr"); | |||
if (rowDescription != null && !rowDescription.equals("")) { | |||
TooltipInfo info = new TooltipInfo(rowDescription); | |||
client.registerTooltip(VScrollTable.this, rowElement, | |||
info); | |||
client.registerTooltip(VScrollTable.this, rowElement, info); | |||
} else { | |||
// Remove possibly previously set tooltip | |||
client.registerTooltip(VScrollTable.this, rowElement, | |||
null); | |||
client.registerTooltip(VScrollTable.this, rowElement, null); | |||
} | |||
tHead.getColumnAlignments(); | |||
@@ -4477,8 +4474,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
final ComponentConnector cellContent = client | |||
.getPaintable((UIDL) cell); | |||
addCell(uidl, cellContent.getWidget(), | |||
aligns[col++], style, sorted); | |||
addCell(uidl, cellContent.getWidget(), aligns[col++], | |||
style, sorted); | |||
paintComponent(cellContent, (UIDL) cell); | |||
} | |||
} | |||
@@ -4761,21 +4758,19 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
if (ConnectorMap.get(client).getWidgetTooltipInfo( | |||
VScrollTable.this, target) != null) { | |||
// Cell has description, use it | |||
client.handleTooltipEvent(event, | |||
VScrollTable.this, target); | |||
client.handleTooltipEvent(event, VScrollTable.this, | |||
target); | |||
} else { | |||
// Cell might have row description, use row | |||
// description | |||
client.handleTooltipEvent(event, | |||
VScrollTable.this, | |||
client.handleTooltipEvent(event, VScrollTable.this, | |||
target.getParentElement()); | |||
} | |||
} | |||
} else { | |||
// Table row (tr) | |||
client.handleTooltipEvent(event, VScrollTable.this, | |||
target); | |||
client.handleTooltipEvent(event, VScrollTable.this, target); | |||
} | |||
} | |||
@@ -4791,8 +4786,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, | |||
showContextMenu(event); | |||
if (enabled | |||
&& (actionKeys != null || client | |||
.hasEventListeners( | |||
VScrollTable.this, | |||
.hasEventListeners(VScrollTable.this, | |||
ITEM_CLICK_EVENT_ID))) { | |||
/* | |||
* Prevent browser context menu only if there are |
@@ -13,7 +13,6 @@ import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.ui.HTML; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ContainerResizedListener; |
@@ -22,13 +22,13 @@ import com.google.gwt.user.client.ui.SimplePanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ComponentState; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.TooltipInfo; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VCaption; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ui.label.VLabel; | |||
public class VTabsheet extends VTabsheetBase { | |||
@@ -205,8 +205,7 @@ public class VTabsheet extends VTabsheetBase { | |||
if (uidl.hasAttribute(AbstractComponentConnector.ATTRIBUTE_ERROR)) { | |||
tooltipInfo.setErrorUidl(uidl.getErrors()); | |||
} | |||
client.registerTooltip(getTabsheet(), getElement(), | |||
tooltipInfo); | |||
client.registerTooltip(getTabsheet(), getElement(), tooltipInfo); | |||
} else { | |||
client.registerTooltip(getTabsheet(), getElement(), null); | |||
} |
@@ -12,8 +12,8 @@ import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.ComplexPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
abstract class VTabsheetBase extends ComplexPanel { | |||
@@ -55,8 +55,8 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, | |||
setPrompting(false); | |||
} | |||
if (getClient() != null | |||
&& getClient().hasEventListeners( | |||
VTextualDate.this, EventId.FOCUS)) { | |||
&& getClient().hasEventListeners(VTextualDate.this, | |||
EventId.FOCUS)) { | |||
getClient() | |||
.updateVariable(getId(), EventId.FOCUS, "", true); | |||
} | |||
@@ -73,8 +73,8 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, | |||
text.setText(readonly ? "" : inputPrompt); | |||
} | |||
if (getClient() != null | |||
&& getClient().hasEventListeners( | |||
VTextualDate.this, EventId.BLUR)) { | |||
&& getClient().hasEventListeners(VTextualDate.this, | |||
EventId.BLUR)) { | |||
getClient().updateVariable(getId(), EventId.BLUR, "", true); | |||
} | |||
} |
@@ -39,11 +39,11 @@ import com.google.gwt.user.client.ui.UIObject; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.MouseEventDetails; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.VTooltip; | |||
import com.vaadin.terminal.gwt.client.ui.dd.DDUtil; | |||
import com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler; | |||
@@ -648,8 +648,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, | |||
final boolean inCaption = target == nodeCaptionSpan | |||
|| (icon != null && target == icon.getElement()); | |||
if (inCaption | |||
&& client.hasEventListeners(VTree.this, | |||
ITEM_CLICK_EVENT_ID) | |||
&& client | |||
.hasEventListeners(VTree.this, ITEM_CLICK_EVENT_ID) | |||
&& (type == Event.ONDBLCLICK || type == Event.ONMOUSEUP)) { | |||
fireClick(event); |
@@ -23,11 +23,11 @@ import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.ui.SimplePanel; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.Focusable; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VConsole; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; | |||
/** | |||
@@ -227,8 +227,7 @@ public class VView extends SimplePanel implements ResizeHandler, | |||
public void execute() { | |||
final ComponentConnector paintable = (ComponentConnector) uidl | |||
.getPaintableAttribute("scrollTo", connection); | |||
paintable.getWidget().getElement() | |||
.scrollIntoView(); | |||
paintable.getWidget().getElement().scrollIntoView(); | |||
} | |||
}); | |||
} |
@@ -28,11 +28,11 @@ import com.google.gwt.user.client.ui.RootPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.Console; | |||
import com.vaadin.terminal.gwt.client.EventId; | |||
import com.vaadin.terminal.gwt.client.Focusable; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; | |||
/** | |||
@@ -747,8 +747,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, | |||
// Update child widget dimensions | |||
if (client != null) { | |||
client.handleComponentRelativeSize(layout.getWidget()); | |||
client.runDescendentsLayout((HasWidgets) layout | |||
.getWidget()); | |||
client.runDescendentsLayout((HasWidgets) layout.getWidget()); | |||
} | |||
Util.runWebkitOverflowAutoFix(contentPanel.getElement()); |
@@ -13,9 +13,9 @@ import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.ui.Frame; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutActionListener; | |||
public class WindowConnector extends AbstractComponentContainerConnector | |||
@@ -46,8 +46,8 @@ public class WindowConnector extends AbstractComponentContainerConnector | |||
// Workaround needed for Testing Tools (GWT generates window DOM | |||
// slightly different in different browsers). | |||
DOM.setElementProperty(getWidget().closeBox, "id", | |||
getWidget().id + "_window_close"); | |||
DOM.setElementProperty(getWidget().closeBox, "id", getWidget().id | |||
+ "_window_close"); | |||
if (uidl.hasAttribute("invisible")) { | |||
getWidget().hide(); | |||
@@ -56,23 +56,19 @@ public class WindowConnector extends AbstractComponentContainerConnector | |||
if (isRealUpdate(uidl)) { | |||
if (uidl.getBooleanAttribute("modal") != getWidget().vaadinModality) { | |||
getWidget().setVaadinModality( | |||
!getWidget().vaadinModality); | |||
getWidget().setVaadinModality(!getWidget().vaadinModality); | |||
} | |||
if (!getWidget().isAttached()) { | |||
getWidget().setVisible(false); // hide until | |||
// possible centering | |||
// possible centering | |||
getWidget().show(); | |||
} | |||
if (uidl.getBooleanAttribute("resizable") != getWidget().resizable) { | |||
getWidget().setResizable( | |||
!getWidget().resizable); | |||
getWidget().setResizable(!getWidget().resizable); | |||
} | |||
getWidget().resizeLazy = uidl | |||
.hasAttribute(VView.RESIZE_LAZY); | |||
getWidget().resizeLazy = uidl.hasAttribute(VView.RESIZE_LAZY); | |||
getWidget().setDraggable( | |||
!uidl.hasAttribute("fixedposition")); | |||
getWidget().setDraggable(!uidl.hasAttribute("fixedposition")); | |||
// Caption must be set before required header size is measured. If | |||
// the caption attribute is missing the caption should be cleared. | |||
@@ -136,19 +132,15 @@ public class WindowConnector extends AbstractComponentContainerConnector | |||
if (getWidget().layout != lo) { | |||
// remove old | |||
client.unregisterPaintable(getWidget().layout); | |||
getWidget().contentPanel | |||
.remove(getWidget().layout | |||
.getWidget()); | |||
getWidget().contentPanel.remove(getWidget().layout.getWidget()); | |||
// add new | |||
if (!showingUrl) { | |||
getWidget().contentPanel.setWidget(lo | |||
.getWidget()); | |||
getWidget().contentPanel.setWidget(lo.getWidget()); | |||
} | |||
getWidget().layout = lo; | |||
} | |||
} else if (!showingUrl) { | |||
getWidget().contentPanel.setWidget(lo | |||
.getWidget()); | |||
getWidget().contentPanel.setWidget(lo.getWidget()); | |||
getWidget().layout = lo; | |||
} | |||
@@ -160,8 +152,7 @@ public class WindowConnector extends AbstractComponentContainerConnector | |||
getWidget().layoutRelativeHeight = uidl | |||
.hasAttribute("layoutRelativeHeight"); | |||
if (getWidget().dynamicWidth | |||
&& getWidget().layoutRelativeWidth) { | |||
if (getWidget().dynamicWidth && getWidget().layoutRelativeWidth) { | |||
/* | |||
* Relative layout width, fix window width before rendering (width | |||
* according to caption) | |||
@@ -170,8 +161,7 @@ public class WindowConnector extends AbstractComponentContainerConnector | |||
} | |||
getWidget().layout.updateFromUIDL(childUidl, client); | |||
if (!getWidget().dynamicHeight | |||
&& getWidget().layoutRelativeWidth) { | |||
if (!getWidget().dynamicHeight && getWidget().layoutRelativeWidth) { | |||
/* | |||
* Relative layout width, and fixed height. Must update the size to | |||
* be able to take scrollbars into account (layout gets narrower | |||
@@ -184,13 +174,11 @@ public class WindowConnector extends AbstractComponentContainerConnector | |||
* No explicit width is set and the layout does not have relative width | |||
* so fix the size according to the layout. | |||
*/ | |||
if (getWidget().dynamicWidth | |||
&& !getWidget().layoutRelativeWidth) { | |||
if (getWidget().dynamicWidth && !getWidget().layoutRelativeWidth) { | |||
getWidget().setNaturalWidth(); | |||
} | |||
if (getWidget().dynamicHeight | |||
&& getWidget().layoutRelativeHeight) { | |||
if (getWidget().dynamicHeight && getWidget().layoutRelativeHeight) { | |||
// Prevent resizing until height has been fixed | |||
getWidget().resizable = false; | |||
} | |||
@@ -205,8 +193,7 @@ public class WindowConnector extends AbstractComponentContainerConnector | |||
getWidget().shortcutHandler = new ShortcutActionHandler( | |||
getId(), client); | |||
} | |||
getWidget().shortcutHandler | |||
.updateActionMap(childUidl); | |||
getWidget().shortcutHandler.updateActionMap(childUidl); | |||
} | |||
} | |||
@@ -238,14 +225,12 @@ public class WindowConnector extends AbstractComponentContainerConnector | |||
getWidget().setWidth(Window.getClientWidth() + "px"); | |||
sizeReduced = true; | |||
} | |||
if (getWidget().getOffsetHeight() > Window | |||
.getClientHeight()) { | |||
if (getWidget().getOffsetHeight() > Window.getClientHeight()) { | |||
getWidget().setHeight(Window.getClientHeight() + "px"); | |||
sizeReduced = true; | |||
} | |||
if (getWidget().dynamicHeight | |||
&& getWidget().layoutRelativeHeight) { | |||
if (getWidget().dynamicHeight && getWidget().layoutRelativeHeight) { | |||
/* | |||
* Window height is undefined, layout is 100% high so the layout | |||
* should define the initial window height but on resize the layout | |||
@@ -267,8 +252,7 @@ public class WindowConnector extends AbstractComponentContainerConnector | |||
client.runDescendentsLayout(getWidget()); | |||
} | |||
Util.runWebkitOverflowAutoFix(getWidget().contentPanel | |||
.getElement()); | |||
Util.runWebkitOverflowAutoFix(getWidget().contentPanel.getElement()); | |||
client.getView().getWidget().scrollIntoView(uidl); | |||
@@ -23,10 +23,10 @@ import com.google.gwt.user.client.Timer; | |||
import com.google.gwt.user.client.ui.RootPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.MouseEventDetails; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ValueMap; | |||
/** | |||
@@ -544,8 +544,7 @@ public class VDragAndDropManager { | |||
} | |||
private void removeActiveDragSourceStyleName(ComponentConnector dragSource) { | |||
dragSource.getWidget().removeStyleName( | |||
ACTIVE_DRAG_SOURCE_STYLENAME); | |||
dragSource.getWidget().removeStyleName(ACTIVE_DRAG_SOURCE_STYLENAME); | |||
} | |||
private void clearDragElement() { |
@@ -3,9 +3,9 @@ | |||
*/ | |||
package com.vaadin.terminal.gwt.client.ui.dd; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
/** | |||
* TODO Javadoc! | |||
@@ -17,7 +17,8 @@ final public class VDragSourceIs extends VAcceptCriterion { | |||
@Override | |||
protected boolean accept(VDragEvent drag, UIDL configuration) { | |||
try { | |||
ComponentConnector component = drag.getTransferable().getDragSource(); | |||
ComponentConnector component = drag.getTransferable() | |||
.getDragSource(); | |||
int c = configuration.getIntAttribute("c"); | |||
for (int i = 0; i < c; i++) { | |||
String requiredPid = configuration |
@@ -6,9 +6,9 @@ | |||
*/ | |||
package com.vaadin.terminal.gwt.client.ui.dd; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
final public class VIsOverId extends VAcceptCriterion { | |||
@@ -6,9 +6,9 @@ | |||
*/ | |||
package com.vaadin.terminal.gwt.client.ui.dd; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
final public class VItemIdIs extends VAcceptCriterion { | |||
@@ -21,8 +21,8 @@ final public class VItemIdIs extends VAcceptCriterion { | |||
VDropHandler currentDropHandler = VDragAndDropManager.get() | |||
.getCurrentDropHandler(); | |||
String pid2 = ConnectorMap.get( | |||
currentDropHandler.getApplicationConnection()).getConnectorId( | |||
dragSource); | |||
currentDropHandler.getApplicationConnection()) | |||
.getConnectorId(dragSource); | |||
if (pid2.equals(pid)) { | |||
Object searchedId = drag.getTransferable().getData("itemId"); | |||
String[] stringArrayAttribute = configuration |
@@ -14,8 +14,8 @@ final public class VSourceIsTarget extends VAcceptCriterion { | |||
@Override | |||
protected boolean accept(VDragEvent drag, UIDL configuration) { | |||
ComponentConnector dragSource = drag.getTransferable().getDragSource(); | |||
ComponentConnector paintable = VDragAndDropManager.get().getCurrentDropHandler() | |||
.getPaintable(); | |||
ComponentConnector paintable = VDragAndDropManager.get() | |||
.getCurrentDropHandler().getPaintable(); | |||
return paintable == dragSource; | |||
} |
@@ -16,7 +16,7 @@ public class VLabel extends HTML { | |||
public static final String CLASSNAME = "v-label"; | |||
private static final String CLASSNAME_UNDEFINED_WIDTH = "v-label-undef-w"; | |||
private ApplicationConnection connection; | |||
public VLabel() { |
@@ -3,9 +3,9 @@ | |||
*/ | |||
package com.vaadin.terminal.gwt.client.ui.layout; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.LayoutManager; | |||
import com.vaadin.terminal.gwt.client.VCaption; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
import com.vaadin.terminal.gwt.client.ui.ManagedLayout; | |||
public class ComponentConnectorLayoutSlot extends VLayoutSlot { | |||
@@ -13,7 +13,8 @@ public class ComponentConnectorLayoutSlot extends VLayoutSlot { | |||
final ComponentConnector paintable; | |||
private LayoutManager layoutManager; | |||
public ComponentConnectorLayoutSlot(String baseClassName, ComponentConnector paintable) { | |||
public ComponentConnectorLayoutSlot(String baseClassName, | |||
ComponentConnector paintable) { | |||
super(baseClassName, paintable.getWidget()); | |||
this.paintable = paintable; | |||
layoutManager = paintable.getLayoutManager(); | |||
@@ -55,14 +56,12 @@ public class ComponentConnectorLayoutSlot extends VLayoutSlot { | |||
@Override | |||
public int getWidgetHeight() { | |||
return layoutManager.getOuterHeight(paintable.getWidget() | |||
.getElement()); | |||
return layoutManager.getOuterHeight(paintable.getWidget().getElement()); | |||
} | |||
@Override | |||
public int getWidgetWidth() { | |||
return layoutManager.getOuterWidth(paintable.getWidget() | |||
.getElement()); | |||
return layoutManager.getOuterWidth(paintable.getWidget().getElement()); | |||
} | |||
@Override |
@@ -26,8 +26,8 @@ import com.google.gwt.user.client.ui.RichTextArea; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.ConnectorMap; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.ui.Field; | |||
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler; | |||
import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; |
@@ -78,8 +78,8 @@ import com.vaadin.ui.Root; | |||
* A server side component sends its state to the client in a paint request (see | |||
* {@link Paintable} and {@link PaintTarget} on the server side). The client | |||
* widget receives these paint requests as calls to | |||
* {@link com.vaadin.terminal.gwt.client.ComponentConnector#updateFromUIDL()}. The | |||
* client component communicates back to the server by sending a list of | |||
* {@link com.vaadin.terminal.gwt.client.ComponentConnector#updateFromUIDL()}. | |||
* The client component communicates back to the server by sending a list of | |||
* variable changes (see {@link ApplicationConnection#updateVariable()} and | |||
* {@link VariableOwner#changeVariables(Object, Map)}). | |||
* |
@@ -18,17 +18,17 @@ import com.google.gwt.core.ext.typeinfo.TypeOracle; | |||
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; | |||
import com.google.gwt.user.rebind.SourceWriter; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.communication.MethodInvocation; | |||
import com.vaadin.terminal.gwt.client.communication.ServerRpc; | |||
import com.vaadin.terminal.gwt.client.communication.ServerRpc.InitializableClientToServerRpc; | |||
import com.vaadin.terminal.gwt.client.communication.MethodInvocation; | |||
/** | |||
* GWT generator that creates client side proxy classes for making RPC calls | |||
* from the client to the server. | |||
* | |||
* GWT.create() calls for interfaces extending {@link ServerRpc} are | |||
* affected, and a proxy implementation is created. Note that the init(...) | |||
* method of the proxy must be called before the proxy is used. | |||
* GWT.create() calls for interfaces extending {@link ServerRpc} are affected, | |||
* and a proxy implementation is created. Note that the init(...) method of the | |||
* proxy must be called before the proxy is used. | |||
* | |||
* @since 7.0 | |||
*/ |
@@ -179,8 +179,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements | |||
// Hide the error indicator if needed | |||
if (shouldHideErrors()) { | |||
target.addAttribute(AbstractComponentConnector.ATTRIBUTE_HIDEERRORS, | |||
true); | |||
target.addAttribute( | |||
AbstractComponentConnector.ATTRIBUTE_HIDEERRORS, true); | |||
} | |||
} | |||
@@ -54,7 +54,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements | |||
@Override | |||
public void addComponent(Component c) { | |||
// Add to components before calling super.addComponent | |||
// so that it is available to AttachListeners | |||
// so that it is available to AttachListeners | |||
components.add(c); | |||
try { | |||
super.addComponent(c); | |||
@@ -75,7 +75,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements | |||
public void addComponentAsFirst(Component c) { | |||
// If c is already in this, we must remove it before proceeding | |||
// see ticket #7668 | |||
if(c.getParent() == this) { | |||
if (c.getParent() == this) { | |||
removeComponent(c); | |||
} | |||
components.addFirst(c); | |||
@@ -100,9 +100,9 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements | |||
public void addComponent(Component c, int index) { | |||
// If c is already in this, we must remove it before proceeding | |||
// see ticket #7668 | |||
if(c.getParent() == this) { | |||
if (c.getParent() == this) { | |||
// When c is removed, all components after it are shifted down | |||
if(index > getComponentIndex(c)) { | |||
if (index > getComponentIndex(c)) { | |||
index--; | |||
} | |||
removeComponent(c); |
@@ -35,7 +35,6 @@ import com.vaadin.terminal.Resource; | |||
import com.vaadin.terminal.gwt.client.ui.dd.VIsOverId; | |||
import com.vaadin.terminal.gwt.client.ui.dd.VItemIdIs; | |||
import com.vaadin.terminal.gwt.client.ui.dd.VerticalDropLocation; | |||
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; | |||
/** | |||
* <p> |
@@ -648,8 +648,8 @@ public interface Component extends Paintable, VariableOwner, Sizeable, | |||
* Notifies the component that it is detached from the application. | |||
* | |||
* <p> | |||
* The {@link #getApplication()} and {@link #getRoot()} methods might | |||
* return <code>null</code> after this method is called. | |||
* The {@link #getApplication()} and {@link #getRoot()} methods might return | |||
* <code>null</code> after this method is called. | |||
* </p> | |||
* | |||
* <p> |
@@ -10,6 +10,7 @@ import com.vaadin.ui.Component.Focusable; | |||
/** | |||
* TODO document | |||
* | |||
* @author Vaadin Ltd. | |||
* | |||
* @param T |