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

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

Introduction

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

Prototype

public Label(final String id, IModel<?> model) 

Source Link

Usage

From source file:$.BootstrapFeedbackPanel.java

License:Apache License

/**
     * Generates a component that is used to display the message inside the
     * feedback panel. This component must handle being attached to
     * <code>span</code> tags.
     * //from  www  .java2  s .  co  m
     * By default a {@link Label} is used.
     * 
     * Note that the created component is expected to respect feedback panel's
     * {@link #getEscapeModelStrings()} value
     * 
     * @param id
     *            parent id
     * @param message
     *            feedback message
     * @return component used to display the message
     */
    protected Component newMessageDisplayComponent(String id, FeedbackMessage message) {
        Serializable serializable = message.getMessage();
        Label label = new Label(id, (serializable == null) ? "" : serializable.toString());
        label.setEscapeModelStrings(BootstrapFeedbackPanel.this.getEscapeModelStrings());
        return label;
    }

From source file:$.HelloWidget.java

License:Apache License

public HelloWidget(String componentId, IModel<HelloWidgetStatus> statusModel) {
        super(componentId, statusModel);

        add(new Label("message", getConfig().getMessage()));

    }//from   w w w  .  j  a v a 2s.  com

From source file:$.HomePage.java

License:Apache License

public HomePage() {
        add(new Label("msg", "Hello World!"));
    }

From source file:abid.password.wicket.pages.LoginPage.java

License:Apache License

public LoginPage() {
    LoginPanel loginPanel = new LoginPanel("loginPanel");
    add(loginPanel);//from   www.  java2s  .c o m

    LoadableDetachableModel<List<User>> usersModel = new LoadableDetachableModel<List<User>>() {

        private static final long serialVersionUID = 1L;

        @Override
        protected List<User> load() {
            return userService.getUsers();
        }
    };

    PageableListView<User> dataList = new PageableListView<User>("usersList", usersModel, 100) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<User> item) {
            final User data = item.getModelObject();
            Label userLabel = new Label("userLabel", data.getUsername());
            Label passLabel = new Label("passLabel", data.getPassword());

            try {
                Password password = new MutablePasswordParser().parse(data.getPassword());
                if (password instanceof MutablePassword) {
                    MutablePassword mutablePassword = (MutablePassword) password;
                    String evalatedPassword = mutablePassword.getEvaluatedPassword();
                    passLabel = new Label("passLabel", evalatedPassword);
                }
            } catch (Exception e) {
                log.error("Could not create the mutable password", e);
            }

            item.add(userLabel);
            item.add(passLabel);
        }
    };

    int refreshTime = 3;
    final WebMarkupContainer usersContainer = new WebMarkupContainer("usersContainer");
    usersContainer.setOutputMarkupId(true);
    usersContainer.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(refreshTime)));
    usersContainer.add(dataList);

    String refreshInformation = String.format("Password refreshes every %s seconds.", refreshTime);
    String javascriptDisabledMsg = "Javascript is disabled you will need to refresh the page manually.";
    AjaxFallbackLabel refreshLabel = new AjaxFallbackLabel("refreshInformation", refreshInformation,
            javascriptDisabledMsg);

    add(usersContainer);
    add(refreshLabel);
}

From source file:abid.password.wicket.pages.UsersPage.java

License:Apache License

public UsersPage() {

    LoadableDetachableModel<List<User>> usersModel = new LoadableDetachableModel<List<User>>() {

        private static final long serialVersionUID = 1L;

        @Override//ww w. ja va  2 s.  c o  m
        protected List<User> load() {
            return userService.getUsers();
        }
    };

    PageableListView<User> dataList = new PageableListView<User>("usersList", usersModel, 100) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<User> item) {
            final User data = item.getModelObject();
            Label userLabel = new Label("userLabel", data.getUsername());
            Label passLabel = new Label("passLabel", data.getPassword());

            try {
                Password password = new MutablePasswordParser().parse(data.getPassword());
                if (password instanceof MutablePassword) {
                    MutablePassword mutablePassword = (MutablePassword) password;
                    String evalatedPassword = mutablePassword.getEvaluatedPassword();
                    passLabel = new Label("passLabel", evalatedPassword);
                }
            } catch (Exception e) {
                log.error("Could not create the mutable password", e);
            }

            item.add(userLabel);
            item.add(passLabel);
        }
    };

    int refreshTime = 3;
    final WebMarkupContainer dataContainer = new WebMarkupContainer("dataContainer");
    dataContainer.setOutputMarkupId(true);
    dataContainer.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(refreshTime)));
    dataContainer.add(dataList);

    String refreshInformation = String.format("Password refreshes every %s seconds.", refreshTime);
    String javascriptDisabledMsg = "Javascript is disabled you will need to refresh the page manually.";
    AjaxFallbackLabel refreshInfoLabel = new AjaxFallbackLabel("refreshInformation", refreshInformation,
            javascriptDisabledMsg);

    add(dataContainer);
    add(refreshInfoLabel);
}

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

