Example usage for org.apache.wicket.request.resource PackageResourceReference PackageResourceReference

List of usage examples for org.apache.wicket.request.resource PackageResourceReference PackageResourceReference

Introduction

In this page you can find the example usage for org.apache.wicket.request.resource PackageResourceReference PackageResourceReference.

Prototype

public PackageResourceReference(final Class<?> scope, final String name) 

Source Link

Document

Construct.

Usage

From source file:at.molindo.wicketutils.migration.JavaScriptPackageResource.java

License:Apache License

public static HeaderContributor getHeaderContribution(final Class<?> scope, final String name) {
    return getHeaderContribution(new PackageResourceReference(scope, name));
}

From source file:au.org.theark.core.web.component.palette.ArkPalette.java

License:Open Source License

@Override
protected ResourceReference getCSS() {
    return new PackageResourceReference(ArkPalette.class, "arkPalette.css");
}

From source file:au.org.theark.core.web.form.HistoryAjaxBehavior.java

License:Open Source License

@Override
public void renderHead(Component component, final IHeaderResponse response) {
    response.renderCSSReference(/*w  w w. j ava2 s. c  o  m*/
            new PackageResourceReference(HistoryAjaxBehavior.class, "history-manager-iframe.css"));
    // conflicts with the jquery imported by the base page
    // response.renderJavascriptReference(new ResourceReference(HistoryAjaxBehavior.class, "jquery.js"));
    response.renderJavaScriptReference(
            new PackageResourceReference(HistoryAjaxBehavior.class, "history-manager.js"));

    /*
     * Save the callback URL to this behavior to call it on back/forward button clicks
     */
    response.renderJavaScript("var notifyBackButton = function() { wicketAjaxGet('" + getCallbackUrl()
            + ", null, null, function() {return true;}.bind(this)); }", "history-manager-url");
}

From source file:au.org.theark.lims.web.component.panel.applet.PrintAppletPanel.java

License:Open Source License

public PrintAppletPanel(String id, String printerName) {
    super(id);//from  w  ww.  jav  a 2s.  c  o  m
    setOutputMarkupPlaceholderTag(true);

    applet = new WebMarkupContainer("applet");
    applet.setOutputMarkupPlaceholderTag(true);

    PackageResourceReference jarResourceReference = new PackageResourceReference(PrintAppletPanel.class,
            "jzebra.jar");
    ResourceReferenceRequestHandler reqHandler = new ResourceReferenceRequestHandler(jarResourceReference);

    final String jarResourceUrl = getRequestCycle().urlFor(reqHandler).toString();
    final String codebase = Strings.beforeLastPathComponent(jarResourceUrl, '/') + '/';
    applet.add(new AttributeModifier("codebase", codebase));
    add(applet);

    final AttributeModifier valueParam1 = new AttributeModifier("value", printerName);
    final WebMarkupContainer appletParam1 = new WebMarkupContainer("appletParam1");
    appletParam1.add(valueParam1);
    applet.add(appletParam1);
}

From source file:ch.qos.mistletoe.wicket.TestReportPanel.java

License:Open Source License

void handleBlankPlaceHolderImage() {
    final WebMarkupContainer parent = new WebMarkupContainer(Constants.TREE_CONTROL_ID);
    // we don't want the "hand" cursor to appear over the blank place holder
    // image/*from   w w  w  .j  a  va 2 s  .  com*/
    parent.add(new AttributeModifier("style", "cursor: default;"));

    Image image = new Image(Constants.TREE_CONTROL_SYMBOL_ID,
            new PackageResourceReference(TestReportPanel.class, Constants.BLANK_GIF));
    parent.add(image);
    add(parent);
}

From source file:ch.qos.mistletoe.wicket.TestReportPanel.java

License:Open Source License

void handleResultImage(TestReport description) {
    boolean hasFailures = description.hasFailures();
    boolean isSuite = description.isSuite();

    String testResultSrc = null;/* w  ww  .j av a  2  s . c o  m*/
    if (isSuite) {
        if (hasFailures) {
            testResultSrc = Constants.TSUITE_ERROR_GIF;
        } else {
            testResultSrc = Constants.TSUITE_OK_GIF;
        }
    } else {
        if (hasFailures) {
            testResultSrc = Constants.TEST_ERROR_GIF;
        } else {
            testResultSrc = Constants.TEST_OK_GIF;
        }
    }

    Image image = new Image(Constants.IMAGE_ID,
            new PackageResourceReference(TestReportPanel.class, testResultSrc));
    add(image);
}

