Search in sources :

Example 1 with ImageResource

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

the class ExampleSection method buildUI.

/**
 * Add the controls to the section in the right order.
 */
private void buildUI() {
    add(messages);
    add(tabset);
    // add(new AccessibilityWarningContainer());
    container.add(new WText("Select an example from the menu"));
    // Set a static ID on container and it becomes a de-facto naming context.
    container.setIdName("eg");
    tabset.addTab(container, "(no selection)", WTabSet.TAB_MODE_CLIENT);
    WImage srcImage = new WImage(new ImageResource("/image/text-x-source.png", "View Source"));
    srcImage.setCacheKey("srcTabImage");
    tabset.addTab(source, new WDecoratedLabel(srcImage), WTabSet.TAB_MODE_LAZY).setToolTip("View Source");
    // The refresh current view button.
    WButton refreshButton = new WButton("\u200b");
    refreshButton.setToolTip("Refresh");
    refreshButton.setHtmlClass(HtmlIconUtil.getIconClasses("fa-refresh"));
    // refreshButton.setImage("/image/refresh-w.png");
    refreshButton.setRenderAsLink(true);
    refreshButton.setAction(new ValidatingAction(messages.getValidationErrors(), refreshButton) {

        @Override
        public void executeOnValid(final ActionEvent event) {
        // Do Nothing
        }
    });
    // The reset example button.
    final WButton resetButton = new WButton("\u200b");
    resetButton.setToolTip("Reset");
    resetButton.setHtmlClass(HtmlIconUtil.getIconClasses("fa-times-circle"));
    // resetButton.setImage("/image/cancel-w.png");
    resetButton.setRenderAsLink(true);
    resetButton.setAction(new ValidatingAction(messages.getValidationErrors(), resetButton) {

        @Override
        public void executeOnValid(final ActionEvent event) {
            resetExample();
        }
    });
    addToTail(refreshButton);
    addToTail(new WText("\u2002"));
    addToTail(resetButton);
}
Also used : ImageResource(com.github.bordertech.wcomponents.ImageResource) WText(com.github.bordertech.wcomponents.WText) ValidatingAction(com.github.bordertech.wcomponents.validation.ValidatingAction) ActionEvent(com.github.bordertech.wcomponents.ActionEvent) WImage(com.github.bordertech.wcomponents.WImage) WButton(com.github.bordertech.wcomponents.WButton) WDecoratedLabel(com.github.bordertech.wcomponents.WDecoratedLabel)

Aggregations

ActionEvent (com.github.bordertech.wcomponents.ActionEvent)1 ImageResource (com.github.bordertech.wcomponents.ImageResource)1 WButton (com.github.bordertech.wcomponents.WButton)1 WDecoratedLabel (com.github.bordertech.wcomponents.WDecoratedLabel)1 WImage (com.github.bordertech.wcomponents.WImage)1 WText (com.github.bordertech.wcomponents.WText)1 ValidatingAction (com.github.bordertech.wcomponents.validation.ValidatingAction)1