Example usage for org.apache.wicket.ajax.markup.html AjaxLink AjaxLink

List of usage examples for org.apache.wicket.ajax.markup.html AjaxLink AjaxLink

Introduction

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

Prototype

public AjaxLink(final String id) 

Source Link

Document

Construct.

Usage

From source file:com.userweave.pages.base.BaseUserWeavePage.java

License:Open Source License

/**
 * Adds the imprint and contacts link to the footer part
 * of this page./*  w w w.  ja va  2 s.  co  m*/
 */
protected void addFooterComponents() {
    add(new BookmarkablePageLink<Void>("imprint", ImprintPage.class));

    // Worflow: see #1275
    if (UserWeaveSession.get().isAuthenticated()) {
        final ModalWindow window = createContactModalWindow();

        add(window);

        add(new AjaxLink<Void>("contact") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClick(AjaxRequestTarget target) {
                window.show(target);
            }
        });
    } else {
        add(new ExternalLink("contact", "mailto:" + "info@userweave.net"));

        add(new WebMarkupContainer("contactModal"));
    }
}

From source file:com.userweave.pages.components.button.AddLink.java

License:Open Source License

/**
 * Initializes this panel with a link.// w  w w .j a v  a 2s .co  m
 * 
 * @param labelModel
 *       StringResourceModel for the label.
 */
private void initLink(StringResourceModel labelModel) {
    AjaxLink link = new AjaxLink("add") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            AddLink.this.onClick(target);
        }
    };

    add(link);

    link.add(new Label("message", labelModel));
}

From source file:com.userweave.pages.components.reorderable.AddButton.java

License:Open Source License

private void init(IModel buttonTextModel) {
    add(new AjaxLink("add") {
        @Override//from   w w w.  ja  v a 2 s. c  o m
        public void onClick(AjaxRequestTarget target) {
            onAdd(target);
        }
    }.add(new Label("text", buttonTextModel)));
}

From source file:com.userweave.pages.components.servicePanel.ServicePanel.java

License:Open Source License

public ServicePanel(String id, ServicePanelType serviceTextResource) {
    super(id);//  w w w  .j av  a2s.co m

    final StringResourceModel srm = new StringResourceModel(serviceTextResource.toString(), this, null);

    final StringResourceModel srm_link = new StringResourceModel(serviceTextResource.toString() + "_link_text",
            this, null);

    add(new Label("servicePanelHeadline",
            new StringResourceModel(serviceTextResource.toString() + "_headline", this, null)));

    add(new Label("serviceText", srm));

    add(new AjaxLink("more") {

        @Override
        public void onClick(AjaxRequestTarget target) {
            modalWindow.show(target);

        }
    }.add(new Label("more_label",
            new StringResourceModel(serviceTextResource.toString() + "_link_text", this, null))));

    add(modalWindow = new CustomModalWindow("showMoreModalWindow"));

    modalWindow.setPageCreator(new ModalWindow.PageCreator() {
        public Page createPage() {
            return new ServicePanelPopupPage(modalWindow, srm, srm_link);
        };
    });

    //      modalWindow.setCssClassName(CustomModalWindow.CSS_CLASS_MINT);
    modalWindow.setInitialHeight(570);
    modalWindow.setInitialWidth(580);
}

From source file:com.userweave.pages.components.slidableajaxtabpanel.SlidableAjaxTabbedPanel.java

License:Open Source License

/**
 * Add the slidable functionality.//from w  w  w . j a  v a 2 s .  com
 */
private void createAndAddSliders() {
    AjaxLink left = new AjaxLink("slide_left") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            shiftLeft(null);

            target.addComponent(SlidableAjaxTabbedPanel.this);
        }

        @Override
        public boolean isVisible() {
            return leftIndex > 0;
        }

    };

    AjaxLink right = new AjaxLink("slide_right") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            shiftRight(null);

            target.addComponent(SlidableAjaxTabbedPanel.this);

        }

        @Override
        public boolean isVisible() {
            return leftIndex + displaySize < tabs.size();
        }
    };

    add(left);
    add(right);
}

From source file:com.userweave.pages.components.slidableajaxtabpanel.StudiesSlidableAjaxTabbedPanel.java

