Example usage for org.apache.wicket.markup.html WebMarkupContainer add

List of usage examples for org.apache.wicket.markup.html WebMarkupContainer add

Introduction

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

Prototype

public MarkupContainer add(final Component... children) 

Source Link

Document

Adds the child component(s) to this container.

Usage

From source file:$.BootstrapFeedbackPanel.java

License:Apache License

/**
     * @see org.apache.wicket.Component#Component(String)
     * /*  w  w w.  ja va  2 s . c o  m*/
     * @param id
     * @param filter
     */
    public BootstrapFeedbackPanel(final String id, IFeedbackMessageFilter filter) {
        super(id);
        WebMarkupContainer messagesContainer = new WebMarkupContainer("feedbackDiv") {
            private static final long serialVersionUID = 1L;

            @Override
            public boolean isVisible() {
                return anyMessage();
            }
        };
        add(messagesContainer);
        messageListView = new MessageListView("messages");
        messageListView.setVersioned(false);
        messagesContainer.add(messageListView);

        if (filter != null) {
            setFilter(filter);
        }
    }

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

License:Apache License

public LoginPage() {
    LoginPanel loginPanel = new LoginPanel("loginPanel");
    add(loginPanel);/* w  w w.  j a v a2  s.co  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//from   ww  w  . j  a v  a2  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:ar.edu.unq.dopplereffect.presentation.panel.upload.UploadPanel.java

License:Apache License

protected void addButtons() {
    WebMarkupContainer ajaxButton = new WebMarkupContainer("aceptar");
    ajaxButton.add(new WiQueryEventBehavior(new Event(MouseEvent.CLICK) {
        private static final long serialVersionUID = 1L;

        @Override/*from  ww w  . j av a2 s  .c  om*/
        public JsScope callback() {
            return JsScope.quickScope(UploadPanel.this.getDialogSelectedTypeToExport().open().render());
        }

    }));
    ajaxButton.add(new ButtonBehavior());
    this.add(ajaxButton);

}

From source file:at.ac.tuwien.ifs.tita.ui.BasePage.java

License:Apache License

/**
 * Adds the secure Links for TimeController.
 * //from  w  ww .  j  a  v  a2  s  . com
 * @param timeControllergroup - container
 */
private void addTimeControllerLinks(WebMarkupContainer timeControllergroup) {
    timeControllergroup.add(new SecurePageLink("projectsPageLink", ProjectsPage.class));
    timeControllergroup.add(new SecurePageLink("multipleProjectsViewLink", MultipleProjectsView.class));
    timeControllergroup.add(new SecurePageLink("targetActualViewLink", TargetActualView.class));
    timeControllergroup.add(new SecurePageLink("performanceOfPersonViewLink", PerformanceOfPersonView.class));
}

From source file:at.ac.tuwien.ifs.tita.ui.BasePage.java

License:Apache License

/**
 * Adds the secure Links for TimeConsumers.
 * //from   w w  w .  j  ava2  s  . c o  m
 * @param timeConsumergroup - container
 */
private void addTimeConsumerLinks(WebMarkupContainer timeConsumergroup) {
    timeConsumergroup.add(new SecurePageLink("effortsPageLink", EffortsPage.class));
    timeConsumergroup.add(new SecurePageLink("dailyViewPageLink", DailyViewPage.class));
    timeConsumergroup.add(new SecurePageLink("monthlyViewPageLink", MonthlyViewPage.class));
    timeConsumergroup.add(new SecurePageLink("effortsImportCSVPageLink", EffortImportCSVPage.class));

}

From source file:at.ac.tuwien.ifs.tita.ui.BasePage.java

License:Apache License

/**
 * Adds the secure Links for TimeController.
 * /*from  w  ww. j a  v a2s.  c  o m*/
 * @param administratorGroup - container
 */
private void addAdminLinks(WebMarkupContainer administratorGroup) {
    administratorGroup.add(new SecurePageLink("adminPageLink", AdminPage.class));
    administratorGroup.add(new SecurePageLink("userAdministrationLink", UserAdministrationPage.class));
    administratorGroup.add(new SecurePageLink("projectAdministrationLink", ProjectAdministrationPage.class));

}

From source file:at.ac.tuwien.ifs.tita.ui.evaluation.timeconsumer.DailyViewPage.java

License:Apache License

/**
 * Inits Page.//  w  ww. java 2  s.co m
 */
private void initPage() {
    Form<Effort> form = new Form<Effort>("timeConsumerEvaluationForm",
            new CompoundPropertyModel<Effort>(new Effort()));
    add(form);
    form.setOutputMarkupId(true);

    final DateTextField dateTextField = new DateTextField("tedate", new PropertyModel<Date>(this, "date"),
            new StyleDateConverter("S-", true));
    dateTextField.add(new DatePicker());
    form.add(dateTextField);

    final WebMarkupContainer timeeffortContainer = new WebMarkupContainer("timeeffortContainer");
    timeeffortContainer.setOutputMarkupId(true);
    timeeffortContainer.setOutputMarkupPlaceholderTag(true);
    add(timeeffortContainer);

    tableModel = new TableModelTimeConsumerEvaluation(getTimeEffortsDailyView(new Date()));
    Table table = new Table("tetable", tableModel);
    timeeffortContainer.add(table);

    final Button btnShowAsPDF = new Button("btnShowPDF") {
        @Override
        public void onSubmit() {
            try {
                loadReport();
                ResourceStreamRequestTarget rsrtarget = new ResourceStreamRequestTarget(
                        pdfResource.getResourceStream());
                rsrtarget.setFileName(pdfResource.getFilename());
                RequestCycle.get().setRequestTarget(rsrtarget);
            } catch (JRException e) {
                // TODO: GUI Exception Handling
                log.error(e.getMessage());
            } catch (PersistenceException e) {
                // TODO: GUI Exception Handling
                log.error(e.getMessage());
            }
        }

        @Override
        public boolean isEnabled() {
            return tableModel.getRowCount() == 0 ? false : true;
        }
    };

    form.add(btnShowAsPDF);

    form.add(new AjaxButton("btnShowEvaluation", form) {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form1) {
            tableModel.reload(getTimeEffortsDailyView(dateTextField.getModelObject()));
            target.addComponent(timeeffortContainer);
            target.addComponent(btnShowAsPDF);
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form1) {
            // TODO Set border red on textfields which are'nt filled
        }
    });

}

