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

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

Introduction

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

Prototype

public PopupSettings(String windowName) 

Source Link

Document

Construct.

Usage

From source file:com.asptt.plongee.resa.util.UtilsFSpdf.java

public ResourceLink createWebResourcePdf(final Adherent adherent, final FicheSecurite fs) {
        Resource pdfResource = new WebResource() {
            @Override/*from   ww  w  . ja  va  2s  . co m*/
            public IResourceStream getResourceStream() {
                String nom = adherent.getNom();
                final String realPath;
                if (null != fs) {
                    realPath = catalinaBasePath.concat(Parameters.getString("fs.path")).concat(nom).concat("_FS")
                            .concat(".pdf");
                    // Cration du pdf
                    try {
                        createPdfFS(realPath, fs);
                    } catch (com.itextpdf.io.IOException ex) {
                        java.util.logging.Logger.getLogger(UpdateListeFS.class.getName()).log(Level.SEVERE, null,
                                ex);
                    } catch (java.io.IOException ex) {
                        java.util.logging.Logger.getLogger(UpdateListeFS.class.getName()).log(Level.SEVERE, null,
                                ex);
                    }
                } else {
                    //Recherche du Certificat mdical
                    nom = nom.substring(0, 1).toUpperCase() + nom.substring(1).toLowerCase();
                    String license = adherent.getNumeroLicense();
                    realPath = catalinaBasePath.concat(Parameters.getString("cm.path")).concat(nom).concat("_")
                            .concat(license).concat(".pdf");
                }
                java.io.File file = new java.io.File(realPath);
                // created FileResourceStream object by passing the above File object name "pdfFile".
                IResourceStream stream = new FileResourceStream(file);
                file.deleteOnExit();
                //finally returns the stream
                return stream;
            }
        };
        /*
         * Created PopupSettings object named "popupSettings" by passing some parameters in the     
         * constructor and also setted the width and height for popup window.
         */
        PopupSettings popupSettings = new PopupSettings(PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS)
                .setHeight(500).setWidth(700);
        /*
         * Created ResourceLink object named "resourceLink" by passing above Resource object          
         * named "pdfResource" as second parameters.The first parameter is "wicket:id" by which      
         * markup identifies the component and renders it on web page.
         */
        ResourceLink resourceLink = (ResourceLink) new ResourceLink("openPdf", pdfResource);
        //Setted the popupSettings properties of "resourceLink".
        resourceLink.setPopupSettings(popupSettings);
        //if file not found disable resourcelink in case of certificat mdical (fs == null)
        if (null == fs) {
            try {
                pdfResource.getResourceStream().getInputStream();
            } catch (ResourceStreamNotFoundException ex) {
                resourceLink.setEnabled(false);
            }
        }
        //return resourceLink for added in page
        return resourceLink;
    }

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

License:Apache License

