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

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

Introduction

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

Prototype

public final int toInt() throws StringValueConversionException 

Source Link

Document

Convert this text to an int.

Usage

From source file:org.efaps.ui.wicket.components.gridx.GridXComponent.java

License:Apache License

@Override
public void onLinkClicked() {
    final StringValue rowId = getRequest().getRequestParameters().getParameterValue("rowId");
    final StringValue colId = getRequest().getRequestParameters().getParameterValue("colId");

    try {//from w  w  w .j a  v a 2 s.  c  o  m
        final UIGrid uiGrid = (UIGrid) getDefaultModelObject();
        final List<Cell> row = uiGrid.getValues().get(rowId.toInt());
        final Cell cell = row.get(colId.toInt());

        if (cell.getInstance() != null) {
            Menu menu = null;
            try {
                menu = Menu.getTypeTreeMenu(cell.getInstance().getType());
            } catch (final EFapsException e) {
                throw new RestartResponseException(new ErrorPage(e));
            }
            if (menu == null) {
                final Exception ex = new Exception(
                        "no tree menu defined for type " + (cell.getInstance()) == null ? "??"
                                : cell.getInstance().getType().getName());
                throw new RestartResponseException(new ErrorPage(ex));
            }

            Page page;
            try {
                page = new ContentContainerPage(menu.getUUID(), cell.getInstance().getKey(),
                        getPage() instanceof StructurBrowserPage);
            } catch (final EFapsException e) {
                page = new ErrorPage(e);
            }
            this.setResponsePage(page);
        }
    } catch (final StringValueConversionException | EFapsException e) {
        GridXComponent.LOG.error("Catched error", e);
    }
}

From source file:org.jabox.webapp.panels.HeaderLinksPage.java

License:Open Source License

public HeaderLinksPage(PageParameters params) {
    StringValue selected = params.get("selected");
    add(new FrameHeaderLinksPanel("headerLinks", selected.toInt()));
}

From source file:org.projectforge.web.wicket.WicketUtils.java

License:Open Source License

public static int getAsInt(final PageParameters parameters, final String name, final int defaultValue) {
    final StringValue sval = parameters.get(name);
    if (sval == null || sval.isNull() == true) {
        return defaultValue;
    } else {//from  w ww .j  a  v  a  2s . c o m
        return sval.toInt();
    }
}