Example usage for org.apache.wicket.markup.html.link PopupSettings setWidth

List of usage examples for org.apache.wicket.markup.html.link PopupSettings setWidth

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.link PopupSettings setWidth.

Prototype

public PopupSettings setWidth(int popupWidth) 

Source Link

Document

Sets the popup window width.

Usage

From source file:com.lili.WicketExampleHeader.java

License:Apache License

/**
 * Construct./* ww w  .  j a v  a  2s  . co m*/
 * 
 * @param id
 *            id of the component
 * @param exampleTitle
 *            title of the example
 * @param page
 *            The example page
 */
public WicketExampleHeader(String id, String exampleTitle, WebPage page) {
    super(id);

    //      add(new DebugBar("debug"));
    //      add(new Label("exampleTitle", exampleTitle));
    //      BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>("sources",
    //         SourcesPage.class, SourcesPage.generatePageParameters(page));
    //      BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>("sources",
    //         null,null);
    //      add(link);

    PopupSettings settings = new PopupSettings("sources", PopupSettings.RESIZABLE);
    settings.setWidth(800);
    settings.setHeight(600);
    //      link.setPopupSettings(settings);
}

From source file:com.marintek.isis.wicket.ui.components.scalars.wicket.StandaloneValueAsPopupWicketBox.java

License:Apache License

private void buildGui() {
    PopupWicketBox fb;//from   www.ja  v a 2 s.c o  m
    IModel fbModel;

    final ValueModel model = getModel();
    final ObjectAdapter boxAdapter = model.getObject();
    final Object boxObj = boxAdapter.getObject();
    PopupWicketBox box = (PopupWicketBox) boxObj;

    // Add that link as a popup
    PopupSettings popupSettings = new PopupSettings(PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS);
    popupSettings.setHeight(box.getHeight());
    popupSettings.setWidth(box.getWidth());
    popupSettings.setLeft(box.getLeft());
    popupSettings.setTop(box.getTop());
    popupSettings.setWindowName(box.getTitle());

    ExternalLink link = new ExternalLink("popupbox", box.getUrl(), "Pop Up").setPopupSettings(popupSettings);
    addOrReplace(link);
}

From source file:com.mastfrog.acteur.wicket.borrowed.WicketExampleHeader.java

License:Apache License

/**
 * Construct.//from   w  w  w . j a v a  2 s .  c o  m
 * 
 * @param id
 *            id of the component
 * @param exampleTitle
 *            title of the example
 * @param page
 *            The example page
 */
public WicketExampleHeader(String id, String exampleTitle, WebPage page) {
    super(id);

    //      add(new DebugBar("debug"));
    add(new Label("exampleTitle", exampleTitle));
    BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>("sources", SourcesPage.class,
            SourcesPage.generatePageParameters(page));
    add(link);

    PopupSettings settings = new PopupSettings("sources", PopupSettings.RESIZABLE);
    settings.setWidth(800);
    settings.setHeight(600);
    link.setPopupSettings(settings);
}

From source file:com.norconex.jefmon.instance.action.ActionsCell.java

License:Apache License

@SuppressWarnings("nls")
public ActionsCell(final String id, final JobStatusTreeNode job, final List<IJobAction> actions) {
    super(id);/*from   ww w.  j  a  v  a  2 s.c  o m*/

    add(new ListView<IJobAction>("actions", actions) {
        private static final long serialVersionUID = 3635147316426384496L;

        @Override
        protected void populateItem(ListItem<IJobAction> item) {
            final IJobAction action = item.getModelObject();
            if (action.isVisible(job)) {
                String icon = action.getFontIcon();
                final String pageName = action.getName().getObject() + " - " + job.getJobId();
                Link<String> link = new Link<String>("actionLink") {
                    private static final long serialVersionUID = 3488334322744811811L;

                    @Override
                    public void onClick() {
                        Component comp = action.execute(job, ActionPage.COMPONENT_ID);
                        if (comp != null) {
                            setResponsePage(new ActionPage(comp, Model.of(pageName)));
                        }
                    }
                };
                PopupSettings popup = new PopupSettings(pageName, PopupSettings.RESIZABLE);
                popup.setWidth(800);
                link.setPopupSettings(popup);
                link.add(new Label("actionIcon").add(new CssClass(icon)));
                link.add(new BootstrapTooltip(action.getName()));
                item.add(link);
            } else {

                WebMarkupContainer empty = new WebMarkupContainer("actionLink");
                empty.add(new Label("actionIcon"));
                empty.setVisible(false);
                item.add(empty);
            }
        }
    });
}

