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

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

Introduction

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

Prototype

int SCROLLBARS

To view the source code for org.apache.wicket.markup.html.link PopupSettings SCROLLBARS.

Click Source Link

Document

Flag to include scrollbars

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/*  w  w  w  . j a v  a 2  s  . c  o 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.  j  a 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:de.tudarmstadt.ukp.csniper.webapp.support.wicket.ThresholdLink.java

License:Apache License

public ThresholdLink(String aId, int aWidth, int aHeight) {
    super(aId);//from w  ww . j  a va2  s.c  o  m

    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:jdave.webdriver.testapplication.WebDriverTestPage.java

License:Apache License

public WebDriverTestPage() {
    final Label label = new Label("testLabel", new Model<String>("test label"));
    label.setOutputMarkupId(true);// ww w. j ava2  s .c  o 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

/**
 * /*from   w w w.  ja va2 s . com*/
 * 
 */
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:jp.go.nict.langrid.management.web.view.page.user.component.link.ExternalHomePageLink.java

License:Open Source License

/**
 * //  w ww .j  a  v  a 2s  .  co 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   ww  w.  ja v  a  2  s .  c  om
 * 
 */
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:ontopoly.components.FieldInstanceURIField.java

License:Apache License

public FieldInstanceURIField(String id, FieldValueModel _fieldValueModel) {
    super(id);/* w  w  w . j  av a 2s. c  om*/
    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 www.j a v a2  s  .c o  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  ww w . j av a2 s  .c o  m
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;
        }
    }
}