Example usage for org.apache.wicket Component add

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

Introduction

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

Prototype

public Component add(final Behavior... behaviors) 

Source Link

Document

Adds a behavior modifier to the component.

Usage

From source file:com.evolveum.midpoint.web.page.admin.configuration.PageImportObject.java

License:Apache License

private void addVisibileForInputType(Component comp, final Integer type, final IModel<Integer> groupModel) {
    comp.add(new VisibleEnableBehaviour() {

        @Override//from  w  w  w .j  a va  2s  .  com
        public boolean isVisible() {
            return type.equals(groupModel.getObject());
        }

    });
}

From source file:com.evolveum.midpoint.web.page.admin.home.component.AsyncDashboardPanel.java

License:Apache License

public AsyncDashboardPanel(String id, IModel<String> title, String icon, IModel<V> callableParameterModel,
        Duration durationSecs, DashboardColor color) {
    super(id, callableParameterModel, durationSecs);

    WebMarkupContainer dashboardTitle = (WebMarkupContainer) get(
            createComponentPath(ID_DASHBOARD_PARENT, ID_DASHBOARD_TITLE));

    Label label = (Label) dashboardTitle.get(ID_TITLE);
    label.setDefaultModel(title);//from w w  w .  ja  va2s  . co  m

    if (color == null) {
        color = DashboardColor.GRAY;
    }
    Component dashboardParent = get(ID_DASHBOARD_PARENT);
    dashboardParent.add(new AttributeAppender("class", " " + color.getCssClass()));

    WebMarkupContainer iconI = new WebMarkupContainer(ID_ICON);
    iconI.add(AttributeModifier.replace("class", icon));
    dashboardTitle.add(iconI);
}

From source file:com.evolveum.midpoint.web.page.admin.home.component.DashboardPanel.java

License:Apache License

public DashboardPanel(String id, IModel<T> model, IModel<String> title, String icon, DashboardColor color) {
    super(id, model);

    WebMarkupContainer dashboardTitle = (WebMarkupContainer) get(
            createComponentPath(ID_DASHBOARD_PARENT, ID_DASHBOARD_TITLE));

    Label label = (Label) dashboardTitle.get(ID_TITLE);
    label.setDefaultModel(title);//www  .  j a  va 2s  .c o  m

    if (color == null) {
        color = DashboardColor.GRAY;
    }
    Component dashboardParent = get(ID_DASHBOARD_PARENT);
    dashboardParent.add(new AttributeAppender("class", " " + color.getCssClass()));

    WebMarkupContainer iconI = new WebMarkupContainer(ID_ICON);
    iconI.add(AttributeModifier.replace("class", icon));
    dashboardTitle.add(iconI);
}

From source file:com.evolveum.midpoint.web.page.admin.resources.component.TestConnectionResultPanel.java

License:Apache License

public void setFocusOnComponent(Component component, AjaxRequestTarget target) {
    if (component == null) {
        return;//from  w  w w  .  j ava2  s .c o m
    }
    initOnFocusBehavior();
    component.add(onFocusBehavior);
    target.focusComponent(component);
}

From source file:com.evolveum.midpoint.web.util.InfoTooltipBehavior.java

License:Apache License

@Override
public void onConfigure(Component component) {
    super.onConfigure(component);

    component.add(AttributeModifier.replace("class", "fa fa-fw fa-info-circle text-info"));
}

From source file:com.evolveum.midpoint.web.util.SchrodingerComponentInitListener.java

License:Apache License

private void writeDataAttribute(Component component, String key, String value) {
    if (!component.getRenderBodyOnly()) {
        component.add(AttributeModifier.append(ATTR_DATA_PREFIX + key, value));
        return;//from w ww. ja  v  a 2  s  . c  o  m
    }

    if ("title".equals(component.getId()) && component.getParent() instanceof Page) {
        // we don't want to alter <title> element
        return;
    }

    component.add(new Behavior() {

        @Override
        public void afterRender(Component component) {
            Response resp = component.getResponse();
            resp.write("<schrodinger " + ATTR_DATA_PREFIX + key + "=\"" + value + "\"></schrodinger>");
        }
    });
}

From source file:com.evolveum.midpoint.web.util.TooltipBehavior.java

License:Apache License

@Override
public void onConfigure(final Component component) {
    component.setOutputMarkupId(true);// w  w w .j  a v  a 2s .c  o  m

    component.add(AttributeModifier.replace("data-toggle", "tooltip"));
    component.add(new AttributeModifier("data-placement", "right") {

        @Override
        protected String newValue(String currentValue, String replacementValue) {
            if (StringUtils.isEmpty(currentValue)) {
                return replacementValue;
            }
            return currentValue;
        }
    });
}

From source file:com.francetelecom.clara.cloud.presentation.applications.ApplicationCreatePanel.java

License:Apache License

@Override
protected void onInitialize() {
    parentPage = (ApplicationsPage) getPage();
    initComponents();/*from  w w w  . j  a  v  a2 s  .c o  m*/
    appForm.visitChildren(FormComponent.class, new IVisitor<Component, Void>() {
        @Override
        public void component(Component object, IVisit<Void> visit) {
            object.add(new FieldFeedbackDecorator());
            visit.dontGoDeeper();
        }
    });
    super.onInitialize();
}

From source file:com.francetelecom.clara.cloud.presentation.applications.ApplicationInformationPanel.java

License:Apache License

@Override
protected void onInitialize() {
    appForm.visitChildren(FormComponent.class, new IVisitor<Component, Void>() {
        @Override//from   ww  w .  j  a  v  a  2s.co m
        public void component(Component object, IVisit<Void> visit) {
            object.add(new FieldFeedbackDecorator());
            visit.dontGoDeeper();
        }
    });
    super.onInitialize();
}

From source file:com.francetelecom.clara.cloud.presentation.designer.services.LogicalServiceBasePanel.java

License:Apache License

@Override
protected void onInitialize() {
    serviceForm.visitChildren(FormComponent.class, new IVisitor<Component, Void>() {
        @Override/* w  w w. ja  v  a 2 s .c  o m*/
        public void component(Component component, IVisit<Void> visit) {
            component.add(new FieldFeedbackDecorator());

            if (!component.equals(addUpdateButton) && !component.equals(cancelCloseButton)) {

                boolean serviceParameterEnable = true;

                if (parentPage instanceof DesignerPage) {
                    serviceParameterEnable = ((DesignerPage) parentPage)
                            .isServiceParameterEnable(serviceForm.getModelObject(), component.getId());
                }

                if (!serviceParameterEnable) {
                    component.setEnabled(false);
                }

            }

            // To disable all field except close button in readOnly mode
            if (readOnly) {
                if (!component.equals(cancelCloseButton)) {
                    component.setEnabled(false);
                }
            }
            // overridable components are re-enabled in subclasses, validation button here
            if (configOverride) {
                addUpdateButton.setEnabled(true);
            }

            visit.dontGoDeeper();
        }

    });

    super.onInitialize();

}