private void buildGui() {
    PopupWicketBox fb;/*w  w w .  ja  va2  s. c  om*/
    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.senacor.wbs.web.project.ProjectListPanel.java

License:Apache License

public ProjectListPanel(final String id, final List<Project> projects) {
    super(id);/*  w  ww  . j a  v  a  2s .c om*/
    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.clarin.webanno.webapp.home.page.ApplicationPageBase.java

License:Apache License

@SuppressWarnings({ "serial" })
private void commonInit() {
    //        getSession().setLocale(Locale.ENGLISH);

    logoutPanel = new LogoutPanel("logoutPanel");
    feedbackPanel = new FeedbackPanel("feedbackPanel");
    feedbackPanel.setOutputMarkupId(true);
    feedbackPanel.add(new AttributeModifier("class", "error"));
    feedbackPanel.setFilter(new IFeedbackMessageFilter() {
        @Override/*from   w w w  . j av a 2  s. com*/
        public boolean accept(FeedbackMessage aMessage) {
            Authentication auth = SecurityContextHolder.getContext().getAuthentication();
            String username = auth != null ? auth.getName() : "SYSTEM";
            if (aMessage.isFatal()) {
                LOG.fatal(username + ": " + aMessage.getMessage());
            } else if (aMessage.isError()) {
                LOG.error(username + ": " + aMessage.getMessage());
            } else if (aMessage.isWarning()) {
                LOG.warn(username + ": " + aMessage.getMessage());
            } else if (aMessage.isInfo()) {
                LOG.info(username + ": " + aMessage.getMessage());
            } else if (aMessage.isDebug()) {
                LOG.debug(username + ": " + aMessage.getMessage());
            }
            return true;
        }
    });

    versionLabel = new Label("version", SettingsUtil.getVersionString());

    embeddedDbWarning = new Label("embeddedDbWarning", "USE THIS INSTALLATION FOR TESTING ONLY -- "
            + "AN EMBEDDED DATABASE IS NOT RECOMMENDED FOR PRODUCTION USE");
    embeddedDbWarning.setVisible(false);
    try {
        String driver = repository.getDatabaseDriverName();
        embeddedDbWarning.setVisible(StringUtils.contains(driver.toLowerCase(Locale.US), "hsql"));
    } catch (Throwable e) {
        LOG.warn("Unable to determine which database is being used", e);
    }

    // Override warning about embedded database.
    Properties settings = SettingsUtil.getSettings();
    if ("false".equalsIgnoreCase(settings.getProperty("warnings.embeddedDatabase"))) {
        embeddedDbWarning.setVisible(false);
    }

    // Display a warning when using an unsupported browser
    RequestCycle requestCycle = RequestCycle.get();
    WebClientInfo clientInfo;
    if (Session.exists()) {
        WebSession session = WebSession.get();
        clientInfo = session.getClientInfo();
    } else {
        clientInfo = new WebClientInfo(requestCycle);
    }
    ClientProperties clientProperties = clientInfo.getProperties();

    browserWarning = new Label("browserWarning",
            "THIS BROWSER IS NOT SUPPORTED -- " + "PLEASE USE CHROME OR SAFARI");
    browserWarning.setVisible(!clientProperties.isBrowserSafari() && !clientProperties.isBrowserChrome());

    // Override warning about browser.
    if ("false".equalsIgnoreCase(settings.getProperty("warnings.unsupportedBrowser"))) {
        browserWarning.setVisible(false);
    }

    boolean helpAvailable;
    try {
        Application.get().getResourceSettings().getLocalizer().getString("page.help.link", this);
        Application.get().getResourceSettings().getLocalizer().getString("page.help", this);
        helpAvailable = true;
    } catch (MissingResourceException e) {
        helpAvailable = false;
    }

    add(helpLink = new ExternalLink("helpLink", new ResourceModel("page.help.link", ""),
            new ResourceModel("page.help", "")));
    helpLink.setPopupSettings(new PopupSettings("_blank"));
    helpLink.setVisible(helpAvailable);

    add(logoutPanel);
    add(feedbackPanel);
    add(versionLabel);
    add(embeddedDbWarning);
    add(browserWarning);
}

From source file:eu.uqasar.web.dashboard.DetachWidgetAction.java

License:Apache License

@Override
public AbstractLink getLink(String id) {
    PageParameters parameters = new PageParameters();
    parameters.add("id", widget.getId());
    BookmarkablePageLink<Void> link = new BookmarkablePageLink<>(id, WidgetPage.class, parameters);

    PopupSettings popupSettings = new PopupSettings(widget.getTitle()).setHeight(320).setWidth(550);
    link.setPopupSettings(popupSettings);

    return link;//w w w.ja  v  a  2  s.  c  om
}

From source file:jdave.webdriver.testapplication.WebDriverTestPage.java

License:Apache License

public WebDriverTestPage() {
    final Label label = new Label("testLabel", new Model<String>("test label"));
    label.setOutputMarkupId(true);/*from w  ww .j a  va2s .  co m*/
    add(label);
    add(new AjaxFallbackLink<Void>("testLink") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            label.setDefaultModelObject("link clicked");
            target.addComponent(label);
        }
    });
    add(new AjaxFallbackLink<Void>("testLink2") {
        @Override
        public void onClick(AjaxRequestTarget target) {
        }
    });
    TextField<String> textField = new TextField<String>("testTextField", new Model<String>());
    add(textField);
    textField.add(new OnChangeAjaxBehavior() {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            label.setDefaultModelObject(getDefaultModelObject());
            target.addComponent(label);
        }
    });
    add(new AjaxCheckBox("testCheckBox", new Model<Boolean>(false)) {
        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            label.setDefaultModelObject("checkbox clicked");
            target.addComponent(label);
        }
    });

    add(TestDropDownChoice.getDropDownChoice());
    Link<Void> openLink = new Link<Void>("openChildPageLink") {
        @Override
        public void onClick() {
            setResponsePage(new ChildPage());
        }
    };
    final PopupSettings popupSettings = new PopupSettings(PopupSettings.SCROLLBARS).setWidth(1045)
            .setHeight(900).setWindowName("childPage");
    openLink.setPopupSettings(popupSettings);
    add(openLink);
}

From source file:jp.go.nict.langrid.management.web.view.component.link.PopupLink.java

License:Open Source License

/**
 * /* ww w .j a  va  2  s .c o  m*/
 * 
 */
public PopupLink(final String label, String id, final String uniqueId, Class<T> pageClass) {
    super(label, pageClass);
    setParameter("id", id);
    settings = new PopupSettings(PopupSettings.SCROLLBARS | PopupSettings.RESIZABLE);
    settings.setHeight(HEIGHT);
    settings.setWidth(WIDTH);
    settings.setTop(TOP);
    settings.setLeft(LEFT);
    setPopupSettings(settings);
}