From source file:com.senacor.wbs.web.project.ProjectListPanel.java

License:Apache License

public ProjectListPanel(final String id, final List<Project> projects) {
    super(id);//from ww  w.j  av a2  s . c o m
    this.locale = getLocale();
    SortableListDataProvider<Project> projectProvider = new SortableListDataProvider<Project>(projects) {
        @Override
        protected Locale getLocale() {
            return ProjectListPanel.this.getLocale();
        }

        public IModel model(final Object object) {
            return new CompoundPropertyModel(object);
        }
    };
    projectProvider.setSort("name", true);
    dataView = new DataView("projects", projectProvider, 4) {
        @Override
        protected void populateItem(final Item item) {
            Project project = (Project) item.getModelObject();
            PageParameters pageParameters = new PageParameters();
            pageParameters.put("projectId", project.getId());
            item.add(new BookmarkablePageLink("tasks", ProjectDetailsPage.class, pageParameters)
                    .add(new Label("id")));
            item.add(new Label("kuerzel"));
            item.add(new Label("titel", project.getName()));
            item.add(new Label("budget"));
            item.add(new Label("costPerHour"));
            item.add(new Label("start"));
            item.add(new Label("ende"));
            item.add(new Label("state"));
            // Alternieren der Farbe zwischen geraden und
            // ungeraden Zeilen
            item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel() {
                @Override
                public Object getObject() {
                    return (item.getIndex() % 2 == 1) ? "even" : "odd";
                }
            }));
        }
    };
    add(dataView);
    Form localeForm = new Form("localeForm");
    ImageButton deButton = new ImageButton("langde", new ResourceReference(BaseWBSPage.class, "de.png")) {
        @Override
        public void onSubmit() {
            ProjectListPanel.this.locale = Locale.GERMANY;
        }
    };
    localeForm.add(deButton);
    ImageButton usButton = new ImageButton("langus", new ResourceReference(BaseWBSPage.class, "us.png")) {
        @Override
        public void onSubmit() {
            ProjectListPanel.this.locale = Locale.US;
        }
    };
    localeForm.add(usButton);
    add(localeForm);
    final IResourceStream pdfResourceStream = new AbstractResourceStreamWriter() {
        public void write(final OutputStream output) {
            Document document = new Document();
            try {
                PdfWriter.getInstance(document, output);
                document.open();
                // document.add(new
                // Paragraph("WBS-Projektliste"));
                // document.add(new Paragraph(""));
                PdfPTable table = new PdfPTable(new float[] { 1f, 1f, 2f, 1f });
                PdfPCell cell = new PdfPCell(new Paragraph("WBS-Projektliste"));
                cell.setColspan(4);
                cell.setGrayFill(0.8f);
                table.addCell(cell);
                table.addCell("ID");
                table.addCell("Krzel");
                table.addCell("Titel");
                table.addCell("Budget in PT");
                for (Project project : projects) {
                    table.addCell("" + project.getId());
                    table.addCell(project.getKuerzel());
                    table.addCell(project.getName());
                    table.addCell("" + project.getBudget());
                }
                document.add(table);
                document.close();
            } catch (DocumentException e) {
                throw new RuntimeException(e);
            }
        }

        public String getContentType() {
            return "application/pdf";
        }
    };
    WebResource projectsResource = new WebResource() {
        {
            setCacheable(false);
        }

        @Override
        public IResourceStream getResourceStream() {
            return pdfResourceStream;
        }

        @Override
        protected void setHeaders(final WebResponse response) {
            super.setHeaders(response);
            // response.setAttachmentHeader("projekte.pdf");
        }
    };
    WebResource projectsResourceDL = new WebResource() {
        {
            setCacheable(false);
        }

        @Override
        public IResourceStream getResourceStream() {
            return pdfResourceStream;
        }

        @Override
        protected void setHeaders(final WebResponse response) {
            super.setHeaders(response);
            response.setAttachmentHeader("projekte.pdf");
        }
    };
    ResourceLink pdfDownload = new ResourceLink("pdfDownload", projectsResourceDL);
    ResourceLink pdfPopup = new ResourceLink("pdfPopup", projectsResource);
    PopupSettings popupSettings = new PopupSettings(PopupSettings.STATUS_BAR);
    popupSettings.setWidth(500);
    popupSettings.setHeight(700);
    pdfPopup.setPopupSettings(popupSettings);
    Link pdfReqTarget = new Link("pdfReqTarget") {
        @Override
        public void onClick() {
            RequestCycle.get()
                    .setRequestTarget(new ResourceStreamRequestTarget(pdfResourceStream, "projekte.pdf"));
        }
    };
    add(pdfReqTarget);
    add(pdfDownload);
    add(pdfPopup);
    add(new OrderByBorder("orderByKuerzel", "kuerzel", projectProvider));
    add(new OrderByBorder("orderByName", "name", projectProvider));
    add(new OrderByBorder("orderByBudget", "budget", projectProvider));
    add(new OrderByBorder("orderByCostPerHour", "costPerHour", projectProvider));
    add(new OrderByBorder("orderByStart", "start", projectProvider));
    add(new OrderByBorder("orderByEnde", "ende", projectProvider));
    add(new OrderByBorder("orderByState", "state", projectProvider));
    add(new PagingNavigator("projectsNavigator", dataView));
}

