Example usage for org.apache.wicket.util.string StringValue toOptionalString

List of usage examples for org.apache.wicket.util.string StringValue toOptionalString

Introduction

In this page you can find the example usage for org.apache.wicket.util.string StringValue toOptionalString.

Prototype

public final String toOptionalString() 

Source Link

Document

Convert to object types, returning null if text is null.

Usage

From source file:eu.uqasar.web.pages.adapterdata.AdapterAddEditPage.java

License:Apache License

/**
 * //from   w ww . j a va  2 s.c  om
 * @param idParam
 */
private void loadAdapter(final StringValue idParam) {
    if (idParam.isEmpty()) {
        setPageTitle(new StringResourceModel("page.create.title", this, null));
        add(new Label("header", new StringResourceModel("form.create.header", this, null)));
        adapterSettings = new AdapterSettings();
    } else {

        adapterSettings = adapterSettingsService.getById(idParam.toOptionalLong());
        if (adapterSettings == null) {
            throw new EntityNotFoundException(AdapterSettings.class, idParam.toOptionalString());
        }

        setPageTitle(new StringResourceModel("page.edit.title", this, null));
        add(new Label("header", new StringResourceModel("form.edit.header", this, null)));
    }
}

From source file:eu.uqasar.web.pages.admin.settings.platform.PlatformSettingsAddEditPage.java

License:Apache License

/**
 * /*from   ww  w  .j  a  v  a2 s  . co  m*/
 * @param idParam
 */
private void loadSettings(final StringValue idParam) {
    if (idParam.isEmpty()) {
        setPageTitle(new StringResourceModel("page.create.title", this, null));
        add(new Label("header", new StringResourceModel("form.create.header", this, null)));
        platformSettings = new PlatformSettings();
    } else {
        platformSettings = platformSettingsService.getById(idParam.toOptionalLong());
        if (platformSettings == null) {
            throw new EntityNotFoundException(PlatformSettings.class, idParam.toOptionalString());
        }

        setPageTitle(new StringResourceModel("page.edit.title", this, null));
        add(new Label("header", new StringResourceModel("form.edit.header", this, null)));
    }
}

From source file:eu.uqasar.web.pages.processes.ProcessAddEditPage.java

License:Apache License

/**
 * //from   www.ja  v a  2 s .c  o m
 * @param idParam
 */
private void loadProcess(final StringValue idParam) {
    // If no id is provided
    if (idParam.isEmpty()) {
        setPageTitle(new StringResourceModel("page.create.title", this, null));
        add(new Label("header", new StringResourceModel("form.create.header", this, null)));
        process = new Process();
    }
    // Attempt to load the process by the id
    else {
        process = processService.getById(idParam.toLong());
        if (process == null) {
            throw new EntityNotFoundException(Process.class, idParam.toOptionalString());
        }

        setPageTitle(new StringResourceModel("page.edit.title", this, null));
        add(new Label("header", new StringResourceModel("form.edit.header", this, null)));
    }
}

From source file:eu.uqasar.web.pages.products.ProductAddEditPage.java

License:Apache License

/**
 * /*from  w  w w .  ja  v  a 2s .  c om*/
 * @param idParam
 */
private void loadProduct(final StringValue idParam) {
    // If no ID is provided
    if (idParam.isEmpty()) {
        setPageTitle(new StringResourceModel("page.create.title", this, null));
        add(new Label("header", new StringResourceModel("form.create.header", this, null)));
        product = new Product();
    }
    // If a parameter is provided, attempt to load the product
    else {
        product = productService.getById(idParam.toLong());
        if (product == null) {
            throw new EntityNotFoundException(Product.class, idParam.toOptionalString());
        }

        setPageTitle(new StringResourceModel("page.edit.title", this, null));
        add(new Label("header", new StringResourceModel("form.edit.header", this, null)));
    }
}

From source file:net.rrm.ehour.ui.timesheet.page.MonthOverviewPage.java

License:Open Source License

public MonthOverviewPage(PageParameters parameters) {
    super(new ResourceModel("overview.title"), null);

    StringValue param = parameters.get(PARAM_OPEN);

    if (param != null) {
        init(OpenPanel.valueOf(param.toOptionalString()));
    } else {// ww  w.ja v  a2s. c o m
        init(OpenPanel.OVERVIEW);
    }
}