Search in sources :

Example 31 with Component

use of org.apache.wicket.Component in project gitblit by gitblit.

the class RepositoriesPage method setup.

private void setup(PageParameters params) {
    setupPage("", "");
    // check to see if we should display a login message
    boolean authenticateView = app().settings().getBoolean(Keys.web.authenticateViewPages, true);
    if (authenticateView && !GitBlitWebSession.get().isLoggedIn()) {
        String messageSource = app().settings().getString(Keys.web.loginMessage, "gitblit");
        String message = readMarkdown(messageSource, "login.mkd");
        Component repositoriesMessage = new Label("repositoriesMessage", message);
        add(repositoriesMessage.setEscapeModelStrings(false));
        add(new Label("repositoriesPanel"));
        return;
    }
    // Load the markdown welcome message
    String messageSource = app().settings().getString(Keys.web.repositoriesMessage, "gitblit");
    String message = readMarkdown(messageSource, "welcome.mkd");
    Component repositoriesMessage = new Label("repositoriesMessage", message).setEscapeModelStrings(false).setVisible(message.length() > 0);
    add(repositoriesMessage);
    // conditionally include personal repositories in this page
    List<RepositoryModel> repositories = getRepositories(params);
    if (!app().settings().getBoolean(Keys.web.includePersonalRepositories, true)) {
        Iterator<RepositoryModel> itr = repositories.iterator();
        while (itr.hasNext()) {
            RepositoryModel rm = itr.next();
            if (rm.isPersonalRepository()) {
                itr.remove();
            }
        }
    }
    RepositoriesPanel repositoriesPanel = new RepositoriesPanel("repositoriesPanel", showAdmin, true, repositories, true, getAccessRestrictions());
    // welcome message
    if (!showAdmin && !repositoriesMessage.isVisible()) {
        WicketUtils.setCssStyle(repositoriesPanel, "padding-top:5px;");
    }
    add(repositoriesPanel);
}
Also used : RepositoriesPanel(com.gitblit.wicket.panels.RepositoriesPanel) Label(org.apache.wicket.markup.html.basic.Label) RepositoryModel(com.gitblit.models.RepositoryModel) Component(org.apache.wicket.Component)

Example 32 with Component

use of org.apache.wicket.Component in project gitblit by gitblit.

the class LinkPanel method setNoFollow.

public void setNoFollow() {
    Component c = get("link");
    c.add(new SimpleAttributeModifier("rel", "nofollow"));
}
Also used : SimpleAttributeModifier(org.apache.wicket.behavior.SimpleAttributeModifier) Component(org.apache.wicket.Component)

Example 33 with Component

use of org.apache.wicket.Component in project gitblit by gitblit.

the class SimpleAjaxLink method setNoFollow.

public void setNoFollow() {
    Component c = get("link");
    c.add(new SimpleAttributeModifier("rel", "nofollow"));
}
Also used : SimpleAttributeModifier(org.apache.wicket.behavior.SimpleAttributeModifier) Component(org.apache.wicket.Component)

Example 34 with Component

use of org.apache.wicket.Component in project midpoint by Evolveum.

the class CheckBoxHeaderColumn method findCheckBoxColumnHeader.

public static CheckBoxPanel findCheckBoxColumnHeader(DataTable table) {
    WebMarkupContainer topToolbars = table.getTopToolbars();
    ComponentHierarchyIterator iterator = topToolbars.visitChildren(TableHeadersToolbar.class);
    if (!iterator.hasNext()) {
        return null;
    }
    TableHeadersToolbar toolbar = (TableHeadersToolbar) iterator.next();
    // simple attempt to find checkbox which is header for our column
    // todo: this search will fail if there are more checkbox header columns (which is not supported now,
    // because Selectable.F_SELECTED is hardcoded all over the place...
    iterator = toolbar.visitChildren(CheckBoxPanel.class);
    while (iterator.hasNext()) {
        Component c = iterator.next();
        if (!c.getOutputMarkupId()) {
            continue;
        }
        return (CheckBoxPanel) c;
    }
    return null;
}
Also used : ComponentHierarchyIterator(org.apache.wicket.util.iterator.ComponentHierarchyIterator) TableHeadersToolbar(com.evolveum.midpoint.web.component.data.TableHeadersToolbar) Component(org.apache.wicket.Component) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 35 with Component

use of org.apache.wicket.Component in project midpoint by Evolveum.

the class UploadDownloadPanel method uploadFilePerformed.

public void uploadFilePerformed(AjaxRequestTarget target) {
    Component input = get(ID_INPUT_FILE);
    try {
        FileUpload uploadedFile = getFileUpload();
        updateValue(uploadedFile.getBytes());
        LOGGER.trace("Upload file success.");
        input.success(getString("UploadPanel.message.uploadSuccess"));
    } catch (Exception e) {
        LOGGER.trace("Upload file error.", e);
        input.error(getString("UploadPanel.message.uploadError") + " " + e.getMessage());
    }
}
Also used : Component(org.apache.wicket.Component) FormComponent(org.apache.wicket.markup.html.form.FormComponent) FileUpload(org.apache.wicket.markup.html.form.upload.FileUpload)

Aggregations

Component (org.apache.wicket.Component)49 Label (org.apache.wicket.markup.html.basic.Label)16 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)13 FormComponent (org.apache.wicket.markup.html.form.FormComponent)13 ArrayList (java.util.ArrayList)10 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)9 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)7 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)5 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)4 Behavior (org.apache.wicket.behavior.Behavior)4 SimpleAttributeModifier (org.apache.wicket.behavior.SimpleAttributeModifier)4 ListView (org.apache.wicket.markup.html.list.ListView)4 Fragment (org.apache.wicket.markup.html.panel.Fragment)4 Item (org.apache.wicket.markup.repeater.Item)4 PropertyModel (org.apache.wicket.model.PropertyModel)4 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)3 DropDownChoicePanel (com.evolveum.midpoint.web.component.input.DropDownChoicePanel)3 RepositoryModel (com.gitblit.models.RepositoryModel)3 TextField (org.apache.wicket.markup.html.form.TextField)3