/** * Gets the label text (if label exists) else returns <code>null</code>. * * @return the text of the label component of this field. */ public String getLabelText() { String text = null; if (label != null) { text = label.getText(); } return text; }
/** * @return a String representation of this component, for debugging purposes. */ @Override public String toString() { String text = getText(); text = text == null ? "null" : ('"' + text + '"'); return toString(text, 1, 1); }
/** * {@inheritDoc} */ @Override public String toString() { String targetName = getTarget().getClass().getSimpleName(); WLabel label = getTarget().getLabel(); if (label != null) { targetName = label.getText(); } return "set " + targetName + " mandatory"; }
/** * {@inheritDoc} */ @Override public String toString() { String targetName = getTarget().getClass().getSimpleName(); WLabel label = getTarget().getLabel(); if (label != null) { targetName = label.getText(); } return "hide " + targetName; }
/** * {@inheritDoc} */ @Override public String toString() { String targetName = getTarget().getClass().getSimpleName(); WLabel label = getTarget().getLabel(); if (label != null) { targetName = label.getText(); } return "set " + targetName + " optional"; }
/** * {@inheritDoc} */ @Override public String toString() { String targetName = getTarget().getClass().getSimpleName(); WLabel label = getTarget().getLabel(); if (label != null) { targetName = label.getText(); } return "show " + targetName; }
/** * {@inheritDoc} */ @Override public String toString() { String triggerName = getTrigger().getClass().getSimpleName(); WLabel label = getTrigger().getLabel(); if (label != null) { triggerName = label.getText(); } return triggerName + ">\"" + getValue() + "\""; }
/** * {@inheritDoc} */ @Override public String toString() { String targetInName = getTargetInGroup().getClass().getSimpleName(); WLabel label = getTargetInGroup().getLabel(); if (label != null) { targetInName = label.getText(); } return "hide " + targetInName + " in " + getTarget(); }
/** * {@inheritDoc} */ @Override public String toString() { String triggerName = getTrigger().getClass().getSimpleName(); WLabel label = getTrigger().getLabel(); if (label != null) { triggerName = label.getText(); } return triggerName + "<\"" + getValue() + "\""; }
/** * {@inheritDoc} */ @Override public String toString() { String targetInName = getTargetInGroup().getClass().getSimpleName(); WLabel label = getTargetInGroup().getLabel(); if (label != null) { targetInName = label.getText(); } return "disable " + targetInName + " in " + getTarget(); }
/** * {@inheritDoc} */ @Override public String toString() { String triggerName = getTrigger().getClass().getSimpleName(); WLabel label = getTrigger().getLabel(); if (label != null) { triggerName = label.getText(); } return triggerName + "!=\"" + getValue() + "\""; }
/** * {@inheritDoc} */ @Override public String toString() { String triggerName = getTrigger().getClass().getSimpleName(); WLabel label = getTrigger().getLabel(); if (label != null) { triggerName = label.getText(); } return triggerName + "=\"" + getValue() + "\""; }
/** * @return a String representation of this component, for debugging purposes. */ @Override public String toString() { String text = getLabel().getText(); text = text == null ? "null" : ('"' + text + '"'); return getContent().toString(text, -1, -1); }
@Test public void testNoSanitizeOnOutput() { String input = "<form>content</form>"; WLabel label = new WLabel(input); label.setEncodeText(false); Assert.assertEquals("Expect output to not be sanitized", input, label.getText()); }
@Test public void testToString() { MyTarget target = new MyTarget(); Disable action = new Disable(target); Assert.assertEquals("Incorrect toString for action", "disable MyTarget", action.toString()); WLabel label = new WLabel("test label", target); Assert.assertEquals("Incorrect toString for action with a label", "disable " + label. getText(), action.toString()); }
@Test public void testToString() { MyTrigger trigger = new MyTrigger(); Equal compare = new Equal(trigger, "1"); Assert.assertEquals("Incorrect toString for compare", "MyTrigger=\"1\"", compare.toString()); WLabel label = new WLabel("test label", trigger); Assert.assertEquals("Incorrect toString for compare with a label", label.getText() + "=\"1\"", compare.toString()); }
@Test public void testToString() { MyTrigger trigger = new MyTrigger(); GreaterThanOrEqual compare = new GreaterThanOrEqual(trigger, "1"); Assert. assertEquals("Incorrect toString for compare", "MyTrigger>=\"1\"", compare. toString()); WLabel label = new WLabel("test label", trigger); Assert.assertEquals("Incorrect toString for compare with a label", label.getText() + ">=\"1\"", compare.toString()); }
@Test public void testToString() { MyTrigger trigger = new MyTrigger(); GreaterThan compare = new GreaterThan(trigger, "1"); Assert.assertEquals("Incorrect toString for compare", "MyTrigger>\"1\"", compare.toString()); WLabel label = new WLabel("test label", trigger); Assert.assertEquals("Incorrect toString for compare with a label", label.getText() + ">\"1\"", compare.toString()); }
@Test public void testToString() { MyTarget target = new MyTarget(); Enable action = new Enable(target); Assert.assertEquals("Incorrect toString for action", "enable MyTarget", action.toString()); WLabel label = new WLabel("test label", target); Assert.assertEquals("Incorrect toString for action with a label", "enable " + label. getText(), action.toString()); }
@Test public void testToString() { MyTarget target = new MyTarget(); Show action = new Show(target); Assert.assertEquals("Incorrect toString for action", "show MyTarget", action.toString()); WLabel label = new WLabel("test label", target); Assert.assertEquals("Incorrect toString for action with a label", "show " + label.getText(), action.toString()); }