License:Apache License

/**
 * Constructor./*www .j  ava 2  s .  co  m*/
 */
AbstractBasePage() {
    super();

    // http://apache-wicket.1842946.n4.nabble.com/wicket-message-in-the-title-td1843627.html
    add(new Label("pageTitle", new ResourceModel("catapult.title")));
    add(new BookmarkablePageLink<Void>("homeLink", IndexPage.class));
    add(new BookmarkablePageLink<Void>("adminLink", AdminPage.class));

    add(new LocaleDropDownPanel("localeSelectPanel", Arrays.asList(new Locale("es"), new Locale("de"),
            new Locale("en"), new Locale("fr"), new Locale("it"))));

    add(new Label("version", ((MainApplication) getApplication()).getVersion()));

    add(new Label("session", new PropertyModel<String>(this, "session.id")));
    add(new SearchPanel("searchPanel"));
    add(new Label("footertext", footerTextService.getText()));

    // Page 87, Wicket in Action
    add(new Label("clock", new Model<String>() {
        @Override
        public String getObject() {
            final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy | HH:mm:ss.mmm",
                    getSession().getLocale());

            return dateFormat.format(new Date());
        }
    }));
}

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

License:Apache License

/**
 * Constructor.//ww w .j a va  2s . 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:almira.sample.web.ListCatapultsPage.java

License:Apache License

/**
 * Constructor./*  w w w.java  2s. co m*/
 *
 * @param params
 *            the page parameters
 */
public ListCatapultsPage(PageParameters params) {
    super();
    StringValue query = params.get("searchString");
    add(new Label("term", getTermLabelModel(query.toString(""))));
    SearchResultPanel panel = new SearchResultPanel("catapults", query.toString());
    add(panel);
}

From source file:an.dpr.manteniket.components.BootstrapNavigationToolbar.java

License:Apache License

/**
 * Factory method used to create the navigator label that will be used by
 * the datatable/*from w  w w . j av a 2 s.  com*/
 * 
 * @param navigatorId
 *            component id navigator label should be created with
 * @param table
 *            dataview used by datatable
 * @return navigator label that will be used to navigate the data table
 * 
 */
protected WebComponent newNavigatorLabel(final String navigatorId, final DataTable<?, ?> table) {
    return new Label(navigatorId, Model.of(""));
}

From source file:ar.com.nybble.futbol.view.TemplatePage.java

License:Apache License

/**
 * Constructor//from   w  w w  . j a  v a2s  .co  m
 */
public TemplatePage() {
    add(new Label("title", new PropertyModel<String>(this, "pageTitle")));
    tree = new LinkTree("tree", createTreeModel()) {
        @Override
        protected void onNodeLinkClicked(Object node, BaseTree tree, AjaxRequestTarget target) {
            super.onNodeLinkClicked(node, tree, target);
            ModelBean clase = (ModelBean) ((DefaultMutableTreeNode) node).getUserObject();
            if (clase.isLinkiable()) {
                setResponsePage(((Class) clase.getContent()));
            } else
                tree.getTreeState().expandNode(node);
        }
    };

    add(tree);
    tree.getTreeState().collapseAll();

    add(new AjaxLink("expandAll") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            getTree().getTreeState().expandAll();
            getTree().updateTree(target);
        }
    });

    add(new AjaxLink("collapseAll") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            getTree().getTreeState().collapseAll();
            getTree().updateTree(target);
        }
    });

}