From source file:de.tudarmstadt.ukp.csniper.webapp.support.wicket.ThresholdLink.java

License:Apache License

public ThresholdLink(String aId, int aWidth, int aHeight) {
    super(aId);/* ww w. jav  a  2s. c om*/

    PopupSettings ps = new PopupSettings(aId, PopupSettings.SCROLLBARS + PopupSettings.LOCATION_BAR);
    ps.setWidth(aWidth);
    ps.setHeight(aHeight);
    setPopupSettings(ps);

    setBody(new Model<String>(
            "<img src=\"images/questionmark.png\" alt=\"Explanation\" style=\"vertical-align:bottom\" />"));
    setEscapeModelStrings(false);
}

From source file:de.twenty11.skysail.client.osgimonitor.wicket.pages.bundles.WicketExampleHeader.java

License:Apache License

/**
 * Construct.//from  ww w  . ja  v a 2  s.  com
 * 
 * @param id
 *            id of the component
 * @param exampleTitle
 *            title of the example
 * @param page
 *            The example page
 */
public WicketExampleHeader(String id, String exampleTitle, WebPage page) {
    super(id);

    //add(new DebugBar("debug"));
    add(new Label("exampleTitle", exampleTitle));
    //      BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>("sources",
    //         SourcesPage.class, SourcesPage.generatePageParameters(page));
    //add(link);

    PopupSettings settings = new PopupSettings("sources", PopupSettings.RESIZABLE);
    settings.setWidth(800);
    settings.setHeight(600);
    //link.setPopupSettings(settings);
}

From source file:jp.go.nict.langrid.management.web.view.page.user.component.link.ExternalHomePageLink.java

License:Open Source License

/**
 * /*w  w  w .j  a v a 2  s .c  o  m*/
 * 
 */
public ExternalHomePageLink(String componentId, String url, String uniqueId) {
    super(componentId, url);
    PopupSettings settings = new PopupSettings(PageMap.forName(componentId.concat(uniqueId)),
            PopupSettings.SCROLLBARS | PopupSettings.RESIZABLE | PopupSettings.MENU_BAR
                    | PopupSettings.LOCATION_BAR | PopupSettings.STATUS_BAR | PopupSettings.TOOL_BAR);
    settings.setHeight(HEIGHT);
    settings.setWidth(WIDTH);
    setPopupSettings(settings);
    add(createLabel(componentId, url).add(new AttributeAppender("title", new Model<String>(url), " ")));
}

From source file:jp.go.nict.langrid.management.web.view.page.user.component.link.ExternalHomePageLink.java

License:Open Source License

/**
 * /*from w  ww . j  av a 2s.  c  o m*/
 * 
 */
public ExternalHomePageLink(String componentId, String url, String uniqueId, int limit) {
    super(componentId, url);
    PopupSettings settings = new PopupSettings(PageMap.forName(componentId.concat(uniqueId)),
            PopupSettings.SCROLLBARS | PopupSettings.RESIZABLE | PopupSettings.MENU_BAR
                    | PopupSettings.LOCATION_BAR | PopupSettings.STATUS_BAR | PopupSettings.TOOL_BAR);
    settings.setHeight(HEIGHT);
    settings.setWidth(WIDTH);
    setPopupSettings(settings);
    if (url == null || url.equals("")) {
        url = "-";
    }
    add(createLabel(componentId, StringUtil.shortenString(url, limit))
            .add(new AttributeAppender("title", new Model<String>(url), " ")));
    setEnabled(!(url == null || url.equals("") || url.equals("-")));
}

