@@ -11,8 +11,8 @@ import com.vaadin.data.Property; | |||
/** | |||
* A simple data object containing one typed value. This class is a | |||
* straightforward implementation of the the | |||
* {@link com.vaadin.data.Property} interface. | |||
* straightforward implementation of the the {@link com.vaadin.data.Property} | |||
* interface. | |||
* | |||
* @author IT Mill Ltd. | |||
* @version |
@@ -2,8 +2,7 @@ package com.vaadin.data.validator; | |||
/** | |||
* Validator base class for validating strings. See | |||
* {@link com.vaadin.data.validator.AbstractValidator} for more | |||
* information. | |||
* {@link com.vaadin.data.validator.AbstractValidator} for more information. | |||
* | |||
* <p> | |||
* If the validation fails, the exception thrown contains the error message with |
@@ -3,8 +3,8 @@ package com.vaadin.data.validator; | |||
import com.vaadin.data.Validator; | |||
/** | |||
* Default Validator base class. See | |||
* {@link com.vaadin.data.validator.Validator} for more information. | |||
* Default Validator base class. See {@link com.vaadin.data.validator.Validator} | |||
* for more information. | |||
* <p> | |||
* If the validation fails, the exception thrown contains the error message with | |||
* its argument 0 replaced with the toString() of the object being validated. |
@@ -5,8 +5,8 @@ package com.vaadin.data.validator; | |||
* complete according to RFC 822 but handles the vast majority of valid e-mail | |||
* addresses correctly. | |||
* | |||
* See {@link com.vaadin.data.validator.AbstractStringValidator} for | |||
* more information. | |||
* See {@link com.vaadin.data.validator.AbstractStringValidator} for more | |||
* information. | |||
* | |||
* @author IT Mill Ltd. | |||
* @version |
@@ -23,6 +23,7 @@ public interface FieldEvents { | |||
* class really will send the events, or if it just defines the methods to | |||
* be able to implement an interface. | |||
* </p> | |||
* | |||
* @since 6.2 | |||
* @see FocusListener | |||
* @see FocusEvent | |||
@@ -60,6 +61,7 @@ public interface FieldEvents { | |||
* class really will send the events, or if it just defines the methods to | |||
* be able to implement an interface. | |||
* </p> | |||
* | |||
* @since 6.2 | |||
* @see BlurListener | |||
* @see BlurEvent |
@@ -14,8 +14,7 @@ import java.lang.reflect.Method; | |||
* | |||
* <p> | |||
* For more information on the inheritable event mechanism see the | |||
* {@link com.vaadin.event com.vaadin.event package | |||
* documentation}. | |||
* {@link com.vaadin.event com.vaadin.event package documentation}. | |||
* </p> | |||
* | |||
* @author IT Mill Ltd. | |||
@@ -35,8 +34,7 @@ public interface MethodEventSource extends Serializable { | |||
* | |||
* <p> | |||
* For more information on the inheritable event mechanism see the | |||
* {@link com.vaadin.event com.vaadin.event package | |||
* documentation}. | |||
* {@link com.vaadin.event com.vaadin.event package documentation}. | |||
* </p> | |||
* | |||
* @param eventType | |||
@@ -69,8 +67,7 @@ public interface MethodEventSource extends Serializable { | |||
* | |||
* <p> | |||
* For more information on the inheritable event mechanism see the | |||
* {@link com.vaadin.event com.vaadin.event package | |||
* documentation}. | |||
* {@link com.vaadin.event com.vaadin.event package documentation}. | |||
* </p> | |||
* | |||
* @param eventType | |||
@@ -95,8 +92,7 @@ public interface MethodEventSource extends Serializable { | |||
* | |||
* <p> | |||
* For more information on the inheritable event mechanism see the | |||
* {@link com.vaadin.event com.vaadin.event package | |||
* documentation}. | |||
* {@link com.vaadin.event com.vaadin.event package documentation}. | |||
* </p> | |||
* | |||
* @param eventType | |||
@@ -114,8 +110,7 @@ public interface MethodEventSource extends Serializable { | |||
* | |||
* <p> | |||
* For more information on the inheritable event mechanism see the | |||
* {@link com.vaadin.event com.vaadin.event package | |||
* documentation}. | |||
* {@link com.vaadin.event com.vaadin.event package documentation}. | |||
* </p> | |||
* | |||
* @param eventType | |||
@@ -145,8 +140,7 @@ public interface MethodEventSource extends Serializable { | |||
* | |||
* <p> | |||
* For more information on the inheritable event mechanism see the | |||
* {@link com.vaadin.event com.vaadin.event package | |||
* documentation}. | |||
* {@link com.vaadin.event com.vaadin.event package documentation}. | |||
* </p> | |||
* | |||
* @param eventType |
@@ -35,33 +35,35 @@ public class BrowserLauncher { | |||
// See if the default browser is Konqueror by resolving the symlink. | |||
boolean isDefaultKonqueror = false; | |||
try { | |||
// Find out the location of the x-www-browser link from path. | |||
Process process = runtime.exec("which x-www-browser"); | |||
BufferedInputStream ins = new BufferedInputStream(process.getInputStream()); | |||
BufferedReader bufreader = new BufferedReader(new InputStreamReader(ins)); | |||
String defaultLinkPath = bufreader.readLine(); | |||
ins.close(); | |||
// The path is null if the link did not exist. | |||
if (defaultLinkPath != null) { | |||
// See if the default browser is Konqueror. | |||
File file = new File(defaultLinkPath); | |||
String canonical = file.getCanonicalPath(); | |||
if (canonical.indexOf("konqueror") != -1) | |||
isDefaultKonqueror = true; | |||
} | |||
// Find out the location of the x-www-browser link from path. | |||
Process process = runtime.exec("which x-www-browser"); | |||
BufferedInputStream ins = new BufferedInputStream(process | |||
.getInputStream()); | |||
BufferedReader bufreader = new BufferedReader( | |||
new InputStreamReader(ins)); | |||
String defaultLinkPath = bufreader.readLine(); | |||
ins.close(); | |||
// The path is null if the link did not exist. | |||
if (defaultLinkPath != null) { | |||
// See if the default browser is Konqueror. | |||
File file = new File(defaultLinkPath); | |||
String canonical = file.getCanonicalPath(); | |||
if (canonical.indexOf("konqueror") != -1) | |||
isDefaultKonqueror = true; | |||
} | |||
} catch (IOException e1) { | |||
// The symlink was probably not found, so this is ok. | |||
// The symlink was probably not found, so this is ok. | |||
} | |||
// Try x-www-browser, which is symlink to the default browser, | |||
// except if we found that it is Konqueror. | |||
if (!started && !isDefaultKonqueror) { | |||
try { | |||
runtime.exec("x-www-browser " + url); | |||
started = true; | |||
} catch (final IOException e) { | |||
} | |||
try { | |||
runtime.exec("x-www-browser " + url); | |||
started = true; | |||
} catch (final IOException e) { | |||
} | |||
} | |||
// Try firefox |
@@ -15,7 +15,7 @@ import java.io.Serializable; | |||
* @VERSION@ | |||
* @since 3.0 | |||
*/ | |||
public interface Resource extends Serializable{ | |||
public interface Resource extends Serializable { | |||
/** | |||
* Gets the MIME type of the resource. |
@@ -15,7 +15,7 @@ import java.io.Serializable; | |||
* @VERSION@ | |||
* @since 3.0 | |||
*/ | |||
public interface Sizeable extends Serializable{ | |||
public interface Sizeable extends Serializable { | |||
/** | |||
* Unit code representing pixels. |
@@ -40,7 +40,7 @@ public interface Terminal extends Serializable { | |||
/** | |||
* Terminal error event. | |||
*/ | |||
public interface ErrorEvent extends Serializable{ | |||
public interface ErrorEvent extends Serializable { | |||
/** | |||
* Gets the contained throwable. | |||
@@ -52,7 +52,7 @@ public interface Terminal extends Serializable { | |||
/** | |||
* Terminal error listener interface. | |||
*/ | |||
public interface ErrorListener extends Serializable{ | |||
public interface ErrorListener extends Serializable { | |||
/** | |||
* Invoked when terminal error occurs. |
@@ -8,7 +8,7 @@ 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. | |||
*/ |
@@ -42,9 +42,13 @@ import com.google.gwt.user.client.ui.Widget; | |||
* <img class='gallery' src='MenuBar.png'/> | |||
* </p> | |||
* | |||
* <h3>CSS Style Rules</h3> <ul class='css'> <li>.gwt-MenuBar { the menu bar | |||
* itself }</li> <li>.gwt-MenuBar .gwt-MenuItem { menu items }</li> <li> | |||
* .gwt-MenuBar .gwt-MenuItem-selected { selected menu items }</li> </ul> | |||
* <h3>CSS Style Rules</h3> | |||
* <ul class='css'> | |||
* <li>.gwt-MenuBar { the menu bar itself }</li> | |||
* <li>.gwt-MenuBar .gwt-MenuItem { menu items }</li> | |||
* <li> | |||
* .gwt-MenuBar .gwt-MenuItem-selected { selected menu items }</li> | |||
* </ul> | |||
* | |||
* <p> | |||
* <h3>Example</h3> |
@@ -263,7 +263,7 @@ public class VCalendarPanel extends FlexTable implements MouseListener { | |||
} | |||
/** | |||
* | |||
* | |||
* @param forceRedraw | |||
* Build all from scratch, in case of e.g. locale changes | |||
*/ | |||
@@ -447,8 +447,8 @@ public class VCalendarPanel extends FlexTable implements MouseListener { | |||
Object sender = event.getSource(); | |||
Cell cell = cal.days.getCellForEvent(event); | |||
if (sender != cal.days || cell == null || cell.getRowIndex() < 1 | |||
|| cell.getRowIndex() > 6 | |||
|| !cal.datefield.isEnabled() || cal.datefield.isReadonly()) { | |||
|| cell.getRowIndex() > 6 || !cal.datefield.isEnabled() | |||
|| cal.datefield.isReadonly()) { | |||
return; | |||
} | |||
@@ -540,7 +540,7 @@ public class VCalendarPanel extends FlexTable implements MouseListener { | |||
/** | |||
* Sets focus to Calendar panel. | |||
* | |||
* | |||
* @param focus | |||
*/ | |||
public void setFocus(boolean focus) { |
@@ -93,7 +93,7 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field, | |||
boolean overflowRight = false; | |||
if (l + +w + extraSpace > browserWindowWidth) { | |||
overflowRight = true; | |||
// Part of the popup is outside the browser window | |||
// Part of the popup is outside the browser window | |||
// (to the right) | |||
l = browserWindowWidth - w - extraSpace; | |||
} |
@@ -153,12 +153,12 @@ public class VPopupView extends HTML implements Container, Iterable<Widget> { | |||
/** | |||
* Determines the correct position for a popup and displays the popup at | |||
* that position. | |||
* | |||
* | |||
* By default, the popup is shown centered relative to its host component, | |||
* ensuring it is visible on the screen if possible. | |||
* | |||
* | |||
* Can be overridden to customize the popup position. | |||
* | |||
* | |||
* @param popup | |||
*/ | |||
protected void showPopup(final CustomPopup popup) { |
@@ -14,7 +14,7 @@ import com.vaadin.terminal.gwt.client.UIDL; | |||
/** | |||
* Client side implementation for UriFragmentUtility. Uses GWT's History object | |||
* as an implementation. | |||
* | |||
* | |||
*/ | |||
public class VUriFragmentUtility extends Widget implements Paintable, | |||
ValueChangeHandler<String> { |
@@ -40,7 +40,7 @@ public class ChildComponentContainer extends Panel { | |||
private int captionHeight = 0; | |||
/** | |||
* | |||
* | |||
* Padding added to the container when it is larger than the component. | |||
*/ | |||
private Size containerExpansion = new Size(0, 0); | |||
@@ -189,14 +189,14 @@ public class ChildComponentContainer extends Panel { | |||
/* | |||
* Must remove width specification from container before rendering to | |||
* allow components to grow in horizontal direction. | |||
* | |||
* | |||
* For fixed width layouts we specify the width directly so that height | |||
* is automatically calculated correctly (e.g. for Labels). | |||
*/ | |||
/* | |||
* This should no longer be needed (after #2563) as all components are | |||
* such that they can be rendered inside a 0x0 DIV. | |||
* | |||
* | |||
* The exception seems to be complex components (Tree and Table) on | |||
* Opera (#3444). | |||
*/ | |||
@@ -611,7 +611,7 @@ public class ChildComponentContainer extends Panel { | |||
/** | |||
* Return true if the size of the widget has been specified in the selected | |||
* orientation. | |||
* | |||
* | |||
* @return | |||
*/ | |||
public boolean widgetHasSizeSpecified(int orientation) { | |||
@@ -654,7 +654,7 @@ public class ChildComponentContainer extends Panel { | |||
/** | |||
* Sets the normalized expand ratio of this slot. The fraction that this | |||
* slot will use of "excess space". | |||
* | |||
* | |||
* @param expandRatio | |||
*/ | |||
public void setNormalizedExpandRatio(double expandRatio) { |
@@ -319,7 +319,7 @@ public class VRichTextToolbar extends Composite { | |||
/** | |||
* Creates a new toolbar that drives the given rich text area. | |||
* | |||
* | |||
* @param richText | |||
* the rich text area to be controlled | |||
*/ |
@@ -51,7 +51,7 @@ import com.vaadin.ui.Window; | |||
/** | |||
* TODO Document me! | |||
* | |||
* | |||
* @author peholmst | |||
*/ | |||
public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
@@ -136,7 +136,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
/** | |||
* Gets an application property value. | |||
* | |||
* | |||
* @param parameterName | |||
* the Name or the parameter. | |||
* @return String value or null if not found | |||
@@ -157,7 +157,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
/** | |||
* Gets an system property value. | |||
* | |||
* | |||
* @param parameterName | |||
* the Name or the parameter. | |||
* @return String value or null if not found | |||
@@ -186,7 +186,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
/** | |||
* Gets an application or system property value. | |||
* | |||
* | |||
* @param parameterName | |||
* the Name or the parameter. | |||
* @param defaultValue | |||
@@ -217,7 +217,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
* Return the URL from where static files, e.g. the widgetset and the theme, | |||
* are served. In a standard configuration the VAADIN folder inside the | |||
* returned folder is what is used for widgetsets and themes. | |||
* | |||
* | |||
* @param request | |||
* @return The location of static resources (inside which there should be a | |||
* VAADIN directory). Does not end with a slash (/). | |||
@@ -292,7 +292,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
/** | |||
* Returns true if the servlet is running in production mode. Production | |||
* mode disables all debug facilities. | |||
* | |||
* | |||
* @return true if in production mode, false if in debug mode | |||
*/ | |||
public boolean isProductionMode() { | |||
@@ -655,15 +655,15 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
* application with window names identical to the portlet mode names. | |||
* Alternatively, a PortletListener can change the application main window | |||
* contents. | |||
* | |||
* | |||
* To implement custom portlet modes, subclass the portlet class and | |||
* implement a method annotated with {@link RenderMode} for the custom mode, | |||
* calling {@link #handleRequest(PortletRequest, PortletResponse)} directly | |||
* from it. | |||
* | |||
* | |||
* Note that the portlet class in the portlet configuration needs to be | |||
* changed when overriding methods of this class. | |||
* | |||
* | |||
* @param request | |||
* @param response | |||
* @throws PortletException | |||
@@ -677,7 +677,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
/** | |||
* Handle a request for the "edit" portlet mode. | |||
* | |||
* | |||
* @see #doView(RenderRequest, RenderResponse) | |||
*/ | |||
@Override | |||
@@ -688,7 +688,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
/** | |||
* Handle a request for the "help" portlet mode. | |||
* | |||
* | |||
* @see #doView(RenderRequest, RenderResponse) | |||
*/ | |||
@Override | |||
@@ -1012,7 +1012,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
/** | |||
* Returns the theme for given request/window | |||
* | |||
* | |||
* @param request | |||
* @param window | |||
* @return | |||
@@ -1063,7 +1063,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
/** | |||
* Get system messages from the current application class | |||
* | |||
* | |||
* @return | |||
*/ | |||
protected SystemMessages getSystemMessages() { | |||
@@ -1136,7 +1136,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet | |||
* Send notification to client's application. Used to notify client of | |||
* critical errors and session expiration due to long inactivity. Server has | |||
* no knowledge of what application client refers to. | |||
* | |||
* | |||
* @param request | |||
* the Portlet request instance. | |||
* @param response |
@@ -43,7 +43,7 @@ public abstract class AbstractWebApplicationContext implements | |||
/** | |||
* Sends a notification that a transaction is starting. | |||
* | |||
* | |||
* @param application | |||
* The application associated with the transaction. | |||
* @param request | |||
@@ -59,7 +59,7 @@ public abstract class AbstractWebApplicationContext implements | |||
/** | |||
* Sends a notification that a transaction has ended. | |||
* | |||
* | |||
* @param application | |||
* The application associated with the transaction. | |||
* @param request | |||
@@ -130,11 +130,11 @@ public abstract class AbstractWebApplicationContext implements | |||
/** | |||
* Get the web browser associated with this application context. | |||
* | |||
* | |||
* Because application context is related to the http session and server | |||
* maintains one session per browser-instance, each context has exactly one | |||
* web browser associated with it. | |||
* | |||
* | |||
* @return | |||
*/ | |||
public WebBrowser getBrowser() { | |||
@@ -150,8 +150,8 @@ public abstract class AbstractWebApplicationContext implements | |||
applicationToAjaxAppMgrMap.remove(application); | |||
} | |||
public String generateApplicationResourceURL( | |||
ApplicationResource resource, String mapKey) { | |||
public String generateApplicationResourceURL(ApplicationResource resource, | |||
String mapKey) { | |||
final String filename = resource.getFilename(); | |||
if (filename == null) { |
@@ -182,7 +182,7 @@ public class ApplicationPortlet implements Portlet, Serializable { | |||
* servlet to extend the session lifetime after each Vaadin | |||
* request. This hack can be removed when supporting portlet | |||
* 2.0 and resourceRequests. | |||
* | |||
* | |||
* TODO make this configurable, this is not necessary with | |||
* some custom session configurations. | |||
*/ |
@@ -89,7 +89,7 @@ public class ApplicationRunnerServlet extends AbstractApplicationServlet { | |||
/** | |||
* Parses application runner URIs. | |||
* | |||
* | |||
* If request URL is e.g. | |||
* http://localhost:8080/vaadin/run/com.vaadin.demo.Calc then | |||
* <ul> | |||
@@ -97,7 +97,7 @@ public class ApplicationRunnerServlet extends AbstractApplicationServlet { | |||
* <li>Runner servlet=run</li> | |||
* <li>Vaadin application=com.vaadin.demo.Calc</li> | |||
* </ul> | |||
* | |||
* | |||
* @param request | |||
* @return string array containing widgetset URI, application URI and | |||
* context, runner, application classname |
@@ -2,9 +2,9 @@ package com.vaadin.terminal.gwt.server; | |||
/** | |||
* TODO Document me! | |||
* | |||
* | |||
* @author peholmst | |||
* | |||
* | |||
*/ | |||
public interface Constants { | |||
@@ -24,7 +24,7 @@ import com.vaadin.terminal.Terminal; | |||
* <p> | |||
* Alternatives for implementing similar features are are Servlet {@link Filter} | |||
* s and {@link TransactionListener}s in Vaadin. | |||
* | |||
* | |||
* @since 6.2 | |||
* @see PortletRequestListener | |||
*/ | |||
@@ -33,7 +33,7 @@ public interface HttpServletRequestListener extends Serializable { | |||
/** | |||
* This method is called before {@link Terminal} applies the request to | |||
* Application. | |||
* | |||
* | |||
* @param request | |||
* @param response | |||
*/ | |||
@@ -42,7 +42,7 @@ public interface HttpServletRequestListener extends Serializable { | |||
/** | |||
* This method is called at the end of each request. | |||
* | |||
* | |||
* @param request | |||
* @param response | |||
*/ |
@@ -15,8 +15,7 @@ import java.io.InputStream; | |||
* @since 5.0 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class HttpUploadStream implements | |||
com.vaadin.terminal.UploadStream { | |||
public class HttpUploadStream implements com.vaadin.terminal.UploadStream { | |||
/** | |||
* Holds value of property variableName. |
@@ -34,10 +34,10 @@ import com.vaadin.ui.Window; | |||
/** | |||
* TODO Write documentation, fix JavaDoc tags. | |||
* | |||
* | |||
* This is automatically registered as a {@link HttpSessionBindingListener} when | |||
* {@link PortletSession#setAttribute()} is called with the context as value. | |||
* | |||
* | |||
* @author peholmst | |||
*/ | |||
@SuppressWarnings("serial") | |||
@@ -144,7 +144,8 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { | |||
Set<PortletListener> listeners = portletListeners.get(app); | |||
if (listeners != null) { | |||
for (PortletListener l : listeners) { | |||
l.handleRenderRequest(request, new RestrictedRenderResponse(response)); | |||
l.handleRenderRequest(request, new RestrictedRenderResponse( | |||
response)); | |||
} | |||
} | |||
} | |||
@@ -154,8 +155,8 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { | |||
String key = request.getParameter(ActionRequest.ACTION_NAME); | |||
if (eventActionDestinationMap.containsKey(key)) { | |||
// this action request is only to send queued portlet events | |||
response.setEvent(eventActionDestinationMap.get(key), eventActionValueMap | |||
.get(key)); | |||
response.setEvent(eventActionDestinationMap.get(key), | |||
eventActionValueMap.get(key)); | |||
// cleanup | |||
eventActionDestinationMap.remove(key); | |||
eventActionValueMap.remove(key); | |||
@@ -214,9 +215,9 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { | |||
/** | |||
* This is for use by {@link AbstractApplicationPortlet} only. | |||
* | |||
* | |||
* TODO cleaner implementation, now "semi-static"! | |||
* | |||
* | |||
* @param mimeResponse | |||
*/ | |||
void setResponse(PortletResponse response) { | |||
@@ -224,8 +225,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { | |||
} | |||
@Override | |||
public String generateApplicationResourceURL( | |||
ApplicationResource resource, | |||
public String generateApplicationResourceURL(ApplicationResource resource, | |||
String mapKey) { | |||
if (response instanceof MimeResponse) { | |||
ResourceURL resourceURL = ((MimeResponse) response) | |||
@@ -245,7 +245,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { | |||
/** | |||
* Creates a new action URL. | |||
* | |||
* | |||
* @param action | |||
* @return action URL or null if called outside a MimeRequest (outside a | |||
* UIDL request or similar) | |||
@@ -263,16 +263,16 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { | |||
/** | |||
* Sends a portlet event to the indicated destination. | |||
* | |||
* | |||
* Internally, an action may be created and opened, as an event cannot be | |||
* sent directly from all types of requests. | |||
* | |||
* | |||
* The event destinations and values need to be kept in the context until | |||
* sent. Any memory leaks if the action fails are limited to the session. | |||
* | |||
* | |||
* Event names for events sent and received by a portlet need to be declared | |||
* in portlet.xml . | |||
* | |||
* | |||
* @param window | |||
* a window in which a temporary action URL can be opened if | |||
* necessary | |||
@@ -310,16 +310,16 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { | |||
/** | |||
* Sets a shared portlet parameter. | |||
* | |||
* | |||
* Internally, an action may be created and opened, as shared parameters | |||
* cannot be set directly from all types of requests. | |||
* | |||
* | |||
* The parameters and values need to be kept in the context until sent. Any | |||
* memory leaks if the action fails are limited to the session. | |||
* | |||
* | |||
* Shared parameters set or read by a portlet need to be declared in | |||
* portlet.xml . | |||
* | |||
* | |||
* @param window | |||
* a window in which a temporary action URL can be opened if | |||
* necessary | |||
@@ -356,9 +356,9 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { | |||
/** | |||
* Sets the portlet mode. This may trigger a new render request. | |||
* | |||
* | |||
* Portlet modes used by a portlet need to be declared in portlet.xml . | |||
* | |||
* | |||
* @param window | |||
* a window in which the render URL can be opened if necessary | |||
* @param portletMode |
@@ -24,9 +24,9 @@ import com.vaadin.ui.Window; | |||
/** | |||
* TODO document me! | |||
* | |||
* | |||
* @author peholmst | |||
* | |||
* | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class PortletCommunicationManager extends AbstractCommunicationManager { | |||
@@ -168,7 +168,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { | |||
/** | |||
* Find the application window to use based on the portlet mode. For | |||
* internal use only, not in the {@link Callback} interface. | |||
* | |||
* | |||
* @param request | |||
* @param application | |||
* @return |
@@ -19,12 +19,11 @@ import org.w3c.dom.Element; | |||
/** | |||
* Read-only wrapper for a {@link RenderResponse}. | |||
* | |||
* | |||
* Only for use by {@link PortletApplicationContext} and | |||
* {@link PortletApplicationContext2}. | |||
*/ | |||
class RestrictedRenderResponse implements RenderResponse, | |||
Serializable { | |||
class RestrictedRenderResponse implements RenderResponse, Serializable { | |||
private RenderResponse response; | |||
@@ -115,8 +114,7 @@ class RestrictedRenderResponse implements RenderResponse, | |||
response.setTitle(title); | |||
} | |||
public void setNextPossiblePortletModes( | |||
Collection<PortletMode> portletModes) { | |||
public void setNextPossiblePortletModes(Collection<PortletMode> portletModes) { | |||
// NOP | |||
// TODO throw? | |||
} |
@@ -20,7 +20,7 @@ public class WebBrowser implements Terminal { | |||
/** | |||
* There is no default-theme for this terminal type. | |||
* | |||
* | |||
* @return Allways returns null. | |||
*/ | |||
public String getDefaultTheme() { | |||
@@ -29,7 +29,7 @@ public class WebBrowser implements Terminal { | |||
/** | |||
* Get the height of the users display in pixels. | |||
* | |||
* | |||
*/ | |||
public int getScreenHeight() { | |||
return screenHeight; | |||
@@ -37,7 +37,7 @@ public class WebBrowser implements Terminal { | |||
/** | |||
* Get the width of the users display in pixels. | |||
* | |||
* | |||
*/ | |||
public int getScreenWidth() { | |||
return screenWidth; | |||
@@ -45,7 +45,7 @@ public class WebBrowser implements Terminal { | |||
/** | |||
* Get the browser user-agent string. | |||
* | |||
* | |||
* @return | |||
*/ | |||
public String getBrowserApplication() { | |||
@@ -78,7 +78,7 @@ public class WebBrowser implements Terminal { | |||
/** | |||
* Get the IP-address of the web browser. If the application is running | |||
* inside a portlet, this method will return null. | |||
* | |||
* | |||
* @return IP-address in 1.12.123.123 -format | |||
*/ | |||
public String getAddress() { |
@@ -20,11 +20,11 @@ import java.util.regex.Pattern; | |||
/** | |||
* Helper class to update widgetsets GWT module configuration file. Can be used | |||
* command line or via IDE tools. | |||
* | |||
* | |||
* <p> | |||
* If module definition file contains text "WS Compiler: manually edited", tool | |||
* will skip editing file. | |||
* | |||
* | |||
*/ | |||
public class WidgetSetBuilder { | |||
@@ -11,9 +11,10 @@ import com.vaadin.data.Property; | |||
/** | |||
* Default implementation of the the following Field types are used by default: | |||
* <p> | |||
* <b>Boolean</b>: Button(switchMode:true).<br/> <b>Date</b>: | |||
* DateField(resolution: day).<br/> <b>Item</b>: Form. <br/> <b>default field | |||
* type</b>: TextField. | |||
* <b>Boolean</b>: Button(switchMode:true).<br/> | |||
* <b>Date</b>: DateField(resolution: day).<br/> | |||
* <b>Item</b>: Form. <br/> | |||
* <b>default field type</b>: TextField. | |||
* <p> | |||
* | |||
* @author IT Mill Ltd. |
@@ -455,8 +455,8 @@ public class GeneratedColumnExample extends CustomComponent { | |||
null); | |||
table.addContainerProperty("quantity", Double.class, null, | |||
"Quantity (l)", null, null); | |||
table.addContainerProperty("price", Double.class, null, "Price (€/l)", | |||
null, null); | |||
table.addContainerProperty("price", Double.class, null, | |||
"Price (€/l)", null, null); | |||
table.addContainerProperty("total", Double.class, null, "Total (€)", | |||
null, null); | |||
table.addContainerProperty("consumption", Double.class, null, |
@@ -12,8 +12,8 @@ import com.vaadin.ui.Label; | |||
import com.vaadin.ui.Window; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
public abstract class Robustness extends com.vaadin.Application | |||
implements Button.ClickListener { | |||
public abstract class Robustness extends com.vaadin.Application implements | |||
Button.ClickListener { | |||
static int totalCount = 0; | |||
@@ -26,8 +26,8 @@ import com.vaadin.ui.Window; | |||
* | |||
* @since 3.1.1 | |||
*/ | |||
public class Parameters extends com.vaadin.Application implements | |||
URIHandler, ParameterHandler { | |||
public class Parameters extends com.vaadin.Application implements URIHandler, | |||
ParameterHandler { | |||
private final Label context = new Label(); | |||
@@ -41,292 +41,291 @@ import com.vaadin.ui.UriFragmentUtility.FragmentChangedEvent; | |||
* | |||
*/ | |||
public class TestBench extends com.vaadin.Application implements | |||
Property.ValueChangeListener { | |||
// Add here packages which are used for finding testable classes | |||
String[] testablePackages = { "com.vaadin.tests", | |||
"com.vaadin.demo", "com.vaadin.demo.colorpicker", | |||
"com.vaadin.demo.reservation", | |||
"com.vaadin.demo.features", | |||
"com.vaadin.tests.tickets", "com.vaadin.tests.book" }; | |||
HierarchicalContainer testables = new HierarchicalContainer(); | |||
Window mainWindow = new Window("TestBench window"); | |||
// Main layout consists of tree menu and body layout | |||
SplitPanel mainLayout = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL); | |||
Tree menu; | |||
Panel bodyLayout = new Panel(); | |||
HashMap itemCaptions = new HashMap(); | |||
@Override | |||
public void init() { | |||
// Add testable classes to hierarchical container | |||
for (int p = 0; p < testablePackages.length; p++) { | |||
testables.addItem(testablePackages[p]); | |||
try { | |||
final List testableClasses = getTestableClassesForPackage(testablePackages[p]); | |||
for (final Iterator it = testableClasses.iterator(); it | |||
.hasNext();) { | |||
final Class t = (Class) it.next(); | |||
// ignore TestBench itself | |||
if (t.equals(TestBench.class)) { | |||
continue; | |||
} | |||
try { | |||
testables.addItem(t); | |||
itemCaptions.put(t, t.getName()); | |||
testables.setParent(t, testablePackages[p]); | |||
testables.setChildrenAllowed(t, false); | |||
continue; | |||
} catch (final Exception e) { | |||
try { | |||
testables.addItem(t); | |||
itemCaptions.put(t, t.getName()); | |||
testables.setParent(t, testablePackages[p]); | |||
testables.setChildrenAllowed(t, false); | |||
continue; | |||
} catch (final Exception e1) { | |||
e1.printStackTrace(); | |||
} | |||
} | |||
} | |||
} catch (final Exception e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
menu = new Tree("Testables", testables); | |||
for (final Iterator i = itemCaptions.keySet().iterator(); i.hasNext();) { | |||
final Class testable = (Class) i.next(); | |||
// simplify captions | |||
final String name = testable.getName().substring( | |||
testable.getName().lastIndexOf('.') + 1); | |||
menu.setItemCaption(testable, name); | |||
} | |||
// expand all root items | |||
for (final Iterator i = menu.rootItemIds().iterator(); i.hasNext();) { | |||
menu.expandItemsRecursively(i.next()); | |||
} | |||
menu.addListener(this); | |||
menu.setImmediate(true); | |||
menu.setNullSelectionAllowed(false); | |||
VerticalLayout lo = new VerticalLayout(); | |||
lo.addComponent(menu); | |||
UriFragmentUtility uri = new UriFragmentUtility(); | |||
lo.addComponent(uri); | |||
uri.addListener(new UriFragmentUtility.FragmentChangedListener() { | |||
public void fragmentChanged(FragmentChangedEvent source) { | |||
String fragment = source.getUriFragmentUtility().getFragment(); | |||
if (fragment != null && !"".equals(fragment)) { | |||
// try to find a proper test class | |||
// exact match | |||
Iterator iterator = menu.getItemIds().iterator(); | |||
while (iterator.hasNext()) { | |||
Object next = iterator.next(); | |||
if (next instanceof Class) { | |||
Class c = (Class) next; | |||
String string = c.getName(); | |||
if (string.equals(fragment)) { | |||
menu.setValue(c); | |||
mainLayout.setSplitPosition(0); | |||
return; | |||
} | |||
} | |||
} | |||
// simple name match | |||
iterator = menu.getItemIds().iterator(); | |||
while (iterator.hasNext()) { | |||
Object next = iterator.next(); | |||
if (next instanceof Class) { | |||
Class c = (Class) next; | |||
String string = c.getSimpleName(); | |||
if (string.equals(fragment)) { | |||
menu.setValue(c); | |||
mainLayout.setSplitPosition(0); | |||
return; | |||
} | |||
} | |||
} | |||
// ticket match | |||
iterator = menu.getItemIds().iterator(); | |||
while (iterator.hasNext()) { | |||
Object next = iterator.next(); | |||
if (next instanceof Class) { | |||
Class c = (Class) next; | |||
String string = c.getSimpleName(); | |||
if (string.startsWith("Ticket" + fragment)) { | |||
menu.setValue(c); | |||
mainLayout.setSplitPosition(0); | |||
return; | |||
} | |||
} | |||
} | |||
// just partly mach lowercase | |||
iterator = menu.getItemIds().iterator(); | |||
while (iterator.hasNext()) { | |||
Object next = iterator.next(); | |||
if (next instanceof Class) { | |||
Class c = (Class) next; | |||
String string = c.getSimpleName(); | |||
if (string.toLowerCase().contains( | |||
fragment.toLowerCase())) { | |||
menu.setValue(c); | |||
mainLayout.setSplitPosition(0); | |||
return; | |||
} | |||
} | |||
} | |||
getMainWindow().showNotification( | |||
"No potential matc for #" + fragment); | |||
} | |||
} | |||
}); | |||
mainLayout.addComponent(lo); | |||
bodyLayout.addStyleName("light"); | |||
bodyLayout.setSizeFull(); | |||
bodyLayout.setLayout(new ExpandLayout()); | |||
mainLayout.addComponent(bodyLayout); | |||
mainLayout.setSplitPosition(30); | |||
mainWindow.setLayout(mainLayout); | |||
setMainWindow(mainWindow); | |||
} | |||
private Component createTestable(Class c) { | |||
try { | |||
final Application app = (Application) c.newInstance(); | |||
app.init(); | |||
Layout lo = app.getMainWindow().getLayout(); | |||
lo.setParent(null); | |||
return lo; | |||
} catch (final Exception e) { | |||
try { | |||
final CustomComponent cc = (CustomComponent) c.newInstance(); | |||
cc.setSizeFull(); | |||
return cc; | |||
} catch (final Exception e1) { | |||
e1.printStackTrace(); | |||
VerticalLayout lo = new VerticalLayout(); | |||
lo.addComponent(new Label( | |||
"Cannot create application / custom component: " | |||
+ e1.toString())); | |||
Link l = new Link("Try opening via app runner", | |||
new ExternalResource("../run/" + c.getName())); | |||
lo.addComponent(l); | |||
return lo; | |||
} | |||
} | |||
} | |||
// Handle menu selection and update body | |||
public void valueChange(Property.ValueChangeEvent event) { | |||
bodyLayout.removeAllComponents(); | |||
bodyLayout.setCaption(null); | |||
final Object o = menu.getValue(); | |||
if (o != null && o instanceof Class) { | |||
final Class c = (Class) o; | |||
final String title = c.getName(); | |||
bodyLayout.setCaption(title); | |||
bodyLayout.addComponent(createTestable(c)); | |||
} else { | |||
// NOP node selected or deselected tree item | |||
} | |||
} | |||
/** | |||
* Return all testable classes within given package. Class is considered | |||
* testable if it's superclass is Application or CustomComponent. | |||
* | |||
* @param packageName | |||
* @return | |||
* @throws ClassNotFoundException | |||
*/ | |||
public static List getTestableClassesForPackage(String packageName) | |||
throws Exception { | |||
final ArrayList directories = new ArrayList(); | |||
try { | |||
final ClassLoader cld = Thread.currentThread() | |||
.getContextClassLoader(); | |||
if (cld == null) { | |||
throw new ClassNotFoundException("Can't get class loader."); | |||
} | |||
final String path = packageName.replace('.', '/'); | |||
// Ask for all resources for the path | |||
final Enumeration resources = cld.getResources(path); | |||
while (resources.hasMoreElements()) { | |||
final URL url = (URL) resources.nextElement(); | |||
directories.add(new File(url.getFile())); | |||
} | |||
} catch (final Exception x) { | |||
throw new Exception(packageName | |||
+ " does not appear to be a valid package."); | |||
} | |||
final ArrayList classes = new ArrayList(); | |||
// For every directory identified capture all the .class files | |||
for (final Iterator it = directories.iterator(); it.hasNext();) { | |||
final File directory = (File) it.next(); | |||
if (directory.exists()) { | |||
// Get the list of the files contained in the package | |||
final String[] files = directory.list(); | |||
for (int j = 0; j < files.length; j++) { | |||
// we are only interested in .class files | |||
if (files[j].endsWith(".class")) { | |||
// removes the .class extension | |||
final String p = packageName + '.' | |||
+ files[j].substring(0, files[j].length() - 6); | |||
final Class c = Class.forName(p); | |||
if (c.getSuperclass() != null) { | |||
if ((c.getSuperclass() | |||
.equals(com.vaadin.Application.class))) { | |||
classes.add(c); | |||
} else if ((c.getSuperclass() | |||
.equals(com.vaadin.ui.CustomComponent.class))) { | |||
classes.add(c); | |||
} | |||
} | |||
// for (int i = 0; i < c.getInterfaces().length; i++) { | |||
// Class cc = c.getInterfaces()[i]; | |||
// if (c.getInterfaces()[i].equals(Testable.class)) { | |||
// // Class is testable | |||
// classes.add(c); | |||
// } | |||
// } | |||
} | |||
} | |||
} else { | |||
throw new ClassNotFoundException(packageName + " (" | |||
+ directory.getPath() | |||
+ ") does not appear to be a valid package"); | |||
} | |||
} | |||
return classes; | |||
} | |||
Property.ValueChangeListener { | |||
// Add here packages which are used for finding testable classes | |||
String[] testablePackages = { "com.vaadin.tests", "com.vaadin.demo", | |||
"com.vaadin.demo.colorpicker", "com.vaadin.demo.reservation", | |||
"com.vaadin.demo.features", "com.vaadin.tests.tickets", | |||
"com.vaadin.tests.book" }; | |||
HierarchicalContainer testables = new HierarchicalContainer(); | |||
Window mainWindow = new Window("TestBench window"); | |||
// Main layout consists of tree menu and body layout | |||
SplitPanel mainLayout = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL); | |||
Tree menu; | |||
Panel bodyLayout = new Panel(); | |||
HashMap itemCaptions = new HashMap(); | |||
@Override | |||
public void init() { | |||
// Add testable classes to hierarchical container | |||
for (int p = 0; p < testablePackages.length; p++) { | |||
testables.addItem(testablePackages[p]); | |||
try { | |||
final List testableClasses = getTestableClassesForPackage(testablePackages[p]); | |||
for (final Iterator it = testableClasses.iterator(); it | |||
.hasNext();) { | |||
final Class t = (Class) it.next(); | |||
// ignore TestBench itself | |||
if (t.equals(TestBench.class)) { | |||
continue; | |||
} | |||
try { | |||
testables.addItem(t); | |||
itemCaptions.put(t, t.getName()); | |||
testables.setParent(t, testablePackages[p]); | |||
testables.setChildrenAllowed(t, false); | |||
continue; | |||
} catch (final Exception e) { | |||
try { | |||
testables.addItem(t); | |||
itemCaptions.put(t, t.getName()); | |||
testables.setParent(t, testablePackages[p]); | |||
testables.setChildrenAllowed(t, false); | |||
continue; | |||
} catch (final Exception e1) { | |||
e1.printStackTrace(); | |||
} | |||
} | |||
} | |||
} catch (final Exception e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
menu = new Tree("Testables", testables); | |||
for (final Iterator i = itemCaptions.keySet().iterator(); i.hasNext();) { | |||
final Class testable = (Class) i.next(); | |||
// simplify captions | |||
final String name = testable.getName().substring( | |||
testable.getName().lastIndexOf('.') + 1); | |||
menu.setItemCaption(testable, name); | |||
} | |||
// expand all root items | |||
for (final Iterator i = menu.rootItemIds().iterator(); i.hasNext();) { | |||
menu.expandItemsRecursively(i.next()); | |||
} | |||
menu.addListener(this); | |||
menu.setImmediate(true); | |||
menu.setNullSelectionAllowed(false); | |||
VerticalLayout lo = new VerticalLayout(); | |||
lo.addComponent(menu); | |||
UriFragmentUtility uri = new UriFragmentUtility(); | |||
lo.addComponent(uri); | |||
uri.addListener(new UriFragmentUtility.FragmentChangedListener() { | |||
public void fragmentChanged(FragmentChangedEvent source) { | |||
String fragment = source.getUriFragmentUtility().getFragment(); | |||
if (fragment != null && !"".equals(fragment)) { | |||
// try to find a proper test class | |||
// exact match | |||
Iterator iterator = menu.getItemIds().iterator(); | |||
while (iterator.hasNext()) { | |||
Object next = iterator.next(); | |||
if (next instanceof Class) { | |||
Class c = (Class) next; | |||
String string = c.getName(); | |||
if (string.equals(fragment)) { | |||
menu.setValue(c); | |||
mainLayout.setSplitPosition(0); | |||
return; | |||
} | |||
} | |||
} | |||
// simple name match | |||
iterator = menu.getItemIds().iterator(); | |||
while (iterator.hasNext()) { | |||
Object next = iterator.next(); | |||
if (next instanceof Class) { | |||
Class c = (Class) next; | |||
String string = c.getSimpleName(); | |||
if (string.equals(fragment)) { | |||
menu.setValue(c); | |||
mainLayout.setSplitPosition(0); | |||
return; | |||
} | |||
} | |||
} | |||
// ticket match | |||
iterator = menu.getItemIds().iterator(); | |||
while (iterator.hasNext()) { | |||
Object next = iterator.next(); | |||
if (next instanceof Class) { | |||
Class c = (Class) next; | |||
String string = c.getSimpleName(); | |||
if (string.startsWith("Ticket" + fragment)) { | |||
menu.setValue(c); | |||
mainLayout.setSplitPosition(0); | |||
return; | |||
} | |||
} | |||
} | |||
// just partly mach lowercase | |||
iterator = menu.getItemIds().iterator(); | |||
while (iterator.hasNext()) { | |||
Object next = iterator.next(); | |||
if (next instanceof Class) { | |||
Class c = (Class) next; | |||
String string = c.getSimpleName(); | |||
if (string.toLowerCase().contains( | |||
fragment.toLowerCase())) { | |||
menu.setValue(c); | |||
mainLayout.setSplitPosition(0); | |||
return; | |||
} | |||
} | |||
} | |||
getMainWindow().showNotification( | |||
"No potential matc for #" + fragment); | |||
} | |||
} | |||
}); | |||
mainLayout.addComponent(lo); | |||
bodyLayout.addStyleName("light"); | |||
bodyLayout.setSizeFull(); | |||
bodyLayout.setLayout(new ExpandLayout()); | |||
mainLayout.addComponent(bodyLayout); | |||
mainLayout.setSplitPosition(30); | |||
mainWindow.setLayout(mainLayout); | |||
setMainWindow(mainWindow); | |||
} | |||
private Component createTestable(Class c) { | |||
try { | |||
final Application app = (Application) c.newInstance(); | |||
app.init(); | |||
Layout lo = app.getMainWindow().getLayout(); | |||
lo.setParent(null); | |||
return lo; | |||
} catch (final Exception e) { | |||
try { | |||
final CustomComponent cc = (CustomComponent) c.newInstance(); | |||
cc.setSizeFull(); | |||
return cc; | |||
} catch (final Exception e1) { | |||
e1.printStackTrace(); | |||
VerticalLayout lo = new VerticalLayout(); | |||
lo.addComponent(new Label( | |||
"Cannot create application / custom component: " | |||
+ e1.toString())); | |||
Link l = new Link("Try opening via app runner", | |||
new ExternalResource("../run/" + c.getName())); | |||
lo.addComponent(l); | |||
return lo; | |||
} | |||
} | |||
} | |||
// Handle menu selection and update body | |||
public void valueChange(Property.ValueChangeEvent event) { | |||
bodyLayout.removeAllComponents(); | |||
bodyLayout.setCaption(null); | |||
final Object o = menu.getValue(); | |||
if (o != null && o instanceof Class) { | |||
final Class c = (Class) o; | |||
final String title = c.getName(); | |||
bodyLayout.setCaption(title); | |||
bodyLayout.addComponent(createTestable(c)); | |||
} else { | |||
// NOP node selected or deselected tree item | |||
} | |||
} | |||
/** | |||
* Return all testable classes within given package. Class is considered | |||
* testable if it's superclass is Application or CustomComponent. | |||
* | |||
* @param packageName | |||
* @return | |||
* @throws ClassNotFoundException | |||
*/ | |||
public static List getTestableClassesForPackage(String packageName) | |||
throws Exception { | |||
final ArrayList directories = new ArrayList(); | |||
try { | |||
final ClassLoader cld = Thread.currentThread() | |||
.getContextClassLoader(); | |||
if (cld == null) { | |||
throw new ClassNotFoundException("Can't get class loader."); | |||
} | |||
final String path = packageName.replace('.', '/'); | |||
// Ask for all resources for the path | |||
final Enumeration resources = cld.getResources(path); | |||
while (resources.hasMoreElements()) { | |||
final URL url = (URL) resources.nextElement(); | |||
directories.add(new File(url.getFile())); | |||
} | |||
} catch (final Exception x) { | |||
throw new Exception(packageName | |||
+ " does not appear to be a valid package."); | |||
} | |||
final ArrayList classes = new ArrayList(); | |||
// For every directory identified capture all the .class files | |||
for (final Iterator it = directories.iterator(); it.hasNext();) { | |||
final File directory = (File) it.next(); | |||
if (directory.exists()) { | |||
// Get the list of the files contained in the package | |||
final String[] files = directory.list(); | |||
for (int j = 0; j < files.length; j++) { | |||
// we are only interested in .class files | |||
if (files[j].endsWith(".class")) { | |||
// removes the .class extension | |||
final String p = packageName + '.' | |||
+ files[j].substring(0, files[j].length() - 6); | |||
final Class c = Class.forName(p); | |||
if (c.getSuperclass() != null) { | |||
if ((c.getSuperclass() | |||
.equals(com.vaadin.Application.class))) { | |||
classes.add(c); | |||
} else if ((c.getSuperclass() | |||
.equals(com.vaadin.ui.CustomComponent.class))) { | |||
classes.add(c); | |||
} | |||
} | |||
// for (int i = 0; i < c.getInterfaces().length; i++) { | |||
// Class cc = c.getInterfaces()[i]; | |||
// if (c.getInterfaces()[i].equals(Testable.class)) { | |||
// // Class is testable | |||
// classes.add(c); | |||
// } | |||
// } | |||
} | |||
} | |||
} else { | |||
throw new ClassNotFoundException(packageName + " (" | |||
+ directory.getPath() | |||
+ ") does not appear to be a valid package"); | |||
} | |||
} | |||
return classes; | |||
} | |||
} |
@@ -16,79 +16,79 @@ import com.vaadin.ui.Panel; | |||
import com.vaadin.ui.TextField; | |||
public class DefaultButtonExample extends CustomComponent implements Handler { | |||
// Define and create user interface components | |||
Panel panel = new Panel("Login"); | |||
FormLayout formlayout = new FormLayout(); | |||
TextField username = new TextField("Username"); | |||
TextField password = new TextField("Password"); | |||
HorizontalLayout buttons = new HorizontalLayout(); | |||
// Define and create user interface components | |||
Panel panel = new Panel("Login"); | |||
FormLayout formlayout = new FormLayout(); | |||
TextField username = new TextField("Username"); | |||
TextField password = new TextField("Password"); | |||
HorizontalLayout buttons = new HorizontalLayout(); | |||
// Create buttons and define their listener methods. | |||
Button ok = new Button("OK", this, "okHandler"); | |||
Button cancel = new Button("Cancel", this, "cancelHandler"); | |||
// Create buttons and define their listener methods. | |||
Button ok = new Button("OK", this, "okHandler"); | |||
Button cancel = new Button("Cancel", this, "cancelHandler"); | |||
// Have the unmodified Enter key cause an event | |||
Action action_ok = new ShortcutAction("Default key", | |||
ShortcutAction.KeyCode.ENTER, null); | |||
// Have the unmodified Enter key cause an event | |||
Action action_ok = new ShortcutAction("Default key", | |||
ShortcutAction.KeyCode.ENTER, null); | |||
// Have the C key modified with Alt cause an event | |||
Action action_cancel = new ShortcutAction("Alt+C", | |||
ShortcutAction.KeyCode.C, | |||
new int[] { ShortcutAction.ModifierKey.ALT }); | |||
// Have the C key modified with Alt cause an event | |||
Action action_cancel = new ShortcutAction("Alt+C", | |||
ShortcutAction.KeyCode.C, | |||
new int[] { ShortcutAction.ModifierKey.ALT }); | |||
public DefaultButtonExample() { | |||
// Set up the user interface | |||
setCompositionRoot(panel); | |||
panel.addComponent(formlayout); | |||
formlayout.addComponent(username); | |||
formlayout.addComponent(password); | |||
formlayout.addComponent(buttons); | |||
buttons.addComponent(ok); | |||
buttons.addComponent(cancel); | |||
public DefaultButtonExample() { | |||
// Set up the user interface | |||
setCompositionRoot(panel); | |||
panel.addComponent(formlayout); | |||
formlayout.addComponent(username); | |||
formlayout.addComponent(password); | |||
formlayout.addComponent(buttons); | |||
buttons.addComponent(ok); | |||
buttons.addComponent(cancel); | |||
// Set focus to username | |||
username.focus(); | |||
// Set focus to username | |||
username.focus(); | |||
// Set this object as the action handler | |||
System.out.println("adding ah"); | |||
panel.addActionHandler(this); | |||
// Set this object as the action handler | |||
System.out.println("adding ah"); | |||
panel.addActionHandler(this); | |||
System.out.println("start done."); | |||
} | |||
System.out.println("start done."); | |||
} | |||
/** | |||
* Retrieve actions for a specific component. This method will be called for | |||
* each object that has a handler; in this example just for login panel. The | |||
* returned action list might as well be static list. | |||
*/ | |||
public Action[] getActions(Object target, Object sender) { | |||
System.out.println("getActions()"); | |||
return new Action[] { action_ok, action_cancel }; | |||
} | |||
/** | |||
* Retrieve actions for a specific component. This method will be called for | |||
* each object that has a handler; in this example just for login panel. The | |||
* returned action list might as well be static list. | |||
*/ | |||
public Action[] getActions(Object target, Object sender) { | |||
System.out.println("getActions()"); | |||
return new Action[] { action_ok, action_cancel }; | |||
} | |||
/** | |||
* Handle actions received from keyboard. This simply directs the actions to | |||
* the same listener methods that are called with ButtonClick events. | |||
*/ | |||
public void handleAction(Action action, Object sender, Object target) { | |||
if (action == action_ok) { | |||
okHandler(); | |||
} | |||
if (action == action_cancel) { | |||
cancelHandler(); | |||
} | |||
} | |||
/** | |||
* Handle actions received from keyboard. This simply directs the actions to | |||
* the same listener methods that are called with ButtonClick events. | |||
*/ | |||
public void handleAction(Action action, Object sender, Object target) { | |||
if (action == action_ok) { | |||
okHandler(); | |||
} | |||
if (action == action_cancel) { | |||
cancelHandler(); | |||
} | |||
} | |||
public void okHandler() { | |||
// Do something: report the click | |||
formlayout.addComponent(new Label("OK clicked. " + "User=" | |||
+ username.getValue() + ", password=" + password.getValue())); | |||
// | |||
} | |||
public void okHandler() { | |||
// Do something: report the click | |||
formlayout.addComponent(new Label("OK clicked. " + "User=" | |||
+ username.getValue() + ", password=" + password.getValue())); | |||
// | |||
} | |||
public void cancelHandler() { | |||
// Do something: report the click | |||
formlayout.addComponent(new Label("Cancel clicked. User=" | |||
+ username.getValue() + ", password=" + password.getValue())); | |||
} | |||
public void cancelHandler() { | |||
// Do something: report the click | |||
formlayout.addComponent(new Label("Cancel clicked. User=" | |||
+ username.getValue() + ", password=" + password.getValue())); | |||
} | |||
} |
@@ -27,7 +27,7 @@ public class TabSheetExample extends CustomComponent implements | |||
// First tab contains a button, for which we | |||
// listen button click events. | |||
tab1.addListener(this); | |||
// This will cause a selectedTabChange() call. | |||
tabsheet.addTab(tab1, "First Tab", null); | |||
@@ -42,8 +42,8 @@ public class TabSheetExample extends CustomComponent implements | |||
public void buttonClick(ClickEvent event) { | |||
// Enable the invisible and disabled tabs. | |||
tabsheet.getTab(tab2).setVisible(true); | |||
tabsheet.getTab(tab3).setEnabled(true); | |||
tabsheet.getTab(tab2).setVisible(true); | |||
tabsheet.getTab(tab3).setEnabled(true); | |||
// Change selection automatically to second tab. | |||
tabsheet.setSelectedTab(tab2); | |||
@@ -51,19 +51,19 @@ public class TabSheetExample extends CustomComponent implements | |||
public void selectedTabChange(SelectedTabChangeEvent event) { | |||
// Cast to a TabSheet. This isn't really necessary in | |||
// this example, as we have only one TabSheet component, | |||
// but would be useful if there were multiple TabSheets. | |||
// this example, as we have only one TabSheet component, | |||
// but would be useful if there were multiple TabSheets. | |||
final TabSheet source = (TabSheet) event.getSource(); | |||
if (source == tabsheet) { | |||
// If the first tab was selected. | |||
if (source.getSelectedTab() == tab1) { | |||
// The 2. and 3. tabs may not have been set yet. | |||
if (tabsheet.getTab(tab2) != null | |||
&& tabsheet.getTab(tab3) != null) { | |||
tabsheet.getTab(tab2).setVisible(false); | |||
tabsheet.getTab(tab3).setEnabled(false); | |||
} | |||
// The 2. and 3. tabs may not have been set yet. | |||
if (tabsheet.getTab(tab2) != null | |||
&& tabsheet.getTab(tab3) != null) { | |||
tabsheet.getTab(tab2).setVisible(false); | |||
tabsheet.getTab(tab3).setEnabled(false); | |||
} | |||
} | |||
} | |||
} |
@@ -16,7 +16,7 @@ public class TableCellStyle extends CustomComponent { | |||
// of the container are integers so we can determine the column number | |||
// easily. | |||
table.addContainerProperty("0", String.class, null, "", null, null); // Row | |||
// header | |||
// header | |||
for (int i = 0; i < 8; i++) { | |||
table.addContainerProperty("" + (i + 1), String.class, null, String | |||
.valueOf((char) (65 + i)), null, null); |
@@ -38,7 +38,7 @@ public class TableEditable extends CustomComponent { | |||
// Create the table row. | |||
table.addItem(new Object[] { calendar.getTime(), | |||
new Boolean(false), "" }, new Integer(i)); // Item | |||
// identifier | |||
// identifier | |||
} | |||
table.setPageLength(8); |
@@ -7,34 +7,34 @@ import com.vaadin.ui.Button.ClickEvent; | |||
public class ReplaceComponentNPE extends TestBase { | |||
@Override | |||
protected String getDescription() { | |||
return "Clicking 'ReplaceComponent' should replace the 'Button' button with a VericalLayout, and move the button inside the verticalLayout. Visually this can be seen by the added margins of the VerticalLayout."; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 3195; | |||
} | |||
final Button button = new Button("Button"); | |||
final VerticalLayout outer = new VerticalLayout(); | |||
@Override | |||
protected void setup() { | |||
outer.setMargin(true); | |||
Button changer = new Button("ReplaceComponent"); | |||
changer.addListener(new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
getLayout().replaceComponent(button, outer); | |||
outer.addComponent(button); | |||
} | |||
}); | |||
getLayout().addComponent(button); | |||
getLayout().addComponent(changer); | |||
} | |||
@Override | |||
protected String getDescription() { | |||
return "Clicking 'ReplaceComponent' should replace the 'Button' button with a VericalLayout, and move the button inside the verticalLayout. Visually this can be seen by the added margins of the VerticalLayout."; | |||
} | |||
@Override | |||
protected Integer getTicketNumber() { | |||
return 3195; | |||
} | |||
final Button button = new Button("Button"); | |||
final VerticalLayout outer = new VerticalLayout(); | |||
@Override | |||
protected void setup() { | |||
outer.setMargin(true); | |||
Button changer = new Button("ReplaceComponent"); | |||
changer.addListener(new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
getLayout().replaceComponent(button, outer); | |||
outer.addComponent(button); | |||
} | |||
}); | |||
getLayout().addComponent(button); | |||
getLayout().addComponent(changer); | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
package com.vaadin.tests.components.splitpanel; | |||
import com.vaadin.terminal.Sizeable; | |||
import com.vaadin.tests.components.AbstractTestCase; | |||
import com.vaadin.ui.Button; |
@@ -1,4 +1,5 @@ | |||
package com.vaadin.tests.components.textfield; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.TextField; | |||
@@ -1,4 +1,5 @@ | |||
package com.vaadin.tests.components.textfield; | |||
import com.vaadin.Application; | |||
import com.vaadin.ui.Component; | |||
import com.vaadin.ui.Panel; |
@@ -118,8 +118,7 @@ public class FeatureUpload extends Feature implements Upload.FinishedListener { | |||
} | |||
/** | |||
* @see com.vaadin.ui.Upload.Receiver#receiveUpload(String, | |||
* String) | |||
* @see com.vaadin.ui.Upload.Receiver#receiveUpload(String, String) | |||
*/ | |||
public OutputStream receiveUpload(String filename, String MIMEType) { | |||
fileName = filename; |
@@ -8,8 +8,8 @@ import com.vaadin.ui.Label; | |||
import com.vaadin.ui.Window; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
public abstract class Robustness extends com.vaadin.Application | |||
implements Button.ClickListener { | |||
public abstract class Robustness extends com.vaadin.Application implements | |||
Button.ClickListener { | |||
static int totalCount = 0; | |||
@@ -32,7 +32,7 @@ public class TransactionListenersConcurrency extends TestCase { | |||
* transaction is then started for each application. Some semi-random delays | |||
* are included so that calls to addTransactionListener and | |||
* WebApplicationContext.startTransaction are mixed. | |||
* | |||
* | |||
*/ | |||
public void testTransactionListeners() throws Exception { | |||
final List<Throwable> exceptions = new ArrayList<Throwable>(); | |||
@@ -133,7 +133,7 @@ public class TransactionListenersConcurrency extends TestCase { | |||
/** | |||
* Creates a HttpSession mock | |||
* | |||
* | |||
*/ | |||
private static HttpSession createSession() { | |||
HttpSession session = createMock(HttpSession.class); | |||
@@ -151,7 +151,7 @@ public class TransactionListenersConcurrency extends TestCase { | |||
/** | |||
* A transaction listener that just sleeps for the given amount of time in | |||
* transactionStart and transactionEnd. | |||
* | |||
* | |||
*/ | |||
public static class DelayTransactionListener implements TransactionListener { | |||
@@ -7,8 +7,7 @@ import com.vaadin.ui.Label; | |||
import com.vaadin.ui.TextField; | |||
import com.vaadin.ui.Window; | |||
public class Ticket1365 extends com.vaadin.Application implements | |||
Handler { | |||
public class Ticket1365 extends com.vaadin.Application implements Handler { | |||
TextField f = new TextField(); | |||