diff --git a/.gitignore b/.gitignore index 9c9d927904..1d7646181e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.metadata .settings .project target/ diff --git a/.travis.yml b/.travis.yml index 5e65bfdea5..ef7326ca58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ sudo: false notifications: email: - mgrigorov@apache.org + - solomax@apache.org irc: channels: - "chat.freenode.net##wicket" @@ -33,7 +34,7 @@ cache: install: true before_script: - - echo "MAVEN_OPTS='-Xmx2g -XX:MaxPermSize=512m'" > ~/.mavenrc + - echo "export MAVEN_OPTS='-Xmx2g -XX:MaxPermSize=512m ${MAVEN_OPTS}'" > ~/.mavenrc script: - "DEPLOY_OR_TEST=install" diff --git a/annotation/pom.xml b/annotation/pom.xml index 10a59bf4c7..43b99d90dd 100644 --- a/annotation/pom.xml +++ b/annotation/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-annotation @@ -35,18 +35,12 @@ org.slf4j - slf4j-log4j12 - test + slf4j-simple junit junit - - log4j - log4j - test - diff --git a/annotationeventdispatcher-parent/annotationeventdispatcher/pom.xml b/annotationeventdispatcher-parent/annotationeventdispatcher/pom.xml index ed425acba1..e920f1c75d 100644 --- a/annotationeventdispatcher-parent/annotationeventdispatcher/pom.xml +++ b/annotationeventdispatcher-parent/annotationeventdispatcher/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-annotationeventdispatcher-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-annotationeventdispatcher diff --git a/annotationeventdispatcher-parent/pom.xml b/annotationeventdispatcher-parent/pom.xml index 2afabfcd98..d6336b6dea 100644 --- a/annotationeventdispatcher-parent/pom.xml +++ b/annotationeventdispatcher-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-annotationeventdispatcher-parent Annotation Event Dispatcher - Parent diff --git a/async-tasks-parent/async-tasks-demo/pom.xml b/async-tasks-parent/async-tasks-demo/pom.xml index 210d7222ac..c6b9e22ab9 100644 --- a/async-tasks-parent/async-tasks-demo/pom.xml +++ b/async-tasks-parent/async-tasks-demo/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff async-tasks-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT async-task-demo diff --git a/async-tasks-parent/async-tasks-impl/pom.xml b/async-tasks-parent/async-tasks-impl/pom.xml index 0a0645df32..0435db2421 100644 --- a/async-tasks-parent/async-tasks-impl/pom.xml +++ b/async-tasks-parent/async-tasks-impl/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff async-tasks-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT async-task-impl diff --git a/async-tasks-parent/async-tasks-impl/src/main/java/org/wicketstuff/async/components/ProgressButton.java b/async-tasks-parent/async-tasks-impl/src/main/java/org/wicketstuff/async/components/ProgressButton.java index 670c79df66..58093bc225 100644 --- a/async-tasks-parent/async-tasks-impl/src/main/java/org/wicketstuff/async/components/ProgressButton.java +++ b/async-tasks-parent/async-tasks-impl/src/main/java/org/wicketstuff/async/components/ProgressButton.java @@ -173,7 +173,7 @@ protected void refresh(AjaxRequestTarget target) { private void concludeIfApplicable(AjaxRequestTarget target) { if (!getTaskContainer().isRunning()) { - if (target != null) { + if (target != null && refreshBehavior.isBinded()) { refreshBehavior.stop(target); } if (getTaskContainer().isFailed()) { @@ -199,6 +199,9 @@ public boolean isEnabled() { } private class RefreshBehavior extends AbstractAjaxTimerBehavior { + + private boolean bound = false; + public RefreshBehavior(Duration updateInterval) { super(updateInterval); } @@ -219,6 +222,22 @@ protected boolean shouldTrigger() { // Again, skip the check for the component being enabled return !isStopped() && getComponent().findParent(Page.class) != null; } + + @Override + protected void onBind() { + super.onBind(); + bound = true; + } + + @Override + protected void onUnbind() { + super.onUnbind(); + bound = false; + } + + public boolean isBinded() { + return bound; + } } /** diff --git a/async-tasks-parent/pom.xml b/async-tasks-parent/pom.xml index a66353ae8d..4d3c6773dc 100644 --- a/async-tasks-parent/pom.xml +++ b/async-tasks-parent/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT async-tasks-parent diff --git a/autocomplete-tagit-parent/autocomplete-tagit-examples/pom.xml b/autocomplete-tagit-parent/autocomplete-tagit-examples/pom.xml index 063e3641d6..92c309cdbc 100644 --- a/autocomplete-tagit-parent/autocomplete-tagit-examples/pom.xml +++ b/autocomplete-tagit-parent/autocomplete-tagit-examples/pom.xml @@ -3,7 +3,7 @@ org.wicketstuff wicketstuff-autocomplete-tagit-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-autocomplete-tagit-examples diff --git a/autocomplete-tagit-parent/autocomplete-tagit/pom.xml b/autocomplete-tagit-parent/autocomplete-tagit/pom.xml index 0108a4dd6b..48ae444a1e 100644 --- a/autocomplete-tagit-parent/autocomplete-tagit/pom.xml +++ b/autocomplete-tagit-parent/autocomplete-tagit/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-autocomplete-tagit-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-autocomplete-tagit @@ -14,11 +14,7 @@ org.slf4j - slf4j-log4j12 - - - log4j - log4j + slf4j-api diff --git a/autocomplete-tagit-parent/pom.xml b/autocomplete-tagit-parent/pom.xml index 4d19af8759..6fe0cff523 100644 --- a/autocomplete-tagit-parent/pom.xml +++ b/autocomplete-tagit-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-autocomplete-tagit-parent Autocomplete Tag It Parent diff --git a/browserid-parent/README.md b/browserid-parent/README.md deleted file mode 100644 index a6be2e0ffd..0000000000 --- a/browserid-parent/README.md +++ /dev/null @@ -1,3 +0,0 @@ -An integration between Apache Wicket and Mozilla BrowserId authentication technology. - -For more information see https://github.com/wicketstuff/core/wiki/BrowserId diff --git a/browserid-parent/browserid-examples/src/main/java/org/wicketstuff/browserid/example/BrowserIdPage.html b/browserid-parent/browserid-examples/src/main/java/org/wicketstuff/browserid/example/BrowserIdPage.html deleted file mode 100644 index 7a7fed4f15..0000000000 --- a/browserid-parent/browserid-examples/src/main/java/org/wicketstuff/browserid/example/BrowserIdPage.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - BrowserId demo page - - - -
-
-
- - - \ No newline at end of file diff --git a/browserid-parent/browserid-examples/src/main/java/org/wicketstuff/browserid/example/BrowserIdPage.java b/browserid-parent/browserid-examples/src/main/java/org/wicketstuff/browserid/example/BrowserIdPage.java deleted file mode 100644 index 426059a858..0000000000 --- a/browserid-parent/browserid-examples/src/main/java/org/wicketstuff/browserid/example/BrowserIdPage.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.wicketstuff.browserid.example; - -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.markup.html.panel.FeedbackPanel; -import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.wicketstuff.browserid.BrowserIdPanel; -import org.wicketstuff.browserid.GuestPanel.Style; - -/** - * Demo page that just adds the default BrowserIdPanel and a feedback panel to show any errors - */ -public class BrowserIdPage extends WebPage -{ - - private static final long serialVersionUID = 1L; - - public BrowserIdPage(final PageParameters parameters) - { - super(parameters); - - add(new BrowserIdPanel("browserId", Style.GREEN)); - - add(new FeedbackPanel("feedback").setOutputMarkupId(true)); - } -} \ No newline at end of file diff --git a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/BrowserId.java b/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/BrowserId.java deleted file mode 100644 index 143c45f6d5..0000000000 --- a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/BrowserId.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.wicketstuff.browserid; - -import java.io.Serializable; -import java.util.Date; - -import org.apache.wicket.util.string.Strings; - -/** - * An object representing the response from https://browserid.org - */ -public class BrowserId implements Serializable -{ - - private static final long serialVersionUID = 1L; - - public enum Status - { - OK, FAIL; - - public static Status parse(final String t) - { - if ("okay".equals(t)) - { - return OK; - } - else if ("failure".equals(t)) - { - return FAIL; - } - else - { - throw new IllegalArgumentException("Unrecognized status: " + t); - } - } - }; - - private Status status; - - private String email; - - private String audience; - - private Date validUntil; - - private String issuer; - - private String reason; - - public String getReason() - { - return reason; - } - - public void setReason(String reason) - { - this.reason = reason; - } - - public Status getStatus() - { - return status; - } - - public void setStatus(Status status) - { - this.status = status; - } - - public String getEmail() - { - return email; - } - - public void setEmail(String email) - { - this.email = email; - } - - public String getAudience() - { - return audience; - } - - public void setAudience(String audience) - { - this.audience = audience; - } - - public Date getValidUntil() - { - return validUntil; - } - - public void setValidUntil(Date validUntil) - { - this.validUntil = validUntil; - } - - public String getIssuer() - { - return issuer; - } - - public void setIssuer(String issuer) - { - this.issuer = issuer; - } - - /** - * Create {@link BrowserId} object from success or failure JSON response - * - * @param json - * the response returned by https://browserid.org - * @return a {@link BrowserId} instance with status OK if the authentication passed, or with - * status FAIL if the authentication failed, or {@code null} if the passed JSON response - * is invalid - */ - public static BrowserId of(String json) - { - BrowserId browserId = null; - - if (json != null && json.startsWith("{") && json.endsWith("}")) - { - json = json.substring(1); - json = json.substring(0, json.length() - 1); - - String[] settings = Strings.split(json, ','); - if (settings.length > 0) - { - browserId = new BrowserId(); - for (String setting : settings) - { - String[] pair = Strings.split(setting, ':'); - pair[0] = Strings.replaceAll(pair[0], "\"", "").toString(); - pair[1] = Strings.replaceAll(pair[1], "\"", "").toString(); - - if ("status".equals(pair[0])) - { - browserId.status = Status.parse(pair[1]); - } - else if ("email".equals(pair[0])) - { - browserId.email = pair[1]; - } - else if ("audience".equals(pair[0])) - { - browserId.audience = pair[1]; - } - else if ("issuer".equals(pair[0])) - { - browserId.issuer = pair[1]; - } - else if ("valid-until".equals(pair[0])) - { - Long millis = Long.valueOf(pair[1]); - browserId.validUntil = new Date(millis); - } - else if ("reason".equals(pair[0])) - { - browserId.reason = pair[1]; - } - else - { - throw new IllegalArgumentException("Unknown setting: " + pair[0]); - } - } - } - } - - return browserId; - } -} diff --git a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/BrowserIdPanel.html b/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/BrowserIdPanel.html deleted file mode 100644 index a982bd65cc..0000000000 --- a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/BrowserIdPanel.html +++ /dev/null @@ -1,5 +0,0 @@ - - -
- -
\ No newline at end of file diff --git a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/BrowserIdPanel.java b/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/BrowserIdPanel.java deleted file mode 100644 index be9005da94..0000000000 --- a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/BrowserIdPanel.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.wicketstuff.browserid; - -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.feedback.IFeedback; -import org.apache.wicket.markup.html.panel.Panel; -import org.wicketstuff.browserid.GuestPanel.Style; - -/** - * This is the main panel which loads specific panels depending on whether there is a logged in user - * or not. - */ -public class BrowserIdPanel extends Panel -{ - - private static final long serialVersionUID = 1L; - - private static final String CONTENT_ID = "content"; - - /** - * The style of the default "Sign In" image button provided by https://browserid.org - */ - private final Style style; - - public BrowserIdPanel(String id) - { - this(id, Style.BLUE); - } - - public BrowserIdPanel(String id, Style style) - { - super(id); - - this.style = style; - - setOutputMarkupId(true); - } - - @Override - protected void onConfigure() - { - super.onConfigure(); - - if (SessionHelper.isLoggedIn(getSession())) - { - addOrReplace(getLoggedInPanel(CONTENT_ID)); - } - else - { - addOrReplace(getGuestPanel(CONTENT_ID)); - } - } - - protected Component getGuestPanel(String componentId) - { - return new GuestPanel(componentId, style) - { - - private static final long serialVersionUID = 1L; - - @Override - protected void onSuccess(AjaxRequestTarget target) - { - super.onSuccess(target); - - target.add(BrowserIdPanel.this); - } - - @Override - protected void onFailure(AjaxRequestTarget target, final String failureReason) - { - super.onFailure(target, failureReason); - - error("The authentication failed: " + failureReason); - target.addChildren(getPage(), IFeedback.class); - } - }; - } - - protected Component getLoggedInPanel(String componentId) - { - return new LoggedInPanel(componentId) - { - - private static final long serialVersionUID = 1L; - - @Override - protected void onLoggedOut(AjaxRequestTarget target) - { - super.onLoggedOut(target); - target.add(BrowserIdPanel.this); - } - }; - } -} diff --git a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/GuestPanel.html b/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/GuestPanel.html deleted file mode 100644 index 5e49ba6207..0000000000 --- a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/GuestPanel.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/GuestPanel.java b/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/GuestPanel.java deleted file mode 100644 index 01db725957..0000000000 --- a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/GuestPanel.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.wicketstuff.browserid; - -import org.apache.wicket.AttributeModifier; -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.markup.head.IHeaderResponse; -import org.apache.wicket.markup.head.JavaScriptHeaderItem; -import org.apache.wicket.markup.html.image.Image; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.request.resource.PackageResourceReference; -import org.apache.wicket.request.resource.ResourceReference; - -/** - * A panel that is used for non-authenticated users - */ -public class GuestPanel extends Panel -{ - - private static final long serialVersionUID = 1L; - - private static final String BROWSER_ID_JS = "https://browserid.org/include.js"; - - private static final ResourceReference RED_ICON = new PackageResourceReference( - GuestPanel.class, "sign_in_red.png"); - private static final ResourceReference BLUE_ICON = new PackageResourceReference( - GuestPanel.class, "sign_in_blue.png"); - private static final ResourceReference GREEN_ICON = new PackageResourceReference( - GuestPanel.class, "sign_in_green.png"); - private static final ResourceReference ORANGE_ICON = new PackageResourceReference( - GuestPanel.class, "sign_in_orange.png"); - private static final ResourceReference GREY_ICON = new PackageResourceReference( - GuestPanel.class, "sign_in_grey.png"); - - /** - * The possible styles of the default "Sign In" image button provided by https://browserid.org - */ - public enum Style - { - RED, BLUE, GREEN, ORANGE, GREY - } - - private final Style style; - - public GuestPanel(String id, Style style) - { - super(id); - - this.style = style; - - Component signInImage = createSignInButton("signInImage"); - signInImage.add(new VerifyBehavior() - { - - private static final long serialVersionUID = 1L; - - @Override - protected void onSuccess(AjaxRequestTarget target) - { - GuestPanel.this.onSuccess(target); - } - - @Override - protected void onFailure(AjaxRequestTarget target, String failureReason) - { - GuestPanel.this.onFailure(target, failureReason); - } - - }); - add(signInImage); - } - - protected Component createSignInButton(String componentId) - { - Image image = new Image(componentId, getImage(style)); - image.add(AttributeModifier.replace("alt", "Sign In")); - return image; - } - - protected ResourceReference getImage(final Style style) - { - final ResourceReference imageIcon; - switch (style) - { - case RED : - imageIcon = RED_ICON; - break; - case GREEN : - imageIcon = GREEN_ICON; - break; - case ORANGE : - imageIcon = ORANGE_ICON; - break; - case GREY : - imageIcon = GREY_ICON; - break; - case BLUE : - default : - imageIcon = BLUE_ICON; - break; - } - - return imageIcon; - } - - @Override - public void renderHead(IHeaderResponse response) - { - super.renderHead(response); - - renderBrowserIdJavaScript(response); - } - - /** - * Renders a reference for external browserid.js (loaded from browserid.org).
- * Can be overridden with local reference to browserid.js if needed. - * - * @param response - * the current header response - */ - protected void renderBrowserIdJavaScript(final IHeaderResponse response) - { - response.render(JavaScriptHeaderItem.forUrl(BROWSER_ID_JS)); - } - - /** - * A callback called when the authentication is successful - * - * @param target - * the current request target - */ - protected void onSuccess(final AjaxRequestTarget target) - { - - } - - /** - * A callback called when the authentication has failed - * - * @param target - * the current request target - * @param target - * @param failureReason - */ - protected void onFailure(final AjaxRequestTarget target, final String failureReason) - { - - } -} diff --git a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/LoggedInPanel.html b/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/LoggedInPanel.html deleted file mode 100644 index 9e246fbb05..0000000000 --- a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/LoggedInPanel.html +++ /dev/null @@ -1,5 +0,0 @@ - - - Hi, ! Logout. - - \ No newline at end of file diff --git a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/LoggedInPanel.java b/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/LoggedInPanel.java deleted file mode 100644 index 4a91ba628e..0000000000 --- a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/LoggedInPanel.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.wicketstuff.browserid; - -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.markup.html.AjaxLink; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.model.PropertyModel; - -public class LoggedInPanel extends Panel -{ - - private static final long serialVersionUID = 1L; - - public LoggedInPanel(String id) - { - super(id); - - BrowserId browserId = SessionHelper.getBrowserId(getSession()); - if (browserId == null) - { - throw new IllegalStateException("The user must be authenticated!"); - } - - add(new Label("emailLabel", new PropertyModel(browserId, "email"))); - add(new AjaxLink("logoutLink") - { - - private static final long serialVersionUID = 1L; - - @Override - public void onClick(AjaxRequestTarget target) - { - SessionHelper.logOut(getSession()); - onLoggedOut(target); - } - }); - } - - protected void onLoggedOut(AjaxRequestTarget target) - { - - } - -} diff --git a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/SessionHelper.java b/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/SessionHelper.java deleted file mode 100644 index c8952da66e..0000000000 --- a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/SessionHelper.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.wicketstuff.browserid; - -import org.apache.wicket.MetaDataKey; -import org.apache.wicket.Session; -import org.apache.wicket.util.lang.Args; - -/** - * Utility class that stores the {@link BrowserId} (authentication data) in the current web session. - */ -public class SessionHelper -{ - - private static final MetaDataKey KEY = new MetaDataKey() - { - - private static final long serialVersionUID = 1L; - }; - - /** - * @param session - * the current web session - * @return the authentication data. May be {@code null}. - */ - public static BrowserId getBrowserId(final Session session) - { - - Args.notNull(session, "session"); - - BrowserId browserId = session.getMetaData(KEY); - - return browserId; - } - - /** - * - * @param session - * the current web session - * @return {@code true} if there is authentication data. {@code false} - otherwise. - */ - public static boolean isLoggedIn(final Session session) - { - return getBrowserId(session) != null; - } - - /** - * Stores the authentication data in the current web session - * - * @param session - * the current web session - * @param browserId - * the authentication data - */ - public static void logIn(final Session session, final BrowserId browserId) - { - Args.notNull(session, "session"); - Args.notNull(browserId, "browserId"); - - session.setMetaData(KEY, browserId); - ; - } - - /** - * Removes the authentication data from the current web session - * - * @param session - * the current web session - */ - public static void logOut(final Session session) - { - Args.notNull(session, "session"); - - session.setMetaData(KEY, null); - ; - } -} diff --git a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/VerifyBehavior.java b/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/VerifyBehavior.java deleted file mode 100644 index 59de48bcfa..0000000000 --- a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/VerifyBehavior.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.wicketstuff.browserid; - -import java.io.IOException; -import java.io.OutputStream; -import java.net.URL; -import java.net.URLConnection; -import java.util.HashMap; -import java.util.Map; - -import org.apache.wicket.Component; -import org.apache.wicket.Session; -import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.markup.head.IHeaderResponse; -import org.apache.wicket.markup.head.OnDomReadyHeaderItem; -import org.apache.wicket.request.Request; -import org.apache.wicket.request.cycle.RequestCycle; -import org.apache.wicket.util.io.IOUtils; -import org.apache.wicket.util.string.StringValue; -import org.apache.wicket.util.template.PackageTextTemplate; -import org.apache.wicket.util.template.TextTemplate; -import org.wicketstuff.browserid.BrowserId.Status; - -/** - * The behavior that should be attached to the "Sign In" button. It cares about loading the - * authentication window and notifying the caller via {@link #onSuccess(AjaxRequestTarget)} or - * {@link #onFailure(AjaxRequestTarget, String)} - */ -public abstract class VerifyBehavior extends AbstractDefaultAjaxBehavior -{ - - private static final long serialVersionUID = 1L; - - @Override - public void renderHead(final Component component, final IHeaderResponse response) - { - component.setOutputMarkupId(true); - super.renderHead(component, response); - - final Map variables = new HashMap(); - variables.put("componentId", component.getMarkupId()); - variables.put("callbackUrl", getCallbackUrl()); - - final TextTemplate verifyTemplate = new PackageTextTemplate(VerifyBehavior.class, - "verify.js.tmpl"); - String asString = verifyTemplate.asString(variables); - response.render(OnDomReadyHeaderItem.forScript(asString)); - } - - @Override - protected void respond(AjaxRequestTarget target) - { - RequestCycle cycle = RequestCycle.get(); - Request request = cycle.getRequest(); - StringValue assertionParam = request.getQueryParameters().getParameterValue("assertion"); - StringValue audienceParam = request.getQueryParameters().getParameterValue("audience"); - - if (assertionParam.isEmpty() == false && audienceParam.isEmpty() == false) - { - String failureReason = verify(assertionParam.toString(), audienceParam.toString()); - if (failureReason == null) - { - onSuccess(target); - } - else - { - onFailure(target, failureReason); - } - } - } - - private String verify(final String assertion, final String audience) - { - String failureReason = null; - try - { - URL verifyUrl = new URL("https://browserid.org/verify"); - URLConnection urlConnection = verifyUrl.openConnection(); - urlConnection.setDoOutput(true); - OutputStream outputStream = urlConnection.getOutputStream(); - String postParams = "assertion=" + assertion + "&audience=" + audience; - outputStream.write(postParams.getBytes()); - outputStream.close(); - - String response = IOUtils.toString(urlConnection.getInputStream(), "UTF-8"); - - BrowserId browserId = BrowserId.of(response); - if (browserId != null) - { - if (Status.OK.equals(browserId.getStatus())) - { - SessionHelper.logIn(Session.get(), browserId); - } - else - { - failureReason = browserId.getReason(); - } - } - } - catch (IOException e) - { - failureReason = e.getMessage(); - } - - return failureReason; - } - - protected abstract void onSuccess(AjaxRequestTarget target); - - protected abstract void onFailure(AjaxRequestTarget target, String failureReason); - -} diff --git a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/verify.js.tmpl b/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/verify.js.tmpl deleted file mode 100644 index baff7519b9..0000000000 --- a/browserid-parent/browserid/src/main/java/org/wicketstuff/browserid/verify.js.tmpl +++ /dev/null @@ -1,31 +0,0 @@ -(function(w) { - - w.Event.add(window, "domready", function(event) { - - var gotVerifiedEmail - , signInButton - , callbackUrl = "${callbackUrl}"; - - gotVerifiedEmail = function (assertion) { - - if (assertion) { - if (callbackUrl.indexOf('?') > -1) { - callbackUrl += '&'; - } else { - callbackUrl += '?'; - } - callbackUrl += "assertion="+assertion; - callbackUrl += "&audience="+window.location.host; - wicketAjaxGet(callbackUrl, null, null, function() {return true}); - } - }; - - signInButton = w.$("${componentId}"); - signInButton.style.cursor = "pointer"; - - w.Event.add(signInButton, "click", function(event) { - navigator.id.getVerifiedEmail(gotVerifiedEmail); - }); - }); - -})(Wicket); \ No newline at end of file diff --git a/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_blue.png b/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_blue.png deleted file mode 100644 index 919a5c7a35..0000000000 Binary files a/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_blue.png and /dev/null differ diff --git a/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_green.png b/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_green.png deleted file mode 100644 index 7e84129b4a..0000000000 Binary files a/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_green.png and /dev/null differ diff --git a/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_grey.png b/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_grey.png deleted file mode 100644 index 467bde42b6..0000000000 Binary files a/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_grey.png and /dev/null differ diff --git a/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_orange.png b/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_orange.png deleted file mode 100644 index 1c7c7925d1..0000000000 Binary files a/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_orange.png and /dev/null differ diff --git a/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_red.png b/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_red.png deleted file mode 100644 index 96d1f98fde..0000000000 Binary files a/browserid-parent/browserid/src/main/resources/org/wicketstuff/browserid/sign_in_red.png and /dev/null differ diff --git a/closure-compiler/pom.xml b/closure-compiler/pom.xml index b535d4f449..f7d49636e6 100644 --- a/closure-compiler/pom.xml +++ b/closure-compiler/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-closure-compiler @@ -24,7 +24,7 @@ org.slf4j - slf4j-log4j12 + slf4j-api org.slf4j diff --git a/console-parent/console/pom.xml b/console-parent/console/pom.xml index bed5f7d439..0a68d39ab1 100644 --- a/console-parent/console/pom.xml +++ b/console-parent/console/pom.xml @@ -37,7 +37,7 @@ org.slf4j - slf4j-log4j12 + slf4j-api javax.servlet diff --git a/dashboard-parent/dashboard-core/pom.xml b/dashboard-parent/dashboard-core/pom.xml index 4a23688874..78f98fa394 100644 --- a/dashboard-parent/dashboard-core/pom.xml +++ b/dashboard-parent/dashboard-core/pom.xml @@ -7,17 +7,13 @@ org.wicketstuff wicketstuff-dashboard-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-dashboard-core jar Wicketstuff Dashboard Core - - 1.4.9 - - @@ -31,5 +27,21 @@ xstream ${xstream.version} + + + + junit + junit + + + javax.servlet + javax.servlet-api + provided + + + org.slf4j + slf4j-simple + test + diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/AbstractWidget.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/AbstractWidget.java index 039e6e0e14..e11e076673 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/AbstractWidget.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/AbstractWidget.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -18,55 +18,56 @@ import org.apache.wicket.markup.html.panel.Panel; /** - * Abstract stub implementation for {@link Widget} to simplify defining of actual widgets + * Abstract stub implementation for {@link Widget} to simplify defining of + * actual widgets + * * @author Decebal Suiu */ public abstract class AbstractWidget implements Widget { - private static final long serialVersionUID = 1L; - + protected String id; protected String title; protected boolean collapsed; - protected Map settings; - protected WidgetLocation location; + protected Map settings; + protected WidgetLocation location; - public AbstractWidget() { + public AbstractWidget() { settings = new HashMap(); location = new WidgetLocation(); } - - @Override - public String getId() { + + @Override + public String getId() { return id; } - @Override + @Override public void setId(String id) { this.id = id; } - @Override + @Override public String getTitle() { return title; } - @Override + @Override public void setTitle(String title) { this.title = title; } - @Override + @Override public boolean isCollapsed() { return collapsed; } - @Override + @Override public void setCollapsed(boolean collapsed) { this.collapsed = collapsed; -// getInternalSettings().put(COLLAPSED, Boolean.toString(collapsed)); + // getInternalSettings().put(COLLAPSED, Boolean.toString(collapsed)); } - + @Override public WidgetLocation getLocation() { return location; @@ -77,59 +78,59 @@ public void setLocation(WidgetLocation location) { this.location = location; } + @Override public void init() { // do nothing } - - @Override + + @Override public boolean hasSettings() { return false; } - @Override + @Override public Map getSettings() { return settings; } - @Override + @Override public void setSettings(Map settings) { this.settings = settings; } - @Override + @Override public Panel createSettingsPanel(String settingsPanelId) { return null; } - + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((title == null) ? 0 : title.hashCode()); + return result; + } + @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - AbstractWidget widget = (AbstractWidget) o; - - if (!title.equals(widget.title)) { - return false; - } - - if (!id.equals(widget.id)) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result; - result = id.hashCode(); - result = 31 * result + title.hashCode(); - return result; - } - + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AbstractWidget other = (AbstractWidget) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + if (title == null) { + if (other.title != null) + return false; + } else if (!title.equals(other.title)) + return false; + return true; + } } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DashboardContextInitializer.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DashboardContextInitializer.java index f02d36b47a..de64e56576 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DashboardContextInitializer.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DashboardContextInitializer.java @@ -1,11 +1,11 @@ /* * Copyright 2013 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -27,18 +27,18 @@ public class DashboardContextInitializer implements IInitializer { @SuppressWarnings("serial") public static MetaDataKey DASHBOARD_CONTEXT_KEY = new MetaDataKey() {}; - + @Override public void init(Application application) { // create dashboard context DashboardContext dashboardContext = new DashboardContext(); - + // store dashboard context in application - application.setMetaData(DASHBOARD_CONTEXT_KEY, dashboardContext); - - // add dashboard context injector - DashboardContextInjector dashboardContextInjector = new DashboardContextInjector(dashboardContext); - application.getComponentInstantiationListeners().add(dashboardContextInjector); + application.setMetaData(DASHBOARD_CONTEXT_KEY, dashboardContext); + + // add dashboard context injector + DashboardContextInjector dashboardContextInjector = new DashboardContextInjector(dashboardContext); + application.getComponentInstantiationListeners().add(dashboardContextInjector); } @Override @@ -46,4 +46,7 @@ public void destroy(Application application) { // does noting } + public static DashboardContext getDashboardContext() { + return Application.get().getMetaData(DASHBOARD_CONTEXT_KEY); + } } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DashboardUtils.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DashboardUtils.java index 6fa1628def..264e1170af 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DashboardUtils.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DashboardUtils.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -21,35 +21,35 @@ * @author Decebal Suiu */ public class DashboardUtils { - + @SuppressWarnings("unchecked") public static void updateWidgetLocations(Dashboard dashboard, DashboardEvent dashboardEvent) { DashboardEvent.EventType eventType = dashboardEvent.getType(); if (DashboardEvent.EventType.WIDGET_ADDED == eventType) { List widgets = dashboard.getWidgets(0); - for (Widget widget : widgets) { - widget.getLocation().incrementRow(); - } + for (Widget widget : widgets) { + widget.getLocation().incrementRow(); + } } else if (DashboardEvent.EventType.WIDGET_REMOVED == eventType) { Widget widgetRemoved = (Widget) dashboardEvent.getDetail(); WidgetLocation widgetRemovedLocation = widgetRemoved.getLocation(); List widgets = dashboard.getWidgets(widgetRemovedLocation.getColumn()); - for (Widget widget : widgets) { - WidgetLocation widgetLocation = widget.getLocation(); - if (widgetLocation.getRow() > widgetRemovedLocation.getRow()) { - widget.getLocation().decrementRow(); - } - } + for (Widget widget : widgets) { + WidgetLocation widgetLocation = widget.getLocation(); + if (widgetLocation.getRow() > widgetRemovedLocation.getRow()) { + widget.getLocation().decrementRow(); + } + } } else if (DashboardEvent.EventType.WIDGETS_SORTED == eventType) { Map widgetLocations = (Map) dashboardEvent.getDetail(); List widgets = dashboard.getWidgets(); - for (Widget widget : widgets) { - String id = widget.getId(); - WidgetLocation location = widgetLocations.get(id); - if (!location.equals(widget.getLocation())) { - widget.setLocation(location); - } - } + for (Widget widget : widgets) { + String id = widget.getId(); + WidgetLocation location = widgetLocations.get(id); + if (!location.equals(widget.getLocation())) { + widget.setLocation(location); + } + } } } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DefaultDashboard.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DefaultDashboard.java index dd39ef66be..9c83ceeddc 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DefaultDashboard.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/DefaultDashboard.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -24,12 +24,12 @@ public class DefaultDashboard implements Dashboard { private static final long serialVersionUID = 1L; - + private String id; private String title; private int columnCount; private List widgets; - + public DefaultDashboard(String id, String title) { this.id = id; this.title = title; @@ -55,18 +55,18 @@ public void setTitle(String title) { @Override public int getColumnCount() { return columnCount; - } + } @Override public void setColumnCount(int columnCount) { this.columnCount = columnCount; } - + @Override public List getWidgets() { return widgets; } - + @Override public List getWidgets(int column) { List columnWidgets = new ArrayList(); @@ -75,13 +75,13 @@ public List getWidgets(int column) { columnWidgets.add(widget); } } - + // sort widgets by row Collections.sort(columnWidgets, new WidgetComparator()); - + return columnWidgets; } - + @Override public Widget getWidget(String widgetId) { for (Widget widget : widgets) { @@ -89,7 +89,7 @@ public Widget getWidget(String widgetId) { return widget; } } - + return null; } @@ -101,15 +101,15 @@ public void setWidgets(List widgets) { public void addWidget(Widget widget) { widgets.add(widget); } - + @Override public void deleteWidget(String widgetId) { Widget widget = getWidget(widgetId); if (widget != null) { widgets.remove(widget); } - } - + } + @Override public String toString() { StringBuffer buffer = new StringBuffer(); @@ -121,5 +121,5 @@ public String toString() { return buffer.toString(); } - + } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/WidgetAction.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/WidgetAction.java index 8bed282959..043cbaf131 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/WidgetAction.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/WidgetAction.java @@ -12,12 +12,11 @@ */ package org.wicketstuff.dashboard; -import org.apache.wicket.markup.html.image.Image; +import java.io.Serializable; + import org.apache.wicket.markup.html.link.AbstractLink; import org.apache.wicket.model.IModel; -import java.io.Serializable; - /** * Interface for actions that can be performed over a widget * @author Decebal Suiu @@ -26,8 +25,7 @@ public interface WidgetAction extends Serializable { public AbstractLink getLink(String id); - public Image getImage(String id); + public String getCssClass(); public IModel getTooltip(); - } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/XStreamDashboardPersister.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/XStreamDashboardPersister.java index 1d75fce99c..917b8b90c2 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/XStreamDashboardPersister.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/XStreamDashboardPersister.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -28,26 +28,26 @@ * @author Decebal Suiu */ public class XStreamDashboardPersister implements DashboardPersister { - + private File file; private XStream xstream; - + public XStreamDashboardPersister(File file) { this.file = file; - - xstream = new XStream(new DomDriver("UTF-8")); - xstream.setMode(XStream.NO_REFERENCES); - xstream.alias("dashboard", DefaultDashboard.class); -// xstream.alias("textWidget", TextWidget.class); -// xstream.alias("chartWidget", ChartWidget.class); + + xstream = new XStream(new DomDriver("UTF-8")); + xstream.setMode(XStream.NO_REFERENCES); + xstream.alias("dashboard", DefaultDashboard.class); +// xstream.alias("textWidget", TextWidget.class); +// xstream.alias("chartWidget", ChartWidget.class); } - + @Override public Dashboard load() { if (!file.exists() || !file.isFile()) { return null; } - + try { return (Dashboard) xstream.fromXML(new FileInputStream(file)); } catch (FileNotFoundException e) { @@ -60,7 +60,7 @@ public Dashboard load() { public void save(Dashboard dashboard) { // sort widgets Collections.sort(dashboard.getWidgets(), new WidgetComparator()); - + try { xstream.toXML(dashboard, new FileOutputStream(file)); } catch (FileNotFoundException e) { diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/AbstractWidgetAction.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/AbstractWidgetAction.java index df17aa677e..997cb2981f 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/AbstractWidgetAction.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/AbstractWidgetAction.java @@ -12,11 +12,7 @@ */ package org.wicketstuff.dashboard.web; -import org.apache.wicket.markup.html.image.Image; import org.apache.wicket.model.IModel; -import org.apache.wicket.request.resource.ContextRelativeResource; -import org.apache.wicket.request.resource.PackageResourceReference; -import org.apache.wicket.util.lang.Args; import org.wicketstuff.dashboard.Widget; import org.wicketstuff.dashboard.WidgetAction; @@ -24,58 +20,34 @@ * @author Decebal Suiu */ public abstract class AbstractWidgetAction implements WidgetAction { - - protected Widget widget; - protected IModel tooltip; - private Class imageScope; - private String imageName; - - public AbstractWidgetAction(Widget widget) { - this.widget = widget; - } - - public Widget getWidget() { - return widget; - } - - @Override - public IModel getTooltip() { - return tooltip; - } - - public void setTooltip(IModel tooltip) { - this.tooltip = tooltip; - } - - /** - * If you use this method than the image name is relative to scope. - * - * @param scope - * @param name - */ - public void setImage(Class scope, String name) { - imageScope = scope; - imageName = name; - } - - /** - * If you use this method than the image name is relative to context. - * - * @param name - */ - public void setImage(String name) { - setImage(null, name); - } - - @Override - public Image getImage(String id) { - Args.notNull(imageName, "imageName"); - - if (imageScope != null) { - return new Image(id, new PackageResourceReference(imageScope, imageName)); - } - - return new Image(id, new ContextRelativeResource(imageName)); - } - + private static final long serialVersionUID = 1L; + protected Widget widget; + protected IModel tooltip; + private String cssClass; + + public AbstractWidgetAction(Widget widget) { + this.widget = widget; + } + + public Widget getWidget() { + return widget; + } + + @Override + public IModel getTooltip() { + return tooltip; + } + + public void setTooltip(IModel tooltip) { + this.tooltip = tooltip; + } + + public void setCssClass(String cssClass) { + this.cssClass = cssClass; + } + + @Override + public String getCssClass() { + return cssClass; + } } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardColumnPanel.html b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardColumnPanel.html index b6bad61754..9540db4713 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardColumnPanel.html +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardColumnPanel.html @@ -1,10 +1,10 @@ -
    -
  • -
    -
  • -
+
    +
  • +
    +
  • +
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardColumnPanel.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardColumnPanel.java index a8addc8227..60ce1cdcbf 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardColumnPanel.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardColumnPanel.java @@ -1,23 +1,25 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.wicketstuff.dashboard.web; +import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; +import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.event.Broadcast; import org.apache.wicket.markup.head.IHeaderResponse; @@ -36,21 +38,21 @@ * @author Decebal Suiu */ class DashboardColumnPanel extends GenericPanel { - - private static final long serialVersionUID = 1L; - + + private static final long serialVersionUID = 1L; + private SortableAjaxBehavior sortableAjaxBehavior; - + public DashboardColumnPanel(String id, final IModel dashboardModel, int columnIndex) { super(id, dashboardModel); - - WebMarkupContainer columnContainer = new WebMarkupContainer("columnContainer"); - columnContainer.setOutputMarkupId(true); - columnContainer.setMarkupId("column-" + columnIndex); + + WebMarkupContainer columnContainer = new WebMarkupContainer("columnContainer"); + columnContainer.setOutputMarkupId(true); + columnContainer.setMarkupId("column-" + columnIndex); final List widgets = getModelObject().getWidgets(columnIndex); ListView listView = new ListView("widgetList", widgets) { - + private static final long serialVersionUID = 1L; @Override @@ -59,21 +61,21 @@ protected void populateItem(ListItem item) { // TODO problems if I add WidgetLoadingPanel // if (widget.isCollapsed()) { IModel widgetModel = new WidgetModel(dashboardModel, widget.getId()); - WidgetPanel widgetPanel = createWidgetPanel("widget", widgetModel); - item.add(widgetPanel); + WidgetPanel widgetPanel = createWidgetPanel("widget", widgetModel); + item.add(widgetPanel); // } else { // item.add(new WidgetLoadingPanel("widget", new WidgetModel(widget.getId()))); // } - + item.setOutputMarkupId(true); item.setMarkupId("widget-" + widget.getId()); } - }; - + }; + columnContainer.add(listView); add(columnContainer); - + if (columnIndex == 0) { add(new AttributeModifier("style", "margin-left: 0px")); } @@ -82,7 +84,7 @@ protected void populateItem(ListItem item) { public WebMarkupContainer getColumnContainer() { return (WebMarkupContainer) get("columnContainer"); } - + public Dashboard getDashboard() { return getModelObject(); } @@ -90,10 +92,10 @@ public Dashboard getDashboard() { @Override protected void onInitialize() { super.onInitialize(); - + addSortableBehavior(getColumnContainer()); } - + private WidgetPanel createWidgetPanel(String id, IModel model) { return new WidgetPanel(id, model); } @@ -107,55 +109,56 @@ private void addSortableBehavior(Component component) { public void onSort(AjaxRequestTarget target, Map widgetLocations) { send(getPage(), Broadcast.BREADTH, new DashboardEvent(target, DashboardEvent.EventType.WIDGETS_SORTED, widgetLocations)); } - + }; component.add(sortableAjaxBehavior); } @Override public void renderHead(IHeaderResponse response) { - super.renderHead(response); + super.renderHead(response); - CharSequence script = sortableAjaxBehavior.getCallbackFunctionBody(); + CharSequence script = sortableAjaxBehavior.getCallbackFunctionBody(); - Map vars = new HashMap(); - vars.put("component", get("columnContainer").getMarkupId()); - vars.put("stopBehavior", script.toString()); + Map vars = new HashMap(); + vars.put("component", get("columnContainer").getMarkupId()); + vars.put("stopBehavior", script.toString()); - PackageTextTemplate template = new PackageTextTemplate(DashboardColumnPanel.class, "res/sort-behavior.template.js"); - template.interpolate(vars); + try (PackageTextTemplate template = new PackageTextTemplate(DashboardColumnPanel.class, "res/sort-behavior.template.js");) { + template.interpolate(vars); + response.render(OnDomReadyHeaderItem.forScript(template.getString())); + } catch (IOException e) { + throw new WicketRuntimeException(e); + } + } - response.render(OnDomReadyHeaderItem.forScript(template.getString())); - } - /* private class WidgetLoadingPanel extends AjaxLazyLoadPanel { private static final long serialVersionUID = 1L; public WidgetLoadingPanel(String id, IModel model) { - super(id, model); + super(id, model); } @Override - public Component getLazyLoadComponent(String id) { + public Component getLazyLoadComponent(String id) { return createWidgetPanel(id, (WidgetModel) this.getDefaultModel()); - } - + } + @Override - public Component getLoadingComponent(final String markupId) { + public Component getLoadingComponent(final String markupId) { Widget widget = (Widget) this.getDefaultModelObject(); int height = 330; - - return new Label(markupId, + + return new Label(markupId, "
" + "

Widget '" + widget.getTitle() + "' is loading ..." + "

"). setEscapeModelStrings(false); } - + } */ - } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardContextInjector.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardContextInjector.java index b4cb5d9f71..8308e50ec2 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardContextInjector.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardContextInjector.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -22,11 +22,11 @@ public class DashboardContextInjector implements IComponentInstantiationListener { private DashboardContext dashboardContext; - + public DashboardContextInjector() { dashboardContext = new DashboardContext(); } - + public DashboardContextInjector(DashboardContext dashboardContext) { this.dashboardContext = dashboardContext; } @@ -41,5 +41,4 @@ public void onInstantiation(Component component) { ((DashboardContextAware) component).setDashboardContext(dashboardContext); } } - } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardPanel.html b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardPanel.html index 7230687da3..838872e9bb 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardPanel.html +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardPanel.html @@ -1,8 +1,8 @@ -
-
-
+
+
+
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardPanel.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardPanel.java index 94cdac04a9..bcee42e8d5 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardPanel.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardPanel.java @@ -12,6 +12,11 @@ */ package org.wicketstuff.dashboard.web; +import static org.wicketstuff.dashboard.DashboardContextInitializer.getDashboardContext; + +import java.util.ArrayList; +import java.util.List; + import org.apache.wicket.AttributeModifier; import org.apache.wicket.event.IEvent; import org.apache.wicket.markup.head.CssHeaderItem; @@ -25,21 +30,15 @@ import org.wicketstuff.dashboard.DashboardUtils; import org.wicketstuff.dashboard.Widget; -import java.util.ArrayList; -import java.util.List; - /** * Wicket {@link Panel} which should be used on a page to render a {@link Dashboard} * @author Decebal Suiu */ -public class DashboardPanel extends GenericPanel implements DashboardContextAware { - +public class DashboardPanel extends GenericPanel { private static final long serialVersionUID = 1L; - private transient DashboardContext dashboardContext; - private List columnPanels; - private IModel rtlModel; + private IModel rtlModel; public DashboardPanel(String id, IModel model) { super(id, model); @@ -53,18 +52,6 @@ public Dashboard getDashboard() { return getModelObject(); } - @Override - public void setDashboardContext(DashboardContext dashboardContext) { - this.dashboardContext = dashboardContext; - } - - /** - * Used by children. - */ - public DashboardContext getDashboardContext() { - return dashboardContext; - } - @Override public void onEvent(IEvent event) { super.onEvent(event); @@ -82,31 +69,31 @@ public void onEvent(IEvent event) { } } - /** - * Use this method if you want to add RightToLeft support. - * - * @param rtlModel - */ - public DashboardPanel setRtlModel(IModel rtlModel) { - this.rtlModel = rtlModel; - return this; - } - - @Override - public void renderHead(IHeaderResponse response) { - super.renderHead(response); - - if ((rtlModel != null) && (rtlModel.getObject() == Boolean.TRUE)) { - response.render(CssHeaderItem.forReference(DashboardSettings.get().getRtlCssReference())); - } - } + /** + * Use this method if you want to add RightToLeft support. + * + * @param rtlModel + */ + public DashboardPanel setRtlModel(IModel rtlModel) { + this.rtlModel = rtlModel; + return this; + } + + @Override + public void renderHead(IHeaderResponse response) { + super.renderHead(response); + + if ((rtlModel != null) && (rtlModel.getObject() == Boolean.TRUE)) { + response.render(CssHeaderItem.forReference(DashboardSettings.get().getRtlCssReference())); + } + } private void onWidgetAdded(DashboardEvent dashboardEvent) { Widget addedWidget = (Widget) dashboardEvent.getDetail(); Dashboard dashboard = getDashboard(); DashboardUtils.updateWidgetLocations(dashboard, dashboardEvent); dashboard.addWidget(addedWidget); - dashboardContext.getDashboardPersister().save(dashboard); + getDashboardContext().getDashboardPersister().save(dashboard); } private void onWidgetRemoved(DashboardEvent dashboardEvent) { @@ -114,25 +101,24 @@ private void onWidgetRemoved(DashboardEvent dashboardEvent) { Dashboard dashboard = getDashboard(); DashboardUtils.updateWidgetLocations(dashboard, dashboardEvent); dashboard.deleteWidget(removedWidget.getId()); - dashboardContext.getDashboardPersister().save(dashboard); + getDashboardContext().getDashboardPersister().save(dashboard); } protected void onWidgetsSorted(DashboardEvent dashboardEvent) { Dashboard dashboard = getDashboard(); DashboardUtils.updateWidgetLocations(dashboard, dashboardEvent); - dashboardContext.getDashboardPersister().save(dashboard); + getDashboardContext().getDashboardPersister().save(dashboard); } private void addColumnsPanel() { final int columnCount = getDashboard().getColumnCount(); Loop columnsView = new Loop("columns", columnCount) { - private static final long serialVersionUID = 1L; @Override protected void onBeforeRender() { if (!hasBeenRendered()) { - columnPanels = new ArrayList(); + columnPanels = new ArrayList<>(); } super.onBeforeRender(); @@ -140,17 +126,15 @@ protected void onBeforeRender() { @Override protected void populateItem(LoopItem item) { - float columnPanelWidth = 100f / columnCount; - DashboardColumnPanel columnPanel = new DashboardColumnPanel("column", getModel(), item.getIndex()); - columnPanel.setRenderBodyOnly(true); - columnPanel.getColumnContainer().add(AttributeModifier.replace("style", "width: " + columnPanelWidth + "%;")); - item.add(columnPanel); + float columnPanelWidth = 100f / columnCount; + DashboardColumnPanel columnPanel = new DashboardColumnPanel("column", getModel(), item.getIndex()); + columnPanel.setRenderBodyOnly(true); + columnPanel.getColumnContainer().add(AttributeModifier.replace("style", "width: " + columnPanelWidth + "%;")); + item.add(columnPanel); - columnPanels.add(columnPanel); + columnPanels.add(columnPanel); } - }; add(columnsView); } - } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardResourcesBehavior.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardResourcesBehavior.java index c88dd71fc0..6a752043c7 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardResourcesBehavior.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardResourcesBehavior.java @@ -19,7 +19,7 @@ import org.apache.wicket.markup.head.JavaScriptHeaderItem; /** - * Provides required resources (JS, CSS) in a head. + * Provides required resources (JS, CSS) in a head. * Should be attached to a component which require these resources * @author Decebal Suiu */ @@ -33,10 +33,6 @@ public void renderHead(Component component, IHeaderResponse response) { DashboardSettings settings = DashboardSettings.get(); - if (settings.isIncludeJQuery()) { - response.render(JavaScriptHeaderItem.forReference(settings.getJQueryReference())); - } - if (settings.isIncludeJQueryUI()) { response.render(JavaScriptHeaderItem.forReference(settings.getJQueryUIReference())); } @@ -51,9 +47,9 @@ public void renderHead(Component component, IHeaderResponse response) { if (settings.isIncludeCss()) { response.render(CssHeaderItem.forReference(settings.getCssReference())); - if (settings.isRtl()) { - response.render(CssHeaderItem.forReference(settings.getRtlCssReference())); - } + if (settings.isRtl()) { + response.render(CssHeaderItem.forReference(settings.getRtlCssReference())); + } } } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardSettings.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardSettings.java index 0e9041d43c..4c2d81ba7c 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardSettings.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DashboardSettings.java @@ -30,21 +30,18 @@ public class DashboardSettings { DashboardSettings.class, "res/dashboard.js"); private ResourceReference cssReference = new PackageResourceReference( DashboardSettings.class, "res/dashboard.css"); - private ResourceReference rtlCssReference = new PackageResourceReference( - DashboardSettings.class, "res/dashboard-rtl.css"); - private ResourceReference jqueryReference = new PackageResourceReference( - DashboardSettings.class, "res/jquery-1.8.3.min.js"); + private ResourceReference rtlCssReference = new PackageResourceReference( + DashboardSettings.class, "res/dashboard-rtl.css"); private ResourceReference jqueryUIReference = new PackageResourceReference( DashboardSettings.class, "res/jquery-ui-1.9.2.min.js"); private ResourceReference jqueryJsonReference = new PackageResourceReference( DashboardSettings.class, "res/jquery.json-2.2.min.js"); - private boolean includeJQuery = false; private boolean includeJQueryUI = true; private boolean includeJQueryJson = true; private boolean includeJavaScript = true; private boolean includeCss = true; - private boolean rtl = false; + private boolean rtl = false; /** * Private constructor, use {@link #get()} instead. @@ -52,15 +49,6 @@ public class DashboardSettings { private DashboardSettings() { } - public boolean isIncludeJQuery() { - return includeJQuery; - } - - public DashboardSettings setIncludeJQuery(boolean includeJQuery) { - this.includeJQuery = includeJQuery; - return this; - } - public boolean isIncludeJQueryUI() { return includeJQueryUI; } @@ -96,15 +84,6 @@ public DashboardSettings setIncludeCss(boolean includeCss) { return this; } - public ResourceReference getJQueryReference() { - return jqueryReference; - } - - public DashboardSettings setJQueryReference(ResourceReference jqueryReference) { - this.jqueryReference = jqueryReference; - return this; - } - public ResourceReference getJQueryUIReference() { return jqueryUIReference; } @@ -141,24 +120,24 @@ public DashboardSettings setCssReference(ResourceReference cssReference) { return this; } - public ResourceReference getRtlCssReference() { - return rtlCssReference; - } + public ResourceReference getRtlCssReference() { + return rtlCssReference; + } - public DashboardSettings setRtlCssReference(ResourceReference rtlCssReference) { - this.rtlCssReference = rtlCssReference; - return this; - } + public DashboardSettings setRtlCssReference(ResourceReference rtlCssReference) { + this.rtlCssReference = rtlCssReference; + return this; + } - public boolean isRtl() { - return rtl; - } + public boolean isRtl() { + return rtl; + } - public void setRtl(boolean rtl) { - this.rtl = rtl; - } + public void setRtl(boolean rtl) { + this.rtl = rtl; + } - /** + /** * Retrieves the instance of settings object. * * @return settings instance diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DefaultWidgetActions.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DefaultWidgetActions.java index c8a9517b43..82af207322 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DefaultWidgetActions.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/DefaultWidgetActions.java @@ -32,120 +32,110 @@ * @author Decebal Suiu */ public class DefaultWidgetActions { + public static class Refresh extends AbstractWidgetAction { + private static final long serialVersionUID = 1L; - public static class Refresh extends AbstractWidgetAction { + public Refresh(Widget widget) { + super(widget); - private static final long serialVersionUID = 1L; + tooltip = new ResourceModel("refresh"); - public Refresh(Widget widget) { - super(widget); + setCssClass("icon refresh"); + } - tooltip = new ResourceModel("refresh"); + @Override + public AbstractLink getLink(String id) { + return new AjaxLink(id) { - setImage(DefaultWidgetActions.class, "res/refresh.gif"); - } + private static final long serialVersionUID = 1L; - @Override - public AbstractLink getLink(String id) { - return new AjaxLink(id) { + @Override + public void onClick(AjaxRequestTarget target) { + WidgetView widgetView = findParent(WidgetPanel.class).getWidgetView(); + target.add(widgetView); + } - private static final long serialVersionUID = 1L; + }; + } + } - @Override - public void onClick(AjaxRequestTarget target) { - WidgetView widgetView = findParent(WidgetPanel.class).getWidgetView(); - target.add(widgetView); - } + public static class Delete extends AbstractWidgetAction { + private static final long serialVersionUID = 1L; - }; - } + public Delete(Widget widget) { + super(widget); - } + tooltip = new ResourceModel("delete"); - public static class Delete extends AbstractWidgetAction { + setCssClass("icon delete"); + } - private static final long serialVersionUID = 1L; + @Override + public AbstractLink getLink(String id) { + AjaxConfirmLink deleteLink = new AjaxConfirmLink(id) { + private static final long serialVersionUID = 1L; - public Delete(Widget widget) { - super(widget); + @Override + public void onClick(AjaxRequestTarget target) { + send(getPage(), Broadcast.BREADTH, new DashboardEvent(target, DashboardEvent.EventType.WIDGET_REMOVED, widget)); + // the widget is removed from ui with javascript (with a IAjaxCallListener) -> see getAjaxCallListener() + } - tooltip = new ResourceModel("delete"); + @Override + protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { + super.updateAjaxAttributes(attributes); - setImage(DefaultWidgetActions.class, "res/delete.gif"); - } + attributes.getAjaxCallListeners().add(new AjaxCallListener() { - @Override - public AbstractLink getLink(String id) { - AjaxConfirmLink deleteLink = new AjaxConfirmLink(id) { + private static final long serialVersionUID = 1L; - private static final long serialVersionUID = 1L; + @Override + public CharSequence getSuccessHandler(Component component) { + return "$('#widget-" + widget.getId() + "').remove();"; + } - @Override - public void onClick(AjaxRequestTarget target) { - send(getPage(), Broadcast.BREADTH, new DashboardEvent(target, DashboardEvent.EventType.WIDGET_REMOVED, widget)); - // the widget is removed from ui with javascript (with a IAjaxCallListener) -> see getAjaxCallListener() - } + }); + } - @Override - protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { - super.updateAjaxAttributes(attributes); + @Override + protected void onInitialize() { + super.onInitialize(); + IModel resourceModel = new StringResourceModel("deleteAsk", this, Model.of(widget.getTitle())); + setConfirmMessage(resourceModel.getObject()); + } + }; - attributes.getAjaxCallListeners().add(new AjaxCallListener() { + return deleteLink; + } + } - private static final long serialVersionUID = 1L; + public static class Settings extends AbstractWidgetAction { + private static final long serialVersionUID = 1L; - @Override - public CharSequence getSuccessHandler(Component component) { - return "$('#widget-" + widget.getId() + "').remove();"; - } + public Settings(Widget widget) { + super(widget); - }); - } + tooltip = new ResourceModel("settings"); - @Override - protected void onInitialize() { - super.onInitialize(); - IModel resourceModel = new StringResourceModel("deleteAsk", this, Model.of(widget.getTitle())); - setConfirmMessage(resourceModel.getObject()); - } - }; + setCssClass("icon edit"); + } - return deleteLink; - } + @Override + public AbstractLink getLink(String id) { + return new AjaxLink(id) { - } - - public static class Settings extends AbstractWidgetAction { - - private static final long serialVersionUID = 1L; - - public Settings(Widget widget) { - super(widget); - - tooltip = new ResourceModel("settings"); - - setImage(DefaultWidgetActions.class, "res/edit.png"); - } - - @Override - public AbstractLink getLink(String id) { - return new AjaxLink(id) { - - private static final long serialVersionUID = 1L; - - @Override - public void onClick(AjaxRequestTarget target) { - if (widget.hasSettings()) { - WidgetPanel widgetPanel = findParent(WidgetPanel.class); - Panel settingsPanel = widgetPanel.getSettingsPanel(); - settingsPanel.setVisible(true); - target.add(settingsPanel); - } - } - - }; - } - - } + private static final long serialVersionUID = 1L; + @Override + public void onClick(AjaxRequestTarget target) { + if (widget.hasSettings()) { + WidgetPanel widgetPanel = findParent(WidgetPanel.class); + Panel settingsPanel = widgetPanel.getSettingsPanel(); + settingsPanel.setVisible(true); + target.add(settingsPanel); + } + } + }; + } + } } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/SortableAjaxBehavior.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/SortableAjaxBehavior.java index 1c322572d7..6b9639d626 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/SortableAjaxBehavior.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/SortableAjaxBehavior.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -26,24 +26,23 @@ * @author Decebal Suiu */ public abstract class SortableAjaxBehavior extends AbstractDefaultAjaxBehavior { - private static final long serialVersionUID = 1L; /** Sorted identifiant into the request */ private static final String JSON_DATA = "data"; - + public abstract void onSort(AjaxRequestTarget target, Map widgetLocations); - - @Override - protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { - super.updateAjaxAttributes(attributes); - StringBuilder buffer = new StringBuilder(); - buffer.append("var data = serializeWidgetLocations();"); - buffer.append("return {'" + JSON_DATA + "': data};"); + @Override + protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { + super.updateAjaxAttributes(attributes); - attributes.getDynamicExtraParameters().add(buffer); - } + StringBuilder buffer = new StringBuilder(); + buffer.append("var data = serializeWidgetLocations();"); + buffer.append("return {'" + JSON_DATA + "': data};"); + + attributes.getDynamicExtraParameters().add(buffer); + } @Override protected void respond(AjaxRequestTarget target) { @@ -54,7 +53,7 @@ protected void respond(AjaxRequestTarget target) { WidgetLocation location = new WidgetLocation(item.column, item.sortIndex); locations.put(item.widget, location); } - + onSort(target, locations); } @@ -67,16 +66,15 @@ private Item[] getItems(String jsonData) { System.out.println(item); } */ - + return items; } - + static class Item { - public int column; public String widget; public int sortIndex; - + @Override public String toString() { StringBuffer buffer = new StringBuffer(); @@ -88,7 +86,5 @@ public String toString() { return buffer.toString(); } - } - } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetActionsPanel.html b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetActionsPanel.html index 9175d762f6..e307a7eaf0 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetActionsPanel.html +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetActionsPanel.html @@ -1,12 +1,10 @@ - +
    +
  • + +
  • +
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetActionsPanel.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetActionsPanel.java index 2e82b4ed48..41d95e4614 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetActionsPanel.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetActionsPanel.java @@ -12,6 +12,10 @@ */ package org.wicketstuff.dashboard.web; +import static org.wicketstuff.dashboard.DashboardContextInitializer.getDashboardContext; + +import java.util.List; + import org.apache.wicket.AttributeModifier; import org.apache.wicket.markup.html.link.AbstractLink; import org.apache.wicket.markup.html.list.ListItem; @@ -22,54 +26,39 @@ import org.wicketstuff.dashboard.Widget; import org.wicketstuff.dashboard.WidgetAction; -import java.util.List; - /** * @author Decebal Suiu */ -public class WidgetActionsPanel extends GenericPanel implements DashboardContextAware { - +public class WidgetActionsPanel extends GenericPanel { private static final long serialVersionUID = 1L; - private transient DashboardContext dashboardContext; - public WidgetActionsPanel(String id, IModel model) { super(id, model); IModel> actionsModel = new LoadableDetachableModel>() { - private static final long serialVersionUID = 1L; @Override protected List load() { - return dashboardContext.getWidgetActionsFactory().createWidgetActions(getWidget()); + return getDashboardContext().getWidgetActionsFactory().createWidgetActions(getWidget()); } - }; ListView actionsView = new ListView("action", actionsModel) { - private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem item) { WidgetAction action = item.getModelObject(); AbstractLink link = action.getLink("link"); - link.add(action.getImage("image")); + link.add(AttributeModifier.replace("class", action.getCssClass())); link.add(AttributeModifier.replace("title", action.getTooltip())); item.add(link); } - }; add(actionsView); } - @Override - public void setDashboardContext(DashboardContext dashboardContext) { - this.dashboardContext = dashboardContext; - } - private Widget getWidget() { return getModelObject(); } - } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetHeaderPanel.html b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetHeaderPanel.html index fb00078ef6..9f719d79a6 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetHeaderPanel.html +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetHeaderPanel.html @@ -1,8 +1,8 @@ - -
-
+
+
+
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetHeaderPanel.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetHeaderPanel.java index a383a256f5..e61a69739a 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetHeaderPanel.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetHeaderPanel.java @@ -12,50 +12,37 @@ */ package org.wicketstuff.dashboard.web; +import static org.wicketstuff.dashboard.DashboardContextInitializer.getDashboardContext; + import org.apache.wicket.AttributeModifier; import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.OnDomReadyHeaderItem; +import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.image.Image; import org.apache.wicket.markup.html.panel.GenericPanel; -import org.apache.wicket.model.AbstractReadOnlyModel; import org.apache.wicket.model.IModel; +import org.apache.wicket.model.AbstractReadOnlyModel; import org.apache.wicket.model.PropertyModel; -import org.apache.wicket.request.resource.PackageResourceReference; -import org.apache.wicket.request.resource.ResourceReference; import org.wicketstuff.dashboard.Dashboard; import org.wicketstuff.dashboard.Widget; /** * @author Decebal Suiu */ -public class WidgetHeaderPanel extends GenericPanel implements DashboardContextAware { - +public class WidgetHeaderPanel extends GenericPanel { private static final long serialVersionUID = 1L; - private transient DashboardContext dashboardContext; - public WidgetHeaderPanel(String id, IModel model) { super(id, model); - setMarkupId("header-" + getModelObject().getId()); + setMarkupId("header-" + getModelObject().getId()); - final Image toggle = new Image("toggle", "") { - - @Override - protected ResourceReference getImageResourceReference() { - String name = getWidget().isCollapsed() ? "res/up.png" : "res/down.png"; - - return new PackageResourceReference(WidgetHeaderPanel.class, name); - } - - }; - - toggle.setOutputMarkupId(true); - toggle.add(new AjaxEventBehavior("click") { + final WebMarkupContainer toggle = new WebMarkupContainer("toggle"); + toggle.setOutputMarkupId(true).add(AttributeModifier.replace("class", getCssClass())); + toggle.add(new AjaxEventBehavior("click") { private static final long serialVersionUID = 1L; @Override @@ -67,55 +54,50 @@ protected void onEvent(AjaxRequestTarget target) { // save the new state of widget/dashboard Dashboard dashboard = findParent(DashboardPanel.class).getDashboard(); - dashboardContext.getDashboardPersister().save(dashboard); + getDashboardContext().getDashboardPersister().save(dashboard); // change toggle's image - target.add(toggle); + target.add(toggle.add(AttributeModifier.replace("class", getCssClass()))); // hide/show the widget's view WidgetView widgetView = findParent(WidgetPanel.class).getWidgetView(); target.add(widgetView); } - }); - toggle.add(new AttributeModifier("title", new AbstractReadOnlyModel() { - - private static final long serialVersionUID = 1L; + toggle.add(new AttributeModifier("title", new AbstractReadOnlyModel() { + private static final long serialVersionUID = 1L; @Override - public String getObject() { - return getWidget().isCollapsed() ? getString("expand") : getString("collapse"); - } - - })); + public String getObject() { + return getWidget().isCollapsed() ? getString("expand") : getString("collapse"); + } + })); add(toggle); - add(new Label("title", new PropertyModel(model, "title"))); + add(new Label("title", new PropertyModel(model, "title"))); WidgetActionsPanel actionsPanel = new WidgetActionsPanel("actions", model); add(actionsPanel); } + private String getCssClass() { + return "dragbox-toggle " + (getWidget().isCollapsed() ? "collapsed" : "expanded"); + } + public Widget getWidget() { return getModelObject(); } @Override - public void setDashboardContext(DashboardContext dashboardContext) { - this.dashboardContext = dashboardContext; - } - - @Override - public void renderHead(IHeaderResponse response) { - super.renderHead(response); + public void renderHead(IHeaderResponse response) { + super.renderHead(response); - StringBuilder statement = new StringBuilder("$('#").append(getMarkupId()).append("').on('mouseover', function(ev) {"); - statement.append(" $(this).find('.dragbox-actions').show();"). - append("}).on('mouseout', function(ev) {"). - append(" $(this).find('.dragbox-actions').hide();"). - append("});"); - - response.render(OnDomReadyHeaderItem.forScript(statement.toString())); - } + StringBuilder statement = new StringBuilder("$('#").append(getMarkupId()).append("').on('mouseover', function(ev) {"); + statement.append(" $(this).find('.dragbox-actions').show();"). + append("}).on('mouseout', function(ev) {"). + append(" $(this).find('.dragbox-actions').hide();"). + append("});"); + response.render(OnDomReadyHeaderItem.forScript(statement.toString())); + } } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetModel.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetModel.java index 5b82aa938e..7be897d25b 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetModel.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetModel.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -21,17 +21,16 @@ * @author Decebal Suiu */ public class WidgetModel extends CascadingLoadableDetachableModel { - private static final long serialVersionUID = 1L; private String widgetId; - + public WidgetModel(IModel dashboardModel, String widgetId) { super(dashboardModel); - + this.widgetId = widgetId; } - + public String getWidgetId() { return widgetId; } @@ -44,5 +43,4 @@ public void setWidgetId(String widgetId) { public Widget load(Dashboard parentObject) { return parentObject.getWidget(widgetId); } - } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetPanel.html b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetPanel.html index ed9b89210f..60d7976cbe 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetPanel.html +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetPanel.html @@ -1,8 +1,8 @@ -
-
-
+
+
+
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetPanel.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetPanel.java index 4ee2b51223..93506cbea9 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetPanel.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetPanel.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -19,27 +19,26 @@ import org.wicketstuff.dashboard.Widget; /** - * Wicket {@link GenericPanel} to render a widget on a page + * Wicket {@link GenericPanel} to render a widget on a page * @author Decebal Suiu */ public class WidgetPanel extends GenericPanel { - private static final long serialVersionUID = 1L; - + private WidgetHeaderPanel widgetHeaderPanel; private WidgetView widgetView; private Panel settingsPanel; - + public WidgetPanel(String id, IModel model) { super(id, model); - - Widget widget = model.getObject(); - + + Widget widget = model.getObject(); + setOutputMarkupId(true); - + widgetHeaderPanel = new WidgetHeaderPanel("header", model); add(widgetHeaderPanel); - + if (model.getObject().hasSettings()) { settingsPanel = widget.createSettingsPanel("settings"); } else { @@ -48,8 +47,8 @@ public WidgetPanel(String id, IModel model) { settingsPanel.setOutputMarkupPlaceholderTag(true); settingsPanel.setVisible(false); add(settingsPanel); - - widgetView = model.getObject().createView("content"); + + widgetView = model.getObject().createView("content"); add(widgetView); } @@ -60,9 +59,8 @@ public WidgetHeaderPanel getWidgetHeaderPanel() { public WidgetView getWidgetView() { return widgetView; } - + public Panel getSettingsPanel() { return settingsPanel; } - } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetView.html b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetView.html index 99476da81b..6c4340df5a 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetView.html +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetView.html @@ -1,6 +1,6 @@ - Widget content here! + Widget content here! - \ No newline at end of file + diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetView.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetView.java index 21627ccbd9..185b59d69e 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetView.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/WidgetView.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -22,15 +22,14 @@ * @author Decebal Suiu */ public class WidgetView extends GenericPanel { + private static final long serialVersionUID = 1L; - private static final long serialVersionUID = 1L; - public WidgetView(String id, IModel model) { super(id, model); - setOutputMarkupPlaceholderTag(true); + setOutputMarkupPlaceholderTag(true); } - + public Widget getWidget() { return getModelObject(); } @@ -38,8 +37,7 @@ public Widget getWidget() { @Override protected void onConfigure() { super.onConfigure(); - + setVisible(!getWidget().isCollapsed()); - } - + } } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/res/dashboard-rtl.css b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/res/dashboard-rtl.css index 2c87faac08..db136907e4 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/res/dashboard-rtl.css +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/res/dashboard-rtl.css @@ -1,7 +1,7 @@ .column { - float: right !important; + float: right !important; } .dragbox-actions { - float: left !important; + float: left !important; } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/res/dashboard.css b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/res/dashboard.css index 5a0259a4e9..9b4dc5a041 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/res/dashboard.css +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/res/dashboard.css @@ -6,13 +6,11 @@ min-height: 320px; float: left; } - ul.column { - list-style-type: none; - margin: 0; - padding: 0; + list-style-type: none; + margin: 0; + padding: 0; } - .dragbox { margin: 5px 2px 20px; background: #fff; @@ -20,60 +18,67 @@ ul.column { border: 1px solid #ddd; border-radius: 5px; } - .dragbox-header { margin: 0; padding: 5px; background: #f0f0f0; color: #000; border-bottom: 1px solid #eee; - cursor: move; - border-top-left-radius: 5px; - border-top-right-radius: 5px; + cursor: move; + border-top-left-radius: 5px; + border-top-right-radius: 5px; } - .dragbox-header img { - margin: 0; - padding: 0; + margin: 0; + padding: 0; } - .dragbox-toggle { - display: inline; + display: inline-block; margin-right: 3px; cursor: pointer; + width: 16px; + height: 16px; +} +.dragbox-toggle.expanded { + background-image: url(http://github.com/down.png) +} +.dragbox-toggle.collapsed { + background-image: url(http://github.com/up.png) } - .dragbox-title { display: inline; - font-weight: bold; + font-weight: bold; + vertical-align: super; } - .dragbox-actions { float: right; margin: 0; padding: 0; display: none; } - .dragbox-actions ul { - padding: 0; - margin: 0; + padding: 0; + margin: 0; } - .dragbox-actions ul li { - display: inline; - margin: 0 1px 0 1px; + display: inline; + margin: 0 1px 0 1px; } - .dragbox-actions ul li a { - text-decoration: none; + text-decoration: none; + display: inline-block; + width: 16px; + height: 16px; } - -.dragbox-actions ul li a img { - border: 0; - margin: 0; +.dragbox-actions ul li a.icon.refresh { + background-image: url(http://github.com/refresh.gif) +} +.dragbox-actions ul li a.icon.delete { + background-image: url(http://github.com/delete.gif) +} +.dragbox-actions ul li a.icon.edit { + background-image: url(http://github.com/edit.png) } - .dragbox-content { background: #fff; min-height: 60px; @@ -81,7 +86,6 @@ ul.column { line-height: 1.5em; overflow: auto; } - .placeholder { background: #f0f0f0; border: 1px dashed #ddd; diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/res/jquery-1.8.3.min.js b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/res/jquery-1.8.3.min.js deleted file mode 100644 index 3883779527..0000000000 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/res/jquery-1.8.3.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v1.8.3 jquery.com | jquery.org/license */ -(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write(""),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t
a",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="
t
",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="
",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;ti.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="
",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="

",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t0)for(i=r;i=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*\s*$/g,Nt={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X
","
"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1>");try{for(;r1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]===""&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("
").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window); \ No newline at end of file diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/util/ConfirmAjaxCallListener.java b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/util/ConfirmAjaxCallListener.java index b6ec828ea5..d7354945fa 100644 --- a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/util/ConfirmAjaxCallListener.java +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/web/util/ConfirmAjaxCallListener.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -19,13 +19,11 @@ * @author Decebal Suiu */ public class ConfirmAjaxCallListener extends AjaxCallListener { - - private static final long serialVersionUID = 1L; - - public ConfirmAjaxCallListener(String confirmMessage) { - CharSequence message = JavaScriptUtils.escapeQuotes(confirmMessage); - StringBuilder precondition = new StringBuilder("if(!confirm('").append(message).append("')) { return false; };"); - onPrecondition(precondition); - } + private static final long serialVersionUID = 1L; + public ConfirmAjaxCallListener(String confirmMessage) { + CharSequence message = JavaScriptUtils.escapeQuotes(confirmMessage); + StringBuilder precondition = new StringBuilder("if(!confirm('").append(message).append("')) { return false; };"); + onPrecondition(precondition); + } } diff --git a/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/wicket-package_pt.properties.xml b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/wicket-package_pt.properties.xml new file mode 100644 index 0000000000..6a38e956e5 --- /dev/null +++ b/dashboard-parent/dashboard-core/src/main/java/org/wicketstuff/dashboard/wicket-package_pt.properties.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/dashboard-parent/dashboard-core/src/main/java/wicket.properties b/dashboard-parent/dashboard-core/src/main/java/wicket.properties deleted file mode 100644 index 53fdedc51d..0000000000 --- a/dashboard-parent/dashboard-core/src/main/java/wicket.properties +++ /dev/null @@ -1 +0,0 @@ -initializer=org.wicketstuff.dashboard.DashboardContextInitializer \ No newline at end of file diff --git a/dashboard-parent/dashboard-core/src/main/resources/META-INF/services/org.apache.wicket.IInitializer b/dashboard-parent/dashboard-core/src/main/resources/META-INF/services/org.apache.wicket.IInitializer new file mode 100644 index 0000000000..a5edce3833 --- /dev/null +++ b/dashboard-parent/dashboard-core/src/main/resources/META-INF/services/org.apache.wicket.IInitializer @@ -0,0 +1 @@ +org.wicketstuff.dashboard.DashboardContextInitializer \ No newline at end of file diff --git a/dashboard-parent/dashboard-core/src/test/java/org/wicketstuff/dashboard/AbstractWidgetTest.java b/dashboard-parent/dashboard-core/src/test/java/org/wicketstuff/dashboard/AbstractWidgetTest.java new file mode 100644 index 0000000000..8024b22970 --- /dev/null +++ b/dashboard-parent/dashboard-core/src/test/java/org/wicketstuff/dashboard/AbstractWidgetTest.java @@ -0,0 +1,109 @@ +package org.wicketstuff.dashboard; + +import static org.hamcrest.CoreMatchers.*; + +import org.apache.wicket.Application; +import org.apache.wicket.MetaDataKey; +import org.apache.wicket.Page; +import org.apache.wicket.markup.Markup; +import org.apache.wicket.model.Model; +import org.apache.wicket.protocol.http.WebApplication; +import org.apache.wicket.util.tester.DummyHomePage; +import org.apache.wicket.util.tester.WicketTester; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.wicketstuff.dashboard.web.DashboardContext; +import org.wicketstuff.dashboard.web.DashboardPanel; +import org.wicketstuff.dashboard.web.WidgetView; + +public class AbstractWidgetTest { + private static final String MARKUP = "
"; + private WicketTester browser; + + public static MetaDataKey DASHBOARD_KEY = new MetaDataKey() { + private static final long serialVersionUID = 1L; + }; + + public static class WebApp extends WebApplication { + @Override + public Class getHomePage() { + return DummyHomePage.class; + } + + @Override + protected void init() { + super.init(); + DashboardContext dashboardContext = this.getMetaData(DashboardContextInitializer.DASHBOARD_CONTEXT_KEY); + WidgetDescriptor widgetDescriptor; + dashboardContext.getWidgetRegistry().registerWidget(widgetDescriptor = new MyWidgetDescriptor()); + + Dashboard dashboard = dashboardContext.getDashboardPersister().load(); + + if (dashboard == null) { + dashboard = new DefaultDashboard("default", "Default"); + dashboard.setColumnCount(3); + } + + WidgetFactory widgetFactory = dashboardContext.getWidgetFactory(); + Widget widget = widgetFactory.createWidget(widgetDescriptor); + dashboard.addWidget(widget); + + this.setMetaData(DASHBOARD_KEY, dashboard); + } + + public static class MyWidgetDescriptor implements WidgetDescriptor { + private static final long serialVersionUID = 1L; + + @Override + public String getTypeName() { + return "widget.foo"; + } + + @Override + public String getName() { + return "Foo widget"; + } + + @Override + public String getProvider() { + return "wicketstuff"; + } + + @Override + public String getDescription() { + return "The foo widget"; + } + + @Override + public String getWidgetClassName() { + return MyWidget.class.getName(); + } + } + + public static class MyWidget extends AbstractWidget { + private static final long serialVersionUID = 1L; + + @Override + public WidgetView createView(String viewId) { + return new WidgetView(viewId, Model. of(this)); + } + } + } + + @Before + public void setup() { + browser = new WicketTester(new WebApp()); + } + + @Test + public void canExposeConfigurationAsString() { + Dashboard dashboard = Application.get().getMetaData(DASHBOARD_KEY); + browser.startComponentInPage(new DashboardPanel("dashboard", Model. of(dashboard)), Markup.of(MARKUP)); + browser.assertNoErrorMessage(); + Assert.assertThat( + browser.getComponentFromLastRenderedPage("dashboard:columns:0:column:columnContainer:widgetList:0:widget:content").getDefaultModelObjectAsString(), + is(not(nullValue())) + ); + } +} diff --git a/dashboard-parent/dashboard-examples/pom.xml b/dashboard-parent/dashboard-examples/pom.xml index aed76c6803..235984876e 100644 --- a/dashboard-parent/dashboard-examples/pom.xml +++ b/dashboard-parent/dashboard-examples/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-dashboard-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-dashboard-examples @@ -25,7 +25,6 @@ org.eclipse.jetty jetty-maven-plugin - ${jetty.version} @@ -115,7 +114,6 @@ org.eclipse.jetty.aggregate jetty-all-server - ${jetty.version} test diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPage.html b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPage.html index af72bbfc4c..bd91b5bb8c 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPage.html +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPage.html @@ -1,11 +1,10 @@ - - - - + + + + - -
- + +
+ - \ No newline at end of file diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPage.java b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPage.java index 4d114554b3..55e8a09562 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPage.java +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPage.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -20,12 +20,10 @@ * @author Decebal Suiu */ public class AddWidgetPage extends WebPage { - - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; public AddWidgetPage() { - Dashboard dashboard = WicketApplication.get().getDashboard(); - add(new AddWidgetPanel("addWidgetPanel", new Model(dashboard))); - } - + Dashboard dashboard = WicketApplication.get().getDashboard(); + add(new AddWidgetPanel("addWidgetPanel", new Model<>(dashboard))); + } } diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel$WidgetDescriptorPanel.html b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel$WidgetDescriptorPanel.html index 8f67b3cc78..7c05b9fbe6 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel$WidgetDescriptorPanel.html +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel$WidgetDescriptorPanel.html @@ -1,10 +1,10 @@ -
- By -
- Add widget - +
+ By +
+ Add widget +
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel.html b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel.html index 9a62a4ed03..1e9aeeb002 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel.html +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel.html @@ -1,11 +1,11 @@ - -
-
-
+ +
+
+
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel.java b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel.java index 128356c9fe..15c5665709 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel.java +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/AddWidgetPanel.java @@ -1,17 +1,19 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.wicketstuff.dashboard.examples; +import static org.wicketstuff.dashboard.DashboardContextInitializer.getDashboardContext; + import java.util.List; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -28,79 +30,67 @@ import org.wicketstuff.dashboard.Widget; import org.wicketstuff.dashboard.WidgetDescriptor; import org.wicketstuff.dashboard.WidgetFactory; -import org.wicketstuff.dashboard.web.DashboardContext; -import org.wicketstuff.dashboard.web.DashboardContextAware; import org.wicketstuff.dashboard.web.DashboardEvent; /** * @author Decebal Suiu */ -public class AddWidgetPanel extends GenericPanel implements DashboardContextAware { - +public class AddWidgetPanel extends GenericPanel { private static final long serialVersionUID = 1L; - - private transient DashboardContext dashboardContext; - + public AddWidgetPanel(String id, IModel model) { - super(id, model); - - add(new BookmarkablePageLink("backDashboard", getApplication().getHomePage())); - - List widgetDescriptors = dashboardContext.getWidgetRegistry().getWidgetDescriptors(); + super(id, model); + + add(new BookmarkablePageLink("backDashboard", getApplication().getHomePage())); + + List widgetDescriptors = getDashboardContext().getWidgetRegistry().getWidgetDescriptors(); ListView listView = new ListView("widgetList", widgetDescriptors) { - private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem item) { item.add(new WidgetDescriptorPanel("widget", item.getModel())); } - }; listView.setRenderBodyOnly(true); add(listView); } - + public Dashboard getDashboard() { + Dashboard dashboard = getDashboardContext().getDashboardPersister().load(); + if (dashboard != null) { + // might be updated + setModelObject(dashboard); + } return getModelObject(); - } - @Override - public void setDashboardContext(DashboardContext dashboardContext) { - this.dashboardContext = dashboardContext; - } - + private String getUniqueWidgetTitle(String title, int count) { String uniqueTitle = title; if (count > 0) { uniqueTitle = title + " " + count; } - - List widgets = getDashboard().getWidgets(); - for (Widget widget : widgets) { + for (Widget widget : getDashboard().getWidgets()) { if (widget.getTitle().equals(uniqueTitle)) { uniqueTitle = getUniqueWidgetTitle(title, count + 1); } } - return uniqueTitle; } private class WidgetDescriptorPanel extends GenericPanel { - private static final long serialVersionUID = 1L; - + private String message = ""; private int count; - + public WidgetDescriptorPanel(String id, final IModel model) { super(id, model); - + add(new Label("name", model.getObject().getName())); add(new Label("provider", model.getObject().getProvider())); add(new Label("description", model.getObject().getDescription())); final Label label = new Label("message", new LoadableDetachableModel() { - private static final long serialVersionUID = 1L; @Override @@ -108,22 +98,19 @@ protected String load() { if (count == 1) { return message; } - return message + " (" + count + ")"; } - }); label.setOutputMarkupId(true); label.setOutputMarkupPlaceholderTag(true); label.setVisible(false); add(label); AjaxLink addLink = new AjaxLink("addWidget") { - private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { - WidgetFactory widgetFactory = dashboardContext.getWidgetFactory(); + WidgetFactory widgetFactory = getDashboardContext().getWidgetFactory(); Widget widget = widgetFactory.createWidget(model.getObject()); widget.setTitle(getUniqueWidgetTitle(widget.getTitle(), count)); // DashboardPanel is on other page @@ -131,17 +118,14 @@ public void onClick(AjaxRequestTarget target) { Dashboard dashboard = getDashboard(); DashboardUtils.updateWidgetLocations(dashboard, new DashboardEvent(target, DashboardEvent.EventType.WIDGET_ADDED, widget)); dashboard.addWidget(widget); - dashboardContext.getDashboardPersister().save(dashboard); + getDashboardContext().getDashboardPersister().save(dashboard); message = "added"; label.setVisible(true); target.add(label); count++; } - }; add(addLink); } - } - } diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/DemoWidgetActionsFactory.java b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/DemoWidgetActionsFactory.java index 838c587b9d..3872f9a3cd 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/DemoWidgetActionsFactory.java +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/DemoWidgetActionsFactory.java @@ -17,8 +17,6 @@ import org.wicketstuff.dashboard.DefaultWidgetActionsFactory; import org.wicketstuff.dashboard.Widget; import org.wicketstuff.dashboard.WidgetAction; -import org.wicketstuff.dashboard.web.AbstractWidgetAction; -import org.wicketstuff.dashboard.web.DefaultWidgetActions; /** * @author Decebal Suiu @@ -30,15 +28,15 @@ public List createWidgetActions(Widget widget) { List widgetActions = super.createWidgetActions(widget); widgetActions.add(0, new DetachWidgetAction(widget)); - /* - for (WidgetAction action : widgetActions) { - if (action instanceof DefaultWidgetActions.Settings) { - // change the icon (relative to context) - ((AbstractWidgetAction) action).setImage("/images/edit.png"); - break; - } - } - */ + /* + for (WidgetAction action : widgetActions) { + if (action instanceof DefaultWidgetActions.Settings) { + // change the icon (relative to context) + ((AbstractWidgetAction) action).setImage("/images/edit.png"); + break; + } + } + */ return widgetActions; } diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/DetachWidgetAction.java b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/DetachWidgetAction.java index 1dfe9365f1..99d7dd5263 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/DetachWidgetAction.java +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/DetachWidgetAction.java @@ -24,7 +24,6 @@ * @author Decebal Suiu */ public class DetachWidgetAction extends AbstractWidgetAction { - private static final long serialVersionUID = 1L; public DetachWidgetAction(Widget widget) { @@ -32,7 +31,7 @@ public DetachWidgetAction(Widget widget) { tooltip = new ResourceModel("detach"); - setImage(HomePage.class, "detach.png"); + setCssClass("icon detach"); } @Override @@ -42,9 +41,8 @@ public AbstractLink getLink(String id) { BookmarkablePageLink link = new BookmarkablePageLink(id, WidgetPage.class, parameters); PopupSettings popupSettings = new PopupSettings(widget.getTitle()).setHeight(320).setWidth(550); - link.setPopupSettings(popupSettings); + link.setPopupSettings(popupSettings); - return link; + return link; } - } diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/HomePage.html b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/HomePage.html index 7127c15400..0991a2c40a 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/HomePage.html +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/HomePage.html @@ -1,15 +1,14 @@ - - - - + + + + - - -
- + + +
+ - \ No newline at end of file diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/HomePage.java b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/HomePage.java index dac4836abb..7707899eeb 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/HomePage.java +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/HomePage.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -22,14 +22,14 @@ * @author Decebal Suiu */ public class HomePage extends WebPage { - - private static final long serialVersionUID = 1L; + + private static final long serialVersionUID = 1L; public HomePage() { add(new BookmarkablePageLink("addWidget", AddWidgetPage.class)); - - Dashboard dashboard = WicketApplication.get().getDashboard(); - add(new DashboardPanel("dashboard", new Model(dashboard))); - } - + + Dashboard dashboard = WicketApplication.get().getDashboard(); + add(new DashboardPanel("dashboard", new Model(dashboard))); + } + } diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/WicketApplication.java b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/WicketApplication.java index deb556a10c..0e2f55c355 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/WicketApplication.java +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/WicketApplication.java @@ -1,21 +1,22 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.wicketstuff.dashboard.examples; +import static org.wicketstuff.dashboard.DashboardContextInitializer.getDashboardContext; + import org.apache.wicket.Page; import org.apache.wicket.protocol.http.WebApplication; import org.wicketstuff.dashboard.Dashboard; -import org.wicketstuff.dashboard.DashboardContextInitializer; import org.wicketstuff.dashboard.DefaultDashboard; import org.wicketstuff.dashboard.examples.jqplot.DemoChartFactory; import org.wicketstuff.dashboard.examples.justgage.DemoJustGageFactory; @@ -37,29 +38,27 @@ */ public class WicketApplication extends WebApplication { - private Dashboard dashboard; - public static WicketApplication get() { return (WicketApplication) WebApplication.get(); } @Override public void init() { - super.init(); + super.init(); // markup settings getMarkupSettings().setStripWicketTags(true); getMarkupSettings().setDefaultMarkupEncoding("UTF-8"); - + // exception settings getResourceSettings().setThrowExceptionOnMissingResource(false); - + // mounts mountPage("add-widget", AddWidgetPage.class); mountPage("widget", WidgetPage.class); - + // >>> begin dashboard settings - + // register some widgets DashboardContext dashboardContext = getDashboardContext(); dashboardContext.getWidgetRegistry() @@ -67,21 +66,18 @@ public void init() { .registerWidget(new ChartWidgetDescriptor()) .registerWidget(new JqPlotWidgetDescriptor()) .registerWidget(new JustGageWidgetDescriptor()) - .registerWidget(new HighChartsWidgetDescriptor()); - + .registerWidget(new HighChartsWidgetDescriptor()); + // add a custom action for all widgets dashboardContext.setWidgetActionsFactory(new DemoWidgetActionsFactory()); // set some (data) factory - ChartWidget.setChartDataFactory(new DemoChartDataFactory()); + ChartWidget.setChartDataFactory(new DemoChartDataFactory()); JqPlotWidget.setChartFactory(new DemoChartFactory()); JustGageWidget.setJustGageFactory(new DemoJustGageFactory()); - HighChartsWidget.setHighChartsFactory(new DemoHighChartsFactory()); - - // init dashboard from context - initDashboard(); - - // <<< end dashboard settings + HighChartsWidget.setHighChartsFactory(new DemoHighChartsFactory()); + + // <<< end dashboard settings } @Override @@ -101,18 +97,11 @@ public Session newSession(Request request, Response response) { */ public Dashboard getDashboard() { + Dashboard dashboard = getDashboardContext().getDashboardPersister().load(); + if (dashboard == null) { + dashboard = new DefaultDashboard("default", "Default"); + } return dashboard; } - private DashboardContext getDashboardContext() { - return getMetaData(DashboardContextInitializer.DASHBOARD_CONTEXT_KEY); - } - - private void initDashboard() { - dashboard = getDashboardContext().getDashboardPersister().load(); - if (dashboard == null) { - dashboard = new DefaultDashboard("default", "Default"); - } - } - } diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/WidgetPage.html b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/WidgetPage.html index 0229ef4433..6367b61d98 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/WidgetPage.html +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/WidgetPage.html @@ -1,12 +1,11 @@ - - - - + + + + - -
- + +
+ - \ No newline at end of file diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/jqplot/DemoChartFactory.java b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/jqplot/DemoChartFactory.java index 0b39eb68ef..1a1362d511 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/jqplot/DemoChartFactory.java +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/jqplot/DemoChartFactory.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -37,7 +37,7 @@ public Chart createChart(JqPlotWidget widget) { private Chart getChart(Map settings) { Chart chart = null; - + String chartType = settings.get("chartType"); if (JqPlotWidget.BAR_TYPE.equals(chartType)) { chart = barChart(); @@ -46,58 +46,59 @@ private Chart getChart(Map settings) { } else if (JqPlotWidget.PIE_TYPE.equals(chartType)) { chart = pieChart(); } else if (JqPlotWidget.AREA_TYPE.equals(chartType)) { - chart = areaChart(); + chart = areaChart(); } - + return chart; } - public static Chart lineChart() { - LineChart lineChart; - lineChart = new LineChart("Line Chart"); - lineChart.addValues(1, 2, 3, 4, 5); - - return lineChart; - } - - public static Chart areaChart() { - AreaChart areaChart; - areaChart = new AreaChart("Area Char"); - areaChart.addValue(Arrays.asList(11, 9, 5, 12, 14)); - areaChart.addValue(Arrays.asList(4, 8, 5, 3, 6)); - areaChart.addValue(Arrays.asList(12, 6, 13, 11, 2)); - - return areaChart; - } - - public static Chart barChart() { - BarChart barChart; - barChart = new BarChart("Bar Chart"); - - barChart.setPadMin(1.05f); - barChart.setStackSeries(true); - barChart.setCaptureRightClick(true); - barChart.setHighlightMouseDown(true); - - barChart.setBarMargin(30); - barChart.setTicks("A", "B", "C", "D"); - barChart.addValue(Arrays.asList(200, 600, 700, 1000)); - barChart.addValue(Arrays.asList(200, 600, 700, 1000)); - barChart.addValue(Arrays.asList(200, 600, 700, 1000)); - - // Texto das Legendas. - barChart.addSeries(new Serie("A"), new Serie("B"), new Serie("C")); - - return barChart; - } - - public static Chart pieChart() { - PieChart pizzaChart = new PieChart("Pizza Chart"); - pizzaChart.addValue("Drops", 10f); - pizzaChart.addValue("Chocolate", 20f); - pizzaChart.addValue("Jujuba", 5f); - - return pizzaChart; - } + public static Chart lineChart() { + LineChart lineChart; + lineChart = new LineChart("Line Chart"); + lineChart.addValues(1, 2, 3, 4, 5); + + return lineChart; + } + + public static Chart areaChart() { + AreaChart areaChart; + areaChart = new AreaChart("Area Char"); + areaChart.addValue(Arrays.asList(11, 9, 5, 12, 14)); + areaChart.addValue(Arrays.asList(4, 8, 5, 3, 6)); + areaChart.addValue(Arrays.asList(12, 6, 13, 11, 2)); + + return areaChart; + } + + @SuppressWarnings("deprecation") + public static Chart barChart() { + BarChart barChart; + barChart = new BarChart("Bar Chart"); + + barChart.setPadMin(1.05f); + barChart.setStackSeries(true); + barChart.setCaptureRightClick(true); + barChart.setHighlightMouseDown(true); + + barChart.setBarMargin(30); + barChart.setTicks("A", "B", "C", "D"); + barChart.addValue(Arrays.asList(200, 600, 700, 1000)); + barChart.addValue(Arrays.asList(200, 600, 700, 1000)); + barChart.addValue(Arrays.asList(200, 600, 700, 1000)); + + // Texto das Legendas. + barChart.addSeries(new Serie("A"), new Serie("B"), new Serie("C")); + + return barChart; + } + + public static Chart pieChart() { + PieChart pizzaChart = new PieChart("Pizza Chart"); + pizzaChart.addValue("Drops", 10f); + pizzaChart.addValue("Chocolate", 20f); + pizzaChart.addValue("Jujuba", 5f); + + return pizzaChart; + } } diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/ofchart/DemoChartFactory.java b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/ofchart/DemoChartFactory.java index fd7c92215c..145161f657 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/ofchart/DemoChartFactory.java +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/ofchart/DemoChartFactory.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -43,7 +43,7 @@ public static Chart createDemoBarChart() { barChart.useAnimation(true); barChart.addValues(1, 2, 3, 4, 5, 6, 7 , 8, 9, 8, 7, 6, 5, 4, 3); barChart.setText("Tue Oct 14 2008"); - + Chart chart = new Chart("Beers and bugs"); /* Legend legend = new Legend(); @@ -51,8 +51,8 @@ public static Chart createDemoBarChart() { chart.setLegend(legend); */ chart.setBackgroundColour("#FFFFFF"); - chart.addElements(barChart); - + chart.addElements(barChart); + return chart; } @@ -78,30 +78,30 @@ public static Chart createDemoDoubleBarChart() { return chart; } - + public static Chart createDemoLineChart() { LineChart lineChart = new LineChart(); lineChart.setWidth(4); lineChart.setColour("#DFC329"); lineChart.setDotSize(5); - + List values = new ArrayList(); Random random = new Random(); for (int i = 0; i < 15; i++) { - values.add(1 + random.nextInt(5)); + values.add(1 + random.nextInt(5)); } lineChart.addValues(values); Chart chart = new Chart("My life with my wife"); YAxis yAxis = new YAxis(); - yAxis.setRange(0, 6, 1); + yAxis.setRange(0, 6, 1); chart.setYAxis(yAxis); chart.addElements(lineChart); chart.setBackgroundColour("#FFFFFF"); - + return chart; } - + public static Chart createDemoDotedLineChart() { // TODO // LineChart lineChart = new LineChart(LineChart.Style.DOT); @@ -112,14 +112,14 @@ public static Chart createDemoDotedLineChart() { List values = new ArrayList(); for (int i = 0; i < 8; i += 0.2) { - double value = Math.sin(i) + 1.5; - if (value > 1.75) { - lineChart.addDots(new LineChart.Dot(value, "#D02020")); - } else { - // TODO give me an out of memory -// values.add(value); - } - } + double value = Math.sin(i) + 1.5; + if (value > 1.75) { + lineChart.addDots(new LineChart.Dot(value, "#D02020")); + } else { + // TODO give me an out of memory +// values.add(value); + } + } lineChart.addValues(values); Chart chart = new Chart(new Date().toString()); @@ -128,16 +128,16 @@ public static Chart createDemoDotedLineChart() { chart.setYAxis(yAxis); chart.addElements(lineChart); chart.setBackgroundColour("#FFFFFF"); - + return chart; } - + public static Chart createDemoPieChart() { PieChart pieChart = new PieChart(); pieChart.setAnimate(true); pieChart.setStartAngle(35); pieChart.setBorder(2); -// pieChart.setAlpha(0.6f); +// pieChart.setAlpha(0.6f); pieChart.addValues(2, 3, 3.5); pieChart.addSlice(6.5f, "Romania (6.5)"); pieChart.setColours("#F78000", "#9AC836", "#D54192", "#E3001B"); @@ -146,31 +146,31 @@ public static Chart createDemoPieChart() { Chart chart = new Chart("Downloads"); chart.addElements(pieChart); chart.setBackgroundColour("#FFFFFF"); - + return chart; } public static Chart createDemoScatterChart() { ScatterChart scatterChart = new ScatterChart(ScatterChart.Style.LINE); - scatterChart.setColour("#FFD600"); + scatterChart.setColour("#FFD600"); scatterChart.setAlpha(0.6f); scatterChart.useAnimation(true); - + for (int i = 0; i < 5; i++) { scatterChart.addPoint(i, i + 1); } - + Chart chart = new Chart(new Date().toString()); - YAxis yAxis = new YAxis(); - yAxis.setRange(0, 7, 1); - chart.setYAxis(yAxis); - XAxis xAxis = new XAxis(); - xAxis.setRange(0, 6, 1); - chart.setXAxis(xAxis); - chart.addElements(scatterChart); + YAxis yAxis = new YAxis(); + yAxis.setRange(0, 7, 1); + chart.setYAxis(yAxis); + XAxis xAxis = new XAxis(); + xAxis.setRange(0, 6, 1); + chart.setXAxis(xAxis); + chart.addElements(scatterChart); chart.setBackgroundColour("#FFFFFF"); - - return chart; + + return chart; } } diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/wickedCharts/DemoHighChartsFactory.java b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/wickedCharts/DemoHighChartsFactory.java index 883df8ffb4..77ce619dfc 100644 --- a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/wickedCharts/DemoHighChartsFactory.java +++ b/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/wickedCharts/DemoHighChartsFactory.java @@ -36,64 +36,64 @@ */ public class DemoHighChartsFactory implements HighChartsFactory { - @Override - public Options createOptions(HighChartsWidget widget) { - Options options; - SeriesType seriesType = SeriesType.valueOf(widget.getSettings().get(Settings.seriesType.name())); - switch(seriesType) { - case AREA: { - options = new BasicAreaOptions(); - break; - } - case AREASPLINE: { - options = new AreaSplineOptions(); - break; - } - case BAR: { - options = new BasicBarOptions(); - break; - } - case COLUMN: { - options = new StackedAndGroupedColumnOptions(); - break; - } - case LINE: { - options = new BasicLineOptions(); - break; - } - case PIE: { - options = new PieWithLegendOptions(); - break; - } - case SCATTER: { - options = new ScatterPlotOptions(); - break; - } - case SPLINE: { - options = new SplineUpdatingOptions(); - break; - } - case GAUGE: { - options = new AngularGaugeOptions(); - break; - } - case COLUMNRANGE: { - options = new ColumnRangeOptions(); - break; - } - case AREARANGE: { - options = new AreaRangeOptions(); - break; - } - case BUBBLE: { - options = new BubbleChart3DOptions(); - break; - } - default: { - options = new Options(); - break; - } - } - return options; - } + @Override + public Options createOptions(HighChartsWidget widget) { + Options options; + SeriesType seriesType = SeriesType.valueOf(widget.getSettings().get(Settings.seriesType.name())); + switch(seriesType) { + case AREA: { + options = new BasicAreaOptions(); + break; + } + case AREASPLINE: { + options = new AreaSplineOptions(); + break; + } + case BAR: { + options = new BasicBarOptions(); + break; + } + case COLUMN: { + options = new StackedAndGroupedColumnOptions(); + break; + } + case LINE: { + options = new BasicLineOptions(); + break; + } + case PIE: { + options = new PieWithLegendOptions(); + break; + } + case SCATTER: { + options = new ScatterPlotOptions(); + break; + } + case SPLINE: { + options = new SplineUpdatingOptions(); + break; + } + case GAUGE: { + options = new AngularGaugeOptions(); + break; + } + case COLUMNRANGE: { + options = new ColumnRangeOptions(); + break; + } + case AREARANGE: { + options = new AreaRangeOptions(); + break; + } + case BUBBLE: { + options = new BubbleChart3DOptions(); + break; + } + default: { + options = new Options(); + break; + } + } + return options; + } } diff --git a/dashboard-parent/dashboard-examples/src/main/webapp/WEB-INF/web.xml b/dashboard-parent/dashboard-examples/src/main/webapp/WEB-INF/web.xml index b300881bfa..006279ecf8 100644 --- a/dashboard-parent/dashboard-examples/src/main/webapp/WEB-INF/web.xml +++ b/dashboard-parent/dashboard-examples/src/main/webapp/WEB-INF/web.xml @@ -1,24 +1,24 @@ + PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" + "http://java.sun.com/dtd/web-app_2_3.dtd"> - Dashboard + Dashboard - wicket.filter + wicket.filter org.apache.wicket.protocol.http.WicketFilter - - applicationClassName - org.wicketstuff.dashboard.examples.WicketApplication - + + applicationClassName + org.wicketstuff.dashboard.examples.WicketApplication + - - - wicket.filter - /app/* - + + + wicket.filter + /app/* + diff --git a/dashboard-parent/dashboard-examples/src/main/webapp/css/style.css b/dashboard-parent/dashboard-examples/src/main/webapp/css/style.css index 22f3cd8368..d84ddd4ff3 100644 --- a/dashboard-parent/dashboard-examples/src/main/webapp/css/style.css +++ b/dashboard-parent/dashboard-examples/src/main/webapp/css/style.css @@ -1,6 +1,6 @@ * { font-family: Verdana; - font-size: 11px; + font-size: 11px; } .left { @@ -13,38 +13,40 @@ .toolbar { line-height: 24px; - margin-bottom: 10px; - width: 100%; - float: left; - font-weight: bold; - border-bottom: 1px solid #CACACA; + margin-bottom: 10px; + width: 100%; + float: left; + font-weight: bold; + border-bottom: 1px solid #CACACA; } .widget-descriptor { - border-bottom: 1px dotted LightGray; - padding-top: 10px; - padding-bottom: 10px; - clear: both; + border-bottom: 1px dotted LightGray; + padding-top: 10px; + padding-bottom: 10px; + clear: both; } .widget-descriptor .name { - color: blue; - font-weight: bold; - font-size: 13; + color: blue; + font-weight: bold; + font-size: 13; } .widget-descriptor .provider { - color: green; - } + color: green; +} .widget-descriptor .description { - margin-top: 5px; - margin-bottom: 5px; - } + margin-top: 5px; + margin-bottom: 5px; +} .widget-descriptor .message { - font-style: italic; - background: Khaki; - padding: 3px; - } - + font-style: italic; + background: Khaki; + padding: 3px; +} +.dragbox-actions ul li a.icon.detach { + background-image: url(http://github.com/images/detach.png) +} diff --git a/dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/detach.png b/dashboard-parent/dashboard-examples/src/main/webapp/images/detach.png similarity index 100% rename from dashboard-parent/dashboard-examples/src/main/java/org/wicketstuff/dashboard/examples/detach.png rename to dashboard-parent/dashboard-examples/src/main/webapp/images/detach.png diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/pom.xml b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/pom.xml index 7aed3a0162..0a1b0215bf 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/pom.xml +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-dashboard-widgets - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-dashboard-widgets-charts diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsFactory.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsFactory.java index cddb1bd7d5..f85dcf4173 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsFactory.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsFactory.java @@ -18,5 +18,5 @@ * @author Paul Bors */ public interface HighChartsFactory { - public Options createOptions(HighChartsWidget widget); + public Options createOptions(HighChartsWidget widget); } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidget.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidget.java index 4c0de59287..af4a602379 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidget.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidget.java @@ -30,58 +30,58 @@ * @author Paul Bors */ public class HighChartsWidget extends AbstractWidget { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private static HighChartsFactory highChartsFactory; + private static HighChartsFactory highChartsFactory; - private transient Chart chart; + private transient Chart chart; - public HighChartsWidget() { - super(); + public HighChartsWidget() { + super(); - setTitle("HighCharts"); + setTitle("HighCharts"); - Map settings = getSettings(); - settings.put(Settings.seriesType.name(), SeriesType.SPLINE.name()); - } + Map settings = getSettings(); + settings.put(Settings.seriesType.name(), SeriesType.SPLINE.name()); + } - public static HighChartsFactory getHighChartsFactory() { - if (highChartsFactory == null) { - throw new RuntimeException("HighChartsFactory cannot be null. Use HighChartsWidget.getHighChartsFactory(...)"); - } - return highChartsFactory; - } + public static HighChartsFactory getHighChartsFactory() { + if (highChartsFactory == null) { + throw new RuntimeException("HighChartsFactory cannot be null. Use HighChartsWidget.getHighChartsFactory(...)"); + } + return highChartsFactory; + } - public static void setHighChartsFactory(HighChartsFactory highChartsFactory) { - HighChartsWidget.highChartsFactory = highChartsFactory; - } + public static void setHighChartsFactory(HighChartsFactory highChartsFactory) { + HighChartsWidget.highChartsFactory = highChartsFactory; + } - public Options newOptions() { - return HighChartsWidget.getHighChartsFactory().createOptions(this); - } + public Options newOptions() { + return HighChartsWidget.getHighChartsFactory().createOptions(this); + } - public Chart getChart(String id) { - chart = new Chart(id, newOptions()); - setTitle(((ShowcaseOptions)chart.getOptions()).getLabel()); - return chart; - } + public Chart getChart(String id) { + chart = new Chart(id, newOptions()); + setTitle(((ShowcaseOptions)chart.getOptions()).getLabel()); + return chart; + } - public void updateChart() { - chart.setOptions(newOptions()); - setTitle(((ShowcaseOptions)chart.getOptions()).getLabel()); - } + public void updateChart() { + chart.setOptions(newOptions()); + setTitle(((ShowcaseOptions)chart.getOptions()).getLabel()); + } - @Override - public boolean hasSettings() { - return true; - } + @Override + public boolean hasSettings() { + return true; + } - @Override - public Panel createSettingsPanel(String settingsPanelId) { - return new HighChartsSettingsPanel(settingsPanelId, new Model(this)); - } + @Override + public Panel createSettingsPanel(String settingsPanelId) { + return new HighChartsSettingsPanel(settingsPanelId, new Model(this)); + } - public WidgetView createView(String viewId) { - return new HighChartsWidgetView(viewId, new Model(this)); - } + public WidgetView createView(String viewId) { + return new HighChartsWidgetView(viewId, new Model(this)); + } } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetDescriptor.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetDescriptor.java index 14fb354614..97cbc2bb64 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetDescriptor.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetDescriptor.java @@ -18,30 +18,30 @@ * @author Paul Bors */ public class HighChartsWidgetDescriptor implements WidgetDescriptor { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Override - public String getDescription() { - return "A chart widget using HighCharts (commercial license) as integrated in Wicket via Wicked-Charts."; - } + @Override + public String getDescription() { + return "A chart widget using HighCharts (commercial license) as integrated in Wicket via Wicked-Charts."; + } - @Override - public String getName() { - return "HighCharts"; - } + @Override + public String getName() { + return "HighCharts"; + } - @Override - public String getProvider() { - return "Paul Bors"; - } + @Override + public String getProvider() { + return "Paul Bors"; + } - @Override - public String getWidgetClassName() { - return HighChartsWidget.class.getName(); - } + @Override + public String getWidgetClassName() { + return HighChartsWidget.class.getName(); + } - @Override - public String getTypeName() { - return "widget.highCharts"; - } + @Override + public String getTypeName() { + return "widget.highCharts"; + } } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetView.html b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetView.html index 8db5394639..2e0723ed73 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetView.html +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetView.html @@ -1,6 +1,6 @@ - -
- + +
+ \ No newline at end of file diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetView.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetView.java index 363bb4ecb8..b4fddf99dc 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetView.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/HighChartsWidgetView.java @@ -20,12 +20,12 @@ * @author Paul Bors */ public class HighChartsWidgetView extends WidgetView { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public HighChartsWidgetView(String id, IModel model) { - super(id, model); + public HighChartsWidgetView(String id, IModel model) { + super(id, model); - final HighChartsWidget widget = (HighChartsWidget)model.getObject(); - add(widget.getChart("chart")); - } + final HighChartsWidget widget = (HighChartsWidget)model.getObject(); + add(widget.getChart("chart")); + } } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/AreaSplineOptions.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/AreaSplineOptions.java index a35c7d71bf..7b5dfc44b8 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/AreaSplineOptions.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/AreaSplineOptions.java @@ -37,68 +37,68 @@ * @author Paul Bors */ public class AreaSplineOptions extends ShowcaseOptions { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public AreaSplineOptions() { - setChart(new ChartOptions().setType(SeriesType.AREASPLINE)); + public AreaSplineOptions() { + setChart(new ChartOptions().setType(SeriesType.AREASPLINE)); - setTitle(new Title("Average fruit consumption during one week")); + setTitle(new Title("Average fruit consumption during one week")); - setLegend(new Legend() - .setLayout(LegendLayout.VERTICAL) - .setAlign(HorizontalAlignment.LEFT) - .setVerticalAlign(VerticalAlignment.TOP) - .setX(150) - .setY(100) - .setFloating(Boolean.TRUE) - .setBorderWidth(1) - .setBackgroundColor(new HexColor("#FFFFFF")) - ); + setLegend(new Legend() + .setLayout(LegendLayout.VERTICAL) + .setAlign(HorizontalAlignment.LEFT) + .setVerticalAlign(VerticalAlignment.TOP) + .setX(150) + .setY(100) + .setFloating(Boolean.TRUE) + .setBorderWidth(1) + .setBackgroundColor(new HexColor("#FFFFFF")) + ); - setxAxis(new Axis() - .setCategories( - Arrays.asList(new String[]{ - "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" - }) - ) - .setPlotBands(Collections.singletonList(new PlotBand() - .setFrom(4.5f) - .setTo(6.5f) - .setColor(new RgbaColor(68, 170, 213, .2f))) - ) - ); + setxAxis(new Axis() + .setCategories( + Arrays.asList(new String[]{ + "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" + }) + ) + .setPlotBands(Collections.singletonList(new PlotBand() + .setFrom(4.5f) + .setTo(6.5f) + .setColor(new RgbaColor(68, 170, 213, .2f))) + ) + ); - setyAxis(new Axis().setTitle(new Title("Fruit units"))); + setyAxis(new Axis().setTitle(new Title("Fruit units"))); - setTooltip( - new Tooltip().setFormatter( - new Function(" return ''+this.x +': '+ this.y +' units';") - ) - ); + setTooltip( + new Tooltip().setFormatter( + new Function(" return ''+this.x +': '+ this.y +' units';") + ) + ); - setCredits(new CreditOptions().setEnabled(Boolean.FALSE)); + setCredits(new CreditOptions().setEnabled(Boolean.FALSE)); - setPlotOptions( - new PlotOptionsChoice().setAreaspline( - new PlotOptions().setFillOpacity(0.5f) - ) - ); + setPlotOptions( + new PlotOptionsChoice().setAreaspline( + new PlotOptions().setFillOpacity(0.5f) + ) + ); - addSeries( - new SimpleSeries() - .setName("John") - .setData(Arrays.asList(new Number[] { 3, 4, 3, 5, 4, 10, 12 })) - ); + addSeries( + new SimpleSeries() + .setName("John") + .setData(Arrays.asList(new Number[] { 3, 4, 3, 5, 4, 10, 12 })) + ); - addSeries( - new SimpleSeries() - .setName("Jane") - .setData(Arrays.asList(new Number[] { 1, 3, 4, 3, 3, 5, 4 })) - ); - } + addSeries( + new SimpleSeries() + .setName("Jane") + .setData(Arrays.asList(new Number[] { 1, 3, 4, 3, 3, 5, 4 })) + ); + } - @Override - public String getLabel() { - return super.getLabel() + "Area spline"; - } + @Override + public String getLabel() { + return super.getLabel() + "Area spline"; + } } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/BasicAreaOptions.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/BasicAreaOptions.java index 09da3d2e6f..43b0dbf86c 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/BasicAreaOptions.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/BasicAreaOptions.java @@ -34,84 +34,84 @@ * @author Paul Bors */ public class BasicAreaOptions extends ShowcaseOptions { - private static final long serialVersionUID = 1L; - - public BasicAreaOptions() { - - ChartOptions chartOptions = new ChartOptions(); - chartOptions - .setType(SeriesType.AREA); - setChartOptions(chartOptions); - - setTitle(new Title("US and USSR nuclear stockpiles")); - setSubtitle(new Title( - "Source: thebulletin.metapress.com" - )); - - Axis xAxis = new Axis(); - xAxis.setLabels( - new Labels().setStyle(new CssStyle()) - ); - setxAxis(xAxis); - - Axis yAxis = new Axis(); - yAxis.setTitle(new Title("Nuclear weapon states")); - yAxis.setLabels( - new Labels().setStyle(new CssStyle()) - ); - setyAxis(yAxis); - - setTooltip(new Tooltip()); - - State hoverState = new State(); - hoverState.setEnabled(Boolean.TRUE); - - StatesChoice statesChoice = new StatesChoice(); - statesChoice.setHover(hoverState); - - Marker marker = new Marker(); - marker.setEnabled(Boolean.TRUE); - marker.setSymbol(new Symbol(Symbol.PredefinedSymbol.CIRCLE)); - marker.setRadius(2); - marker.setStates(statesChoice); - - PlotOptions plotOptions = new PlotOptions(); - plotOptions.setPointStart(1940l); - plotOptions.setMarker(marker); - - PlotOptionsChoice plotOptionsChoice = new PlotOptionsChoice(); - plotOptionsChoice.setArea(plotOptions); - setPlotOptions(plotOptionsChoice); - - Series series1 = new SimpleSeries(); - series1.setName("USA"); - series1.setData(Arrays - .asList(new Number[]{null, null, null, null, null, 6, 11, 32, - 110, 235, 369, 640, 1005, 1436, 2063, 3057, 4618, 6444, 9822, - 15468, 20434, 24126, 27387, 29459, 31056, 31982, 32040, 31233, - 29224, 27342, 26662, 26956, 27912, 28999, 28965, 27826, 25579, - 25722, 24826, 24605, 24304, 23464, 23708, 24099, 24357, 24237, - 24401, 24344, 23586, 22380, 21004, 17287, 14747, 13076, 12555, - 12144, 11009, 10950, 10871, 10824, 10577, 10527, 10475, 10421, - 10358, 10295, 10104})); - addSeries(series1); - - Series series2 = new SimpleSeries(); - series2.setName("USSR/Russia"); - series2.setData(Arrays - .asList(new Number[]{null, null, null, null, null, null, null, - null, null, null, 5, 25, 50, 120, 150, 200, 426, 660, 869, - 1060, 1605, 2471, 3322, 4238, 5221, 6129, 7089, 8339, 9399, - 10538, 11643, 13092, 14478, 15915, 17385, 19055, 21205, 23044, - 25393, 27935, 30062, 32049, 33952, 35804, 37431, 39197, 45000, - 43000, 41000, 39000, 37000, 35000, 33000, 31000, 29000, 27000, - 25000, 24000, 23000, 22000, 21000, 20000, 19000, 18000, 18000, - 17000, 16000})); - addSeries(series2); - } - - @Override - public String getLabel() { + private static final long serialVersionUID = 1L; + + public BasicAreaOptions() { + + ChartOptions chartOptions = new ChartOptions(); + chartOptions + .setType(SeriesType.AREA); + setChartOptions(chartOptions); + + setTitle(new Title("US and USSR nuclear stockpiles")); + setSubtitle(new Title( + "Source: thebulletin.metapress.com" + )); + + Axis xAxis = new Axis(); + xAxis.setLabels( + new Labels().setStyle(new CssStyle()) + ); + setxAxis(xAxis); + + Axis yAxis = new Axis(); + yAxis.setTitle(new Title("Nuclear weapon states")); + yAxis.setLabels( + new Labels().setStyle(new CssStyle()) + ); + setyAxis(yAxis); + + setTooltip(new Tooltip()); + + State hoverState = new State(); + hoverState.setEnabled(Boolean.TRUE); + + StatesChoice statesChoice = new StatesChoice(); + statesChoice.setHover(hoverState); + + Marker marker = new Marker(); + marker.setEnabled(Boolean.TRUE); + marker.setSymbol(new Symbol(Symbol.PredefinedSymbol.CIRCLE)); + marker.setRadius(2); + marker.setStates(statesChoice); + + PlotOptions plotOptions = new PlotOptions(); + plotOptions.setPointStart(1940l); + plotOptions.setMarker(marker); + + PlotOptionsChoice plotOptionsChoice = new PlotOptionsChoice(); + plotOptionsChoice.setArea(plotOptions); + setPlotOptions(plotOptionsChoice); + + Series series1 = new SimpleSeries(); + series1.setName("USA"); + series1.setData(Arrays + .asList(new Number[]{null, null, null, null, null, 6, 11, 32, + 110, 235, 369, 640, 1005, 1436, 2063, 3057, 4618, 6444, 9822, + 15468, 20434, 24126, 27387, 29459, 31056, 31982, 32040, 31233, + 29224, 27342, 26662, 26956, 27912, 28999, 28965, 27826, 25579, + 25722, 24826, 24605, 24304, 23464, 23708, 24099, 24357, 24237, + 24401, 24344, 23586, 22380, 21004, 17287, 14747, 13076, 12555, + 12144, 11009, 10950, 10871, 10824, 10577, 10527, 10475, 10421, + 10358, 10295, 10104})); + addSeries(series1); + + Series series2 = new SimpleSeries(); + series2.setName("USSR/Russia"); + series2.setData(Arrays + .asList(new Number[]{null, null, null, null, null, null, null, + null, null, null, 5, 25, 50, 120, 150, 200, 426, 660, 869, + 1060, 1605, 2471, 3322, 4238, 5221, 6129, 7089, 8339, 9399, + 10538, 11643, 13092, 14478, 15915, 17385, 19055, 21205, 23044, + 25393, 27935, 30062, 32049, 33952, 35804, 37431, 39197, 45000, + 43000, 41000, 39000, 37000, 35000, 33000, 31000, 29000, 27000, + 25000, 24000, 23000, 22000, 21000, 20000, 19000, 18000, 18000, + 17000, 16000})); + addSeries(series2); + } + + @Override + public String getLabel() { return super.getLabel() + "Basic area"; - } + } } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/BasicBarOptions.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/BasicBarOptions.java index 705130c80a..4c6da46d09 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/BasicBarOptions.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/BasicBarOptions.java @@ -36,78 +36,78 @@ * @author Paul Bors */ public class BasicBarOptions extends ShowcaseOptions { - private static final long serialVersionUID = 1L; - - public BasicBarOptions() { - setChartOptions(new ChartOptions().setType(SeriesType.BAR)); - - setGlobal(new Global().setUseUTC(Boolean.TRUE)); - - setTitle(new Title("Historic World Population by Region")); - - setSubtitle(new Title("Source: Wikipedia.org")); - - setxAxis(new Axis() - .setCategories("Africa", "America", "Asia", "Europe", "Oceania") - .setTitle(new Title(null)) - ); - - setyAxis( - new Axis().setTitle( - new Title("Population (millions)") - .setAlign(HorizontalAlignment.HIGH)) - .setLabels(new Labels().setOverflow(Overflow.JUSTIFY)) - ); - - setTooltip( - new Tooltip().setFormatter( - new Function("return ''+this.series.name +': '+ this.y +' millions';") - ) - ); - - setPlotOptions( - new PlotOptionsChoice().setBar( - new PlotOptions().setDataLabels( - new DataLabels().setEnabled(Boolean.TRUE) - ) - ) - ); - - setLegend(new Legend() - .setLayout(LegendLayout.VERTICAL) - .setAlign(HorizontalAlignment.RIGHT) - .setVerticalAlign(VerticalAlignment.TOP) - .setX(-100) - .setY(100) - .setFloating(Boolean.TRUE) - .setBorderWidth(1) - .setBackgroundColor(new HexColor("#ffffff")) - .setShadow(Boolean.TRUE) - ); - - setCredits(new CreditOptions() - .setEnabled(Boolean.FALSE) - ); - - addSeries(new SimpleSeries() - .setName("Year 1800") - .setData(107, 31, 635, 203, 2) - ); - - addSeries(new SimpleSeries() - .setName("Year 1900") - .setData(133, 156, 947, 408, 6) - ); - - addSeries(new SimpleSeries() - .setName("Year 2008") - .setData(973, 914, 4054, 732, 34) - ); - - } - - @Override - public String getLabel() { + private static final long serialVersionUID = 1L; + + public BasicBarOptions() { + setChartOptions(new ChartOptions().setType(SeriesType.BAR)); + + setGlobal(new Global().setUseUTC(Boolean.TRUE)); + + setTitle(new Title("Historic World Population by Region")); + + setSubtitle(new Title("Source: Wikipedia.org")); + + setxAxis(new Axis() + .setCategories("Africa", "America", "Asia", "Europe", "Oceania") + .setTitle(new Title(null)) + ); + + setyAxis( + new Axis().setTitle( + new Title("Population (millions)") + .setAlign(HorizontalAlignment.HIGH)) + .setLabels(new Labels().setOverflow(Overflow.JUSTIFY)) + ); + + setTooltip( + new Tooltip().setFormatter( + new Function("return ''+this.series.name +': '+ this.y +' millions';") + ) + ); + + setPlotOptions( + new PlotOptionsChoice().setBar( + new PlotOptions().setDataLabels( + new DataLabels().setEnabled(Boolean.TRUE) + ) + ) + ); + + setLegend(new Legend() + .setLayout(LegendLayout.VERTICAL) + .setAlign(HorizontalAlignment.RIGHT) + .setVerticalAlign(VerticalAlignment.TOP) + .setX(-100) + .setY(100) + .setFloating(Boolean.TRUE) + .setBorderWidth(1) + .setBackgroundColor(new HexColor("#ffffff")) + .setShadow(Boolean.TRUE) + ); + + setCredits(new CreditOptions() + .setEnabled(Boolean.FALSE) + ); + + addSeries(new SimpleSeries() + .setName("Year 1800") + .setData(107, 31, 635, 203, 2) + ); + + addSeries(new SimpleSeries() + .setName("Year 1900") + .setData(133, 156, 947, 408, 6) + ); + + addSeries(new SimpleSeries() + .setName("Year 2008") + .setData(973, 914, 4054, 732, 34) + ); + + } + + @Override + public String getLabel() { return super.getLabel() + "Basic bar"; - } + } } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/ShowcaseOptions.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/ShowcaseOptions.java index a7f5405d54..27ce1d4f5a 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/ShowcaseOptions.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/ShowcaseOptions.java @@ -20,12 +20,12 @@ * @author Paul Bors */ public abstract class ShowcaseOptions extends Options { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * The label under which the Options class is shown in navigation. - */ - public String getLabel() { + /** + * The label under which the Options class is shown in navigation. + */ + public String getLabel() { return "HighCharts: "; } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/SplineUpdatingOptions.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/SplineUpdatingOptions.java index 7904bc7307..bd43150ce1 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/SplineUpdatingOptions.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/SplineUpdatingOptions.java @@ -36,88 +36,88 @@ * @author Paul Bors */ public class SplineUpdatingOptions extends ShowcaseOptions { - private static final long serialVersionUID = 1L; - - protected LiveDataSeries series; - - public SplineUpdatingOptions() { - this.setChartOptions(new ChartOptions() - .setType(SeriesType.SPLINE) - .setMarginRight(10)); - - this.setTitle(new Title("Live random data")); - - this.setxAxis(new Axis() - .setType(AxisType.DATETIME) - .setTickPixelInterval(150) - ); - - this.setyAxis(new Axis() - .setTitle(new Title("Value")) - .setPlotLines(Collections - .singletonList(new PlotLine() - .setValue(0f) - .setWidth(1) - .setColor(new HexColor("#808080")) - ) - ) - ); - - this.setTooltip(new Tooltip() - .setFormatter(new Function() - .setFunction( - "return ''+ this.series.name +'
'+" + - "Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'
'+" + - "Highcharts.numberFormat(this.y, 2);" - ) - ) - ); - - this.setLegend(new Legend(Boolean.FALSE)); - - this.setExporting(new ExportingOptions().setEnabled(Boolean.FALSE)); - - this.series = new LiveDataSeries(this, 1000) { - private static final long serialVersionUID = 1L; - @Override - public Point update(final LiveDataUpdateEvent event) { - Point point = new Point(); - point.setX(new Date().getTime()); - point.setY(Math.random()); - //point.setMarker(new Marker().setFillColor(HexColor.fromString("#0000FF"))); - return point; - } - }.addJavaScriptParameter("currentTime", "new Date()"); - - this.series - .setData(this.randomData(20)) - .setName("Random data"); - - this.addSeries(this.series); - } - - /** - * Refreshes the series data so that it starts at the current date. - */ - public void refresh() { - this.series.setData(this.randomData(20)); - } - - protected List randomData(final int size) { - long time = new Date().getTime() - 20000; - List result = new ArrayList(); - for (int i = 0; i < size; i++) { - result.add(new Point() - .setX(time) - .setY(Math.random()) - ); - time += 1000; - } - return result; - } - - @Override - public String getLabel() { + private static final long serialVersionUID = 1L; + + protected LiveDataSeries series; + + public SplineUpdatingOptions() { + this.setChartOptions(new ChartOptions() + .setType(SeriesType.SPLINE) + .setMarginRight(10)); + + this.setTitle(new Title("Live random data")); + + this.setxAxis(new Axis() + .setType(AxisType.DATETIME) + .setTickPixelInterval(150) + ); + + this.setyAxis(new Axis() + .setTitle(new Title("Value")) + .setPlotLines(Collections + .singletonList(new PlotLine() + .setValue(0f) + .setWidth(1) + .setColor(new HexColor("#808080")) + ) + ) + ); + + this.setTooltip(new Tooltip() + .setFormatter(new Function() + .setFunction( + "return ''+ this.series.name +'
'+" + + "Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'
'+" + + "Highcharts.numberFormat(this.y, 2);" + ) + ) + ); + + this.setLegend(new Legend(Boolean.FALSE)); + + this.setExporting(new ExportingOptions().setEnabled(Boolean.FALSE)); + + this.series = new LiveDataSeries(this, 1000) { + private static final long serialVersionUID = 1L; + @Override + public Point update(final LiveDataUpdateEvent event) { + Point point = new Point(); + point.setX(new Date().getTime()); + point.setY(Math.random()); + //point.setMarker(new Marker().setFillColor(HexColor.fromString("#0000FF"))); + return point; + } + }.addJavaScriptParameter("currentTime", "new Date()"); + + this.series + .setData(this.randomData(20)) + .setName("Random data"); + + this.addSeries(this.series); + } + + /** + * Refreshes the series data so that it starts at the current date. + */ + public void refresh() { + this.series.setData(this.randomData(20)); + } + + protected List randomData(final int size) { + long time = new Date().getTime() - 20000; + List result = new ArrayList(); + for (int i = 0; i < size; i++) { + result.add(new Point() + .setX(time) + .setY(Math.random()) + ); + time += 1000; + } + return result; + } + + @Override + public String getLabel() { return super.getLabel() + "Spline updating each second"; - } + } } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/StackedAndGroupedColumnOptions.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/StackedAndGroupedColumnOptions.java index 1853082d10..f9a1f363e6 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/StackedAndGroupedColumnOptions.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/options/StackedAndGroupedColumnOptions.java @@ -32,92 +32,92 @@ * @author Paul Bors */ public class StackedAndGroupedColumnOptions extends ShowcaseOptions { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public StackedAndGroupedColumnOptions() { - ChartOptions chartOptions = new ChartOptions(); - chartOptions.setType(SeriesType.COLUMN); - setChartOptions(chartOptions); + public StackedAndGroupedColumnOptions() { + ChartOptions chartOptions = new ChartOptions(); + chartOptions.setType(SeriesType.COLUMN); + setChartOptions(chartOptions); - Title title = new Title("Total fruit consumption, grouped by gender"); - setTitle(title); + Title title = new Title("Total fruit consumption, grouped by gender"); + setTitle(title); - Axis xAxis = new Axis(); - xAxis - .setCategories(Arrays - .asList(new String[]{"Apples", "Oranges", "Pears", "Grapes", - "Bananas"})); - setxAxis(xAxis); + Axis xAxis = new Axis(); + xAxis + .setCategories(Arrays + .asList(new String[]{"Apples", "Oranges", "Pears", "Grapes", + "Bananas"})); + setxAxis(xAxis); - Axis yAxis = new Axis(); - yAxis.setAllowDecimals(Boolean.FALSE); - yAxis.setMin(0); - yAxis.setTitle(new Title("Number of fruits")); - setyAxis(yAxis); + Axis yAxis = new Axis(); + yAxis.setAllowDecimals(Boolean.FALSE); + yAxis.setMin(0); + yAxis.setTitle(new Title("Number of fruits")); + setyAxis(yAxis); - setTooltip(new Tooltip()); + setTooltip(new Tooltip()); - PlotOptions plotOptions = new PlotOptions(); - plotOptions.setStacking(Stacking.NORMAL); - PlotOptionsChoice choice = new PlotOptionsChoice(); - choice.setColumn(plotOptions); - setPlotOptions(choice); + PlotOptions plotOptions = new PlotOptions(); + plotOptions.setStacking(Stacking.NORMAL); + PlotOptionsChoice choice = new PlotOptionsChoice(); + choice.setColumn(plotOptions); + setPlotOptions(choice); - // create data - Random r = new Random(); - List sales = new ArrayList(); - for (int i = 0; i <= 5; i++) { - sales - .add(r - .nextInt(10)); - } - List sales2 = new ArrayList(); - for (int i = 0; i <= 5; i++) { - sales2 - .add(r - .nextInt(10)); - } - List sales3 = new ArrayList(); - for (int i = 0; i <= 5; i++) { - sales3 - .add(r - .nextInt(10)); - } - List sales4 = new ArrayList(); - for (int i = 0; i <= 5; i++) { - sales4 - .add(r - .nextInt(10)); - } + // create data + Random r = new Random(); + List sales = new ArrayList(); + for (int i = 0; i <= 5; i++) { + sales + .add(r + .nextInt(10)); + } + List sales2 = new ArrayList(); + for (int i = 0; i <= 5; i++) { + sales2 + .add(r + .nextInt(10)); + } + List sales3 = new ArrayList(); + for (int i = 0; i <= 5; i++) { + sales3 + .add(r + .nextInt(10)); + } + List sales4 = new ArrayList(); + for (int i = 0; i <= 5; i++) { + sales4 + .add(r + .nextInt(10)); + } - // add data to the chart - Series series1 = new SimpleSeries(); - series1.setData(sales); - series1.setStack("male"); - series1.setName("John"); - addSeries(series1); + // add data to the chart + Series series1 = new SimpleSeries(); + series1.setData(sales); + series1.setStack("male"); + series1.setName("John"); + addSeries(series1); - Series series2 = new SimpleSeries(); - series2.setData(sales2); - series2.setStack("male"); - series2.setName("Joe"); - addSeries(series2); + Series series2 = new SimpleSeries(); + series2.setData(sales2); + series2.setStack("male"); + series2.setName("Joe"); + addSeries(series2); - Series series3 = new SimpleSeries(); - series3.setData(sales3); - series3.setStack("female"); - series3.setName("Jane"); - addSeries(series3); + Series series3 = new SimpleSeries(); + series3.setData(sales3); + series3.setStack("female"); + series3.setName("Jane"); + addSeries(series3); - Series series4 = new SimpleSeries(); - series4.setData(sales4); - series4.setStack("female"); - series4.setName("Janet"); - addSeries(series4); - } + Series series4 = new SimpleSeries(); + series4.setData(sales4); + series4.setStack("female"); + series4.setName("Janet"); + addSeries(series4); + } - @Override - public String getLabel() { + @Override + public String getLabel() { return super.getLabel() + "Stacked and grouped column"; - } + } } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/HighChartsSettingsPanel.html b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/HighChartsSettingsPanel.html index cd0cef5ca3..fc69611500 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/HighChartsSettingsPanel.html +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/HighChartsSettingsPanel.html @@ -1,13 +1,13 @@ - -
- Type - - Save - Cancel -
- Visit the HighCharts demo site for a full list of chart types. - -
- \ No newline at end of file + +
+ Type + + Save + Cancel +
+ Visit the HighCharts demo site for a full list of chart types. + +
+ diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/HighChartsSettingsPanel.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/HighChartsSettingsPanel.java index 398f96c74a..f07968f96e 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/HighChartsSettingsPanel.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/HighChartsSettingsPanel.java @@ -12,7 +12,10 @@ */ package org.wicketstuff.dashboard.widgets.charts.settings; -import com.googlecode.wickedcharts.highcharts.options.SeriesType; +import static org.wicketstuff.dashboard.DashboardContextInitializer.getDashboardContext; + +import java.util.Arrays; + import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; @@ -23,85 +26,80 @@ import org.apache.wicket.model.PropertyModel; import org.wicketstuff.dashboard.Dashboard; import org.wicketstuff.dashboard.Widget; -import org.wicketstuff.dashboard.web.DashboardContext; -import org.wicketstuff.dashboard.web.DashboardContextAware; import org.wicketstuff.dashboard.web.DashboardPanel; import org.wicketstuff.dashboard.web.WidgetPanel; import org.wicketstuff.dashboard.widgets.charts.HighChartsWidget; import org.wicketstuff.dashboard.widgets.charts.HighChartsWidgetView; -import java.util.Arrays; +import com.googlecode.wickedcharts.highcharts.options.SeriesType; /** * @author Paul Bors */ -public class HighChartsSettingsPanel extends GenericPanel implements DashboardContextAware { - private static final long serialVersionUID = 1L; - - private transient DashboardContext dashboardContext; - private SeriesType seriesType; - - public HighChartsSettingsPanel(String id, IModel model) { - super(id, model); - - setOutputMarkupPlaceholderTag(true); - - Form form = new Form("form"); - add(form); - - seriesType = SeriesType.valueOf(getModelObject().getSettings().get(Settings.seriesType.name())); - DropDownChoice choice = new DropDownChoice(Settings.seriesType.name(), - new PropertyModel(this, Settings.seriesType.name()), Arrays.asList(SeriesType.values())); - form.add(choice); - - form.add(new AjaxSubmitLink("submit") { - private static final long serialVersionUID = 1L; - @Override - protected void onSubmit(AjaxRequestTarget target, Form form) { - getModelObject().getSettings().put(Settings.seriesType.name(), seriesType.name()); - getModelObject().updateChart(); - - Dashboard dashboard = findParent(DashboardPanel.class).getDashboard(); - dashboardContext.getDashboardPersister().save(dashboard); - - hideSettingPanel(target); - - WidgetPanel widgetPanel = findParent(WidgetPanel.class); - target.add(widgetPanel.getWidgetHeaderPanel()); - - HighChartsWidgetView widgetView = (HighChartsWidgetView) widgetPanel.getWidgetView(); - target.add(widgetView); - } - @Override - protected void onError(AjaxRequestTarget target, Form form) { - } - }); - - form.add(new AjaxLink("cancel") { - private static final long serialVersionUID = 1L; - @Override - public void onClick(AjaxRequestTarget target) { - hideSettingPanel(target); - } - }); - - } - - @Override - public void setDashboardContext(DashboardContext dashboardContext) { - this.dashboardContext = dashboardContext; - } - - private void hideSettingPanel(AjaxRequestTarget target) { - setVisible(false); - target.add(this); - } - - public SeriesType getSeriesType() { - return seriesType; - } - - public void setSeriesType(SeriesType seriesType) { - this.seriesType = seriesType; - } +public class HighChartsSettingsPanel extends GenericPanel { + private static final long serialVersionUID = 1L; + + private SeriesType seriesType; + + public HighChartsSettingsPanel(String id, IModel model) { + super(id, model); + + setOutputMarkupPlaceholderTag(true); + + Form form = new Form<>("form"); + add(form); + + seriesType = SeriesType.valueOf(getModelObject().getSettings().get(Settings.seriesType.name())); + DropDownChoice choice = new DropDownChoice<>(Settings.seriesType.name(), + new PropertyModel(this, Settings.seriesType.name()), Arrays.asList(SeriesType.values())); + form.add(choice); + + form.add(new AjaxSubmitLink("submit") { + private static final long serialVersionUID = 1L; + + @Override + protected void onSubmit(AjaxRequestTarget target, Form form) { + getModelObject().getSettings().put(Settings.seriesType.name(), seriesType.name()); + getModelObject().updateChart(); + + Dashboard dashboard = findParent(DashboardPanel.class).getDashboard(); + getDashboardContext().getDashboardPersister().save(dashboard); + + hideSettingPanel(target); + + WidgetPanel widgetPanel = findParent(WidgetPanel.class); + target.add(widgetPanel.getWidgetHeaderPanel()); + + HighChartsWidgetView widgetView = (HighChartsWidgetView) widgetPanel.getWidgetView(); + target.add(widgetView); + } + + @Override + protected void onError(AjaxRequestTarget target, Form form) { + } + }); + + form.add(new AjaxLink("cancel") { + private static final long serialVersionUID = 1L; + + @Override + public void onClick(AjaxRequestTarget target) { + hideSettingPanel(target); + } + }); + + } + + private void hideSettingPanel(AjaxRequestTarget target) { + setVisible(false); + target.add(this); + } + + public SeriesType getSeriesType() { + return seriesType; + } + + public void setSeriesType(SeriesType seriesType) { + this.seriesType = seriesType; + } } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/Settings.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/Settings.java index 29e0326e56..082025779f 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/Settings.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-charts/src/main/java/org/wicketstuff/dashboard/widgets/charts/settings/Settings.java @@ -20,21 +20,21 @@ * @author Paul Bors */ public enum Settings { - seriesType("seriesType"); + seriesType("seriesType"); - private String name; + private String name; - Settings(String name) { - this.name = name; - } + Settings(String name) { + this.name = name; + } - @Override - public String toString() { - return name; - } + @Override + public String toString() { + return name; + } - public static SeriesType toSeriesType(Map settings) { - return SeriesType.valueOf(settings.get(seriesType.name())); - } + public static SeriesType toSeriesType(Map settings) { + return SeriesType.valueOf(settings.get(seriesType.name())); + } } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/pom.xml b/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/pom.xml index 16974c6ddf..c37f7a504c 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/pom.xml +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-dashboard-widgets - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-dashboard-widgets-jqplot diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotSettingsPanel.html b/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotSettingsPanel.html index 26878883c9..6026071f11 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotSettingsPanel.html +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotSettingsPanel.html @@ -1,11 +1,11 @@ -
- Type - - Save - Cancel - +
+ Type + + Save + Cancel +
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotSettingsPanel.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotSettingsPanel.java index 0345df52bd..c323dba3d8 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotSettingsPanel.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotSettingsPanel.java @@ -1,17 +1,19 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.wicketstuff.dashboard.widgets.jqplot; +import static org.wicketstuff.dashboard.DashboardContextInitializer.getDashboardContext; + import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; @@ -22,45 +24,40 @@ import org.apache.wicket.model.PropertyModel; import org.wicketstuff.dashboard.Dashboard; import org.wicketstuff.dashboard.Widget; -import org.wicketstuff.dashboard.web.DashboardContext; -import org.wicketstuff.dashboard.web.DashboardContextAware; import org.wicketstuff.dashboard.web.DashboardPanel; import org.wicketstuff.dashboard.web.WidgetPanel; /** * @author Decebal Suiu */ -public class JqPlotSettingsPanel extends GenericPanel implements DashboardContextAware { - +public class JqPlotSettingsPanel extends GenericPanel { private static final long serialVersionUID = 1L; - - private transient DashboardContext dashboardContext; + private String chartType; - + public JqPlotSettingsPanel(String id, IModel model) { super(id, model); - + setOutputMarkupPlaceholderTag(true); - - Form form = new Form("form"); + + Form form = new Form<>("form"); chartType = getModelObject().getSettings().get("chartType"); // chartType = ChartWidget.BAR_TYPE; - DropDownChoice choice = new DropDownChoice("chartType", - new PropertyModel(this, "chartType"), JqPlotWidget.TYPES); - form.add(choice); - - form.add(new AjaxSubmitLink("submit") { + DropDownChoice choice = new DropDownChoice<>("chartType", + new PropertyModel(this, "chartType"), JqPlotWidget.TYPES); + form.add(choice); + form.add(new AjaxSubmitLink("submit") { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form form) { - getModelObject().getSettings().put("chartType", chartType); + getModelObject().getSettings().put("chartType", chartType); Dashboard dashboard = findParent(DashboardPanel.class).getDashboard(); - dashboardContext.getDashboardPersister().save(dashboard); + getDashboardContext().getDashboardPersister().save(dashboard); - hideSettingPanel(target); - // TODO + hideSettingPanel(target); + // TODO WidgetPanel widgetPanel = findParent(WidgetPanel.class); JqPlotWidgetView widgetView = (JqPlotWidgetView) widgetPanel.getWidgetView(); target.add(widgetView); @@ -69,19 +66,16 @@ protected void onSubmit(AjaxRequestTarget target, Form form) { @Override protected void onError(AjaxRequestTarget target, Form form) { } - - }); - form.add(new AjaxLink("cancel") { - - private static final long serialVersionUID = 1L; + }); + form.add(new AjaxLink("cancel") { + private static final long serialVersionUID = 1L; @Override - public void onClick(AjaxRequestTarget target) { - hideSettingPanel(target); - } - - }); - + public void onClick(AjaxRequestTarget target) { + hideSettingPanel(target); + } + }); + add(form); } @@ -93,14 +87,8 @@ public void setChartType(String chartType) { this.chartType = chartType; } - @Override - public void setDashboardContext(DashboardContext dashboardContext) { - this.dashboardContext = dashboardContext; - } - private void hideSettingPanel(AjaxRequestTarget target) { - setVisible(false); - target.add(this); + setVisible(false); + target.add(this); } - } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotWidgetView.html b/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotWidgetView.html index 7d7908c64b..a6baf25d74 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotWidgetView.html +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-jqplot/src/main/java/org/wicketstuff/dashboard/widgets/jqplot/JqPlotWidgetView.html @@ -1,6 +1,6 @@ -
+
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/pom.xml b/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/pom.xml index 748098f7a8..3a51116ac1 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/pom.xml +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-dashboard-widgets - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-dashboard-widgets-justgage diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/JustGageWidgetView.html b/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/JustGageWidgetView.html index 9e22d0f799..1eb2c8bfbd 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/JustGageWidgetView.html +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/JustGageWidgetView.html @@ -1,6 +1,6 @@ -
+
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/JustGageWidgetView.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/JustGageWidgetView.java index db8a5b1e8d..7400c5a725 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/JustGageWidgetView.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/JustGageWidgetView.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -36,10 +36,10 @@ public class JustGageWidgetView extends WidgetView { JustGageWidgetView.class, "res/justgage.1.0.1.min.js"); private String gaugeId; - + public JustGageWidgetView(String id, Model model) { super(id, model); - + gaugeId = "gauge" + getSession().nextSequenceValue(); add(new WebMarkupContainer("gauge").setMarkupId(gaugeId)); } @@ -47,28 +47,28 @@ public JustGageWidgetView(String id, Model model) { @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); - + response.render(JavaScriptHeaderItem.forReference(raphaelReference)); response.render(JavaScriptHeaderItem.forReference(justgageReference)); - + response.render(OnDomReadyHeaderItem.forScript(getJustGageJavaScript())); } - + private CharSequence getJustGageJavaScript() { /* var g = new JustGage({ - id: "gauge", - value: 67, - min: 0, - max: 100, - title: "Visitors" - }); + id: "gauge", + value: 67, + min: 0, + max: 100, + title: "Visitors" + }); */ - - JustGageWidget widget = (JustGageWidget) getModelObject(); + + JustGageWidget widget = (JustGageWidget) getModelObject(); JustGage justGage = widget.getJustGage(); justGage.setId(gaugeId); - + StringBuilder function = new StringBuilder(); function.append("var " + gaugeId + " = "); function.append("new JustGage({"); @@ -76,19 +76,19 @@ private CharSequence getJustGageJavaScript() { function.append("});"); // System.out.println(function); - - return function; + + return function; } - + /* private String getGaugeId() { // return "gauge-" + getModelObject().getId(); return getGaugeVarname(); } - + private String getGaugeVarname() { return "gauge" + getSession().nextSequenceValue(); } */ - + } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/option/JavaScriptOptionsRenderer.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/option/JavaScriptOptionsRenderer.java index e13131ef9f..f08de3ca7e 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/option/JavaScriptOptionsRenderer.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-justgage/src/main/java/org/wicketstuff/dashboard/widgets/justgage/option/JavaScriptOptionsRenderer.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -21,14 +21,14 @@ public class JavaScriptOptionsRenderer { public static void renderOptions(Object optionsProvider, StringBuilder builder) { for (Field field : optionsProvider.getClass().getDeclaredFields()) { - // check if field has Option annotation + // check if field has Option annotation Option option; - if ((option = field.getAnnotation(Option.class)) != null) { - String name = option.name(); - if ("".equals(name)) { - name = field.getName(); - } - Object value = null; + if ((option = field.getAnnotation(Option.class)) != null) { + String name = option.name(); + if ("".equals(name)) { + name = field.getName(); + } + Object value = null; if (!field.isAccessible()) { field.setAccessible(true); } @@ -38,10 +38,10 @@ public static void renderOptions(Object optionsProvider, StringBuilder builder) // TODO e.printStackTrace(); } - boolean required = option.required(); + boolean required = option.required(); if ((value == null) && !required ) { - continue; // jump to next option + continue; // jump to next option } String optionValue; @@ -50,15 +50,15 @@ public static void renderOptions(Object optionsProvider, StringBuilder builder) } else { optionValue = value.toString(); } - - builder.append(name + ':' + optionValue + ','); - } + + builder.append(name + ':' + optionValue + ','); + } } - + char lastChar = builder.charAt(builder.length() - 1); if (',' == lastChar) { - builder.deleteCharAt(builder.length() - 1); // delete last "," + builder.deleteCharAt(builder.length() - 1); // delete last "," } } - + } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-loremipsum/pom.xml b/dashboard-parent/dashboard-widgets/dashboard-widgets-loremipsum/pom.xml index 579b4d38ef..2c2b88a079 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-loremipsum/pom.xml +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-loremipsum/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-dashboard-widgets - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-dashboard-widgets-loremipsum diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-loremipsum/src/main/java/org/wicketstuff/dashboard/widgets/loremipsum/LoremIpsumWidgetView.html b/dashboard-parent/dashboard-widgets/dashboard-widgets-loremipsum/src/main/java/org/wicketstuff/dashboard/widgets/loremipsum/LoremIpsumWidgetView.html index ba8023181a..f401318e8c 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-loremipsum/src/main/java/org/wicketstuff/dashboard/widgets/loremipsum/LoremIpsumWidgetView.html +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-loremipsum/src/main/java/org/wicketstuff/dashboard/widgets/loremipsum/LoremIpsumWidgetView.html @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/pom.xml b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/pom.xml index 835525a814..fb560f6cf9 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/pom.xml +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-dashboard-widgets - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-dashboard-widgets-ofchart diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartSettingsPanel.html b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartSettingsPanel.html index 26878883c9..6026071f11 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartSettingsPanel.html +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartSettingsPanel.html @@ -1,11 +1,11 @@ -
- Type - - Save - Cancel - +
+ Type + + Save + Cancel +
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartSettingsPanel.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartSettingsPanel.java index d3c89d5b4a..9abee82c71 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartSettingsPanel.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartSettingsPanel.java @@ -1,17 +1,19 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.wicketstuff.dashboard.widgets.ofchart; +import static org.wicketstuff.dashboard.DashboardContextInitializer.getDashboardContext; + import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; @@ -22,45 +24,40 @@ import org.apache.wicket.model.PropertyModel; import org.wicketstuff.dashboard.Dashboard; import org.wicketstuff.dashboard.Widget; -import org.wicketstuff.dashboard.web.DashboardContext; -import org.wicketstuff.dashboard.web.DashboardContextAware; import org.wicketstuff.dashboard.web.DashboardPanel; import org.wicketstuff.dashboard.web.WidgetPanel; /** * @author Decebal Suiu */ -public class ChartSettingsPanel extends GenericPanel implements DashboardContextAware { - +public class ChartSettingsPanel extends GenericPanel { private static final long serialVersionUID = 1L; - - private transient DashboardContext dashboardContext; + private String chartType; - + public ChartSettingsPanel(String id, IModel model) { super(id, model); - + setOutputMarkupPlaceholderTag(true); - - Form form = new Form("form"); + + Form form = new Form<>("form"); chartType = getModelObject().getSettings().get("chartType"); // chartType = ChartWidget.BAR_TYPE; - DropDownChoice choice = new DropDownChoice("chartType", - new PropertyModel(this, "chartType"), ChartWidget.TYPES); - form.add(choice); - - form.add(new AjaxSubmitLink("submit") { + DropDownChoice choice = new DropDownChoice<>("chartType", + new PropertyModel(this, "chartType"), ChartWidget.TYPES); + form.add(choice); + form.add(new AjaxSubmitLink("submit") { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form form) { - getModelObject().getSettings().put("chartType", chartType); + getModelObject().getSettings().put("chartType", chartType); Dashboard dashboard = findParent(DashboardPanel.class).getDashboard(); - dashboardContext.getDashboardPersister().save(dashboard); + getDashboardContext().getDashboardPersister().save(dashboard); - hideSettingPanel(target); - // TODO + hideSettingPanel(target); + // TODO WidgetPanel widgetPanel = findParent(WidgetPanel.class); ChartWidgetView widgetView = (ChartWidgetView) widgetPanel.getWidgetView(); target.add(widgetView); @@ -69,19 +66,16 @@ protected void onSubmit(AjaxRequestTarget target, Form form) { @Override protected void onError(AjaxRequestTarget target, Form form) { } - - }); - form.add(new AjaxLink("cancel") { - - private static final long serialVersionUID = 1L; + }); + form.add(new AjaxLink("cancel") { + private static final long serialVersionUID = 1L; @Override - public void onClick(AjaxRequestTarget target) { - hideSettingPanel(target); - } - - }); - + public void onClick(AjaxRequestTarget target) { + hideSettingPanel(target); + } + }); + add(form); } @@ -93,14 +87,8 @@ public void setChartType(String chartType) { this.chartType = chartType; } - @Override - public void setDashboardContext(DashboardContext dashboardContext) { - this.dashboardContext = dashboardContext; - } - private void hideSettingPanel(AjaxRequestTarget target) { - setVisible(false); - target.add(this); + setVisible(false); + target.add(this); } - } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartWidgetView.html b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartWidgetView.html index 7d7908c64b..a6baf25d74 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartWidgetView.html +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/ChartWidgetView.html @@ -1,6 +1,6 @@ -
+
- \ No newline at end of file + diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/DataResource.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/DataResource.java index 68372b9a83..672e3ed96b 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/DataResource.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/DataResource.java @@ -1,11 +1,11 @@ /* * Copyright 2013 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -23,35 +23,35 @@ public class DataResource extends AbstractResource { private static final long serialVersionUID = 1L; - + private Dashboard dashboard; public DataResource(Dashboard dashboard) { this.dashboard = dashboard; } - + @Override protected ResourceResponse newResourceResponse(Attributes attributes) { System.out.println("DataResource.newResourceResponse()"); String widgetId = attributes.getParameters().get("widgetId").toString(); System.out.println("widgetId = " + widgetId); - + System.out.println("dashboard = " + dashboard); final ChartWidget widget = (ChartWidget) dashboard.getWidget(widgetId); System.out.println("widget = " + widget); - - ResourceResponse response = new ResourceResponse(); - response.setContentType("application/json"); + + ResourceResponse response = new ResourceResponse(); + response.setContentType("application/json"); response.setWriteCallback(new WriteCallback() { @Override public void writeData(Attributes attributes) throws IOException { attributes.getResponse().write(widget.getChartData()); } - - }); - - return response; + + }); + + return response; } - + } diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/OpenFlashChart.html b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/OpenFlashChart.html index 564e1d70c8..81598919ce 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/OpenFlashChart.html +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/OpenFlashChart.html @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/SWFObject.java b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/SWFObject.java index 2bfb0dee4f..80ca761136 100644 --- a/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/SWFObject.java +++ b/dashboard-parent/dashboard-widgets/dashboard-widgets-ofchart/src/main/java/org/wicketstuff/dashboard/widgets/ofchart/SWFObject.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Decebal Suiu - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -46,7 +46,7 @@ public class SWFObject extends Behavior { * version can be a string in the format of * 'majorVersion.minorVersion.revision'. An example would be: "6.0.65". Or * you can just require the major version, such as "6". - * + * * @param flashUrl * The url of your swf file. * @param width @@ -60,7 +60,7 @@ public SWFObject(String flashUrl, String width, String height, String version) { if (flashUrl == null) { throw new IllegalArgumentException("Argument [flashUrl] cannot be null"); } - + this.flashUrl = flashUrl; this.width = width; this.height = height; @@ -81,7 +81,7 @@ public String getJavaScript() { if (target != null) { target.appendJavaScript(javascript); } - + return javascript; } @@ -121,22 +121,22 @@ private String buildDataObject(Map data) { String quote = "\""; if ((data != null) && !data.isEmpty()) { StringBuilder result = new StringBuilder(); - int size = getParameters().entrySet().size(); - int count = 0; - for (Map.Entry e : getParameters().entrySet()) { - result.append("{"); - result.append(quote).append(e.getKey()).append(quote). - append(":"). - append(quote).append(e.getValue()).append(quote); - result.append("}"); - if (count < size-1) { - result.append(","); - } - count++; - } + int size = getParameters().entrySet().size(); + int count = 0; + for (Map.Entry e : getParameters().entrySet()) { + result.append("{"); + result.append(quote).append(e.getKey()).append(quote). + append(":"). + append(quote).append(e.getValue()).append(quote); + result.append("}"); + if (count < size-1) { + result.append(","); + } + count++; + } return result.toString(); } - + return "{}"; } diff --git a/dashboard-parent/dashboard-widgets/pom.xml b/dashboard-parent/dashboard-widgets/pom.xml index bc4a327bf7..b03559416a 100644 --- a/dashboard-parent/dashboard-widgets/pom.xml +++ b/dashboard-parent/dashboard-widgets/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-dashboard-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-dashboard-widgets diff --git a/dashboard-parent/pom.xml b/dashboard-parent/pom.xml index 2e431da4fa..bc0d3d4f7e 100644 --- a/dashboard-parent/pom.xml +++ b/dashboard-parent/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-dashboard-parent diff --git a/datastores-parent/datastore-cassandra/pom.xml b/datastores-parent/datastore-cassandra/pom.xml index 35a4c49d64..fc0408b5c1 100644 --- a/datastores-parent/datastore-cassandra/pom.xml +++ b/datastores-parent/datastore-cassandra/pom.xml @@ -3,7 +3,7 @@ org.wicketstuff datastores-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT 4.0.0 diff --git a/datastores-parent/datastore-common/pom.xml b/datastores-parent/datastore-common/pom.xml index 6e4a470955..c93d1a280e 100644 --- a/datastores-parent/datastore-common/pom.xml +++ b/datastores-parent/datastore-common/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff datastores-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT 4.0.0 diff --git a/datastores-parent/datastore-hazelcast/pom.xml b/datastores-parent/datastore-hazelcast/pom.xml index b27ad094e1..de32a4ad7d 100644 --- a/datastores-parent/datastore-hazelcast/pom.xml +++ b/datastores-parent/datastore-hazelcast/pom.xml @@ -3,7 +3,7 @@ org.wicketstuff datastores-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT 4.0.0 diff --git a/datastores-parent/datastore-ignite/pom.xml b/datastores-parent/datastore-ignite/pom.xml index 767782659e..b0c64f6171 100644 --- a/datastores-parent/datastore-ignite/pom.xml +++ b/datastores-parent/datastore-ignite/pom.xml @@ -3,7 +3,7 @@ org.wicketstuff datastores-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT 4.0.0 diff --git a/datastores-parent/datastore-memcached/pom.xml b/datastores-parent/datastore-memcached/pom.xml index a71c8ae52c..13f7326d90 100644 --- a/datastores-parent/datastore-memcached/pom.xml +++ b/datastores-parent/datastore-memcached/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff datastores-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT 4.0.0 diff --git a/datastores-parent/datastore-redis/pom.xml b/datastores-parent/datastore-redis/pom.xml index 2eaf7976f3..a4f24d78a6 100644 --- a/datastores-parent/datastore-redis/pom.xml +++ b/datastores-parent/datastore-redis/pom.xml @@ -3,7 +3,7 @@ org.wicketstuff datastores-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT 4.0.0 diff --git a/datastores-parent/pom.xml b/datastores-parent/pom.xml index 9ae1634f85..62de508f3f 100644 --- a/datastores-parent/pom.xml +++ b/datastores-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT datastores-parent diff --git a/datatables-parent/datatables-examples/pom.xml b/datatables-parent/datatables-examples/pom.xml index ad3c01a1a8..8931e9f1f8 100644 --- a/datatables-parent/datatables-examples/pom.xml +++ b/datatables-parent/datatables-examples/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff datatables-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT datatables-examples diff --git a/datatables-parent/datatables/pom.xml b/datatables-parent/datatables/pom.xml index 70afab0d98..60826c29ad 100755 --- a/datatables-parent/datatables/pom.xml +++ b/datatables-parent/datatables/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff datatables-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-datatables diff --git a/datatables-parent/pom.xml b/datatables-parent/pom.xml index 89de79d499..0a0f836c67 100644 --- a/datatables-parent/pom.xml +++ b/datatables-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT datatables-parent diff --git a/editable-grid-parent/editable-grid-examples/pom.xml b/editable-grid-parent/editable-grid-examples/pom.xml index a5f5aa0b39..fcf266e20f 100644 --- a/editable-grid-parent/editable-grid-examples/pom.xml +++ b/editable-grid-parent/editable-grid-examples/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff editable-grid-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT editable-grid-examples war diff --git a/editable-grid-parent/editable-grid/pom.xml b/editable-grid-parent/editable-grid/pom.xml index c8e65a0c0c..7ffaff0598 100644 --- a/editable-grid-parent/editable-grid/pom.xml +++ b/editable-grid-parent/editable-grid/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff editable-grid-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-editable-grid Editable Grid component for Apache Wicket diff --git a/editable-grid-parent/editable-grid/src/main/java/org/wicketstuff/egrid/component/EditableDataTable.java b/editable-grid-parent/editable-grid/src/main/java/org/wicketstuff/egrid/component/EditableDataTable.java index ef36c6256f..78236c689b 100644 --- a/editable-grid-parent/editable-grid/src/main/java/org/wicketstuff/egrid/component/EditableDataTable.java +++ b/editable-grid-parent/editable-grid/src/main/java/org/wicketstuff/egrid/component/EditableDataTable.java @@ -32,6 +32,7 @@ import org.wicketstuff.egrid.model.OperationType; import org.wicketstuff.egrid.provider.IEditableDataProvider; import org.wicketstuff.egrid.toolbar.AbstractEditableGridToolbar; +import org.wicketstuff.egrid.component.EditableDataTable; /** * @@ -517,8 +518,10 @@ public void onEvent(IEvent event) { @SuppressWarnings("unchecked") Item rowItem = ((Item)event.getPayload()); - this.datagrid.refreash(rowItem); - event.stop(); + if (rowItem.findParent(EditableDataTable.class).equals(this)) { + this.datagrid.refreash(rowItem); + event.stop(); + } } else if (event.getPayload() instanceof GridOperationData) { diff --git a/editable-grid-parent/pom.xml b/editable-grid-parent/pom.xml index 34a0f41088..dfe41a6fef 100644 --- a/editable-grid-parent/pom.xml +++ b/editable-grid-parent/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT editable-grid-parent diff --git a/flot-parent/flot-examples/pom.xml b/flot-parent/flot-examples/pom.xml index bea7eda941..8d2b29fee0 100644 --- a/flot-parent/flot-examples/pom.xml +++ b/flot-parent/flot-examples/pom.xml @@ -6,7 +6,7 @@ flot-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT flot-examples diff --git a/flot-parent/flot/pom.xml b/flot-parent/flot/pom.xml index 852279809c..775fff645c 100644 --- a/flot-parent/flot/pom.xml +++ b/flot-parent/flot/pom.xml @@ -6,7 +6,7 @@ flot-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-flot @@ -25,11 +25,7 @@ org.slf4j - slf4j-log4j12 - - - log4j - log4j + slf4j-api junit diff --git a/flot-parent/pom.xml b/flot-parent/pom.xml index 42d1673c1c..1e50e4bafd 100644 --- a/flot-parent/pom.xml +++ b/flot-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT flot-parent diff --git a/gae-initializer-parent/gae-initializer-example/pom.xml b/gae-initializer-parent/gae-initializer-example/pom.xml index 1ee5857826..e992555055 100644 --- a/gae-initializer-parent/gae-initializer-example/pom.xml +++ b/gae-initializer-parent/gae-initializer-example/pom.xml @@ -6,7 +6,7 @@ gae-initializer-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT gae-initializer-example diff --git a/gae-initializer-parent/gae-initializer/pom.xml b/gae-initializer-parent/gae-initializer/pom.xml index d615e55dcf..7e32ffc0dd 100644 --- a/gae-initializer-parent/gae-initializer/pom.xml +++ b/gae-initializer-parent/gae-initializer/pom.xml @@ -6,7 +6,7 @@ gae-initializer-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-gae-initializer diff --git a/gae-initializer-parent/pom.xml b/gae-initializer-parent/pom.xml index 3790f207f0..9370adeffa 100644 --- a/gae-initializer-parent/pom.xml +++ b/gae-initializer-parent/pom.xml @@ -21,7 +21,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT gae-initializer-parent @@ -42,14 +42,9 @@ - org.slf4j - slf4j-log4j12 - - - log4j - log4j + slf4j-api diff --git a/gchart-parent/gchart-examples/pom.xml b/gchart-parent/gchart-examples/pom.xml new file mode 100644 index 0000000000..7159483351 --- /dev/null +++ b/gchart-parent/gchart-examples/pom.xml @@ -0,0 +1,74 @@ + + + + + 4.0.0 + + + + wicket-gchart-parent + org.wicketstuff + 7.0-SNAPSHOT + + wicket-gchart-examples + war + + wicket-gchart-examples + Examples for use of Google Charts. + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + UTF-8 + + + + + + org.slf4j + slf4j-api + + + + + junit + junit + test + + + + + org.eclipse.jetty.aggregate + jetty-all + ${jetty.version} + test + + + ${project.groupId} + wicket-gchart + ${project.version} + + + diff --git a/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage.html b/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage.html new file mode 100644 index 0000000000..32a4bb1002 --- /dev/null +++ b/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage.html @@ -0,0 +1,25 @@ + + + + + Apache Wicket Google Charts Test + + + + +

Test of Google Charts adaption

+

+ This demo uses wicket-gchart, a simple combination of wicket and Google Charts. +

+ +
+
+
+
+
+ +

+ After the charts. +

+ + diff --git a/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage.java b/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage.java new file mode 100644 index 0000000000..b6b313762d --- /dev/null +++ b/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage.java @@ -0,0 +1,421 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.examples; + +import org.wicketstuff.gchart.Chart; +import org.wicketstuff.gchart.ChartLibLoaderBehavior; +import org.wicketstuff.gchart.ChartType; +import org.wicketstuff.gchart.gchart.options.ClassicOptionHelper; +import org.wicketstuff.gchart.ColumnDeclaration; +import org.wicketstuff.gchart.ColumnRole; +import org.wicketstuff.gchart.ColumnType; +import org.wicketstuff.gchart.DataCell; +import org.wicketstuff.gchart.DataRow; +import org.wicketstuff.gchart.DataTable; +import org.wicketstuff.gchart.gchart.options.ChartOptions; +import org.wicketstuff.gchart.gchart.options.OptionHelper; +import org.wicketstuff.gchart.gchart.options.OptionModifier; +import org.wicketstuff.gchart.gchart.options.builder.OptionBuilder; +import java.text.DecimalFormat; +import java.text.Format; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.List; +import org.apache.wicket.Component; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.json.JSONArray; +import org.apache.wicket.ajax.json.JsonFunction; +import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.model.AbstractReadOnlyModel; +import org.apache.wicket.model.ComponentModel; +import org.apache.wicket.model.IComponentAssignedModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.PropertyModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HomePage extends WebPage { + + private static final long serialVersionUID = 1L; + private static final Logger log = LoggerFactory.getLogger(HomePage.class); + + private ChartLibLoaderBehavior chartLibLoader; + private Boolean stackedPercent = false; + private WebMarkupContainer barContainer; + private Chart chartBar; + + public HomePage(final PageParameters parameters) { + super(parameters); + chartLibLoader = new ChartLibLoaderBehavior(); + add(chartLibLoader); + // demonstrate different charts on one page + add(createChartPie()); + add(createChartLine()); + add(createChartDualLine()); + barContainer = new WebMarkupContainer("barContainer"); + barContainer.setOutputMarkupId(true); + add(barContainer); + chartBar = createChartBar(); + barContainer.add(chartBar); + + final PropertyModel stackedPercentModel = new PropertyModel<>(HomePage.this, "stackedPercent"); + AjaxCheckBox ajaxCheckBox = new AjaxCheckBox("stackedPercent", stackedPercentModel) { + private static final long serialVersionUID = 1L; + + @Override + protected void onUpdate(AjaxRequestTarget target) { + log.trace("stackedPercent {}", stackedPercent ? "True" : "False"); + target.add(barContainer); + target.appendJavaScript(chartBar.getCallbackId() + "();"); + } + }; + add(ajaxCheckBox); + } + + public boolean isStackedPercent() { + return stackedPercent; + } + + public void setStackedPercent(boolean stackedPercent) { + this.stackedPercent = stackedPercent; + } + + /** + * Minimum example as in + * Quick + * Start. + * + * @return Configured Pie Chart as in quick start example. + */ + private Chart createChartPie() { + AbstractReadOnlyModel optionsModel = new AbstractReadOnlyModel() { + private static final long serialVersionUID = 1L; + + @Override + public ChartOptions getObject() { + ChartOptions opts = new ChartOptions("options"); + opts.put("title", "How Much Pizza I Ate Last Night"); +// opts.put("width", 400); +// opts.put("height", 300); +// opts.put("colors", new JSONArray("['#e0440e', '#e6693e', '#ec8f6e', '#f3b49f', '#f6c7b6']")); + + return opts; + } + }; + + AbstractReadOnlyModel dataModel = new AbstractReadOnlyModel() { + private static final long serialVersionUID = 1L; + + @Override + public DataTable getObject() { + List colDefs; + List rows; + colDefs = new ArrayList<>(2); + colDefs.add(new ColumnDeclaration(ColumnType.STRING, "Topping")); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, "Slices")); + + rows = new ArrayList<>(5); + rows.add(new DataRow(Arrays.asList(new Object[]{"Mushrooms", 3}))); + rows.add(new DataRow(Arrays.asList(new Object[]{"Onions", 1}))); + rows.add(new DataRow(Arrays.asList(new Object[]{"Olives", 1}))); + rows.add(new DataRow(Arrays.asList(new Object[]{"Zucchini", 1}))); + rows.add(new DataRow(Arrays.asList(new Object[]{"Pepperoni", 2}))); + return new DataTable("data", colDefs, rows); + } + }; + + return new Chart("chartPie", Model.of(ChartType.PIE), optionsModel, dataModel, chartLibLoader); + } + + /** + * More complicated example: Line chart with three series and two axes. Make + * use of OptionHelper and use labels from i18n resources. Make use of + * explicit formatting of cell values and axis labels Simple + * AbstractReadonlyModel could be used if no i18n from Resources is needed. + * Shows use of {@link OptionModifier} to demonstrate axis and series + * configuring. Resulting options: + * {@code var options = {"pointSize":5,"hAxis":{"format":"hh:mm a","title":"Ortszeit 19.07.2017","viewWindow":{"min":new Date(2017, 6, 19, 0, 0),"max":new Date(2017, 6, 20, 0, 0)},"gridlines":{"count":8}},"vAxes":{"0":{"title":"Temperatur (°C)","viewWindow":{"min":10,"max":30}},"1":{"format":"percent","title":"Rel. Luftfeuchte %","viewWindow":{"min":0.3,"max":0.6},"gridlines":{"count":8}}},"series":{"0":{"targetAxisIndex":0},"1":{"targetAxisIndex":0},"2":{"targetAxisIndex":1}},"title":"Metar Temperatur"};} + * + * @return Line chart ready to use on page. + */ + private Chart createChartLine() { + IComponentAssignedModel optionsModel = new ComponentModel() { + private static final long serialVersionUID = 1L; + + @Override + public ChartOptions getObject(Component component) { + OptionHelper optionHelper = new ClassicOptionHelper((Chart) component); + ChartOptions opts = new ChartOptions("options"); + optionHelper.addTitle(opts); + opts.put("pointSize", 5); + + OptionModifier temperatureModifier = new OptionModifier() { + @Override + public void modify(ChartOptions options) { + ChartOptions viewWindow = new ChartOptions(); + viewWindow.put("min", 10); + viewWindow.put("max", 30); + options.put("viewWindow", viewWindow); + } + }; + OptionModifier humidityModifier = new OptionModifier() { + @Override + public void modify(ChartOptions options) { + options.put("format", "percent"); + ChartOptions viewWindow = new ChartOptions(); + viewWindow.put("min", 0.30); + viewWindow.put("max", 0.60); + options.put("viewWindow", viewWindow); + ChartOptions vAxisGridline = new ChartOptions(); + vAxisGridline.put("count", 8); + options.put("gridlines", vAxisGridline); + } + }; + + optionHelper.addDualAxisOptions(opts, + new String[]{"Temp", "Humidity"}, + new String[]{"Temp", "Temp", "Humidity"}, + // add for use with no i18n: new String[]{"Temperatur", "Rel. Luftfeuchte"}, + new OptionModifier[]{temperatureModifier, humidityModifier}, + null); + + ChartOptions hAxisOpts = new ChartOptions(); + hAxisOpts.put("title", "Ortszeit 19.07.2017"); + hAxisOpts.put("format", "hh:mm a"); // just for demonstration, delete line to see Google's format, which is more pretty here + ChartOptions viewWinOpts = new ChartOptions(); + viewWinOpts.put("min", DataCell.getJsValue(new GregorianCalendar(2017, Calendar.JULY, 19, 0, 0))); + viewWinOpts.put("max", DataCell.getJsValue(new GregorianCalendar(2017, Calendar.JULY, 20, 0, 0))); + hAxisOpts.put("viewWindow", viewWinOpts); + ChartOptions hAxisGridline = new ChartOptions(); + hAxisGridline.put("count", 8); + hAxisOpts.put("gridlines", hAxisGridline); + opts.put("hAxis", hAxisOpts); + + return opts; + } + }; + + IComponentAssignedModel dataModel = new ComponentModel() { + private static final long serialVersionUID = 1L; + + @Override + public DataTable getObject(Component component) { + + OptionHelper optionHelper = new ClassicOptionHelper((Chart) component); + List colDefs; + List rows; + colDefs = new ArrayList<>(); + colDefs.add(new ColumnDeclaration(ColumnType.DATETIME, "Timestamp")); +// alternative colDefs.add(new ColumnDeclaration(ColumnType.DATETIME, optionHelper.getChartLabelResourceModel("series.0.label"))); + +// alternative colDefs.add(ColumnDeclaration.fromJSON("{'type': 'number', 'label':'Temperature'}")); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, optionHelper.getChartLabelResourceModel("series.1.label"))); + colDefs.add(new ColumnDeclaration(ColumnType.STRING, ColumnRole.ANNOTATION)); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, optionHelper.getChartLabelResourceModel("series.2.label"))); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, optionHelper.getChartLabelResourceModel("series.3.label"))); + + Object[][] exampleData = new Object[][]{ + {new GregorianCalendar(2017, Calendar.JULY, 19, 8, 20).getTime(), 28, null, 12, 0.45}, + {new GregorianCalendar(2017, Calendar.JULY, 19, 8, 50), 18, null, 13, 0.49}, + {new GregorianCalendar(2017, Calendar.JULY, 19, 9, 20), 23, "Annotation", 14, 0.44}, + {new GregorianCalendar(2017, Calendar.JULY, 19, 9, 50), 16, null, 14, 0.40} + }; + // demonstration of explicitly formatting the data. + // If simple object is added to row instead of DataCell, Google Charts formats the values for you. + Format dateFormat = new SimpleDateFormat("dd.MM HH:mm", ((Chart) component).getLocale()); + Format celsiusFormat = new DecimalFormat("00.#°"); + Format percentFormat = new DecimalFormat("##0.0%"); + rows = new ArrayList<>(); + + for (Object[] objects : exampleData) { + DataRow row = new DataRow(5); + row.add(new DataCell(objects[0], dateFormat)); // hAxis Date + row.add(new DataCell(objects[1], celsiusFormat)); // series 1 + row.add(objects[2]); // Annotation for series 1 + row.add(new DataCell(objects[3], celsiusFormat)); // series 2 + row.add(new DataCell(objects[4], percentFormat)); // series 3 + rows.add(row); + } + + return new DataTable("data", colDefs, rows); + } + }; + + return new Chart("chartLine", Model.of(ChartType.LINE), optionsModel, dataModel, chartLibLoader); + } + + /** + * Line chart with two series and two axes according to + * Google's + * example. Make use of OptionBuiler. Shows use of {@link OptionModifier} + * to demonstrate series configuring. + * + * @return Line chart ready to use on page. + */ + private Chart createChartDualLine() { + IComponentAssignedModel optionsModel = new ComponentModel() { + private static final long serialVersionUID = 1L; + + @Override + public ChartOptions getObject(Component component) { + OptionBuilder builder = OptionBuilder.classic((Chart) component); + ChartOptions opts = new ChartOptions("options"); + + builder.title("Average Temperatures and Daylight in Iceland Throughout the Year"); + opts.put("width", 900); + opts.put("height", 500); + + builder.axis("TEMP", "Temps (Celsius)").axis("DAYLIGHT", "Daylight"); + + // change color of series 1 to orange to demonstrate use of modifiers + OptionModifier daylightSeriesModifier = new OptionModifier() { + + @Override + public void modify(ChartOptions options) { + options.put("color", "#FF7D0E"); + } + }; + builder.mapSeries("TEMP").mapSeries("DAYLIGHT", daylightSeriesModifier); + + ChartOptions hAxisOpts = new ChartOptions(); + JSONArray ticksJSON = new JSONArray(); + for (int month = 0; month < 12; month++) { + JsonFunction dateFun = new JsonFunction(String.format("new Date(2014, %d)", month)); + ticksJSON.put(dateFun); + } + hAxisOpts.put("ticks", ticksJSON); + opts.put("hAxis", hAxisOpts); + + ChartOptions vAxisOpts = new ChartOptions(); + ChartOptions viewWindowOpts = new ChartOptions(); + viewWindowOpts.put("max", 30); + vAxisOpts.put("viewWindow", viewWindowOpts); + opts.put("vAxis", vAxisOpts); + + opts.putAll(builder.build()); + return opts; + } + }; + + IComponentAssignedModel dataModel = new ComponentModel() { + private static final long serialVersionUID = 1L; + + @Override + public DataTable getObject(Component component) { + + List colDefs; + List rows; + colDefs = new ArrayList<>(); + colDefs.add(new ColumnDeclaration(ColumnType.DATE, "Month")); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, "Average Temperature")); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, "Average Hours of Daylight")); + + Object[][] exampleData = new Object[][]{ + {new GregorianCalendar(2014, Calendar.JANUARY, 1, 0, 0), -0.5, 5.7}, + {new GregorianCalendar(2014, Calendar.FEBRUARY, 1, 8, 0), .4, 8.7}, + {new GregorianCalendar(2014, Calendar.MARCH, 1, 0, 0), .5, 12}, + {new GregorianCalendar(2014, Calendar.APRIL, 1, 0, 0), 2.9, 15.3}, + {new GregorianCalendar(2014, Calendar.MAY, 1, 0, 0), 6.3, 18.6}, + {new GregorianCalendar(2014, Calendar.JUNE, 1, 0, 0), 9, 20.9}, + {new GregorianCalendar(2014, Calendar.JULY, 1, 0, 0), 10.6, 19.8}, + {new GregorianCalendar(2014, Calendar.AUGUST, 1, 0, 0), 10.3, 16.6}, + {new GregorianCalendar(2014, Calendar.SEPTEMBER, 1, 0, 0), 7.4, 13.3}, + {new GregorianCalendar(2014, Calendar.OCTOBER, 1, 0, 0), 4.4, 9.9}, + {new GregorianCalendar(2014, Calendar.NOVEMBER, 1, 0, 0), 1.1, 6.6}, + {new GregorianCalendar(2014, Calendar.DECEMBER, 1, 0, 0), -.2, 4.5} + }; + rows = DataTable.fromArray(exampleData); + + return new DataTable("data", colDefs, rows); + } + }; + final Chart chart = new Chart("chartDualLine", Model.of(ChartType.LINE), optionsModel, dataModel, chartLibLoader); + chart.setResponsive(false); + return chart; + } + + private Chart createChartBar() { + // 100% stacked ba chart from https://developers.google.com/chart/interactive/docs/gallery/barchart + + IComponentAssignedModel optionsModel = new ComponentModel() { + private static final long serialVersionUID = 1L; + + @Override + public ChartOptions getObject(Component component) { + ChartOptions opts = new ChartOptions("options"); + + opts.put("width", 600); + opts.put("height", 400); +// opts.put("isStacked", "percent"); + opts.put("isStacked", stackedPercent ? "percent" : true); + + ChartOptions barOpt = new ChartOptions(); + barOpt.put("groupWidth", "75%"); + opts.put("bar", barOpt); + + ChartOptions legendOpt = new ChartOptions(); + legendOpt.put("position", "top"); + legendOpt.put("maxLines", 3); + opts.put("legend", legendOpt); + + ChartOptions hAxisOpts = new ChartOptions(); + hAxisOpts.put("minValue", "0"); + hAxisOpts.put("ticks", new JSONArray("[0, .3, .6, .9, 1]")); +// opts.put("hAxis", hAxisOpts); + + return opts; + } + }; + + IComponentAssignedModel dataModel = new ComponentModel() { + private static final long serialVersionUID = 1L; + + @Override + public DataTable getObject(Component component) { + + List colDefs = new ArrayList<>(); + List rows; + + colDefs.add(new ColumnDeclaration(ColumnType.STRING, "Year")); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, "Fantasy & Sci Fi")); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, "Romance")); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, "Mystery/Crime")); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, "General")); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, "Western")); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, "Literature")); + colDefs.add(new ColumnDeclaration(ColumnType.STRING, ColumnRole.ANNOTATION)); + + Object[][] exampleData = new Object[][]{ + {"2010", 10, 24, 20, 32, 18, 5, ""}, + {"2020", 16, 22, 23, 30, 16, 9, ""}, + {"2030", 28, 19, 29, 30, 12, 13, ""} + }; + + rows = DataTable.fromArray(exampleData); + + return new DataTable("data", colDefs, rows); + } + }; + + final Chart chartB = new Chart("chartBar", Model.of(ChartType.BAR), optionsModel, dataModel, chartLibLoader); + chartB.setResponsive(false); + return chartB; + } +} diff --git a/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage.properties b/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage.properties new file mode 100644 index 0000000000..1528bac878 --- /dev/null +++ b/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage.properties @@ -0,0 +1,19 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +chart.chartLine.title=Metar Temperature +chart.chartLine.axis.Temp.label=Temperature (\u00b0C) +chart.chartLine.axis.Humidity.label=Humidity % +chart.chartLine.series.0.label=Timestamp +chart.chartLine.series.1.label=Temperature +chart.chartLine.series.2.label=Dewpoint +chart.chartLine.series.3.label=Humidity diff --git a/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage_de_DE.properties b/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage_de_DE.properties new file mode 100644 index 0000000000..01bef7c1b3 --- /dev/null +++ b/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/HomePage_de_DE.properties @@ -0,0 +1,19 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +chart.chartLine.title=Metar Temperatur +chart.chartLine.axis.Temp.label=Temperatur (\u00b0C) +chart.chartLine.axis.Humidity.label=Rel. Luftfeuchte % +chart.chartLine.series.0.label=Zeitpunkt +chart.chartLine.series.1.label=Temperatur +chart.chartLine.series.2.label=Taupunkt +chart.chartLine.series.3.label=Rel. Luftfeuchte diff --git a/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/WicketApplication.java b/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/WicketApplication.java new file mode 100644 index 0000000000..16382a72c8 --- /dev/null +++ b/gchart-parent/gchart-examples/src/main/java/org/wicketstuff/gchart/examples/WicketApplication.java @@ -0,0 +1,28 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.examples; + +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.protocol.http.WebApplication; + +/** + * Application object for your web application. + */ +public class WicketApplication extends WebApplication { + + @Override + public Class getHomePage() { + return HomePage.class; + } +} diff --git a/gchart-parent/gchart-examples/src/main/resources/log4j2.xml b/gchart-parent/gchart-examples/src/main/resources/log4j2.xml new file mode 100644 index 0000000000..5596dd5f40 --- /dev/null +++ b/gchart-parent/gchart-examples/src/main/resources/log4j2.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gchart-parent/gchart-examples/src/main/webapp/META-INF/context.xml b/gchart-parent/gchart-examples/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000000..aa86782afa --- /dev/null +++ b/gchart-parent/gchart-examples/src/main/webapp/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/gchart-parent/gchart-examples/src/main/webapp/WEB-INF/web.xml b/gchart-parent/gchart-examples/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..36d7036b59 --- /dev/null +++ b/gchart-parent/gchart-examples/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,32 @@ + + + + wicket-gcharttrial + + + + + wicket.wicket-gcharttrial + org.apache.wicket.protocol.http.WicketFilter + + applicationClassName + org.wicketstuff.gchart.examples.WicketApplication + + + + + wicket.wicket-gcharttrial + /* + + diff --git a/gchart-parent/gchart-examples/src/main/webapp/css/style.css b/gchart-parent/gchart-examples/src/main/webapp/css/style.css new file mode 100644 index 0000000000..fc137cadb0 --- /dev/null +++ b/gchart-parent/gchart-examples/src/main/webapp/css/style.css @@ -0,0 +1,68 @@ +body, p, li, a { font-family: georgia, times, serif;font-size:13pt;} +h1, h2, h3 { font-family: 'Yanone Kaffeesatz', arial, serif; } +body { margin:0;padding:0;} +#hd { + width : 100%; + height : 87px; + background-color : #092E67; + margin-top : 0; + padding-top : 10px; + border-bottom : 1px solid #888; + z-index : 0; +} +#ft { + position : absolute; + bottom : 0; + width : 100%; + height : 99px; + background-color : #6493D2; + border-top : 1px solid #888; + z-index : 0; +} +#logo,#bd { + width : 650px; + margin: 0 auto; + padding: 25px 50px 0 50px; +} +#logo h1 { + color : white; + font-size:36pt; + display: inline; +} +#logo img { + display:inline; + vertical-align: bottom; + margin-left : 50px; + margin-right : 5px; +} +body { margin-top : 0; padding-top : 0;} +#logo, #logo h1 { margin-top : 0; padding-top : 0;} +#bd { + position : absolute; + top : 75px; + bottom : 75px; + left : 50%; + margin-left : -325px; + z-index : 1; + overflow: auto; + background-color : #fff; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + -moz-box-shadow: 0px 0px 10px #888; + -webkit-box-shadow: 0px 0px 10px #888; + box-shadow: 0px 0px 10px #888; +} +a, a:visited, a:hover, a:active { + color : #6493D2; +} +h2 { + padding : 0; margin:0; + font-size:36pt; + color:#FF5500; +} +h3 { + padding : 0; margin:0; + font-size:24pt; + color:#092E67; +} \ No newline at end of file diff --git a/gchart-parent/gchart-examples/src/main/webapp/logo.png b/gchart-parent/gchart-examples/src/main/webapp/logo.png new file mode 100644 index 0000000000..39ec54854b Binary files /dev/null and b/gchart-parent/gchart-examples/src/main/webapp/logo.png differ diff --git a/gchart-parent/gchart-examples/src/test/java/org/wicketstuff/gchart/examples/TestHomePage.java b/gchart-parent/gchart-examples/src/test/java/org/wicketstuff/gchart/examples/TestHomePage.java new file mode 100644 index 0000000000..f8150ac5d3 --- /dev/null +++ b/gchart-parent/gchart-examples/src/test/java/org/wicketstuff/gchart/examples/TestHomePage.java @@ -0,0 +1,29 @@ +package org.wicketstuff.gchart.examples; + +import org.apache.wicket.util.tester.WicketTester; +import org.junit.Before; +import org.junit.Test; + +/** + * Simple test using the WicketTester + */ +public class TestHomePage +{ + private WicketTester tester; + + @Before + public void setUp() + { + tester = new WicketTester(new WicketApplication()); + } + + @Test + public void homepageRendersSuccessfully() + { + //start and render the test page + tester.startPage(HomePage.class); + + //assert rendered page class + tester.assertRenderedPage(HomePage.class); + } +} diff --git a/gchart-parent/gchart-examples/src/test/jetty/jetty-http.xml b/gchart-parent/gchart-examples/src/test/jetty/jetty-http.xml new file mode 100644 index 0000000000..9f3256b15c --- /dev/null +++ b/gchart-parent/gchart-examples/src/test/jetty/jetty-http.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gchart-parent/gchart-examples/src/test/jetty/jetty-https.xml b/gchart-parent/gchart-examples/src/test/jetty/jetty-https.xml new file mode 100644 index 0000000000..58f7d53d2d --- /dev/null +++ b/gchart-parent/gchart-examples/src/test/jetty/jetty-https.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + http/1.1 + + + + + + + + + + + + + 30000 + + + + \ No newline at end of file diff --git a/gchart-parent/gchart-examples/src/test/jetty/jetty-ssl.xml b/gchart-parent/gchart-examples/src/test/jetty/jetty-ssl.xml new file mode 100644 index 0000000000..49e558bb47 --- /dev/null +++ b/gchart-parent/gchart-examples/src/test/jetty/jetty-ssl.xml @@ -0,0 +1,36 @@ + + + + + + + + + / + + + + + + SSL_RSA_WITH_DES_CBC_SHA + SSL_DHE_RSA_WITH_DES_CBC_SHA + SSL_DHE_DSS_WITH_DES_CBC_SHA + SSL_RSA_EXPORT_WITH_RC4_40_MD5 + SSL_RSA_EXPORT_WITH_DES40_CBC_SHA + SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA + SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gchart-parent/gchart-examples/src/test/jetty/jetty.xml b/gchart-parent/gchart-examples/src/test/jetty/jetty.xml new file mode 100644 index 0000000000..1a6293b405 --- /dev/null +++ b/gchart-parent/gchart-examples/src/test/jetty/jetty.xml @@ -0,0 +1,23 @@ + + + + + + + + https + + + + 32768 + 8192 + 8192 + true + false + 512 + + + + + + \ No newline at end of file diff --git a/gchart-parent/gchart-examples/src/test/resources/keystore b/gchart-parent/gchart-examples/src/test/resources/keystore new file mode 100644 index 0000000000..30bbc90ccf Binary files /dev/null and b/gchart-parent/gchart-examples/src/test/resources/keystore differ diff --git a/gchart-parent/gchart/pom.xml b/gchart-parent/gchart/pom.xml new file mode 100644 index 0000000000..e888138e47 --- /dev/null +++ b/gchart-parent/gchart/pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + + + wicket-gchart-parent + org.wicketstuff + 7.0-SNAPSHOT + + + wicket-gchart + jar + + Google Charts component for wicket + Integrate Google Charts API (v45) with wicket. + The API tries not to hide all details of the Google API, + but makes use of the JSON lib of wicket to mix Java, JavaScript and JSON in a transparent way.. + + + Dieter Tremel + tremel@tremel-computer.de + http://www.tremel-computer.de + +1 + + http://www.tremel-computer.de/typo3temp/pics/09570b0eb3.jpg + http://hotchpotch-blog.de/wp-content/uploads/2012/11/pleyer-foto-20121115-103612.jpg + + + + + http://www.tremel-computer.de + + + UTF-8 + 1.7 + 1.7 + + + + + + org.slf4j + slf4j-api + + + + + junit + junit + test + + + org.mockito + mockito-core + test + + + com.google.code.gson + gson + test + + + net.javacrumbs.json-unit + json-unit + 1.25.0 + test + + + \ No newline at end of file diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/Chart.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/Chart.java new file mode 100644 index 0000000000..275b97c291 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/Chart.java @@ -0,0 +1,411 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import org.apache.wicket.Component; +import org.apache.wicket.Session; +import org.apache.wicket.ajax.json.JSONArray; +import org.apache.wicket.ajax.json.JSONObject; +import org.apache.wicket.markup.head.HeaderItem; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptContentHeaderItem; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.head.JavaScriptReferenceHeaderItem; +import org.apache.wicket.markup.html.WebComponent; +import org.apache.wicket.model.IComponentAssignedModel; +import org.apache.wicket.model.IModel; +import org.wicketstuff.gchart.gchart.options.ChartOptions; + +/** + * Abstraction of Google charts for wicket. {@code OutputMarkupId} is set to + * true, since id is referenced in generated JavaScript. + * + * @author Dieter Tremel + */ +public class Chart extends WebComponent implements JavaScriptable { + + private static final long serialVersionUID = 1L; + /** URL for Google lib loader */ + public static final String LOADER_URL = "https://www.gstatic.com/charts/loader.js"; + + private ChartLibLoader loader = null; + private boolean responsive = true; + private Locale locale = null; + private String mapsApiKey = null; + private IModel typeModel; + private IModel dataModel; + + /** + * Basic Constructor. + * + * @param id Wicket id. Id is used in javascript, but at the moment not + * escaped to JavaScript identifier rules. So use only characters allowed + * for JavaScript declarations to avoid problems. + */ + public Chart(String id) { + super(id); + setOutputMarkupId(true); + } + + /** + * Complete Constructor. + * + * @param id Wicket id. Id is used in javascript, but at the moment not + * escaped to JavaScript identifier rules. So use only characters allowed + * for JavaScript declarations to avoid problems. + * + * This constructor is for use without {@link ChartLibLoader} (one chart per page). + * + * @param typeModel Model of Type of chart. + * @param optionModel Model of optionModel. + * @param dataModel Model of data dataModel. + */ + public Chart(String id, IModel typeModel, IModel optionModel, IModel dataModel) { + this(id, typeModel, optionModel, dataModel, null); + } + + /** + * Complete Constructor. + * + * @param id Wicket id. Id is used in javascript, but at the moment not + * escaped to JavaScript identifier rules. So use only characters allowed + * for JavaScript declarations to avoid problems. + * + * This constructor is for use with {@link ChartLibLoader} (multiple charts per page). + * + * @param typeModel Model of Type of chart. + * @param optionModel Model of optionModel. + * @param dataModel Model of data dataModel. + * @param loader Loader to add the chart to. + */ + public Chart(String id, IModel typeModel, IModel optionModel, IModel dataModel, ChartLibLoader loader) { + this(id); + this.typeModel = typeModel; + this.setDefaultModel(optionModel); + setDataModel(dataModel); +// add(new GoogleChartBehavior(this, getMarkupId())); + this.loader = loader; + if (loader != null) { + loader.addChart(this); + } + } + + @Override + protected void onDetach() { + super.onDetach(); + typeModel.detach(); + dataModel.detach(); + } + + /** + * Get Google Loader URL. Can be overwritten, if Google changes URL in + * future. + * + * @return Returns {@link #LOADER_URL}. + */ + public String getLoaderUrl() { + return LOADER_URL; + } + + /** + * Create the JavaScript for the Google loader. + * + * @return HeaderItem for Google loader url. + */ + public JavaScriptHeaderItem createLoaderItem() { + return JavaScriptHeaderItem.forUrl(getLoaderUrl()); + } + + @Override + public void renderHead(final IHeaderResponse response) { + super.renderHead(response); + // TODO ist this rendering sufficient for refreshing chart by AJAX? + + final List depItemList = new ArrayList<>(); + final JavaScriptContentHeaderItem chartScriptItem = new JavaScriptContentHeaderItem(toJavaScript(), getScriptId(), null) { + private static final long serialVersionUID = 1L; + + @Override + public List getDependencies() { + return depItemList; + } + }; + if (loader == null) { + response.render(createLoaderItem()); + } else { + depItemList.add(loader.getHeaderItem()); + } + response.render(chartScriptItem); + if (responsive) { + final JavaScriptReferenceHeaderItem jQueryHeaderItem = JavaScriptHeaderItem.forReference( + getApplication().getJavaScriptLibrarySettings().getJQueryReference()); +// response.render(jQueryHeaderItem); + response.render(new JavaScriptContentHeaderItem(createRedrawJavaScript(), getRedrawScriptId(), null) { + private static final long serialVersionUID = 1L; + + @Override + public List getDependencies() { + final List dependencies = super.getDependencies(); + dependencies.add(jQueryHeaderItem); + return dependencies; + } + }); + } + } + + /** + * Should some JavaScript be added to make the Chart responsive. By default + * Google charts are not responsive, this is an extension by wicket-gchart. + * + *

+ * This is set to true by default. + * + * @return True if the chart will redraw on window resize, false if not. + */ + public boolean isResponsive() { + return responsive; + } + + /** + * Set this to true if some JavaScript should be added to make the Chart + * responsive. By default Google charts are not responsive, this is an + * extension by wicket-gchart. If true a script like + *

+     * {@code $(window).resize(function(){
+     *   drawChart1();
+     * });}
+     * 
will be rendered in head to add this functionality. + * + * @param responsive Set to true to dynamically redraw the chart on resize + * events. Set to false not to redraw. Default is true. + */ + public void setResponsive(boolean responsive) { + this.responsive = responsive; + } + + /** + * The Locale is used to render a {@code language = "de"} in the + * load + * statement like in the example: + *
+     * {@code
+     * // Load Google Charts for the Japanese locale.
+     * google.charts.load('current', {'packages':['corechart'], 'language': 'ja'});
+     * }
If Locale is not explicitly set and null, the wicket {@link Component#getLocale() + * } + * is returned, which is identical to {@link Session#getLocale() }. To + * override use {@link #setLocale(java.util.Locale) }. + * + * @return Locale used for the package language option. + */ + @Override + public Locale getLocale() { + if (locale == null) { + return super.getLocale(); + } else { + return locale; + } + } + + /** + * Override default Locale for the chart. See {@link #getLocale() }. + * + * @param locale Locale to render chart with. + */ + public void setLocale(Locale locale) { + this.locale = locale; + } + + /** + * Getter for Google Maps API key for geo- and map charts. In all other + * charts this value will be null. Getter should never find any usage except + * tests and logging. + * + * @return Google Maps API key. Null except for Geo Charts. + */ + public String getMapsApiKey() { + return mapsApiKey; + } + + /** + * Setter for Google Maps API key for geo- and map charts. In all other + * charts this has no use. For geo- and mapcharts add this key to be + * rendered in package deklaration: + *
 {@code
+     * google.charts.load('current', {
+     *  'packages':['geochart'],
+     *  // Note: you will need to get a mapsApiKey for your project.
+     *  // See: https://developers.google.com/chart/interactive/docs/basic_load_libs#load-settings
+     *  'mapsApiKey': 'AIzaSyD-9tSrke72PouQMnMX-a7eZSW0jkFMBWY'
+     * });
+     * }
+ * + * @param mapsApiKey Google Maps API key. + */ + public void setMapsApiKey(String mapsApiKey) { + this.mapsApiKey = mapsApiKey; + } + + public IModel getTypeModel() { + return typeModel; + } + + public void setTypeModel(IModel typeModel) { + this.typeModel = typeModel; + } + + public IModel getOptionModel() { + return (IModel) getDefaultModel(); + } + + public void setOptionModel(IModel optionModel) { + this.setDefaultModel(optionModel); + } + + public IModel getDataModel() { + return dataModel; + } + + public final void setDataModel(IModel dataModel) { + this.dataModel = dataModel instanceof IComponentAssignedModel + ? ((IComponentAssignedModel) dataModel).wrapOnAssignment(this) + : dataModel; + } + + /** + * Create the load statement of the chart lib with package, language and + * Maps API key declaration as defined by the chart and its + * {@link ChartType}. + * + * @return Onle line load statement to be included in a JavaScript. + */ + protected String createLoaderStatement() { + StringBuilder sb = new StringBuilder(); + // Load the Visualization API and the package. + JSONObject packageDecl = new JSONObject(); + JSONArray packages = new JSONArray(); + packages.put(typeModel.getObject().getLoadPackage()); + packageDecl.put("packages", packages); + packageDecl.put("language", getLocale().getLanguage()); + if (mapsApiKey != null) { + packageDecl.put("mapsApiKey", mapsApiKey); + } + sb.append("google.charts.load('current', ").append(packageDecl.toString()).append(");").append("\n"); + return sb.toString(); + } + + @Override + public String toJavaScript() { + StringBuilder sb = new StringBuilder(); + + if (loader == null) { + sb.append(createLoaderStatement()); + } + + // Register a callback to run when the Google Visualization API is loaded. + sb.append("google.charts.setOnLoadCallback(").append(getCallbackId()).append(");").append("\n"); + + // define callback function + sb.append("function ").append(getCallbackId()).append("() {").append("\n"); + + // data table + final DataTable datatable = dataModel.getObject(); + sb.append(datatable.toJavaScript()).append("\n"); + + // options + final ChartOptions options = (ChartOptions) getDefaultModelObject(); + sb.append(options.toJavaScript()).append("\n"); + + // Instantiate and draw our chart, passing in the optionModel. + // var chart = new google.visualization.PieChart(document.getElementById('chart_div')); + sb.append("var ").append(getChartId()).append(" = new ").append(typeModel.getObject().toJavaScript()).append("("); + sb.append("document.getElementById('").append(getMarkupId()).append("')"); + sb.append(")").append("\n"); + + // chart.draw(data, optionModel); + sb.append(getChartId()).append(".draw(").append(datatable.getName()).append(", ").append(options.getName()).append(");").append("\n"); + + sb.append("}").append("\n"); // close callback function + + return sb.toString(); + } + + /** + * Make a callback identifier from chart id. + * + * @return Identifier for callback. + */ + public String getCallbackId() { + // TODO escape CSS ids in some way to avoid javascript id problems + return "draw" + getId(); + } + + /** + * Make a chart identifier from chart id. + * + * @return Identifier(js) for chart. + */ + public String getChartId() { + // TODO escape CSS ids in some way to avoid javascript id problems + return getId() + "Chart"; + } + + /** + * Make a script id from chart id. + * + * @return Identifier(js) for chart creation script.. + */ + public String getScriptId() { + // TODO escape CSS ids in some way to avoid javascript id problems + return getId() + "Script"; + } + + /** + * Make a script id for redraw script from chart id. This is used if chart + * should be responsive. + * + * @return Identifier(js) for chart redraw script.. + */ + public String getRedrawScriptId() { + // TODO escape CSS ids in some way to avoid javascript id problems + return getId() + "RedrawScript"; + } + +//$(window).resize(function(){ +// drawChart1(); +// drawChart2(); +//}); + /** + * Create a a redraw script for responsive charts. The chart is redrawn on + * {@code (window).resize} events. + * + * @return Complete redraw script. + */ + public String createRedrawJavaScript() { + StringBuilder sb = new StringBuilder("$(window).resize(function(){"); + sb.append(getCallbackId()).append("();"); + sb.append("});"); + return sb.toString(); + } + + /** + * @return the loader + */ + public ChartLibLoader getLoader() { + return loader; + } +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ChartLibLoader.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ChartLibLoader.java new file mode 100644 index 0000000000..a43245ebfb --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ChartLibLoader.java @@ -0,0 +1,50 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +import org.apache.wicket.markup.head.HeaderItem; + +/** + * Interface for implementation of central lib and package loading mechanism. + * The implementation should load the Google chart lib only once and load every + * package needed by all charts added. If a Maps API key is set in one of the charts, + * it is also added. + * + * @author Dieter Tremel + */ +public interface ChartLibLoader { + + /** + * Add a chart to the loader, so it's package is loaded to. + * + * @param chart Chart to add. + * @return True if Chart is added. + */ + public boolean addChart(Chart chart); + + /** + * Remove a previous added chart. + * + * @param chart Chart to remove. + * @return True if the Chart was managed and is removed now, false otherwise. + */ + public boolean removeChart(Chart chart); + + /** + * Get the HeaderItem the loader adds, only to make dependencies to. + * + * @return HeaderItem that the loader contributes. + */ + public HeaderItem getHeaderItem(); +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ChartLibLoaderBehavior.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ChartLibLoaderBehavior.java new file mode 100644 index 0000000000..647052aacb --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ChartLibLoaderBehavior.java @@ -0,0 +1,176 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Set; +import org.apache.wicket.Component; +import org.apache.wicket.Page; +import org.apache.wicket.Session; +import org.apache.wicket.ajax.json.JSONArray; +import org.apache.wicket.ajax.json.JSONObject; +import org.apache.wicket.behavior.Behavior; +import org.apache.wicket.markup.head.HeaderItem; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptContentHeaderItem; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import static org.wicketstuff.gchart.Chart.LOADER_URL; + +/** + * Behavior to bundle the Google chart lib loading and package declaration for + * multiple charts on one page. All needed packages are merged in a set, so the + * loading is done only once as the + * docs + * request. + * + * To use add this behavior to the page (not the chart) and give the + * instance as param to every constructor of a chart component of the page. The + * Charts will register in the loader by {@link ChartLibLoader#addChart(org.wicketstuff.gchart.Chart) + * } + * and lib loading is done centralized. + * + * Use this behavior at page when you display multiple charts on the page (Since + * Google Charts version 45 this is mandatory, but still recommended.) + * + * @author Dieter Tremel + */ +public class ChartLibLoaderBehavior extends Behavior implements JavaScriptable, ChartLibLoader { + + private static final Logger log = LoggerFactory.getLogger(ChartLibLoaderBehavior.class); + public static final String LOADER_SCRIPT_ID = ChartLibLoaderBehavior.class.getSimpleName(); + private static final long serialVersionUID = 1L; + + private Locale locale = null; + private boolean renderLocale = true; + private final List charts = new ArrayList<>(); + private HeaderItem headerItem = null; + + @Override + public void bind(Component component) { + if (!(component instanceof Page)) { + throw new IllegalArgumentException("This behavior should be used at the page, not the chart!"); + } + super.bind(component); + locale = component.getLocale(); + } + + @Override + public boolean addChart(Chart chart) { + return charts.add(chart); + } + + @Override + public boolean removeChart(Chart chart) { + return charts.remove(chart); + } + + /** + * The Locale is used to render a {@code language = "de"} in the + * load + * statement like in the example: + *
+     * {@code
+     * // Load Google Charts for the Japanese locale.
+     * google.charts.load('current', {'packages':['corechart'], 'language': 'ja'});
+     * }
If this behavior is attached to the Page, Locale is set from the + * Page which normally is identical to {@link Session#getLocale() }. To + * override use {@link #setLocale(java.util.Locale) }. + * + * @return Locale used for the package language option. + */ + public Locale getLocale() { + return locale; + } + + public void setLocale(Locale locale) { + this.locale = locale; + } + + public List getCharts() { + return charts; + } + + public boolean isRenderLocale() { + return renderLocale; + } + + public void setRenderLocale(boolean renderLocale) { + this.renderLocale = renderLocale; + } + + /** + * Get Google loader URL. Can be overwritten, if Google changes URL in + * future. + * + * @return Returns {@link Chart#LOADER_URL}. + */ + public String getLoaderUrl() { + return LOADER_URL; + } + + @Override + public String toJavaScript() { + // collect information from charts + Set packageSet = new HashSet<>(); + String mapsApiKey = null; + for (Chart chart : charts) { + packageSet.add(chart.getTypeModel().getObject().getLoadPackage()); + if (chart.getMapsApiKey() != null) { + mapsApiKey = chart.getMapsApiKey(); + } + } + + StringBuilder sb = new StringBuilder(); + // Load the Visualization API and the package. + // google.charts.load('current', {'packages':['corechart']}); + JSONObject packageDecl = new JSONObject(); + JSONArray packages = new JSONArray(packageSet); +// packages.put(packageSet); + packageDecl.put("packages", packages); + if (renderLocale) { + packageDecl.put("language", getLocale().getLanguage()); + } + if (mapsApiKey != null) { + packageDecl.put("mapsApiKey", mapsApiKey); + } + sb.append("google.charts.load('current', ").append(packageDecl.toString()).append(");").append("\n"); + return sb.toString(); + } + + @Override + public HeaderItem getHeaderItem() { + if (headerItem == null) { + headerItem = new JavaScriptContentHeaderItem(toJavaScript(), LOADER_SCRIPT_ID, null) { + @Override + public List getDependencies() { + final List dependencies = super.getDependencies(); + dependencies.add(JavaScriptHeaderItem.forUrl(getLoaderUrl())); + return dependencies; + } + }; + } + return headerItem; + } + + @Override + public void renderHead(Component component, IHeaderResponse response) { + response.render(getHeaderItem()); + } + +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ChartType.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ChartType.java new file mode 100644 index 0000000000..648b32f7cc --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ChartType.java @@ -0,0 +1,91 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +/** + * Selection of chart types. + * Complete for classic charts, but does not implement the + * Material chart types. + * + * @author Dieter Tremel + */ +public enum ChartType implements JavaScriptable { + ANNOTATION("AnnotationChart", "annotationchart"), + AREA("AreaChart"), + BAR("BarChart"), + BUBBLE("BubbleChart"), + CALENDAR("Calendar", "calendar"), + CANDLESTICK("CandlestickChart"), + COLUMN("ColumnChart"), + COMBO("ComboChart"), + GANTT("Gantt", "gantt"), + GAUGE("Gauge", "gauge"), + /** Geocharts need Maps API key, see {@link Chart#setMapsApiKey(java.lang.String) } */ + GEO("GeoChart", "geochart"), + HISTOGRAM("Histogram"), + LINE("LineChart"), + LINE_MATERIAL("Line", "line"), + /** Map charts need Maps API key, see {@link Chart#setMapsApiKey(java.lang.String) } */ + MAP("Map", "map"), + ORG("OrgChart", "orgchart"), + /** PieChart. For Donut charts use this with Option {@code pieHole}. */ + PIE("PieChart"), + SANKEY("Sankey", "sankey"), + SCATTER("ScatterChart"), + STEPPEDAREA("SteppedAreaChart"), + TABLE("Table", "table"), + TIMELINE("Timeline", "timeline"), + TREEMAP("TreeMap", "treemap"), + WORDTREE("WordTree", "wordtree"); + + /** Name of Google chart core package */ + private static final String CORE_PACKAGE = "corechart"; + + private final String chartClass; + private final String loadPackage; + + private ChartType(String chartClass) { + this.chartClass = chartClass; + this.loadPackage = CORE_PACKAGE; + } + + private ChartType(String chartClass, String loadPackage) { + this.chartClass = chartClass; + this.loadPackage = loadPackage; + } + + /** + * Get the class name of the chart type. + * + * @return Class name of Google implementation. + */ + public String getChartClass() { + return chartClass; + } + + /** + * Package name of the type to use in the loader. + * + * @return Name of the charts package name. This defaults to + * {@link #CORE_PACKAGE} for most types. + */ + public String getLoadPackage() { + return loadPackage; + } + + @Override + public String toJavaScript() { + return "google.visualization." + getChartClass(); + } +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ColumnDeclaration.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ColumnDeclaration.java new file mode 100644 index 0000000000..a3294c4ed5 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ColumnDeclaration.java @@ -0,0 +1,256 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +import java.util.HashMap; +import java.util.Map; +import org.apache.wicket.ajax.json.JSONObject; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; + +/** + * Abstraction of a data column defintion. The more exotic fields like pattern, + * role and properties are handled by the setters. + * + * @author Dieter Tremel + */ +public class ColumnDeclaration implements Jsonable { + + private ColumnType type; + private String id = null; + private IModel labelModel = null; + private String pattern = null; + private ColumnRole role = null; + private final Map properties = new HashMap<>(8); + + /** + * Default constructor. + * + * @param type Datatype of column. + */ + public ColumnDeclaration(ColumnType type) { + this.type = type; + this.labelModel = null; + } + + /** + * Default constructor. + * + * @param id Id of Column. + * @param type Datatype of column. + */ + public ColumnDeclaration(String id, ColumnType type) { + this.id = id; + this.type = type; + this.labelModel = null; + } + + /** + * Constructor with label as String. + * + * @param type Datatype of column. + * @param label Label for description of column. + */ + public ColumnDeclaration(ColumnType type, String label) { + this.type = type; + this.labelModel = Model.of(label); + } + + /** + * Constructor with label. + * + * @param type Datatype of column. + * @param labelModel Model of Label for description of column. + */ + public ColumnDeclaration(ColumnType type, IModel labelModel) { + this.type = type; + this.labelModel = labelModel; + } + + /** + * Constructor with label. + * + * @param id Id of Column. + * @param type Datatype of column. + * @param labelModel Model of Label for description of column. + */ + public ColumnDeclaration(String id, ColumnType type, IModel labelModel) { + this.id = id; + this.type = type; + this.labelModel = labelModel; + } + + /** + * Constructor with role. Example: + *
{@code new ColumnDeclaration(ColumnType.STRING, ColumnRole.ANNOTATION);}
+ * + * @param type Datatype of column. + * @param role Role of column. + */ + public ColumnDeclaration(ColumnType type, ColumnRole role) { + this.type = type; + this.role = role; + + } + + /** + * Constructor with role. Example: + *
{@code new ColumnDeclaration(ColumnType.STRING, ColumnRole.ANNOTATION);}
+ * + * @param id Id of Column. + * @param type Datatype of column. + * @param role Role of column. + */ + public ColumnDeclaration(String id, ColumnType type, ColumnRole role) { + this.id = id; + this.type = type; + this.role = role; + + } + + /** + * Build an instance from a JSON string for instance as seen in tutorials. + * For users, that find coding in JSON easier than building nested + * ChartOptions, this my be an additional offer. Implemented as + * {@code fromJson(new JSONObject(json));}, see {@link #fromJSON(org.apache.wicket.ajax.json.JSONObject) + * }. + * + * @param json JSON string like + * {@code {id: 'task', label: 'Employee Name', type: 'string'}} + * @return New instance with data from the JSON String. + */ + public static ColumnDeclaration fromJSON(String json) { + return fromJSON(new JSONObject(json)); + } + + /** + * Build instance from a JSONobject. + * + * @param jsonObj JSON object to build ColumnDeclaration from. If this + * contains "properties" nested, it will try to fill them in the instance. + * @return New instance with data from the JSONObject. + */ + public static ColumnDeclaration fromJSON(JSONObject jsonObj) { + if (!jsonObj.has("type")) { + throw new IllegalArgumentException("The JSON for a ColumnDeclaration must at least have a type definition"); + } + ColumnType type = ColumnType.valueOf(jsonObj.getString("type").toUpperCase()); + ColumnDeclaration columnDeclaration = new ColumnDeclaration(type); + if (jsonObj.has("label")) { + columnDeclaration.setLabelModel(Model.of(jsonObj.getString("label"))); + } + if (jsonObj.has("pattern")) { + columnDeclaration.setPattern(jsonObj.getString("pattern")); + } + if (jsonObj.has("role")) { + columnDeclaration.setRole(ColumnRole.valueOf(jsonObj.getString("role"))); + } + if (jsonObj.has("properties")) { + if (jsonObj.get("properties") instanceof JSONObject) { + JSONObject props = (JSONObject) jsonObj.get("properties"); + for (String name : JSONObject.getNames(props)) { + columnDeclaration.getProperties().put(name, props.get(name)); + } + } + } + return columnDeclaration; + } + + public ColumnType getType() { + return type; + } + + public void setType(ColumnType type) { + this.type = type; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLabel() { + return labelModel.getObject(); + } + + public IModel getLabelModel() { + return labelModel; + } + + public void setLabelModel(IModel labelModel) { + this.labelModel = labelModel; + } + + public ColumnRole getRole() { + return role; + } + + /** + * Set role of column. See + * Column + * Roles. + * + * @param role Role of Column. + */ + public void setRole(ColumnRole role) { + this.role = role; + } + + public Map getProperties() { + return properties; + } + + public String getPattern() { + return pattern; + } + + /** + * Just given for completeness, Google Charts does not use this value at the moment. + * Use definition of options of axis ticks with value and format + * or {@code hAxis.format} instead to format axis values. + * + * @param pattern Pattern for Column. + */ + public void setPattern(String pattern) { + this.pattern = pattern; + } + + @Override + public JSONObject toJSON() { + // {id: 'hours', label: 'Hours per Day', type: 'number'} + JSONObject colDef = new JSONObject(); + + if (id != null) { + colDef.put("id", getId()); + } + if (labelModel != null) { + colDef.put("label", getLabel()); + } + if (pattern != null) { + colDef.put("pattern", getPattern()); + } + if (role != null) { + colDef.put("role", getRole().toJavaScript()); + } + if (properties != null && !properties.isEmpty()) { + colDef.put("p", new JSONObject(properties)); + } + colDef.put("type", getType().toJavaScript()); + + return colDef; + } +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ColumnRole.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ColumnRole.java new file mode 100644 index 0000000000..4912372487 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ColumnRole.java @@ -0,0 +1,35 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +/** + * Roles of columns in chart. Use in {@link ColumnDeclaration}. + * See Column Roles. + * + * @author Dieter Tremel + */ +public enum ColumnRole { + ANNOTATION, + ANNOTATIONTEXT, + CERTAINTY, + EMPHASIS, + INTERVAL, + SCOPE, + STYLE, + TOOLTIP; + + public String toJavaScript() { + return toString().toLowerCase(); + } +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ColumnType.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ColumnType.java new file mode 100644 index 0000000000..77e9e855c4 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/ColumnType.java @@ -0,0 +1,30 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +/** + * Google Column Types, see + * DataTable. + * + * @author Dieter Tremel + */ +public enum ColumnType implements JavaScriptable { + // string, number, boolean, date, datetime, and timeofday + STRING, NUMBER, BOOLEAN, DATE, DATETIME, TIMEOFDAY; + + @Override + public String toJavaScript() { + return toString().toLowerCase(); + } +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/DataCell.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/DataCell.java new file mode 100644 index 0000000000..1b1e8c6867 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/DataCell.java @@ -0,0 +1,235 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +import java.text.DateFormat; +import java.text.Format; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import org.apache.wicket.ajax.json.JSONObject; +import org.apache.wicket.ajax.json.JsonFunction; +import org.apache.wicket.util.io.IClusterable; + +/** + * Cell object for data values with more features. + * + * @author Dieter Tremel + */ +public class DataCell implements IClusterable, Jsonable { + + private static final long serialVersionUID = 1L; + + private Object value; + private Format format; + private String formatted; + private Map properties = null; + + public DataCell(Object value) { + this.value = value; + this.formatted = null; + } + + public DataCell(Object value, Format format) { + this.value = value; + this.formatted = null; + this.format = format; + } + + public DataCell(Object value, String formatted) { + this.value = value; + this.formatted = formatted; + } + + public DataCell(Object value, String formatted, Map properties) { + this.value = value; + this.formatted = formatted; + this.properties = properties; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + public Format getFormat() { + return format; + } + + /** + * Format used for calculating the value to a String used for rendering of + * {@code f} in JavaScript. + * + * @param format The format to applied if the formatted value of the + * instance is null. For Number this can be a DecimalFormat, for Dates for + * instance a SimpleDateFormat. + */ + public void setFormat(Format format) { + this.format = format; + } + + /** + * Return the formatted value. If this is null, null is also returned and + * there should be no rendering of {@code f} in JavaScript. In this case + * format conversion is done by Google chart lib. See therefor {@link Chart#getLocale() + * }. + * + * If {@link #getFormat() } is not null and the formatted field is null, the + * format is applied to the value. If formatted field is not null this is + * returned without change, so a single DataCell can override the Formatter. + * + * @return Field formatted if field format is null. If field format is not + * null and field formatted is null, the format is applied to the value and + * the result is returned. + */ + public String getFormatted() { + if (formatted == null && format != null) { + // TODO Check if Format crashes if value is null. Should we return null in this case? + if (format instanceof DateFormat && value instanceof Calendar) { + return format.format(((Calendar) value).getTime()); + } else { + return format.format(value); + } + } else { + return formatted; + } + } + + public void setFormatted(String formatted) { + this.formatted = formatted; + } + + public Map getProperties() { + if (properties == null) { + properties = new HashMap<>(8); + } + return properties; + } + + @Override + public JSONObject toJSON() { + JSONObject cell = new JSONObject(); + cell.put("v", getJsValue(value)); + final String formattedVal = getFormatted(); + if (formattedVal != null) { + cell.put("f", formattedVal); + } + if (properties != null && !properties.isEmpty()) { + cell.put("p", new JSONObject(properties)); + } + return cell; + } + + /** + * Create a representation of a Java object suitable for a put operation to + * a {@link JSONObject}. For simple types like String and Number the object + * is returned unmodified. + *

+ * Booleans are rendered as String {@code "true"} or {@code "false"} + *

+ * Dates or Calendars are rendered as JsonFunction {@code "Date()"} by use + * of {@link #createJsDate(java.util.Calendar) }. + *

+ * {@link TimeOfDay} are rendered as JSONArray by use of {@link TimeOfDay#getTimeOfDayArray() + * }. + * + * @param val The object to convert to. + * @return JSON compatible wrapping of the value or the value itself for + * simple types. + */ + public static Object getJsValue(Object val) { +// if (val == null) { +// return JSONObject.NULL; +// } +// use real null value instead + if (val instanceof Boolean) { + return ((Boolean) val).toString(); + } + if (val instanceof Date) { + return createJsDate((Date) val); + } + if (val instanceof Calendar) { + return createJsDate((Calendar) val); + } + if (val instanceof TimeOfDay) { + return ((TimeOfDay) val).getTimeOfDayArray(); + } + // if(val instanceof String || val instanceof Number) + return val; + } + + /** + * Convert a Calendar object to a JavaScript {@code Date()} call that + * generates the same value. Return as a human readable JsonFunction + * ({@code new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]])}) + * for rendering in JSONObjects. + * + * @param cal Calender value to render. + * @return JavaScript Date function for the value. + */ + public static JsonFunction createExplicitJsDate(Calendar cal) { + StringBuilder sb = new StringBuilder("new Date("); + sb.append(cal.get(Calendar.YEAR)); + sb.append(", ").append(cal.get(Calendar.MONTH)); + sb.append(", ").append(cal.get(Calendar.DAY_OF_MONTH)); + sb.append(", ").append(cal.get(Calendar.HOUR_OF_DAY)); + sb.append(", ").append(cal.get(Calendar.MINUTE)); + if ((cal.isSet(Calendar.SECOND) && cal.get(Calendar.SECOND) != 0) + || (cal.isSet(Calendar.MILLISECOND) && cal.get(Calendar.MILLISECOND) != 0)) { + sb.append(", ").append(cal.get(Calendar.SECOND)); + } + if (cal.isSet(Calendar.MILLISECOND) && cal.get(Calendar.MILLISECOND) != 0) { + sb.append(", ").append(cal.get(Calendar.MILLISECOND)); + } + sb.append(")"); + return new JsonFunction(sb.toString()); + } + + /** + * Convert a Calendar object to a JavaScript {@code Date()} call that + * generates the same value. Return as a + * JsonFunction({@code new Date(value);}) (milliseconds since epoch) for + * rendering in JSONObjects . + * + * @param cal Calender value to render. + * @return JavaScript Date function for the value. + */ + public static JsonFunction createJsDate(Calendar cal) { + StringBuilder sb = new StringBuilder("new Date("); + sb.append(cal.getTimeInMillis()); + sb.append(")"); + return new JsonFunction(sb.toString()); + } + + /** + * Convert a Date object to a JavaScript {@code Date()} call that generates + * the same value. Return as a + * JsonFunction({@code new Date(value);})(milliseconds since epoch) for + * rendering in JSONObjects. + * + * @param date Date value to render. + * @return JavaScript Date function for the value. + */ + public static JsonFunction createJsDate(Date date) { + StringBuilder sb = new StringBuilder("new Date("); + sb.append(date.getTime()); + sb.append(")"); + return new JsonFunction(sb.toString()); + } + +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/DataRow.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/DataRow.java new file mode 100644 index 0000000000..d5d6c336d8 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/DataRow.java @@ -0,0 +1,65 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +import java.util.ArrayList; +import java.util.Collection; +import org.apache.wicket.ajax.json.JSONArray; +import org.apache.wicket.ajax.json.JSONObject; +import org.apache.wicket.util.io.IClusterable; + +/** + * Modelling one row of data as List. Elements can be basic objects (eg. String, + * Number, ..., see {@link ColumnType}) for simple use cases or {@link DataCell} + * instances for special uses. + * + * @author Dieter Tremel + */ +public class DataRow extends ArrayList implements IClusterable, Jsonable { + + private static final long serialVersionUID = 1L; + + public DataRow(int initialCapacity) { + super(initialCapacity); + } + + public DataRow() { + } + + public DataRow(Collection c) { + super(c); + } + + @Override + public JSONObject toJSON() { + JSONObject row = new JSONObject(); + + JSONArray cells = new JSONArray(); + for (Object c : this) { + if (c instanceof DataCell) { + cells.put(((DataCell) c).toJSON()); + } else if (//c instanceof JSONObject || c instanceof JSONArray || c instanceof JsonFunction || + c == JSONObject.NULL || c == null) { + cells.put(c); + } else { + final JSONObject valueObj = new JSONObject(); + valueObj.put("v", DataCell.getJsValue(c)); + cells.put(valueObj); + } + } + row.put("c", cells); + return row; + } + +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/DataTable.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/DataTable.java new file mode 100644 index 0000000000..566bab3211 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/DataTable.java @@ -0,0 +1,131 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.wicket.ajax.json.JSONArray; +import org.apache.wicket.ajax.json.JSONObject; +import org.apache.wicket.util.io.IClusterable; + +/** + * Abstraction of a datatable. + * + * @author Dieter Tremel + */ +public class DataTable implements IClusterable, Jsonable { + + private static final long serialVersionUID = 1L; + + private final String name; + private final List columnDescs; + private final List rows; + private final Map properties; + + public DataTable(String name, Collection columDescs, Collection rows) { + this.name = name; + this.columnDescs = new ArrayList<>(columDescs); + this.rows = new ArrayList<>(rows); + this.properties = new HashMap<>(8); + } + + public DataTable(String name, Collection columDescs, Collection rows, Map properties) { + this.name = name; + this.columnDescs = new ArrayList<>(columDescs); + this.rows = new ArrayList<>(rows); + this.properties = properties; + } + + /** + * Create rows for the datatable from an array. + * + * @param data Two dimensional array with data series. First index over + * rows, second index over columns. Do not include header in data, use + * {@link ColumnDeclaration} for that. + * @return List of DataRows suited for {@link #DataTable(java.lang.String, java.util.Collection, java.util.Collection) + * }. + */ + public static List fromArray(Object[][] data) { + ArrayList rows = new ArrayList<>(data.length); + for (Object[] arrayRow : data) { + DataRow row = new DataRow(arrayRow.length); + row.addAll(Arrays.asList(arrayRow)); + rows.add(row); + } + return rows; + } + + public String toJavaScript() { + StringBuilder sb = new StringBuilder(); + sb.append("var ").append(name).append(" = new google.visualization.DataTable("); + sb.append(toJSON().toString()); + sb.append(")").append("\n"); + return sb.toString(); + } + + @Override + public JSONObject toJSON() { + JSONObject datatable = new JSONObject(); + + // column definitions + JSONArray cols = new JSONArray(); + for (ColumnDeclaration columnDesc : columnDescs) { + cols.put(columnDesc.toJSON()); + } + datatable.put("cols", cols); + + // data rows + JSONArray rowsJSON = new JSONArray(); + for (DataRow row : rows) { + rowsJSON.put(row.toJSON()); + } + datatable.put("rows", rowsJSON); + + // properties + if (properties != null && !properties.isEmpty()) { + datatable.put("p", new JSONObject(properties)); + } + + return datatable; + } + + public String getName() { + return name; + } + + public List getColumnDescs() { + return columnDescs; + } + + public List getRows() { + return rows; + } + + public Map getProperties() { + return properties; + } + + public boolean addRow(DataRow newRow) { + return rows.add(newRow); + } + + public boolean addRow(Collection newRow) { + return rows.add(new DataRow(newRow)); + } + +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/GoogleChartBehavior.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/GoogleChartBehavior.java new file mode 100644 index 0000000000..e5e2bdb783 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/GoogleChartBehavior.java @@ -0,0 +1,51 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +import org.apache.wicket.Component; +import org.apache.wicket.behavior.Behavior; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import static org.wicketstuff.gchart.Chart.LOADER_URL; + +/** + * + * @author Dieter Tremel + */ +public class GoogleChartBehavior extends Behavior { + + private static final long serialVersionUID = 6022115409129348109L; + + private final Chart chart; + private final String divId; + + public GoogleChartBehavior(Chart chart, String divId) { + this.chart = chart; + this.divId = divId; + } + + @Override + public void renderHead(Component component, IHeaderResponse response) { + super.renderHead(component, response); + // TODO ist this rendering sufficient for refreshing chart by AJAX? + response.render(JavaScriptHeaderItem.forReference( + component.getApplication().getJavaScriptLibrarySettings().getJQueryReference())); + response.render(JavaScriptHeaderItem.forUrl(LOADER_URL)); + response.render(JavaScriptHeaderItem.forScript(chart.toJavaScript(), chart.getScriptId())); + if (chart.isResponsive()) { + response.render(JavaScriptHeaderItem.forScript(chart.createRedrawJavaScript(), chart.getRedrawScriptId())); + } + } + +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/JavaScriptable.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/JavaScriptable.java new file mode 100644 index 0000000000..2102e6ce40 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/JavaScriptable.java @@ -0,0 +1,28 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +/** + * Interface for object that render a part of google chart's javascript. + * + * @author Dieter Tremel + */ +public interface JavaScriptable { + + /** + * Return the JavaScript part. + * @return JavaScript String for use as part of chart declaration. + */ + public String toJavaScript(); +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/Jsonable.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/Jsonable.java new file mode 100644 index 0000000000..484b901dba --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/Jsonable.java @@ -0,0 +1,34 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +import org.apache.wicket.ajax.json.JSONObject; + + + +/** + * Interface for object that can render a JSON representation of an instance. + * Makes use of Wicket JSON library, see package {@code org.apache.wicket.ajax.json}. + * + * @author Dieter Tremel + */ +public interface Jsonable { + + /** + * Create the JSON serialization of the instance. + * + * @return Json object for the instance. + */ + public JSONObject toJSON(); +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/TimeOfDay.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/TimeOfDay.java new file mode 100644 index 0000000000..36633ea678 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/TimeOfDay.java @@ -0,0 +1,107 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart; + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import org.apache.wicket.ajax.json.JSONArray; + +/** + * A time of day value as defined in Google charts. + * + * @author Dieter Tremel + */ +public class TimeOfDay { + + private int hours; + private int minutes; + private int seconds; + private int milliseconds; + + public TimeOfDay(int hours, int minutes, int seconds) { + this.hours = hours; + this.minutes = minutes; + this.seconds = seconds; + this.milliseconds = 0; + } + + public TimeOfDay(int hours, int minutes, int seconds, int milliseconds) { + this.hours = hours; + this.minutes = minutes; + this.seconds = seconds; + this.milliseconds = milliseconds; + } + + public TimeOfDay(Calendar cal) { + // Date part of cal value is ignored + this.hours = cal.get(Calendar.HOUR_OF_DAY); + this.minutes = cal.get(Calendar.MINUTE); + this.seconds = cal.get(Calendar.SECOND); + this.milliseconds = cal.get(Calendar.MILLISECOND); + } + + public TimeOfDay(Date date) { + // Date part of Date value is ignored + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(date); + this.hours = cal.get(Calendar.HOUR_OF_DAY); + this.minutes = cal.get(Calendar.MINUTE); + this.seconds = cal.get(Calendar.SECOND); + this.milliseconds = cal.get(Calendar.MILLISECOND); + } + + public int getHours() { + return hours; + } + + public void setHours(int hours) { + this.hours = hours; + } + + public int getMinutes() { + return minutes; + } + + public void setMinutes(int minutes) { + this.minutes = minutes; + } + + public int getSeconds() { + return seconds; + } + + public void setSeconds(int seconds) { + this.seconds = seconds; + } + + public int getMilliseconds() { + return milliseconds; + } + + public void setMilliseconds(int milliseconds) { + this.milliseconds = milliseconds; + } + + public JSONArray getTimeOfDayArray() { + JSONArray tofday = new JSONArray(); + tofday.put(hours); + tofday.put(minutes); + tofday.put(seconds); + if (milliseconds != 0) { + tofday.put(milliseconds); + } + return tofday; + } +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/json/ModelAwareJSONObject.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/json/ModelAwareJSONObject.java new file mode 100644 index 0000000000..64b999102e --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/json/ModelAwareJSONObject.java @@ -0,0 +1,54 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.json; + +import java.util.Map; +import org.apache.wicket.ajax.json.JSONException; +import org.apache.wicket.ajax.json.JSONObject; +import org.apache.wicket.ajax.json.JSONTokener; + +/** + * + * @author Dieter Tremel + */ +public class ModelAwareJSONObject extends JSONObject { + + public ModelAwareJSONObject() { + } + + public ModelAwareJSONObject(Map copyFrom) { + super(copyFrom); + } + + public ModelAwareJSONObject(JSONTokener readFrom) throws JSONException { + super(readFrom); + } + + public ModelAwareJSONObject(String json) throws JSONException { + super(json); + } + + public ModelAwareJSONObject(JSONObject copyFrom, String[] names) throws JSONException { + super(copyFrom, names); + } + + public ModelAwareJSONObject(Object bean) throws JSONException { + super(bean); + } + + @Override + public String toString() { + return toString(new ModelAwareJSONStringer()); + } +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/json/ModelAwareJSONStringer.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/json/ModelAwareJSONStringer.java new file mode 100644 index 0000000000..7799c7950d --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/json/ModelAwareJSONStringer.java @@ -0,0 +1,40 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.json; + +import org.apache.wicket.ajax.json.JSONException; +import org.apache.wicket.ajax.json.JSONStringer; +import org.wicketstuff.gchart.gchart.options.ChartOptions; +import org.apache.wicket.model.IModel; + +/** + * Subclass of {@link JSONStringer}, that dereferences models ({@code instanceof IModel}) + * before rendering to JSON. + * Useful when using JSONObject inside complex nested structures of {@link ChartOptions}, + * the value can be in model to allow dynamic creation or lazy loading. + * + * @author Dieter Tremel + */ +public class ModelAwareJSONStringer extends JSONStringer { + + @Override + public JSONStringer value(Object value) throws JSONException { + if (value instanceof IModel) { + return super.value(((IModel) value).getObject()); + } else { + return super.value(value); + } + } + +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/AbstractOptionHelper.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/AbstractOptionHelper.java new file mode 100644 index 0000000000..dc1ca8bbc1 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/AbstractOptionHelper.java @@ -0,0 +1,96 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options; + +import org.wicketstuff.gchart.Chart; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.ResourceModel; + +/** + * Abstract superclass for alle implementations of {@link OptionHelper}. Used + * for {@link MaterialOptionHelper} and {@link ClassicOptionHelper}. + * + * @author Dieter Tremel + */ +public abstract class AbstractOptionHelper implements OptionHelper { + + protected Chart chart; + + public AbstractOptionHelper(Chart chart) { + assert chart != null; + assert chart.getId() != null && !chart.getId().isEmpty(); + this.chart = chart; + } + + /** + * Helper function to build resource base key for a chart and it's id + * according to a convention. This should be used as left part for all keys + * for i18n of charts. + * + * @param chartId Wicket id of Chart. + * @return Base key with trailing dot, eg. {@code "Chart.myChart."} if param + * is {@code "myChart"}. + */ + public static String getChartBaseResourceKey(String chartId) { + return "chart." + chartId + "."; + } + + @Override + public String getChartBaseResourceKey() { + return getChartBaseResourceKey(chart.getId()); + } + + @Override + public IModel getChartLabelResourceModel(String subKey) { + ResourceModel resourceModel = new ResourceModel(getChartBaseResourceKey() + subKey); + return resourceModel.wrapOnAssignment(chart); + } + + @Override + public ChartOptions addTitle(ChartOptions parent) { + return addTitle(parent, getChartLabelResourceModel("title")); + } + + @Override + public ChartOptions addSubTitle(ChartOptions parent) { + return addTitle(parent, getChartLabelResourceModel("subtitle")); + } + + @Override + public ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping) { + String[] axisTitles = new String[axisNames.length]; + int axNo = 0; + for (String axisName : axisNames) { + axisTitles[axNo++] = getChartLabelResourceModel("axis." + axisName + ".label").getObject(); + } + return addDualAxisOptions(parent, axisNames, seriesMapping, axisTitles, null, null); + } + + @Override + public ChartOptions addDualAxisOptions(ChartOptions parent, + String[] axisNames, String[] seriesMapping, + OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers) { + String[] axisTitles = new String[axisNames.length]; + int axNo = 0; + for (String axisName : axisNames) { + axisTitles[axNo++] = getChartLabelResourceModel("axis." + axisName + ".label").getObject(); + } + return addDualAxisOptions(parent, axisNames, seriesMapping, axisTitles, axisModifiers, seriesModifiers); + } + + @Override + public ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, String[] axisTitles) { + return addDualAxisOptions(parent, axisNames, seriesMapping, axisTitles, null, null); + } +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/ChartOptions.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/ChartOptions.java new file mode 100644 index 0000000000..9ae94ef6e8 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/ChartOptions.java @@ -0,0 +1,212 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options; + +import org.wicketstuff.gchart.JavaScriptable; +import org.wicketstuff.gchart.Jsonable; +import org.wicketstuff.gchart.gchart.json.ModelAwareJSONObject; +import org.wicketstuff.gchart.gchart.json.ModelAwareJSONStringer; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.apache.wicket.ajax.json.JSONObject; +import org.apache.wicket.ajax.json.JSONStringer; +import org.apache.wicket.model.IModel; +import org.apache.wicket.util.io.IClusterable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Specialization of {@code HashMap} to hold chart options and + * generate JSON to represent them. + * + * ChartOptions can be nested, so more complex settings are realized in JSON + * output. + * + * For instance + *
{@code
+ * ChartOptions opts = new ChartOptions("options");
+ * opts.put("title", "Metar Temperatur");
+ * //        opts.put("width", 400);
+ * //        opts.put("height", 300);
+ *
+ * ChartOptions hAxisOpts = new ChartOptions();
+ *
+ * ChartOptions vAxisOpts = new ChartOptions();
+ * ChartOptions vAxisGridline = new ChartOptions();
+ * vAxisGridline.put("count", 8);
+ * vAxisOpts.put("gridlines", vAxisGridline);
+ * opts.put("vAxis", vAxisOpts);
+ * } 
results in + * {@code var options = {"vAxis":{"gridlines":{"count":8}},"title":"Metar Temperatur"};} + *

+ * + * The root instance must have a name so an identifier for the variable ist + * given. + * + * Values can be models ({@code instanceof IModel}). If the ChartOptions are + * rendered to JavaScript by {@link #toJavaScript()}, + * {@code getObject()} will be applied automatically to the models to retreive + * the value that goes to JavaScript. This is even possible if values are + * JSONObjects with Models as values, since a subclass of {@link JSONStringer} + * is used, that dereferences the models before rendering the value. + * + * @see ModelAwareJSONStringer + * + * @author Dieter Tremel + */ +public class ChartOptions extends HashMap implements IClusterable, JavaScriptable, Jsonable { + + private static final long serialVersionUID = 1L; + private static final Logger log = LoggerFactory.getLogger(ChartOptions.class); + + private String name; + + /** + * Default constructor. + */ + public ChartOptions() { + this.name = null; + } + + /** + * Constructor defining name. + * + * @param name The name is used to render a variable name in javascript. + */ + public ChartOptions(String name) { + this.name = name; + } + + public ChartOptions(ChartOptions m) { + super(m); + this.name = m.getName(); + } + + /** + * Constructor from another map. + * + * @param name The name is used to render a variable name in javascript. + * @param m Map to initialize from. + */ + public ChartOptions(String name, Map m) { + super(m); + this.name = name; + } + + /** + * Build an instance from a JSON string for instance as seen in tutorials. + * For users, that find coding in JSON easier than building nested + * ChartOptions, this my be an additional offer. Implemented as + * {@code fromJson(new JSONObject(json));}, see {@link #fromJson(org.apache.wicket.ajax.json.JSONObject) + * }. + * + * @param json JSON string like + * {@code {'title':'How Much Pizza I Ate Last Night','width':400,'height':300}} + * @return New instance with data from the JSON String. + */ + public static ChartOptions fromJson(String json) { + return fromJson(new JSONObject(json)); + } + + /** + * Build instance from a JSONobject. + * + * @param json JSON object to build map from. If this contains other + * JSONObjects nested, a corresponding nested structure of ChartOptions will + * be built. + * @return New instance with data from the JSONObject. + */ + public static ChartOptions fromJson(JSONObject json) { + ChartOptions chartOptions = new ChartOptions(); + for (String key : json.keySet()) { + Object obj = json.get(key); + if (obj instanceof JSONObject) { + chartOptions.put(key, fromJson((JSONObject) obj)); + } else { + chartOptions.put(key, obj); + } + } + return chartOptions; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ChartOptions other = (ChartOptions) obj; + if (!Objects.equals(this.name, other.name)) { + return false; + } + return super.equals(obj); + } + + @Override + public int hashCode() { + int hash = 5; + hash = 97 * hash + Objects.hashCode(this.name) + 23 * super.hashCode(); + return hash; + } + + /** + * Create a deep copy of the instance, where all models + * ({@code instanceof IModel}) are replaced with there value by + * {@code getObject()}. + * + * @return Deep copy with all models replaced. + */ + public ChartOptions getModelObjects() { + ChartOptions opts = new ChartOptions(name); + for (Map.Entry e : entrySet()) { + String key = e.getKey(); + Object value = e.getValue(); + if (value instanceof ChartOptions) { + opts.put(key, ((ChartOptions) value).getModelObjects()); + } else if (value instanceof IModel) { + opts.put(key, ((IModel) value).getObject()); + } else { + opts.put(key, value); + } + } + return opts; + } + + @Override + public String toJavaScript() { + if (name == null || name.isEmpty()) { + throw new IllegalArgumentException("Name must not be null or empty for Javascript generation of ChartOptions."); + } + return "var " + name + " = " + toJSON() + ";\n"; + } + + @Override + public JSONObject toJSON() { + return new ModelAwareJSONObject(this.getModelObjects()); + } +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/ClassicOptionHelper.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/ClassicOptionHelper.java new file mode 100644 index 0000000000..609cbab2db --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/ClassicOptionHelper.java @@ -0,0 +1,92 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options; + +import org.wicketstuff.gchart.Chart; +import java.util.HashMap; +import org.apache.wicket.model.IModel; + +/** + * Implementation of {@link OptionHelper} for Classic Charts. + * + * @author Dieter Tremel + */ +public class ClassicOptionHelper extends AbstractOptionHelper { + + public ClassicOptionHelper(Chart chart) { + super(chart); + } + + @Override + public ChartOptions addTitle(ChartOptions parent, IModel titleModel) { + parent.put("title", titleModel); + return parent; + } + @Override + public ChartOptions addTitle(ChartOptions parent, String title) { + parent.put("title", title); + return parent; + } + @Override + public ChartOptions addSubTitle(ChartOptions parent, IModel titleModel) { +// no subtitle in classic chart parent.put("subtitle", titleModel); + return parent; + } + @Override + public ChartOptions addSubTitle(ChartOptions parent, String subTitle) { +// no subtitle in classic chart parent.put("subtitle", subTitle); + return parent; + } +//series: { +// 0: {targetAxisIndex: 0}, +// 1: {targetAxisIndex: 1} +//}, +//vAxes: { +// // Adds titles to each axis. +// 0: {title: 'Temps (Celsius)'}, +// 1: {title: 'Daylight'} +//} + + @Override + public ChartOptions addDualAxisOptions(ChartOptions parent, + String[] axisNames, String[] seriesMapping, String[] axisTitles, + OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers) { + HashMap axisNoMap = new HashMap<>(); + ChartOptions vAxesOpts = new ChartOptions(); + int axNo = 0; + for (String axisName : axisNames) { + axisNoMap.put(axisName, axNo); + ChartOptions axisOpts = new ChartOptions(); + axisOpts.put("title", axisTitles[axNo]); + if(axisModifiers!= null && axisModifiers[axNo]!= null){ + axisModifiers[axNo].modify(axisOpts); + } + vAxesOpts.put(String.valueOf(axNo++), axisOpts); + } + parent.put("vAxes", vAxesOpts); + + ChartOptions seriesOpt = new ChartOptions(); + int serNo = 0; + for (String seriesMap : seriesMapping) { + ChartOptions mapOpt = new ChartOptions(); + mapOpt.put("targetAxisIndex", axisNoMap.get(seriesMap)); + if(seriesModifiers!= null && seriesModifiers[serNo]!= null){ + seriesModifiers[serNo].modify(mapOpt); + } + seriesOpt.put(String.valueOf(serNo++), mapOpt); + } + parent.put("series", seriesOpt); + return parent; + } +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/MaterialOptionHelper.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/MaterialOptionHelper.java new file mode 100644 index 0000000000..6183819806 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/MaterialOptionHelper.java @@ -0,0 +1,93 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options; + +import org.wicketstuff.gchart.Chart; +import org.apache.wicket.model.IModel; + +/** + * Implementation of {@link OptionHelper} for Material Charts. + * + * @author Dieter Tremel + */ +public class MaterialOptionHelper extends AbstractOptionHelper { + + public MaterialOptionHelper(Chart chart) { + super(chart); + } + + @Override + public ChartOptions addTitle(ChartOptions parent, String title) { + ChartOptions chartOpt = new ChartOptions(); + chartOpt.put("title", title); + parent.put("chart", chartOpt); + return parent; + } + + @Override + public ChartOptions addTitle(ChartOptions parent, IModel titleModel) { + ChartOptions chartOpt = new ChartOptions(); + chartOpt.put("title", titleModel); + parent.put("chart", chartOpt); + return parent; + } + + @Override + public ChartOptions addSubTitle(ChartOptions parent, String subTitle) { + ChartOptions chartOpt = new ChartOptions(); + chartOpt.put("subtitle", subTitle); + parent.put("chart", chartOpt); + return parent; + } + + @Override + public ChartOptions addSubTitle(ChartOptions parent, IModel subTitleModel) { + ChartOptions chartOpt = new ChartOptions(); + chartOpt.put("subtitle", subTitleModel); + parent.put("chart", chartOpt); + return parent; + } + + @Override + public ChartOptions addDualAxisOptions(ChartOptions parent, + String[] axisNames, String[] seriesMapping, String[] axisTitles, + OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers) { + ChartOptions axesOpt = new ChartOptions(); + ChartOptions yOpt = new ChartOptions(); + int axNo = 0; + for (String axisName : axisNames) { + ChartOptions lblOpt = new ChartOptions(); + lblOpt.put("label", axisTitles[axNo++]); + yOpt.put(axisName, lblOpt); + if (axisModifiers != null && axisModifiers[axNo] != null) { + axisModifiers[axNo].modify(yOpt); + } + } + axesOpt.put("y", yOpt); + parent.put("axes", axesOpt); + + ChartOptions seriesOpt = new ChartOptions(); + int i = 0; + for (String seriesMap : seriesMapping) { + ChartOptions mapOpt = new ChartOptions(); + mapOpt.put("axis", seriesMap); + if (seriesModifiers != null && seriesModifiers[i] != null) { + seriesModifiers[i].modify(seriesOpt); + } + seriesOpt.put(String.valueOf(i++), mapOpt); + } + parent.put("series", seriesOpt); + return parent; + } +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/OptionHelper.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/OptionHelper.java new file mode 100644 index 0000000000..c8d1d75964 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/OptionHelper.java @@ -0,0 +1,177 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options; + +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.ResourceModel; +import org.wicketstuff.gchart.Chart; + +/** + * Utility methods to generate more complex constructs in {@link ChartOptions}. + * Also two implementations ({@link ClassicOptionHelper} and + * {@link MaterialOptionHelper}) can be used for convenient building of + * different option structure just by changing the implementation of this + * interface. + * + * Also used to generate ResourceModels according to a convention for the keys. + * Implementations should call {@link ResourceModel#wrapOnAssignment(org.apache.wicket.Component) + * } with the {@link Chart} component as wrapper. + * + * @author Dieter Tremel + */ +public interface OptionHelper { + + /** + * Generate the base resource key for the chart. By convention this is build + * from the id of the Chart Component. Eg. if Chart id is {@code "myChart"} + * the result should be {@code "chart.myChart."}. + * + * @return Base resource key of chart in form + * {@code "chart.."}. Note the trailing dot. + */ + public String getChartBaseResourceKey(); + + /** + * Generate a wrapped ResourceModel for the {@link Chart} component. + * + * @param subKey Subkey as suffix of {@link #getChartBaseResourceKey() }. + * @return ResourceModel for the complete key. There is no default defined, + * so missing properties can be easyly detected. + */ + public IModel getChartLabelResourceModel(String subKey); + + /** + * Add a title of the chart to the root of ChartOptions. Use ResourceModel + * for the label text. The title handling is different for Material and + * Classic charts, so this convenient methods are written. + * + * @param parent Root ChartOptions to add title to. + * @return Parent for fluent calling. + */ + public ChartOptions addTitle(ChartOptions parent); + + /** + * Add a title of the chart to the root of ChartOptions. + * + * @param parent Root ChartOptions to add title to. + * @param title String to use for the title. + * @return Parent for fluent calling. + */ + public ChartOptions addTitle(ChartOptions parent, String title); + + /** + * Add a title of the chart to the root of ChartOptions. + * + * @param parent Root ChartOptions to add title to. + * @param titleModel Model to use for the title. + * @return Parent for fluent calling. + */ + public ChartOptions addTitle(ChartOptions parent, IModel titleModel); + /** + * Add a subTitle of the chart to the root of ChartOptions. Use ResourceModel + * for the label text. The subTitle handling is different for Material and + * Classic charts, so this convenient methods are written. + * + * @param parent Root ChartOptions to add subTitle to. + * @return Parent for fluent calling. + */ + public ChartOptions addSubTitle(ChartOptions parent); + + /** + * Add a subTitle of the chart to the root of ChartOptions. + * + * @param parent Root ChartOptions to add subTitle to. + * @param subTitle String to use for the subTitle. + * @return Parent for fluent calling. + */ + public ChartOptions addSubTitle(ChartOptions parent, String subTitle); + + /** + * Add a subTitle of the chart to the root of ChartOptions. + * + * @param parent Root ChartOptions to add subTitle to. + * @param subTitleModel Model to use for the subTitle. + * @return Parent for fluent calling. + */ + public ChartOptions addSubTitle(ChartOptions parent, IModel subTitleModel); + + /** + * Add a definition of dual axis to the root of ChartOptions. Use + * ResourceModels with key convention for labeling axis. + * + * @param parent Root ChartOptions to add title to. + * @param axisNames Names of the axis. + * @param seriesMapping Map each serie in order to an axis by the axis name. + * @return Parent for fluent calling. + */ + public ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping); + + /** + * Add a definition of dual axis to the root of ChartOptions. Use + * ResourceModels with key convention for labeling axis. + * + * @param parent Root ChartOptions to add title to. + * @param axisNames Names of the axis. + * @param seriesMapping Map each serie in order to an axis by the axis name. + * @param axisModifiers Modifiers for the axis definitions. Can be used to + * add options to each axis. Set to {@code null} if no modification is + * necessary at all. Set position in array to {@code null} if to + * modification is needed for the particular axis. + * @param seriesModifiers Modifiers for the series definitions. Can be used + * to add options to each series. Set to {@code null} if no modification is + * necessary at all. Set position in array to {@code null} if to + * modification is needed for the particular series. + * @return Parent for fluent calling. + */ + public ChartOptions addDualAxisOptions(ChartOptions parent, + String[] axisNames, String[] seriesMapping, + OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers); + + /** + * Add a definition of dual axis to the root of ChartOptions. Use explicit + * axis titles for labeling axis. + * + * @param parent Root ChartOptions to add title to. + * @param axisNames Names of the axis. + * @param seriesMapping Map each serie in order to an axis by the axis name. + * @param axisTitles Display titles (labels) used for the titles axis. Must + * have same order and count as {@code axisNames}. + * @return Parent for fluent calling. + */ + public ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, String[] axisTitles); + + /** + * Add a definition of dual axis to the root of ChartOptions. Use explicit + * axis titles for labeling axis. + * + * @param parent Root ChartOptions to add title to. + * @param axisNames Names of the axis. + * @param seriesMapping Map each serie in order to an axis by the axis name. + * @param axisTitles Display titles (labels) used for the titles axis. Must + * have same order and count as {@code axisNames}. + * @param axisModifiers Modifiers for the axis definitions. Can be used to + * add options to each axis. Set to {@code null} if no modification is + * necessary at all. Set position in array to {@code null} if to + * modification is needed for the particular axis. + * @param seriesModifiers Modifiers for the series definitions. Can be used + * to add options to each series. Set to {@code null} if no modification is + * necessary at all. Set position in array to {@code null} if to + * modification is needed for the particular series. Set to {@code null} if + * no modification needed. + * @return Parent for fluent calling. + */ + public ChartOptions addDualAxisOptions(ChartOptions parent, + String[] axisNames, String[] seriesMapping, String[] axisTitles, + OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers); +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/OptionModifier.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/OptionModifier.java new file mode 100644 index 0000000000..b039717fd9 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/OptionModifier.java @@ -0,0 +1,31 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options; + +/** + * Interface for a callback, that modifies a ChartOption. + * Used for {@link OptionHelper} to modify {@link ChartOptions} that are created within a + * deeper structure without diving into the structure. + * + * @author Dieter Tremel + */ +public interface OptionModifier { + + /** + * Do modifications on the options node. + * + * @param options Options node to modify. + */ + public void modify(ChartOptions options); +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/builder/ClassicOptionBuilder.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/builder/ClassicOptionBuilder.java new file mode 100644 index 0000000000..ca9c6f5ca0 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/builder/ClassicOptionBuilder.java @@ -0,0 +1,86 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options.builder; + +import org.wicketstuff.gchart.Chart; +import org.wicketstuff.gchart.gchart.options.ChartOptions; +import java.util.HashMap; +import java.util.Map; +import org.apache.wicket.model.IModel; + +/** + * + * @author Dieter Tremel + */ +public class ClassicOptionBuilder extends OptionBuilder { + + public ClassicOptionBuilder(Chart chart) { + super(chart); + } + +//series: { +// 0: {targetAxisIndex: 0}, +// 1: {targetAxisIndex: 1} +//}, +//vAxes: { +// // Adds titles to each axis. +// 0: {title: 'Temps (Celsius)'}, +// 1: {title: 'Daylight'} +//} + @Override + public ChartOptions build() { + ChartOptions options = new ChartOptions(); + + if (titleModel != null) { + options.put("title", titleModel); + } + // no subtitle in classic chart +// if (subTitleModel != null) { +// options.put("subTitle", subTitleModel); +// } + + HashMap axisNoMap = new HashMap<>(); + ChartOptions vAxes = new ChartOptions(); + int axNo = 0; + for (Map.Entry> entry : axisMap.entrySet()) { + axisNoMap.put(entry.getKey(), axNo); + final ChartOptions axisOpt = new ChartOptions(); + axisOpt.put("title", entry.getValue()); + if (axisModifierMap.containsKey(entry.getKey())) { + axisModifierMap.get(entry.getKey()).modify(axisOpt); + } + vAxes.put(String.valueOf(axNo++), axisOpt); + } + if (!vAxes.isEmpty()) { + options.put("vAxes", vAxes); + } + + int serNo = 0; + ChartOptions seriesOpts = new ChartOptions(); + for (SeriesDeclaration ser : series) { + ChartOptions mapOpt = new ChartOptions(); + mapOpt.put("targetAxisIndex", axisNoMap.get(ser.getAxisName())); + if (ser.hasModifier()) { + ser.getModifier().modify(mapOpt); + } + seriesOpts.put(String.valueOf(serNo++), mapOpt); + } + if (!seriesOpts.isEmpty()) { + options.put("series", seriesOpts); + } + + return options; + } + +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/builder/IOptionBuilder.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/builder/IOptionBuilder.java new file mode 100644 index 0000000000..be8c228893 --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/builder/IOptionBuilder.java @@ -0,0 +1,165 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options.builder; + +import org.wicketstuff.gchart.gchart.options.ChartOptions; +import org.wicketstuff.gchart.gchart.options.OptionModifier; +import org.apache.wicket.model.IModel; +import org.wicketstuff.gchart.Chart; + +/** + * + * @author Dieter Tremel + */ +public interface IOptionBuilder { + + /** + * Helper function to build resource base key for a chart and it's id + * according to a convention. This should be used as left part for all keys + * for i18n of charts. Takes the chart id from the chart field. + * + * @return Base key with trailing dot, eg. {@code "Chart.myChart."} if param + * is {@code "myChart"}. + */ + public String getChartBaseResourceKey(); + + /** + * Generate a wrapped ResourceModel for the {@link Chart} component. + * + * @param subKey Subkey as suffix of {@link #getChartBaseResourceKey() }. + * @return ResourceModel for the complete key. There is no default defined, + * so missing properties can be easyly detected. + */ + public IModel getChartLabelResourceModel(String subKey); + + /** + * Add a title of the chart from i18n. The key of the ResourceModel is + * constructed by convention. + * + * @return IOptionbuilder for fluent api. + * @see OptionBuilder#getChartBaseResourceKey(java.lang.String) + * @see IOptionBuilder#getChartBaseResourceKey() + */ + public IOptionBuilder title(); + + /** + * Add a title of the chart direct from String. Convenient function to wrap + * String in a model. + * + * @param title Text of title. + * @return IOptionbuilder for fluent api. + */ + public IOptionBuilder title(String title); + + /** + * Give the model for the title of the chart. + * + * @param titleModel Model for title. + * @return IOptionbuilder for fluent api. + */ + public IOptionBuilder title(IModel titleModel); + + /** + * Add a subTitle of the chart from i18n. The key of the ResourceModel is + * constructed by convention. + * + * @return IOptionbuilder for fluent api. + * @see OptionBuilder#getChartBaseResourceKey(java.lang.String) + * @see IOptionBuilder#getChartBaseResourceKey() + */ + public IOptionBuilder subTitle(); + + /** + * Add a subTitle of the chart direct from String. Convenient function to wrap + * String in a model. + * + * @param subTitle Text of subTitle. + * @return IOptionbuilder for fluent api. + */ + public IOptionBuilder subTitle(String subTitle); + + /** + * Give the model for the subTitle of the chart. + * + * @param subTitleModel Model for subTitle. + * @return IOptionbuilder for fluent api. + */ + public IOptionBuilder subTitle(IModel subTitleModel); + + /** + * Add a axis with a title from i18n. The key of the ResourceModel is + * constructed by convention by + * {@link IOptionBuilder#getChartBaseResourceKey()} + {@code "axis.name.title"}. + * + * @param name Uniq name for the axis. + * @return IOptionbuilder for fluent api. + * @see OptionBuilder#getChartBaseResourceKey(java.lang.String) + * @see IOptionBuilder#getChartBaseResourceKey() + */ + public IOptionBuilder axis(String name); + + /** + * Add a axis title direct from String. Convenient function to wrap String + * in a model. + * + * @param name Uniq name for the axis. + * @param title Text of title. + * @return IOptionbuilder for fluent api. + */ + public IOptionBuilder axis(String name, String title); + + /** + * Add a axis, give the model for the title of the axis. + * + * @param name Uniq name for the axis. + * @param titleModel Model for title. + * @return IOptionbuilder for fluent api. + */ + public IOptionBuilder axis(String name, IModel titleModel); + + /** + * Add a modifier to configure options for the axis. + * + * @param name Name to refer to an axis. + * @param axisModifier Modifier to handle axis options. + * @return IOptionbuilder for fluent api. + */ + public IOptionBuilder modifyAxis(String name, OptionModifier axisModifier); + + /** + * Map a serie to an axis by the axisname. + * + * @param axisName Name of a previous defined axis. + * @return IOptionbuilder for fluent api. + */ + public IOptionBuilder mapSeries(String axisName); + + /** + * Map a serie to an axis by the axisname. Aply a modifier to the options of + * this series. + * + * @param axisName Name of a previous defined axis. + * @param seriesModifier Modifierer for the opts of this series. + * @return IOptionbuilder for fluent api. + */ + public IOptionBuilder mapSeries(String axisName, OptionModifier seriesModifier); + + /** + * Return the ChartOptions defined by previous fluent calls. + * + * @return ChartOptions as defined. + */ + public ChartOptions build(); + +} diff --git a/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/builder/OptionBuilder.java b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/builder/OptionBuilder.java new file mode 100644 index 0000000000..30420209ff --- /dev/null +++ b/gchart-parent/gchart/src/main/java/org/wicketstuff/gchart/gchart/options/builder/OptionBuilder.java @@ -0,0 +1,197 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options.builder; + +import org.wicketstuff.gchart.Chart; +import org.wicketstuff.gchart.gchart.options.OptionModifier; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.ResourceModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Dieter Tremel + */ +public abstract class OptionBuilder implements IOptionBuilder { + + private static final Logger log = LoggerFactory.getLogger(OptionBuilder.class); + protected Chart chart; + + protected IModel titleModel; + protected IModel subTitleModel; + protected Map> axisMap = new LinkedHashMap<>(); + protected Map axisModifierMap = new HashMap<>(); + List series = new ArrayList<>(); + + protected OptionBuilder(Chart chart) { + this.chart = chart; + } + + public static ClassicOptionBuilder classic(Chart chart) { + return new ClassicOptionBuilder(chart); + } + + /** + * Helper function to build resource base key for a chart and it's id + * according to a convention. This should be used as left part for all keys + * for i18n of charts. + * + * @param chartId Wicket id of Chart. + * @return Base key with trailing dot, eg. {@code "Chart.myChart."} if param + * is {@code "myChart"}. + */ + public static String getChartBaseResourceKey(String chartId) { + return "chart." + chartId + "."; + } + + @Override + public String getChartBaseResourceKey() { + return getChartBaseResourceKey(chart.getId()); + } + + @Override + public IModel getChartLabelResourceModel(String subKey) { + ResourceModel resourceModel = new ResourceModel(getChartBaseResourceKey() + subKey); + return resourceModel.wrapOnAssignment(chart); + } + + @Override + public IOptionBuilder title() { + this.titleModel = getChartLabelResourceModel("title"); + return this; + } + + @Override + public IOptionBuilder title(String title) { + this.titleModel = Model.of(title); + return this; + } + + @Override + public IOptionBuilder title(IModel titleModel) { + this.titleModel = titleModel; + return this; + } + + @Override + public IOptionBuilder subTitle() { + this.subTitleModel = getChartLabelResourceModel("subTitle"); + return this; + } + + @Override + public IOptionBuilder subTitle(String subTitle) { + this.subTitleModel = Model.of(subTitle); + return this; + } + + @Override + public IOptionBuilder subTitle(IModel subTitleModel) { + this.subTitleModel = subTitleModel; + return this; + } + + @Override + public IOptionBuilder axis(String name) { + axisMap.put(name, getChartLabelResourceModel("axis." + name + ".title")); + return this; + } + + @Override + public IOptionBuilder axis(String name, String title) { + axisMap.put(name, Model.of(title)); + return this; + } + + @Override + public IOptionBuilder axis(String name, IModel titleModel) { + axisMap.put(name, titleModel); + return this; + } + + @Override + public IOptionBuilder modifyAxis(String name, OptionModifier axisModifier) { + if (!axisMap.containsKey(name)) { + log.warn("Adding a modfier for an axis that is not yet defined."); + } + axisModifierMap.put(name, axisModifier); + return this; + } + + @Override + public IOptionBuilder mapSeries(String axisName) { + series.add(new SeriesDeclaration(axisName)); + return this; + } + + @Override + public IOptionBuilder mapSeries(String axisName, OptionModifier seriesModifier) { + series.add(new SeriesDeclaration(axisName, seriesModifier)); + return this; + } + + /** + * Class for a record of sieries axis mapping and associated OptionModifier. + */ + protected class SeriesDeclaration { + + private final String axisName; + private final OptionModifier modifier; + + /** + * Declares a series without modifier. + * + * @param axisName Name of axis to map to. + */ + public SeriesDeclaration(String axisName) { + this.axisName = axisName; + modifier = null; + } + + /** + * Declares a series with modifier. + * + * @param axisName Name of axis to map to. + * @param modifier Modifier to apply to the sieries' options. + */ + public SeriesDeclaration(String axisName, OptionModifier modifier) { + this.axisName = axisName; + this.modifier = modifier; + } + + public String getAxisName() { + return axisName; + } + + public OptionModifier getModifier() { + return modifier; + } + + /** + * Calc if there is a modifier defined. + * + * @return True if an modifiere exists for this mapping. + */ + public boolean hasModifier() { + return modifier != null; + } + } +} diff --git a/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/ChartLibLoaderBehaviorTest.java b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/ChartLibLoaderBehaviorTest.java new file mode 100644 index 0000000000..99eab3972e --- /dev/null +++ b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/ChartLibLoaderBehaviorTest.java @@ -0,0 +1,137 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart; + +import org.wicketstuff.gchart.Chart; +import org.wicketstuff.gchart.ChartType; + +import net.javacrumbs.jsonunit.JsonAssert; + +import org.wicketstuff.gchart.ChartLibLoaderBehavior; +import java.util.List; +import java.util.Locale; + +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.model.Model; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static net.javacrumbs.jsonunit.JsonAssert.*; +import static net.javacrumbs.jsonunit.core.Option.*; +/** + * + * @author Dieter Tremel + */ +public class ChartLibLoaderBehaviorTest { + private final Chart chart1; + private final Chart chart2; + private final WebPage page; + + private static String JSON_PREFIX = "google.charts.load('current', "; + private static String JSON_SUFIX = ");\n"; + + public ChartLibLoaderBehaviorTest() { + page = mock(WebPage.class); + when(page.getLocale()).thenReturn(Locale.getDefault()); + chart1 = mock(Chart.class); + when(chart1.getTypeModel()).thenReturn(Model.of(ChartType.AREA)); + chart2 = mock(Chart.class); + when(chart2.getTypeModel()).thenReturn(Model.of(ChartType.CALENDAR)); + } + + @Before + public void setUp() { + } + + /** + * Test of addChart method, of class ChartLibLoaderBehavior. + */ + @Test + public void testAddChart() { + ChartLibLoaderBehavior loader = new ChartLibLoaderBehavior(); + assertTrue(loader.addChart(chart1)); + assertTrue(loader.addChart(chart2)); + } + + /** + * Test of removeChart method, of class ChartLibLoaderBehavior. + */ + @Test + public void testRemoveChart() { + ChartLibLoaderBehavior loader = new ChartLibLoaderBehavior(); + assertTrue(loader.addChart(chart1)); +// assertTrue(loader.addChart(chart2)); + assertTrue(loader.removeChart(chart1)); + assertFalse(loader.removeChart(chart2)); + } + + /** + * Test of getLocale method, of class ChartLibLoaderBehavior. + */ + @Test + public void testGetLocale() { + ChartLibLoaderBehavior instance = new ChartLibLoaderBehavior(); + instance.bind(page); + Locale expResult = Locale.getDefault(); + Locale result = instance.getLocale(); + assertEquals(expResult, result); + } + + /** + * Test of setLocale method, of class ChartLibLoaderBehavior. + */ + @Test + public void testSetLocale() { + Locale locale = Locale.ITALIAN; + ChartLibLoaderBehavior instance = new ChartLibLoaderBehavior(); + instance.setLocale(locale); + assertEquals(locale, instance.getLocale()); + } + + /** + * Test of getCharts method, of class ChartLibLoaderBehavior. + */ + @Test + public void testGetCharts() { + ChartLibLoaderBehavior loader = new ChartLibLoaderBehavior(); + assertTrue(loader.addChart(chart1)); + assertTrue(loader.addChart(chart2)); + List result = loader.getCharts(); + assertEquals(2, result.size()); + } + + /** + * Test of toJavaScript method, of class ChartLibLoaderBehavior. + */ + @Test + public void testToJavaScript() { + ChartLibLoaderBehavior loader = new ChartLibLoaderBehavior(); + loader.bind(page); + assertTrue(loader.addChart(chart1)); + assertTrue(loader.addChart(chart2)); + + Locale currentLocale = Locale.getDefault(); + String expResult = "{\"packages\":[\"corechart\",\"calendar\"],\"language\":\"" + currentLocale.getLanguage() +"\"}"; + String resultJs = loader.toJavaScript(); + + assertTrue(resultJs.startsWith(JSON_PREFIX)); + assertTrue(resultJs.endsWith(JSON_SUFIX)); + + String resJson = resultJs.substring(resultJs.indexOf('{'), resultJs.indexOf('}') + 1); + + assertJsonEquals(expResult, resJson, JsonAssert.when(IGNORING_ARRAY_ORDER)); + } +} diff --git a/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/ChartTypeTest.java b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/ChartTypeTest.java new file mode 100644 index 0000000000..35dd5abc08 --- /dev/null +++ b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/ChartTypeTest.java @@ -0,0 +1,38 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart; + +import org.wicketstuff.gchart.ChartType; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author Dieter Tremel + */ +public class ChartTypeTest { + + + /** + * Test of toJavaScript method, of class ChartType. + */ + @Test + public void testToJavaScript() { + ChartType instance = ChartType.BUBBLE; + String expResult = "google.visualization." + "BubbleChart"; + String result = instance.toJavaScript(); + assertEquals(expResult, result); + } + +} diff --git a/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/DataCellTest.java b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/DataCellTest.java new file mode 100644 index 0000000000..dd2eb448eb --- /dev/null +++ b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/DataCellTest.java @@ -0,0 +1,77 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart; + +import org.wicketstuff.gchart.TimeOfDay; +import org.wicketstuff.gchart.DataCell; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author Dieter Tremel + */ +public class DataCellTest { + + public DataCellTest() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + /** + * Test of toJSON method, of class DataCell. + */ + @Test + public void testToJSON() { + DataCell instance = new DataCell(2.6, "2.60"); + instance.getProperties().put("style", "color: blue;"); + String expResult = "{\"v\":2.6,\"f\":\"2.60\",\"p\":{\"style\":\"color: blue;\"}}"; + String result = instance.toJSON().toString(); + assertEquals(expResult, result); + + GregorianCalendar cal = new GregorianCalendar(2017, 6, 20, 10, 31, 20); + cal.setTimeZone(TimeZone.getTimeZone("GMT+2")); + instance = new DataCell(cal); + expResult = "{\"v\":new Date(1500539480000)}"; + result = instance.toJSON().toString(); + assertEquals(expResult, result); + + instance = new DataCell(cal.getTime()); + expResult = "{\"v\":new Date(1500539480000)}"; + result = instance.toJSON().toString(); + assertEquals(expResult, result); + + instance = new DataCell(true); + expResult = "{\"v\":\"true\"}"; + result = instance.toJSON().toString(); + assertEquals(expResult, result); + + instance = new DataCell(new TimeOfDay(20, 15, 14)); + expResult = "{\"v\":[20,15,14]}"; + result = instance.toJSON().toString(); + assertEquals(expResult, result); + } + +} diff --git a/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/DataTableTest.java b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/DataTableTest.java new file mode 100644 index 0000000000..36b62206c2 --- /dev/null +++ b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/DataTableTest.java @@ -0,0 +1,90 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart; + +import org.wicketstuff.gchart.DataTable; +import org.wicketstuff.gchart.ColumnType; +import org.wicketstuff.gchart.DataRow; +import org.wicketstuff.gchart.ColumnDeclaration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author Dieter Tremel + */ +public class DataTableTest { + + private List colDefs; + private List rows; + + public DataTableTest() { + } + + @Before + public void setUp() { + colDefs = new ArrayList<>(2); + colDefs.add(new ColumnDeclaration(ColumnType.STRING, "Topping")); + colDefs.add(new ColumnDeclaration(ColumnType.NUMBER, "Slices")); + + rows = new ArrayList<>(5); + rows.add(new DataRow(Arrays.asList(new Object[]{"Mushrooms", 3}))); + rows.add(new DataRow(Arrays.asList(new Object[]{"Onions", 1}))); + rows.add(new DataRow(Arrays.asList(new Object[]{"Olives", 1}))); + rows.add(new DataRow(Arrays.asList(new Object[]{"Zucchini", 1}))); + rows.add(new DataRow(Arrays.asList(new Object[]{"Pepperoni", 2}))); + } + + @After + public void tearDown() { + } + + /** + * Test of toJavaScript method, of class DataTable. + */ + @Test + public void testToJavaScript() { + DataTable tbl = new DataTable("data", colDefs, rows); + String expResult1 = "var data = new google.visualization.DataTable({\"cols\":[{\"label\":\"Topping\",\"type\":\"string\"},{\"label\":\"Slices\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"Mushrooms\"},{\"v\":3}]},{\"c\":[{\"v\":\"Onions\"},{\"v\":1}]},{\"c\":[{\"v\":\"Olives\"},{\"v\":1}]},{\"c\":[{\"v\":\"Zucchini\"},{\"v\":1}]},{\"c\":[{\"v\":\"Pepperoni\"},{\"v\":2}]}]})\n"; + String result = tbl.toJavaScript(); +// System.out.println(result); + assertEquals(expResult1, result); + } + + /** + * Test of fromArray method, of class DataTable. + */ + @Test + public void testFromArray() { + Object[][] data = new Object[][]{{"Zeile 1", 1},{"Zeile 2", 2, "Zusatz"}}; + List expResult = new ArrayList<>(2); + DataRow row1 = new DataRow(); + DataRow row2 = new DataRow(); + expResult.add(row1); + expResult.add(row2); + row1.add("Zeile 1"); + row1.add(1); + row2.add("Zeile 2"); + row2.add(2); + row2.add("Zusatz"); + List result = DataTable.fromArray(data); + assertEquals(expResult, result); + } + +} diff --git a/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/AbstractOptionHelperTest.java b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/AbstractOptionHelperTest.java new file mode 100644 index 0000000000..890236b8e9 --- /dev/null +++ b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/AbstractOptionHelperTest.java @@ -0,0 +1,118 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options; + +import org.wicketstuff.gchart.Chart; +import org.apache.wicket.model.IModel; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +/** + * + * @author Dieter Tremel + */ +public class AbstractOptionHelperTest { + private Chart chart; + + public AbstractOptionHelperTest() { + chart = mock(Chart.class); + when(chart.getId()).thenReturn("myChart"); + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + /** + * Test of getChartBaseResourceKey method, of class AbstractOptionHelper. + */ + @Test + public void testGetChartBaseResourceKey() { + AbstractOptionHelper instance = new AbstractOptionHelperImpl(chart); + String expResult = "chart.myChart."; + String result = instance.getChartBaseResourceKey(); + assertEquals(expResult, result); + } + + /** + * Test of getChartLabelResourceModel method, of class AbstractOptionHelper. + */ +// @Test +// public void testGetChartResourceModel() { +// System.out.println("getChartLabelResourceModel"); +// String subKey = "title"; +// AbstractOptionHelper instance = new AbstractOptionHelperImpl(chart); +// ResourceModel expResult = "chart.myChart.title"; +// ResourceModel result = instance.getChartLabelResourceModel(subKey); +// assertEquals(expResult, result); +// } + + public class AbstractOptionHelperImpl extends AbstractOptionHelper { + + public AbstractOptionHelperImpl(Chart chart) { + super(chart); + } + + + @Override + public ChartOptions addTitle(ChartOptions parent) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public ChartOptions addTitle(ChartOptions parent, String title) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, String[] axisTitles) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, String[] axisTitles, OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public ChartOptions addTitle(ChartOptions parent, IModel titleModel) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public ChartOptions addSubTitle(ChartOptions parent, String subTitle) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public ChartOptions addSubTitle(ChartOptions parent, IModel subTitleModel) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + } + +} diff --git a/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/ChartOptionsTest.java b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/ChartOptionsTest.java new file mode 100644 index 0000000000..9009295749 --- /dev/null +++ b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/ChartOptionsTest.java @@ -0,0 +1,117 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options; + +import org.apache.wicket.ajax.json.JSONObject; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; +import static net.javacrumbs.jsonunit.JsonAssert.*; + + +/** + * + * @author Dieter Tremel + */ +public class ChartOptionsTest { + + public ChartOptionsTest() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + /** + * Test of getName method, of class ChartOptions. + */ + @Test + public void testGetName() { + ChartOptions instance = new ChartOptions("fred"); + String expResult = "fred"; + String result = instance.getName(); + assertEquals(expResult, result); + } + + /** + * Test of toJavaScript method, of class ChartOptions. + */ + @Test + public void testToJavaScript() { + String varPrefix = "var options = "; + + ChartOptions opts = new ChartOptions("options"); + opts.put("title", "How Much Pizza I Ate Last Night"); + opts.put("width", 400); + opts.put("height", 300); + + String expResult = "var options = {\"width\":400,\"title\":\"How Much Pizza I Ate Last Night\",\"height\":300};\n"; + String result = opts.toJavaScript(); + + assertTrue(result.startsWith(varPrefix)); + assertJsonEquals(expResult.replace(varPrefix, "").replace(';', '\n'), + result.replaceAll(varPrefix, "").replace(';', '\n')); + } + + /** + * Test of fromJson method, of class ChartOptions. + */ + @Test + public void testFromJson_String() { + String json = "{'title':'Header'}"; + ChartOptions expResult = new ChartOptions(); + expResult.put("title", "Header"); + ChartOptions result = ChartOptions.fromJson(json); + assertEquals(expResult, result); + } + + /** + * Test of fromJson method, of class ChartOptions. + */ + @Test + public void testFromJson_JSONObject() { + JSONObject json = new JSONObject("{'title':'Header',hAxis: { ticks: [5,10,15,20] }}"); + ChartOptions result = ChartOptions.fromJson(json); + assertEquals("[5,10,15,20]", ((ChartOptions) result.get("hAxis")).get("ticks").toString()); + } + + /** + * Test of setName method, of class ChartOptions. + */ + @Test + public void testSetName() { + String name = "fred"; + ChartOptions instance = new ChartOptions(); + instance.setName(name); + assertEquals(name, instance.getName()); + } + + /** + * Test of toJSON method, of class ChartOptions. + */ + @Test + public void testToJSON() { + ChartOptions instance = new ChartOptions(); + instance.put("title", "Header"); + JSONObject expResult = new JSONObject("{'title':'Header'}"); + JSONObject result = instance.toJSON(); + assertEquals(expResult.toString(), result.toString()); + } + +} diff --git a/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/ClassicOptionHelperTest.java b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/ClassicOptionHelperTest.java new file mode 100644 index 0000000000..f2716b47ef --- /dev/null +++ b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/ClassicOptionHelperTest.java @@ -0,0 +1,101 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options; + +import org.wicketstuff.gchart.Chart; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static net.javacrumbs.jsonunit.JsonAssert.*; + +/** + * + * @author Dieter Tremel + */ +public class ClassicOptionHelperTest { + + private Chart chart; + + public ClassicOptionHelperTest() { + chart = mock(Chart.class); + when(chart.getId()).thenReturn("myChart"); + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + /** + * Test of addTitle method, of class ClassicOptionHelper. + */ + @Test + public void testAddTitleOption() { + ChartOptions parent = new ChartOptions(); + ClassicOptionHelper instance = new ClassicOptionHelper(chart); + String expResult = "{\"title\":\"Chart Title\"}"; + ChartOptions result = instance.addTitle(parent, "Chart Title"); + assertJsonEquals(expResult, result.toJSON().toString()); + } + + /** + * Test of addDualAxisOptions method, of class ClassicOptionHelper. + */ + @Test + public void testAddDualAxisOptions() { + ChartOptions parent = new ChartOptions(); + ClassicOptionHelper instance = new ClassicOptionHelper(chart); + String[] axisNames = {"Temp", "Humidity"}; + String[] seriesMapping = {"Temp", "Temp", "Humidity"}; + String[] axisTitles = {"Temperatur", "Feuchtigkeit"}; + String expResult = "{\"vAxes\":{\"0\":{\"title\":\"Temperatur\"},\"1\":{\"title\":\"Feuchtigkeit\"}},\"series\":{\"0\":{\"targetAxisIndex\":0},\"1\":{\"targetAxisIndex\":0},\"2\":{\"targetAxisIndex\":1}}}"; + ChartOptions result = instance.addDualAxisOptions(parent, axisNames, seriesMapping, axisTitles); + assertJsonEquals(expResult, result.toJSON().toString()); + } + + /** + * Test of addDualAxisOptions method, of class ClassicOptionHelper. + */ + @Test + public void testAddDualAxisOptionsModifier() { + ChartOptions parent = new ChartOptions(); + ClassicOptionHelper instance = new ClassicOptionHelper(chart); + String[] axisNames = {"Temp", "Humidity"}; + String[] seriesMapping = {"Temp", "Temp", "Humidity"}; + String[] axisTitles = {"Temperatur", "Feuchtigkeit"}; + OptionModifier temperatureAxisModifier = new OptionModifier() { + @Override + public void modify(ChartOptions options) { + options.put("format", "percent"); + } + }; + OptionModifier humiditySeriesModifier = new OptionModifier() { + @Override + public void modify(ChartOptions options) { + options.put("lineWidth", 8); + } + }; + String expResult = "{\"vAxes\":{\"0\":{\"format\":\"percent\",\"title\":\"Temperatur\"},\"1\":{\"title\":\"Feuchtigkeit\"}},\"series\":{\"0\":{\"targetAxisIndex\":0},\"1\":{\"targetAxisIndex\":0,\"lineWidth\":8},\"2\":{\"targetAxisIndex\":1}}}"; + ChartOptions result = instance.addDualAxisOptions(parent, + axisNames, seriesMapping, axisTitles, + new OptionModifier[]{temperatureAxisModifier, null}, new OptionModifier[]{null, humiditySeriesModifier, null}); + assertJsonEquals(expResult, result.toJSON().toString()); + } + +} diff --git a/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/MaterialOptionHelperTest.java b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/MaterialOptionHelperTest.java new file mode 100644 index 0000000000..711be4daec --- /dev/null +++ b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/MaterialOptionHelperTest.java @@ -0,0 +1,73 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options; + +import org.wicketstuff.gchart.Chart; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static net.javacrumbs.jsonunit.JsonAssert.*; + +/** + * + * @author Dieter Tremel + */ +public class MaterialOptionHelperTest { + + private Chart chart; + + public MaterialOptionHelperTest() { + chart = mock(Chart.class); + when(chart.getId()).thenReturn("myChart"); + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + /** + * Test of addTitle method, of class MaterialOptionHelper. + */ + @Test + public void testAddTitleOption() { + ChartOptions parent = new ChartOptions(); + MaterialOptionHelper instance = new MaterialOptionHelper(chart); + String expResult = "{\"chart\":{\"title\":\"Chart Title\"}}"; + ChartOptions result = instance.addTitle(parent, "Chart Title"); + assertEquals(expResult, result.toJSON().toString()); + } + + /** + * Test of addDualAxisOptions method, of class MaterialOptionHelper. + */ + @Test + public void testAddDualAxisOptions() { + ChartOptions parent = new ChartOptions(); + MaterialOptionHelper instance = new MaterialOptionHelper(chart); + String[] axisNames = {"Temp", "Humidity"}; + String[] seriesMapping = {"Temp", "Temp", "Humidity"}; + String[] axisTitles = {"Temperatur", "Feuchtigkeit"}; + String expResult = "{\"series\":{\"0\":{\"axis\":\"Temp\"},\"1\":{\"axis\":\"Temp\"},\"2\":{\"axis\":\"Humidity\"}},\"axes\":{\"y\":{\"Temp\":{\"label\":\"Temperatur\"},\"Humidity\":{\"label\":\"Feuchtigkeit\"}}}}"; + ChartOptions result = instance.addDualAxisOptions(parent, axisNames, seriesMapping, axisTitles); + assertJsonEquals(expResult, result.toJSON().toString()); + } + +} diff --git a/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/builder/ClassicOptionBuilderTest.java b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/builder/ClassicOptionBuilderTest.java new file mode 100644 index 0000000000..c16579dff4 --- /dev/null +++ b/gchart-parent/gchart/src/test/java/org/wicketstuff/gchart/gchart/options/builder/ClassicOptionBuilderTest.java @@ -0,0 +1,98 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.gchart.gchart.options.builder; + +import org.wicketstuff.gchart.Chart; +import org.wicketstuff.gchart.gchart.options.ChartOptions; +import org.wicketstuff.gchart.gchart.options.OptionModifier; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; +import static net.javacrumbs.jsonunit.JsonAssert.*; + +/** + * Test of ClassicOptionBuilder. + * + * @author Dieter Tremel + */ +public class ClassicOptionBuilderTest { + + private Chart chart; + + public ClassicOptionBuilderTest() { + chart = mock(Chart.class); + when(chart.getId()).thenReturn("myChart"); + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + +//series: { +// 0: {targetAxisIndex: 0}, +// 1: {targetAxisIndex: 1} +//}, +//vAxes: { +// // Adds titles to each axis. +// 0: {title: 'Temps (Celsius)'}, +// 1: {title: 'Daylight'} +//} + /** + * Test of build method, of class ClassicOptionBuilder. + */ + @Test + public void testBuild() { + ClassicOptionBuilder builder = OptionBuilder.classic(chart); + + builder.title("My first Chart"); + + ChartOptions expResult = new ChartOptions(); + expResult.put("title", "My first Chart"); + + ChartOptions result = builder.build(); + + assertNotEquals(expResult, result); + assertJsonEquals(expResult.toJSON().toString(), result.toJSON().toString()); + + // add axis and series + builder.axis("TEMP", "Temps (Celsius)").axis("DAYLIGHT", "Daylight"); + builder.modifyAxis("TEMP", new OptionModifier() { + @Override + public void modify(ChartOptions options) { + ChartOptions textStyle = new ChartOptions(); + textStyle.put("color", "red"); + options.put("textStyle", textStyle); + } + }); + + builder.mapSeries("TEMP").mapSeries("DAYLIGHT", new OptionModifier() { + @Override + public void modify(ChartOptions options) { + options.put("color", "yellow"); + } + }); + result = builder.build(); +// System.out.println(result.toJSON().toString()); + assertJsonEquals("{\"vAxes\":{\"0\":{\"textStyle\":{\"color\":\"red\"},\"title\":\"Temps (Celsius)\"},\"1\":{\"title\":\"Daylight\"}},\"series\":{\"0\":{\"targetAxisIndex\":0},\"1\":{\"color\":\"yellow\",\"targetAxisIndex\":1}},\"title\":\"My first Chart\"}", + result.toJSON().toString()); + + } + +} diff --git a/gchart-parent/pom.xml b/gchart-parent/pom.xml new file mode 100644 index 0000000000..5248694d0f --- /dev/null +++ b/gchart-parent/pom.xml @@ -0,0 +1,27 @@ + + + + 4.0.0 + + + org.wicketstuff + wicketstuff-core + 7.0-SNAPSHOT + + + wicket-gchart-parent + pom + + Wicket Google Charts - Parent + + wicket-gchart is a component to use Google Charts in your Wicket application. + It is written for the v45 API based on https://www.gstatic.com/charts/loader.js, + whereas googlecharts from wicketstuff is based on the old deprecated Image Charts API. + + + + gchart + gchart-examples + + + diff --git a/gmap3-parent/gmap3-examples/pom.xml b/gmap3-parent/gmap3-examples/pom.xml index de03571c75..d5f2b3768c 100644 --- a/gmap3-parent/gmap3-examples/pom.xml +++ b/gmap3-parent/gmap3-examples/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff gmap3-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-gmap3-examples diff --git a/gmap3-parent/gmap3/pom.xml b/gmap3-parent/gmap3/pom.xml index 591845d252..115ded4894 100644 --- a/gmap3-parent/gmap3/pom.xml +++ b/gmap3-parent/gmap3/pom.xml @@ -21,7 +21,7 @@ limitations under the License. org.wicketstuff gmap3-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-gmap3 diff --git a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/GMap.java b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/GMap.java index 0af91c2c2b..1628661c55 100644 --- a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/GMap.java +++ b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/GMap.java @@ -75,6 +75,7 @@ public class GMap extends Panel implements GOverlayContainer private GLatLngBounds bounds; private OverlayListener overlayListener = null; private List markersToShow = new ArrayList(); + private boolean jsInitialized = false; /** * If set to true map loading will not produce any JavaScript errors in case @@ -199,6 +200,7 @@ protected void onBeforeRender() public void renderHead(IHeaderResponse response) { response.render(OnDomReadyHeaderItem.forScript(getJSinit())); + jsInitialized = true; } /** @@ -216,7 +218,7 @@ public GMap addOverlay(final GOverlay overlay) overlay.setParent(this); AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(overlay.getJS()); } @@ -241,7 +243,7 @@ public GMap removeOverlay(final GOverlay overlay) } AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(overlay.getJSremove()); } @@ -266,7 +268,7 @@ public GMap removeAllOverlays() } overlays.clear(); AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSinvoke("clearOverlays()")); } @@ -320,7 +322,7 @@ public void setDraggingEnabled(final boolean enabled) draggingEnabled = enabled; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetDraggingEnabled(enabled)); } @@ -348,7 +350,7 @@ public void setDoubleClickZoomEnabled(final boolean enabled) doubleClickZoomEnabled = enabled; AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetDoubleClickZoomEnabled(enabled)); } @@ -377,7 +379,7 @@ public void setScrollWheelZoomEnabled(final boolean enabled) scrollWheelZoomEnabled = enabled; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetScrollWheelZoomEnabled(enabled)); } @@ -417,7 +419,7 @@ public void setStreetViewControlEnabled(boolean enabled) streetViewControlEnabled = enabled; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetStreetViewControlEnabled(enabled)); } @@ -446,7 +448,7 @@ public void setZoomControlEnabled(boolean enabled) this.zoomControlEnabled = enabled; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetZoomControlEnabled(enabled)); } @@ -477,7 +479,7 @@ public void setMapTypeControlEnabled(boolean enabled) this.mapTypeControlEnabled = enabled; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetMapTypeControlEnabled(enabled)); } @@ -506,7 +508,7 @@ public void setScaleControlEnabled(boolean enabled) this.scaleControlEnabled = enabled; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetScaleControlEnabled(enabled)); } @@ -535,7 +537,7 @@ public void setPanControlEnabled(boolean enabled) this.panControlEnabled = enabled; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetPanControlEnabled(enabled)); } @@ -563,7 +565,7 @@ public void setMapType(final GMapType mapType) this.mapType = mapType; AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(mapType.getJSsetMapType(GMap.this)); } @@ -605,7 +607,7 @@ public void setZoom(final int level) this.zoom = level; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetZoom(zoom)); } @@ -623,7 +625,7 @@ public void setMinZoom(final int level) this.minZoom = level >= 0 ? level : 0; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetMinZoom(minZoom)); } @@ -641,7 +643,7 @@ public void setMaxZoom(final int level) this.maxZoom = level >= 0 ? level : 0; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetMaxZoom(maxZoom)); } @@ -669,7 +671,7 @@ public void setCenter(final GLatLng center) this.center = center; AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSsetCenter(center)); } @@ -690,7 +692,7 @@ public void panTo(final GLatLng center) this.center = center; AjaxRequestTarget target = getRequestCycle().find(AjaxRequestTarget.class); - if (target != null && findPage() != null) + if (target != null && findPage() != null && jsInitialized) { target.appendJavaScript(getJSpanTo(center)); } diff --git a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/GMapHeaderContributor.java b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/GMapHeaderContributor.java index c1bb58b3d1..ec41726aa4 100644 --- a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/GMapHeaderContributor.java +++ b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/GMapHeaderContributor.java @@ -94,7 +94,7 @@ public void renderHead(Component component, IHeaderResponse response) String url = String.format(GMAP_API_URL, scheme); if (apiKey != null) { - url = url + "apiKey=" + apiKey; + url = url + "key=" + apiKey; } response.render(JavaScriptHeaderItem.forUrl(url)); } diff --git a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/Geocoder.java b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/Geocoder.java index aa07f7a9c2..f33236212b 100644 --- a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/Geocoder.java +++ b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/Geocoder.java @@ -161,7 +161,7 @@ public GLatLng decode(String response) throws GeocoderException, JSONException { */ public String encode(final String address) { - StringBuilder sb = new StringBuilder("http://maps.googleapis.com/maps/api/geocode/"); + StringBuilder sb = new StringBuilder("https://maps.googleapis.com/maps/api/geocode/"); sb.append(output); sb.append("?"); if (apiKey != null) diff --git a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/GeocoderException.java b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/GeocoderException.java index 20de1af3a6..795715e554 100644 --- a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/GeocoderException.java +++ b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/geocoder/GeocoderException.java @@ -19,7 +19,8 @@ public class GeocoderException extends IOException { - private final GeocoderStatus _status; + private static final long serialVersionUID = 1L; + private final GeocoderStatus _status; public GeocoderException(GeocoderStatus status) { super(status.toString()); diff --git a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/wicket-gmap.js b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/wicket-gmap.js index a0335147ec..22c034e3f1 100644 --- a/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/wicket-gmap.js +++ b/gmap3-parent/gmap3/src/main/java/org/wicketstuff/gmap/wicket-gmap.js @@ -17,7 +17,7 @@ /* * Wicket GMap3 * - * @author Tilman M�ller + * @author Tilman Mueller * @author Joachim F. Rohde */ // Wicket Namespace @@ -84,8 +84,8 @@ function WicketMap(id, failSilently) { params['zoom'] = this.map.getZoom(); params['currentMapType'] = this.getMapTypeString(this.map.getMapTypeId()); - for ( var key in params) { - callBack = callBack + '&' + key + '=' + params[key]; + for (var key in params) { + callBack = callBack + '&' + key + '=' + encodeURI(params[key]); } Wicket.Ajax.ajax({ diff --git a/gmap3-parent/gmap3/src/test/java/wicket/contrib/gmap/util/GMapTest.java b/gmap3-parent/gmap3/src/test/java/wicket/contrib/gmap/util/GMapTest.java index 50f3df83d9..f736c1e38a 100644 --- a/gmap3-parent/gmap3/src/test/java/wicket/contrib/gmap/util/GMapTest.java +++ b/gmap3-parent/gmap3/src/test/java/wicket/contrib/gmap/util/GMapTest.java @@ -1,7 +1,10 @@ package wicket.contrib.gmap.util; +import static wicket.contrib.gmap.util.GeocoderTest.DEFAULT_API_KEY; + import org.apache.wicket.util.tester.WicketTester; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -17,15 +20,23 @@ @RunWith(JUnit4.class) public class GMapTest { - /** - * Test if the JavaScript for fitBounds() isn't rendered,
- * if >not< bounds set on the map - */ + private String apiKey = DEFAULT_API_KEY; + + @Before + public void setUp() + { + apiKey = System.getProperty("wicketstuff.gmap3.apiKey", DEFAULT_API_KEY); + } + + /** + * Test if the JavaScript for fitBounds() isn't rendered,
+ * if >not< bounds set on the map + */ @Test public void testIfBoundJSIsntRenderedIfBoundsPropertyIsntSet() { WicketTester tester = new WicketTester(); - GMap map = new GMap("someId"); + GMap map = new GMap("someId", apiKey); tester.startComponentInPage(map); Assert.assertFalse( "If the property bounds is not set, it shouldn't render the JS-method", @@ -33,15 +44,15 @@ public void testIfBoundJSIsntRenderedIfBoundsPropertyIsntSet() } - /** - * Test if the JavaScript for fitBounds() is rendered,
- * if bounds set on the map - */ + /** + * Test if the JavaScript for fitBounds() is rendered,
+ * if bounds set on the map + */ @Test public void testIfBoundJSIsRenderedIfBoundsPropertyIsSet() { WicketTester tester = new WicketTester(); - GMap map = new GMap("someId"); + GMap map = new GMap("someId", apiKey); map.setBounds(new GLatLngBounds(// new GLatLng(43.8864731, 4.739279), // new GLatLng(43.9966409, 4.927226)// @@ -56,4 +67,4 @@ public void testIfBoundJSIsRenderedIfBoundsPropertyIsSet() + "new google.maps.LatLng(43.9966409, 4.927226, false)))"// )); } -} \ No newline at end of file +} diff --git a/gmap3-parent/gmap3/src/test/java/wicket/contrib/gmap/util/GeocoderTest.java b/gmap3-parent/gmap3/src/test/java/wicket/contrib/gmap/util/GeocoderTest.java index fd9be4e6db..84332c2ad3 100644 --- a/gmap3-parent/gmap3/src/test/java/wicket/contrib/gmap/util/GeocoderTest.java +++ b/gmap3-parent/gmap3/src/test/java/wicket/contrib/gmap/util/GeocoderTest.java @@ -3,6 +3,7 @@ import org.apache.wicket.util.tester.WicketTester; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -13,31 +14,33 @@ @RunWith(JUnit4.class) public class GeocoderTest { - private Geocoder coder; + public static final String DEFAULT_API_KEY = "YOUR_API_KEY"; + private String apiKey = DEFAULT_API_KEY; @Before public void setUp() { - coder = new Geocoder(); - + apiKey = System.getProperty("wicketstuff.gmap3.apiKey", DEFAULT_API_KEY); } @Test public void testEncode() { + Geocoder coder = new Geocoder(apiKey); String encode = coder.encode("Salzburgerstraße 205, 4030 Linz, Österreich"); - Assert.assertEquals( - "http://maps.googleapis.com/maps/api/geocode/json?address=Salzburgerstra%C3%9Fe+205%2C+4030+Linz%2C+%C3%96sterreich", - encode); + Assert.assertEquals(new StringBuilder("https://maps.googleapis.com/maps/api/geocode/json?apiKey=") + .append(apiKey).append("&address=Salzburgerstra%C3%9Fe+205%2C+4030+Linz%2C+%C3%96sterreich").toString() + , encode); } @Test + @Ignore // Ignored for now due to too much OVER_QUERY_LIMIT errors public void testGeocoding() throws Exception { - Geocoder coder = new Geocoder(); + Geocoder coder = new Geocoder(apiKey); GLatLng result = coder.geocode("Salzburgerstraße 205, 4030 Linz, Österreich"); Assert.assertNotNull(result); - Assert.assertEquals(48.25763170, result.getLat(), 0.00001); + Assert.assertEquals(48.2572879, result.getLat(), 0.00001); Assert.assertEquals(14.29231840, result.getLng(), 0.00001); } @@ -49,12 +52,13 @@ public void testGeocoding() throws Exception * @throws Exception */ @Test + @Ignore // Ignored for now due to too much OVER_QUERY_LIMIT errors public void testCenterAndFitZoomForAdress() throws Exception { WicketTester tester = new WicketTester(); - GMap map = new GMap("gmap"); + GMap map = new GMap("gmap", apiKey); tester.startComponentInPage(map); - Geocoder gecoder = new Geocoder(); + Geocoder gecoder = new Geocoder(apiKey); gecoder.centerAndFitZoomForAdress(map, "Avignon, France"); Assert.assertEquals(43.9966409, map.getBounds().getNE().getLat(), 0.00001); Assert.assertEquals(4.927226, map.getBounds().getNE().getLng(), 0.00001); diff --git a/gmap3-parent/pom.xml b/gmap3-parent/pom.xml index e3df6c0c1c..e33329bde1 100644 --- a/gmap3-parent/pom.xml +++ b/gmap3-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT gmap3-parent diff --git a/googlecharts-parent/googlecharts-examples/pom.xml b/googlecharts-parent/googlecharts-examples/pom.xml index 296a079da7..49b5d1b885 100644 --- a/googlecharts-parent/googlecharts-examples/pom.xml +++ b/googlecharts-parent/googlecharts-examples/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff googlecharts-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT googlecharts-examples diff --git a/googlecharts-parent/googlecharts/pom.xml b/googlecharts-parent/googlecharts/pom.xml index bf6f6734df..0c3175e732 100644 --- a/googlecharts-parent/googlecharts/pom.xml +++ b/googlecharts-parent/googlecharts/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff googlecharts-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-googlecharts jar diff --git a/googlecharts-parent/pom.xml b/googlecharts-parent/pom.xml index 9420e5a4e8..39bb6c4699 100644 --- a/googlecharts-parent/pom.xml +++ b/googlecharts-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT googlecharts-parent diff --git a/htmlcompressor-parent/htmlcompressor-examples/pom.xml b/htmlcompressor-parent/htmlcompressor-examples/pom.xml index 3dc5325fbc..f490c390f9 100644 --- a/htmlcompressor-parent/htmlcompressor-examples/pom.xml +++ b/htmlcompressor-parent/htmlcompressor-examples/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-htmlcompressor-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-htmlcompressor-examples diff --git a/htmlcompressor-parent/htmlcompressor/pom.xml b/htmlcompressor-parent/htmlcompressor/pom.xml index 5f185e9a29..fa13d9811e 100644 --- a/htmlcompressor-parent/htmlcompressor/pom.xml +++ b/htmlcompressor-parent/htmlcompressor/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-htmlcompressor-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-htmlcompressor diff --git a/htmlcompressor-parent/pom.xml b/htmlcompressor-parent/pom.xml index e5569ca0bd..b915674cc2 100644 --- a/htmlcompressor-parent/pom.xml +++ b/htmlcompressor-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-htmlcompressor-parent diff --git a/inmethod-grid-parent/inmethod-grid-examples/pom.xml b/inmethod-grid-parent/inmethod-grid-examples/pom.xml index 0cf2516ca6..e2015c4f3b 100644 --- a/inmethod-grid-parent/inmethod-grid-examples/pom.xml +++ b/inmethod-grid-parent/inmethod-grid-examples/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff inmethod-grid-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-inmethod-grid-examples diff --git a/inmethod-grid-parent/inmethod-grid/pom.xml b/inmethod-grid-parent/inmethod-grid/pom.xml index 3415bdddaa..fdbaf1ace7 100644 --- a/inmethod-grid-parent/inmethod-grid/pom.xml +++ b/inmethod-grid-parent/inmethod-grid/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff inmethod-grid-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-inmethod-grid diff --git a/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/column/CheckBoxColumn.java b/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/column/CheckBoxColumn.java index 2357edf226..819ba65505 100644 --- a/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/column/CheckBoxColumn.java +++ b/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/column/CheckBoxColumn.java @@ -152,7 +152,7 @@ public boolean isVisible() checkbox.setOutputMarkupId(true); add(checkbox); - checkbox.add(new AjaxFormSubmitBehavior(getGrid().getForm(), "onclick") + checkbox.add(new AjaxFormSubmitBehavior(getGrid().getForm(), "click") { private static final long serialVersionUID = 1L; @@ -297,7 +297,7 @@ protected void onComponentTag(ComponentTag tag) }; add(checkbox); - checkbox.add(new AjaxFormSubmitBehavior(getGrid().getForm(), "onclick") + checkbox.add(new AjaxFormSubmitBehavior(getGrid().getForm(), "click") { private static final long serialVersionUID = 1L; diff --git a/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/common/AbstractPageableView.java b/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/common/AbstractPageableView.java index 33b37e09e8..8a444b0bed 100644 --- a/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/common/AbstractPageableView.java +++ b/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/common/AbstractPageableView.java @@ -198,8 +198,12 @@ public void setMaxFirstItemReached(long maxFirstItemReached) { */ private transient QueryResult queryResult; - /** clears the queryResult so the next use will be forced to re-initialize */ - public void clearCache() { queryResult = null; } + /** clears the queryResult so the next use will be forced to re-initialize */ + public void clearCache() + { + queryResult = null; + realItemCount = UNKNOWN_COUNT; + } /** * Allows to wrap created query. @@ -461,7 +465,7 @@ else if (totalCount == IQueryResult.NO_MORE_ITEMS) protected void onDetach() { super.onDetach(); - queryResult = null; + clearCache(); } protected abstract IGridSortState getSortState(); @@ -494,7 +498,7 @@ private void setCurrentPageFirstItem(long currentItem) maxFirstItemReached = currentItem; } currentPageFirstItem = currentItem; - queryResult = null; + clearCache(); } } diff --git a/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/common/ColumnsHeaderRepeater.java b/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/common/ColumnsHeaderRepeater.java index 3e81b0bcf1..75826d261a 100644 --- a/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/common/ColumnsHeaderRepeater.java +++ b/inmethod-grid-parent/inmethod-grid/src/main/java/com/inmethod/grid/common/ColumnsHeaderRepeater.java @@ -172,7 +172,7 @@ protected void onRender() { throw new IllegalStateException("Column ID has changed during rendering"); } - IMarkupFragment componentMarkup = getParent().getParent().getMarkup(); + IMarkupFragment componentMarkup = component.getParent().getMarkup(); component.setMarkup(componentMarkup); component.render(); diff --git a/inmethod-grid-parent/pom.xml b/inmethod-grid-parent/pom.xml index 46844b0adc..b8e6d68233 100644 --- a/inmethod-grid-parent/pom.xml +++ b/inmethod-grid-parent/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT inmethod-grid-parent @@ -62,13 +62,8 @@ org.slf4j - slf4j-log4j12 + slf4j-api - - log4j - log4j - - junit diff --git a/input-events-parent/input-events-examples/pom.xml b/input-events-parent/input-events-examples/pom.xml index 3480b243dd..dac99ed1f1 100644 --- a/input-events-parent/input-events-examples/pom.xml +++ b/input-events-parent/input-events-examples/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff input-events-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT input-events-examples diff --git a/input-events-parent/input-events/pom.xml b/input-events-parent/input-events/pom.xml index 2d968c8c2c..b979544e0e 100644 --- a/input-events-parent/input-events/pom.xml +++ b/input-events-parent/input-events/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff input-events-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-input-events @@ -25,10 +25,6 @@ - - org.slf4j - slf4j-log4j12 - javax.servlet javax.servlet-api diff --git a/input-events-parent/pom.xml b/input-events-parent/pom.xml index f7df1393b1..aadf914ecc 100644 --- a/input-events-parent/pom.xml +++ b/input-events-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT input-events-parent diff --git a/jamon-parent/jamon-examples/pom.xml b/jamon-parent/jamon-examples/pom.xml index 4046df193d..9acfd625b9 100644 --- a/jamon-parent/jamon-examples/pom.xml +++ b/jamon-parent/jamon-examples/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-jamon-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT jamon-examples Jamon examples diff --git a/jamon-parent/jamon/pom.xml b/jamon-parent/jamon/pom.xml index 8d15f13d2c..713673bff1 100644 --- a/jamon-parent/jamon/pom.xml +++ b/jamon-parent/jamon/pom.xml @@ -4,7 +4,8 @@ org.wicketstuff wicketstuff-jamon-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT + ../pom.xml wicketstuff-jamon Jamon diff --git a/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/JamonAdminPageTest.java b/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/JamonAdminPageTest.java index 9bd25256d0..ca072ced5e 100644 --- a/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/JamonAdminPageTest.java +++ b/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/JamonAdminPageTest.java @@ -21,7 +21,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.wicketstuff.jamon.component.JamonAdminPage; import org.wicketstuff.jamon.monitor.JamonRepository; import com.jamonapi.MonitorFactory; @@ -42,6 +41,7 @@ public void beforeEachTest() @After public void after() { + wicketTester.destroy(); MonitorFactory.getFactory().reset(); } @@ -49,7 +49,7 @@ public void after() public void shouldRenderStatisticsPageWithOneMonitor() { JamonTestUtil.startThisManyMonitors(1); - wicketTester.startPage(new JamonAdminPage()); + wicketTester.startPage(JamonAdminPage.class); wicketTester.assertRenderedPage(JamonAdminPage.class); Assert.assertEquals(1, wicketTester.getTagsByWicketId("linkText").size()); Assert.assertTrue( @@ -68,4 +68,4 @@ public void shouldRenderStatisticsPageWithTwoMonitors() Assert.assertTrue( wicketTester.getTagsByWicketId("linkText").get(1).getValue().equals("mon1")); } -} \ No newline at end of file +} diff --git a/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/JamonProviderTest.java b/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/JamonProviderTest.java index f0302a8674..51637b75c0 100644 --- a/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/JamonProviderTest.java +++ b/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/JamonProviderTest.java @@ -38,22 +38,22 @@ public class JamonProviderTest { private JamonProvider jamonProvider; - + private WicketTester wicketTester; - + @Before public void setup() { wicketTester = new WicketTester(JamonAdminPage.class); wicketTester.getApplication().setMetaData(MonitoringRepositoryKey.KEY, new JamonRepository()); - + jamonProvider = new JamonProvider(new AlwaysSatisfiedMonitorSpecification()); } @After - @Before public void reset() { + wicketTester.destroy(); MonitorFactory.getFactory().reset(); } @@ -86,15 +86,15 @@ public void shouldSupportSortingOfProperties() jamonProvider.setSort("label", SortOrder.ASCENDING); Iterator ascendingIterator = jamonProvider.iterator(0, 3); - assertEquals("mon0", ((Monitor)ascendingIterator.next()).getLabel()); - assertEquals("mon1", ((Monitor)ascendingIterator.next()).getLabel()); - assertEquals("mon2", ((Monitor)ascendingIterator.next()).getLabel()); + assertEquals("mon0", ascendingIterator.next().getLabel()); + assertEquals("mon1", ascendingIterator.next().getLabel()); + assertEquals("mon2", ascendingIterator.next().getLabel()); jamonProvider.setSort("label", SortOrder.DESCENDING); Iterator descendingIterator = jamonProvider.iterator(0, 3); - assertEquals("mon2", ((Monitor)descendingIterator.next()).getLabel()); - assertEquals("mon1", ((Monitor)descendingIterator.next()).getLabel()); - assertEquals("mon0", ((Monitor)descendingIterator.next()).getLabel()); + assertEquals("mon2", descendingIterator.next().getLabel()); + assertEquals("mon1", descendingIterator.next().getLabel()); + assertEquals("mon0", descendingIterator.next().getLabel()); } } diff --git a/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/PropertyModelObject.java b/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/PropertyModelObject.java index 67016bb244..6e1a43d212 100644 --- a/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/PropertyModelObject.java +++ b/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/component/PropertyModelObject.java @@ -16,15 +16,17 @@ */ package org.wicketstuff.jamon.component; +import java.io.Serializable; + /** * Class used in {@link PropertyModelObjectComparatorTest}. Just to wrap a property. - * + * * @author lars * */ -class PropertyModelObject +class PropertyModelObject implements Serializable { - + private static final long serialVersionUID = 1L; private final String name; public PropertyModelObject(String name) @@ -36,4 +38,4 @@ public String getName() { return name; } -} \ No newline at end of file +} diff --git a/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/request/cycle/JamonMonitoredRequestCycleTest.java b/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/request/cycle/JamonMonitoredRequestCycleTest.java index 37eba8faf3..ac68645937 100644 --- a/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/request/cycle/JamonMonitoredRequestCycleTest.java +++ b/jamon-parent/jamon/src/test/java/org/wicketstuff/jamon/request/cycle/JamonMonitoredRequestCycleTest.java @@ -20,6 +20,7 @@ import org.apache.wicket.util.tester.FormTester; import org.apache.wicket.util.tester.WicketTester; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.wicketstuff.jamon.component.JamonAdminPage; @@ -45,6 +46,13 @@ public void setup() MonitorFactory.getFactory().reset(); } + @After + public void after() + { + wicketTester.destroy(); + MonitorFactory.getFactory().reset(); + } + @Test public void shouldCreateMonitorForPagesThatAreNavigatedTo() { diff --git a/jamon-parent/pom.xml b/jamon-parent/pom.xml index 9dec0f84e0..d5e79f1305 100644 --- a/jamon-parent/pom.xml +++ b/jamon-parent/pom.xml @@ -4,7 +4,8 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT + ../pom.xml wicketstuff-jamon-parent pom diff --git a/jasperreports-parent/jasperreports-examples/pom.xml b/jasperreports-parent/jasperreports-examples/pom.xml index 26a35b2b43..9e154fc6b4 100644 --- a/jasperreports-parent/jasperreports-examples/pom.xml +++ b/jasperreports-parent/jasperreports-examples/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff jasperreports-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT jasperreports-examples diff --git a/jasperreports-parent/jasperreports/pom.xml b/jasperreports-parent/jasperreports/pom.xml index 5a7f851a2d..cfc01c262a 100644 --- a/jasperreports-parent/jasperreports/pom.xml +++ b/jasperreports-parent/jasperreports/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff jasperreports-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-jasperreports diff --git a/jasperreports-parent/pom.xml b/jasperreports-parent/pom.xml index 4316c5db03..ca916c1233 100644 --- a/jasperreports-parent/pom.xml +++ b/jasperreports-parent/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT jasperreports-parent diff --git a/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-ear/pom.xml b/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-ear/pom.xml index 6059ff9eab..aaadf8823b 100644 --- a/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-ear/pom.xml +++ b/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-ear/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff javaee-inject-examples - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT javaee-inject-example-ear ear diff --git a/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-ejb/pom.xml b/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-ejb/pom.xml index e6ae9ad226..2abd6b0073 100644 --- a/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-ejb/pom.xml +++ b/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-ejb/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff javaee-inject-examples - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT javaee-inject-example-ejb ejb diff --git a/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-war/pom.xml b/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-war/pom.xml index 8ec3369754..fddc97d6eb 100644 --- a/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-war/pom.xml +++ b/javaee-inject-parent/javaee-inject-examples/javaee-inject-example-war/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff javaee-inject-examples - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT javaee-inject-example-war war diff --git a/javaee-inject-parent/javaee-inject-examples/pom.xml b/javaee-inject-parent/javaee-inject-examples/pom.xml index 8662078870..f335fd34ae 100644 --- a/javaee-inject-parent/javaee-inject-examples/pom.xml +++ b/javaee-inject-parent/javaee-inject-examples/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff javaee-inject-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT javaee-inject-examples pom diff --git a/javaee-inject-parent/javaee-inject/pom.xml b/javaee-inject-parent/javaee-inject/pom.xml index aa40f45d10..1f7eeeeee4 100644 --- a/javaee-inject-parent/javaee-inject/pom.xml +++ b/javaee-inject-parent/javaee-inject/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff javaee-inject-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-javaee-inject jar diff --git a/javaee-inject-parent/pom.xml b/javaee-inject-parent/pom.xml index c1f5524179..23d347eb61 100644 --- a/javaee-inject-parent/pom.xml +++ b/javaee-inject-parent/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT javaee-inject-parent pom diff --git a/jee-web-parent/jee-web-examples/pom.xml b/jee-web-parent/jee-web-examples/pom.xml index 0b67def582..a39ff59423 100644 --- a/jee-web-parent/jee-web-examples/pom.xml +++ b/jee-web-parent/jee-web-examples/pom.xml @@ -3,7 +3,7 @@ org.wicketstuff jee-web-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-jee-web-examples war diff --git a/jee-web-parent/jee-web/pom.xml b/jee-web-parent/jee-web/pom.xml index bfd51b9921..1edf4f112c 100644 --- a/jee-web-parent/jee-web/pom.xml +++ b/jee-web-parent/jee-web/pom.xml @@ -3,7 +3,7 @@ org.wicketstuff jee-web-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-jee-web jar diff --git a/jee-web-parent/pom.xml b/jee-web-parent/pom.xml index 25d9adef3b..22b44b7d60 100644 --- a/jee-web-parent/pom.xml +++ b/jee-web-parent/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT jee-web-parent pom diff --git a/jqplot-parent/jqplot-examples/pom.xml b/jqplot-parent/jqplot-examples/pom.xml index e60e5e9b99..f4f75e4782 100644 --- a/jqplot-parent/jqplot-examples/pom.xml +++ b/jqplot-parent/jqplot-examples/pom.xml @@ -1,12 +1,10 @@ - - 4.0.0 org.wicketstuff jqplot-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT jqplot-examples @@ -29,12 +27,12 @@ - + ${project.groupId} jqplot ${project.version} - + org.slf4j slf4j-api @@ -48,13 +46,26 @@ log4j runtime + + + org.eclipse.jetty.aggregate + jetty-all-server + - - - - org.mortbay.jetty - maven-jetty-plugin - - - + + + + org.mortbay.jetty + jetty-maven-plugin + + + + 8080 + 3600000 + + + + + + diff --git a/jqplot-parent/jqplot-examples/src/main/java/org/wicketstuff/jqplot/examples/HomePage.java b/jqplot-parent/jqplot-examples/src/main/java/org/wicketstuff/jqplot/examples/HomePage.java index 356181b8a0..cfb98cf399 100644 --- a/jqplot-parent/jqplot-examples/src/main/java/org/wicketstuff/jqplot/examples/HomePage.java +++ b/jqplot-parent/jqplot-examples/src/main/java/org/wicketstuff/jqplot/examples/HomePage.java @@ -64,7 +64,7 @@ private void addChartWithImage() { Legend legend = new Legend(); legend.setShow(true); - legend.setPlacment("outsite"); + legend.setPlacement("outsite"); legend.setRendererOptions(new LegendRenderer().setNumberRows(1)); legend.setLocation(Location.s); legend.setMarginTop("15px"); @@ -135,7 +135,7 @@ public AreaChart areaChart2() { Legend legend = new Legend(); legend.setShow(true); - legend.setPlacment("outsideGrid"); + legend.setPlacement("outsideGrid"); areaChart.setLegend(legend); TickOptions tickOptions = new TickOptions(); @@ -156,7 +156,7 @@ private PieChart pieChart2() { Legend legend = new Legend(); legend.setShow(true); - legend.setPlacment("outsite"); + legend.setPlacement("outsite"); legend.setRendererOptions(new LegendRenderer().setNumberRows(1)); legend.setLocation(Location.s); legend.setMarginTop("15px"); @@ -270,7 +270,7 @@ private BarChart barChart1() { BarChart barChart1 = new BarChart("Bar Chart"); Legend legend = new Legend(); legend.setShow(true); - legend.setPlacment("outsideGrid"); + legend.setPlacement("outsideGrid"); barChart1.setLegend(legend); barChart1 .getChartConfiguration() diff --git a/jqplot-parent/jqplot-examples/src/main/webapp/WEB-INF/web.xml b/jqplot-parent/jqplot-examples/src/main/webapp/WEB-INF/web.xml index c4a76ff6b1..b896f61af9 100644 --- a/jqplot-parent/jqplot-examples/src/main/webapp/WEB-INF/web.xml +++ b/jqplot-parent/jqplot-examples/src/main/webapp/WEB-INF/web.xml @@ -1,10 +1,9 @@ - + - jqplot-wicket + jqplot-wicket - - - org.slf4j - slf4j-log4j12 - - - - log4j - log4j - - junit diff --git a/lambda-parent/lambda-examples/pom.xml b/lambda-parent/lambda-examples/pom.xml index 37a50c5a42..a393cd0a8f 100644 --- a/lambda-parent/lambda-examples/pom.xml +++ b/lambda-parent/lambda-examples/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-lambda-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-lambda-examples @@ -20,7 +20,7 @@ org.wicketstuff wicketstuff-lambda - ${version} + ${project.version} diff --git a/lambda-parent/lambda/pom.xml b/lambda-parent/lambda/pom.xml index 44249679e9..a74c682ea7 100644 --- a/lambda-parent/lambda/pom.xml +++ b/lambda-parent/lambda/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-lambda-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-lambda diff --git a/lambda-parent/pom.xml b/lambda-parent/pom.xml index e699929211..bfe20c1a7d 100644 --- a/lambda-parent/pom.xml +++ b/lambda-parent/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-lambda-parent @@ -36,7 +36,6 @@ maven-javadoc-plugin false - -Xdoclint:none diff --git a/lightbox2-parent/lightbox2-examples/pom.xml b/lightbox2-parent/lightbox2-examples/pom.xml index 55f2e7a2dd..6999229e08 100644 --- a/lightbox2-parent/lightbox2-examples/pom.xml +++ b/lightbox2-parent/lightbox2-examples/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff lightbox2-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT lightbox2-examples @@ -48,13 +48,4 @@ runtime - - - - - org.mortbay.jetty - maven-jetty-plugin - - - diff --git a/lightbox2-parent/lightbox2/pom.xml b/lightbox2-parent/lightbox2/pom.xml index aec5806900..7cd8b2e867 100644 --- a/lightbox2-parent/lightbox2/pom.xml +++ b/lightbox2-parent/lightbox2/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff lightbox2-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT lightbox2 diff --git a/lightbox2-parent/pom.xml b/lightbox2-parent/pom.xml index c6d63eb636..c2f8869424 100644 --- a/lightbox2-parent/pom.xml +++ b/lightbox2-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT lightbox2-parent diff --git a/mbeanview-parent/mbeanview-examples/pom.xml b/mbeanview-parent/mbeanview-examples/pom.xml index 73f8849824..ebe6cc47d2 100644 --- a/mbeanview-parent/mbeanview-examples/pom.xml +++ b/mbeanview-parent/mbeanview-examples/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff mbeanview-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT mbeanview-examples diff --git a/mbeanview-parent/mbeanview/pom.xml b/mbeanview-parent/mbeanview/pom.xml index 3db09d78a5..d9b6d2a85b 100644 --- a/mbeanview-parent/mbeanview/pom.xml +++ b/mbeanview-parent/mbeanview/pom.xml @@ -3,7 +3,7 @@ org.wicketstuff mbeanview-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-mbeanview diff --git a/mbeanview-parent/pom.xml b/mbeanview-parent/pom.xml index e5edb7e10b..6361a684d3 100644 --- a/mbeanview-parent/pom.xml +++ b/mbeanview-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT mbeanview-parent diff --git a/minis-parent/minis-examples/pom.xml b/minis-parent/minis-examples/pom.xml index f1a49728dd..46fde76e19 100644 --- a/minis-parent/minis-examples/pom.xml +++ b/minis-parent/minis-examples/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff minis-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-minis-examples diff --git a/minis-parent/minis-examples/src/main/java/org/wicketstuff/minis/WicketApplication.java b/minis-parent/minis-examples/src/main/java/org/wicketstuff/minis/WicketApplication.java index 171d2cfd3b..474ba38490 100644 --- a/minis-parent/minis-examples/src/main/java/org/wicketstuff/minis/WicketApplication.java +++ b/minis-parent/minis-examples/src/main/java/org/wicketstuff/minis/WicketApplication.java @@ -1,6 +1,11 @@ package org.wicketstuff.minis; +import org.apache.wicket.Component; +import org.apache.wicket.application.IComponentInstantiationListener; +import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.protocol.http.WebApplication; +import org.wicketstuff.minis.behavior.ie.DocumentCompatibilityBehavior; +import org.wicketstuff.minis.behavior.safari.PersistedCacheBehavior; /** * Application object for your web application. If you want to run this application without @@ -25,10 +30,20 @@ public Class getHomePage() { return HomePage.class; } - + @Override protected void init() { - super.init(); + super.init(); + + getComponentInstantiationListeners().add(new IComponentInstantiationListener() { + @Override + public void onInstantiation(Component component) { + if (component instanceof WebPage) { + component.add(DocumentCompatibilityBehavior.ieEdge()); + component.add(PersistedCacheBehavior.prevent()); + } + } + }); } } diff --git a/minis-parent/minis/pom.xml b/minis-parent/minis/pom.xml index 24db0dae81..c771f54e8f 100644 --- a/minis-parent/minis/pom.xml +++ b/minis-parent/minis/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff minis-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-minis diff --git a/minis-parent/minis/src/main/java/org/wicketstuff/minis/behavior/ie/DocumentCompatibilityBehavior.java b/minis-parent/minis/src/main/java/org/wicketstuff/minis/behavior/ie/DocumentCompatibilityBehavior.java new file mode 100644 index 0000000000..6f9c13dae0 --- /dev/null +++ b/minis-parent/minis/src/main/java/org/wicketstuff/minis/behavior/ie/DocumentCompatibilityBehavior.java @@ -0,0 +1,80 @@ +package org.wicketstuff.minis.behavior.ie; + +import org.apache.wicket.Component; +import org.apache.wicket.behavior.Behavior; +import org.apache.wicket.request.Response; +import org.apache.wicket.request.http.WebResponse; + +/** + * Force a compatibility mode on Internet Explorer. + *
+ * Adds a {@code X-UA-Compatibility}-header to the response which takes precedence over + * browser settings, "intranet" exclusions, {@code }-tags and any quirk-modus + * detection. + * + * @see #ieEdge() + * + * @author svenmeier + */ +public class DocumentCompatibilityBehavior extends Behavior { + + private static final String X_UA_COMPATIBLE = "X-UA-Compatible"; + + private final String content; + + /** + * Default using latest standard compatibility. + */ + public DocumentCompatibilityBehavior() { + this.content = "IE=Edge"; + } + + public DocumentCompatibilityBehavior(final String content) { + this.content = content; + } + + @Override + public void beforeRender(Component component) { + + Response response = component.getResponse(); + if (response instanceof WebResponse) { + ((WebResponse)response).addHeader(X_UA_COMPATIBLE, content); + } + } + + public static DocumentCompatibilityBehavior ieEdge() { + return new DocumentCompatibilityBehavior(); + } + + public static DocumentCompatibilityBehavior ie11() { + return new DocumentCompatibilityBehavior("IE=11"); + } + + public static DocumentCompatibilityBehavior ie10() { + return new DocumentCompatibilityBehavior("IE=10"); + } + + public static DocumentCompatibilityBehavior ie9() { + return new DocumentCompatibilityBehavior("IE=9"); + } + + public static DocumentCompatibilityBehavior ie8() { + return new DocumentCompatibilityBehavior("IE=8"); + } + + public static DocumentCompatibilityBehavior ieEmulate11() { + return new DocumentCompatibilityBehavior("IE=Emulate11"); + } + + public static DocumentCompatibilityBehavior ieEmulate10() { + return new DocumentCompatibilityBehavior("IE=Emulate10"); + } + + public static DocumentCompatibilityBehavior ieEmulate9() { + return new DocumentCompatibilityBehavior("IE=Emulate9"); + } + + public static DocumentCompatibilityBehavior ieEmulate8() { + return new DocumentCompatibilityBehavior("IE=Emulate8"); + } +} \ No newline at end of file diff --git a/minis-parent/minis/src/main/java/org/wicketstuff/minis/behavior/safari/PersistedCacheBehavior.java b/minis-parent/minis/src/main/java/org/wicketstuff/minis/behavior/safari/PersistedCacheBehavior.java new file mode 100644 index 0000000000..ab8040e869 --- /dev/null +++ b/minis-parent/minis/src/main/java/org/wicketstuff/minis/behavior/safari/PersistedCacheBehavior.java @@ -0,0 +1,43 @@ +package org.wicketstuff.minis.behavior.safari; + +import org.apache.wicket.Component; +import org.apache.wicket.Page; +import org.apache.wicket.behavior.Behavior; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.request.resource.JavaScriptResourceReference; +import org.apache.wicket.request.resource.ResourceReference; + +/** + * Safari 5 loads pages persisted on back button, regardless of all {@code cache-control} headers. + *
+ * When added to a page, this behavior will prevent this via a small JavaScript snippet which forces + * a reload of the page. + * + * @see http://stackoverflow.com/questions/5297122/preventing-cache-on-back-button-in-safari-5 + * + * @author svenmeier + */ +public class PersistedCacheBehavior extends Behavior { + + public static final ResourceReference REF = new JavaScriptResourceReference(PersistedCacheBehavior.class, "script.js"); + + private PersistedCacheBehavior() { + } + + @Override + public void bind(Component component) { + if ((component instanceof Page) == false) { + throw new IllegalArgumentException("must be bound to a page"); + } + } + + @Override + public void renderHead(Component component, IHeaderResponse response) { + response.render(JavaScriptHeaderItem.forReference(REF)); + } + + public static PersistedCacheBehavior prevent() { + return new PersistedCacheBehavior(); + } +} diff --git a/minis-parent/minis/src/main/java/org/wicketstuff/minis/behavior/safari/script.js b/minis-parent/minis/src/main/java/org/wicketstuff/minis/behavior/safari/script.js new file mode 100644 index 0000000000..44d2dd46c2 --- /dev/null +++ b/minis-parent/minis/src/main/java/org/wicketstuff/minis/behavior/safari/script.js @@ -0,0 +1,7 @@ +if (window.addEventListener) { + window.addEventListener('pageshow', function(event) { + if (event.persisted) { + window.location.reload(); + } + }); +} \ No newline at end of file diff --git a/minis-parent/pom.xml b/minis-parent/pom.xml index d8e69dd9b1..48df21ca55 100644 --- a/minis-parent/pom.xml +++ b/minis-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT minis-parent diff --git a/modalx-parent/modalx-examples/pom.xml b/modalx-parent/modalx-examples/pom.xml index cce4d190f1..63df16d435 100644 --- a/modalx-parent/modalx-examples/pom.xml +++ b/modalx-parent/modalx-examples/pom.xml @@ -3,7 +3,7 @@ org.wicketstuff modalx-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT modalx-examples diff --git a/modalx-parent/modalx/pom.xml b/modalx-parent/modalx/pom.xml index 3ce0d08156..71c94d9fc6 100644 --- a/modalx-parent/modalx/pom.xml +++ b/modalx-parent/modalx/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff modalx-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT modalx diff --git a/modalx-parent/pom.xml b/modalx-parent/pom.xml index 9e0434686c..3bdf3bc698 100644 --- a/modalx-parent/pom.xml +++ b/modalx-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT modalx-parent ModalX Parent diff --git a/nashorn-parent/nashorn-examples/pom.xml b/nashorn-parent/nashorn-examples/pom.xml index 30b4db9ffd..58ca5677c6 100644 --- a/nashorn-parent/nashorn-examples/pom.xml +++ b/nashorn-parent/nashorn-examples/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-nashorn-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-nashorn-examples diff --git a/nashorn-parent/nashorn/pom.xml b/nashorn-parent/nashorn/pom.xml index f2a9154ae5..d8f3c87170 100644 --- a/nashorn-parent/nashorn/pom.xml +++ b/nashorn-parent/nashorn/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-nashorn-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-nashorn diff --git a/nashorn-parent/nashorn/src/test/java/org/wicketstuff/nashorn/resource/NashornResourceReferenceTest.java b/nashorn-parent/nashorn/src/test/java/org/wicketstuff/nashorn/resource/NashornResourceReferenceTest.java index a34297bb6c..50848237a1 100644 --- a/nashorn-parent/nashorn/src/test/java/org/wicketstuff/nashorn/resource/NashornResourceReferenceTest.java +++ b/nashorn-parent/nashorn/src/test/java/org/wicketstuff/nashorn/resource/NashornResourceReferenceTest.java @@ -64,7 +64,7 @@ public ServletInputStream getInputStream() throws IOException wicketTester.setRequest(mockHttpServletRequest); NashornResourceReference nashornResourceReference = new NashornResourceReference("nashorn", - 10, 10, TimeUnit.SECONDS) + 50, 50, TimeUnit.SECONDS) { private static final long serialVersionUID = 1L; @@ -144,4 +144,4 @@ public void setReadListener(ReadListener arg0) { } } -} \ No newline at end of file +} diff --git a/nashorn-parent/pom.xml b/nashorn-parent/pom.xml index da30f38d7d..c3d5addac6 100644 --- a/nashorn-parent/pom.xml +++ b/nashorn-parent/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-nashorn-parent @@ -41,7 +41,6 @@ maven-javadoc-plugin false - -Xdoclint:none diff --git a/objectautocomplete-parent/objectautocomplete-examples/pom.xml b/objectautocomplete-parent/objectautocomplete-examples/pom.xml index 5c0651e0bc..4e3cd021d7 100644 --- a/objectautocomplete-parent/objectautocomplete-examples/pom.xml +++ b/objectautocomplete-parent/objectautocomplete-examples/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-objectautocomplete-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-objectautocomplete-examples diff --git a/objectautocomplete-parent/objectautocomplete/pom.xml b/objectautocomplete-parent/objectautocomplete/pom.xml index ad0d546d16..1d2f232f72 100644 --- a/objectautocomplete-parent/objectautocomplete/pom.xml +++ b/objectautocomplete-parent/objectautocomplete/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-objectautocomplete-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-objectautocomplete @@ -31,14 +31,6 @@ org.slf4j slf4j-api
- - org.slf4j - slf4j-log4j12 - - - log4j - log4j - diff --git a/objectautocomplete-parent/pom.xml b/objectautocomplete-parent/pom.xml index e59e204d94..5b8ee6cfda 100644 --- a/objectautocomplete-parent/pom.xml +++ b/objectautocomplete-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-objectautocomplete-parent diff --git a/offline-mode-parent/offline-mode-examples/pom.xml b/offline-mode-parent/offline-mode-examples/pom.xml index fd70152a08..dae444669e 100644 --- a/offline-mode-parent/offline-mode-examples/pom.xml +++ b/offline-mode-parent/offline-mode-examples/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-offline-mode-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-offline-mode-examples diff --git a/offline-mode-parent/offline-mode/pom.xml b/offline-mode-parent/offline-mode/pom.xml index 5e0f78fdf6..a4986c4d08 100644 --- a/offline-mode-parent/offline-mode/pom.xml +++ b/offline-mode-parent/offline-mode/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-offline-mode-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-offline-mode diff --git a/offline-mode-parent/pom.xml b/offline-mode-parent/pom.xml index cd1ba95ec5..9b7eb6b7c1 100644 --- a/offline-mode-parent/pom.xml +++ b/offline-mode-parent/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-offline-mode-parent @@ -34,7 +34,6 @@ maven-javadoc-plugin false - -Xdoclint:none diff --git a/openlayers-parent/openlayers-examples/pom.xml b/openlayers-parent/openlayers-examples/pom.xml index 8939e5c023..665444b8ac 100644 --- a/openlayers-parent/openlayers-examples/pom.xml +++ b/openlayers-parent/openlayers-examples/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff openlayers-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT openlayers-examples diff --git a/openlayers-parent/openlayers-proxy/pom.xml b/openlayers-parent/openlayers-proxy/pom.xml index 28df739fa7..373cab14f6 100644 --- a/openlayers-parent/openlayers-proxy/pom.xml +++ b/openlayers-parent/openlayers-proxy/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff openlayers-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-openlayers-proxy diff --git a/openlayers-parent/openlayers/pom.xml b/openlayers-parent/openlayers/pom.xml index 6714191940..42e9c9ff7f 100644 --- a/openlayers-parent/openlayers/pom.xml +++ b/openlayers-parent/openlayers/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff openlayers-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-openlayers @@ -50,14 +50,6 @@ org.slf4j slf4j-api - - org.slf4j - slf4j-log4j12 - - - log4j - log4j - junit junit diff --git a/openlayers-parent/pom.xml b/openlayers-parent/pom.xml index 172b210411..0fc35f6704 100644 --- a/openlayers-parent/pom.xml +++ b/openlayers-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT openlayers-parent diff --git a/openlayers3-parent/openlayers3-bootstrap/pom.xml b/openlayers3-parent/openlayers3-bootstrap/pom.xml index afc8a3a950..ed16d3c1f6 100644 --- a/openlayers3-parent/openlayers3-bootstrap/pom.xml +++ b/openlayers3-parent/openlayers3-bootstrap/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff openlayers3-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-openlayers3-bootstrap @@ -46,14 +46,6 @@ org.slf4j slf4j-api - - org.slf4j - slf4j-log4j12 - - - log4j - log4j - junit junit diff --git a/openlayers3-parent/openlayers3-examples/pom.xml b/openlayers3-parent/openlayers3-examples/pom.xml index 49d4e587ed..07f5b85b7d 100644 --- a/openlayers3-parent/openlayers3-examples/pom.xml +++ b/openlayers3-parent/openlayers3-examples/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff openlayers3-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT openlayers3-examples diff --git a/openlayers3-parent/openlayers3/pom.xml b/openlayers3-parent/openlayers3/pom.xml index 61a5dd73fb..de3397a2f7 100644 --- a/openlayers3-parent/openlayers3/pom.xml +++ b/openlayers3-parent/openlayers3/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff openlayers3-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-openlayers3 diff --git a/openlayers3-parent/pom.xml b/openlayers3-parent/pom.xml index 3586175057..7306db3aa4 100644 --- a/openlayers3-parent/pom.xml +++ b/openlayers3-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT openlayers3-parent diff --git a/phonebook/pom.xml b/phonebook/pom.xml index 0aa8b1ca08..2debaed56a 100644 --- a/phonebook/pom.xml +++ b/phonebook/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-phonebook diff --git a/plugin/pom.xml b/plugin/pom.xml index 6db45e8182..9102e083a5 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-plugin diff --git a/pom.xml b/pom.xml index 403c61d94a..667934909c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,13 +1,12 @@ - + 4.0.0 org.wicketstuff wicketstuff-core pom - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT WicketStuff Core Parent WicketStuff Core Parent is the parent project for all of the core WicketStuff projects. It tries @@ -164,7 +163,7 @@ sonatype-nexus-staging Nexus Release Repository - http://oss.sonatype.org/service/local/staging/deploy/maven2/ + https://oss.sonatype.org/service/local/staging/deploy/maven2/ @@ -180,7 +179,7 @@ sonatype-nexus-snapshots Sonatype Nexus Snapshots - http://oss.sonatype.org/content/repositories/snapshots + https://oss.sonatype.org/content/repositories/snapshots @@ -209,7 +208,7 @@ sonatype-nexus-snapshots Sonatype Nexus Snapshots - http://oss.sonatype.org/content/repositories/snapshots + https://oss.sonatype.org/content/repositories/snapshots true @@ -244,7 +243,7 @@ - 7.4.0-SNAPSHOT + 7.18.0-SNAPSHOT 1.7 1.7 @@ -268,6 +267,7 @@ 3.1 2.1 2.11.8 + 1.4.14-jdk7 @@ -283,11 +283,11 @@ annotationeventdispatcher-parent async-tasks-parent autocomplete-tagit-parent - browserid-parent datastores-parent datatables-parent flot-parent gae-initializer-parent + gchart-parent gmap3-parent googlecharts-parent htmlcompressor-parent @@ -330,6 +330,8 @@ wicket-facebook-parent wicket-html5-parent wicket-servlet3-parent + wicketstuff-clipboard-js-parent + wicketstuff-pdf-js-parent wicketstuff-springreference-parent wicket-security-parent @@ -547,7 +549,7 @@ org.apache.commons commons-collections4 - 4.0 + 4.1 org.apache.commons @@ -977,6 +979,7 @@ com.mycila.maven-license-plugin maven-license-plugin + 1.10.b1

${basedir}/license_header.txt
true @@ -1193,7 +1196,7 @@ - + @@ -1214,7 +1217,7 @@ - + @@ -1235,7 +1238,7 @@ - + diff --git a/portlet-parent/pom.xml b/portlet-parent/pom.xml index f9411e917c..332c2e1b3c 100644 --- a/portlet-parent/pom.xml +++ b/portlet-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-portlet-parent Portlet Parent @@ -29,6 +29,11 @@ + + kkaravitis + Konstantinos Karavitis + kkaravitis@gmail.com + Peter Pastrnak diff --git a/portlet-parent/wicketstuff-portlet-examples/pom.xml b/portlet-parent/wicketstuff-portlet-examples/pom.xml index 271f7d149d..b225ca2112 100644 --- a/portlet-parent/wicketstuff-portlet-examples/pom.xml +++ b/portlet-parent/wicketstuff-portlet-examples/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-portlet-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-portlet-examples diff --git a/portlet-parent/wicketstuff-portlet/pom.xml b/portlet-parent/wicketstuff-portlet/pom.xml index b38fff576f..4802a4500d 100644 --- a/portlet-parent/wicketstuff-portlet/pom.xml +++ b/portlet-parent/wicketstuff-portlet/pom.xml @@ -1,85 +1,85 @@ - - 4.0.0 - - - org.wicketstuff - wicketstuff-portlet-parent - 7.4.0-SNAPSHOT - - - wicketstuff-portlet - jar - Apache Wicket - Portlet Support - - - - 2.0 - - - - - - - - org.apache.wicket - wicket-core - ${wicket.version} - - - - - - javax.servlet - javax.servlet-api - provided - - - - javax.portlet - portlet-api - ${portlet-api.version} - provided - - - - - ${project.artifactId}-${project.version} - - - - false - src/main/java - - ** - - - **/*.java - - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - - org.apache.maven.plugins - maven-eclipse-plugin - - true - true - 2.0 - - - - - + + 4.0.0 + + + org.wicketstuff + wicketstuff-portlet-parent + 7.0-SNAPSHOT + + + wicketstuff-portlet + jar + Apache Wicket - Portlet Support + + + + 2.0 + + + + + + + + org.apache.wicket + wicket-core + ${wicket.version} + + + + + + javax.servlet + javax.servlet-api + provided + + + + javax.portlet + portlet-api + ${portlet-api.version} + provided + + + + + ${project.artifactId}-${project.version} + + + + false + src/main/java + + ** + + + **/*.java + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + + true + true + 2.0 + + + + + diff --git a/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletFilter.java b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletFilter.java index a91213090b..6da8320cea 100644 --- a/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletFilter.java +++ b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletFilter.java @@ -1,161 +1,176 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.portlet; - -import java.io.IOException; - -import javax.portlet.PortletConfig; -import javax.portlet.PortletRequest; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.wicket.IPageRendererProvider; -import org.apache.wicket.IRequestCycleProvider; -import org.apache.wicket.core.request.handler.RenderPageRequestHandler; -import org.apache.wicket.protocol.http.WicketFilter; -import org.apache.wicket.request.UrlRenderer; -import org.apache.wicket.request.cycle.RequestCycle; -import org.apache.wicket.request.cycle.RequestCycleContext; -import org.apache.wicket.request.handler.render.PageRenderer; -import org.apache.wicket.request.http.WebResponse; -import org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException; -import org.apache.wicket.settings.RequestCycleSettings.RenderStrategy; -import org.apache.wicket.util.crypt.Base64; - -/** - * This class subclasses the original WicketFilter to add the necessary porlet - * functionality. It is responsible for the initialization of all portlet - * specific settings of the WebApplication and wraps the portlet request and - * portlet response objects by an http servlet request / response wrapper. - * - * @author Peter Pastrnak - * @author Konstantinos Karavitis - */ -public class PortletFilter extends WicketFilter { - public static final String SHARED_RESOURCE_URL_PORTLET_WINDOW_ID_PREFIX = "/ps:"; - - private static String NOT_MOUNTED_PATH = "notMountedPath"; - - private FilterConfig filterConfig; - - @Override - public void init(boolean isServlet, FilterConfig filterConfig) throws ServletException { - super.init(isServlet, filterConfig); - this.filterConfig = filterConfig; - getApplication().getRequestCycleSettings().setRenderStrategy(RenderStrategy.REDIRECT_TO_RENDER); - getApplication().getRequestCycleSettings().addResponseFilter(new PortletInvalidMarkupFilter()); - //fix for https://github.com/wicketstuff/core/issues/487 - getApplication().getMarkupSettings().setMarkupIdGenerator(new PortletMarkupIdGenerator()); - getApplication().setRootRequestMapper(new PortletRequestMapper(getApplication())); - //Application must use the portlet specific page renderer provider. - getApplication().setPageRendererProvider(new IPageRendererProvider() { - @Override - public PageRenderer get(RenderPageRequestHandler handler) { - return new PortletPageRenderer(handler); - } - }); - // fix for https://github.com/wicketstuff/core/issues/478 issue - getApplication().setRequestCycleProvider(new IRequestCycleProvider() { - @Override - public RequestCycle get(RequestCycleContext context) { - return new RequestCycle(context) { - @Override - protected UrlRenderer newUrlRenderer() { - return new PortletUrlRenderer(getRequest()); - } - }; - } - }); - } - - @Override - public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { - HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; - HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; - String filterPath = getFilterPath(httpServletRequest); - - PortletRequest portletRequest = (PortletRequest) httpServletRequest.getAttribute("javax.portlet.request"); - if (portletRequest != null) { - final PortletConfig portletConfig = (PortletConfig) httpServletRequest.getAttribute("javax.portlet.config"); - final ResponseState responseState = (ResponseState) httpServletRequest.getAttribute(WicketPortlet.RESPONSE_STATE_ATTR); - - if (portletConfig != null) { - if (responseState == null) { - filterChain.doFilter(httpServletRequest, httpServletResponse); - return; - } - - HttpSession proxiedSession = PortletHttpSessionWrapper.createProxy( - httpServletRequest, portletRequest.getWindowID(), getApplication() - .getSessionAttributePrefix(null, filterConfig.getFilterName())); - - httpServletRequest = new PortletServletRequestWrapper(filterConfig.getServletContext(), httpServletRequest, proxiedSession, filterPath); - httpServletResponse = new PortletServletResponseWrapper(httpServletResponse, responseState); - } - } - else { - // look for windowId and serve it as a shared resource - - String pathInfo = httpServletRequest.getRequestURI().substring(httpServletRequest.getContextPath().length() + filterPath.length()); - if (pathInfo.startsWith(SHARED_RESOURCE_URL_PORTLET_WINDOW_ID_PREFIX)) { - - int nextSeparator = pathInfo.indexOf('/', 1); - if (nextSeparator > 0) { - String windowId = new String(Base64.decodeBase64(pathInfo.substring(SHARED_RESOURCE_URL_PORTLET_WINDOW_ID_PREFIX.length(), nextSeparator))); - - HttpSession proxiedSession = PortletHttpSessionWrapper.createProxy( - httpServletRequest, - windowId, - getApplication().getSessionAttributePrefix(null, - filterConfig.getFilterName())); - - pathInfo = pathInfo.substring(nextSeparator); - httpServletRequest = new PortletServletRequestWrapper(filterConfig.getServletContext(), httpServletRequest, proxiedSession, filterPath, pathInfo); - } - } - } - - super.doFilter(httpServletRequest, httpServletResponse, filterChain); - } - - protected boolean processRequestCycle(RequestCycle requestCycle, WebResponse webResponse, - HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, final FilterChain chain) - throws IOException, ServletException { - // Assume we are able to handle the request - boolean res = true; - - if (requestCycle.processRequestAndDetach()) { - webResponse.flush(); - } else if (httpServletRequest.getPathInfo() != null - && httpServletRequest.getPathInfo().equals(httpServletRequest.getAttribute(NOT_MOUNTED_PATH))) { - throw new AbortWithHttpErrorCodeException(404, httpServletRequest.getPathInfo() + " is not mounted to any Page"); - } else { - if (chain != null) { - httpServletRequest.setAttribute(NOT_MOUNTED_PATH, httpServletRequest.getPathInfo()); - chain.doFilter(httpServletRequest, httpServletResponse); - } - res = false; - } - return res; - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.portlet; + +import java.io.IOException; + +import javax.portlet.PortletConfig; +import javax.portlet.PortletRequest; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.wicket.IPageRendererProvider; +import org.apache.wicket.IRequestCycleProvider; +import org.apache.wicket.core.request.handler.RenderPageRequestHandler; +import org.apache.wicket.portlet.ajax.WicketPortletAjaxResourceReference; +import org.apache.wicket.protocol.http.WicketFilter; +import org.apache.wicket.protocol.https.HttpsConfig; +import org.apache.wicket.protocol.https.HttpsMapper; +import org.apache.wicket.protocol.https.Scheme; +import org.apache.wicket.request.IRequestHandler; +import org.apache.wicket.request.Request; +import org.apache.wicket.request.UrlRenderer; +import org.apache.wicket.request.cycle.RequestCycle; +import org.apache.wicket.request.cycle.RequestCycleContext; +import org.apache.wicket.request.handler.render.PageRenderer; +import org.apache.wicket.request.http.WebResponse; +import org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException; +import org.apache.wicket.settings.RequestCycleSettings.RenderStrategy; +import org.apache.wicket.util.crypt.Base64; + +/** + * This class subclasses the original WicketFilter to add the necessary porlet + * functionality. It is responsible for the initialization of all portlet + * specific settings of the WebApplication and wraps the portlet request and + * portlet response objects by an http servlet request / response wrapper. + * + * @author Peter Pastrnak + * @author Konstantinos Karavitis + */ +public class PortletFilter extends WicketFilter { + public static final String SHARED_RESOURCE_URL_PORTLET_WINDOW_ID_PREFIX = "/ps:"; + + private static String NOT_MOUNTED_PATH = "notMountedPath"; + + private FilterConfig filterConfig; + + @Override + public void init(boolean isServlet, FilterConfig filterConfig) throws ServletException { + super.init(isServlet, filterConfig); + this.filterConfig = filterConfig; + getApplication().getRequestCycleSettings().setRenderStrategy(RenderStrategy.REDIRECT_TO_RENDER); + getApplication().getRequestCycleSettings().addResponseFilter(new PortletInvalidMarkupFilter()); + //fix for https://github.com/wicketstuff/core/issues/487 + getApplication().getMarkupSettings().setMarkupIdGenerator(new PortletMarkupIdGenerator()); + //make the wicket bridge schema (HTTPS/HTTP) aware + getApplication().setRootRequestMapper(new HttpsMapper(new PortletRequestMapper(getApplication()), new HttpsConfig()){ + @Override + protected Scheme getDesiredSchemeFor(IRequestHandler handler) { + Request request = RequestCycle.get().getRequest(); + return super.getSchemeOf(request); + } + }); + //Application must use the portlet specific page renderer provider. + getApplication().setPageRendererProvider(new IPageRendererProvider() { + @Override + public PageRenderer get(RenderPageRequestHandler handler) { + return new PortletPageRenderer(handler); + } + }); + // fix for https://github.com/wicketstuff/core/issues/478 issue + getApplication().setRequestCycleProvider(new IRequestCycleProvider() { + @Override + public RequestCycle get(RequestCycleContext context) { + return new RequestCycle(context) { + @Override + protected UrlRenderer newUrlRenderer() { + return new PortletUrlRenderer(getRequest()); + } + }; + } + }); + //fix for https://github.com/wicketstuff/core/issues/588 issue + getApplication().getJavaScriptLibrarySettings().setWicketAjaxReference(WicketPortletAjaxResourceReference.get()); + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { + HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; + HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; + String filterPath = getFilterPath(httpServletRequest); + + PortletRequest portletRequest = (PortletRequest) httpServletRequest.getAttribute("javax.portlet.request"); + if (portletRequest != null) { + final PortletConfig portletConfig = (PortletConfig) httpServletRequest.getAttribute("javax.portlet.config"); + final ResponseState responseState = (ResponseState) httpServletRequest.getAttribute(WicketPortlet.RESPONSE_STATE_ATTR); + + if (portletConfig != null) { + if (responseState == null) { + filterChain.doFilter(httpServletRequest, httpServletResponse); + return; + } + + HttpSession proxiedSession = PortletHttpSessionWrapper.createProxy( + httpServletRequest, portletRequest.getWindowID(), getApplication() + .getSessionAttributePrefix(null, filterConfig.getFilterName())); + + httpServletRequest = new PortletServletRequestWrapper(filterConfig.getServletContext(), httpServletRequest, proxiedSession, filterPath); + httpServletResponse = new PortletServletResponseWrapper(httpServletResponse, responseState); + } + } + else { + // look for windowId and serve it as a shared resource + + String pathInfo = httpServletRequest.getRequestURI().substring(httpServletRequest.getContextPath().length() + filterPath.length()); + if (pathInfo.startsWith(SHARED_RESOURCE_URL_PORTLET_WINDOW_ID_PREFIX)) { + + int nextSeparator = pathInfo.indexOf('/', 1); + if (nextSeparator > 0) { + String windowId = new String(Base64.decodeBase64(pathInfo.substring(SHARED_RESOURCE_URL_PORTLET_WINDOW_ID_PREFIX.length(), nextSeparator))); + + HttpSession proxiedSession = PortletHttpSessionWrapper.createProxy( + httpServletRequest, + windowId, + getApplication().getSessionAttributePrefix(null, + filterConfig.getFilterName())); + + pathInfo = pathInfo.substring(nextSeparator); + httpServletRequest = new PortletServletRequestWrapper(filterConfig.getServletContext(), httpServletRequest, proxiedSession, filterPath, pathInfo); + } + } + } + + super.doFilter(httpServletRequest, httpServletResponse, filterChain); + } + + protected boolean processRequestCycle(RequestCycle requestCycle, WebResponse webResponse, + HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, final FilterChain chain) + throws IOException, ServletException { + // Assume we are able to handle the request + boolean res = true; + + if (requestCycle.processRequestAndDetach()) { + webResponse.flush(); + } else if (httpServletRequest.getPathInfo() != null + && httpServletRequest.getPathInfo().equals(httpServletRequest.getAttribute(NOT_MOUNTED_PATH))) { + throw new AbortWithHttpErrorCodeException(404, httpServletRequest.getPathInfo() + " is not mounted to any Page"); + } else { + if (chain != null) { + httpServletRequest.setAttribute(NOT_MOUNTED_PATH, httpServletRequest.getPathInfo()); + chain.doFilter(httpServletRequest, httpServletResponse); + } + res = false; + } + return res; + } +} \ No newline at end of file diff --git a/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletRequestMapper.java b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletRequestMapper.java index ebe00e073a..637a13cca1 100644 --- a/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletRequestMapper.java +++ b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletRequestMapper.java @@ -1,258 +1,267 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.portlet; - -import java.util.Iterator; -import java.util.Map; - -import javax.portlet.MimeResponse; -import javax.portlet.PortletResponse; -import javax.portlet.PortletURL; -import javax.portlet.ResourceURL; -import javax.servlet.http.HttpServletRequest; - -import org.apache.wicket.Application; -import org.apache.wicket.IResourceListener; -import org.apache.wicket.RequestListenerInterface; -import org.apache.wicket.SystemMapper; -import org.apache.wicket.behavior.IBehaviorListener; -import org.apache.wicket.core.request.handler.BookmarkableListenerInterfaceRequestHandler; -import org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler; -import org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler; -import org.apache.wicket.core.request.handler.RenderPageRequestHandler; -import org.apache.wicket.core.request.mapper.AbstractComponentMapper; -import org.apache.wicket.portlet.request.mapper.PortletSystemMapper; -import org.apache.wicket.request.IRequestHandler; -import org.apache.wicket.request.Request; -import org.apache.wicket.request.Url; -import org.apache.wicket.request.cycle.RequestCycle; -import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler; -import org.apache.wicket.request.resource.IResource; -import org.apache.wicket.request.resource.PackageResource; -import org.apache.wicket.request.resource.SharedResourceReference; -import org.apache.wicket.util.crypt.Base64; - -/** - * This class is the default request mapper for portlets. It modifies the - * generated URLs (that are generated by the wrapped SystemMapper) depending on - * the type of the used request handler. Its purpose is to implement all portlet - * related functionality from WebRequestCodingStrategy, that was used in Wicket - * 1.4. - * - * @author Peter Pastrnak - * @author Konstantinos Karavitis - */ -public class PortletRequestMapper extends AbstractComponentMapper { - private SystemMapper systemMapper; - - public PortletRequestMapper(final Application application) { - systemMapper = new PortletSystemMapper(application); - } - - @Override - public IRequestHandler mapRequest(Request request) { - return systemMapper.mapRequest(request); - } - - @Override - public int getCompatibilityScore(Request request) { - return systemMapper.getCompatibilityScore(request); - } - - @Override - public Url mapHandler(IRequestHandler requestHandler) { - Url url = systemMapper.mapHandler(requestHandler); - if (ThreadPortletContext.getPortletRequest() == null || url == null) { - return url; - } - - if (requestHandler instanceof RenderPageRequestHandler) { - if (ThreadPortletContext.isAjax()) { - url = encodeRenderUrl(url, true); - } - } - else if (requestHandler instanceof SharedResourceReference) { - url = encodeSharedResourceUrl(url); - } - else if (requestHandler instanceof ResourceReferenceRequestHandler) { - ResourceReferenceRequestHandler resourceReferenceRequestHandler = (ResourceReferenceRequestHandler) requestHandler; - IResource resource = resourceReferenceRequestHandler.getResource(); - - if (resource instanceof PackageResource) { - url = encodeSharedResourceUrl(url); - } - else { - url = encodeResourceUrl(url); - } - } - else if (requestHandler instanceof BookmarkablePageRequestHandler) { - url = encodeRenderUrl(url, true); - } - //added mapping for request handlers with type of BookmarkableListenerInterfaceRequestHandler. The handling is the same as for handlers of type ListenerInterfaceRequestHandler - else if (requestHandler instanceof ListenerInterfaceRequestHandler || requestHandler instanceof BookmarkableListenerInterfaceRequestHandler) { - RequestListenerInterface listenerInterface; - - if (requestHandler instanceof ListenerInterfaceRequestHandler) { - listenerInterface = ((ListenerInterfaceRequestHandler) requestHandler).getListenerInterface(); - } - else { - listenerInterface = ((BookmarkableListenerInterfaceRequestHandler)requestHandler).getListenerInterface(); - } - - Class listenerClass = listenerInterface.getMethod().getDeclaringClass(); - if ((IResourceListener.class.isAssignableFrom(listenerClass)) || (IBehaviorListener.class.isAssignableFrom(listenerClass))) { - url = encodeResourceUrl(url); - } - else { - url = encodeActionUrl(url, ThreadPortletContext.isAjax()); - } - } - - return url; - } - - private String getQualifiedPath(String path) { - HttpServletRequest request = ThreadPortletContext.getHttpServletRequest(); - return request.getServletPath() + "/" + path; - } - - private Url parseUrl(String urlString) { - Url url = Url.parse(urlString); - - // to avoid UrlRenderer touching the url (shouldRenderAsFull) - url.setProtocol(null); - url.setHost(null); - url.setPort(null); - - return url; - } - - private Url encodeResourceUrl(Url url) { - if (url != null) { - String qualifiedPath = getQualifiedPath(url.toString()); - - PortletResponse portletResponse = ThreadPortletContext.getPortletResponse(); - if ((portletResponse != null) && (portletResponse instanceof MimeResponse)) { - try { - ResourceURL resourceUrl = ((MimeResponse) portletResponse).createResourceURL(); - resourceUrl.setResourceID(qualifiedPath); - qualifiedPath = resourceUrl.toString(); - - // resource URLs preserve all request render parameters (at - // least for Liferay even all POST parameters), so we have - // to remove all Wicket parameters (that have the portlet - // namespace), otherwise we would have all submited values - // in the URL - int queryStringSeparator = qualifiedPath.indexOf('?'); - if (queryStringSeparator > 0) { - Map parameterMap = Utils.parseQueryString(qualifiedPath.substring(queryStringSeparator + 1)); - - boolean changed = false; - Iterator> it = parameterMap.entrySet().iterator(); - String namespace = ThreadPortletContext.getNamespace(); - while (it.hasNext()) { - if (it.next().getKey().startsWith(namespace)) { - changed = true; - it.remove(); - } - } - if (changed) { - qualifiedPath = qualifiedPath.substring(0, queryStringSeparator) + '?' + Utils.buildQueryString(parameterMap); - } - } - } - catch (Exception e) { - throw new RuntimeException(e); - } - } - - url = parseUrl(qualifiedPath); - } - - return url; - } - - private Url encodeSharedResourceUrl(Url url) { - if (url != null) { - Request request = RequestCycle.get().getRequest(); - - StringBuilder urlBuilder = new StringBuilder(); - urlBuilder.append(request.getContextPath()); - urlBuilder.append(request.getFilterPath()); - urlBuilder.append(PortletFilter.SHARED_RESOURCE_URL_PORTLET_WINDOW_ID_PREFIX); - urlBuilder.append(Base64.encodeBase64URLSafeString(ThreadPortletContext.getWindowID().getBytes())); - urlBuilder.append('/'); - urlBuilder.append(url.toString()); - - url = Url.parse(urlBuilder.toString()); - } - - return url; - } - - private Url encodeActionUrl(Url url, boolean forceActionUrl) { - if ((!forceActionUrl) && (ThreadPortletContext.isResourceRequest())) { - return encodeResourceUrl(url); - } - - if (url != null) { - String qualifiedPath = getQualifiedPath(url.toString()); - - PortletResponse portletResponse = ThreadPortletContext.getPortletResponse(); - if ((portletResponse != null) && (portletResponse instanceof MimeResponse)) { - try { - PortletURL portletUrl = ((MimeResponse) portletResponse).createActionURL(); - portletUrl.setParameter(WicketPortlet.WICKET_URL_PORTLET_PARAMETER, qualifiedPath); - qualifiedPath = portletUrl.toString(); - } - catch (Exception e) { - throw new RuntimeException(e); - } - } - - url = parseUrl(qualifiedPath); - } - - return url; - } - - private Url encodeRenderUrl(Url url, boolean forceRenderUrl) { - if ((!forceRenderUrl) && (ThreadPortletContext.isResourceRequest())) { - return encodeResourceUrl(url); - } - - if (url != null) { - String qualifiedPath = getQualifiedPath(url.toString()); - - PortletResponse portletResponse = ThreadPortletContext.getPortletResponse(); - if ((portletResponse != null) && (portletResponse instanceof MimeResponse)) { - try { - PortletURL portletUrl = ((MimeResponse) portletResponse).createRenderURL(); - portletUrl.setParameter(WicketPortlet.WICKET_URL_PORTLET_PARAMETER + ThreadPortletContext.getPortletMode().toString(), qualifiedPath); - qualifiedPath = portletUrl.toString(); - } - catch (Exception e) { - throw new RuntimeException(e); - } - } - - url = parseUrl(qualifiedPath); - } - - return url; - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.portlet; + +import java.util.Iterator; +import java.util.Map; + +import javax.portlet.MimeResponse; +import javax.portlet.PortletRequest; +import javax.portlet.PortletResponse; +import javax.portlet.PortletURL; +import javax.portlet.ResourceURL; +import javax.servlet.http.HttpServletRequest; + +import org.apache.wicket.Application; +import org.apache.wicket.IResourceListener; +import org.apache.wicket.RequestListenerInterface; +import org.apache.wicket.SystemMapper; +import org.apache.wicket.behavior.IBehaviorListener; +import org.apache.wicket.core.request.handler.BookmarkableListenerInterfaceRequestHandler; +import org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler; +import org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler; +import org.apache.wicket.core.request.handler.RenderPageRequestHandler; +import org.apache.wicket.core.request.mapper.AbstractComponentMapper; +import org.apache.wicket.portlet.request.mapper.PortletSystemMapper; +import org.apache.wicket.request.IRequestHandler; +import org.apache.wicket.request.Request; +import org.apache.wicket.request.Url; +import org.apache.wicket.request.cycle.RequestCycle; +import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler; +import org.apache.wicket.request.resource.IResource; +import org.apache.wicket.request.resource.PackageResource; +import org.apache.wicket.request.resource.SharedResourceReference; +import org.apache.wicket.util.crypt.Base64; + +/** + * This class is the default request mapper for portlets. It modifies the + * generated URLs (that are generated by the wrapped SystemMapper) depending on + * the type of the used request handler. Its purpose is to implement all portlet + * related functionality from WebRequestCodingStrategy, that was used in Wicket + * 1.4. + * + * @author Peter Pastrnak + * @author Konstantinos Karavitis + */ +public class PortletRequestMapper extends AbstractComponentMapper { + + public static String PORTLET_URL = "portlet-url"; + + private SystemMapper systemMapper; + + public PortletRequestMapper(final Application application) { + systemMapper = new PortletSystemMapper(application); + } + + @Override + public IRequestHandler mapRequest(Request request) { + return systemMapper.mapRequest(request); + } + + @Override + public int getCompatibilityScore(Request request) { + return systemMapper.getCompatibilityScore(request); + } + + @Override + public Url mapHandler(IRequestHandler requestHandler) { + Url url = systemMapper.mapHandler(requestHandler); + if (ThreadPortletContext.getPortletRequest() == null || url == null) { + return url; + } + + if (requestHandler instanceof RenderPageRequestHandler) { + if (PortletRequest.RESOURCE_PHASE.equals(ThreadPortletContext.getPortletRequest().getAttribute(PortletRequest.LIFECYCLE_PHASE))) { + url = encodeRenderUrl(url, true); + } + } + else if (requestHandler instanceof SharedResourceReference) { + url = encodeSharedResourceUrl(url); + } + else if (requestHandler instanceof ResourceReferenceRequestHandler) { + ResourceReferenceRequestHandler resourceReferenceRequestHandler = (ResourceReferenceRequestHandler) requestHandler; + IResource resource = resourceReferenceRequestHandler.getResource(); + + if (resource instanceof PackageResource) { + url = encodeSharedResourceUrl(url); + } + else { + url = encodeResourceUrl(url); + } + } + else if (requestHandler instanceof BookmarkablePageRequestHandler) { + url = encodeRenderUrl(url, true); + } + //added mapping for request handlers with type of BookmarkableListenerInterfaceRequestHandler. The handling is the same as for handlers of type ListenerInterfaceRequestHandler + else if (requestHandler instanceof ListenerInterfaceRequestHandler || requestHandler instanceof BookmarkableListenerInterfaceRequestHandler) { + RequestListenerInterface listenerInterface; + + if (requestHandler instanceof ListenerInterfaceRequestHandler) { + listenerInterface = ((ListenerInterfaceRequestHandler) requestHandler).getListenerInterface(); + } + else { + listenerInterface = ((BookmarkableListenerInterfaceRequestHandler)requestHandler).getListenerInterface(); + } + + Class listenerClass = listenerInterface.getMethod().getDeclaringClass(); + if ((IResourceListener.class.isAssignableFrom(listenerClass)) || (IBehaviorListener.class.isAssignableFrom(listenerClass))) { + url = encodeResourceUrl(url); + } + else { + url = encodeActionUrl(url, ThreadPortletContext.isAjax()); + } + } + + return url; + } + + private String getQualifiedPath(String path) { + HttpServletRequest request = ThreadPortletContext.getHttpServletRequest(); + return request.getServletPath() + "/" + path; + } + + private Url parseUrl(String urlString) { + Url url = Url.parse(urlString); + + // to avoid UrlRenderer touching the url (shouldRenderAsFull) + url.setProtocol(null); + url.setHost(null); + url.setPort(null); + + return url; + } + + private Url encodeResourceUrl(Url url) { + if (url != null) { + String qualifiedPath = getQualifiedPath(url.toString()); + + PortletResponse portletResponse = ThreadPortletContext.getPortletResponse(); + if ((portletResponse != null) && (portletResponse instanceof MimeResponse)) { + try { + ResourceURL resourceUrl = ((MimeResponse) portletResponse).createResourceURL(); + resourceUrl.setResourceID(qualifiedPath); + qualifiedPath = resourceUrl.toString(); + + // resource URLs preserve all request render parameters (at + // least for Liferay even all POST parameters), so we have + // to remove all Wicket parameters (that have the portlet + // namespace), otherwise we would have all submited values + // in the URL + int queryStringSeparator = qualifiedPath.indexOf('?'); + if (queryStringSeparator > 0) { + Map parameterMap = Utils.parseQueryString(qualifiedPath.substring(queryStringSeparator + 1)); + + boolean changed = false; + Iterator> it = parameterMap.entrySet().iterator(); + String namespace = ThreadPortletContext.getNamespace(); + while (it.hasNext()) { + if (it.next().getKey().startsWith(namespace)) { + changed = true; + it.remove(); + } + } + if (changed) { + qualifiedPath = qualifiedPath.substring(0, queryStringSeparator) + '?' + Utils.buildQueryString(parameterMap); + } + } + } + catch (Exception e) { + throw new RuntimeException(e); + } + } + + url = parseUrl(qualifiedPath); + } + + return markAsPortletUrl(url); + } + + private Url encodeSharedResourceUrl(Url url) { + if (url != null) { + Request request = RequestCycle.get().getRequest(); + + StringBuilder urlBuilder = new StringBuilder(); + urlBuilder.append(request.getContextPath()); + urlBuilder.append(request.getFilterPath()); + urlBuilder.append(PortletFilter.SHARED_RESOURCE_URL_PORTLET_WINDOW_ID_PREFIX); + urlBuilder.append(Base64.encodeBase64URLSafeString(ThreadPortletContext.getWindowID().getBytes())); + urlBuilder.append('/'); + urlBuilder.append(url.toString()); + + url = Url.parse(urlBuilder.toString()); + } + + return url; + } + + private Url encodeActionUrl(Url url, boolean forceActionUrl) { + if ((!forceActionUrl) && (ThreadPortletContext.isResourceRequest())) { + return encodeResourceUrl(url); + } + + if (url != null) { + String qualifiedPath = getQualifiedPath(url.toString()); + + PortletResponse portletResponse = ThreadPortletContext.getPortletResponse(); + if ((portletResponse != null) && (portletResponse instanceof MimeResponse)) { + try { + PortletURL portletUrl = ((MimeResponse) portletResponse).createActionURL(); + portletUrl.setParameter(WicketPortlet.WICKET_URL_PORTLET_PARAMETER, qualifiedPath); + qualifiedPath = portletUrl.toString(); + } + catch (Exception e) { + throw new RuntimeException(e); + } + } + + url = parseUrl(qualifiedPath); + } + + return markAsPortletUrl(url); + } + + private Url encodeRenderUrl(Url url, boolean forceRenderUrl) { + if ((!forceRenderUrl) && (ThreadPortletContext.isResourceRequest())) { + return encodeResourceUrl(url); + } + + if (url != null) { + String qualifiedPath = getQualifiedPath(url.toString()); + + PortletResponse portletResponse = ThreadPortletContext.getPortletResponse(); + if ((portletResponse != null) && (portletResponse instanceof MimeResponse)) { + try { + PortletURL portletUrl = ((MimeResponse) portletResponse).createRenderURL(); + portletUrl.setParameter(WicketPortlet.WICKET_URL_PORTLET_PARAMETER + ThreadPortletContext.getPortletMode().toString(), qualifiedPath); + qualifiedPath = portletUrl.toString(); + } + catch (Exception e) { + throw new RuntimeException(e); + } + } + + url = parseUrl(qualifiedPath); + } + + return markAsPortletUrl(url); + } + + private Url markAsPortletUrl(Url url) { + url.setQueryParameter(PORTLET_URL, PORTLET_URL); + return url; + } +} diff --git a/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletUrlRenderer.java b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletUrlRenderer.java index ba6e1d3e54..afddd9acc3 100644 --- a/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletUrlRenderer.java +++ b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/PortletUrlRenderer.java @@ -3,9 +3,11 @@ import javax.portlet.PortletRequest; import org.apache.wicket.request.Request; +import org.apache.wicket.request.Url; import org.apache.wicket.request.UrlRenderer; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.PrependingStringBuffer; +import org.apache.wicket.util.string.Strings; /** *

{@link UrlRenderer} for Portlet Applications.

@@ -34,6 +36,10 @@ */ public class PortletUrlRenderer extends UrlRenderer { + + + private Request request; + /** * @param request * @@ -43,6 +49,7 @@ public class PortletUrlRenderer extends UrlRenderer public PortletUrlRenderer(Request request) { super(request); + this.request = request; PortletRequest portletRequest = ThreadPortletContext.getPortletRequest(); String lifecyclePhase = (String) portletRequest.getAttribute(PortletRequest.LIFECYCLE_PHASE); @@ -67,4 +74,57 @@ public String renderContextRelativeUrl(String url) return buffer.toString(); } + + /** + * Renders the Url + * + * @param url + * @return Url rendered as string + */ + public String renderUrl(final Url url) + { + + if (url.getQueryParameter(PortletRequestMapper.PORTLET_URL) != null) { + url.removeQueryParameters(PortletRequestMapper.PORTLET_URL); + return url.toString(); + } + + CharSequence renderedUrl = super.renderUrl(url); + + Url absoluteUrl = Url.parse(renderedUrl); + Url clientUrl = request.getClientUrl(); + if (!shouldRedirectToExternalUrl(absoluteUrl, clientUrl)) { + if (absoluteUrl.getProtocol() != null) { + renderedUrl = Strings.replaceAll(renderedUrl, absoluteUrl.getProtocol() + "://", "/"); + } + if (absoluteUrl.getHost() != null) { + renderedUrl = Strings.replaceAll(renderedUrl, "/" + absoluteUrl.getHost(), "/"); + } + if (absoluteUrl.getPort() != null) { + renderedUrl = Strings.replaceAll(renderedUrl, "/:" + absoluteUrl.getPort(), "/"); + + } + renderedUrl = Strings.replaceAll(renderedUrl, "//", "/"); + } + + return renderedUrl.toString(); + } + + private boolean shouldRedirectToExternalUrl(Url url, Url clientUrl) + { + if (!Strings.isEmpty(url.getProtocol()) && !url.getProtocol().equals(clientUrl.getProtocol())) + { + return true; + } + if (!Strings.isEmpty(url.getHost()) && !url.getHost().equals(clientUrl.getHost())) + { + return true; + } + if ((url.getPort() != null) && !url.getPort().equals(clientUrl.getPort())) + { + return true; + } + + return false; + } } \ No newline at end of file diff --git a/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/WicketPortlet.java b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/WicketPortlet.java index 6c5f881cb6..f3d4a53afc 100644 --- a/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/WicketPortlet.java +++ b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/WicketPortlet.java @@ -1,719 +1,722 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.portlet; - -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.regex.Pattern; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.GenericPortlet; -import javax.portlet.MimeResponse; -import javax.portlet.PortletConfig; -import javax.portlet.PortletException; -import javax.portlet.PortletMode; -import javax.portlet.PortletRequest; -import javax.portlet.PortletRequestDispatcher; -import javax.portlet.PortletResponse; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.portlet.ResourceRequest; -import javax.portlet.ResourceResponse; -import javax.servlet.RequestDispatcher; - -import org.apache.wicket.protocol.http.WicketFilter; -import org.apache.wicket.util.file.File; -import org.apache.wicket.util.string.Strings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Adapter between the Portlet world requests and the internal Wicket engine. - * I.e. simulates the web/servlet environment for Wicket, while it's actually - * running as a Portlet. - * - *

- * It receives a portlet request and dispatches to a a Wicket filter; wrapping - * the servlet context, request and response objects; intercepts response - * writing (especially urls and redirects) and rewrites and adapts the output to - * accommodate the portlet requirements. - * - *

- * The WicketPortlet is configured (using an initParameter) against a specific - * filter path, e.g. Wicket WebApplication. The WicketPortlet maintains a - * parameter for the current Wicket page URL being requested as a URL parameter, - * based against the filter path (e.g. fully qualified to the context path). - * When a request (action, render or direct resource/ajax call) is received by - * the WicketPortlet, it dispatches it to Wicket core as a filter request using - * the provided Wicket page URL parameter. - * - * @see WicketPortlet#WICKET_URL_PORTLET_PARAMETER - * @see WicketFilter - * - * @author Ate Douma - * @author Sebastian Thomschke - * @author Peter Pastrnak - * @author Konstantinos Karavitis - */ -public class WicketPortlet extends GenericPortlet { - private static final Pattern PROTECTED_RESOURCES = Pattern.compile("\\A\\s*[/\\\\]*\\s*(WEB|META)[-]INF(.*)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); - - private static final Pattern ABSOLUTE_URI_PATTERN = Pattern.compile("([a-z][a-z0-9]*://|/).*"); - - public static enum PageType { - ACTION("actionPage"), // - CUSTOM("customPage"), // - EDIT("editPage"), // - HELP("helpPage"), // - VIEW("viewPage"); - - public static PageType getByInitParameterName(final String initParameterName) { - for (final PageType p : PageType.values()) - if (p.initParameterName.equals(initParameterName)) - return p; - return null; - } - - public final String initParameterName; - - PageType(final String initParameterName) { - this.initParameterName = initParameterName; - } - } - - private static final Logger LOG = LoggerFactory.getLogger(WicketPortlet.class); - - /** - * FIXME javadoc - * - *

- * The prefix for the parameter name for storing Wicket URLs. - * - *

- * The actual Wicket URLs generated by Wicket are passed around in portal - * URLs, encoded by the portal (as a URL parameter of this name). The Wicket - * URL is later decoded on subsequent requests, from the portal URL, so that - * we know where to route the request, once it's passed out of the 'portal' - * realm and into the 'Wicket' realm. - * - *

- * This is also used in generating links by {@link PortletRequestContext} in - * generating links, as the links have to be portal encoded links, but must - * also still contain the original wicket url for use by Wicket (e.g. - * {@link PortletRequestContext#encodeActionURL}). - * - *

- * The default/buildin name of the parameter which stores the name of the - * wicket url is stored under {@link #WICKET_URL_PORTLET_PARAMETER}. It will - * be stored suffixed with the current portlet mode (e.g. view), so that - * render requests know what mode to render. - * - * @see PortletRequestContext - */ - public static final String WICKET_URL_PORTLET_PARAMETER = "_wu"; - - /** - * FIXME javadoc - */ - public static final String WICKET_FILTER_PATH_PARAM = "wicketFilterPath"; - /** - * FIXME javadoc - */ - public static final String RESPONSE_BUFFER_FOLDER_PARAM = "responseBufferFolder"; - /** - * FIXME javadoc - */ - public static final String CONFIG_PARAM_PREFIX = WicketPortlet.class.getName() + "."; - /** - * Marker used as key for the ResponseState object stored as a request - * attribute. - */ - public static final String RESPONSE_STATE_ATTR = ResponseState.class.getName(); - /** FIXME javadoc */ - public static final String WICKET_PORTLET_PROPERTIES = WicketPortlet.class.getName().replace('.', '/') + ".properties"; - - /** FIXME javadoc */ - private String wicketFilterPath; - - /** FIXME javadoc */ - private File responseBufferFolder; - - /** - * A collection of the default URL's for the different view modes of the - * portlet - e.g. VIEW, EDIT, HELP etc... - */ - private final HashMap defaultPages = new HashMap(); - - protected String buildWicketFilterPath(String filterPath) { - if (filterPath == null || filterPath.length() == 0) - return "/"; - - if (!filterPath.startsWith("/")) - filterPath = "/" + filterPath; - if (filterPath.endsWith("*")) - filterPath = filterPath.substring(0, filterPath.length() - 1); - if (!filterPath.endsWith("/")) - filterPath += "/"; - - return filterPath; - } - - /** - * Delegates to - * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. - * - * @see #processRequest(PortletRequest, PortletResponse, String, String) - */ - protected void doCustom(final RenderRequest request, final RenderResponse response) throws PortletException, IOException { - processRequest(request, response, PageType.CUSTOM); - } - - /** - * Delegates to - * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. - * - * @see #processRequest(PortletRequest, PortletResponse, String, String) - */ - @Override - protected void doEdit(final RenderRequest request, final RenderResponse response) throws PortletException, IOException { - processRequest(request, response, PageType.EDIT); - } - - /** - * Delegates to - * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. - * - * @see #processRequest(PortletRequest, PortletResponse, String, String) - */ - @Override - protected void doHelp(final RenderRequest request, final RenderResponse response) throws PortletException, IOException { - processRequest(request, response, PageType.HELP); - } - - /** - * Delegates to - * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. - * - * @see #processRequest(PortletRequest, PortletResponse, String, String) - */ - @Override - protected void doView(final RenderRequest request, final RenderResponse response) throws PortletException, IOException { - processRequest(request, response, PageType.VIEW); - } - - /** - * @param pageType - * the mode of the portlet page, e.g. VIEW, EDIT etc... - * @return the default page name for the given pate type. - */ - protected String getDefaultPage(final PageType pageType) { - return defaultPages.get(pageType); - } - - /** - * Loads the Wicket Portlet properties file off the class path. - * - * FIXME javadoc - check properties - * - * @param properties - * appends the portlet properties to - * @return Wicket portlet properties. Returns an empty or unchanged - * properties object if Wicket Portlet properties could not be found - * @throws PortletException - * if loading the properties fails - */ - protected Properties getWicketPortletProperties(Properties properties) throws PortletException { - if (properties == null) - properties = new Properties(); - final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(WICKET_PORTLET_PROPERTIES); - if (is != null) - try { - properties.load(is); - } - catch (final IOException e) { - throw new PortletException("Failed to load WicketPortlet.properties from classpath", e); - } - return properties; - } - - /** - * Retrieves the Wicket URL from the request object as a request parameter, - * or if none exists returns the default URL. The name of the request - * parameter is stored as a request attribute. - * - *

- * This url is then used to pass on to the matching {@link WicketFilter} to - * process, by way of {@link RequestDispatcher} via the filters context - * path. - * - *

- * A "parameter" is a form field name/value pair passed from the HTML side - * of the world. Its value is a String. - * - *

- * An "attribute" is a Java object name/value pair passed only through the - * internal JavaServer processes. (I.e. it can come from a JSP or servlet - * but not an HTML page.) Its value is an Object. - * - * @see PortletRequestContext#getLastEncodedPath() - * @param request - * @param pageType - * @param defaultPage - * url of the default page - * @return the Wicket URL from within the specified request - */ - protected String getWicketURL(final PortletRequest request, final PageType pageType, final String defaultPage) { - String wicketURL = null; - if (request instanceof ActionRequest) - // try to lookup the passed in wicket url parameter - wicketURL = request.getParameter(WICKET_URL_PORTLET_PARAMETER); - else if (request instanceof ResourceRequest) - wicketURL = ((ResourceRequest) request).getResourceID(); - else { - // try to lookup the passed in wicket url parameter, suffixed with - // the portlet mode - String redirectUrlKey = WICKET_URL_PORTLET_PARAMETER + request.getPortletMode().toString(); - String redirectUrl = request.getParameter(redirectUrlKey); - // if the wicket url is not in request parameters try to lookup into the action scoped - // attributes. - wicketURL = redirectUrl == null ? (String)request.getAttribute(redirectUrlKey) : redirectUrl; - } - - // if the wicketURL could not be retrieved, return the url for the - // default page - if (wicketURL == null) - wicketURL = defaultPage; - return wicketURL; - } - - /** - * {@inheritDoc} - */ - @Override - public void init(final PortletConfig config) throws PortletException { - // enable action-scoped request attributes support (see JSR286 specification PLT.10.4.4) - config.getContainerRuntimeOptions().put("javax.portlet.actionScopedRequestAttributes", - new String[] { "true", "numberOfCachedScopes", "10" }); - super.init(config); - - wicketFilterPath = buildWicketFilterPath(config.getInitParameter(WICKET_FILTER_PATH_PARAM)); - String responseBufferFolderPath = config.getInitParameter(RESPONSE_BUFFER_FOLDER_PARAM); - if ((responseBufferFolderPath != null) && (!Strings.isEmpty(responseBufferFolderPath))) { - responseBufferFolder = new File(responseBufferFolderPath); - } - - for (final PageType p : PageType.values()) { - defaultPages.put(p, config.getInitParameter(p.initParameterName)); - } - - validateDefaultPages(defaultPages); - } - - /** - * Delegates to - * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. - * - *

- * Stores the {@link ActionResponse} so that - * {@link PortletEventService#broadcast} can send events using - * {@link ActionResponse#setEvent} - * - * @see PortletEventService#broadcastToPortletListeners - * @see #processRequest(PortletRequest, PortletResponse, String, String) - */ - @Override - public void processAction(final ActionRequest request, final ActionResponse response) throws PortletException, IOException { - processRequest(request, response, PageType.ACTION); - } - - /** - * Handles redirects set from processing the action. Checks the response - * state after the action has been processed by Wicket for the presence of a - * redirect URL, and if present, 'portletifies' the URL. If the URL is a - * redirect to within the scope of this portlet, leaves it to be handled in - * a subsequent render call, or if not, sends the redirect to the client. - * The recorded url is then used in by wicket in the subsequnt 'VIEW' - * requests by the portal, to render the correct Page. - * - * @see IRequestCycleSettings#REDIRECT_TO_RENDER - * @param wicketURL - * @param request - * @param response - * @param responseState - * @throws PortletException - * @throws IOException - */ - protected void processActionResponseState(String wicketURL, final PortletRequest request, final ActionResponse response, final ResponseState responseState) throws PortletException, IOException { - // write out Cookies to ActionResponse - responseState.flushAndClose(); - String redirectLocationUrl = responseState.getRedirectLocation(); - if (LOG.isDebugEnabled()) - LOG.debug("redirectURL after include:" + redirectLocationUrl); - if (redirectLocationUrl != null && !redirectLocationUrl.isEmpty()) { - redirectLocationUrl = fixWicketUrl(wicketURL, redirectLocationUrl); - if (redirectLocationUrl.startsWith(wicketFilterPath)) { - final String portletMode = request.getPortletMode().toString(); - final String redirectUrlKey = WICKET_URL_PORTLET_PARAMETER + portletMode; - // put the redirect location into the "_wuview" action scoped request attribute - request.setAttribute(redirectUrlKey, redirectLocationUrl); - } - else - response.sendRedirect(redirectLocationUrl); - } - } - - /** - * Loops until wicket processing does not result in a redirect (redirects - * have to be caught, and fed back into Wicket as we only want the portlet - * redirected, not the entire page of course). - * - * @param request - * @param response - * @param requestType - * @param wicketURL - * @param responseState - * @throws PortletException - * @throws IOException - */ - private void processMimeResponseRequest(String wicketURL, final PortletRequest request, final MimeResponse response, final ResponseState responseState) throws PortletException, IOException { - PortletRequestDispatcher rd = null; - String previousURL = null; - // FIXME portal comment: explain while loop - // keep looping until wicket processing does not result in a redirect - // (redirects have to - // be caught, and fed back into Wicket as we only want the portlet - // redirected, not the - // entire page of course. - while (true) { - rd = getPortletContext().getRequestDispatcher(wicketURL); - if (rd != null) { - // Need to use RequestDispatcher.include here otherwise - // internally rewinding on a - // redirect - // won't be allowed (calling forward will close the response) - rd.include(request, response); - - // process _other_ response states - check for redirects as a - // result of wicket - // processing the request - - String redirectLocation = responseState.getRedirectLocation(); - String ajaxRedirectLocation = responseState.getAjaxRedirectLocation(); - if (ajaxRedirectLocation != null) { - // Ajax redirect - ajaxRedirectLocation = fixWicketUrl(wicketURL, ajaxRedirectLocation); - responseState.clear(); - responseState.setDateHeader("Date", System.currentTimeMillis()); - responseState.setDateHeader("Expires", 0); - responseState.setHeader("Pragma", "no-cache"); - responseState.setHeader("Cache-Control", "no-cache, no-store"); - //client side javascript needs the Ajax-Location header see wicket-ajax-jquery.js line 771 - responseState.setHeader("Ajax-Location", ajaxRedirectLocation);// - responseState.setContentType("text/xml;charset=UTF-8"); - responseState.getWriter().write( - ""); - responseState.flushAndClose(); - } - else if (redirectLocation != null) { - // TODO: check if its redirect to wicket page (find _wu or - // _wuPortletMode or resourceId parameter) - - redirectLocation = fixWicketUrl(wicketURL, redirectLocation); - - final boolean validWicketUrl = redirectLocation.startsWith(wicketFilterPath); - if (validWicketUrl) { - if (previousURL == null || previousURL != redirectLocation) { - previousURL = wicketURL; - wicketURL = redirectLocation; - ((RenderResponse) response).reset(); - responseState.clear(); - continue; - } - else { - // internal Wicket redirection loop: unsure yet what - // to send out from - // here - // TODO: determine what kind of error (message or - // page) should be - // written out - // for now: no output available/written :( - responseState.clear(); - break; - } - } - else { - responseState.clear(); - if (responseState.isResourceResponse()) { - // Formally, the Portlet 2.0 Spec doesn't support - // directly redirecting - // from serveResource. However, it is possible to - // write response headers - // to the ResourceResponse (using setProperty), - // which means the - // technical implementation of a response.redirect - // call might be - // "simulated" by writing out: - - // a) setting response.setStatus(SC_FOUND) - // b) setting header "Location" to the - // redirectLocation - - // Caveat 1: - // ResourceResponse.setStatus isn't supported - // either, but this can be - // done by setting the header property - // ResourceResponse.HTTP_STATUS_CODE - - // Caveat 2: Actual handling of Response headers as - // set through - // PortletResponse.setProperty is completely - // optional by the Portlet - // Spec so it really depends on the portlet - // container implementation - // (and environment, e.g. consider using WSRP - // here...) if this will - // work. - - // On Apache Pluto/Jetspeed-2, the above descibed - // handling *will* be - // implemented as expected! - - // HttpServletResponse.SC_FOUND == 302, defined by - // Servlet API >= 2.4 - response.setProperty(ResourceResponse.HTTP_STATUS_CODE, Integer.toString(302)); - response.setProperty("Location", redirectLocation); - } - else { - response.reset(); - response.setProperty("expiration-cache", "0"); - - PrintWriter writer = response.getWriter(); - writer.append(""); - writer.append(""); - writer.append(""); - writer.close(); - break; - } - } - } - else { - if (LOG.isDebugEnabled()) { - LOG.debug("ajax redirect url after inclusion:" + redirectLocation); - } - // write response state out to the PortletResponse - responseState.flushAndClose(); - } - } - break; - } - } - - /** - * Consumes and processes all portlet requests. All the doX methods delegate - * to this method, including processAction and serveResource. - * - * @param request - * @param response - * @param requestType - * @param pageType - * @throws PortletException - * @throws IOException - */ - protected void processRequest(final PortletRequest request, final PortletResponse response, final PageType pageType) throws PortletException, IOException { - String wicketURL = null; - - // get the actual wicketURL for this request, to be passed onto Wicket - // core for processing - wicketURL = getWicketURL(request, pageType, getDefaultPage(pageType)); - - if (LOG.isDebugEnabled()) - LOG.debug("Portlet \"" + request.getAttribute(PortletRequest.LIFECYCLE_PHASE) + "\" for wicket url:" + wicketURL); - - // store the response state and request type in the request object, so - // they can be looked up - // from a different context - final ResponseState responseState = new ResponseState(request, response, responseBufferFolder); - request.setAttribute(RESPONSE_STATE_ATTR, responseState); - - // need to record the effective wicket url of the rendered result, so - // that the subsequent - // portlet 'view' requests can delegate to wicket to render the correct - // location/wicket url. - if (responseState.isActionResponse()) { - // create the request dispatcher, to delegate the request to the - // wicket filter - final PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(wicketURL); - - if (rd != null) { - // delegate to wicket filter - this is where the magic happens - rd.include(request, response); - // String newWicketURL = getWicketURL(request, pageType, - // getDefaultPage(pageType)); - LOG.debug("wicket filter inclusion complete"); - processActionResponseState(wicketURL, request, (ActionResponse) response, responseState); - } - else { - // FIXME - throw exception? - // no-op for now - } - } - else if (responseState.isMimeResponse()) - processMimeResponseRequest(wicketURL, request, (MimeResponse) response, responseState); - else - LOG.warn("Unsupported Portlet lifecycle: {}", request.getAttribute(PortletRequest.LIFECYCLE_PHASE)); - if (LOG.isDebugEnabled()) { - wicketURL = getWicketURL(request, pageType, getDefaultPage(pageType)); - LOG.debug("end of request, wicket url: " + wicketURL); - } - } - - /** - * Delegates to - * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. - * - * @see #processRequest(PortletRequest, PortletResponse, String, String) - */ - @Override - public void serveResource(final ResourceRequest request, final ResourceResponse response) throws PortletException, IOException { - String resourceId = request.getResourceID(); - if (resourceId != null) { - if (PROTECTED_RESOURCES.matcher(resourceId).matches()) { - response.setProperty(ResourceResponse.HTTP_STATUS_CODE, "404"); - } - processRequest(request, response, PageType.VIEW); - } - } - - /** - * FIXME javadoc - * - *

- * Corrects the incoming URL if the old home page style, or if it's missing - * the filter path prefix. - * - * @param url - * the URL to fix - * @return the corrected URL - */ - protected String fixWicketUrl(final String url) { - if (url == null) - return wicketFilterPath; - - if (!url.startsWith(wicketFilterPath)) { - if (url.startsWith("..?")) { - return wicketFilterPath + url.substring(2); - } - if ((url + "/").equals(wicketFilterPath)) { - // hack around "old" style wicket home url's without trailing - // '/' which would lead - // to a redirect to the real home path anyway - return wicketFilterPath; - } - } - return url; - } - - /** - * FIXME javadoc - * - *

- * Corrects the incoming URL if the old home page style, or if it's missing - * the filter path prefix. - * - * @param requestUrl - * the original request URL - * @param url - * the URL to fix - * @return the corrected URL - */ - protected String fixWicketUrl(final String requestUrl, final String url) { - if ((url != null) && (requestUrl != null) && (!ABSOLUTE_URI_PATTERN.matcher(url).matches())) { - try { - if (!requestUrl.startsWith("http")) { - return new URL(new URL("http:" + requestUrl), url).toString().substring(5); - } - else { - return new URL(new URL(requestUrl), url).getPath(); - } - } - catch (Exception e) { - } - } - return fixWicketUrl(url); - } - - /** - * FIXME javadoc - * - *

- * Registers the default pages and their URLs for the different - * {@link PortletMode}s. Also corrects and slightly incorrect URLs (see - * {@link #fixWicketUrl(String)}). - * - *

- * If no specific page was specified for a given portlet mode (VIEW, EDIT - * etc) then the page for that mode is set to be the same page as that of - * the VIEW mode. - * - * @see PortletMode - * @see #fixWicketUrl(String) - * @param defaultPages - */ - protected void validateDefaultPages(final Map defaultPages) { - final String viewPage = fixWicketUrl(defaultPages.get(PageType.VIEW)); - defaultPages.put(PageType.VIEW, viewPage.startsWith(wicketFilterPath) ? viewPage : wicketFilterPath); - - String defaultPage = defaultPages.get(PageType.ACTION); - if (defaultPage == null) - defaultPages.put(PageType.ACTION, viewPage); - else { - defaultPage = fixWicketUrl(defaultPage); - defaultPages.put(PageType.ACTION, defaultPage.startsWith(wicketFilterPath) ? defaultPage : viewPage); - } - - defaultPage = defaultPages.get(PageType.CUSTOM); - if (defaultPage == null) - defaultPages.put(PageType.CUSTOM, viewPage); - else { - defaultPage = fixWicketUrl(defaultPage); - defaultPages.put(PageType.CUSTOM, defaultPage.startsWith(wicketFilterPath) ? defaultPage : viewPage); - } - - defaultPage = defaultPages.get(PageType.HELP); - if (defaultPage == null) - defaultPages.put(PageType.HELP, viewPage); - else { - defaultPage = fixWicketUrl(defaultPage); - defaultPages.put(PageType.HELP, defaultPage.startsWith(wicketFilterPath) ? defaultPage : viewPage); - } - - defaultPage = defaultPages.get(PageType.EDIT); - if (defaultPage == null) - defaultPages.put(PageType.EDIT, viewPage); - else { - defaultPage = fixWicketUrl(defaultPage); - defaultPages.put(PageType.EDIT, defaultPage.startsWith(wicketFilterPath) ? defaultPage : viewPage); - } - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.portlet; + +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.regex.Pattern; + +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; +import javax.portlet.GenericPortlet; +import javax.portlet.MimeResponse; +import javax.portlet.PortletConfig; +import javax.portlet.PortletException; +import javax.portlet.PortletMode; +import javax.portlet.PortletRequest; +import javax.portlet.PortletRequestDispatcher; +import javax.portlet.PortletResponse; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; +import javax.portlet.ResourceRequest; +import javax.portlet.ResourceResponse; +import javax.servlet.RequestDispatcher; + +import org.apache.commons.fileupload.portlet.PortletRequestContext; +import org.apache.wicket.protocol.http.WicketFilter; +import org.apache.wicket.util.file.File; +import org.apache.wicket.util.string.Strings; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Adapter between the Portlet world requests and the internal Wicket engine. + * I.e. simulates the web/servlet environment for Wicket, while it's actually + * running as a Portlet. + * + *

+ * It receives a portlet request and dispatches to a a Wicket filter; wrapping + * the servlet context, request and response objects; intercepts response + * writing (especially urls and redirects) and rewrites and adapts the output to + * accommodate the portlet requirements. + * + *

+ * The WicketPortlet is configured (using an initParameter) against a specific + * filter path, e.g. Wicket WebApplication. The WicketPortlet maintains a + * parameter for the current Wicket page URL being requested as a URL parameter, + * based against the filter path (e.g. fully qualified to the context path). + * When a request (action, render or direct resource/ajax call) is received by + * the WicketPortlet, it dispatches it to Wicket core as a filter request using + * the provided Wicket page URL parameter. + * + * @see WicketPortlet#WICKET_URL_PORTLET_PARAMETER + * @see WicketFilter + * + * @author Ate Douma + * @author Sebastian Thomschke + * @author Peter Pastrnak + * @author Konstantinos Karavitis + */ +public class WicketPortlet extends GenericPortlet { + private static final Pattern PROTECTED_RESOURCES = Pattern.compile("\\A\\s*[/\\\\]*\\s*(WEB|META)[-]INF(.*)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); + + private static final Pattern ABSOLUTE_URI_PATTERN = Pattern.compile("([a-z][a-z0-9]*://|/).*"); + + public static enum PageType { + ACTION("actionPage"), // + CUSTOM("customPage"), // + EDIT("editPage"), // + HELP("helpPage"), // + VIEW("viewPage"); + + public static PageType getByInitParameterName(final String initParameterName) { + for (final PageType p : PageType.values()) { + if (p.initParameterName.equals(initParameterName)) { + return p; + } + } + return null; + } + + public final String initParameterName; + + PageType(final String initParameterName) { + this.initParameterName = initParameterName; + } + } + + private static final Logger LOG = LoggerFactory.getLogger(WicketPortlet.class); + + /** + * FIXME javadoc + * + *

+ * The prefix for the parameter name for storing Wicket URLs. + * + *

+ * The actual Wicket URLs generated by Wicket are passed around in portal + * URLs, encoded by the portal (as a URL parameter of this name). The Wicket + * URL is later decoded on subsequent requests, from the portal URL, so that + * we know where to route the request, once it's passed out of the 'portal' + * realm and into the 'Wicket' realm. + * + *

+ * This is also used in generating links by {@link PortletRequestContext} in + * generating links, as the links have to be portal encoded links, but must + * also still contain the original wicket url for use by Wicket (e.g. + * {@link PortletRequestContext#encodeActionURL}). + * + *

+ * The default/buildin name of the parameter which stores the name of the + * wicket url is stored under {@link #WICKET_URL_PORTLET_PARAMETER}. It will + * be stored suffixed with the current portlet mode (e.g. view), so that + * render requests know what mode to render. + * + * @see PortletRequestContext + */ + public static final String WICKET_URL_PORTLET_PARAMETER = "_wu"; + + /** + * FIXME javadoc + */ + public static final String WICKET_FILTER_PATH_PARAM = "wicketFilterPath"; + /** + * FIXME javadoc + */ + public static final String RESPONSE_BUFFER_FOLDER_PARAM = "responseBufferFolder"; + /** + * FIXME javadoc + */ + public static final String CONFIG_PARAM_PREFIX = WicketPortlet.class.getName() + "."; + /** + * Marker used as key for the ResponseState object stored as a request + * attribute. + */ + public static final String RESPONSE_STATE_ATTR = ResponseState.class.getName(); + /** FIXME javadoc */ + public static final String WICKET_PORTLET_PROPERTIES = WicketPortlet.class.getName().replace('.', '/') + ".properties"; + + /** FIXME javadoc */ + private String wicketFilterPath; + + /** FIXME javadoc */ + private File responseBufferFolder; + + /** + * A collection of the default URL's for the different view modes of the + * portlet - e.g. VIEW, EDIT, HELP etc... + */ + private final HashMap defaultPages = new HashMap<>(); + + protected String buildWicketFilterPath(String filterPath) { + if (filterPath == null || filterPath.length() == 0) { + return "/"; + } + + if (!filterPath.startsWith("/")) { + filterPath = "/" + filterPath; + } + if (filterPath.endsWith("*")) { + filterPath = filterPath.substring(0, filterPath.length() - 1); + } + if (!filterPath.endsWith("/")) { + filterPath += "/"; + } + + return filterPath; + } + + /** + * Delegates to + * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. + * + * @see #processRequest(PortletRequest, PortletResponse, String, String) + */ + protected void doCustom(final RenderRequest request, final RenderResponse response) throws PortletException, IOException { + processRequest(request, response, PageType.CUSTOM); + } + + /** + * Delegates to + * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. + * + * @see #processRequest(PortletRequest, PortletResponse, String, String) + */ + @Override + protected void doEdit(final RenderRequest request, final RenderResponse response) throws PortletException, IOException { + processRequest(request, response, PageType.EDIT); + } + + /** + * Delegates to + * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. + * + * @see #processRequest(PortletRequest, PortletResponse, String, String) + */ + @Override + protected void doHelp(final RenderRequest request, final RenderResponse response) throws PortletException, IOException { + processRequest(request, response, PageType.HELP); + } + + /** + * Delegates to + * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. + * + * @see #processRequest(PortletRequest, PortletResponse, String, String) + */ + @Override + protected void doView(final RenderRequest request, final RenderResponse response) throws PortletException, IOException { + processRequest(request, response, PageType.VIEW); + } + + /** + * @param pageType + * the mode of the portlet page, e.g. VIEW, EDIT etc... + * @return the default page name for the given pate type. + */ + protected String getDefaultPage(final PageType pageType) { + return defaultPages.get(pageType); + } + + /** + * Loads the Wicket Portlet properties file off the class path. + * + * FIXME javadoc - check properties + * + * @param properties + * appends the portlet properties to + * @return Wicket portlet properties. Returns an empty or unchanged + * properties object if Wicket Portlet properties could not be found + * @throws PortletException + * if loading the properties fails + */ + protected Properties getWicketPortletProperties(Properties properties) throws PortletException { + if (properties == null) { + properties = new Properties(); + } + final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(WICKET_PORTLET_PROPERTIES); + if (is != null) { + try { + properties.load(is); + } + catch (final IOException e) { + throw new PortletException("Failed to load WicketPortlet.properties from classpath", e); + } + } + return properties; + } + + /** + * Retrieves the Wicket URL from the request object as a request parameter, + * or if none exists returns the default URL. The name of the request + * parameter is stored as a request attribute. + * + *

+ * This url is then used to pass on to the matching {@link WicketFilter} to + * process, by way of {@link RequestDispatcher} via the filters context + * path. + * + *

+ * A "parameter" is a form field name/value pair passed from the HTML side + * of the world. Its value is a String. + * + *

+ * An "attribute" is a Java object name/value pair passed only through the + * internal JavaServer processes. (I.e. it can come from a JSP or servlet + * but not an HTML page.) Its value is an Object. + * + * @see PortletRequestContext#getLastEncodedPath() + * @param request + * @param pageType + * @param defaultPage + * url of the default page + * @return the Wicket URL from within the specified request + */ + protected String getWicketURL(final PortletRequest request, final PageType pageType, final String defaultPage) { + String wicketURL = null; + if (request instanceof ActionRequest) { + // try to lookup the passed in wicket url parameter + wicketURL = request.getParameter(WICKET_URL_PORTLET_PARAMETER); + } else if (request instanceof ResourceRequest) { + wicketURL = ((ResourceRequest) request).getResourceID(); + } else { + // try to lookup the passed in wicket url parameter, suffixed with + // the portlet mode + String redirectUrlKey = WICKET_URL_PORTLET_PARAMETER + request.getPortletMode().toString(); + wicketURL = request.getParameter(redirectUrlKey); + } + + // if the wicketURL could not be retrieved, return the url for the + // default page + if (wicketURL == null) { + wicketURL = defaultPage; + } + return wicketURL; + } + + /** + * {@inheritDoc} + */ + @Override + public void init(final PortletConfig config) throws PortletException { + super.init(config); + + wicketFilterPath = buildWicketFilterPath(config.getInitParameter(WICKET_FILTER_PATH_PARAM)); + String responseBufferFolderPath = config.getInitParameter(RESPONSE_BUFFER_FOLDER_PARAM); + if ((responseBufferFolderPath != null) && (!Strings.isEmpty(responseBufferFolderPath))) { + responseBufferFolder = new File(responseBufferFolderPath); + } + + for (final PageType p : PageType.values()) { + defaultPages.put(p, config.getInitParameter(p.initParameterName)); + } + + validateDefaultPages(defaultPages); + } + + /** + * Delegates to + * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. + * + *

+ * Stores the {@link ActionResponse} so that + * {@link PortletEventService#broadcast} can send events using + * {@link ActionResponse#setEvent} + * + * @see PortletEventService#broadcastToPortletListeners + * @see #processRequest(PortletRequest, PortletResponse, String, String) + */ + @Override + public void processAction(final ActionRequest request, final ActionResponse response) throws PortletException, IOException { + processRequest(request, response, PageType.ACTION); + } + + /** + * Handles redirects set from processing the action. Checks the response + * state after the action has been processed by Wicket for the presence of a + * redirect URL, and if present, 'portletifies' the URL. If the URL is a + * redirect to within the scope of this portlet, leaves it to be handled in + * a subsequent render call, or if not, sends the redirect to the client. + * The recorded url is then used in by wicket in the subsequnt 'VIEW' + * requests by the portal, to render the correct Page. + * + * @see IRequestCycleSettings#REDIRECT_TO_RENDER + * @param wicketURL + * @param request + * @param response + * @param responseState + * @throws PortletException + * @throws IOException + */ + protected void processActionResponseState(String wicketURL, final PortletRequest request, final ActionResponse response, final ResponseState responseState) throws PortletException, IOException { + // write out Cookies to ActionResponse + responseState.flushAndClose(); + String redirectLocationUrl = responseState.getRedirectLocation(); + if (LOG.isDebugEnabled()) { + LOG.debug("redirectURL after include:" + redirectLocationUrl); + } + if (redirectLocationUrl != null && !redirectLocationUrl.isEmpty()) { + redirectLocationUrl = fixWicketUrl(wicketURL, redirectLocationUrl, request.getScheme()); + if (redirectLocationUrl.startsWith(wicketFilterPath)) { + final String portletMode = request.getPortletMode().toString(); + final String redirectUrlKey = WICKET_URL_PORTLET_PARAMETER + portletMode; + // put the redirect location into the "_wuview" render parameter + response.setRenderParameter(redirectUrlKey, redirectLocationUrl); + } else { + response.sendRedirect(redirectLocationUrl); + } + } + } + + /** + * Loops until wicket processing does not result in a redirect (redirects + * have to be caught, and fed back into Wicket as we only want the portlet + * redirected, not the entire page of course). + * + * @param request + * @param response + * @param requestType + * @param wicketURL + * @param responseState + * @throws PortletException + * @throws IOException + */ + private void processMimeResponseRequest(String wicketURL, final PortletRequest request, final MimeResponse response, final ResponseState responseState) throws PortletException, IOException { + PortletRequestDispatcher rd = null; + String previousURL = null; + // FIXME portal comment: explain while loop + // keep looping until wicket processing does not result in a redirect + // (redirects have to + // be caught, and fed back into Wicket as we only want the portlet + // redirected, not the + // entire page of course. + while (true) { + rd = getPortletContext().getRequestDispatcher(wicketURL); + if (rd != null) { + // Need to use RequestDispatcher.include here otherwise + // internally rewinding on a + // redirect + // won't be allowed (calling forward will close the response) + rd.include(request, response); + + // process _other_ response states - check for redirects as a + // result of wicket + // processing the request + + String redirectLocation = responseState.getRedirectLocation(); + String ajaxRedirectLocation = responseState.getAjaxRedirectLocation(); + if (ajaxRedirectLocation != null) { + // Ajax redirect + responseState.clear(); + responseState.setDateHeader("Date", System.currentTimeMillis()); + responseState.setDateHeader("Expires", 0); + responseState.setHeader("Pragma", "no-cache"); + responseState.setHeader("Cache-Control", "no-cache, no-store"); + //client side javascript needs the Ajax-Location header see wicket-ajax-jquery.js line 771 + responseState.setHeader("Ajax-Location", ajaxRedirectLocation);// + responseState.setContentType("text/xml;charset=UTF-8"); + responseState.getWriter().write( + ""); + responseState.flushAndClose(); + } else if (redirectLocation != null) { + // TODO: check if its redirect to wicket page (find _wu or + // _wuPortletMode or resourceId parameter) + + final boolean validWicketUrl = redirectLocation.startsWith(wicketFilterPath); + if (validWicketUrl) { + if (!redirectLocation.equals(previousURL)) { + previousURL = wicketURL; + wicketURL = redirectLocation; + response.reset(); + responseState.clear(); + continue; + } else { + // internal Wicket redirection loop: unsure yet what + // to send out from + // here + // TODO: determine what kind of error (message or + // page) should be + // written out + // for now: no output available/written :( + responseState.clear(); + break; + } + } + else { + responseState.clear(); + if (responseState.isResourceResponse()) { + // Formally, the Portlet 2.0 Spec doesn't support + // directly redirecting + // from serveResource. However, it is possible to + // write response headers + // to the ResourceResponse (using setProperty), + // which means the + // technical implementation of a response.redirect + // call might be + // "simulated" by writing out: + + // a) setting response.setStatus(SC_FOUND) + // b) setting header "Location" to the + // redirectLocation + + // Caveat 1: + // ResourceResponse.setStatus isn't supported + // either, but this can be + // done by setting the header property + // ResourceResponse.HTTP_STATUS_CODE + + // Caveat 2: Actual handling of Response headers as + // set through + // PortletResponse.setProperty is completely + // optional by the Portlet + // Spec so it really depends on the portlet + // container implementation + // (and environment, e.g. consider using WSRP + // here...) if this will + // work. + + // On Apache Pluto/Jetspeed-2, the above descibed + // handling *will* be + // implemented as expected! + + // HttpServletResponse.SC_FOUND == 302, defined by + // Servlet API >= 2.4 + response.setProperty(ResourceResponse.HTTP_STATUS_CODE, Integer.toString(302)); + response.setProperty("Location", redirectLocation); + } + else { + response.reset(); + response.setProperty("expiration-cache", "0"); + + PrintWriter writer = response.getWriter(); + writer.append(""); + writer.append(""); + writer.append(""); + writer.close(); + break; + } + } + } + else { + if (LOG.isDebugEnabled()) { + LOG.debug("ajax redirect url after inclusion:" + responseState.getAjaxRedirectLocation()); + } + // write response state out to the PortletResponse + responseState.flushAndClose(); + } + } + break; + } + } + + /** + * Consumes and processes all portlet requests. All the doX methods delegate + * to this method, including processAction and serveResource. + * + * @param request + * @param response + * @param requestType + * @param pageType + * @throws PortletException + * @throws IOException + */ + protected void processRequest(final PortletRequest request, final PortletResponse response, final PageType pageType) throws PortletException, IOException { + String wicketURL = null; + + // get the actual wicketURL for this request, to be passed onto Wicket + // core for processing + wicketURL = getWicketURL(request, pageType, getDefaultPage(pageType)); + + if (LOG.isDebugEnabled()) { + LOG.debug("Portlet \"" + request.getAttribute(PortletRequest.LIFECYCLE_PHASE) + "\" for wicket url:" + wicketURL); + } + + // store the response state and request type in the request object, so + // they can be looked up + // from a different context + final ResponseState responseState = new ResponseState(request, response, responseBufferFolder); + request.setAttribute(RESPONSE_STATE_ATTR, responseState); + + // need to record the effective wicket url of the rendered result, so + // that the subsequent + // portlet 'view' requests can delegate to wicket to render the correct + // location/wicket url. + if (responseState.isActionResponse()) { + // create the request dispatcher, to delegate the request to the + // wicket filter + final PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(wicketURL); + + if (rd != null) { + // delegate to wicket filter - this is where the magic happens + rd.include(request, response); + // String newWicketURL = getWicketURL(request, pageType, + // getDefaultPage(pageType)); + LOG.debug("wicket filter inclusion complete"); + processActionResponseState(wicketURL, request, (ActionResponse) response, responseState); + } + else { + // FIXME - throw exception? + // no-op for now + } + } + else if (responseState.isMimeResponse()) { + processMimeResponseRequest(wicketURL, request, (MimeResponse) response, responseState); + } else { + LOG.warn("Unsupported Portlet lifecycle: {}", request.getAttribute(PortletRequest.LIFECYCLE_PHASE)); + } + if (LOG.isDebugEnabled()) { + wicketURL = getWicketURL(request, pageType, getDefaultPage(pageType)); + LOG.debug("end of request, wicket url: " + wicketURL); + } + } + + /** + * Delegates to + * {@link #processRequest(PortletRequest, PortletResponse, String, String)}. + * + * @see #processRequest(PortletRequest, PortletResponse, String, String) + */ + @Override + public void serveResource(final ResourceRequest request, final ResourceResponse response) throws PortletException, IOException { + String resourceId = request.getResourceID(); + if (resourceId != null) { + if (PROTECTED_RESOURCES.matcher(resourceId).matches()) { + response.setProperty(ResourceResponse.HTTP_STATUS_CODE, "404"); + } + processRequest(request, response, PageType.VIEW); + } + } + + /** + * FIXME javadoc + * + *

+ * Corrects the incoming URL if the old home page style, or if it's missing + * the filter path prefix. + * + * @param url + * the URL to fix + * @return the corrected URL + */ + protected String fixWicketUrl(final String url) { + if (url == null) { + return wicketFilterPath; + } + + if (!url.startsWith(wicketFilterPath)) { + if (url.startsWith("..?")) { + return wicketFilterPath + url.substring(2); + } + if ((url + "/").equals(wicketFilterPath)) { + // hack around "old" style wicket home url's without trailing + // '/' which would lead + // to a redirect to the real home path anyway + return wicketFilterPath; + } + } + return url; + } + + /** + * FIXME javadoc + * + *

+ * Corrects the incoming URL if the old home page style, or if it's missing + * the filter path prefix. + * + * @param requestUrl + * the original request URL + * @param url + * the URL to fix + * @return the corrected URL + */ + protected String fixWicketUrl(final String requestUrl, final String url, final String scheme) { + if ((url != null) && (requestUrl != null) && (!ABSOLUTE_URI_PATTERN.matcher(url).matches())) { + try { + if (!requestUrl.startsWith("http")) { + return new URL(new URL(scheme + ":" + requestUrl), url).toString().substring(scheme.length() + 1); + } + else { + return new URL(new URL(requestUrl), url).getPath(); + } + } + catch (Exception e) { + } + } + return fixWicketUrl(url); + } + + /** + * FIXME javadoc + * + *

+ * Registers the default pages and their URLs for the different + * {@link PortletMode}s. Also corrects and slightly incorrect URLs (see + * {@link #fixWicketUrl(String)}). + * + *

+ * If no specific page was specified for a given portlet mode (VIEW, EDIT + * etc) then the page for that mode is set to be the same page as that of + * the VIEW mode. + * + * @see PortletMode + * @see #fixWicketUrl(String) + * @param defaultPages + */ + protected void validateDefaultPages(final Map defaultPages) { + final String viewPage = fixWicketUrl(defaultPages.get(PageType.VIEW)); + defaultPages.put(PageType.VIEW, viewPage.startsWith(wicketFilterPath) ? viewPage : wicketFilterPath); + + String defaultPage = defaultPages.get(PageType.ACTION); + if (defaultPage == null) { + defaultPages.put(PageType.ACTION, viewPage); + } else { + defaultPage = fixWicketUrl(defaultPage); + defaultPages.put(PageType.ACTION, defaultPage.startsWith(wicketFilterPath) ? defaultPage : viewPage); + } + + defaultPage = defaultPages.get(PageType.CUSTOM); + if (defaultPage == null) { + defaultPages.put(PageType.CUSTOM, viewPage); + } else { + defaultPage = fixWicketUrl(defaultPage); + defaultPages.put(PageType.CUSTOM, defaultPage.startsWith(wicketFilterPath) ? defaultPage : viewPage); + } + + defaultPage = defaultPages.get(PageType.HELP); + if (defaultPage == null) { + defaultPages.put(PageType.HELP, viewPage); + } else { + defaultPage = fixWicketUrl(defaultPage); + defaultPages.put(PageType.HELP, defaultPage.startsWith(wicketFilterPath) ? defaultPage : viewPage); + } + + defaultPage = defaultPages.get(PageType.EDIT); + if (defaultPage == null) { + defaultPages.put(PageType.EDIT, viewPage); + } else { + defaultPage = fixWicketUrl(defaultPage); + defaultPages.put(PageType.EDIT, defaultPage.startsWith(wicketFilterPath) ? defaultPage : viewPage); + } + } +} diff --git a/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/ajax/WicketPortletAjaxResourceReference.java b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/ajax/WicketPortletAjaxResourceReference.java new file mode 100644 index 0000000000..cbfc81e2ad --- /dev/null +++ b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/ajax/WicketPortletAjaxResourceReference.java @@ -0,0 +1,40 @@ +package org.apache.wicket.portlet.ajax; + +import java.util.List; + +import org.apache.wicket.ajax.WicketAjaxJQueryResourceReference; +import org.apache.wicket.markup.head.HeaderItem; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.request.resource.JavaScriptResourceReference; + +/** + * @author Konstantinos Karavitis + * + */ +public class WicketPortletAjaxResourceReference extends JavaScriptResourceReference +{ + private static final long serialVersionUID = 1L; + + private static WicketPortletAjaxResourceReference INSTANCE = new WicketPortletAjaxResourceReference(); + + /** + * @return the singleton INSTANCE + */ + public static WicketPortletAjaxResourceReference get() + { + return INSTANCE; + } + + private WicketPortletAjaxResourceReference() + { + super(WicketPortletAjaxResourceReference.class, "res/js/wicket-portlet-ajax.js"); + } + + @Override + public List getDependencies() + { + List dependencies = super.getDependencies(); + dependencies.add(JavaScriptHeaderItem.forReference(WicketAjaxJQueryResourceReference.get())); + return dependencies; + } +} diff --git a/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/ajax/res/js/wicket-portlet-ajax.js b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/ajax/res/js/wicket-portlet-ajax.js new file mode 100644 index 0000000000..3c0bd3b5e5 --- /dev/null +++ b/portlet-parent/wicketstuff-portlet/src/main/java/org/apache/wicket/portlet/ajax/res/js/wicket-portlet-ajax.js @@ -0,0 +1,37 @@ +/* + * Wicket Portlet Ajax support + * + * @author Konstantinos Karavitis + * + * fix for https://github.com/wicketstuff/core/issues/588 issue + */ +;(function(Wicket) { + Wicket.Ajax.Call.prototype.processAjaxResponse = function(data, textStatus, jqXHR, context) { + if (jqXHR.readyState === 4) { + // first try to get the redirect header + var redirectUrl; + try { + redirectUrl = jqXHR.getResponseHeader('Ajax-Location'); + } catch (ignore) { // might happen in older mozilla + } + + // the redirect header was set, go to new url + if (typeof(redirectUrl) !== "undefined" && redirectUrl !== null && redirectUrl !== "") { + this.success(context); + context.isRedirecting = true; + Wicket.Ajax.redirect(redirectUrl); + } + else { + // no redirect, just regular response + if (Wicket.Log.enabled()) { + var responseAsText = jqXHR.responseText; + Wicket.Log.info("Received ajax response (" + responseAsText.length + " characters)"); + Wicket.Log.info("\n" + responseAsText); + } + + // invoke the loaded callback with an xml document + return this.loadedCallback(data, context); + } + } + }; +})(Wicket); \ No newline at end of file diff --git a/progressbar-parent/pom.xml b/progressbar-parent/pom.xml index 582c6c9766..0a38dd1d50 100644 --- a/progressbar-parent/pom.xml +++ b/progressbar-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT progressbar-parent @@ -22,6 +22,9 @@ progressbar-spring progressbar-example + + false + @@ -30,15 +33,20 @@ hlubek at users.sf.net + + + + SKIP_MODULE_TESTS + + true + + + - - log4j - log4j - org.slf4j - slf4j-log4j12 + slf4j-api javax.servlet @@ -49,4 +57,15 @@ junit + + + + org.apache.maven.plugins + maven-surefire-plugin + + ${skip.module.tests} + + + + diff --git a/progressbar-parent/progressbar-example/pom.xml b/progressbar-parent/progressbar-example/pom.xml index e95f2e4143..593126d94c 100644 --- a/progressbar-parent/progressbar-example/pom.xml +++ b/progressbar-parent/progressbar-example/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff progressbar-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT progressbar-example diff --git a/progressbar-parent/progressbar-spring/pom.xml b/progressbar-parent/progressbar-spring/pom.xml index 8f2e02f081..d957dd8f68 100644 --- a/progressbar-parent/progressbar-spring/pom.xml +++ b/progressbar-parent/progressbar-spring/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff progressbar-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-progressbar-spring TaskService for use with user submitted background tasks and the progress bar. Could be used with Spring or any other application framework. diff --git a/progressbar-parent/progressbar/pom.xml b/progressbar-parent/progressbar/pom.xml index 785566b488..d577fc848d 100644 --- a/progressbar-parent/progressbar/pom.xml +++ b/progressbar-parent/progressbar/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff progressbar-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-progressbar diff --git a/push-parent/pom.xml b/push-parent/pom.xml index e98549b4fb..882169f652 100644 --- a/push-parent/pom.xml +++ b/push-parent/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT push-parent diff --git a/push-parent/push-cometd/pom.xml b/push-parent/push-cometd/pom.xml index 5f89b74017..fd4116f097 100644 --- a/push-parent/push-cometd/pom.xml +++ b/push-parent/push-cometd/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff push-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-push-cometd diff --git a/push-parent/push-core/pom.xml b/push-parent/push-core/pom.xml index dfb7f9f8a0..78855a445d 100644 --- a/push-parent/push-core/pom.xml +++ b/push-parent/push-core/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff push-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-push-core diff --git a/push-parent/push-examples/overlays/org.cometd.javascript.cometd-javascript-common-2.4.0.RC1.info b/push-parent/push-examples/overlays/org.cometd.javascript.cometd-javascript-common-2.4.0.RC1.info index 97f77fce62..7535cbafc6 100644 --- a/push-parent/push-examples/overlays/org.cometd.javascript.cometd-javascript-common-2.4.0.RC1.info +++ b/push-parent/push-examples/overlays/org.cometd.javascript.cometd-javascript-common-2.4.0.RC1.info @@ -1,3 +1,3 @@ -1406211421000 +1483545308000 (?:[^/]+/)*?[^/]*? META-INF(?:$|/.+) \ No newline at end of file diff --git a/push-parent/push-examples/pom.xml b/push-parent/push-examples/pom.xml index 8fc458e10b..748e6885a1 100644 --- a/push-parent/push-examples/pom.xml +++ b/push-parent/push-examples/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff push-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-push-examples diff --git a/push-parent/push-timer/pom.xml b/push-parent/push-timer/pom.xml index 5af5fab271..3bfd2c0b0d 100644 --- a/push-parent/push-timer/pom.xml +++ b/push-parent/push-timer/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff push-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-push-timer diff --git a/scala-extensions-parent/pom.xml b/scala-extensions-parent/pom.xml index 92dcd1db39..1fe25386c1 100644 --- a/scala-extensions-parent/pom.xml +++ b/scala-extensions-parent/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT org.wicketstuff.scala diff --git a/scala-extensions-parent/wicket-scala-archetype/pom.xml b/scala-extensions-parent/wicket-scala-archetype/pom.xml index e876a637c8..0d390275c5 100644 --- a/scala-extensions-parent/wicket-scala-archetype/pom.xml +++ b/scala-extensions-parent/wicket-scala-archetype/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff.scala scala-extensions-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT maven-archetype diff --git a/scala-extensions-parent/wicket-scala-sample/pom.xml b/scala-extensions-parent/wicket-scala-sample/pom.xml index 92a0dbdd80..2f5e00db27 100644 --- a/scala-extensions-parent/wicket-scala-sample/pom.xml +++ b/scala-extensions-parent/wicket-scala-sample/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff.scala scala-extensions-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-sample diff --git a/scala-extensions-parent/wicket-scala/pom.xml b/scala-extensions-parent/wicket-scala/pom.xml index d4a769a829..d8f988d244 100644 --- a/scala-extensions-parent/wicket-scala/pom.xml +++ b/scala-extensions-parent/wicket-scala/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff.scala scala-extensions-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-scala diff --git a/select2-parent/pom.xml b/select2-parent/pom.xml index bd04c8ba43..e68f3b8caf 100755 --- a/select2-parent/pom.xml +++ b/select2-parent/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-select2-parent pom diff --git a/select2-parent/select2-examples/pom.xml b/select2-parent/select2-examples/pom.xml index a55740a187..946ad09eb9 100755 --- a/select2-parent/select2-examples/pom.xml +++ b/select2-parent/select2-examples/pom.xml @@ -4,7 +4,7 @@ wicketstuff-select2-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-select2-examples war diff --git a/select2-parent/select2/pom.xml b/select2-parent/select2/pom.xml index 4af99095d7..59b5cde749 100755 --- a/select2-parent/select2/pom.xml +++ b/select2-parent/select2/pom.xml @@ -21,7 +21,7 @@ org.wicketstuff wicketstuff-select2-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT 4.0.0 wicketstuff-select2 diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/AbstractSelect2Choice.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/AbstractSelect2Choice.java index 4c26d3a614..d5076b58ca 100755 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/AbstractSelect2Choice.java +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/AbstractSelect2Choice.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Igor Vaynberg - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -23,11 +23,12 @@ import org.apache.wicket.IResourceListener; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONWriter; +import org.apache.wicket.ajax.json.JSONStringer; import org.apache.wicket.event.IEvent; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; import org.apache.wicket.markup.head.OnDomReadyHeaderItem; import org.apache.wicket.markup.html.form.AbstractTextComponent; import org.apache.wicket.markup.html.form.FormComponent; @@ -49,7 +50,7 @@ * type of model object * @author igor */ -abstract class AbstractSelect2Choice extends AbstractTextComponent implements IResourceListener +public abstract class AbstractSelect2Choice extends AbstractTextComponent implements IResourceListener { private static final long serialVersionUID = 1L; @@ -118,11 +119,16 @@ public AbstractSelect2Choice(String id, IModel model, ChoiceProvider provi public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); + // render theme related resources if any if(settings.getTheme() != null) { settings.getTheme().renderHead(component, response); } + + // include i18n resource file + response.render(JavaScriptHeaderItem.forReference( + new Select2LanguageResourceReference(settings.getLanguage()))); } }); setOutputMarkupId(true); @@ -262,8 +268,8 @@ protected void onInitialize() { AjaxSettings ajax = getSettings().getAjax(true); ajax.setData(String.format( - "function(params) { return { q: params.term, page: params.page, '%s':true, '%s':[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}; }", - WebRequest.PARAM_AJAX, WebRequest.PARAM_AJAX_BASE_URL)); + "function(params) { return { '%s': params.term, page: params.page, '%s':true, '%s':[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}; }", + settings.getQueryParam(), WebRequest.PARAM_AJAX, WebRequest.PARAM_AJAX_BASE_URL)); ajax.setProcessResults("function(data, page) { return { results: data.items, pagination: { more: data.more } }; }"); } else if (settings.isStateless()) //configure stateless mode @@ -287,7 +293,7 @@ protected void onConfigure() } else if (isAjax()) { - getSettings().getAjax().setUrl(urlFor(IResourceListener.INTERFACE, null)); + getSettings().getAjax(true).setUrl(urlFor(IResourceListener.INTERFACE, null)); } } @@ -330,7 +336,19 @@ public boolean isAjax() * @param provider * @param outputStream */ - public static void generateJSON(ChoiceProvider provider, OutputStream outputStream) + public static void generateJSON(ChoiceProvider provider, OutputStream outputStream) + { + generateJSON(Settings.DEFAULT_QUERY_PARAM, provider, outputStream); + } + + /** + * Utility method to generate JSON response. + * + * @param provider + * @param outputStream + * @param queryParam - parameter to be used as Ajax query param + */ + public static void generateJSON(String queryParam, ChoiceProvider provider, OutputStream outputStream) { // this is the callback that retrieves matching choices used to populate the dropdown @@ -338,7 +356,7 @@ public static void generateJSON(ChoiceProvider provider, OutputStream out IRequestParameters params = request.getRequestParameters(); // retrieve choices matching the search term - String term = params.getParameterValue("q").toOptionalString(); + String term = params.getParameterValue(queryParam).toOptionalString(); int page = params.getParameterValue("page").toInt(1); // select2 uses 1-based paging, but in wicket world we are used to @@ -350,14 +368,13 @@ public static void generateJSON(ChoiceProvider provider, OutputStream out // jsonize and write out the choices to the response - OutputStreamWriter out = new OutputStreamWriter(outputStream, request.getCharset()); - JSONWriter json = new JSONWriter(out); + JSONStringer json = new JSONStringer(); try { json.object(); json.key("items").array(); - for (T item : response) + for (T item : response) { json.object(); provider.toJson(item, json); @@ -366,24 +383,16 @@ public static void generateJSON(ChoiceProvider provider, OutputStream out json.endArray(); json.key("more").value(response.getHasMore()).endObject(); } - catch (JSONException e) + catch (JSONException e) { throw new RuntimeException("Could not write Json response", e); } - try + try (OutputStreamWriter out = new OutputStreamWriter(outputStream, request.getCharset())) { + out.append(json.toString()); out.flush(); } - catch (IOException e) - { - throw new RuntimeException("Could not write Json to servlet response", e); - } - - try - { - out.close(); - } catch (IOException e) { throw new RuntimeException("Could not write Json to servlet response", e); @@ -395,7 +404,7 @@ public void onResourceRequested() { WebResponse webResponse = (WebResponse) getRequestCycle().getResponse(); webResponse.setContentType("application/json"); - generateJSON(provider, webResponse.getOutputStream()); + generateJSON(settings.getQueryParam(), provider, webResponse.getOutputStream()); } @Override @@ -466,7 +475,7 @@ public void onComponentTagBody(final MarkupStream markupStream, final ComponentT } replaceComponentTagBody(markupStream, openTag, buffer); } - + /** * Empty input is acceptable */ diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/AjaxSettings.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/AjaxSettings.java index ecbb5ccbe1..20bc44dd90 100755 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/AjaxSettings.java +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/AjaxSettings.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Igor Vaynberg - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -15,12 +15,12 @@ import java.io.Serializable; import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONWriter; +import org.apache.wicket.ajax.json.JSONStringer; import org.wicketstuff.select2.json.Json; /** * Select2 Ajax settings. Refer to the Select2 documentation for what these options mean. - * + * * @author igor */ public final class AjaxSettings implements Serializable @@ -34,16 +34,16 @@ public final class AjaxSettings implements Serializable /** whether or not to use traditional parameter encoding. */ private boolean cache; - public void toJson(JSONWriter writer) throws JSONException + public void toJson(JSONStringer stringer) throws JSONException { - writer.object(); - Json.writeFunction(writer, "data", data); - Json.writeObject(writer, "dataType", dataType); - Json.writeObject(writer, "delay", delay); - Json.writeFunction(writer, "processResults", processResults); - Json.writeObject(writer, "url", url); - Json.writeObject(writer, "cache", cache); - writer.endObject(); + stringer.object(); + Json.writeFunction(stringer, "data", data); + Json.writeObject(stringer, "dataType", dataType); + Json.writeObject(stringer, "delay", delay); + Json.writeFunction(stringer, "processResults", processResults); + Json.writeObject(stringer, "url", url); + Json.writeObject(stringer, "cache", cache); + stringer.endObject(); } public void setUrl(CharSequence url) diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/ChoiceProvider.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/ChoiceProvider.java index 17b274fc73..2464d81d59 100755 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/ChoiceProvider.java +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/ChoiceProvider.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Igor Vaynberg - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -15,7 +15,7 @@ import java.util.Collection; import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONWriter; +import org.apache.wicket.ajax.json.JSONStringer; import org.apache.wicket.model.IDetachable; /** @@ -34,9 +34,9 @@ * For the most common usecase where each choice is rendered as a text string see * {@link TextChoiceProvider}. *

- * + * * @author igor - * + * * @param * type of choice object */ @@ -72,7 +72,7 @@ public abstract class ChoiceProvider implements IDetachable /** * Queries application for choices that match the search {@code term} and adds them to the * {@code response} - * + * * @param term * search term * @param page @@ -84,40 +84,40 @@ public abstract class ChoiceProvider implements IDetachable /** * Converts the specified choice to Json. - * + * *

* At the very least each choice should contain an {@code id} attribute. If no custom rendering * function is specified, the {@code text} attribute should also be provided *

- * + * *

* Example: If mapping a User {Long id, String name} using default rendering the code should * look like this: - * + * *

-	 * toJson(User choice, JSONWriter writer)
+	 * toJson(User choice, JSONStringer stringer)
 	 * {
 	 * 	writer.key("id").value(choice.getId()).key("text").value(choice.getName());
 	 * }
 	 * 
- * + * *

- * + * * @param choice * choice to convert - * @param writer - * Json writer that should be used to covnert the choice + * @param stringer + * Json stringer that should be used to covnert the choice * @throws JSONException */ - protected void toJson(T choice, JSONWriter writer) throws JSONException { - writer.key("id").value(getIdValue(choice)).key("text").value(getDisplayValue(choice)); + protected void toJson(T choice, JSONStringer stringer) throws JSONException { + stringer.key("id").value(getIdValue(choice)).key("text").value(getDisplayValue(choice)); } /** * Converts a list of choice ids back into application's choice objects. When the choice * provider is attached to a single-select component the {@code ids} collection will contain * exactly one id, and a collection containing exactly one choice should be returned. - * + * * @param ids * collection containing choice ids * @return collection containing application choice objects diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/Select2LanguageResourceReference.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/Select2LanguageResourceReference.java new file mode 100644 index 0000000000..dc9203ff33 --- /dev/null +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/Select2LanguageResourceReference.java @@ -0,0 +1,41 @@ +package org.wicketstuff.select2; + +import org.apache.wicket.request.resource.JavaScriptResourceReference; + +/** + * {@link JavaScriptResourceReference} for a select2 i18n file, + * please see i18n resources folder for supported languages. + * + * @author Tom Götz (tom@decoded.de) + */ +class Select2LanguageResourceReference extends JavaScriptResourceReference { + private static final long serialVersionUID = 1L; + private static final String resourceName = "res/js/i18n/%s.js"; + private static final String defaultLanguage = "en"; + + /** + * @param language i18n file to load (e.g. "en", "de", "fr" ...) + */ + Select2LanguageResourceReference(String language) { + super(Select2LanguageResourceReference.class, getResourceName(language)); + } + + /** + * Returns the resource name of the i18n file, uses a fallback to defaultLanguage + * if requested resource file does not exist + * + * @param language i18n file to load + * @return resource name + */ + private static String getResourceName(String language) { + try { + String name = String.format(resourceName, language); + if (Select2LanguageResourceReference.class.getResource(name) != null) { + return name; + } + } catch (Exception ignore) { + // noop + } + return String.format(resourceName, defaultLanguage); + } +} diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/Select2ResourcesBehavior.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/Select2ResourcesBehavior.java index 1422a09426..68cb517405 100755 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/Select2ResourcesBehavior.java +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/Select2ResourcesBehavior.java @@ -12,16 +12,12 @@ */ package org.wicketstuff.select2; -import java.net.URL; - import org.apache.wicket.Application; import org.apache.wicket.Component; -import org.apache.wicket.Session; import org.apache.wicket.behavior.Behavior; import org.apache.wicket.markup.head.CssHeaderItem; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.JavaScriptHeaderItem; -import org.apache.wicket.request.resource.JavaScriptResourceReference; /** * Adds various resources needed by Select2 such as JavaScript and CSS. Which resources are added is @@ -60,20 +56,5 @@ public void renderHead(Component component, IHeaderResponse response) { response.render(CssHeaderItem.forReference(settings.getCssReference())); } - //i18n - try - { - String name = String.format("res/js/i18n/%s.js", Session.get().getLocale().toLanguageTag()); - URL lang = getClass().getResource(name); - if (lang != null) - { - //localization found - response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(getClass(), name))); - } - } - catch (Exception e) - { - //no-op - } } } diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/Settings.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/Settings.java index 340ec868d6..a0f992cc11 100755 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/Settings.java +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/Settings.java @@ -1,35 +1,40 @@ /* * Copyright 2012 Igor Vaynberg - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.wicketstuff.select2; +import static org.apache.wicket.util.string.Strings.defaultIfEmpty; + import java.io.Serializable; import org.apache.wicket.Component; import org.apache.wicket.Session; import org.apache.wicket.WicketRuntimeException; +import org.apache.wicket.ajax.json.JSONArray; import org.apache.wicket.ajax.json.JSONException; import org.apache.wicket.ajax.json.JSONStringer; import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.util.string.Strings; import org.wicketstuff.select2.json.Json; /** * Select2 settings. Refer to the Select2 documentation for what these options mean. - * + * * @author igor */ public final class Settings implements Serializable { private static final long serialVersionUID = 1L; + public static final String DEFAULT_QUERY_PARAM = "q"; /** * Some predefined width option values @@ -42,6 +47,9 @@ public static class Widths public static String ELEMENT = "element"; } + // language code (e.g. "en", "de", "fr", ...) + private String language; + private Integer minimumInputLength, minimumResultsForSearch; private Integer maximumSelectionLength; private Object placeholder; @@ -55,6 +63,7 @@ public static class Widths private String query; private String width; private String containerCss, dropdownCss, containerCssClass, dropdownCssClass; //TODO deprecated + private String dropdownParent; private AjaxSettings ajax; private String data; @@ -80,6 +89,11 @@ public static class Widths */ private String mountPath; + /** + * The name of the parameter being used for Ajax request. + */ + private String queryParam = DEFAULT_QUERY_PARAM; + public CharSequence toJson() { try @@ -109,9 +123,14 @@ public CharSequence toJson() Json.writeFunction(writer, "dropdownCss", dropdownCss); Json.writeObject(writer, "dropdownCssClass", dropdownCssClass); Json.writeObject(writer, "separator", separator); - Json.writeObject(writer, "tokenSeparators", tokenSeparators); + if (tokenSeparators != null) { + Json.writeObject(writer, "tokenSeparators", new JSONArray(tokenSeparators)); + } Json.writeObject(writer, "selectOnClose", selectOnClose); Json.writeObject(writer, "dropdownAutoWidth", dropdownAutoWidth); + if (!Strings.isEmpty(dropdownParent)) { + Json.writeFunction(writer, "dropdownParent", String.format("$('#%s')", dropdownParent)); + } if (ajax != null) { writer.key("ajax"); @@ -120,9 +139,11 @@ public CharSequence toJson() Json.writeFunction(writer, "data", data); Json.writeObject(writer, "tags", tags); Json.writeFunction(writer, "createTag", createTag); - writer.key("language").value(Session.get().getLocale().toLanguageTag()); - writer.endObject(); + // Set language + writer.key("language").value(getLanguage()); + + writer.endObject(); return writer.toString(); } catch (JSONException e) @@ -450,6 +471,15 @@ public Settings setDropdownCssClass(String dropdownCssClass) return this; } + public String getDropdownParent() { + return dropdownParent; + } + + public Settings setDropdownParent(String dropdownParent) { + this.dropdownParent = dropdownParent; + return this; + } + public String getSeparator() { return separator; @@ -499,9 +529,10 @@ public boolean isStateless() return stateless; } - public void setStateless(boolean stateless) + public Settings setStateless(boolean stateless) { this.stateless = stateless; + return this; } public String getMountPath() @@ -509,8 +540,29 @@ public String getMountPath() return mountPath; } - public void setMountPath(String mountPath) + public Settings setMountPath(String mountPath) { this.mountPath = mountPath; + return this; + } + + public String getQueryParam() + { + return queryParam; + } + + public Settings setQueryParam(String queryParam) + { + this.queryParam = queryParam; + return this; + } + + public String getLanguage() { + return defaultIfEmpty(language, Session.get().getLocale().getLanguage()); + } + + public Settings setLanguage(String language) { + this.language = language; + return this; } } diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/Json.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/Json.java index cdecd943f2..14838b1e86 100755 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/Json.java +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/Json.java @@ -1,11 +1,11 @@ /* * Copyright 2012 Igor Vaynberg - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with * the License. You may obtain a copy of the License in the LICENSE file, or at: - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. @@ -13,7 +13,7 @@ package org.wicketstuff.select2.json; import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONWriter; +import org.apache.wicket.ajax.json.JSONStringer; /** * Json utilities @@ -26,43 +26,43 @@ private Json() /** * Writes a key/value pair into the {@code writer} if the value is not {@code null} - * - * @param writer - * json writer + * + * @param stringer + * json stringer * @param key * key * @param value * value * @throws JSONException */ - public static void writeObject(JSONWriter writer, String key, Object value) + public static void writeObject(JSONStringer stringer, String key, Object value) throws JSONException { if (value != null) { - writer.key(key); - writer.value(value); + stringer.key(key); + stringer.value(value); } } /** * Writes a key/value pair into the {@code writer} where {@code value} represents a javascript * function and should be written out unencoded if the value is not {@code null} - * - * @param writer - * json writer + * + * @param stringer + * json stringer * @param key * key * @param value * value * @throws JSONException */ - public static void writeFunction(JSONWriter writer, String key, String value) + public static void writeFunction(JSONStringer stringer, String key, String value) throws JSONException { if (value != null) { - writer.key(key).value(new JsonFunction(value)); + stringer.key(key).value(new JsonFunction(value)); } } diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/JsonBuilder.java b/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/JsonBuilder.java deleted file mode 100755 index e02b63121c..0000000000 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/json/JsonBuilder.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012 Igor Vaynberg - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with - * the License. You may obtain a copy of the License in the LICENSE file, or at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.wicketstuff.select2.json; - -import org.apache.wicket.ajax.json.JSONWriter; - -/** - * A JSONWriter that writes and allows access to the underlying {@link StringBuilder}. One of the - * advantages of this class is that it can expose Json as a {@link CharSequence} instead of a - * {@link String} so no extra memory allocations are necessary for code that can use a - * {@link CharSequence} . - * - * @author igor - * - */ -public class JsonBuilder extends JSONWriter -{ - - /** - * Constructs a builder with a new {@link StringBuilder}. - */ - public JsonBuilder() - { - this(new StringBuilder()); - } - - /** - * Constructs a builder with an existing {@link StringBuilder}. - * - * @param builder - */ - public JsonBuilder(StringBuilder builder) - { - super(new StringBuilderWriter(builder)); - } - - /** - * @return underlying {@link StringBuilder} as a {@link CharSequence}. - */ - public CharSequence toJson() - { - return ((StringBuilderWriter)writer).getBuilder(); - } - -} diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/css/select2.css b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/css/select2.css index 2006064094..447b2b86cc 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/css/select2.css +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/css/select2.css @@ -184,6 +184,8 @@ margin: 0; padding: 0 5px; width: 100%; } + .select2-container--default .select2-selection--multiple .select2-selection__rendered li { + list-style: none; } .select2-container--default .select2-selection--multiple .select2-selection__placeholder { color: #999; margin-top: 5px; diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/css/select2.min.css b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/css/select2.min.css index a170ecdd58..76de04d923 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/css/select2.min.css +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/css/select2.min.css @@ -1 +1 @@ -.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb} +.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb} diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ar.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ar.js index 6242409936..01a6882948 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ar.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ar.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="الرجاء حذف "+t+" عناصر";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="الرجاء إضافة "+t+" عناصر";return n},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){var t="تستطيع إختيار "+e.maximum+" بنود فقط";return t},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/az.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/az.js index 9c119a3955..2accb973f6 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/az.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/az.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/bg.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/bg.js index 72a3bd5472..35ae989447 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/bg.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/bg.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ca.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ca.js index 9ef134fee5..fdb5f3d2a5 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ca.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ca.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/cs.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/cs.js index 22a1f4acc2..9651378a60 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/cs.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/cs.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím zadejte o jeden znak méně":n<=4?"Prosím zadejte o "+e(n,!0)+" znaky méně":"Prosím zadejte o "+n+" znaků méně"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím zadejte ještě jeden znak":n<=4?"Prosím zadejte ještě další "+e(n,!0)+" znaky":"Prosím zadejte ještě dalších "+n+" znaků"},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky":"Můžete zvolit maximálně "+n+" položek"},noResults:function(){return"Nenalezeny žádné položky"},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/da.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/da.js index f099692725..501c51e933 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/da.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/da.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Angiv venligst "+t+" tegn mindre";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Angiv venligst "+t+" tegn mere";return n},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/de.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/de.js index da7e5cb42f..9a6d55366f 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/de.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/de.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/el.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/el.js new file mode 100644 index 0000000000..4735d14052 --- /dev/null +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/el.js @@ -0,0 +1,3 @@ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ + +(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/en.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/en.js index 1f414f3045..8e80ede8db 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/en.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/en.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/es.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/es.js index ca0d6cbae5..0a096502da 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/es.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/es.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"La carga falló"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/et.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/et.js index 10d6597f08..c70f4a5b31 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/et.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/et.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/eu.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/eu.js index eaa83987ee..9336053a7d 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/eu.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/eu.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fa.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fa.js index b3668c42ab..5118cd28f8 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fa.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fa.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها می‌توانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fi.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fi.js index c128bff657..9e60f26a05 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fi.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fi.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fr.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fr.js index 7f6ebfb40c..e4a6650097 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fr.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/fr.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Supprimez "+t+" caractère";return t!==1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Saisissez "+t+" caractère";return t!==1&&(n+="s"),n},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){var t="Vous pouvez seulement sélectionner "+e.maximum+" élément";return e.maximum!==1&&(t+="s"),t},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file +(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Supprimez "+t+" caractère";return t!==1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Saisissez "+t+" caractère";return t!==1&&(n+="s"),n},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){var t="Vous pouvez seulement sélectionner "+e.maximum+" élément";return e.maximum!==1&&(t+="s"),t},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/gl.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/gl.js index 2ea96bd771..02f258f928 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/gl.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/gl.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Elimine ";return t===1?n+="un carácter":n+=t+" caracteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Engada ";return t===1?n+="un carácter":n+=t+" caracteres",n},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){var t="Só pode ";return e.maximum===1?t+="un elemento":t+=e.maximum+" elementos",t},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/he.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/he.js index 76f0810a08..881f8d389f 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/he.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/he.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hi.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hi.js index 681e856089..e829684268 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hi.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hi.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hr.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hr.js index 54d17491fa..89f7b12bff 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hr.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hr.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hu.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hu.js index f89dc37b4d..74c8a90dec 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hu.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/hu.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/id.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/id.js index 5915419886..9586782618 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/id.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/id.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/is.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/is.js index 844bbca091..ab97a14d18 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/is.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/is.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/it.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/it.js index 62784c6f99..7796b9f76a 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/it.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/it.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ja.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ja.js index ecc8b43844..9f4fff6cb2 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ja.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ja.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/km.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/km.js new file mode 100644 index 0000000000..8e94adcf3a --- /dev/null +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/km.js @@ -0,0 +1,3 @@ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ + +(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ko.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ko.js index 711043dae6..4ed03215fc 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ko.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ko.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/lt.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/lt.js index b1d4642290..05f3a6e5eb 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/lt.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/lt.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%100>9&&e%100<21||e%10===0?e%10>1?n:r:t}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"ių","ius","į"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"ių","ius","į"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ų","us","ą"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file +(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%10===1&&(e%100<11||e%100>19)?t:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"į","ius","ių"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"į","ius","ių"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ą","us","ų"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/lv.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/lv.js index 0d6da7f177..df8ee94232 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/lv.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/lv.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/mk.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/mk.js index 2efac65294..319ecca14b 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/mk.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/mk.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ms.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ms.js index 3f2ce70ca0..4258f125b5 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ms.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ms.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Sila hapuskan "+t+" aksara"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Sila masukkan "+t+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(e){return"Anda hanya boleh memilih "+e.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/nb.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/nb.js index b19103407b..6770087cee 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/nb.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/nb.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ -(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nb",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vennligst skriv inn ";return t>1?n+=" flere tegn":n+=" tegn til",n},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file +(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vennligst skriv inn ";return t>1?n+=" flere tegn":n+=" tegn til",n},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/nl.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/nl.js index d2f8736d80..8bd5e3cf43 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/nl.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/nl.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",n="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(n+="s"),n+=" worden geselecteerd",n},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pl.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pl.js index dd25209088..54ba28e9ba 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pl.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pl.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pt-BR.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pt-BR.js index d77841ff8e..a6629c8aec 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pt-BR.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pt-BR.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pt.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pt.js index a6570fae78..0cbda561b9 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pt.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/pt.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"carácter",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ro.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ro.js index b23cdd8500..788a26376a 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ro.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ro.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return t!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți "+t+"sau mai multe caractere";return n},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",e.maximum!==1&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ru.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ru.js index c95fdfa4c2..9ecab80911 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ru.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/ru.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите еще хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sk.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sk.js index e29c996efd..82f294138a 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sk.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sk.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sr-Cyrl.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sr-Cyrl.js index c9d61f0a0b..e9453940cc 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sr-Cyrl.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sr-Cyrl.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr-Cyrl",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Обришите "+n+" симбол";return r+=e(n,"","а","а"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Укуцајте бар још "+n+" симбол";return r+=e(n,"","а","а"),r},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(t){var n="Можете изабрати само "+t.maximum+" ставк";return n+=e(t.maximum,"у","е","и"),n},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sr.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sr.js index 02d577ce4c..ac0cc721fd 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sr.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sr.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sv.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sv.js index 3334874720..bedac08c47 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sv.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/sv.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/th.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/th.js index 9e7c2fc862..097a86c699 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/th.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/th.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/th",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="โปรดลบออก "+t+" ตัวอักษร";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="โปรดพิมพ์เพิ่มอีก "+t+" ตัวอักษร";return n},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(e){var t="คุณสามารถเลือกได้ไม่เกิน "+e.maximum+" รายการ";return t},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/tr.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/tr.js index 7ba93cb78f..25d27a877f 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/tr.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/tr.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tr",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/uk.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/uk.js index 1f22d5fae8..eb3ca89031 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/uk.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/uk.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/vi.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/vi.js index b9c0cd382b..8975b8ac6e 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/vi.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/vi.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/vi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vui lòng nhập ít hơn "+t+" ký tự";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vui lòng nhập nhiều hơn "+t+' ký tự"';return n},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(e){var t="Chỉ có thể chọn được "+e.maximum+" lựa chọn";return t},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/zh-CN.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/zh-CN.js index 9ed3ca9625..2ed959723d 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/zh-CN.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/zh-CN.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="请删除"+t+"个字符";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="请再输入至少"+t+"个字符";return n},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(e){var t="最多只能选择"+e.maximum+"个项目";return t},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/zh-TW.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/zh-TW.js index ab6b49aeef..ea0812ee0d 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/zh-TW.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/i18n/zh-TW.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */ +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="請刪掉"+t+"個字元";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="請再輸入"+t+"個字元";return n},loadingMore:function(){return"載入中…"},maximumSelected:function(e){var t="你只能選擇最多"+e.maximum+"項";return t},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"}}}),{define:e.define,require:e.require}})(); \ No newline at end of file diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/select2.full.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/select2.full.js index 43510eb755..e750834ef5 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/select2.full.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/select2.full.js @@ -1,5 +1,5 @@ /*! - * Select2 4.0.2 + * Select2 4.0.3 * https://select2.github.io * * Released under the MIT license @@ -606,9 +606,23 @@ S2.define('select2/utils',[ Observable.prototype.trigger = function (event) { var slice = Array.prototype.slice; + var params = slice.call(arguments, 1); this.listeners = this.listeners || {}; + // Params should always come in as an array + if (params == null) { + params = []; + } + + // If there are no arguments to the event, use a temporary object + if (params.length === 0) { + params.push({}); + } + + // Set the `_type` of the first object to the event + params[0]._type = event; + if (event in this.listeners) { this.invoke(this.listeners[event], slice.call(arguments, 1)); } @@ -842,6 +856,25 @@ S2.define('select2/results',[ return sorter(data); }; + Results.prototype.highlightFirstItem = function () { + var $options = this.$results + .find('.select2-results__option[aria-selected]'); + + var $selected = $options.filter('[aria-selected=true]'); + + // Check if there are any selected options + if ($selected.length > 0) { + // If there are selected options, highlight the first + $selected.first().trigger('mouseenter'); + } else { + // If there are no selected options, highlight the first option + // in the dropdown + $options.first().trigger('mouseenter'); + } + + this.ensureHighlightVisible(); + }; + Results.prototype.setClasses = function () { var self = this; @@ -869,17 +902,6 @@ S2.define('select2/results',[ } }); - var $selected = $options.filter('[aria-selected=true]'); - - // Check if there are any selected options - if ($selected.length > 0) { - // If there are selected options, highlight the first - $selected.first().trigger('mouseenter'); - } else { - // If there are no selected options, highlight the first option - // in the dropdown - $options.first().trigger('mouseenter'); - } }); }; @@ -990,6 +1012,7 @@ S2.define('select2/results',[ if (container.isOpen()) { self.setClasses(); + self.highlightFirstItem(); } }); @@ -1012,6 +1035,7 @@ S2.define('select2/results',[ } self.setClasses(); + self.highlightFirstItem(); }); container.on('unselect', function () { @@ -1020,6 +1044,7 @@ S2.define('select2/results',[ } self.setClasses(); + self.highlightFirstItem(); }); container.on('open', function () { @@ -1497,6 +1522,12 @@ S2.define('select2/selection/single',[ // User exits the container }); + container.on('focus', function (evt) { + if (!container.isOpen()) { + self.$selection.focus(); + } + }); + container.on('selection:update', function (params) { self.update(params.data); }); @@ -3436,6 +3467,12 @@ S2.define('select2/data/ajax',[ callback(results); }, function () { + // Attempt to detect if a request was aborted + // Only works if the transport exposes a status property + if ($request.status && $request.status === '0') { + return; + } + self.trigger('results:message', { message: 'errorLoading' }); @@ -3444,7 +3481,7 @@ S2.define('select2/data/ajax',[ self._request = $request; } - if (this.ajaxOptions.delay && params.term !== '') { + if (this.ajaxOptions.delay && params.term != null) { if (this._queryTimeout) { window.clearTimeout(this._queryTimeout); } @@ -3607,6 +3644,29 @@ S2.define('select2/data/tokenizer',[ Tokenizer.prototype.query = function (decorated, params, callback) { var self = this; + function createAndSelect (data) { + // Normalize the data object so we can use it for checks + var item = self._normalizeItem(data); + + // Check if the data object already exists as a tag + // Select it if it doesn't + var $existingOptions = self.$element.find('option').filter(function () { + return $(this).val() === item.id; + }); + + // If an existing option wasn't found for it, create the option + if (!$existingOptions.length) { + var $option = self.option(item); + $option.attr('data-select2-tag', true); + + self._removeOldTags(); + self.addOptions([$option]); + } + + // Select the item, now that we know there is an option for it + select(item); + } + function select (data) { self.trigger('select', { data: data @@ -3615,7 +3675,7 @@ S2.define('select2/data/tokenizer',[ params.term = params.term || ''; - var tokenData = this.tokenizer(params, this.options, select); + var tokenData = this.tokenizer(params, this.options, createAndSelect); if (tokenData.term !== params.term) { // Replace the search term if we have the search box @@ -3880,6 +3940,12 @@ S2.define('select2/dropdown/search',[ self.$search.val(''); }); + container.on('focus', function () { + if (container.isOpen()) { + self.$search.focus(); + } + }); + container.on('results:all', function (params) { if (params.query.term == null || params.query.term === '') { var showSearch = self.showSearch(params); @@ -4229,7 +4295,7 @@ S2.define('select2/dropdown/attachBody',[ if (newDirection == 'above' || (isCurrentlyAbove && newDirection !== 'below')) { - css.top = container.top - dropdown.height; + css.top = container.top - parentOffset.top - dropdown.height; } if (newDirection != null) { @@ -4251,6 +4317,7 @@ S2.define('select2/dropdown/attachBody',[ if (this.options.get('dropdownAutoWidth')) { css.minWidth = css.width; + css.position = 'relative'; css.width = 'auto'; } @@ -4317,12 +4384,22 @@ S2.define('select2/dropdown/selectOnClose',[ decorated.call(this, container, $container); - container.on('close', function () { - self._handleSelectOnClose(); + container.on('close', function (params) { + self._handleSelectOnClose(params); }); }; - SelectOnClose.prototype._handleSelectOnClose = function () { + SelectOnClose.prototype._handleSelectOnClose = function (_, params) { + if (params && params.originalSelect2Event != null) { + var event = params.originalSelect2Event; + + // Don't select an item if the close event was triggered from a select or + // unselect event + if (event._type === 'select' || event._type === 'unselect') { + return; + } + } + var $highlightedResults = this.getHighlightedResults(); // Only select highlighted results @@ -4375,7 +4452,10 @@ S2.define('select2/dropdown/closeOnSelect',[ return; } - this.trigger('close', {}); + this.trigger('close', { + originalEvent: originalEvent, + originalSelect2Event: evt + }); }; return CloseOnSelect; @@ -5129,10 +5209,15 @@ S2.define('select2/core',[ }); }); - this._sync = Utils.bind(this._syncAttributes, this); + this.$element.on('focus.select2', function (evt) { + self.trigger('focus', evt); + }); + + this._syncA = Utils.bind(this._syncAttributes, this); + this._syncS = Utils.bind(this._syncSubtree, this); if (this.$element[0].attachEvent) { - this.$element[0].attachEvent('onpropertychange', this._sync); + this.$element[0].attachEvent('onpropertychange', this._syncA); } var observer = window.MutationObserver || @@ -5142,14 +5227,30 @@ S2.define('select2/core',[ if (observer != null) { this._observer = new observer(function (mutations) { - $.each(mutations, self._sync); + $.each(mutations, self._syncA); + $.each(mutations, self._syncS); }); this._observer.observe(this.$element[0], { attributes: true, + childList: true, subtree: false }); } else if (this.$element[0].addEventListener) { - this.$element[0].addEventListener('DOMAttrModified', self._sync, false); + this.$element[0].addEventListener( + 'DOMAttrModified', + self._syncA, + false + ); + this.$element[0].addEventListener( + 'DOMNodeInserted', + self._syncS, + false + ); + this.$element[0].addEventListener( + 'DOMNodeRemoved', + self._syncS, + false + ); } }; @@ -5294,6 +5395,46 @@ S2.define('select2/core',[ } }; + Select2.prototype._syncSubtree = function (evt, mutations) { + var changed = false; + var self = this; + + // Ignore any mutation events raised for elements that aren't options or + // optgroups. This handles the case when the select element is destroyed + if ( + evt && evt.target && ( + evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' + ) + ) { + return; + } + + if (!mutations) { + // If mutation events aren't supported, then we can only assume that the + // change affected the selections + changed = true; + } else if (mutations.addedNodes && mutations.addedNodes.length > 0) { + for (var n = 0; n < mutations.addedNodes.length; n++) { + var node = mutations.addedNodes[n]; + + if (node.selected) { + changed = true; + } + } + } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { + changed = true; + } + + // Only re-pull the data if we think there is a change + if (changed) { + this.dataAdapter.current(function (currentData) { + self.trigger('selection:update', { + data: currentData + }); + }); + } + }; + /** * Override the trigger method to automatically trigger pre-events when * there are events that can be prevented. @@ -5440,7 +5581,7 @@ S2.define('select2/core',[ this.$container.remove(); if (this.$element[0].detachEvent) { - this.$element[0].detachEvent('onpropertychange', this._sync); + this.$element[0].detachEvent('onpropertychange', this._syncA); } if (this._observer != null) { @@ -5448,10 +5589,15 @@ S2.define('select2/core',[ this._observer = null; } else if (this.$element[0].removeEventListener) { this.$element[0] - .removeEventListener('DOMAttrModified', this._sync, false); + .removeEventListener('DOMAttrModified', this._syncA, false); + this.$element[0] + .removeEventListener('DOMNodeInserted', this._syncS, false); + this.$element[0] + .removeEventListener('DOMNodeRemoved', this._syncS, false); } - this._sync = null; + this._syncA = null; + this._syncS = null; this.$element.off('.select2'); this.$element.attr('tabindex', this.$element.data('old-tabindex')); @@ -6235,6 +6381,7 @@ S2.define('jquery.select2',[ return this; } else if (typeof options === 'string') { var ret; + var args = Array.prototype.slice.call(arguments, 1); this.each(function () { var instance = $(this).data('select2'); @@ -6246,8 +6393,6 @@ S2.define('jquery.select2',[ ); } - var args = Array.prototype.slice.call(arguments, 1); - ret = instance[options].apply(instance, args); }); diff --git a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/select2.full.min.js b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/select2.full.min.js index 36403ae2d1..684edf3238 100644 --- a/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/select2.full.min.js +++ b/select2-parent/select2/src/main/java/org/wicketstuff/select2/res/js/select2.full.min.js @@ -1,3 +1,3 @@ -/*! Select2 4.0.2 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;hc;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('
    ');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('
  • '),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")});var f=e.filter("[aria-selected=true]");f.length>0?f.first().trigger("mouseenter"):e.first().trigger("mouseenter")})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&d.setClasses()}),b.on("unselect",function(){b.isOpen()&&d.setClasses()}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(''),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('
      '),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('
    • ×
    • ');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e0||0===c.length)){var d=a('×');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('
    • '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(""),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&(f=d(this),null!=f&&g.push(f))})),b.attr("class",g.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a; -}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;return this._isInitialized?void b.call(this,c):void this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change"); +if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('
    • '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(""),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null; +},e.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&(f=d(this),null!=f&&g.push(f))})),b.attr("class",g.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;return this._isInitialized?void b.call(this,c):void this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('
    • '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(""),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d;return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2.");var e=Array.prototype.slice.call(arguments,1);d=c[b].apply(c,e)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c}); \ No newline at end of file +/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;hc;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('
        ');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('
      • '),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(''),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('
          '),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('
        • ×
        • ');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e0||0===c.length)){var d=a('×');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change"); +if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('
        • '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(""),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null; +},e.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c}); \ No newline at end of file diff --git a/serializer-common/pom.xml b/serializer-common/pom.xml index efc8c3a0e7..fa32ad2415 100644 --- a/serializer-common/pom.xml +++ b/serializer-common/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-serializer-common diff --git a/serializer-fast/pom.xml b/serializer-fast/pom.xml index c6450236fd..3dd0d3bed1 100644 --- a/serializer-fast/pom.xml +++ b/serializer-fast/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-serializer-fast @@ -18,14 +18,10 @@ junit junit - - org.slf4j - slf4j-log4j12 - org.wicketstuff wicketstuff-serializer-common - ${parent.version} + ${project.parent.version} de.ruedigermoeller diff --git a/serializer-fast2/pom.xml b/serializer-fast2/pom.xml index 262893686c..e7b996b8f0 100644 --- a/serializer-fast2/pom.xml +++ b/serializer-fast2/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-serializer-fast2 diff --git a/serializer-kryo/pom.xml b/serializer-kryo/pom.xml index c7f340a2f2..3516908467 100644 --- a/serializer-kryo/pom.xml +++ b/serializer-kryo/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-serializer-kryo @@ -17,10 +17,6 @@ junit junit - - org.slf4j - slf4j-log4j12 - com.googlecode kryo diff --git a/serializer-kryo2/pom.xml b/serializer-kryo2/pom.xml index fd675f3703..84bc853398 100644 --- a/serializer-kryo2/pom.xml +++ b/serializer-kryo2/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-serializer-kryo2 @@ -18,14 +18,10 @@ junit junit - - org.slf4j - slf4j-log4j12 - org.wicketstuff wicketstuff-serializer-common - ${parent.version} + ${project.parent.version} org.slf4j - slf4j-log4j12 - - - log4j - log4j + slf4j-api diff --git a/simile-timeline-parent/simile-timeline/pom.xml b/simile-timeline-parent/simile-timeline/pom.xml index 0525bd637f..d2bfcc224a 100644 --- a/simile-timeline-parent/simile-timeline/pom.xml +++ b/simile-timeline-parent/simile-timeline/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff simile-timeline-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-simile-timeline @@ -40,13 +40,9 @@ junit junit - - log4j - log4j - org.slf4j - slf4j-log4j12 + slf4j-api diff --git a/sitemap-xml-parent/pom.xml b/sitemap-xml-parent/pom.xml index fb537ae677..b2c9f9d51c 100644 --- a/sitemap-xml-parent/pom.xml +++ b/sitemap-xml-parent/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT sitemap-xml-parent diff --git a/sitemap-xml-parent/sitemap-xml-examples/pom.xml b/sitemap-xml-parent/sitemap-xml-examples/pom.xml index 19979d350e..b879deb83a 100644 --- a/sitemap-xml-parent/sitemap-xml-examples/pom.xml +++ b/sitemap-xml-parent/sitemap-xml-examples/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff sitemap-xml-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT sitemap-xml-examples wicketstuff-sitemap-xml-examples diff --git a/sitemap-xml-parent/sitemap-xml/pom.xml b/sitemap-xml-parent/sitemap-xml/pom.xml index 2d3ed8aca1..833e82b73b 100644 --- a/sitemap-xml-parent/sitemap-xml/pom.xml +++ b/sitemap-xml-parent/sitemap-xml/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff sitemap-xml-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-sitemap-xml jar diff --git a/stateless-parent/pom.xml b/stateless-parent/pom.xml index 9e69883466..148ee197d3 100644 --- a/stateless-parent/pom.xml +++ b/stateless-parent/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-stateless-parent diff --git a/stateless-parent/stateless-examples/pom.xml b/stateless-parent/stateless-examples/pom.xml index 9a182e2e5d..f8ca939cd5 100644 --- a/stateless-parent/stateless-examples/pom.xml +++ b/stateless-parent/stateless-examples/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-stateless-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-stateless-examples diff --git a/stateless-parent/stateless/pom.xml b/stateless-parent/stateless/pom.xml index f3b708a99a..e957606b62 100644 --- a/stateless-parent/stateless/pom.xml +++ b/stateless-parent/stateless/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-stateless-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-stateless diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/StatelessEncoder.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/StatelessEncoder.java index 9d584d92d3..164997e1c6 100644 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/StatelessEncoder.java +++ b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/StatelessEncoder.java @@ -29,8 +29,11 @@ /** * Centralize algorithms that are shared. * + * @deprecated Statelss components and behaviors are now supported since + * version 7.4.0, so this module will be dropped in version 8 * @author jfk */ + public class StatelessEncoder { /** diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxEventBehavior.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxEventBehavior.java index 364795d800..f7a1146f58 100644 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxEventBehavior.java +++ b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxEventBehavior.java @@ -25,6 +25,9 @@ /** * Stateless version of AjaxEventBehavior * + * @deprecated Statelss components and behaviors are now supported since + * version 7.4.0, so this module will be dropped in version 8 + * * @author Andrea Del Bene * */ diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormComponentUpdatingBehavior.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormComponentUpdatingBehavior.java index b249a548ee..5024db2cb0 100644 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormComponentUpdatingBehavior.java +++ b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormComponentUpdatingBehavior.java @@ -25,6 +25,8 @@ /** * Stateless version of AjaxFormComponentUpdatingBehavior. * + * @deprecated Statelss components and behaviors are now supported since + * version 7.4.0, so this module will be dropped in version 8 * @author jfk * */ diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormSubmitBehavior.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormSubmitBehavior.java index 3903ce5683..3960166e85 100644 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormSubmitBehavior.java +++ b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessAjaxFormSubmitBehavior.java @@ -26,6 +26,9 @@ /** * Stateless version of AjaxFormSubmitBehavior. + * + * @deprecated Statelss components and behaviors are now supported since + * version 7.4.0, so this module will be dropped in version 8 */ public class StatelessAjaxFormSubmitBehavior extends StatelessAjaxEventBehavior { diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessOnChangeAjaxBehavior.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessOnChangeAjaxBehavior.java index 233577c1ef..74875bf48a 100644 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessOnChangeAjaxBehavior.java +++ b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/behaviors/StatelessOnChangeAjaxBehavior.java @@ -32,6 +32,9 @@ * 'change' event is used. *

          * + * @deprecated Statelss components and behaviors are now supported since + * version 7.4.0, so this module will be dropped in version 8 + * * @author Andrea Del Bene * */ diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxButton.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxButton.java index 69ad633333..92aa4f44f1 100644 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxButton.java +++ b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxButton.java @@ -32,6 +32,9 @@ * * @since 1.3 * + * @deprecated Statelss components and behaviors are now supported since + * version 7.4.0, so this module will be dropped in version 8 + * * @author Igor Vaynberg (ivaynberg) */ public abstract class StatelessAjaxButton extends Button diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxFallbackLink.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxFallbackLink.java index efbd71efa7..5e3b24b84e 100644 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxFallbackLink.java +++ b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxFallbackLink.java @@ -29,6 +29,8 @@ /** * Just like {@link AjaxFallbackLink}, but stateless. * + * @deprecated Statelss components and behaviors are now supported since + * version 7.4.0, so this module will be dropped in version 8 * @author jfk */ public abstract class StatelessAjaxFallbackLink extends StatelessLink diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxSubmitLink.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxSubmitLink.java index 294f8a34bd..1db633745a 100644 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxSubmitLink.java +++ b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessAjaxSubmitLink.java @@ -23,6 +23,8 @@ /** * Stateless version of AjaxSubmitLink. * + * @deprecated Statelss components and behaviors are now supported since + * version 7.4.0, so this module will be dropped in version 8 * @author Andrea Del Bene * */ diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxButton.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxButton.java index ab2dae5c6a..fc1c8af10b 100644 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxButton.java +++ b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxButton.java @@ -5,7 +5,12 @@ import org.apache.wicket.extensions.ajax.markup.html.AjaxIndicatorAppender; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.model.IModel; - +/** + * + * @deprecated Statelss components and behaviors are now supported since + * version 7.4.0, so this module will be dropped in version 8 + * + */ public class StatelessIndicatingAjaxButton extends StatelessAjaxButton implements IAjaxIndicatorAware { private static final long serialVersionUID = 1L; diff --git a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxFallbackLink.java b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxFallbackLink.java index 33ec92a3d7..f779864fde 100644 --- a/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxFallbackLink.java +++ b/stateless-parent/stateless/src/main/java/org/wicketstuff/stateless/components/StatelessIndicatingAjaxFallbackLink.java @@ -20,7 +20,11 @@ import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.IAjaxIndicatorAware; import org.apache.wicket.extensions.ajax.markup.html.AjaxIndicatorAppender; - +/** + * + * @deprecated Statelss components and behaviors are now supported since + * version 7.4.0, so this module will be dropped in version 8 + */ public class StatelessIndicatingAjaxFallbackLink extends StatelessAjaxFallbackLink implements IAjaxIndicatorAware { private static final long serialVersionUID = 1L; diff --git a/tinymce3-parent/pom.xml b/tinymce3-parent/pom.xml index 45e9f5254e..8aaed219b4 100644 --- a/tinymce3-parent/pom.xml +++ b/tinymce3-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT tinymce3-parent diff --git a/tinymce3-parent/tinymce3-examples/pom.xml b/tinymce3-parent/tinymce3-examples/pom.xml index 79dc61aaf3..db4ef0227a 100644 --- a/tinymce3-parent/tinymce3-examples/pom.xml +++ b/tinymce3-parent/tinymce3-examples/pom.xml @@ -16,7 +16,7 @@ org.wicketstuff tinymce3-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT tinymce3-examples diff --git a/tinymce3-parent/tinymce3/pom.xml b/tinymce3-parent/tinymce3/pom.xml index 009cbca54f..78b9c2a1e0 100644 --- a/tinymce3-parent/tinymce3/pom.xml +++ b/tinymce3-parent/tinymce3/pom.xml @@ -16,7 +16,7 @@ org.wicketstuff tinymce3-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-tinymce3 @@ -35,7 +35,7 @@ commons-io commons-io - 2.1 + 2.6 junit diff --git a/tinymce4-parent/pom.xml b/tinymce4-parent/pom.xml index ad838574a3..ae74185fc7 100644 --- a/tinymce4-parent/pom.xml +++ b/tinymce4-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT tinymce4-parent diff --git a/tinymce4-parent/tinymce4-examples/pom.xml b/tinymce4-parent/tinymce4-examples/pom.xml index dc9c86cb8f..cb6b3d97c0 100644 --- a/tinymce4-parent/tinymce4-examples/pom.xml +++ b/tinymce4-parent/tinymce4-examples/pom.xml @@ -16,7 +16,7 @@ org.wicketstuff tinymce4-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT tinymce4-examples diff --git a/tinymce4-parent/tinymce4/pom.xml b/tinymce4-parent/tinymce4/pom.xml index 460435ba92..ccbe634788 100644 --- a/tinymce4-parent/tinymce4/pom.xml +++ b/tinymce4-parent/tinymce4/pom.xml @@ -16,7 +16,7 @@ org.wicketstuff tinymce4-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-tinymce4 @@ -36,7 +36,7 @@ commons-io commons-io - 2.4 + 2.6 junit diff --git a/tinymce4-parent/tinymce4/src/main/java/wicket/contrib/tinymce4/tinymce/plugins/imageupload/plugin.min.js b/tinymce4-parent/tinymce4/src/main/java/wicket/contrib/tinymce4/tinymce/plugins/imageupload/plugin.min.js new file mode 100644 index 0000000000..9099199af2 --- /dev/null +++ b/tinymce4-parent/tinymce4/src/main/java/wicket/contrib/tinymce4/tinymce/plugins/imageupload/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("imageupload",function(a){a.addButton("imageupload",{icon:"image",text:"Image upload",tooltip:"Upload an image",onclick:function(){showImageUploadDialog()}})}); diff --git a/twitter-parent/pom.xml b/twitter-parent/pom.xml index 3575b2ccbf..bb92a91151 100644 --- a/twitter-parent/pom.xml +++ b/twitter-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT twitter-parent diff --git a/twitter-parent/twitter-examples/pom.xml b/twitter-parent/twitter-examples/pom.xml index 11eb5c5e3a..fdceeec452 100644 --- a/twitter-parent/twitter-examples/pom.xml +++ b/twitter-parent/twitter-examples/pom.xml @@ -3,7 +3,7 @@ twitter-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-twitter-examples war diff --git a/twitter-parent/twitter/pom.xml b/twitter-parent/twitter/pom.xml index 2ea914eaea..2eb4904ecf 100644 --- a/twitter-parent/twitter/pom.xml +++ b/twitter-parent/twitter/pom.xml @@ -3,7 +3,7 @@ twitter-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-twitter diff --git a/urlfragment-parent/pom.xml b/urlfragment-parent/pom.xml index ff54192c51..d8c2704257 100644 --- a/urlfragment-parent/pom.xml +++ b/urlfragment-parent/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-urlfragment-parent diff --git a/urlfragment-parent/urlfragment-example/pom.xml b/urlfragment-parent/urlfragment-example/pom.xml index 7c4e75cc54..966170d6db 100644 --- a/urlfragment-parent/urlfragment-example/pom.xml +++ b/urlfragment-parent/urlfragment-example/pom.xml @@ -23,7 +23,7 @@ org.wicketstuff wicketstuff-urlfragment-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-urlfragment-examples @@ -48,7 +48,6 @@ org.apache.wicket wicket-core - ${wicket.version} @@ -83,7 +82,6 @@ org.eclipse.jetty.aggregate jetty-all-server - ${jetty.version} provided diff --git a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/WicketApplication.java b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/WicketApplication.java index 6cb05ad35e..d618b155a5 100644 --- a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/WicketApplication.java +++ b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/WicketApplication.java @@ -6,7 +6,6 @@ public class WicketApplication extends WebApplication { - @Override public Class getHomePage() { diff --git a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/AsyncHomePage.html b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/AsyncHomePage.html index f1f3702ce2..e0b61aee6a 100644 --- a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/AsyncHomePage.html +++ b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/AsyncHomePage.html @@ -5,7 +5,8 @@ WicketUrlFragment example - Hi, I'm a static line of text. I was loaded during the initial page request. Everything below me was loaded after the URL query and fragment parameters were sent to the server asynchronously. -
          + Hi, I'm a static line of text. I was loaded during the initial page request. + Everything below me was loaded after the URL query and fragment parameters were sent to the server asynchronously. +
          diff --git a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/AsyncHomePage.java b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/AsyncHomePage.java index 677881bf0d..42f32ca871 100644 --- a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/AsyncHomePage.java +++ b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/AsyncHomePage.java @@ -7,6 +7,7 @@ public class AsyncHomePage extends AsyncUrlFragmentAwarePage { + private static final long serialVersionUID = 1L; @Override protected void onInitialize() diff --git a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/ContentPanel.html b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/ContentPanel.html index 50757a9832..5e52a8a2ab 100644 --- a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/ContentPanel.html +++ b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/ContentPanel.html @@ -1,14 +1,17 @@ + + -

          parameter 'linkParam' from initial page request (reload page to update):

          - -

          replace fragment with anything

          -

          replace fragment with key-value-pair

          -

          put parameter into fragment

          -

          append parameter

          -

          remove parameter

          - -
          - - - -
          \ No newline at end of file +

          parameter 'linkParam' from initial page request (reload page to update):

          + +

          replace fragment with anything

          +

          replace fragment with key-value-pair

          +

          put parameter into fragment

          +

          append parameter

          +

          remove parameter

          + +
          + + + + + diff --git a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/ContentPanel.java b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/ContentPanel.java index 98d65af139..0c4214927e 100644 --- a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/ContentPanel.java +++ b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpage/ContentPanel.java @@ -16,7 +16,7 @@ public class ContentPanel extends Panel { - + private static final long serialVersionUID = 1L; private final StringValue linkParam; public ContentPanel(String id, IRequestParameters requestParameters) @@ -44,6 +44,7 @@ protected void onInitialize() add(new BookmarkableAjaxLink("setFragment") { + private static final long serialVersionUID = 1L; @Override public void onBookmarkableClick(AjaxRequestTarget target) @@ -56,6 +57,7 @@ public void onBookmarkableClick(AjaxRequestTarget target) add(new BookmarkableAjaxLink("setFragmentParameter") { + private static final long serialVersionUID = 1L; @Override public void onBookmarkableClick(AjaxRequestTarget target) @@ -68,6 +70,7 @@ public void onBookmarkableClick(AjaxRequestTarget target) add(new BookmarkableAjaxLink("appendParam") { + private static final long serialVersionUID = 1L; @Override public void onBookmarkableClick(AjaxRequestTarget target) @@ -80,6 +83,7 @@ public void onBookmarkableClick(AjaxRequestTarget target) add(new BookmarkableAjaxLink("putParam") { + private static final long serialVersionUID = 1L; @Override public void onBookmarkableClick(AjaxRequestTarget target) @@ -92,6 +96,7 @@ public void onBookmarkableClick(AjaxRequestTarget target) add(new BookmarkableAjaxLink("removeParam") { + private static final long serialVersionUID = 1L; @Override public void onBookmarkableClick(AjaxRequestTarget target) @@ -103,11 +108,12 @@ public void onBookmarkableClick(AjaxRequestTarget target) }); final Model formModel = Model.of("something"); - final Form form = new StatelessForm("form"); + final Form form = new StatelessForm<>("form"); form.setOutputMarkupId(true); - form.add(new TextField("formParam", formModel)); + form.add(new TextField<>("formParam", formModel)); form.add(new BookmarkableAjaxButton("submit") { + private static final long serialVersionUID = 1L; @Override protected void onBookmarkableSubmit(AjaxRequestTarget target, Form form) diff --git a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/AsyncContentPanel.html b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/AsyncContentPanel.html index c778c1594b..e4ade2c792 100644 --- a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/AsyncContentPanel.html +++ b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/AsyncContentPanel.html @@ -1,5 +1,8 @@ + + -

          ASC

          -

          DESC

          -

          sorting:

          -
          \ No newline at end of file +

          ASC

          +

          DESC

          +

          sorting:

          + + diff --git a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/AsyncContentPanel.java b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/AsyncContentPanel.java index d0d1c416da..15e6650754 100644 --- a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/AsyncContentPanel.java +++ b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/AsyncContentPanel.java @@ -10,7 +10,7 @@ public class AsyncContentPanel extends AsyncUrlFragmentAwarePanel { - + private static final long serialVersionUID = 1L; private final IModel sortingModel; private final Label sortingLabel; @@ -26,6 +26,7 @@ public AsyncContentPanel(String id) add(new BookmarkableAjaxLink("zins_asc", "sorting", "zins_asc") { + private static final long serialVersionUID = 1L; @Override public void onBookmarkableClick(AjaxRequestTarget target) @@ -38,6 +39,7 @@ public void onBookmarkableClick(AjaxRequestTarget target) add(new BookmarkableAjaxLink("zins_desc", "sorting", "zins_desc") { + private static final long serialVersionUID = 1L; @Override public void onBookmarkableClick(AjaxRequestTarget target) diff --git a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/HomePage.html b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/HomePage.html index 32ada89896..d4a62ceda6 100644 --- a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/HomePage.html +++ b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/HomePage.html @@ -5,7 +5,7 @@ WicketUrlFragment example - static content - + static content + diff --git a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/HomePage.java b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/HomePage.java index 213737731d..14b831b5b7 100644 --- a/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/HomePage.java +++ b/urlfragment-parent/urlfragment-example/src/main/java/org/wicketstuff/urlfragment/example/asyncpanel/HomePage.java @@ -5,6 +5,7 @@ public class HomePage extends WebPage { + private static final long serialVersionUID = 1L; public HomePage(final PageParameters parameters) { diff --git a/urlfragment-parent/urlfragment-example/src/test/java/start/Start.java b/urlfragment-parent/urlfragment-example/src/test/java/start/Start.java index 746ee3f4c1..e41c17b154 100644 --- a/urlfragment-parent/urlfragment-example/src/test/java/start/Start.java +++ b/urlfragment-parent/urlfragment-example/src/test/java/start/Start.java @@ -9,7 +9,7 @@ import org.eclipse.jetty.webapp.WebAppContext; public class Start { - public static void main(String[] args) throws Exception { + public static void main(String[] args) { int timeout = (int) Duration.ONE_HOUR.getMilliseconds(); Server server = new Server(); diff --git a/urlfragment-parent/urlfragment/pom.xml b/urlfragment-parent/urlfragment/pom.xml index 405bc75908..f1628ded39 100644 --- a/urlfragment-parent/urlfragment/pom.xml +++ b/urlfragment-parent/urlfragment/pom.xml @@ -21,7 +21,7 @@ org.wicketstuff wicketstuff-urlfragment-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT 4.0.0 wicketstuff-urlfragment @@ -40,7 +40,6 @@ org.apache.wicket wicket-core - ${wicket.version} diff --git a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/AsyncUrlFragmentAwarePage.java b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/AsyncUrlFragmentAwarePage.java index 5e7ea36873..e1a95eba5c 100644 --- a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/AsyncUrlFragmentAwarePage.java +++ b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/AsyncUrlFragmentAwarePage.java @@ -1,11 +1,11 @@ /* Copyright (c) 2013 Martin Knopf - * + * * Licensed under the MIT license; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://opensource.org/licenses/MIT - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -39,13 +39,13 @@ * call. This means, that, before the fragment parameters arrive, your implementation has to have * initial state (models) and content and cannot be invisible. *

          - * + * * @author Martin Knopf - * + * */ public abstract class AsyncUrlFragmentAwarePage extends WebPage implements IBookmarkableComponent { - + private static final long serialVersionUID = 1L; private transient AjaxRequestTarget target = null; protected UrlParametersReceivingBehavior urlParametersReceivingBehavior; @@ -70,6 +70,8 @@ protected void onInitialize() super.onInitialize(); urlParametersReceivingBehavior = new UrlParametersReceivingBehavior(getOptions()) { + private static final long serialVersionUID = 1L; + @Override protected void onParameterArrival(IRequestParameters requestParameters, AjaxRequestTarget target) @@ -95,18 +97,18 @@ protected void onParameterArrival(IRequestParameters requestParameters, * '&') * *

          - * + * * @return */ protected Map getOptions() { - return new HashMap(); + return new HashMap<>(); } /** * This is where you can grab the URL query and fragment parameters, your site was requested * with. You can use {@link #urlFragment()} inside this method. - * + * * @param requestParameters * @param target */ @@ -146,7 +148,7 @@ public void removeFragmentParameter(String parameterName) /** * Returns a {@link UrlFragment} connected to the current {@link AjaxRequestTarget}. Use the * {@link UrlFragment} to update the URL fragment in the browser after the current AJAX event. - * + * * @return */ protected UrlFragment urlFragment() @@ -158,6 +160,6 @@ protected UrlFragment urlFragment() public void renderHead(IHeaderResponse response) { super.renderHead(response); - response.render(UrlParametersReceivingBehavior.getJS(AsyncUrlFragmentAwarePage.class)); + response.render(UrlParametersReceivingBehavior.JS_REF); } } diff --git a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/AsyncUrlFragmentAwarePanel.java b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/AsyncUrlFragmentAwarePanel.java index 970bcd357b..6b517353a1 100644 --- a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/AsyncUrlFragmentAwarePanel.java +++ b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/AsyncUrlFragmentAwarePanel.java @@ -1,11 +1,11 @@ /* Copyright (c) 2013 Martin Knopf - * + * * Licensed under the MIT license; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://opensource.org/licenses/MIT - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,13 +38,13 @@ * call. This means, that, before the fragment parameters arrive, your implementation has to have * initial state (models) and content and cannot be invisible. *

          - * + * * @author Martin Knopf - * + * */ public abstract class AsyncUrlFragmentAwarePanel extends Panel implements IBookmarkableComponent { - + private static final long serialVersionUID = 1L; private transient AjaxRequestTarget target = null; public AsyncUrlFragmentAwarePanel(String id) @@ -64,6 +64,7 @@ private void initializeFragmentBehavior() this.setOutputMarkupId(true); add(new UrlParametersReceivingBehavior(getOptions()) { + private static final long serialVersionUID = 1L; @Override protected void onParameterArrival(IRequestParameters requestParameters, @@ -91,18 +92,18 @@ protected void onParameterArrival(IRequestParameters requestParameters, * is '&') * *

          - * + * * @return */ protected Map getOptions() { - return new HashMap(); + return new HashMap<>(); } /** * This is where you can grab the URL query and fragment parameters, your site was requested * with. You can use {@link #urlFragment()} inside this method. - * + * * @param requestParameters * @param target */ @@ -143,18 +144,17 @@ public void removeFragmentParameter(String parameterName) public void renderHead(IHeaderResponse response) { super.renderHead(response); - response.render(UrlParametersReceivingBehavior.getJS(AsyncUrlFragmentAwarePanel.class)); + response.render(UrlParametersReceivingBehavior.JS_REF); } /** * Returns a {@link UrlFragment} connected to the current {@link AjaxRequestTarget}. Use the * {@link UrlFragment} to update the URL fragment in the browser after the current AJAX event. - * + * * @return */ protected UrlFragment urlFragment() { return new UrlFragment(target); } - } diff --git a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/BookmarkableAjaxButton.java b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/BookmarkableAjaxButton.java index 476eb07b7c..8dc73d21f7 100644 --- a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/BookmarkableAjaxButton.java +++ b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/BookmarkableAjaxButton.java @@ -1,11 +1,11 @@ /* Copyright (c) 2013 Martin Knopf - * + * * Licensed under the MIT license; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://opensource.org/licenses/MIT - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,12 +26,12 @@ * You can set or remove parameters using {@link #setFragmentParameter(String, String)} or * {@link #removeFragmentParameter(String)} during your handling of the submit and error event. *

          - * + * * @author Martin Knopf */ public abstract class BookmarkableAjaxButton extends AjaxButton implements IBookmarkableComponent { - + private static final long serialVersionUID = 1L; private transient AjaxRequestTarget target = null; public BookmarkableAjaxButton(String id) @@ -72,7 +72,7 @@ protected void onError(AjaxRequestTarget target, Form form) /** * Override to handle the submit event. You can use {@link #urlFragment()} inside this method. - * + * * @param target * @param form */ @@ -80,7 +80,7 @@ protected void onError(AjaxRequestTarget target, Form form) /** * Override to handle the error event. You can use {@link #urlFragment()} inside this method. - * + * * @param target * @param form */ @@ -119,7 +119,7 @@ public void removeFragmentParameter(String parameterName) /** * Returns a {@link UrlFragment} connected to the current {@link AjaxRequestTarget}. Use the * {@link UrlFragment} to update the URL fragment in the browser after the current AJAX event. - * + * * @return */ protected UrlFragment urlFragment() @@ -131,7 +131,6 @@ protected UrlFragment urlFragment() public void renderHead(IHeaderResponse response) { super.renderHead(response); - response.render(UrlParametersReceivingBehavior.getJS(BookmarkableAjaxButton.class)); + response.render(UrlParametersReceivingBehavior.JS_REF); } - } diff --git a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/BookmarkableAjaxLink.java b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/BookmarkableAjaxLink.java index 760ce2bdbc..8a88d99c72 100644 --- a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/BookmarkableAjaxLink.java +++ b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/BookmarkableAjaxLink.java @@ -1,11 +1,11 @@ /* Copyright (c) 2013 Martin Knopf - * + * * Licensed under the MIT license; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://opensource.org/licenses/MIT - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,13 +26,14 @@ * event handling. You can also set or remove parameters by yourself using * {@link #setFragmentParameter(String, String)} or {@link #removeFragmentParameter(String)}. *

          - * + * * @author Martin Knopf - * + * * @param */ public abstract class BookmarkableAjaxLink extends AjaxLink implements IBookmarkableComponent { + private static final long serialVersionUID = 1L; private transient AjaxRequestTarget target = null; @@ -41,7 +42,7 @@ public abstract class BookmarkableAjaxLink extends AjaxLink implements IBo /** * Constructor. - * + * * @param id */ public BookmarkableAjaxLink(String id) @@ -51,7 +52,7 @@ public BookmarkableAjaxLink(String id) /** * Constructor. - * + * * @param id * @param model */ @@ -63,7 +64,7 @@ public BookmarkableAjaxLink(String id, IModel model) /** * Constructor. Sets given URL fragment parameter in the browser during the click event. Be * aware that the given parameter name and value will not be set if they are empty. - * + * * @param id * @param parameterName * @param parameterValue @@ -79,7 +80,7 @@ public BookmarkableAjaxLink(String id, String parameterName, String parameterVal * Constructor. Sets given default URL fragment parameter during the click event. Be aware that * the given parameter name and value will not be set if either one is empty and that the * parameter will be overwritten if it already exists. - * + * * @param id * @param model * @param parameterName @@ -108,7 +109,7 @@ public void onClick(AjaxRequestTarget target) /** * Handles the click event. Your default URL fragment parameter was already set automatically if * it wasn't empty. You can use {@link #urlFragment()} inside this method. - * + * * @param target */ public abstract void onBookmarkableClick(AjaxRequestTarget target); @@ -146,7 +147,7 @@ public void removeFragmentParameter(String parameterName) /** * Returns a {@link UrlFragment} connected to the current {@link AjaxRequestTarget}. Use the * {@link UrlFragment} to update the URL fragment in the browser after the current AJAX event. - * + * * @return */ protected UrlFragment urlFragment() @@ -158,7 +159,6 @@ protected UrlFragment urlFragment() public void renderHead(IHeaderResponse response) { super.renderHead(response); - response.render(UrlParametersReceivingBehavior.getJS(BookmarkableAjaxLink.class)); + response.render(UrlParametersReceivingBehavior.JS_REF); } - } diff --git a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/CrawlableAsyncUrlFragmentAwarePage.java b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/CrawlableAsyncUrlFragmentAwarePage.java index a8f31b17b8..0074cc0d48 100644 --- a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/CrawlableAsyncUrlFragmentAwarePage.java +++ b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/CrawlableAsyncUrlFragmentAwarePage.java @@ -24,6 +24,7 @@ */ public abstract class CrawlableAsyncUrlFragmentAwarePage extends AsyncUrlFragmentAwarePage { + private static final long serialVersionUID = 1L; @Override protected void onInitialize() diff --git a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/IBookmarkableComponent.java b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/IBookmarkableComponent.java index e1529c2806..c7f367609c 100644 --- a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/IBookmarkableComponent.java +++ b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/IBookmarkableComponent.java @@ -1,11 +1,11 @@ /* Copyright (c) 2013 Martin Knopf - * + * * Licensed under the MIT license; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://opensource.org/licenses/MIT - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,14 +18,13 @@ public interface IBookmarkableComponent { - /** * Sets the given URL fragment parameter by adding a JavaScript to the current * {@link AjaxRequestTarget}. *

          * The parameter will be overwritten if it already exists. *

          - * + * * @param parameterName * the name of your URL fragment parameter to set * @param parameterValue @@ -47,7 +46,7 @@ public interface IBookmarkableComponent *

          * The value will be appended with the specified delimiter if the parameter already exists. *

          - * + * * @param parameterName * the name of your URL fragment parameter to set * @param parameterValue @@ -66,11 +65,10 @@ public interface IBookmarkableComponent *

          * Removes the given URL fragment parameter by adding a JavaScript to the current * {@link AjaxRequestTarget}. - * + * * @param parameterName * the name of your URL fragment parameter to set */ @Deprecated void removeFragmentParameter(String parameterName); - } diff --git a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlFragment.java b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlFragment.java index e8ad74872b..cc975d1211 100644 --- a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlFragment.java +++ b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlFragment.java @@ -1,11 +1,11 @@ /* Copyright (c) 2013 Martin Knopf - * + * * Licensed under the MIT license; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://opensource.org/licenses/MIT - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,9 +18,9 @@ /** * Encapsulates the JavaScripts used to edit the URL fragment in the browser. - * + * * @author Martin Knopf - * + * */ public class UrlFragment { @@ -33,7 +33,7 @@ public UrlFragment(IPartialPageRequestHandler handler) /** * Sets the value of window.location.hash to the given String. - * + * * @param urlFragment * @return */ @@ -47,7 +47,7 @@ public UrlFragment set(Object urlFragment) /** * Sets the value of window.location.hash to the given key-value-pair. - * + * * @param parameterName * @param parameterValue * @return @@ -62,7 +62,7 @@ public UrlFragment set(String parameterName, Object parameterValue) /** * Puts the given key-value-pair into window.location.hash. - * + * * @param parameterName * @param parameterValue * @return @@ -78,7 +78,7 @@ public UrlFragment putParameter(String parameterName, Object parameterValue) /** * Puts the given key-value-pair into window.location.hash. If the key already exists the value * will be appended to the existing value with the given delimiter. - * + * * @param parameterName * @param parameterValue * @param valueDelimiter @@ -96,7 +96,7 @@ public UrlFragment putParameter(String parameterName, Object parameterValue, /** * Removes the key-value-pair from window.location.hash that is identified by the given * parameter name. - * + * * @param parameterName * @return */ @@ -115,5 +115,4 @@ private void addJsToTarget(String js) this.handler.prependJavaScript(js); } } - } diff --git a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlParametersReceivingBehavior.java b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlParametersReceivingBehavior.java index 5499892cf0..bcb1e0060b 100644 --- a/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlParametersReceivingBehavior.java +++ b/urlfragment-parent/urlfragment/src/main/java/org/wicketstuff/urlfragment/UrlParametersReceivingBehavior.java @@ -1,11 +1,11 @@ /* Copyright (c) 2013 Martin Knopf - * + * * Licensed under the MIT license; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://opensource.org/licenses/MIT - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,10 +22,8 @@ import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.ajax.json.JSONException; -import org.apache.wicket.ajax.json.JSONStringer; -import org.apache.wicket.ajax.json.JSONWriter; +import org.apache.wicket.ajax.json.JSONObject; import org.apache.wicket.behavior.Behavior; -import org.apache.wicket.markup.head.HeaderItem; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.JavaScriptHeaderItem; import org.apache.wicket.markup.head.OnDomReadyHeaderItem; @@ -36,12 +34,15 @@ /** * Reads URL fragment parameters. This {@link Behavior} will execute an AJAX call to itself with the * URL query and fragment parameters. - * + * * @author Martin Knopf - * + * */ public abstract class UrlParametersReceivingBehavior extends AbstractDefaultAjaxBehavior { + private static final long serialVersionUID = 1L; + protected static final JavaScriptHeaderItem JS_REF + = JavaScriptHeaderItem.forReference(new PackageResourceReference(UrlParametersReceivingBehavior.class, "urlfragment.js")); private final Component[] components; private final Map options; @@ -49,7 +50,7 @@ public abstract class UrlParametersReceivingBehavior extends AbstractDefaultAjax /** * Constructor that takes an array of {@link Component}s which will be added to the * {@link AjaxRequestTarget} for you when the URL parameters come in. - * + * * @param components * the components you wish to add to the request target when the income of the URL * fragment parameters is handled @@ -62,7 +63,7 @@ public UrlParametersReceivingBehavior(Component... components) /** * Constructor that takes an array of {@link Component}s which will be added to the * {@link AjaxRequestTarget} for you when the URL parameters come in. - * + * * @param options * JS options to customize the behavior * @param components @@ -82,15 +83,15 @@ public void renderHead(Component component, IHeaderResponse response) super.renderHead(component, response); StringBuilder sb = new StringBuilder().append("try{") - .append("window.UrlUtil = newUrlUtil(") + .append("if (window.UrlUtil === undefined) {window.UrlUtil = newUrlUtil(") .append(optionsJsonString()) .append(");") .append("UrlUtil.setWicketAjaxCall(function(){" + getCallbackFunctionBody() + "});") .append("$(window).bind('hashchange',window.UrlUtil.back);") - .append("window.UrlUtil.sendUrlParameters();") + .append("window.UrlUtil.sendUrlParameters();}") .append("}catch(e){}"); response.render(new OnDomReadyHeaderItem(sb.toString())); - response.render(getJS(getClass())); + response.render(JS_REF); } private String optionsJsonString() @@ -98,13 +99,7 @@ private String optionsJsonString() String optionsJsonString = ""; try { - JSONWriter writer = new JSONStringer().object(); - for (String key : options.keySet()) - { - writer.key(key).value(options.get(key)); - } - writer.endObject(); - optionsJsonString = writer.toString(); + optionsJsonString = new JSONObject(options).toString(); } catch (JSONException e) { @@ -117,8 +112,9 @@ protected void respond(AjaxRequestTarget target) { onParameterArrival(RequestCycle.get().getRequest().getRequestParameters(), target); - if (this.components != null) + if (this.components != null) { addComponentsToBeRendered(target); + } } @Override @@ -135,7 +131,7 @@ private void addComponentsToBeRendered(AjaxRequestTarget target) /** * Hook for evaluating the request parameters when they come in. - * + * * @param requestParameters * use this to obtain the values of your URL fragment parameters * @param target @@ -143,18 +139,4 @@ private void addComponentsToBeRendered(AjaxRequestTarget target) */ protected abstract void onParameterArrival(IRequestParameters requestParameters, AjaxRequestTarget target); - - /** - * Returns the {@link HeaderItem} representing the JavaScript library used to read and write URL - * fragment parameters. - * - * @param scope - * the scope of the {@link PackageResourceReference} - * @return - */ - protected static HeaderItem getJS(Class scope) - { - PackageResourceReference ref = new PackageResourceReference(scope, "urlfragment.js"); - return JavaScriptHeaderItem.forReference(ref, ref.getName()); - } } diff --git a/whiteboard-parent/pom.xml b/whiteboard-parent/pom.xml index 66c5ecd3c2..84c373dd74 100644 --- a/whiteboard-parent/pom.xml +++ b/whiteboard-parent/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-whiteboard-parent diff --git a/whiteboard-parent/whiteboard-examples/pom.xml b/whiteboard-parent/whiteboard-examples/pom.xml index 3808fbdc32..8864a97b84 100644 --- a/whiteboard-parent/whiteboard-examples/pom.xml +++ b/whiteboard-parent/whiteboard-examples/pom.xml @@ -7,7 +7,7 @@ wicketstuff-whiteboard-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-whiteboard-examples diff --git a/whiteboard-parent/whiteboard/pom.xml b/whiteboard-parent/whiteboard/pom.xml index 7eb267e939..0b12e01eb6 100644 --- a/whiteboard-parent/whiteboard/pom.xml +++ b/whiteboard-parent/whiteboard/pom.xml @@ -7,7 +7,7 @@ wicketstuff-whiteboard-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-whiteboard @@ -41,7 +41,7 @@ org.slf4j - slf4j-log4j12 + slf4j-api javax.servlet diff --git a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/WhiteboardBehavior.java b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/WhiteboardBehavior.java index a667ecdfd6..f1ffed03cf 100644 --- a/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/WhiteboardBehavior.java +++ b/whiteboard-parent/whiteboard/src/main/java/org/wicketstuff/whiteboard/WhiteboardBehavior.java @@ -16,6 +16,22 @@ */ package org.wicketstuff.whiteboard; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.concurrent.BlockingDeque; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.LinkedBlockingDeque; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; @@ -23,7 +39,11 @@ import org.apache.wicket.ajax.json.JSONArray; import org.apache.wicket.ajax.json.JSONException; import org.apache.wicket.ajax.json.JSONObject; -import org.apache.wicket.markup.head.*; +import org.apache.wicket.markup.head.CssHeaderItem; +import org.apache.wicket.markup.head.IHeaderResponse; +import org.apache.wicket.markup.head.JavaScriptHeaderItem; +import org.apache.wicket.markup.head.OnDomReadyHeaderItem; +import org.apache.wicket.markup.head.PriorityHeaderItem; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.protocol.ws.WebSocketSettings; import org.apache.wicket.protocol.ws.api.IWebSocketConnection; @@ -33,24 +53,39 @@ import org.apache.wicket.request.http.WebRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.wicketstuff.whiteboard.elements.*; +import org.wicketstuff.whiteboard.elements.CircleGeneral; +import org.wicketstuff.whiteboard.elements.Circle_3p; +import org.wicketstuff.whiteboard.elements.ClipArt; +import org.wicketstuff.whiteboard.elements.Element; import org.wicketstuff.whiteboard.elements.Element.Type; -import org.wicketstuff.whiteboard.resource.*; +import org.wicketstuff.whiteboard.elements.LineGeneral; +import org.wicketstuff.whiteboard.elements.Line_2p; +import org.wicketstuff.whiteboard.elements.PencilArrow; +import org.wicketstuff.whiteboard.elements.PencilCircle; +import org.wicketstuff.whiteboard.elements.PencilCurve; +import org.wicketstuff.whiteboard.elements.PencilFreeLine; +import org.wicketstuff.whiteboard.elements.PencilPointAtRect; +import org.wicketstuff.whiteboard.elements.PencilPointer; +import org.wicketstuff.whiteboard.elements.PencilRect; +import org.wicketstuff.whiteboard.elements.PencilUnderline; +import org.wicketstuff.whiteboard.elements.PointAtCircle; +import org.wicketstuff.whiteboard.elements.PointAtLine; +import org.wicketstuff.whiteboard.elements.PointFree; +import org.wicketstuff.whiteboard.elements.Point_2c; +import org.wicketstuff.whiteboard.elements.Point_2l; +import org.wicketstuff.whiteboard.elements.Point_lc; +import org.wicketstuff.whiteboard.elements.Segment; +import org.wicketstuff.whiteboard.elements.Text; +import org.wicketstuff.whiteboard.resource.GoogStyleSheetResourceReference; +import org.wicketstuff.whiteboard.resource.TranslateJavaScriptResourceReference; +import org.wicketstuff.whiteboard.resource.WhiteboardHelperJavaScriptResourceReference; +import org.wicketstuff.whiteboard.resource.WhiteboardJavaScriptResourceReference; +import org.wicketstuff.whiteboard.resource.WhiteboardStyleSheetResourceReference; import org.wicketstuff.whiteboard.settings.WhiteboardLibrarySettings; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.concurrent.BlockingDeque; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.LinkedBlockingDeque; - /** * This class is the behaviour handler of the whiteboard. All the server-side functionality of whiteboard is handled * here @@ -917,7 +952,7 @@ private void loadDocuments() { * @return */ private boolean isEqual(JSONObject element1, JSONObject element2) { - for (String key : JSONObject.getNames(element1)) { + for (String key : element1.keySet()) { Object value = null; try { value = element2.get(key); diff --git a/wicket-bundle-parent/pom.xml b/wicket-bundle-parent/pom.xml index cd73b734aa..0e366d0426 100644 --- a/wicket-bundle-parent/pom.xml +++ b/wicket-bundle-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-bundle-parent diff --git a/wicket-bundle-parent/wicket-bundle/pom.xml b/wicket-bundle-parent/wicket-bundle/pom.xml index 03cd77faa8..834ebd7984 100644 --- a/wicket-bundle-parent/wicket-bundle/pom.xml +++ b/wicket-bundle-parent/wicket-bundle/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicket-bundle-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-bundle diff --git a/wicket-bundle-parent/wicket-ioc-bundle/pom.xml b/wicket-bundle-parent/wicket-ioc-bundle/pom.xml index ff794dd146..35b625919a 100644 --- a/wicket-bundle-parent/wicket-ioc-bundle/pom.xml +++ b/wicket-bundle-parent/wicket-ioc-bundle/pom.xml @@ -3,7 +3,7 @@ wicket-bundle-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-ioc-bundle bundle diff --git a/wicket-facebook-parent/pom.xml b/wicket-facebook-parent/pom.xml index 2674b5d72e..d8fcd0ca61 100644 --- a/wicket-facebook-parent/pom.xml +++ b/wicket-facebook-parent/pom.xml @@ -4,7 +4,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT Wicket Facebook :: Parent diff --git a/wicket-facebook-parent/wicket-facebook-examples/pom.xml b/wicket-facebook-parent/wicket-facebook-examples/pom.xml index 69b8bc03cd..ebbfd75f27 100644 --- a/wicket-facebook-parent/wicket-facebook-examples/pom.xml +++ b/wicket-facebook-parent/wicket-facebook-examples/pom.xml @@ -4,7 +4,7 @@ wicket-facebook-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-facebook-examples Wicket Facebook Examples diff --git a/wicket-facebook-parent/wicket-facebook/pom.xml b/wicket-facebook-parent/wicket-facebook/pom.xml index bab423e611..da2aa38a2a 100644 --- a/wicket-facebook-parent/wicket-facebook/pom.xml +++ b/wicket-facebook-parent/wicket-facebook/pom.xml @@ -4,7 +4,7 @@ wicket-facebook-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-facebook Wicket Facebook diff --git a/wicket-facebook-parent/wicket-facebook/src/main/java/org/wicketstuff/facebook/plugins/LoginButton.java b/wicket-facebook-parent/wicket-facebook/src/main/java/org/wicketstuff/facebook/plugins/LoginButton.java index 44440f7f9c..3354d3040b 100644 --- a/wicket-facebook-parent/wicket-facebook/src/main/java/org/wicketstuff/facebook/plugins/LoginButton.java +++ b/wicket-facebook-parent/wicket-facebook/src/main/java/org/wicketstuff/facebook/plugins/LoginButton.java @@ -60,7 +60,7 @@ public LoginButton(final String id) add(new AttributeModifier("data-show-faces", new PropertyModel(this, "showFaces"))); add(new AttributeModifier("data-max-rows", new PropertyModel(this, "maxRows"))); - add(new AttributeModifier("data-perms", new PermissionsModel())); + add(new AttributeModifier("data-scope", new PermissionsModel())); } /** diff --git a/wicket-foundation/pom.xml b/wicket-foundation/pom.xml index f2763f5f80..11d536f425 100644 --- a/wicket-foundation/pom.xml +++ b/wicket-foundation/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT org.wicketstuff.foundation diff --git a/wicket-foundation/wicket-foundation-core/pom.xml b/wicket-foundation/wicket-foundation-core/pom.xml index 3726a86e93..7cd00e99d2 100644 --- a/wicket-foundation/wicket-foundation-core/pom.xml +++ b/wicket-foundation/wicket-foundation-core/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff.foundation wicket-foundation-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-foundation-core @@ -23,18 +23,12 @@ org.slf4j - slf4j-log4j12 + slf4j-simple test - - log4j - log4j - test - javax.servlet - servlet-api - 2.5 + javax.servlet-api test diff --git a/wicket-foundation/wicket-foundation-samples/pom.xml b/wicket-foundation/wicket-foundation-samples/pom.xml index 34b077d8d8..0dbe890d04 100644 --- a/wicket-foundation/wicket-foundation-samples/pom.xml +++ b/wicket-foundation/wicket-foundation-samples/pom.xml @@ -7,7 +7,7 @@ wicket-foundation-parent org.wicketstuff.foundation - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-foundation-samples diff --git a/wicket-html5-parent/pom.xml b/wicket-html5-parent/pom.xml index 78bf184d2f..cd957e66bb 100644 --- a/wicket-html5-parent/pom.xml +++ b/wicket-html5-parent/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-html5-parent diff --git a/wicket-html5-parent/wicket-html5-examples/pom.xml b/wicket-html5-parent/wicket-html5-examples/pom.xml index 24e081927f..59f89b6d6b 100644 --- a/wicket-html5-parent/wicket-html5-examples/pom.xml +++ b/wicket-html5-parent/wicket-html5-examples/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-html5-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-html5-examples diff --git a/wicket-html5-parent/wicket-html5/pom.xml b/wicket-html5-parent/wicket-html5/pom.xml index 5a6a082861..beb66929f5 100644 --- a/wicket-html5-parent/wicket-html5/pom.xml +++ b/wicket-html5-parent/wicket-html5/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-html5-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-html5 diff --git a/wicket-mount-parent/pom.xml b/wicket-mount-parent/pom.xml index 3e8ea5547d..0a25933d65 100644 --- a/wicket-mount-parent/pom.xml +++ b/wicket-mount-parent/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-mount-parent diff --git a/wicket-mount-parent/wicket-mount-core/pom.xml b/wicket-mount-parent/wicket-mount-core/pom.xml index f17634ece2..787e56dc94 100644 --- a/wicket-mount-parent/wicket-mount-core/pom.xml +++ b/wicket-mount-parent/wicket-mount-core/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicket-mount-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT 4.0.0 diff --git a/wicket-mount-parent/wicket-mount-example/pom.xml b/wicket-mount-parent/wicket-mount-example/pom.xml index 9bb94e06f2..62318e618d 100644 --- a/wicket-mount-parent/wicket-mount-example/pom.xml +++ b/wicket-mount-parent/wicket-mount-example/pom.xml @@ -5,7 +5,7 @@ wicket-mount-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT org.wicketstuff diff --git a/wicket-mount-parent/wicket-mount/pom.xml b/wicket-mount-parent/wicket-mount/pom.xml index 175f34cc2b..d213404a5d 100644 --- a/wicket-mount-parent/wicket-mount/pom.xml +++ b/wicket-mount-parent/wicket-mount/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicket-mount-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT 4.0.0 wicket-mount diff --git a/wicket-osgi-parent/pom.xml b/wicket-osgi-parent/pom.xml index d011fae003..7b8fc8c5f8 100644 --- a/wicket-osgi-parent/pom.xml +++ b/wicket-osgi-parent/pom.xml @@ -3,7 +3,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-osgi-parent Wicket OSGi Parent diff --git a/wicket-osgi-parent/wicket-osgi-test-service/pom.xml b/wicket-osgi-parent/wicket-osgi-test-service/pom.xml index 29fb9d1a61..7e8b70a104 100644 --- a/wicket-osgi-parent/wicket-osgi-test-service/pom.xml +++ b/wicket-osgi-parent/wicket-osgi-test-service/pom.xml @@ -3,7 +3,7 @@ wicket-osgi-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-osgi-test-service bundle diff --git a/wicket-osgi-parent/wicket-osgi-test-web/pom.xml b/wicket-osgi-parent/wicket-osgi-test-web/pom.xml index d77f07cb52..ffa87c176b 100644 --- a/wicket-osgi-parent/wicket-osgi-test-web/pom.xml +++ b/wicket-osgi-parent/wicket-osgi-test-web/pom.xml @@ -3,7 +3,7 @@ wicket-osgi-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-osgi-test-web bundle diff --git a/wicket-osgi-parent/wicket-osgi/pom.xml b/wicket-osgi-parent/wicket-osgi/pom.xml index a7e60ba4ed..2a8985e3d3 100644 --- a/wicket-osgi-parent/wicket-osgi/pom.xml +++ b/wicket-osgi-parent/wicket-osgi/pom.xml @@ -3,7 +3,7 @@ wicket-osgi-parent org.wicketstuff - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-osgi bundle diff --git a/wicket-poi-parent/pom.xml b/wicket-poi-parent/pom.xml index 16543c633b..99b219f35d 100644 --- a/wicket-poi-parent/pom.xml +++ b/wicket-poi-parent/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-poi-parent diff --git a/wicket-poi-parent/wicket-poi-examples/pom.xml b/wicket-poi-parent/wicket-poi-examples/pom.xml index f9fc9dd403..59e1c47ad0 100644 --- a/wicket-poi-parent/wicket-poi-examples/pom.xml +++ b/wicket-poi-parent/wicket-poi-examples/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicket-poi-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-poi-examples diff --git a/wicket-poi-parent/wicket-poi/pom.xml b/wicket-poi-parent/wicket-poi/pom.xml index 4af7efc915..a017b12a25 100644 --- a/wicket-poi-parent/wicket-poi/pom.xml +++ b/wicket-poi-parent/wicket-poi/pom.xml @@ -6,7 +6,7 @@ org.wicketstuff wicket-poi-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-poi diff --git a/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java b/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java index ef90e78a87..f960ab45e4 100644 --- a/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java +++ b/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java @@ -125,7 +125,7 @@ private void doParse(CharSequence gridComponentMarkup, Component tableComponent) else if ("td".equals(tagName) || "th".equals(tagName) ) { int index = cell == null ? 0 : cell.getColumnIndex() + 1 + colsToSpan; - if (skipColumn(index)) + while (skipColumn(index)) { index += columnSpan.get(index); } diff --git a/wicket-poi-parent/wicket-poi/src/test/java/org/wicketstuff/poi/excel/Table2.html b/wicket-poi-parent/wicket-poi/src/test/java/org/wicketstuff/poi/excel/Table2.html new file mode 100644 index 0000000000..962e15b091 --- /dev/null +++ b/wicket-poi-parent/wicket-poi/src/test/java/org/wicketstuff/poi/excel/Table2.html @@ -0,0 +1,50 @@ + + + +

          + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          123
          3-13-23-3
          abcde
          fghij
          + + \ No newline at end of file diff --git a/wicket-poi-parent/wicket-poi/src/test/java/org/wicketstuff/poi/excel/Table2.java b/wicket-poi-parent/wicket-poi/src/test/java/org/wicketstuff/poi/excel/Table2.java new file mode 100644 index 0000000000..42eda788aa --- /dev/null +++ b/wicket-poi-parent/wicket-poi/src/test/java/org/wicketstuff/poi/excel/Table2.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wicketstuff.poi.excel; + +import org.apache.wicket.markup.html.WebPage; + +public class Table2 extends WebPage +{ + /** */ + private static final long serialVersionUID = 1L; + +} diff --git a/wicket-poi-parent/wicket-poi/src/test/java/org/wicketstuff/poi/excel/TableParserTest.java b/wicket-poi-parent/wicket-poi/src/test/java/org/wicketstuff/poi/excel/TableParserTest.java index 85f28f4003..84bd4a884d 100644 --- a/wicket-poi-parent/wicket-poi/src/test/java/org/wicketstuff/poi/excel/TableParserTest.java +++ b/wicket-poi-parent/wicket-poi/src/test/java/org/wicketstuff/poi/excel/TableParserTest.java @@ -19,13 +19,14 @@ import java.io.IOException; import java.text.ParseException; -import junit.framework.TestCase; - import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Sheet; +import org.apache.wicket.request.resource.ResourceStreamResource; import org.apache.wicket.util.resource.ResourceStreamNotFoundException; import org.apache.wicket.util.tester.WicketTester; +import junit.framework.TestCase; + /** * @author Pedro Santos */ @@ -74,4 +75,31 @@ public void testTable1() throws IOException, ResourceStreamNotFoundException, Pa // PoiTestUtil.openFileInResponse(tester); } + + public void testTable2() throws IOException, ResourceStreamNotFoundException, ParseException + { + Sheet sheet = new HSSFWorkbook().createSheet(); + TableParser tableParser = new TableParser(sheet, new GeneralPurposeExporter()); + tableParser.parse(new Table2()); + + assertEquals(0, sheet.getMergedRegion(0).getFirstColumn()); + assertEquals(0, sheet.getMergedRegion(0).getLastColumn()); + assertEquals(0, sheet.getMergedRegion(0).getFirstRow()); + assertEquals(1, sheet.getMergedRegion(0).getLastRow()); + + assertEquals(1, sheet.getMergedRegion(1).getFirstColumn()); + assertEquals(1, sheet.getMergedRegion(1).getLastColumn()); + assertEquals(0, sheet.getMergedRegion(1).getFirstRow()); + assertEquals(1, sheet.getMergedRegion(1).getLastRow()); + + assertEquals(2, sheet.getMergedRegion(2).getFirstColumn()); + assertEquals(4, sheet.getMergedRegion(2).getLastColumn()); + assertEquals(0, sheet.getMergedRegion(2).getFirstRow()); + assertEquals(0, sheet.getMergedRegion(2).getLastRow()); + + assertEquals("3-1", sheet.getRow(1).getCell(2).getStringCellValue()); + assertEquals("3-2", sheet.getRow(1).getCell(3).getStringCellValue()); + assertEquals("3-3", sheet.getRow(1).getCell(4).getStringCellValue()); + + } } diff --git a/wicket-security-parent/archetypes/swarm-quickstart/src/main/resources/archetype-resources/pom.xml b/wicket-security-parent/archetypes/swarm-quickstart/src/main/resources/archetype-resources/pom.xml index 750be60c65..ab32759238 100644 --- a/wicket-security-parent/archetypes/swarm-quickstart/src/main/resources/archetype-resources/pom.xml +++ b/wicket-security-parent/archetypes/swarm-quickstart/src/main/resources/archetype-resources/pom.xml @@ -42,7 +42,7 @@ log4j log4j - 1.2.14 + 1.2.17 true test diff --git a/wicket-security-parent/pom.xml b/wicket-security-parent/pom.xml index 3a960f8164..40552b785e 100644 --- a/wicket-security-parent/pom.xml +++ b/wicket-security-parent/pom.xml @@ -19,7 +19,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT 4.0.0 wicket-security-parent @@ -113,10 +113,6 @@ junit junit - - org.slf4j - slf4j-log4j12 - log4j log4j diff --git a/wicket-security-parent/swarm-parent/hive/pom.xml b/wicket-security-parent/swarm-parent/hive/pom.xml index 333ad3e0f5..02df456d85 100644 --- a/wicket-security-parent/swarm-parent/hive/pom.xml +++ b/wicket-security-parent/swarm-parent/hive/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff wicket-security-swarm-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-security-hive jar diff --git a/wicket-security-parent/swarm-parent/pom.xml b/wicket-security-parent/swarm-parent/pom.xml index 5a987ec9f7..19ff3055e2 100644 --- a/wicket-security-parent/swarm-parent/pom.xml +++ b/wicket-security-parent/swarm-parent/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff wicket-security-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-security-swarm-parent pom diff --git a/wicket-security-parent/swarm-parent/swarm/pom.xml b/wicket-security-parent/swarm-parent/swarm/pom.xml index f3cd2ff213..0e20d70160 100644 --- a/wicket-security-parent/swarm-parent/swarm/pom.xml +++ b/wicket-security-parent/swarm-parent/swarm/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff wicket-security-swarm-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-security-swarm jar diff --git a/wicket-security-parent/wasp-parent/pom.xml b/wicket-security-parent/wasp-parent/pom.xml index 3a174a64c4..7201074aeb 100644 --- a/wicket-security-parent/wasp-parent/pom.xml +++ b/wicket-security-parent/wasp-parent/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff wicket-security-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicket-security-wasp-parent pom diff --git a/wicket-security-parent/wasp-parent/wasp/pom.xml b/wicket-security-parent/wasp-parent/wasp/pom.xml index eee302bf22..ec04afeaf8 100644 --- a/wicket-security-parent/wasp-parent/wasp/pom.xml +++ b/wicket-security-parent/wasp-parent/wasp/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff wicket-security-wasp-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-security-wasp jar diff --git a/wicket-security-parent/wasp-parent/wasp/src/test/java/org/wicketstuff/security/SessionInvalidationTest.java b/wicket-security-parent/wasp-parent/wasp/src/test/java/org/wicketstuff/security/SessionInvalidationTest.java index 144590bf1d..9fb564a2b9 100644 --- a/wicket-security-parent/wasp-parent/wasp/src/test/java/org/wicketstuff/security/SessionInvalidationTest.java +++ b/wicket-security-parent/wasp-parent/wasp/src/test/java/org/wicketstuff/security/SessionInvalidationTest.java @@ -46,7 +46,7 @@ public void testSessionInvalidationWithSingleLogin() assertEquals(session, mock.getSession()); assertTrue(((WaspSession)mock.getSession()).logoff(null)); mock.processRequest(); - assertTrue(session.isSessionInvalidated()); + assertFalse(session.isSessionInvalidated()); assertFalse(((WaspAuthorizationStrategy)mock.getSession().getAuthorizationStrategy()).isUserAuthenticated()); } @@ -77,7 +77,7 @@ public void testSessionInvalidationWithMultiLogin() ((WaspSession)mock.getSession()).logoff(null); mock.processRequest(); - assertTrue(session.isSessionInvalidated()); + assertFalse(session.isSessionInvalidated()); assertFalse(((WaspAuthorizationStrategy)mock.getSession().getAuthorizationStrategy()).isUserAuthenticated()); } diff --git a/wicket-security-parent/wasp-parent/wicomsec/pom.xml b/wicket-security-parent/wasp-parent/wicomsec/pom.xml index cf44a59edb..2a2b4b8adb 100644 --- a/wicket-security-parent/wasp-parent/wicomsec/pom.xml +++ b/wicket-security-parent/wasp-parent/wicomsec/pom.xml @@ -20,7 +20,7 @@ org.wicketstuff wicket-security-wasp-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-security-wicomsec jar diff --git a/wicket-servlet3-parent/pom.xml b/wicket-servlet3-parent/pom.xml index f52cbf9737..88f8941848 100644 --- a/wicket-servlet3-parent/pom.xml +++ b/wicket-servlet3-parent/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-core - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-servlet3-parent diff --git a/wicket-servlet3-parent/wicket-servlet3-auth/pom.xml b/wicket-servlet3-parent/wicket-servlet3-auth/pom.xml index 441f0e48e3..10dd8e7ad5 100644 --- a/wicket-servlet3-parent/wicket-servlet3-auth/pom.xml +++ b/wicket-servlet3-parent/wicket-servlet3-auth/pom.xml @@ -5,7 +5,7 @@ org.wicketstuff wicketstuff-servlet3-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-servlet3-auth diff --git a/wicket-servlet3-parent/wicket-servlet3-examples/pom.xml b/wicket-servlet3-parent/wicket-servlet3-examples/pom.xml index 91aa331a60..ff19a238d4 100644 --- a/wicket-servlet3-parent/wicket-servlet3-examples/pom.xml +++ b/wicket-servlet3-parent/wicket-servlet3-examples/pom.xml @@ -7,7 +7,7 @@ org.wicketstuff wicketstuff-servlet3-parent - 7.4.0-SNAPSHOT + 7.0-SNAPSHOT wicketstuff-servlet3-examples diff --git a/wicketstuff-clipboard-js-parent/README.md b/wicketstuff-clipboard-js-parent/README.md new file mode 100644 index 0000000000..6095fbb4c0 --- /dev/null +++ b/wicketstuff-clipboard-js-parent/README.md @@ -0,0 +1,63 @@ +An integration between Apache Wicket and Clipboard JS - copy text without Flash. + +For more information see https://clipboardjs.com/ + +## Usage + +```java +package org.wicketstuff.clipboardjs.example; + +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.form.TextArea; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.wicketstuff.clipboardjs.ClipboardJsBehavior; + +public class ClipboardJsDemoPage extends WebPage { + private static final long serialVersionUID = 1L; + + public ClipboardJsDemoPage(final PageParameters parameters) { + super(parameters); + + TextArea target = new TextArea("target"); + add(target); + + final WebMarkupContainer copyBtn = new WebMarkupContainer("copyBtn"); + final ClipboardJsBehavior clipboardJsBehavior = new ClipboardJsBehavior(); + copyBtn.add(clipboardJsBehavior); + clipboardJsBehavior + // set Wicket Component (e.g. TextField or TextArea) as a target + .setTarget(target) + + // set the target by using CSS selector. This way there is no need to make the target a Wicket Component + // .setTarget(".target") + + // set the action to 'CUT'. Works only on non-disabled and +
          + + + + + +``` diff --git a/wicketstuff-clipboard-js-parent/pom.xml b/wicketstuff-clipboard-js-parent/pom.xml new file mode 100644 index 0000000000..ec7bb615b3 --- /dev/null +++ b/wicketstuff-clipboard-js-parent/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + + org.wicketstuff + wicketstuff-core + 7.0-SNAPSHOT + + wicketstuff-clipboardjs-parent + WicketStuff Clipboard JS Parent + + pom + + Parent project for WicketStuff Clipboard JS + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + wicketstuff-clipboardjs + wicketstuff-clipboardjs-examples + + + + + Martin Grigorov + + + + diff --git a/wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/pom.xml b/wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/pom.xml new file mode 100644 index 0000000000..1d08d4d76a --- /dev/null +++ b/wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/pom.xml @@ -0,0 +1,57 @@ + + 4.0.0 + + org.wicketstuff + wicketstuff-clipboardjs-parent + 7.0-SNAPSHOT + + + wicketstuff-clipboardjs-examples + war + WicketStuff Clipboard JS Example + Example usage of WicketStuff Clipboard JS + + + true + true + true + + + + + ${project.groupId} + wicketstuff-clipboardjs + ${project.parent.version} + + + + + org.slf4j + slf4j-log4j12 + + + log4j + log4j + + + + + junit + junit + + + + + org.eclipse.jetty.aggregate + jetty-all-server + + + + + + org.mortbay.jetty + jetty-maven-plugin + + + + diff --git a/browserid-parent/browserid-examples/src/main/java/org/wicketstuff/browserid/example/BrowserIdApplication.java b/wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsApplication.java similarity index 51% rename from browserid-parent/browserid-examples/src/main/java/org/wicketstuff/browserid/example/BrowserIdApplication.java rename to wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsApplication.java index 4963c2ede1..aa47a72242 100644 --- a/browserid-parent/browserid-examples/src/main/java/org/wicketstuff/browserid/example/BrowserIdApplication.java +++ b/wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsApplication.java @@ -1,15 +1,12 @@ -package org.wicketstuff.browserid.example; +package org.wicketstuff.clipboardjs.example; import org.apache.wicket.Page; import org.apache.wicket.protocol.http.WebApplication; -public class BrowserIdApplication extends WebApplication -{ - +public class ClipboardJsApplication extends WebApplication { @Override public Class getHomePage() { - return BrowserIdPage.class; + return ClipboardJsDemoPage.class; } - } diff --git a/wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsDemoPage.html b/wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsDemoPage.html new file mode 100644 index 0000000000..1b752bf085 --- /dev/null +++ b/wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsDemoPage.html @@ -0,0 +1,14 @@ + + + + + ClipboardJs demo page + + + + +
          + + + + diff --git a/wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsDemoPage.java b/wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsDemoPage.java new file mode 100644 index 0000000000..b0969d613b --- /dev/null +++ b/wicketstuff-clipboard-js-parent/wicketstuff-clipboardjs-examples/src/main/java/org/wicketstuff/clipboardjs/example/ClipboardJsDemoPage.java @@ -0,0 +1,39 @@ +package org.wicketstuff.clipboardjs.example; + +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.form.TextArea; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.wicketstuff.clipboardjs.ClipboardJsBehavior; + +/** + * Demo page of {@link ClipboardJsBehavior} + */ +public class ClipboardJsDemoPage extends WebPage { + private static final long serialVersionUID = 1L; + + public ClipboardJsDemoPage(final PageParameters parameters) { + super(parameters); + + TextArea target = new TextArea("target"); + add(target); + + final WebMarkupContainer copyBtn = new WebMarkupContainer("copyBtn"); + final ClipboardJsBehavior clipboardJsBehavior = new ClipboardJsBehavior(); + copyBtn.add(clipboardJsBehavior); + clipboardJsBehavior + // set Wicket Component (e.g. TextField or TextArea) as a target + .setTarget(target) + + // set the target by using CSS selector. This way there is no need to make the target a Wicket Component + // .setTarget(".target") + + // set the action to 'CUT'. Works only on non-disabled and