From source file:ch.qos.mistletoe.wicket.TreeExpansionLink.java

License:Open Source License

ResourceReference getControlSymbolResourceReference(boolean expanded) {
    String raw = EXPAND_GIF;/*from  w  w w  .j  a v a2s  .com*/
    if (expanded) {
        raw = COLLAPSE_GIF;
    }
    return new PackageResourceReference(TestReportPanel.class, raw);
}

From source file:com.axway.ats.testexplorer.pages.model.ColumnsDialog.java

License:Apache License

@SuppressWarnings({ "rawtypes" })
public ColumnsDialog(String id, final DataGrid grid, List<TableColumn> columnDefinitions) {

    super(id);//  w ww . ja  va  2  s .c  o  m
    setOutputMarkupId(true);

    this.dbColumnDefinitions = columnDefinitions;

    DataView<TableColumn> table = new DataView<TableColumn>("headers",
            new ListDataProvider<TableColumn>(dbColumnDefinitions), 100) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final Item<TableColumn> item) {

            final TableColumn column = item.getModelObject();

            item.add(new CheckBox("visible", new PropertyModel<Boolean>(column, "visible")));
            item.add(new Label("columnName", new PropertyModel<String>(column, "columnName")));

            item.add(new AjaxEventBehavior("click") {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onEvent(AjaxRequestTarget target) {

                    TableColumn tableColumn = (TableColumn) this.getComponent().getDefaultModelObject();
                    tableColumn.setVisible(!tableColumn.isVisible());

                    if (tableColumn.isVisible()) {
                        item.add(AttributeModifier.replace("class", "selected"));
                    } else {
                        item.add(AttributeModifier.replace("class", "notSelected"));
                    }
                    grid.getColumnState().setColumnVisibility(tableColumn.getColumnId(),
                            tableColumn.isVisible());
                    target.add(grid);
                    target.add(this.getComponent());

                    open(target);
                }
            });
            item.setOutputMarkupId(true);

            if (column.isVisible()) {
                item.add(AttributeModifier.replace("class", "selected"));
            } else {
                item.add(AttributeModifier.replace("class", "notSelected"));
            }
        }
    };
    add(table);

    final Form<Void> columnDefinitionsForm = new Form<Void>("columnDefinitionsForm");
    add(columnDefinitionsForm);

    AjaxSubmitLink saveButton = new AjaxSubmitLink("saveButton", columnDefinitionsForm) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {

            super.updateAjaxAttributes(attributes);
            AjaxCallListener ajaxCallListener = new AjaxCallListener();
            ajaxCallListener.onPrecondition("getTableColumnDefinitions(); ");
            attributes.getAjaxCallListeners().add(ajaxCallListener);
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {

            String columnDefinitionsString = form.getRequest().getPostParameters()
                    .getParameterValue("columnDefinitions").toString();

            List<TableColumn> jsColDefinitions = asList(columnDefinitionsString);
            orderTableColumns(dbColumnDefinitions, jsColDefinitions);

            try {
                saveColumnDefinitionsToDb(jsColDefinitions);

                modifyDBColumnDefinitionList(jsColDefinitions);

            } catch (DatabaseAccessException dae) {
                throw new RuntimeException("Unable to save table Column definitions in db: "
                        + ((TestExplorerSession) Session.get()).getDbName(), dae);
            } catch (SQLException sqle) {
                throw new RuntimeException("Unable to save table Column definitions in db: "
                        + ((TestExplorerSession) Session.get()).getDbName(), sqle);
            }

            close(target);
        }
    };
    add(AttributeModifier.append("class", "runsTableColDialogDivWrapper"));
    columnDefinitionsForm.add(saveButton);

    add(new Behavior() {

        private static final long serialVersionUID = 1L;

        @Override
        public void renderHead(Component component, IHeaderResponse response) {

            if (autoAddToHeader()) {

                String script = "jQuery.fn.center=function(){" + "this.css(\"position\",\"absolute\");"
                        + "this.css(\"top\",(jQuery(window).height()-this.height())/2+jQuery(window).scrollTop()+\"px\");"
                        + "this.css(\"left\",(jQuery(window).width()-this.width())/2+jQuery(window).scrollLeft()+\"px\");"
                        + "return this};";

                String css = "#settingsoverlay,.settingsoverlay,#settingsoverlay_high,"
                        + ".settingsoverlay_high{filter:Alpha(Opacity=40);"
                        + "-moz-opacity:.4;opacity:.4;background-color:#444;display:none;position:absolute;"
                        + "left:0;top:0;width:100%;height:100%;text-align:center;z-index:5000;}"
                        + "#settingsoverlay_high,.settingsoverlay_high{z-index:6000;}"
                        + "#settingsoverlaycontent,#settingsoverlaycontent_high{display:none;z-index:5500;"
                        + "text-align:center;}.settingsoverlaycontent,"
                        + ".settingsoverlaycontent_high{display:none;z-index:5500;text-align:left;}"
                        + "#settingsoverlaycontent_high,.settingsoverlaycontent_high{z-index:6500;}"
                        + "#settingsoverlaycontent .modalborder,"
                        + "#settingsoverlaycontent_high .modalborder{padding:15px;width:300px;"
                        + "border:1px solid #444;background-color:white;"
                        + "-webkit-box-shadow:0 0 10px rgba(0,0,0,0.8);-moz-box-shadow:0 0 10px rgba(0,0,0,0.8);"
                        + "box-shadow:0 0 10px rgba(0,0,0,0.8);"
                        + "filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=5,OffY=5,Color='gray');"
                        + "-ms-filter:\"progid:DXImageTransform.Microsoft.dropshadow(OffX=5,OffY=5,Color='gray')\";}";

                response.render(JavaScriptHeaderItem.forScript(script, null));
                response.render(CssHeaderItem.forCSS(css, null));
                if (isSupportIE6()) {
                    response.render(JavaScriptHeaderItem
                            .forReference(new PackageResourceReference(getClass(), "jquery.bgiframe.js")));
                }
            }

            response.render(OnDomReadyHeaderItem.forScript(getJS()));
        }

        private String getJS() {

            StringBuilder sb = new StringBuilder();
            sb.append("if (jQuery('#").append(getDivId())
                    .append("').length == 0) { jQuery(document.body).append('")
                    .append(getDiv().replace("'", "\\'")).append("'); }");
            return sb.toString();
        }

        private String getDivId() {

            return getMarkupId() + "_ovl";
        }

        private String getDiv() {

            if (isClickBkgToClose()) {
                return ("<div id=\"" + getDivId() + "\" class=\"settingsoverlayCD\" onclick=\""
                        + getCloseString() + "\"></div>");
            } else {
                return ("<div id=\"" + getDivId() + "\" class=\"settingsoverlayCD\"></div>");
            }
        }
    });

}

