Example usage for org.apache.wicket.request.mapper.parameter PageParameters toString

List of usage examples for org.apache.wicket.request.mapper.parameter PageParameters toString

Introduction

In this page you can find the example usage for org.apache.wicket.request.mapper.parameter PageParameters toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:com.modusoperandi.dragonfly.widgets.chart.ScatterChartPage.java

License:Open Source License

/**
 * Instantiates a new portal page.// ww  w  .j  a  va2  s . c  o m
 *
 * @param parameters
 */
public ScatterChartPage(final PageParameters parameters) {

    LOGGER.info("parameters = " + parameters.toString());

    add(new TsvXyAjaxBehavior());
    add(new TsvYCountAjaxBehavior());
    add(new TsvLabelCountAjaxBehavior());
    add(new TsvPercentCountAjaxBehavior());
    add(new JsonTimewheelAjaxBehavior());
    add(new JsonHeatMapRingMapAjaxBehavior());

    // /////////////////////////////
    // Elasticsearch
    getEsClient();

    // /////////////////////////////
    // UI
    final Form<?> queryForm = new Form<Void>("queryForm");
    add(queryForm);

    queryForm.add(new AddAjaxButton());

    final RefreshAjaxButton refreshButton = new RefreshAjaxButton();
    queryForm.add(refreshButton);
    queryForm.setDefaultButton(refreshButton);

    termFilterField = new TextField<String>("termFilter", new PropertyModel<String>(this, "filterTerm"));
    queryForm.add(termFilterField);

    hitsField = new Label("hits", new PropertyModel<String>(this, "hits"));
    hitsField.setOutputMarkupId(true);
    queryForm.add(hitsField);

    // /////////////////////////////
    // Add Panel
    addWindow = new ModalWindow("dataPanel");
    d3SettingsPanel = new SettingsPanel(addWindow.getContentId(), addWindow);
    addWindow.setContent(d3SettingsPanel);
    addWindow.setCookieName(null);
    addWindow.setInitialHeight(400);
    addWindow.setHeightUnit("px");
    addWindow.setInitialWidth(620);
    addWindow.setWidthUnit("px");
    addWindow.setResizable(false);
    addWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8118424010410661292L;

        @Override
        public void onClose(final AjaxRequestTarget target) {

            if (d3SettingsPanel.isOk()) {

                configuration = d3SettingsPanel.getConfiguration();

                if (configuration.get("Type").equals(SettingsPanel.XY)) {
                    target.appendJavaScript("drawScatterChart(\"" + configuration.get("X") + "\",\""
                            + configuration.get("Y") + "\");");

                } else if (configuration.get("Type").equals(SettingsPanel.FACET_BAR)) {
                    target.appendJavaScript("drawBarChart(\"" + configuration.get("CountField") + "\");");

                } else if (configuration.get("Type").equals(SettingsPanel.SERIES_LINE)) {
                    target.appendJavaScript("drawLineChart(\"" + configuration.get("X") + "\",\""
                            + configuration.get("Y") + "\");");

                } else if (configuration.get("Type").equals(SettingsPanel.FACET_PIE)) {
                    target.appendJavaScript("drawPieChart(\"" + configuration.get("CountField") + "\");");

                } else if (configuration.get("Type").equals(SettingsPanel.TIMEWHEEL)) {
                    target.appendJavaScript("drawTimewheelChart();");

                } else if (configuration.get("Type").equals(SettingsPanel.HEAT_MAP_RING_MAP)) {
                    target.appendJavaScript("drawHeatMapRingMap(" + Integer.toString(chartId) + ", "
                            + jsString(configuration.get("Index")) + ", "
                            + jsString(configuration.get("LocationField")) + ", "
                            + jsString(configuration.get("TimeField")) + ", "
                            + jsString(configuration.get("TimeScale")) + ", "
                            + jsString(configuration.get("LabelField")) + ", " + jsString(filterTerm) + ");");
                }

                chartId++;
            }
        }
    });
    add(addWindow);
}

From source file:nl.ru.cmbi.vase.web.page.AlignmentPage.java

License:Apache License