From source file:ontopoly.components.FieldInstanceURIField.java

License:Apache License

public FieldInstanceURIField(String id, FieldValueModel _fieldValueModel) {
    super(id);//from  w  ww  . jav a 2 s. com
    this.fieldValueModel = _fieldValueModel;

    if (!fieldValueModel.isExistingValue()) {
        this.oldValue = null;
    } else {
        Object value = fieldValueModel.getObject();
        if (value instanceof OccurrenceIF) {
            OccurrenceIF occ = (OccurrenceIF) value;
            this.oldValue = occ.getValue();
        } else if (value instanceof LocatorIF) {
            LocatorIF identity = (LocatorIF) value;
            this.oldValue = identity.getAddress();
        } else {
            throw new RuntimeException("Unsupported field value: " + value);
        }
    }

    this.textField = new TextField<String>("input", new Model<String>(oldValue)) {
        @Override
        public boolean isEnabled() {
            return FieldInstanceURIField.this.isEnabled();
        }

        @Override
        protected void onComponentTag(ComponentTag tag) {
            tag.setName("input");
            tag.put("type", "text");
            tag.put("size", cols);
            super.onComponentTag(tag);
        }

        @Override
        protected void onModelChanged() {
            super.onModelChanged();
            String newValue = getModelObject();
            if (ObjectUtils.equals(newValue, oldValue))
                return;
            AbstractOntopolyPage page = (AbstractOntopolyPage) getPage();
            FieldInstance fieldInstance = fieldValueModel.getFieldInstanceModel().getFieldInstance();
            if (fieldValueModel.isExistingValue() && oldValue != null)
                fieldInstance.removeValue(oldValue, page.getListener());
            if (newValue != null && !newValue.equals("")) {
                fieldInstance.addValue(newValue, page.getListener());
                fieldValueModel.setExistingValue(newValue);
            }
            oldValue = newValue;
        }

    };
    if (fieldValueModel.getFieldInstanceModel().getFieldType() == FieldDefinition.FIELD_TYPE_IDENTITY) {
        textField.add(new IdentityValidator(this, fieldValueModel.getFieldInstanceModel()));
    } else {
        textField.add(new URIValidator(this, fieldValueModel.getFieldInstanceModel()));
    }
    add(textField);

    this.button = new ExternalLink("button", new AbstractReadOnlyModel<String>() {
        @Override
        public String getObject() {
            return textField.getModelObject();
        }
    }) {

        @Override
        public boolean isVisible() {
            return textField.getModelObject() != null;
        }
    };
    button.setOutputMarkupId(true);
    button.setPopupSettings(
            new PopupSettings(PopupSettings.LOCATION_BAR | PopupSettings.MENU_BAR | PopupSettings.RESIZABLE
                    | PopupSettings.SCROLLBARS | PopupSettings.STATUS_BAR | PopupSettings.TOOL_BAR));
    button.add(new OntopolyImage("icon", "goto.gif"));
    add(button);

    // validate field using registered validators
    ExternalValidation.validate(textField, oldValue);
}

From source file:org.dcache.webadmin.view.beans.ThumbnailPanelBean.java

License:Open Source License

public ThumbnailPanelBean(File file, int height, int width) {
    String name = file.getName();
    int end = name.indexOf(RrdSettings.FILE_SUFFIX);
    this.name = name.substring(0, end);
    IResource resource = new ResourceStreamResource(new FileResourceStream(file));
    Image image = new Image("thumbnail", resource);
    PopupSettings popupSettings = new PopupSettings(PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS)
            .setHeight(height).setWidth(width);

    ResourceLink link = new ResourceLink("plotlink", resource);
    link.setPopupSettings(popupSettings);
    link.add(image);//from  w w  w  . ja  va  2  s . co  m
    this.link = link;
}

From source file:org.dcache.webadmin.view.panels.billingplots.PlotsPanel.java

License:Open Source License

/**
 * Two thirds of this method is shared with {@link ThumbnailPanelBean};
 * the latter needs to be generalized to cover this case. TODO
 *//*from w  ww  . ja  v a  2s . com*/
private void loadPlots(File[] files, int width, int height) {
    int n = 0;
    int m = 0;
    for (File file : files) {
        String suffix = "_" + m + n;
        ResourceStreamResource resource = new ResourceStreamResource(new FileResourceStream(file));
        resource.setCacheDuration(Duration.NONE);
        Image image = new Image(IMAGE_NAME + suffix, resource);
        PopupSettings popupSettings = new PopupSettings(PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS)
                .setHeight(height).setWidth(width);
        ResourceLink link = new ResourceLink(LINK_NAME + suffix, resource);
        link.setPopupSettings(popupSettings);
        link.add(image);
        add(link);
        n = (n + 1) % 4;
        if (n == 0) {
            ++m;
        }
    }
}