Example usage for org.apache.wicket.markup.html.basic Label setDefaultModel

List of usage examples for org.apache.wicket.markup.html.basic Label setDefaultModel

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.basic Label setDefaultModel.

Prototype

public Component setDefaultModel(final IModel<?> model) 

Source Link

Document

Sets the given model.

Usage

From source file:almira.sample.web.AdminPage.java

License:Apache License

/**
 * Constructor.//from   w  w w  .  j  ava 2 s.  c om
 */
public AdminPage() {
    super();

    final Label counterLabel = new Label(COUNTER_LABEL_ID, "0");
    add(counterLabel);

    final Label feedbackLabel = new Label(FEEDBACK_LABEL_ID);
    add(feedbackLabel);

    add(new Link<String>("increment_counter_link") {
        @Override
        public void onClick() {
            final Session session = AdminPage.this.getSession();
            int counterValue = 0;
            synchronized (session) {
                AtomicInteger counter = (AtomicInteger) session.getAttribute(COUNTER_LABEL_ID);
                if (counter == null) {
                    counter = new AtomicInteger();
                }
                counterValue = counter.incrementAndGet();
                // trigger replication to other cluster nodes
                session.setAttribute(COUNTER_LABEL_ID, counter);
            }
            counterLabel.setDefaultModel(new Model<Integer>(counterValue));
            LOG.fine("*** Catapult counter value=" + counterValue + " ***");
            feedbackLabel.setDefaultModel(new Model<String>());
        }
    });

    add(new Link<String>("rebuild_index") {
        @Override
        public void onClick() {
            try {
                indexService.rebuildIndex();
                feedbackLabel.setDefaultModel(new Model<String>("Rebuilding index."));
            } catch (Exception e) {
                feedbackLabel.setDefaultModel(new Model<String>("Error rebuilding index!"));
                LOG.log(Level.SEVERE, "Error rebuilding", e);
            }
        }
    });
}

From source file:com.evolveum.midpoint.web.component.dialog.ConfirmationDialog.java

License:Apache License

public void setMessage(IModel<String> message) {
    Label label = (Label) getContent().get(ID_CONFIRM_TEXT);
    label.setDefaultModel(message);
}

From source file:com.evolveum.midpoint.web.component.dialog.ConfirmationPanel.java

License:Apache License

public void setMessage(IModel<String> message) {
    Label label = (Label) get(ID_PANEL).get(ID_CONFIRM_TEXT);
    label.setDefaultModel(message);
}

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);

    if (color == null) {
        color = DashboardColor.GRAY;/* ww  w  . ja  v  a  2s.  c om*/
    }
    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);

    if (color == null) {
        color = DashboardColor.GRAY;//from   w  w  w  .ja v  a2  s.c om
    }
    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.francetelecom.clara.cloud.presentation.designer.services.cfjavaprocessing.LogicalCfJavaProcessingServicePanel.java

License:Apache License

private void setDefaultIconAndUpdateFeedBack(WebMarkupContainer image, Label feedback,
        String detailedErrorMessage) {
    image.add(new AttributeModifier("style", new Model<String>(
            "background-image:url(\"../../../../../images/designer/cloudfoundry-icon.png\"); background-repeat:no-repeat; background-position:5px 5px")));
    if (feedback != null) {
        feedback.setDefaultModel(
                new StringResourceModel("portal.designer.service.cfjava.iconUrl.preview.text.ko", null,
                        new Object[] { detailedErrorMessage }));
    }//from w w w  . j  a  va 2 s  .  c o m
}

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

License:Apache License

private void setDefaultIconAndUpdateFeedBack(WebMarkupContainer image, Label feedback,
        String detailedErrorMessage) {
    image.add(new AttributeModifier("style", new Model<String>(
            "background-image:url(\"../../../../../images/designer/jee-processing-icon.png\"); background-repeat:no-repeat; background-position:5px 5px")));
    if (feedback != null) {
        feedback.setDefaultModel(new StringResourceModel("portal.designer.service.jee.iconUrl.preview.text.ko",
                null, new Object[] { detailedErrorMessage }));
    }/*  ww w  .  j a v  a  2 s  .  com*/
}

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

License:Apache License

protected void setDefaultIconAndUpdateFeedBack(WebMarkupContainer image, Label feedback,
        String detailedErrorMessage) {
    image.add(new AttributeModifier("style", new Model<String>(
            "background-image:url(\"../../../../../images/designer/jee-processing-icon.png\"); background-repeat:no-repeat; background-position:5px 5px")));
    if (feedback != null) {
        feedback.setDefaultModel(
                new StringResourceModel("portal.designer.service.cfjava.iconUrl.preview.text.ko", null,
                        new Object[] { detailedErrorMessage }));
    }//  w  w w  .  java 2  s  .c  o m
}

From source file:com.googlecode.wicket.jquery.ui.form.slider.AbstractSlider.java

License:Apache License

/**
 * Constructor//  www  .j ava2 s.  c  o  m
 * @param id the markup id
 * @param model the {@link IModel}
 * @param label {@link Label} on which the current slide value will be displayed
 */
public AbstractSlider(String id, IModel<T> model, Label label) {
    super(id, model);

    label.setDefaultModel(model);
    label.setOutputMarkupId(true);
    this.setLabelId(label.getMarkupId());
}

From source file:com.koodaripalvelut.common.wicket.webtest.openid.InfoPage.java

License:Open Source License

public InfoPage() {
    add(new AjaxLazyLoadPanel(SIGNIN_PANEL_ID) {

        private static final long serialVersionUID = 1L;

        @Override//  w  w  w. j  a va  2  s.c om
        public Component getLazyLoadComponent(final String markupId) {
            return new OpenIDPanel(markupId);
        }

        @Override
        public Component getLoadingComponent(final String markupId) {
            final Label label = (Label) super.getLoadingComponent(markupId);
            final StringBuilder sb = new StringBuilder(label.getDefaultModelObjectAsString());
            sb.append("<div>");
            sb.append(InfoPage.this.getString("loadingMesssage"));
            sb.append("</div>");
            label.setDefaultModel(Model.of(sb.toString()));
            return label;
        }
    });
}