Search in sources :

Example 71 with WLabel

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

the class WLabelRenderer method doRender.

/**
 * Paints the given {@link WLabel}.
 *
 * @param component the WLabel to paint.
 * @param renderContext the RenderContext to paint to.
 */
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
    WLabel label = (WLabel) component;
    XmlStringBuilder xml = renderContext.getWriter();
    xml.appendTagOpen("ui:label");
    xml.appendAttribute("id", component.getId());
    xml.appendOptionalAttribute("class", component.getHtmlClass());
    xml.appendOptionalAttribute("track", component.isTracking(), "true");
    xml.appendOptionalAttribute("for", label.getLabelFor());
    WComponent what = label.getForComponent();
    String whatFor = null;
    if (what instanceof MultiInputComponent) {
        whatFor = "group";
    } else if (what instanceof Labelable) {
        whatFor = "input";
    }
    boolean isReadOnly = ((what instanceof Input) && ((Input) what).isReadOnly()) || (what instanceof WRadioButton && ((WRadioButton) what).isReadOnly());
    boolean isMandatory = (what instanceof Input) && ((Input) what).isMandatory();
    xml.appendOptionalAttribute("what", whatFor);
    xml.appendOptionalAttribute("readonly", isReadOnly, "true");
    xml.appendOptionalAttribute("required", isMandatory, "true");
    xml.appendOptionalAttribute("hiddencomponent", (what != null && what.isHidden()), "true");
    xml.appendOptionalAttribute("hint", label.getHint());
    xml.appendOptionalAttribute("accessKey", Util.upperCase(label.getAccessKeyAsString()));
    xml.appendOptionalAttribute("hidden", label.isHidden(), "true");
    xml.appendOptionalAttribute("toolTip", label.getToolTip());
    xml.appendOptionalAttribute("accessibleText", label.getAccessibleText());
    xml.appendClose();
    xml.append(label.getText(), label.isEncodeText());
    paintChildren(label, renderContext);
    xml.appendEndTag("ui:label");
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) Labelable(com.github.bordertech.wcomponents.Labelable) MultiInputComponent(com.github.bordertech.wcomponents.MultiInputComponent) Input(com.github.bordertech.wcomponents.Input) WRadioButton(com.github.bordertech.wcomponents.WRadioButton) XmlStringBuilder(com.github.bordertech.wcomponents.XmlStringBuilder) WLabel(com.github.bordertech.wcomponents.WLabel)

Example 72 with WLabel

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

the class EnableInGroup method toString.

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

Example 73 with WLabel

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

the class GreaterThan 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 74 with WLabel

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

the class GreaterThanOrEqual 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 75 with WLabel

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

the class Hide method toString.

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

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