From source file:at.ac.tuwien.ifs.tita.ui.evaluation.timeconsumer.MonthlyViewPage.java

License:Apache License

/**
 * Inits Page.//w w w .  ja  v a 2 s.c o  m
 */
@SuppressWarnings("unchecked")
private void initPage() {
    Form<Effort> form = new Form<Effort>("timeConsumerEvaluationForm",
            new CompoundPropertyModel<Effort>(new Effort()));
    add(form);
    form.setOutputMarkupId(true);

    ChoiceRenderer choiceRenderer = new ChoiceRenderer("value", "key");

    final DropDownChoice ddYears = new DropDownChoice("yearSelection", new PropertyModel(this, "selectedYear"),
            getYears(), choiceRenderer);
    form.add(ddYears);

    final DropDownChoice ddMonths = new DropDownChoice("monthSelection",
            new PropertyModel(this, "selectedMonth"), getMonths(), choiceRenderer);
    form.add(ddMonths);

    final WebMarkupContainer timeeffortContainer = new WebMarkupContainer("timeeffortContainer");
    timeeffortContainer.setOutputMarkupId(true);
    timeeffortContainer.setOutputMarkupPlaceholderTag(true);
    add(timeeffortContainer);

    initButtons(form, timeeffortContainer);

    Calendar cal = Calendar.getInstance();
    tableModel = new TableModelTimeConsumerEvaluation(
            getTimeEffortsMonthlyView(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)));
    Table table = new Table("tetable", tableModel);
    timeeffortContainer.add(table);
}

From source file:au.com.scds.isis.viewer.wicket.ui.components.entity.properties.MyEntityPropertiesForm.java

License:Apache License

private boolean addPropertiesInColumn(MarkupContainer markupContainer, MemberGroupLayoutHint hint,
        ColumnSpans columnSpans) {/*from  w w w . j  a v  a  2  s .  co  m*/
    final int span = hint.from(columnSpans);

    final EntityModel entityModel = (EntityModel) getModel();
    final ObjectAdapter adapter = entityModel.getObject();
    final ObjectSpecification objSpec = adapter.getSpecification();

    final List<ObjectAssociation> associations = visibleProperties(adapter, objSpec, Where.OBJECT_FORMS);

    final RepeatingView memberGroupRv = new RepeatingView(ID_MEMBER_GROUP);
    markupContainer.add(memberGroupRv);

    Map<String, List<ObjectAssociation>> associationsByGroup = ObjectAssociation.Util
            .groupByMemberOrderName(associations);

    final List<String> groupNames = ObjectSpecifications.orderByMemberGroups(objSpec,
            associationsByGroup.keySet(), hint);
    //TODO remove      System.out.println(">>>" + groupNames.toString());

    for (String groupName : groupNames) {
        final List<ObjectAssociation> associationsInGroup = associationsByGroup.get(groupName);
        if (associationsInGroup == null) {
            continue;
        }

        final WebMarkupContainer memberGroupRvContainer = new WebMarkupContainer(memberGroupRv.newChildId());
        memberGroupRv.add(memberGroupRvContainer);
        memberGroupRvContainer.add(new Label(ID_MEMBER_GROUP_NAME, groupName));

        final List<LinkAndLabel> memberGroupActions = Lists.newArrayList();

        final RepeatingView propertyRv = new RepeatingView(ID_PROPERTIES);
        memberGroupRvContainer.add(propertyRv);

        @SuppressWarnings("unused")
        Component component;
        for (final ObjectAssociation association : associationsInGroup) {
            final WebMarkupContainer propertyRvContainer = new UiHintPathSignificantWebMarkupContainer(
                    propertyRv.newChildId());
            propertyRv.add(propertyRvContainer);

            addPropertyToForm(entityModel, (OneToOneAssociation) association, propertyRvContainer,
                    memberGroupActions);
        }

        final List<LinkAndLabel> actionsPanel = LinkAndLabel.positioned(memberGroupActions,
                ActionLayout.Position.PANEL);
        final List<LinkAndLabel> actionsPanelDropDown = LinkAndLabel.positioned(memberGroupActions,
                ActionLayout.Position.PANEL_DROPDOWN);

        AdditionalLinksPanel.addAdditionalLinks(memberGroupRvContainer, ID_ASSOCIATED_ACTION_LINKS_PANEL,
                actionsPanel, AdditionalLinksPanel.Style.INLINE_LIST);
        AdditionalLinksPanel.addAdditionalLinks(memberGroupRvContainer,
                ID_ASSOCIATED_ACTION_LINKS_PANEL_DROPDOWN, actionsPanelDropDown,
                AdditionalLinksPanel.Style.DROPDOWN);
    }

    addClassForSpan(markupContainer, span);
    return !groupNames.isEmpty();
}