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.ttdev.wicketpagetest.sample.spring.PageRefreshingTR.java

License:Open Source License

public PageRefreshingTR() {
    values = Arrays.asList(new Integer[] { 0, 0, 0 });
    ListView<Integer> eachRow = new ListView<Integer>("eachRow", values) {

        private static final long serialVersionUID = 1L;

        @Override/*from  ww  w .j  ava 2  s .  c  o m*/
        protected void populateItem(final ListItem<Integer> item) {
            item.setOutputMarkupId(true);
            item.add(new Label("count", new AbstractReadOnlyModel<Integer>() {

                private static final long serialVersionUID = 1L;

                @Override
                public Integer getObject() {
                    return getRowCount(item);
                }

            }));
            item.add(new Label("sum", new AbstractReadOnlyModel<Integer>() {

                private static final long serialVersionUID = 1L;

                @Override
                public Integer getObject() {
                    Integer c = getRowCount(item);
                    int sum = 0;
                    for (int i = 0; i <= c; i++) {
                        sum += i;
                    }
                    return sum;
                }
            }));
            item.add(new AjaxLink<Void>("inc") {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    values.set(item.getIndex(), getRowCount(item) + 1);
                    target.add(item);
                }
            });
        }
    };
    add(eachRow);
}

From source file:com.tysanclan.site.projectewok.components.CalendarPanelNavigator.java

License:Open Source License

public CalendarPanelNavigator(String id, CalendarPanel panel) {
    super(id);//from   w w  w  . j a  va  2s . com
    this.panel = panel;

    selectedDate = DateUtil.getMidnightDate(panel.getCalendar().getTime());

    add(createMonthLabel(selectedDate));

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

        @Override
        public void onClick(AjaxRequestTarget target) {
            Calendar cal = DateUtil.getCalendarInstance();
            cal.setTime(getSelectedDate());
            cal.add(Calendar.MONTH, -1);
            replacePanel(target, cal.getTime());
        }

    });

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

        @Override
        public void onClick(AjaxRequestTarget target) {
            Calendar cal = DateUtil.getCalendarInstance();
            cal.setTime(getSelectedDate());
            cal.add(Calendar.MONTH, 1);
            replacePanel(target, cal.getTime());
        }

    });

}

From source file:com.tysanclan.site.projectewok.TysanPage.java

License:Open Source License

public TysanPage(String title, IModel<?> model) {
    super(model);

    notificationWindow = new Dialog("notificationWindow");
    notificationWindow.setTitle("Urgent Message");
    notificationWindow.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true);

    notificationWindow.add(new ComponentFeedbackPanel("messages", notificationWindow).setOutputMarkupId(true)
            .setOutputMarkupPlaceholderTag(true));
    notificationWindow.setAutoOpen(false);
    notificationWindow.setVisible(false);

    add(notificationWindow);/*from  w w w  .  java  2s. c  o m*/

    headerLabel = new Label("header", title);
    titleLabel = new Label("title", title + getTitleSuffix());

    headerLabel.setEscapeModelStrings(false);
    titleLabel.setEscapeModelStrings(false);

    add(headerLabel);
    add(titleLabel);
    add(new FeedbackPanel("feedback").setOutputMarkupId(true));

    Dialog window = new Dialog("debugWindow");
    window.setTitle("Debug Information");
    window.add(new DebugWindow("debugPanel", this.getPageClass()));
    window.setWidth(600);
    window.setHeight(300);
    window.setResizable(false);

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

        @Override
        public void onClick(AjaxRequestTarget target) {

        }

    }.setVisible(ENABLE_MAGIC_PUSHTBUTTON));

    add(window);

    add(new AjaxLink<Dialog>("debugLink", new Model<Dialog>(window)) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            Dialog _window = getModelObject();
            target.appendJavaScript(_window.open().render().toString());

        }

    }.setVisible(Application.get().getConfigurationType() == RuntimeConfigurationType.DEVELOPMENT));

    User u = getTysanSession().getUser();
    WebMarkupContainer subMenu = new WebMarkupContainer("topMenu");
    if (u != null) {
        if (MemberUtil.isMember(u)) {
            topPanel = new WebMarkupContainer("topbar");
            subMenu = new TysanMemberPanel("topMenu", u);
        } else {
            topPanel = new WebMarkupContainer("topbar");
            subMenu = new TysanUserPanel("topMenu", u);
        }
    } else {
        topPanel = new TysanLoginPanel("topbar");
    }
    add(new TysanMenu("menu", u != null));
    add(subMenu);

    add(topPanel);

    add(new Label("version", TysanApplication.getApplicationVersion()));

    if (u != null) {
        get("version").add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(30)) {
            private static final long serialVersionUID = 1L;

            /**
             * @see org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior#onPostProcessTarget(org.apache.wicket.ajax.AjaxRequestTarget)
             */
            @Override
            protected void onPostProcessTarget(AjaxRequestTarget target) {
                Dialog d = getNotificationWindow();
                TysanSession t = TysanSession.get();
                int i = 0;

                for (SiteWideNotification swn : TysanApplication.get().getActiveNotifications()) {
                    if (t != null && !t.notificationSeen(swn)) {
                        swn.display(d);
                        i++;
                    }
                }

                if (i > 0) {
                    d.setAutoOpen(true);
                    d.setVisible(true);
                    target.add(d);
                    getNotificationWindow().open(target);
                }
            }
        });

    }
    addAnimalPanel();

    add(new Label("year", LocalDate.now().getYear()).setRenderBodyOnly(true));
    add(new WebMarkupContainer("texas").setVisible(isAprilFoolsDay(2017)));
}

