Example usage for org.apache.wicket.util.value IValueMap getInt

List of usage examples for org.apache.wicket.util.value IValueMap getInt

Introduction

In this page you can find the example usage for org.apache.wicket.util.value IValueMap getInt.

Prototype

int getInt(final String key, final int defaultValue) throws StringValueConversionException;

Source Link

Document

Retrieves an int value by key, using a default value if not found.

Usage

From source file:org.hippoecm.frontend.dialog.DialogWindow.java

License:Apache License

private void internalShow(Dialog dialog) {
    this.dialog = dialog;
    dialog.setDialogService(this);
    setTitle(new EscapeHtmlStringModel(new StringWithoutLineBreaksModel(dialog.getTitle())));
    setContent(dialog.getComponent());/*from  w  w  w  .  j a  v a2  s  .  com*/
    setWindowClosedCallback(new Callback(dialog));

    IValueMap properties = dialog.getProperties();

    if (properties.containsKey("height") && properties.getString("height").equals("auto")) {
        setUseInitialHeight(false);
    } else {
        setUseInitialHeight(true);
        setInitialHeight(properties.getInt("height", 455));
    }

    setInitialWidth(properties.getInt("width", 850));
    setResizable(properties.getAsBoolean("resizable", false));

    String cssClasses = "hippo-dialog";
    if (isResizable()) {
        cssClasses += " hippo-dialog-resizable";
    }

    final String customCssClass = properties.getString("css-class-name", null);
    if (StringUtils.isNotEmpty(customCssClass)) {
        cssClasses += " " + customCssClass;
    }
    setCssClassName(cssClasses);

    AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
    if (target != null) {
        show(target);
    }
}

From source file:org.hippoecm.frontend.plugins.yui.upload.validation.ImageUploadValidationService.java

License:Apache License

public ImageUploadValidationService(IValueMap params) {
    super(params);

    maxWidth = params.getInt(MAX_WIDTH, DEFAULT_MAX_WIDTH);
    maxHeight = params.getInt(MAX_HEIGHT, DEFAULT_MAX_HEIGHT);

    addValidator(upload -> {/*from  ww w .j a v  a 2  s .  com*/
        // SVG files do not have a fixed size so they are always OK
        if (!MimeTypeHelper.isSvgMimeType(upload.getContentType())) {
            validateSizes(upload);
        }
    });
}