From source file:org.apache.oodt.cas.webcomponents.filemgr.browser.types.TypeBrowser.java

License:Apache License

public TypeBrowser(String componentId, String fmUrlStr, String productTypeName, int pageNum,
        final Class<? extends WebPage> typeBrowserPage, final Class<? extends WebPage> produdctBrowser,
        final Class<? extends WebPage> prodRefsBrowser, final Class<? extends WebPage> prodMetBrowser) {

    super(componentId);
    this.fm = new FileManagerConn(fmUrlStr);
    this.type = fm.safeGetProductTypeByName(productTypeName);
    this.pageNum = pageNum;
    this.criteria = ((FMBrowserSession) getSession()).getCriteria();
    this.refreshProductPage();
    this.computeStartEndIdx();

    add(new ExistingCriteriaForm("existing_criteria_form"));
    add(new AddCriteriaForm("new_criteria_form"));

    add(new Label("ptype_name", type.getName()));
    add(new Label("start_idx", String.valueOf(this.startIdx)));
    add(new Label("end_idx", String.valueOf(this.endIdx)));
    add(new Label("num_products", String.valueOf(this.totalProducts)));

    add(new ListView<Product>("product_list", this.productPage.getPageProducts()) {
        /*//  w ww  . j a v a  2s . com
         * (non-Javadoc)
         * 
         * @see
         * org.apache.wicket.markup.html.list.ListView#populateItem(org.apache
         * .wicket.markup.html.list.ListItem)
         */
        @Override
        protected void populateItem(ListItem<Product> prodItem) {
            Link prodPageLink = new Link<Product>("product_page_link",
                    new ProductModel(prodItem.getModelObject())) {

                /*
                 * (non-Javadoc)
                 * 
                 * @see org.apache.wicket.markup.html.link.Link#onClick()
                 */
                @Override
                public void onClick() {
                    PageParameters params = new PageParameters();
                    params.add("id", this.getModelObject().getProductId());
                    setResponsePage(produdctBrowser, params);

                }
            };

            prodPageLink.add(new Label("product_name", prodItem.getModelObject().getProductName()));
            prodItem.add(prodPageLink);

            prodItem.add(new Label("product_transfer_status", prodItem.getModelObject().getTransferStatus()));
            try {
                prodItem.add(new Label("product_pct_transferred", NumberFormat.getPercentInstance()
                        .format(fm.getFm().getProductPctTransferred(prodItem.getModelObject()))));
            } catch (DataTransferException e) {
                LOG.log(Level.WARNING, "Unable to obtain transfer percentage for product: ["
                        + prodItem.getModelObject().getProductName() + "]: Reason: " + e.getMessage());
            }

            String prodReceivedTime = fm.getProdReceivedTime(prodItem.getModelObject());
            prodItem.add(new Label("product_received_time", prodReceivedTime));
            PopupSettings refSettings = new PopupSettings();
            refSettings.setWidth(525).setHeight(450).setWindowName("_refWin");
            Link<String> refLink = new Link<String>("ref_page_link",
                    new Model<String>(prodItem.getModelObject().getProductId())) {

                /*
                 * (non-Javadoc)
                 * 
                 * @see org.apache.wicket.markup.html.link.Link#onClick()
                 */
                @Override
                public void onClick() {
                    PageParameters params = new PageParameters();
                    params.add("id", getModelObject());
                    setResponsePage(prodRefsBrowser, params);

                }
            };
            refLink.setPopupSettings(refSettings);
            prodItem.add(refLink);

            Link<String> metLink = new Link<String>("met_page_link",
                    new Model(prodItem.getModelObject().getProductId())) {

                /*
                 * (non-Javadoc)
                 * 
                 * @see org.apache.wicket.markup.html.link.Link#onClick()
                 */
                @Override
                public void onClick() {
                    PageParameters params = new PageParameters();
                    params.add("id", getModelObject());
                    setResponsePage(prodMetBrowser, params);

                }

            };

            PopupSettings metSettings = new PopupSettings();
            metSettings.setWidth(525).setHeight(450).setWindowName("_metWin");
            metLink.setPopupSettings(metSettings);
            prodItem.add(metLink);

        }

    });

    add(new ProductPaginator("paginator", this.productPage, this.type.getName(), typeBrowserPage));

}