/** * Returns the value of the input field. * * @return the current value */ public String getValue() { return m_inputField.getValue(); }
/** * Returns the value of the key input field. * * @return the current value */ public String getKey() { return m_keyInputField.getValue(); }
/** * Gets the resource type name. * * @return the resource type name */ public String getResourceTypeName() { return name.getValue(); } }
/** * Gets the SNMP collection name. * * @return the SNMP collection name */ public String getSnmpCollectionName() { return name.getValue(); }
/** * Gets the group name. * * @return the group name */ public String getGroupName() { return name.getValue(); } }
/** * Returns the value of the value input field. * * @return the current value */ public String getValue() { return m_valueInputField.getValue(); }
/** * Gets the system definition name. * * @return the system definition name */ public String getSystemDefName() { return name.getValue(); } }
@Override public String getValue() { return this.textField.getValue(); }
/** * Gets the step value. * * @return the step value */ public Integer getStepValue() { final String value = step.getValue(); return value == null ? null : Integer.valueOf(value); } }
@Override public void buttonClick(Button.ClickEvent event) { final Button btn = event.getButton(); if (btn == okButton) { if (ueiBase.getValue() != null && ! ((String) ueiBase.getValue()).trim().equals("")) { close(); changeUeiHandler((String)ueiBase.getValue()); } } if (btn == cancelButton) { close(); } }
@Override protected SystemDefChoice getInternalValue() { SystemDefChoice systemDef = new SystemDefChoice(); String type = (String) oidType.getValue(); if (type.equals(SINGLE)) { systemDef.setSysoid((String) oidValue.getValue()); } else { systemDef.setSysoidMask((String) oidValue.getValue()); } return systemDef; }
@Override protected Rrd getInternalValue() { Rrd rrd = new Rrd(); try { rrd.setStep(Integer.valueOf((String) step.getValue())); } catch (NumberFormatException e) { rrd.setStep(null); } for (RRA rra: container.getOnmsBeans()) { rrd.addRra(rra.getRra()); } return rrd; }
@Override public void writeDesign(Element design, DesignContext designContext) { super.writeDesign(design, designContext); AbstractTextField def = (AbstractTextField) designContext .getDefaultInstance(this); Attributes attr = design.attributes(); DesignAttributeHandler.writeAttribute("value", attr, getValue(), def.getValue(), String.class, designContext); }
@Override public void buttonClick(Button.ClickEvent event) { if (!m_thresholdTextField.isValid() || !m_nameTextField.isValid() || !m_exponentialPropagationBaseTextField.isValid()) { return; } final ReductionFunction reductionFunction = getReduceFunction(); businessService.setName(m_nameTextField.getValue().trim()); businessService.setReduceFunction(reductionFunction); businessService.save(); close(); }
@Test public void linkField_SetFieldPropagation() throws Exception { // GIVEN baseNode.setProperty(propertyName, "notChanged"); setFactory(null); Field<String> field = linkFieldFactory.createField(); assertThat("notChanged", is(((LinkField) field).getTextField().getValue())); // WHEN ((LinkField) field).getTextField().setValue("Changed"); // THEN assertThat("Changed", is(((LinkField) field).getTextField().getValue())); }
/** * Gets the OpenNMS data collection group. * * @return the OpenNMS data collection group */ public DatacollectionGroup getOnmsDataCollection() { final DatacollectionGroup group = new DatacollectionGroup(); group.setName((String) groupName.getValue()); group.setGroups(groups.getGroups()); group.setResourceTypes(resourceTypes.getResourceTypes()); group.setSystemDefs(systemDefs.getSystemDefs()); return group; }
@Test public void linkFieldRequired() throws Exception { // GIVEN definition.setRequired(true); baseNode.setProperty(propertyName, "notChanged"); setFactory(null); Field<String> field = linkFieldFactory.createField(); assertThat("notChanged", is(((LinkField) field).getTextField().getValue())); // WHEN field.setValue(null); ErrorMessage errorMessage = ((LinkField) field).getErrorMessage(); // THEN assertThat(errorMessage, is(notNullValue())); }
@Test public void fileNameChangeIsPropagated() throws IOException { // GIVEN BasicUploadFieldDefinition definition = new BasicUploadFieldDefinition(); definition.setEditFileName(true); BasicUploadField<UploadReceiver> uploadField = new BasicUploadField<UploadReceiver>(null, null, definition, simpleTranslator); receiver.setFileName("me.jpg"); Property<UploadReceiver> property = new ObjectProperty<UploadReceiver>(receiver); uploadField.setPropertyDataSource(property); TextField textField = (TextField) uploadField.getFileDetailFileName(); assertEquals("me", textField.getValue()); // WHEN textField.setValue("newMe"); // THEN assertEquals("newMe.jpg", receiver.getFileName()); }
@Test public void fileNameChangeIsPropagatedWhenFileHasNoExtension() throws IOException { // GIVEN BasicUploadFieldDefinition definition = new BasicUploadFieldDefinition(); definition.setEditFileName(true); BasicUploadField<UploadReceiver> uploadField = new BasicUploadField<UploadReceiver>(null, null, definition, simpleTranslator); receiver.setFileName("me"); Property<UploadReceiver> property = new ObjectProperty<UploadReceiver>(receiver); uploadField.setPropertyDataSource(property); TextField textField = (TextField) uploadField.getFileDetailFileName(); assertEquals("me", textField.getValue()); // WHEN textField.setValue("newMe.png"); // THEN assertEquals("newMe.png", receiver.getFileName()); }