From source file:com.ccc.crest.need.template.HeaderPanel.java

License:Open Source License

public HeaderPanel(String id) {
    super(id);//  w w  w.  j ava 2s  . co  m

    WicketClientInfo sessionClientInfo = (WicketClientInfo) getWebSession().getClientInfo();
    CrestClientInfo clientInfo = (CrestClientInfo) sessionClientInfo.getOauthClientInfo();

    String user = sessionClientInfo.isAuthenticated() ? clientInfo.getVerifyData().CharacterName : null;

    login = new BookmarkablePageLink<Object>("login", LoginPage.class);
    logout = new BookmarkablePageLink<Object>("logout", LogoutPage.class);
    logoutLabel = new Label("logoutLabel", "Welcome, " + user + " - ");
    needsApiLabel = new Label("needsApiLabel", "We need your API Key");
    //        String s = CrestController.getCrestController().scopes.getCreatePredefinedUrl(ScopeToMask.Type.Character);
    //        needsApi = new ExternalLink("needsApi", s);
    needsApi = new BookmarkablePageLink<Object>("needsApi", ApiKeyInput.class);

    boolean loggedIn = user != null && !user.isEmpty();
    boolean hasKeys = true; // not going to display if not authenticated
    //TODO: add in check if there are actually any scopes configured
    if (loggedIn)
        hasKeys = CrestController.getCrestController().capsuleerHasApiKey(user);
    logout.setVisible(loggedIn);
    logoutLabel.setVisible(loggedIn);
    login.setVisible(!loggedIn);
    needsApiLabel.setVisible(!hasKeys);
    needsApi.setVisible(!hasKeys);

    PackageResourceReference resourceReference = new PackageResourceReference(getClass(), "eveSsoSmlWht.png");
    login.add(new Image("loginImg", resourceReference));

    add(new BookmarkablePageLink<>("homeURL", Index.class));
    add(login);
    add(logoutLabel);
    add(logout);
    add(needsApiLabel);
    add(needsApi);
}

From source file:com.cubeia.backoffice.web.Home.java

License:Open Source License

public void renderHead(IHeaderResponse resp) {
    resp.render(CssHeaderItem.forReference(new PackageResourceReference(BasePage.class, "home.css")));

}