Search in sources :

Example 36 with WLabel

use of com.github.bordertech.wcomponents.WLabel in project wcomponents by BorderTech.

the class NotEqual method toString.

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
    String triggerName = getTrigger().getClass().getSimpleName();
    WLabel label = getTrigger().getLabel();
    if (label != null) {
        triggerName = label.getText();
    }
    return triggerName + "!=\"" + getValue() + "\"";
}
Also used : WLabel(com.github.bordertech.wcomponents.WLabel)

Example 37 with WLabel

use of com.github.bordertech.wcomponents.WLabel in project wcomponents by BorderTech.

the class Show method toString.

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
    String targetName = getTarget().getClass().getSimpleName();
    WLabel label = getTarget().getLabel();
    if (label != null) {
        targetName = label.getText();
    }
    return "show " + targetName;
}
Also used : WLabel(com.github.bordertech.wcomponents.WLabel)

Example 38 with WLabel

use of com.github.bordertech.wcomponents.WLabel in project wcomponents by BorderTech.

the class Action method toString.

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
    String targetName = target.getClass().getSimpleName();
    WLabel label = target.getLabel();
    if (label != null) {
        targetName = label.getText();
    }
    switch(type) {
        case DISABLE:
            return "disable " + targetName;
        case ENABLE:
            return "enable " + targetName;
        case HIDE:
            return "hide " + targetName;
        case MANDATORY:
            return "set " + targetName + " mandatory";
        case OPTIONAL:
            return "set " + targetName + " optional";
        case SHOW:
            return "show " + targetName;
        case SHOWIN:
            return "show " + targetName + " in " + group;
        case HIDEIN:
            return "hide " + targetName + " in " + group;
        case ENABLEIN:
            return "enable " + targetName + " in " + group;
        case DISABLEIN:
            return "disable " + targetName + " in " + group;
        default:
            throw new IllegalArgumentException("Unknown type: " + type);
    }
}
Also used : WLabel(com.github.bordertech.wcomponents.WLabel)

Example 39 with WLabel

use of com.github.bordertech.wcomponents.WLabel in project wcomponents by BorderTech.

the class AbstractFieldValidator method getMessageArguments.

/**
 * Sub classes should remember to call super.getMessageArguments() to ensure that the field label is added to the
 * list of arguments.
 *
 * @return The list of arguments to be applied to the validators error message.
 */
protected List<Serializable> getMessageArguments() {
    List<Serializable> args = new ArrayList<>(1);
    WLabel label = input.getLabel();
    if (label == null) {
        args.add("");
    } else {
        args.add(label.getText());
    }
    return args;
}
Also used : Serializable(java.io.Serializable) ArrayList(java.util.ArrayList) WLabel(com.github.bordertech.wcomponents.WLabel)

Example 40 with WLabel

use of com.github.bordertech.wcomponents.WLabel in project wcomponents by BorderTech.

the class WApplicationRenderer_Test method testRenderedFormatWithHiddenFields.

@Test
public void testRenderedFormatWithHiddenFields() throws XpathException, IOException, SAXException {
    MockWEnvironment environment = new MockWEnvironment();
    environment.setPostPath("WApplicationRendererTest.postPath");
    WApplication application = new WApplication();
    UIContext uic = createUIContext();
    uic.setEnvironment(environment);
    uic.setUI(application);
    setActiveContext(uic);
    WLabel label = new WLabel("dummy");
    application.add(label);
    Map<String, String> hiddenParameters = new HashMap<>();
    hiddenParameters.put("keyA", "valueA");
    hiddenParameters.put("keyB", "valueB");
    environment.setHiddenParameters(hiddenParameters);
    assertSchemaMatch(application);
    assertXpathEvaluatesTo(label.getText(), "normalize-space(//ui:application/ui:label)", application);
    assertXpathEvaluatesTo("valueA", "//ui:application/ui:param[@name='keyA']/@value", application);
    assertXpathEvaluatesTo("valueB", "//ui:application/ui:param[@name='keyB']/@value", application);
}
Also used : MockWEnvironment(com.github.bordertech.wcomponents.MockWEnvironment) WApplication(com.github.bordertech.wcomponents.WApplication) UIContext(com.github.bordertech.wcomponents.UIContext) HashMap(java.util.HashMap) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Aggregations

WLabel (com.github.bordertech.wcomponents.WLabel)99 Test (org.junit.Test)57 WHeading (com.github.bordertech.wcomponents.WHeading)13 WTextField (com.github.bordertech.wcomponents.WTextField)10 WButton (com.github.bordertech.wcomponents.WButton)9 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)9 WComponent (com.github.bordertech.wcomponents.WComponent)8 WRadioButtonSelect (com.github.bordertech.wcomponents.WRadioButtonSelect)8 WPanel (com.github.bordertech.wcomponents.WPanel)7 UIContext (com.github.bordertech.wcomponents.UIContext)6 WCheckBoxSelect (com.github.bordertech.wcomponents.WCheckBoxSelect)6 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)5 UIContextImpl (com.github.bordertech.wcomponents.UIContextImpl)5 WAjaxControl (com.github.bordertech.wcomponents.WAjaxControl)5 WComponentGroup (com.github.bordertech.wcomponents.WComponentGroup)5 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)5 Action (com.github.bordertech.wcomponents.Action)4 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)4 WApplication (com.github.bordertech.wcomponents.WApplication)4 WContainer (com.github.bordertech.wcomponents.WContainer)4