Example usage for org.apache.wicket Component setVisible

List of usage examples for org.apache.wicket Component setVisible

Introduction

In this page you can find the example usage for org.apache.wicket Component setVisible.

Prototype

public final Component setVisible(final boolean visible) 

Source Link

Document

Sets whether this component and any children are visible.

Usage

From source file:org.wicketstuff.minis.behavior.HideWhenEmptyOrNullBehavior.java

License:Apache License

@Override
public void onConfigure(final Component component) {
    super.onConfigure(component);
    Object dependentValue = component.getDefaultModelObject();
    boolean visible;
    if (dependentValue instanceof Collection) {
        final Collection<?> c = (Collection<?>) dependentValue;
        visible = !c.isEmpty();//from   ww  w .j  a  v a2  s .com
    } else if (dependentValue instanceof CharSequence) {
        visible = !Strings.isEmpty((CharSequence) dependentValue);
    } else {
        visible = dependentValue != null;
    }
    component.setVisible(visible);
}

From source file:org.wicketstuff.minis.behavior.VisibleModelBehavior.java

License:Apache License

@Override
public void onConfigure(final Component component) {
    super.onConfigure(component);
    Boolean visible = getDependentModel().getObject();
    component.setVisible(visible != null && visible);
}

From source file:org.xaloon.wicket.component.navigation.DecoratedPagingNavigator.java

License:Apache License

private void refreshLastNextComponents(WebMarkupContainer currentNavigator, Form<Void> form, long currentPage,
        long pageCount) {
    Component nextPage = currentNavigator.get("next");
    if (nextPage != null) {
        currentNavigator.remove("next");
        form.add(nextPage);/*from w  ww .ja  va 2 s .  c  o m*/
    }
    Component lastPage = currentNavigator.get("last");
    if (lastPage != null) {
        currentNavigator.remove("last");
        form.add(lastPage);
    }
    if ((nextPage != null) && (lastPage != null)) {
        if (pageCount == 0 || currentPage == pageCount - 1) {
            nextPage.setVisible(false);
            lastPage.setVisible(false);
        } else {
            nextPage.setVisible(true);
            lastPage.setVisible(true);
        }
    }
}

From source file:org.xaloon.wicket.component.navigation.DecoratedPagingNavigator.java

License:Apache License

private void refreshFirstPreviousComponents(WebMarkupContainer currentNavigator, Form<Void> form,
        long currentPage) {
    Component previousPage = currentNavigator.get("prev");
    if (previousPage != null) {
        currentNavigator.remove("prev");
        form.add(previousPage);/*from   w w  w .  j  av  a 2 s  .  c  om*/
    }

    Component firstPage = currentNavigator.get("first");
    if (firstPage != null) {
        currentNavigator.remove("first");
        form.add(firstPage);
    }
    if ((previousPage != null) && (firstPage != null)) {
        if (currentPage == 0) {
            previousPage.setVisible(false);
            firstPage.setVisible(false);
        } else {
            previousPage.setVisible(true);
            firstPage.setVisible(true);
        }
    }
}

From source file:ro.nextreports.server.web.core.search.SearchEntityPanel.java

License:Apache License

private void makeSearchComponentVisible(Component component, boolean isRowLabel) {
    component.setVisible(true);
    if (isRowLabel) {
        component.add(AttributeModifier.replace("class", "row-label row-bottom"));
    } else {/*from  w ww.j a  va  2  s.  co m*/
        component.add(AttributeModifier.replace("class", "row-bottom"));
    }
}

From source file:ro.nextreports.server.web.dashboard.WidgetPanel.java

License:Apache License

private void addWidgetView(boolean isCollapsed) {
    Component component;
    if (isCollapsed) {
        component = new EmptyPanel("content");
        component.setVisible(false);
    } else {//ww w. ja v  a 2s .c  om
        try {
            widgetView = getWidget().createView("content", false);

            // set a special class for min-height depending on widget type
            String cssClass = null;
            if (getWidget() instanceof AlarmWidget) {
                cssClass = "dragbox-content-alarm";
            } else if (getWidget() instanceof IndicatorWidget) {
                cssClass = "dragbox-content-indicator";
            } else if (getWidget() instanceof DisplayWidget) {
                cssClass = "dragbox-content-display";
            } else if (getWidget() instanceof ChartWidget) {
                cssClass = "dragbox-content-chart";
            } else if (getWidget() instanceof DrillDownWidget) {
                // see also DrillDownWidgetView where we have to remove this cssClass when we drill-down
                // and add it again when we drill-up to first Chart
                Entity entity = ((DrillDownWidget) getWidget()).getEntity();
                if (entity instanceof Chart) {
                    cssClass = "dragbox-content-chart";
                }
            }
            if (cssClass != null) {
                widgetView.add(AttributeAppender.append("class", cssClass));
            }
        } catch (Throwable e) {
            LOG.error(e.getMessage(), e);
            widgetView = new WidgetErrorView("content", getModel(), e);
        }
        component = widgetView;
    }

    addOrReplace(component);
}