From source file:com.userweave.components.customModalWindow.BaseModalWindowPage.java

License:Open Source License

protected WebMarkupContainer getAcceptButton(String componentId, final ModalWindow window) {
    return new AjaxLink<Void>(componentId) {
        private static final long serialVersionUID = 1L;

        @Override/*from w ww.  j ava2 s .com*/
        public void onClick(AjaxRequestTarget target) {
            if (window != null) {
                window.close(target);
            } else {
                onAccept(target);
            }
        }
    };
}

From source file:com.userweave.components.customModalWindow.BaseModalWindowPage.java

License:Open Source License

protected WebMarkupContainer getDeclineButton(String componentId, final ModalWindow window) {
    return new AjaxLink<Void>(componentId) {
        private static final long serialVersionUID = 1L;

        @Override/*  w  w w.j  a v a2s .co  m*/
        public void onClick(AjaxRequestTarget target) {
            if (window != null) {
                window.close(target);
            } else {
                onDecline(target);
            }
        }
    };
}

From source file:com.userweave.components.customModalWindow.SurveyModalWindow.java

License:Open Source License

private void init() {
    setCssClassName(CustomModalWindow.CSS_CLASS_CUSTOM);
    setMaskType(ModalWindow.MaskType.TRANSPARENT);
    setInitialHeight(CustomModalWindow.defaultHeight);
    setInitialWidth(CustomModalWindow.defaultWidth);

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

        @Override/*from   w  ww.ja v a 2  s . com*/
        public void onClick(AjaxRequestTarget target) {
            SurveyModalWindow.this.close(target);
        }
    });

    close.setOutputMarkupId(true);
    close.setOutputMarkupPlaceholderTag(true);
}

From source file:com.userweave.components.navigation.breadcrumb.BreadcrumbLinkPanel.java

License:Open Source License

public BreadcrumbLinkPanel(String id, String displayName) {
    super(id);// w  ww. j a va  2s  .c o  m

    AjaxLink link = new AjaxLink("link") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            BreadcrumbLinkPanel.this.onClick(target);
        }
    };

    link.add(new Label("displayName", displayName));

    add(link);
}

From source file:com.userweave.components.navigation.breadcrumb.BreadcrumbPanel.java

License:Open Source License

/**
 * Link to redirect to project overview.
 */// w  ww.j a v  a 2 s  .  co m
@SuppressWarnings("serial")
private AjaxLink getHomePageLink(final EventHandler callback) {
    AjaxLink homeLink = new AjaxLink("home") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            EntityEvent.Selected(target, null).fire(callback);
        }
    };

    return homeLink;
}

From source file:com.userweave.components.navigation.breadcrumb.BreadcrumbPanelWithTabs.java

License:Open Source License

/**
 * Study tabs development and results./*  w  ww  .j  a  v  a 2  s.  c  om*/
 * 
 * @param entity
 *       The entity of this panel. Needed to determine the 
 *       visibility of the tabs.
 */
private void addStudyTabs(final EntityBase entity, final EventHandler studyCallback) {
    add(new AjaxLink("studyDevelTab") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            stateChangeTrigger.triggerChange(UiState.CONFIG, target, studyCallback);

            //StudyEvent.Selected(target, entity, true).fire(studyCallback);
        }
    });

    add(new AjaxLink("studyResultsTab") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            stateChangeTrigger.triggerChange(UiState.REPORT, target, studyCallback);

            //StudyEvent.Selected(target, entity, false).fire(studyCallback);
        }
    });
}

From source file:com.userweave.module.methoden.iconunderstandability.page.report.bmi.IconReportPanel.java

License:Open Source License

public IconReportPanel(String id, IconReport iconReport, Locale studyLocale, int index) {
    super(id);/*  ww w.  ja  va  2s . c o m*/

    this.studyLocale = studyLocale;

    final ImageBase image = iconReport.getImage();

    final CustomModalWindow iconOrderModalWindow = createAddModalWindow(iconReport);

    add(iconOrderModalWindow);

    add(new AjaxLink("openIconOrderLink") {
        private static final long serialVersionUID = 1L;

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

    add(ImageResource.createImage("image", image));

    addNoteModalWindow(iconReport);

    addBarListPopupAndPanel(iconReport);
}