License:Open Source License

/**
 * Creates an ajax link to show an/*from  www.  java 2s.  c o m*/
 * extra tab independent from the
 * tabbed panel to display configuration.
 * 
 * @return
 */
protected AjaxLink getConfigLink() {
    AjaxLink link = new AjaxLink(CONFIG_TAB_ID) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            if (StudiesSlidableAjaxTabbedPanel.this.get(TAB_PANEL_ID) == null) {
                StudiesSlidableAjaxTabbedPanel.this.add(getConfigTabPanel(TAB_PANEL_ID));
            } else {
                StudiesSlidableAjaxTabbedPanel.this.replace(getConfigTabPanel(TAB_PANEL_ID));
            }

            isTabPanelActive = false;

            this.add(configTabSelected);

            target.addComponent(this);
            target.addComponent(StudiesSlidableAjaxTabbedPanel.this);

            target.appendJavaScript(getTriggerScripts());
        }
    };

    link.add(new Label("configTabLabel",
            new StringResourceModel("config_label", StudiesSlidableAjaxTabbedPanel.this, null)));

    link.setOutputMarkupId(true);

    return link;
}

From source file:com.userweave.pages.components.slidableajaxtabpanel.StudiesSlidableAjaxTabbedPanel.java

License:Open Source License

/**
 * Creates an ajax link to show an/*from w  w w  . j a va2s .co  m*/
 * extra tab independent from the
 * tabbed panel to display results.
 * 
 * @return
 */
protected AjaxLink getResultLink() {
    AjaxLink link = new AjaxLink(CONFIG_TAB_ID) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            displayResultTab();

            target.addComponent(this);
            target.addComponent(StudiesSlidableAjaxTabbedPanel.this);

            target.appendJavaScript(getTriggerScripts());
        }
    };

    link.add(new Label("configTabLabel",
            new StringResourceModel("result_label", StudiesSlidableAjaxTabbedPanel.this, null)));

    return link;
}

From source file:com.userweave.pages.components.studypanel.FilterActionPanel.java

License:Open Source License

public FilterActionPanel(String id, final Integer studyId) {
    super(id);/*from  w w w .  j av a 2  s  . c  o m*/

    final CustomModalWindow filterOverviewModal = new CustomModalWindow("filterOverviewModal");

    add(new AjaxLink("filterOverview") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            filterOverviewModal.show(target);
        }

    });

    add(filterOverviewModal);

    filterOverviewModal.setPageCreator(new ModalWindow.PageCreator() {
        @Override
        public Page createPage() {
            return new FilterOverviewPage(filterOverviewModal, studyId);
        }
    });

    filterOverviewModal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
        @Override
        public void onClose(AjaxRequestTarget target) {
            onWindowClose(target);

            //            groupFilterList.triggerModelChangeOfChoices();
            //            target.addComponent(groupFilterList);
        }
    });
}

From source file:com.userweave.pages.configuration.base.NavigationLink.java

License:Open Source License

public NavigationLink(String id, IModel header, IModel name) {
    super(id);/*from   www.jav a2s  .c o  m*/
    add(new RoundedBorderGray("roundedBorderModule")
            .add(new NavigationBorder("navigationBorder", header, NavigationBorder.Color.Gray)
                    .add(new AjaxLink("link") {

                        @Override
                        public void onClick(AjaxRequestTarget target) {
                            NavigationLink.this.onClick(target);
                        }

                    }.add(new Label("name", shortenModelString(name)))
                            .add(new AttributeModifier("title", true, name)))));
}

From source file:com.userweave.pages.configuration.editentitypanel.CopyEntityPanel.java

License:Open Source License

/**
 * Default constructor.//from  w w  w .  java  2s.c o m
 * 
 * @param id
 *       Component id.
 * @param entity
 *       Entity to copy.
 * @param callback
 *       Callback to fire on event.
 */
public CopyEntityPanel(String id, IModel<T> entityModel, EventHandler callback) {
    super(id, entityModel, callback);

    add(copyModal = getCopyModal(callback));

    AjaxLink<Void> copy = new AjaxLink<Void>("copy") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            copyModal.show(target);
        }
    };

    add(copy);
}