List of usage examples for org.apache.wicket.util.value ValueMap getInt
@Override public final int getInt(final String key, final int defaultValue)
From source file:net.kornr.swit.wicket.layout.threecol.ThreeColumnsLayoutResource.java
License:Apache License
@Override public IResourceStream getResourceStream() { ValueMap map = this.getParameters(); String name = map.getString("id", null); if (name == null) return null; LayoutInfo current = m_layouts.get(name); current = current.duplicate();//from w ww .j a v a 2 s. com try { current.setLeftSize(map.getInt("left", current.getLeftSize())); current.setRightSize(map.getInt("right", current.getRightSize())); current.setUnit(map.getInt("unit", current.getUnit())); String leftcol = map.getString("leftcol", null); if (leftcol != null) current.setLeftColor(new Color(Integer.parseInt(leftcol))); String rightcol = map.getString("rightcol", null); if (rightcol != null) current.setLeftColor(new Color(Integer.parseInt(rightcol))); String middlecol = map.getString("middlecol", null); if (middlecol != null) current.setLeftColor(new Color(Integer.parseInt(middlecol))); } catch (Exception exc) { // We don't really care if there's an error exc.printStackTrace(); } String css = getStyle(current); return new StringResourceStream(css, "text/css"); }
From source file:org.geoserver.web.crs.DynamicCrsMapResource.java
License:Open Source License
@Override public IResourceStream getResourceStream() { ValueMap parameters = getParameters(); int width = parameters.getInt("WIDTH", 400); int height = parameters.getInt("HEIGHT", 200); String bboxStr = parameters.getString("BBOX"); ByteArrayOutputStream output = null; if (bboxStr != null) { try {//from w w w . j a va2 s. c om CRSAreaOfValidityMapBuilder builder = new CRSAreaOfValidityMapBuilder(width, height); Envelope envelope = parseEnvelope(bboxStr); RenderedImage image = builder.createMapFor(crs, envelope); output = new ByteArrayOutputStream(); ImageIO.write(image, "PNG", output); } catch (Exception e) { output = null; e.printStackTrace(); } } final byte[] byteArray = output == null ? null : output.toByteArray(); return new ByteArrayResourceStream(byteArray); }
From source file:org.obiba.onyx.quartz.core.wicket.layout.impl.simplified.pad.NumericPad.java
License:Open Source License
private DataField createPadInputField(final DataType type) { // Create the numeric pad input field. DataField openField = new DataField("value", new PropertyModel(this, "data"), type); openField.getField().clearInput();/* w w w . jav a 2 s . c o m*/ openField.setOutputMarkupId(true); openField.setMarkupId("valuePressed"); openField.setRequired(isRequired()); ValueMap arguments = getOpenAnswerDefinition().getUIArgumentsValueMap(); int size = 2; if (arguments != null) { size = arguments.getInt(INPUT_SIZE_KEY, -1); } if (size < 1) { size = 1; } openField.add(new AttributeAppender("size", new Model<String>(Integer.toString(size)), "")); // Transfer the validators of the OpenAnswer field to the numeric pad. for (IValidator dataValidator : OpenAnswerDefinitionValidatorFactory.getValidators( getOpenAnswerDefinitionModel(), activeQuestionnaireAdministrationService.getQuestionnaireParticipant().getParticipant())) { openField.add(dataValidator); } return openField; }
From source file:org.obiba.onyx.quartz.core.wicket.layout.impl.util.QuestionCategoryListToGridPermutator.java
License:Open Source License
public QuestionCategoryListToGridPermutator(IModel<Question> questionModel) { super();/*from ww w . j a va 2 s.c om*/ Question question = (Question) questionModel.getObject(); ValueMap arguments = question.getUIArgumentsValueMap(); if (arguments != null) { setRowCount(arguments.getInt(ROW_COUNT_KEY, ListToGridPermutator.DEFAULT_ROW_COUNT)); } }