public AlignmentPage(final PageParameters parameters) {

    log.info("start AlignmentPage with parameters " + parameters.toString());

    StringValue structureIDString = parameters.get(0), chainIDString = parameters.get(1);

    if (structureIDString == null || structureIDString.isNull() || structureIDString.isEmpty()) {

        throw new RestartResponseAtInterceptPageException(new ErrorPage("structure id missing"));

    } else {/*from   ww  w .  j  a  v a2  s. c  om*/

        structureID = structureIDString.toString().toLowerCase();

        if (chainIDString != null && !chainIDString.isNull() && !chainIDString.isEmpty()) {

            chainID = chainIDString.toChar();
        }

        try {
            File xmlFile = new File(Config.getCacheDir(), structureID + ".xml"),
                    gzXmlFile = new File(Config.getCacheDir(), structureID + ".xml.gz");
            if (xmlFile.isFile()) {

                VASEDataObject data = VASEXMLParser.parse(new FileInputStream(xmlFile));

                this.initPageWith(data);
            } else if (gzXmlFile.isFile()) {

                VASEDataObject data = VASEXMLParser.parse(new GZIPInputStream(new FileInputStream(xmlFile)));

                this.initPageWith(data);
            } else {

                if (Config.isXmlOnly()) {

                    throw new RestartResponseAtInterceptPageException(new ErrorPage(
                            "VASE is running in xml-only mode, so only xml-entries can be accessed. (see homepage)"));
                }

                InputStream pdbIn = Utils.getPdbInputStream(structureID);
                if (pdbIn == null) {

                    throw new RestartResponseAtInterceptPageException(
                            new ErrorPage("Unable to resolve PDB URL for: " + structureID));
                }

                InputStream stockholmInputStream = Utils.getStockholmInputStream(structureID);
                if (stockholmInputStream == null) {

                    throw new RestartResponseAtInterceptPageException(
                            new ErrorPage("No alignment data for: " + structureID));
                }

                Set<Character> stockholmChainIDs = StockholmParser.listChainsInStockholm(stockholmInputStream);

                if (chainID == null) {

                    if (stockholmChainIDs.size() == 1) {

                        // no chain id needs to be given, since there's only one

                        chainID = stockholmChainIDs.iterator().next();
                    } else {

                        // Redirect to a page with chain selection

                        PageParameters params = new PageParameters();
                        params.add(SearchResultsPage.parameterName, structureID);

                        this.setResponsePage(SearchResultsPage.class, params);
                        return;
                    }
                } else if (!stockholmChainIDs.contains(chainID)) {

                    throw new RestartResponseAtInterceptPageException(
                            new ErrorPage("No such chain in " + structureID + ": " + chainID));
                }

                stockholmInputStream = Utils.getStockholmInputStream(structureID);

                VASEDataObject data = StockholmParser.parseStockHolm(stockholmInputStream, pdbIn, structureID,
                        chainID);
                if (data == null)
                    log.error("data is null");

                this.initPageWith(data);
            }

        } catch (RestartResponseAtInterceptPageException e) {

            //just rethrow it
            throw e;

        } catch (Exception e) { // any other type of exception

            log.error("Error getting alignments for " + structureIDString + " : " + e.getMessage(), e);

            throw new RestartResponseAtInterceptPageException(
                    new ErrorPage("Error getting alignments for " + structureIDString + " : " + e.toString()));
        }
    }
}

From source file:org.sakaiproject.profile2.tool.pages.panels.MessageView.java

License:Educational Community License

/**
 * Constructor for an incoming link with a threadId as part of the PageParameters
 * @param parameters// w  w  w  .  j  ava  2  s.  c o  m
 */
public MessageView(final String id, PageParameters parameters) {
    super(id);
    log.debug("MyMessageView(" + parameters.toString() + ")");

    MessageThread thread = messagingLogic.getMessageThread(parameters.get("thread").toString());

    //check user is a thread participant
    String currentUserUuid = sakaiProxy.getCurrentUserId();
    if (!messagingLogic.isThreadParticipant(thread.getId(), currentUserUuid)) {
        //this would only ever happen if the user has access to the other user's workspace because the link is a direct link to their site
        //so they won't even reach this part if they don't have access - so it would need to be a very special case.
        log.error("MyMessageView: user " + currentUserUuid + " attempted to access restricted thread: "
                + thread.getId());
        throw new RestartResponseException(new MyMessages());
    }

    renderMyMessagesView(sakaiProxy.getCurrentUserId(), thread.getId(), thread.getSubject());
}

From source file:org.wuqispank.web.BookmarkableTabbedPanel2.java

License:Apache License

@Override
protected WebMarkupContainer newLink(String linkId, int index) {
    PageParameters localParameters = new PageParameters(pageParameters);
    log.debug("Entering newLink");
    WebMarkupContainer link;/*  w ww  .  j a  va 2 s .c  om*/

    if (index == defaultTabIndex)
        localParameters.remove(tabParameterName); // keep URLs short
    else {
        localParameters.set(tabParameterName, "" + index);
        log.debug("passed index does not match default tab index.  Added to link [" + tabParameterName + "] ["
                + index + "]");
    }
    link = new BookmarkablePageLink<Object>(linkId, getPage().getClass(), localParameters);

    if (index == getSelectedTab())
        setSelectedTab(index);
    log.debug("Exiting newLink.  created link [" + localParameters.toString() + "]");

    return link;
}