import com.vaadin.terminal.gwt.client.ui.VNotification;
import com.vaadin.terminal.gwt.client.ui.VView;
import com.vaadin.terminal.gwt.client.ui.VNotification.HideEvent;
+import com.vaadin.terminal.gwt.server.AbstractCommunicationManager;
/**
- * Entry point classes define <code>onModuleLoad()</code>.
+ * This is the client side communication "engine", managing client-server
+ * communication with its server side counterpart
+ * {@link AbstractCommunicationManager}.
+ *
+ * Client-side widgets receive updates from the corresponding server-side
+ * components as calls to
+ * {@link Paintable#updateFromUIDL(UIDL, ApplicationConnection)} (not to be
+ * confused with the server side interface {@link com.vaadin.terminal.Paintable}
+ * ). Any client-side changes (typically resulting from user actions) are sent
+ * back to the server as variable changes (see {@link #updateVariable()}).
+ *
+ * TODO document better
+ *
+ * Entry point classes (widgetsets) define <code>onModuleLoad()</code>.
*/
public class ApplicationConnection {
private static final String MODIFIED_CLASSNAME = "v-modified";
* <li><code>vaadin.postRequestHooks</code> is a map of functions which gets
* called after each XHR made by vaadin application. Note, that it is
* attaching js functions responsibility to create the variable like this:
- *
+ *
* <code><pre>
* if(!vaadin.postRequestHooks) {vaadin.postRequestHooks = new Object();}
* postRequestHooks.myHook = function(appId) {
* </pre></code> First parameter passed to these functions is the identifier
* of Vaadin application that made the request.
* </ul>
- *
+ *
* TODO make this multi-app aware
*/
private native void initializeClientHooks()
/**
* Runs possibly registered client side post request hooks. This is expected
* to be run after each uidl request made by Vaadin application.
- *
+ *
* @param appId
*/
private static native void runPostRequestHooks(String appId)
/**
* Checks if client side is in debug mode. Practically this is invoked by
* adding ?debug parameter to URI.
- *
+ *
* @return true if client side is currently been debugged
*/
public native static boolean isDebugMode()
/**
* Shows the communication error notification. The 'details' only go to the
* console for now.
- *
+ *
* @param details
* Optional details for debugging.
*/
/**
* This method is called after applying uidl change set to application.
- *
+ *
* It will clean current and queued variable change sets. And send next
* change set if it exists.
*/
/**
* Cleans given queue of variable changes of such changes that came from
* components that do not exist anymore.
- *
+ *
* @param variableBurst
*/
private void cleanVariableBurst(ArrayList<String> variableBurst) {
/**
* Returns Paintable element by its id
- *
+ *
* @param id
* Paintable ID
*/
/**
* This method sends currently queued variable changes to server. It is
* called when immediate variable update must happen.
- *
+ *
* To ensure correct order for variable changes (due servers multithreading
* or network), we always wait for active request to be handler before
* sending a new one. If there is an active request, we will put varible
* "burst" to queue that will be purged after current request is handled.
- *
+ *
*/
@SuppressWarnings("unchecked")
public void sendPendingVariableChanges() {
/**
* Build the variable burst and send it to server.
- *
+ *
* When sync is forced, we also force sending of all pending variable-bursts
* at the same time. This is ok as we can assume that DOM will never be
* updated after this.
- *
+ *
* @param pendingVariables
* Vector of variable changes to send
* @param forceSync
/**
* Update generic component features.
- *
+ *
* <h2>Selecting correct implementation</h2>
- *
+ *
* <p>
* The implementation of a component depends on many properties, including
* styles, component features, etc. Sometimes the user changes those
* the beginning of your updateFromUIDL -method automatically replaces your
* component with more appropriate if the requested implementation changes.
* </p>
- *
+ *
* <h2>Caption, icon, error messages and description</h2>
- *
+ *
* <p>
* Component can delegate management of caption, icon, error messages and
* description to parent layout. This is optional an should be decided by
* component author
* </p>
- *
+ *
* <h2>Component visibility and disabling</h2>
- *
+ *
* This method will manage component visibility automatically and if
* component is an instanceof FocusWidget, also handle component disabling
* when needed.
- *
+ *
* @param component
* Widget to be updated, expected to implement an instance of
* Paintable
* @param manageCaption
* True if you want to delegate caption, icon, description and
* error message management to parent.
- *
+ *
* @return Returns true iff no further painting is needed by caller
*/
public boolean updateComponent(Widget component, UIDL uidl,
/**
* Traverses recursively child widgets until ContainerResizedListener child
* widget is found. They will delegate it further if needed.
- *
+ *
* @param container
*/
private boolean runningLayout = false;
/**
* Converts relative sizes into pixel sizes.
- *
+ *
* @param child
* @return true if the child has a relative size
*/
/**
* Converts relative sizes into pixel sizes.
- *
+ *
* @param child
* @return true if the child has a relative size
*/
/**
* Get either existing or new Paintable for given UIDL.
- *
+ *
* If corresponding Paintable has been previously painted, return it.
* Otherwise create and register a new Paintable from UIDL. Caller must
* update the returned Paintable from UIDL after it has been connected to
* parent.
- *
+ *
* @param uidl
* UIDL to create Paintable from.
* @return Either existing or new Paintable corresponding to UIDL.
/**
* Returns a Paintable element by its root element
- *
+ *
* @param element
* Root element of the paintable
*/
/**
* Singleton method to get instance of app's context menu.
- *
+ *
* @return VContextMenu object
*/
public VContextMenu getContextMenu() {
* Translates custom protocols in UIDL URI's to be recognizable by browser.
* All uri's from UIDL should be routed via this method before giving them
* to browser due URI's in UIDL may contain custom protocols like theme://.
- *
+ *
* @param uidlUri
* Vaadin URI from uidl
* @return translated URI ready for browser
/**
* Listens for Notification hide event, and redirects. Used for system
* messages, such as session expired.
- *
+ *
*/
private class NotificationRedirect implements VNotification.EventListener {
String url;
/**
* Data showed in tooltips are stored centrilized as it may be needed in
* varios place: caption, layouts, and in owner components themselves.
- *
+ *
* Updating TooltipInfo is done in updateComponent method.
- *
+ *
*/
public TooltipInfo getTooltipTitleInfo(Paintable titleOwner, Object key) {
if (null == titleOwner) {
* Component may want to delegate Tooltip handling to client. Layouts add
* Tooltip (description, errors) to caption, but some components may want
* them to appear one other elements too.
- *
+ *
* Events wanted by this handler are same as in Tooltip.TOOLTIP_EVENTS
- *
+ *
* @param event
* @param owner
*/
* Component may want to delegate Tooltip handling to client. Layouts add
* Tooltip (description, errors) to caption, but some components may want
* them to appear one other elements too.
- *
+ *
* Events wanted by this handler are same as in Tooltip.TOOLTIP_EVENTS
- *
+ *
* @param event
* @param owner
* @param key
/**
* Adds PNG-fix conditionally (only for IE6) to the specified IMG -element.
- *
+ *
* @param el
* the IMG element to fix
*/
* Reset the name of the current browser-window. This should reflect the
* window-name used in the server, but might be different from the
* window-object target-name on client.
- *
+ *
* @param stringAttribute
* New name for the window.
*/
* <p>
* This method can also be used to deregister tooltips by using null as
* tooltip
- *
+ *
* @param paintable
* Paintable "owning" this tooltip
* @param key
* key assosiated with given tooltip. Can be any object. For
* example a related dom element. Same key must be given for
* {@link #handleTooltipEvent(Event, Paintable, Object)} method.
- *
+ *
* @param tooltip
* the TooltipInfo object containing details shown in tooltip,
* null if deregistering tooltip
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
package com.vaadin.terminal.gwt.client;
+/**
+ * An interface used by client-side widgets or paintable parts to receive
+ * updates from the corresponding server-side components in the form of
+ * {@link UIDL}.
+ *
+ * Updates can be sent back to the server using the
+ * {@link ApplicationConnection#updateVariable()} methods.
+ */
public interface Paintable {
public void updateFromUIDL(UIDL uidl, ApplicationConnection client);
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
import com.vaadin.Application;
import com.vaadin.Application.SystemMessages;
import com.vaadin.external.org.apache.commons.fileupload.FileItemIterator;
import com.vaadin.external.org.apache.commons.fileupload.FileUpload;
import com.vaadin.external.org.apache.commons.fileupload.FileUploadException;
import com.vaadin.external.org.apache.commons.fileupload.ProgressListener;
+import com.vaadin.terminal.ApplicationResource;
import com.vaadin.terminal.DownloadStream;
import com.vaadin.terminal.PaintException;
+import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.Paintable;
import com.vaadin.terminal.URIHandler;
import com.vaadin.terminal.UploadStream;
import com.vaadin.terminal.VariableOwner;
import com.vaadin.terminal.Paintable.RepaintRequestEvent;
import com.vaadin.terminal.Terminal.ErrorEvent;
+import com.vaadin.terminal.Terminal.ErrorListener;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.server.ComponentSizeValidator.InvalidLayout;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.Upload.UploadException;
/**
- * TODO Document me!
+ * This is a common base class for the server-side implementations of the
+ * communication system between the client code (compiled with GWT into
+ * JavaScript) and the server side components. Its client side counterpart is
+ * {@link ApplicationConnection}.
+ *
+ * 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.Paintable#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)}).
+ *
+ * TODO Document better!
*/
@SuppressWarnings("serial")
public abstract class AbstractCommunicationManager implements
Paintable.RepaintRequestListener, Serializable {
/**
- * TODO Document me!
- *
+ * Generic interface of a (HTTP or Portlet) request to the application.
+ *
+ * This is a wrapper interface that allows
+ * {@link AbstractCommunicationManager} to use a unified API.
+ *
+ * @see javax.servlet.ServletRequest
+ * @see javax.portlet.PortletRequest
+ *
* @author peholmst
*/
protected interface Request {
+ /**
+ * Gets a {@link Session} wrapper implementation representing the
+ * session for which this request was sent.
+ *
+ * Multiple Vaadin applications can be associated with a single session.
+ *
+ * @return Session
+ */
public Session getSession();
+ /**
+ * Are the applications in this session running in a portlet or directly
+ * as servlets.
+ *
+ * @return true if in a portlet
+ */
public boolean isRunningInPortlet();
+ /**
+ * Get the named HTTP or portlet request parameter.
+ *
+ * @see javax.servlet.ServletRequest#getParameter(String)
+ * @see javax.portlet.PortletRequest#getParameter(String)
+ *
+ * @param name
+ * @return
+ */
public String getParameter(String name);
+ /**
+ * Returns the length of the request content that can be read from the
+ * input stream returned by {@link #getInputStream()}.
+ *
+ * @return content length in bytes
+ */
public int getContentLength();
+ /**
+ * Returns an input stream from which the request content can be read.
+ * The request content length can be obtained with
+ * {@link #getContentLength()} without reading the full stream contents.
+ *
+ * @return
+ * @throws IOException
+ */
public InputStream getInputStream() throws IOException;
+ /**
+ * Returns the request identifier that identifies the target Vaadin
+ * window for the request.
+ *
+ * @return String identifier for the request target window
+ */
public String getRequestID();
+ /**
+ * @see javax.servlet.ServletRequest#getAttribute(String)
+ * @see javax.portlet.PortletRequest#getAttribute(String)
+ */
public Object getAttribute(String name);
- public void setAttribute(String name, Object o);
+ /**
+ * @see javax.servlet.ServletRequest#setAttribute(String, Object)
+ * @see javax.portlet.PortletRequest#setAttribute(String, Object)
+ */
+ public void setAttribute(String name, Object value);
+ /**
+ * Gets the underlying request object. The request is typically either a
+ * {@link ServletRequest} or a {@link PortletRequest}.
+ *
+ * @return wrapped request object
+ */
public Object getWrappedRequest();
}
/**
- * TODO Document me!
- *
+ * Generic interface of a (HTTP or Portlet) response from the application.
+ *
+ * This is a wrapper interface that allows
+ * {@link AbstractCommunicationManager} to use a unified API.
+ *
+ * @see javax.servlet.ServletResponse
+ * @see javax.portlet.PortletResponse
+ *
* @author peholmst
*/
protected interface Response {
+ /**
+ * Gets the output stream to which the response can be written.
+ *
+ * @return
+ * @throws IOException
+ */
public OutputStream getOutputStream() throws IOException;
+ /**
+ * Sets the MIME content type for the response to be communicated to the
+ * browser.
+ *
+ * @param type
+ */
public void setContentType(String type);
+ /**
+ * Gets the wrapped response object, usually a class implementing either
+ * {@link ServletResponse} or {@link PortletResponse}.
+ *
+ * @return wrapped request object
+ */
public Object getWrappedResponse();
}
/**
+ * Generic wrapper interface for a (HTTP or Portlet) session.
+ *
+ * Several applications can be associated with a single session.
+ *
* TODO Document me!
- *
+ *
+ * @see javax.servlet.http.HttpSession
+ * @see javax.portlet.PortletSession
+ *
* @author peholmst
*/
protected interface Session {
/**
* TODO Document me!
- *
+ *
* @author peholmst
*/
protected interface Callback {
}
- // FIXME Create an abstract class with custom Request/Response/Session
- // interfaces, then create
- // subclasses for servlets and portlets.
-
private static String GET_PARAM_REPAINT_ALL = "repaintAll";
// flag used in the request to indicate that the security token should be
private static final String GET_PARAM_ANALYZE_LAYOUTS = "analyzeLayouts";
- private final ArrayList<Paintable> dirtyPaintabletSet = new ArrayList<Paintable>();
+ private final ArrayList<Paintable> dirtyPaintables = new ArrayList<Paintable>();
private final HashMap<Paintable, String> paintableIdMap = new HashMap<Paintable, String>();
/**
* TODO New constructor - document me!
- *
+ *
* @param application
*/
public AbstractCommunicationManager(Application application) {
}
/**
- * TODO New method - document me!
- *
- * @return
+ * Create an upload handler that is appropriate to the context in which the
+ * application is being run (servlet or portlet).
+ *
+ * @return new {@link FileUpload} instance
*/
protected abstract FileUpload createFileUpload();
/**
* TODO New method - document me!
- *
+ *
* @param upload
* @param request
* @return
* @throws IOException
* @throws FileUploadException
*/
- protected abstract FileItemIterator getItemIterator(FileUpload upload,
+ protected abstract FileItemIterator getUploadItemIterator(FileUpload upload,
Request request) throws IOException, FileUploadException;
/**
* TODO New method - document me!
- *
+ *
* @param request
* @param response
* @throws IOException
FileItemIterator iter;
try {
- iter = getItemIterator(upload, request);
+ iter = getUploadItemIterator(upload, request);
/*
* ATM this loop is run only once as we are uploading one file per
* request.
// ignored, upload requests contains only files
} else {
final String pid = name.split("_")[0];
- // TODO Remove debug printlns
- System.out.println("Looking up upload component with PID " + pid);
final Upload uploadComponent = (Upload) idPaintableMap
.get(pid);
if (uploadComponent == null) {
synchronized (application) {
handleChangeVariablesError(application,
uploadComponent, e,
- new HashMap<Object, Object>());
+ new HashMap<String, Object>());
}
}
}
sendUploadResponse(request, response);
}
-
+
+ /**
+ * TODO document
+ *
+ * @param request
+ * @param response
+ * @throws IOException
+ */
protected void sendUploadResponse(Request request, Response response) throws IOException {
response.setContentType("text/html");
final OutputStream out = response.getOutputStream();
}
/**
- * TODO New method - document me!
- *
+ * Internally process a UIDL request from the client.
+ *
+ * This method calls
+ * {@link #handleVariables(Request, Response, Callback, Application, Window)}
+ * to process any changes to variables by the client and then repaints
+ * affected components using {@link #paintAfterVariableChanges()}.
+ *
+ * Also, some cleanup is done when a request arrives for an application that
+ * has already been closed.
+ *
+ * The method handleUidlRequest(...) in subclasses should call this method.
+ *
+ * TODO better documentation
+ *
* @param request
* @param response
* @param callback
}
- paintAfterVariablechanges(request, response, callback, repaintAll,
+ paintAfterVariableChanges(request, response, callback, repaintAll,
outWriter, window, analyzeLayouts);
if (closingWindowName != null) {
out.close();
}
- private void paintAfterVariablechanges(Request request, Response response,
+ /**
+ * TODO document
+ *
+ * @param request
+ * @param response
+ * @param callback
+ * @param repaintAll
+ * @param outWriter
+ * @param window
+ * @param analyzeLayouts
+ * @throws PaintException
+ * @throws IOException
+ */
+ private void paintAfterVariableChanges(Request request, Response response,
Callback callback, boolean repaintAll, final PrintWriter outWriter,
Window window, boolean analyzeLayouts) throws PaintException,
IOException {
if (p.getApplication() == null) {
idPaintableMap.remove(paintableIdMap.get(p));
it.remove();
- dirtyPaintabletSet.remove(p);
+ dirtyPaintables.remove(p);
p.removeListener(this);
}
}
outWriter.print(" }");
}
+ // add any pending locale definitions requested by the client
printLocaleDeclarations(outWriter);
outWriter.print("}]");
}
/**
+ * TODO document
+ *
* If this method returns false, something was submitted that we did not
* expect; this is probably due to the client being out-of-sync and sending
* variable changes for non-existing pids
- *
+ *
* @return true if successful, false if there was an inconsistency
*/
private boolean handleVariables(Request request, Response response,
final VariableOwner owner = (VariableOwner) idPaintableMap
.get(variable[VAR_PID]);
if (owner != null && owner.isEnabled()) {
+ // TODO this should be Map<String, Object>, but the
+ // VariableOwner API does not guarantee the key is a
+ // string
Map<Object, Object> m;
if (nextVariable != null
&& variable[VAR_PID]
variable[VAR_VALUE]));
} else {
// use optimized single value map
- m = new SingleValueMap(variable[VAR_NAME],
+ m = Collections.singletonMap(
+ (Object) variable[VAR_NAME],
convertVariableValue(variable[VAR_TYPE]
.charAt(0), variable[VAR_VALUE]));
}
final PrintWriter outWriter = new PrintWriter(
new CharArrayWriter());
- paintAfterVariablechanges(request, response, callback,
+ paintAfterVariableChanges(request, response, callback,
true, outWriter, window, false);
}
/**
* Reads the request data from the Request and returns it converted to an
* UTF-8 string.
- *
+ *
* @param request
* @return
* @throws IOException
}
+ /**
+ * Handles an error (exception) that occurred when processing variable
+ * changes from the client or a failure of a file upload.
+ *
+ * For {@link AbstractField} components,
+ * {@link AbstractField#handleError(com.vaadin.ui.AbstractComponent.ComponentErrorEvent)}
+ * is called. In all other cases (or if the field does not handle the
+ * error), {@link ErrorListener#terminalError(ErrorEvent)} for the
+ * application error handler is called.
+ *
+ * @param application
+ * @param owner
+ * component that the error concerns
+ * @param e
+ * exception that occurred
+ * @param m
+ * map from variable names to values
+ */
private void handleChangeVariablesError(Application application,
- Component owner, Exception e, Map<Object, Object> m) {
+ Component owner, Exception e, Map<? extends Object, Object> m) {
boolean handled = false;
ChangeVariablesErrorEvent errorEvent = new ChangeVariablesErrorEvent(
owner, e, m);
return val;
}
+ /**
+ * Prints the queued (pending) locale definitions to a {@link PrintWriter} in
+ * a (UIDL) format that can be sent to the client and used there in formatting
+ * dates, times etc.
+ *
+ * @param outWriter
+ */
private void printLocaleDeclarations(PrintWriter outWriter) {
/*
* ----------------------------- Sending Locale sensitive date
final String timeformat = df.substring(timeStart, df.length());
/*
* Doesn't return second or milliseconds.
- *
+ *
* We use timeformat to determine 12/24-hour clock
*/
final boolean twelve_hour_clock = timeformat.indexOf("a") > -1;
/**
* TODO New method - document me!
- *
+ *
* @param request
* @param callback
* @param application
/**
* Ends the Application.
- *
+ *
+ * The browser is redirected to the Application logout URL set with
+ * {@link Application#setLogoutURL(String)}, or to the application URL if no
+ * logout URL is given.
+ *
* @param request
* the request instance.
* @param response
/**
* Gets the Paintable Id. If Paintable has debug id set it will be used
* prefixed with "PID_S". Otherwise a sequenced ID is created.
- *
+ *
* @param paintable
* @return the paintable Id.
*/
public String getPaintableId(Paintable paintable) {
- // TODO Remove debug println:s from this method
- //System.out.println("getPaintableId: " + paintable + " (" + paintable.getClass().getName() + ")");
-
+
String id = paintableIdMap.get(paintable);
if (id == null) {
// use testing identifier as id if set
} else {
id = "PID_S" + id;
}
- //System.out.println(" id: " + id);
Paintable old = idPaintableMap.put(id, paintable);
if (old != null && old != paintable) {
/*
/**
* Returns dirty components which are in given window. Components in an
* invisible subtrees are omitted.
- *
+ *
* @param w
* root window for which dirty components is to be fetched
* @return
*/
private ArrayList<Paintable> getDirtyVisibleComponents(Window w) {
final ArrayList<Paintable> resultset = new ArrayList<Paintable>(
- dirtyPaintabletSet);
+ dirtyPaintables);
// The following algorithm removes any components that would be painted
// as a direct descendant of other components from the dirty components
// list. The result is that each component should be painted exactly
// once and any unmodified components will be painted as "cached=true".
- for (final Iterator<Paintable> i = dirtyPaintabletSet.iterator(); i
+ for (final Iterator<Paintable> i = dirtyPaintables.iterator(); i
.hasNext();) {
final Paintable p = i.next();
if (p instanceof Component) {
&& !component.getParent().isVisible()) {
/*
* Do not return components in an invisible subtree.
- *
+ *
* Components that are invisible in visible subree, must
* be rendered (to let client know that they need to be
* hidden).
*/
public void repaintRequested(RepaintRequestEvent event) {
final Paintable p = event.getPaintable();
- if (!dirtyPaintabletSet.contains(p)) {
- dirtyPaintabletSet.add(p);
+ if (!dirtyPaintables.contains(p)) {
+ dirtyPaintables.add(p);
}
}
/**
- *
- * @param p
+ * Internally mark a {@link Paintable} as painted and start collecting new
+ * repaint requests for it.
+ *
+ * @param paintable
*/
- private void paintablePainted(Paintable p) {
- dirtyPaintabletSet.remove(p);
- p.requestRepaintRequests();
- }
-
- private final class SingleValueMap implements Map<Object, Object>,
- Serializable {
-
- private final String name;
-
- private final Object value;
-
- private SingleValueMap(String name, Object value) {
- this.name = name;
- this.value = value;
- }
-
- public void clear() {
- throw new UnsupportedOperationException();
- }
-
- public boolean containsKey(Object key) {
- if (name == null) {
- return key == null;
- }
- return name.equals(key);
- }
-
- public boolean containsValue(Object v) {
- if (value == null) {
- return v == null;
- }
- return value.equals(v);
- }
-
- public Set<Entry<Object, Object>> entrySet() {
- final Set<Entry<Object, Object>> s = new HashSet<Entry<Object, Object>>();
- s.add(new Map.Entry<Object, Object>() {
-
- public Object getKey() {
- return name;
- }
-
- public Object getValue() {
- return value;
- }
-
- public Object setValue(Object value) {
- throw new UnsupportedOperationException();
- }
- });
- return s;
- }
-
- public Object get(Object key) {
- if (!name.equals(key)) {
- return null;
- }
- return value;
- }
-
- public boolean isEmpty() {
- return false;
- }
-
- public Set<Object> keySet() {
- final Set<Object> s = new HashSet<Object>();
- s.add(name);
- return s;
- }
-
- public Object put(Object key, Object value) {
- throw new UnsupportedOperationException();
- }
-
- public void putAll(Map<?, ?> t) {
- throw new UnsupportedOperationException();
- }
-
- public Object remove(Object key) {
- throw new UnsupportedOperationException();
- }
-
- public int size() {
- return 1;
- }
-
- public Collection<Object> values() {
- final LinkedList<Object> s = new LinkedList<Object>();
- s.add(value);
- return s;
-
- }
+ private void paintablePainted(Paintable paintable) {
+ dirtyPaintables.remove(paintable);
+ paintable.requestRepaintRequests();
}
/**
- * Implementation of URIHandler.ErrorEvent interface.
+ * Implementation of {@link URIHandler.ErrorEvent} interface.
*/
public class URIHandlerErrorImpl implements URIHandler.ErrorEvent,
Serializable {
private final Throwable throwable;
/**
- *
+ *
* @param owner
* @param throwable
*/
}
}
+ /**
+ * Queues a locale to be sent to the client (browser) for date and time
+ * entry etc. All locale specific information is derived from server-side
+ * {@link Locale} instances and sent to the client when needed, eliminating
+ * the need to use the {@link Locale} class and all the framework behind
+ * it on the client.
+ *
+ * @see Locale#toString()
+ *
+ * @param value
+ */
public void requireLocale(String value) {
if (locales == null) {
locales = new ArrayList<String>();
}
}
+ /**
+ * Constructs a {@link Locale} instance to be sent to the client based on a
+ * short locale description string.
+ *
+ * @see #requireLocale(String)
+ *
+ * @param value
+ * @return
+ */
private Locale generateLocale(String value) {
final String[] temp = value.split("_");
if (temp.length == 1) {
/**
* Helper method to test if a component contains another
- *
+ *
* @param parent
* @param child
*/
}
/**
- * Handles the requested URI. An application can add handlers to do special
- * processing, when a certain URI is requested. The handlers are invoked
- * before any windows URIs are processed and if a DownloadStream is returned
- * it is sent to the client.
- *
- * @param application
- * the Application owning the URI.
+ * Calls the Window URI handler for a request and returns the
+ * {@link DownloadStream} returned by the handler.
+ *
+ * If the window is the main window of an application, the (deprecated)
+ * {@link Application#handleURI(java.net.URL, String)} is called first to
+ * handle {@link ApplicationResource}s, and the window handler is only
+ * called if it returns null.
+ *
+ * @param window
+ * the target window of the request
* @param request
- * the request instance.
+ * the request instance
* @param response
- * the response to write to.
- * @return boolean <code>true</code> if the request was handled and further
- * processing should be suppressed, <code>false</code> otherwise.
+ * the response to write to
+ * @return DownloadStream if the request was handled and further processing
+ * should be suppressed, null otherwise.
* @see com.vaadin.terminal.URIHandler
*/
protected DownloadStream handleURI(Window window, Request request,
/**
* Helper class for terminal to keep track of data that client is expected
* to know.
- *
+ *
* TODO make customlayout templates (from theme) to be cached here.
*/
class OpenWindowCache implements Serializable {
private Set<Object> res = new HashSet<Object>();
/**
- *
+ *
* @param paintable
* @return true if the given class was added to cache
*/
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
import com.vaadin.external.org.apache.commons.fileupload.FileUpload;
import com.vaadin.external.org.apache.commons.fileupload.FileUploadException;
import com.vaadin.external.org.apache.commons.fileupload.servlet.ServletFileUpload;
+import com.vaadin.terminal.ApplicationResource;
import com.vaadin.terminal.DownloadStream;
import com.vaadin.ui.Window;
/**
* Application manager processes changes and paints for single application
* instance.
+ *
+ * This class handles applications running as servlets.
*
+ * @see AbstractCommunicationManager
+ *
* @author IT Mill Ltd.
* @version
* @VERSION@
@SuppressWarnings("serial")
public class CommunicationManager extends AbstractCommunicationManager {
+ /**
+ * Concrete wrapper class for {@link HttpServletRequest}.
+ *
+ * @see Request
+ */
private static class HttpServletRequestWrapper implements Request {
private final HttpServletRequest request;
}
}
+ /**
+ * Concrete wrapper class for {@link HttpServletResponse}.
+ *
+ * @see Response
+ */
private static class HttpServletResponseWrapper implements Response {
private final HttpServletResponse response;
}
+ /**
+ * Concrete wrapper class for {@link HttpSession}.
+ *
+ * @see Session
+ */
private static class HttpSessionWrapper implements Session {
private final HttpSession session;
/**
* TODO New constructor - document me!
- *
+ *
* @param application
*/
public CommunicationManager(Application application) {
}
@Override
- protected FileItemIterator getItemIterator(FileUpload upload,
+ protected FileItemIterator getUploadItemIterator(FileUpload upload,
Request request) throws IOException, FileUploadException {
return ((ServletFileUpload) upload)
.getItemIterator((HttpServletRequest) request
/**
* Handles file upload request submitted via Upload component.
- *
+ *
+ * TODO document
+ *
* @param request
* @param response
* @throws IOException
/**
* Handles UIDL request
- *
+ *
+ * TODO document
+ *
* @param request
* @param response
* @throws IOException
}
/**
- * Gets the existing application or create a new one. Get a window within an
- * application based on the requested URI.
- *
+ * Gets the existing application or creates a new one. Get a window within
+ * an application based on the requested URI.
+ *
* @param request
* the HTTP Request.
* @param application
* @param assumedWindow
* if the window has been already resolved once, this parameter
* must contain the window.
- * @return Window mathing the given URI or null if not found.
+ * @return Window matching the given URI or null if not found.
* @throws ServletException
* if an exception has occurred that interferes with the
* servlet's normal operation.
}
/**
- * TODO Document me!
- *
+ * Calls the Window URI handler for a request and returns the
+ * {@link DownloadStream} returned by the handler.
+ *
+ * If the window is the main window of an application, the deprecated
+ * {@link Application#handleURI(java.net.URL, String)} is called first to
+ * handle {@link ApplicationResource}s and the window handler is only called
+ * if it returns null.
+ *
+ * @see AbstractCommunicationManager#handleURI(Window, Request, Response,
+ * Callback)
+ *
* @param window
* @param request
* @param response
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
/**
* User Interface Description Language Target.
*
+ * TODO document better: role of this class, UIDL format, attributes, variables,
+ * etc.
+ *
* @author IT Mill Ltd.
* @version
* @VERSION@
/**
* Creates a new XMLPrintWriter, without automatic line flushing.
- *
+ *
* @param variableMap
* @param manager
* @param outWriter
/**
* Prints the element start tag.
- *
+ *
* <pre>
* Todo:
* Checking of input values
- *
+ *
* </pre>
- *
+ *
* @param tagName
* the name of the start tag.
* @throws PaintException
* if the paint operation failed.
- *
+ *
*/
public void startTag(String tagName, boolean isChildNode)
throws PaintException {
/**
* Prints the element end tag.
- *
+ *
* If the parent tag is closed before every child tag is closed an
* PaintException is raised.
- *
+ *
* @param tag
* the name of the end tag.
* @throws Paintexception
/**
* Substitutes the XML sensitive characters with predefined XML entities.
- *
+ *
* @param xml
* the String to be substituted.
* @return A new string instance where all occurrences of XML sensitive
/**
* Substitutes the XML sensitive characters with predefined XML entities.
- *
+ *
* @param xml
* the String to be substituted.
* @return A new StringBuilder instance where all occurrences of XML
* sensitive characters are substituted with entities.
- *
+ *
*/
static StringBuilder escapeXML(StringBuilder xml) {
if (xml == null || xml.length() <= 0) {
/**
* Substitutes a XML sensitive character with predefined XML entity.
- *
+ *
* @param c
* the Character to be replaced with an entity.
* @return String of the entity or null if character is not to be replaced
/**
* Prints XML-escaped text.
- *
+ *
* @param str
* @throws PaintException
* if the paint operation failed.
- *
+ *
*/
public void addText(String str) throws PaintException {
tag.addData("\"" + escapeJSON(str) + "\"");
/**
* Adds a boolean attribute to component. Atributes must be added before any
* content is written.
- *
+ *
* @param name
* the Attribute name.
* @param value
/**
* Adds a resource attribute to component. Attributes must be added before
* any content is written.
- *
+ *
* @param name
* the Attribute name.
* @param value
* the Attribute value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a integer attribute to component. Atributes must be added before any
* content is written.
- *
+ *
* @param name
* the Attribute name.
* @param value
* the Attribute value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a long attribute to component. Atributes must be added before any
* content is written.
- *
+ *
* @param name
* the Attribute name.
* @param value
* the Attribute value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a float attribute to component. Atributes must be added before any
* content is written.
- *
+ *
* @param name
* the Attribute name.
* @param value
* the Attribute value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a double attribute to component. Atributes must be added before any
* content is written.
- *
+ *
* @param name
* the Attribute name.
* @param value
* the Attribute value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a string attribute to component. Atributes must be added before any
* content is written.
- *
+ *
* @param name
* the String attribute name.
* @param value
* the String attribute value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a string type variable.
- *
+ *
* @param owner
* the Listener for variable changes.
* @param name
* the Variable name.
* @param value
* the Variable initial value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a int type variable.
- *
+ *
* @param owner
* the Listener for variable changes.
* @param name
* the Variable name.
* @param value
* the Variable initial value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a long type variable.
- *
+ *
* @param owner
* the Listener for variable changes.
* @param name
* the Variable name.
* @param value
* the Variable initial value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a float type variable.
- *
+ *
* @param owner
* the Listener for variable changes.
* @param name
* the Variable name.
* @param value
* the Variable initial value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a double type variable.
- *
+ *
* @param owner
* the Listener for variable changes.
* @param name
* the Variable name.
* @param value
* the Variable initial value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a boolean type variable.
- *
+ *
* @param owner
* the Listener for variable changes.
* @param name
* the Variable name.
* @param value
* the Variable initial value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a string array type variable.
- *
+ *
* @param owner
* the Listener for variable changes.
* @param name
* the Variable name.
* @param value
* the Variable initial value.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Adds a upload stream type variable.
- *
+ *
* TODO not converted for JSON
- *
+ *
* @param owner
* the Listener for variable changes.
* @param name
* the Variable name.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/**
* Prints the single text section.
- *
+ *
* Prints full text section. The section data is escaped
- *
+ *
* @param sectionTagName
* the name of the tag.
* @param sectionData
/**
* Adds XML directly to UIDL.
- *
+ *
* @param xml
* the Xml to be added.
* @throws PaintException
/**
* Adds XML section with namespace.
- *
+ *
* @param sectionTagName
* the name of the tag.
* @param sectionData
* the namespace to be added.
* @throws PaintException
* if the paint operation failed.
- *
+ *
* @see com.vaadin.terminal.PaintTarget#addXMLSection(String, String,
* String)
*/
/**
* Gets the UIDL already printed to stream. Paint target must be closed
* before the <code>getUIDL</code> can be called.
- *
+ *
* @return the UIDL.
*/
public String getUIDL() {
* <code>getUIDL</code> can be called. Subsequent attempts to write to paint
* target. If the target was already closed, call to this function is
* ignored. will generate an exception.
- *
+ *
* @throws PaintException
* if the paint operation failed.
*/
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.terminal.PaintTarget#startTag(com.vaadin.terminal
* .Paintable, java.lang.String)
*/
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.terminal.PaintTarget#addCharacterData(java.lang.String )
*/
public void addCharacterData(String text) throws PaintException {
/**
* This is basically a container for UI components variables, that will be
* added at the end of JSON object.
- *
+ *
* @author mattitahvonen
- *
+ *
*/
class JsonTag implements Serializable {
boolean firstField = false;
}
/**
- *
+ *
* @param s
* json string, object or array
*/
/**
* Method to check if paintable is already painted into this target.
- *
+ *
* @param p
* @return true if is not yet painted into this target and is connected to
* app
}
@Override
- protected FileItemIterator getItemIterator(FileUpload upload,
+ protected FileItemIterator getUploadItemIterator(FileUpload upload,
Request request) throws IOException, FileUploadException {
return ((PortletFileUpload) upload)
.getItemIterator((ActionRequest) request.getWrappedRequest());
-/*
+/*
@ITMillApache2LicenseForJavaFiles@
*/
/**
* Application window component.
- *
+ *
* @author IT Mill Ltd.
* @version
* @VERSION@
/**
* Creates a new empty unnamed window with default layout.
- *
+ *
* <p>
* To show the window in application, it must be added to application with
* <code>Application.addWindow</code> method.
* </p>
- *
+ *
* <p>
* The windows are scrollable by default.
* </p>
- *
+ *
* @param caption
* the Title of the window.
*/
/**
* Creates a new empty window with default layout.
- *
+ *
* <p>
* To show the window in application, it must be added to application with
* <code>Application.addWindow</code> method.
* </p>
- *
+ *
* <p>
* The windows are scrollable by default.
* </p>
- *
+ *
* @param caption
* the Title of the window.
*/
/**
* Creates a new window.
- *
+ *
* <p>
* To show the window in application, it must be added to application with
* <code>Application.addWindow</code> method.
* </p>
- *
+ *
* <p>
* The windows are scrollable by default.
* </p>
- *
+ *
* @param caption
* the Title of the window.
* @param layout
/**
* Gets the terminal type.
- *
+ *
* @return the Value of property terminal.
*/
public Terminal getTerminal() {
* Gets the window of the component. Returns the window where this component
* belongs to. If the component does not yet belong to a window the returns
* null.
- *
+ *
* @return the parent window of the component.
*/
@Override
* Gets the application instance of the component. Returns the application
* where this component belongs to. If the component does not yet belong to
* a application the returns null.
- *
+ *
* @return the parent application of the component.
*/
@Override
/**
* Getter for property parent.
- *
+ *
* <p>
* Parent is the visual parent of a component. Each component can belong to
* only one ComponentContainer at time.
* </p>
- *
+ *
* <p>
* For windows attached directly to the application, parent is
* <code>null</code>. For windows inside other windows, parent is the window
* containing this window.
* </p>
- *
+ *
* @return the Value of property parent.
*/
@Override
/**
* Setter for property parent.
- *
+ *
* <p>
* Parent is the visual parent of a component. This is mostly called by
* containers add method and should not be called directly
* </p>
- *
+ *
* @param parent
* the New value of property parent.
*/
/**
* Adds the new URI handler to this window. For sub-windows, URI handlers
* are attached to root level window.
- *
+ *
* @param handler
* the URI handler to add.
*/
/**
* Removes the given URI handler from this window.
- *
+ *
* @param handler
* the URI handler to remove.
*/
}
/**
- * Handles uri recursively. Windows uri handler passes uri to all
+ * Handles URI recursively. Window URI handler passes the URI to all
* {@link URIHandler}s added to it.
* <p>
* Note, that instead of overriding this method developer should consider
- * using {@link Window#addURIHandler(URIHandler)} to add uri handler to
+ * using {@link Window#addURIHandler(URIHandler)} to add URI handler to
* Window.
- *
+ *
* @param context
* @param relativeUri
*/
/**
* Adds the new parameter handler to this window. For sub windows, parameter
* handlers are attached to parent windows.
- *
+ *
* @param handler
* the parameter handler to add.
*/
/**
* Removes the given URI handler from this window.
- *
+ *
* @param handler
* the parameter handler to remove.
*/
/**
* Gets the theme for this window.
- *
+ *
* <p>
* Subwindows do not support themes and thus return theme used by the parent
* </p>
- *
+ *
* @return the Name of the theme used in window. If the theme for this
* individual window is not explicitly set, the application theme is
* used instead. If application is not assigned the
/**
* Sets the theme for this window.
- *
+ *
* Setting theme for subwindows is not supported.
- *
+ *
* The terminal will reload its host page on theme changes.
- *
+ *
* @param theme
* the New theme for this window. Null implies the default theme.
*/
/**
* Paints the content of this component.
- *
+ *
* @param event
* the Paint Event.
* @throws PaintException
/**
* Opens the given resource in this window.
- *
+ *
* @param resource
*/
public void open(Resource resource) {
* Opens the given resource in named terminal window. Empty or
* <code>null</code> window name results the resource to be opened in this
* window.
- *
+ *
* <p>
* Note! When opening browser window with name "_self", client will skip
* rendering rest of the changes as it considers them irrelevant. This may
* inconsistent state with server in case nothing is actually opened to
* window (like if browser decided to download the resource instead of
* displaying it).
- *
+ *
* @param resource
* the resource.
* @param windowName
* Opens the given resource in named terminal window with given size and
* border properties. Empty or <code>null</code> window name results the
* resource to be opened in this window.
- *
+ *
* @param resource
* @param windowName
* @param width
/**
* Returns the full url of the window, this returns window specific url even
* for the main window.
- *
+ *
* @return the URL of the window.
*/
public URL getURL() {
/**
* Gets the unique name of the window that indentifies it on the terminal.
- *
+ *
* <p>
* Name identifies the URL used to access application-level windows, but is
* not used for windows inside other windows. all application-level windows
* inside other windows - these windows show as smaller windows inside those
* windows.
* </p>
- *
+ *
* @return the Name of the Window.
*/
public String getName() {
/**
* Returns the border.
- *
+ *
* @return the border.
*/
public int getBorder() {
/**
* Sets the border.
- *
+ *
* @param border
* the border to set.
*/
/**
* Sets the application this window is connected to.
- *
+ *
* <p>
* This method should not be invoked directly. Instead the
* {@link com.vaadin.Application#addWindow(Window)} method should be used to
* {@link com.vaadin.Application#removeWindow(Window)} method for removing
* the window from the applicion. These methods call this method implicitly.
* </p>
- *
+ *
* <p>
* The method invokes {@link Component#attach()} and
* {@link Component#detach()} methods when necessary.
* <p>
- *
+ *
* @param application
* the application to set.
*/
* <p>
* The name of the window must be unique inside the application.
* </p>
- *
+ *
* <p>
* If the name is null, the the window is given name automatically when it
* is added to an application.
* </p>
- *
+ *
* @param name
* the name to set.
*/
/**
* Sets the terminal type. The terminal type is set by the the terminal
* adapter and may change from time to time.
- *
+ *
* @param type
* the terminal type to set.
*/
/**
* Creates a new open resource.
- *
+ *
* @param resource
* @param name
* @param width
/**
* Paints the open-tag inside the window.
- *
+ *
* @param target
* the Paint Event.
* @throws PaintException
/**
* Called when one or more variables handled by the implementing class are
* changed.
- *
+ *
* @see com.vaadin.terminal.VariableOwner#changeVariables(java.lang.Object,
* java.util.Map)
*/
/**
* Method that handles window closing (from UI).
- *
+ *
* <p>
* By default, sub-windows are removed from their respective parent windows
* and thus visually closed on browser-side. Browser-level windows also
* closed on the client-side, but they are not implicitly removed from the
* application.
* </p>
- *
+ *
* <p>
* If one wants change the default behavior, register a window close
* listenter and do something else. For example, you could re-open the
/**
* Gets the distance of Window left border in pixels from left border of the
* containing (main window).
- *
+ *
* @return the Distance of Window left border in pixels from left border of
* the containing (main window). or -1 if unspecified.
* @since 4.0.0
/**
* Sets the distance of Window left border in pixels from left border of the
* containing (main window).
- *
+ *
* @param positionX
* the Distance of Window left border in pixels from left border
* of the containing (main window). or -1 if unspecified.
/**
* Gets the distance of Window top border in pixels from top border of the
* containing (main window).
- *
+ *
* @return Distance of Window top border in pixels from top border of the
* containing (main window). or -1 if unspecified .
- *
+ *
* @since 4.0.0
*/
public int getPositionY() {
/**
* Sets the distance of Window top border in pixels from top border of the
* containing (main window).
- *
+ *
* @param positionY
* the Distance of Window top border in pixels from top border of
* the containing (main window). or -1 if unspecified
- *
+ *
* @since 4.0.0
*/
public void setPositionY(int positionY) {
public class CloseEvent extends Component.Event {
/**
- *
+ *
* @param source
*/
public CloseEvent(Component source) {
/**
* Gets the Window.
- *
+ *
* @return the window.
*/
public Window getWindow() {
/**
* Adds the listener.
- *
+ *
* @param listener
* the listener to add.
*/
/**
* Removes the listener.
- *
+ *
* @param listener
* the listener to remove.
*/
public class ResizeEvent extends Component.Event {
/**
- *
+ *
* @param source
*/
public ResizeEvent(Component source) {
/**
* Get the window form which this event originated
- *
+ *
* @return the window
*/
public Window getWindow() {
/**
* Listener for window resize events.
- *
+ *
* @see com.vaadin.ui.Window.ResizeEvent
*/
public interface ResizeListener extends Serializable {
/**
* Add a resize listener.
- *
+ *
* @param listener
*/
public void addListener(ResizeListener listener) {
/**
* Remove a resize listener.
- *
+ *
* @param listener
*/
public void removeListener(ResizeListener listener) {
/**
* Adds a window inside another window.
- *
+ *
* <p>
* Adding windows inside another window creates "subwindows". These windows
* should not be added to application directly and are not accessible
* directly with any url. Addding windows implicitly sets their parents.
* </p>
- *
+ *
* <p>
* Only one level of subwindows are supported. Thus you can add windows
* inside such windows whose parent is <code>null</code>.
* </p>
- *
+ *
* @param window
* @throws IllegalArgumentException
* if a window is added inside non-application level window.
/**
* Remove the given subwindow from this window.
- *
+ *
* @param window
* Window to be removed.
*/
/**
* Get the set of all child windows.
- *
+ *
* @return Set of child windows.
*/
public Set<Window> getChildWindows() {
/**
* Sets sub-window modal, so that widgets behind it cannot be accessed.
* <b>Note:</b> affects sub-windows only.
- *
+ *
* @param modality
* true if modality is to be turned on
*/
/**
* Sets sub-window resizable. <b>Note:</b> affects sub-windows only.
- *
+ *
* @param resizable
* true if resizability is to be turned on
*/
}
/**
- *
+ *
* @return true if window is resizable by the end-user, otherwise false.
*/
public boolean isResizable() {
/**
* Shows a notification message on the middle of the window. The message
* automatically disappears ("humanized message").
- *
+ *
* @see #showNotification(com.vaadin.ui.Window.Notification)
* @see Notification
- *
+ *
* @param caption
* The message
*/
* Shows a notification message the window. The position and behavior of the
* message depends on the type, which is one of the basic types defined in
* {@link Notification}, for instance Notification.TYPE_WARNING_MESSAGE.
- *
+ *
* @see #showNotification(com.vaadin.ui.Window.Notification)
* @see Notification
- *
+ *
* @param caption
* The message
* @param type
* Shows a notification consisting of a bigger caption and a smaller
* description on the middle of the window. The message automatically
* disappears ("humanized message").
- *
+ *
* @see #showNotification(com.vaadin.ui.Window.Notification)
* @see Notification
- *
+ *
* @param caption
* The caption of the message
* @param description
* The message description
- *
+ *
*/
public void showNotification(String caption, String description) {
addNotification(new Notification(caption, description));
* description. The position and behavior of the message depends on the
* type, which is one of the basic types defined in {@link Notification},
* for instance Notification.TYPE_WARNING_MESSAGE.
- *
+ *
* @see #showNotification(com.vaadin.ui.Window.Notification)
* @see Notification
- *
+ *
* @param caption
* The caption of the message
* @param description
/**
* Shows a notification message.
- *
+ *
* @see Notification
* @see #showNotification(String)
* @see #showNotification(String, int)
* @see #showNotification(String, String)
* @see #showNotification(String, String, int)
- *
+ *
* @param notification
* The notification message to show
*/
* Component.Focusable) due we want the last focused component to be focused
* in client too. Not the one that is rendered last (the case we'd get if
* implemented in Focusable only).
- *
+ *
* To focus component from Vaadin application, use Focusable.focus(). See
* {@link Focusable}.
- *
+ *
* @param focusable
* to be focused on next paint
*/
* configured to show up in a custom position, for a specified time (or
* until clicked), and with a custom stylename. An icon can also be added.
* </p>
- *
+ *
*/
public static class Notification implements Serializable {
public static final int TYPE_HUMANIZED_MESSAGE = 1;
/**
* Creates a "humanized" notification message.
- *
+ *
* @param caption
* The message to show
*/
/**
* Creates a notification message of the specified type.
- *
+ *
* @param caption
* The message to show
* @param type
/**
* Creates a "humanized" notification message with a bigger caption and
* smaller description.
- *
+ *
* @param caption
* The message caption
* @param description
/**
* Creates a notification message of the specified type, with a bigger
* caption and smaller description.
- *
+ *
* @param caption
* The message caption
* @param description
/**
* Gets the caption part of the notification message.
- *
+ *
* @return The message caption
*/
public String getCaption() {
/**
* Sets the caption part of the notification message
- *
+ *
* @param caption
* The message caption
*/
/**
* Gets the description part of the notification message.
- *
+ *
* @return The message description.
*/
public String getDescription() {
/**
* Sets the description part of the notification message.
- *
+ *
* @param description
*/
public void setDescription(String description) {
/**
* Gets the position of the notification message.
- *
+ *
* @return The position
*/
public int getPosition() {
/**
* Sets the position of the notification message.
- *
+ *
* @param position
* The desired notification position
*/
/**
* Gets the icon part of the notification message.
- *
+ *
* @return The message icon
*/
public Resource getIcon() {
/**
* Sets the icon part of the notification message.
- *
+ *
* @param icon
* The desired message icon
*/
/**
* Gets the delay before the notification disappears.
- *
+ *
* @return the delay in msec, -1 indicates the message has to be
* clicked.
*/
/**
* Sets the delay before the notification disappears.
- *
+ *
* @param delayMsec
* the desired delay in msec, -1 to require the user to click
* the message
/**
* Sets the style name for the notification message.
- *
+ *
* @param styleName
* The desired style name.
*/
/**
* Gets the style name for the notification message.
- *
+ *
* @return
*/
public String getStyleName() {
/**
* Executes JavaScript in this window.
- *
+ *
* <p>
* This method allows one to inject javascript from the server to client. A
* client implementation is not required to implement this functionality,
* but currently all web-based clients do implement this.
* </p>
- *
+ *
* <p>
* Executing javascript this way often leads to cross-browser compatibility
* issues and regressions that are hard to resolve. Use of this method
* with GWT. For more info on creating own, reusable client-side widgets in
* Java, read the corresponding chapter in Book of Vaadin.
* </p>
- *
+ *
* @param script
* JavaScript snippet that will be executed.
*/