List of usage examples for org.apache.wicket Component add
public Component add(final Behavior... behaviors)
From source file:net.dontdrinkandroot.wicket.bootstrap.component.modal.AbstractFormModalPanel.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); this.add(new CssClassAppender(BootstrapCssClass.MODAL)); this.add(new CssClassAppender(BootstrapCssClass.FADE)); Form<T> form = this.createForm("form"); this.add(form); Label headingLabel = new Label("heading", this.createHeadingModel()); headingLabel.add(new CssClassAppender(BootstrapCssClass.MODAL_TITLE)); form.add(headingLabel);/*from w ww .j a va2s. c om*/ Component body = this.createBody("body"); body.add(new CssClassAppender(BootstrapCssClass.MODAL_BODY)); form.add(body); Component footer = this.createFooter("footer"); footer.add(new CssClassAppender(BootstrapCssClass.MODAL_FOOTER)); form.add(footer); }
From source file:net.dontdrinkandroot.wicket.bootstrap.component.modal.AbstractModalPanel.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); Label headingLabel = new Label("heading", this.createHeadingModel()); headingLabel.add(new CssClassAppender(BootstrapCssClass.MODAL_TITLE)); this.add(headingLabel); Component body = this.createBody("body"); body.add(new CssClassAppender(BootstrapCssClass.MODAL_BODY)); this.add(body); Component footer = this.createFooter("footer"); footer.add(new CssClassAppender(BootstrapCssClass.MODAL_FOOTER)); this.add(footer); }
From source file:net.dontdrinkandroot.wicket.bootstrap.component.panel.Panel.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); this.add(new CssClassAppender(BootstrapCssClass.PANEL)); this.add(new CssClassAppender(this.styleModel)); Component headingComponent = this.createHeadingComponent("heading"); headingComponent.add(new CssClassAppender(BootstrapCssClass.PANEL_HEADING)); this.add(headingComponent); this.add(this.createAfterBodyComponent("afterBody")); Component footerComponent = this.createFooterComponent("footer"); footerComponent.add(new CssClassAppender(BootstrapCssClass.PANEL_FOOTER)); this.add(footerComponent); }
From source file:net.dontdrinkandroot.wicket.bootstrap.component.thumbnail.ThumbnailsList.java
License:Apache License
@Override protected void onBeforeRender() { this.itemView.removeAll(); for (int idx = 0; idx < this.getModelObject().size(); idx++) { IModel<T> listItemModel = new ListItemModel<T>(this.getModel(), idx); Component item = this.createItem(this.itemView.newChildId(), listItemModel); item.add(new CssClassAppender(this.spanClass)); this.itemView.add(item); }//from w ww .ja va2 s . co m super.onBeforeRender(); }
From source file:net.rrm.ehour.ui.timesheet.panel.ProjectOverviewPanel.java
License:Open Source License
private void setProjectLabelWidth(Component label) { if (!isTurnOverVisible()) { label.add(AttributeModifier.replace("style", "width: 35%;")); }//from w ww . ja v a 2 s . c om }
From source file:net.rrm.ehour.ui.timesheet.panel.TimesheetRowList.java
License:Open Source License
private void addInputCells(ListItem<TimesheetRow> item, final TimesheetRow row) { Calendar currentDate = (Calendar) row.getFirstDayOfWeekDate().clone(); ProjectAssignment assignment = row.getProjectAssignment(); final DateRange range = new DateRange(assignment.getDateStart(), assignment.getDateEnd()); final List<Calendar> dates = Lists.newArrayList(); for (int i = 1; i <= 7; i++, currentDate.add(Calendar.DAY_OF_YEAR, 1)) { dates.add((Calendar) currentDate.clone()); }//from w w w . j a v a 2 s . c om item.add(new ListView<Calendar>("days", dates) { @Override protected void populateItem(ListItem<Calendar> item) { Calendar currentDate = item.getModelObject(); int index = currentDate.get(Calendar.DAY_OF_WEEK) - 1; TimesheetCell timesheetCell = row.getTimesheetCells()[index]; DayStatus dayStatus = determineDayStatus(timesheetCell, currentDate, range); Component day; switch (dayStatus) { case HIDDEN: default: day = createEmptyTimesheetEntry(DAY_ID); item.add(new WebMarkupContainer(DAY_OPTIONS_ID)); break; case OPEN: day = createInputTimesheetEntry(DAY_ID, row, index); item.add(renderOptions(DAY_OPTIONS_ID, timesheetCell, dayStatus)); break; case LOCKED: day = createLockedTimesheetEntry(DAY_ID, row, index); item.add(renderOptions(DAY_OPTIONS_ID, timesheetCell, dayStatus)); item.add(AttributeModifier.append("class", "locked")); break; } String cssClass = "weekday"; if (dayStatus == DayStatus.LOCKED) { cssClass += " lockedCell"; } else if (item.getIndex() == 0) { cssClass = "sunday"; } else if (item.getIndex() == 6) { cssClass = "saturday"; } day.add(AttributeModifier.replace("class", cssClass)); item.add(day); } }); }
From source file:nl.knaw.dans.common.web.template.AbstractCommonForm.java
License:Apache License
/** * Disable all components in the form, make any submit component invisible and make a link visible. * * @param enableComponents//from w w w . j a v a2s . c o m * list of all components */ protected void disableForm(final String[] enableComponents) { // Disable all components. final AttributeModifier disabler = new AttributeModifier("disabled", true, new Model("true")); this.visitChildren(FormComponent.class, new IVisitor() { public Object component(final Component component) { // Submitlinks and buttons are removed. if (SubmitLink.class.isAssignableFrom(component.getClass()) || Button.class.isAssignableFrom(component.getClass())) { component.setVisible(false); } else { // Others disabled. component.add(disabler); } return IVisitor.CONTINUE_TRAVERSAL; } }); // Disable the form. this.setEnabled(false); // Enable some specific components for (String componentName : enableComponents) { this.get(componentName).setVisible(true); } }
From source file:nl.knaw.dans.dccd.common.wicket.geo.LazyLoadingGeoViewer.java
License:Apache License
/** * The only constructor that makes sense for lazy loading! * //from w w w . ja va 2s. c o m * @param id */ public LazyLoadingGeoViewer(String id) { super(id); /** * Note that respond is called after OnDomReady, see renderHead * the AjaxLazyLoadPanel is using the same approach */ add(new AbstractDefaultAjaxBehavior() { private static final long serialVersionUID = -7720550178388585424L; @Override protected void respond(AjaxRequestTarget target) { addMarkers(produceMarkers(), target); Component indicatorDone = new Label("indicator", "").setOutputMarkupId(true); indicatorDone.add(new SimpleAttributeModifier("style", "display:none;")); // Hmm, could make a hidden class, looks better, maybe there is one allready? indicator.replaceWith(indicatorDone); indicator = indicatorDone; target.addComponent(indicatorDone); } @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.renderOnDomReadyJavascript(getCallbackScript().toString()); } }); }
From source file:nl.knaw.dans.libs.map.LazyLoadingMapViewerPanel.java
License:Apache License
/** * The only constructor that makes sense for lazy loading! * /*from w w w .j ava 2 s.c o m*/ * @param id */ public LazyLoadingMapViewerPanel(String id) { super(id); /** * Note that respond is called after OnDomReady, see renderHead the AjaxLazyLoadPanel is using the same approach */ add(new AbstractDefaultAjaxBehavior() { private static final long serialVersionUID = -7720550178388585424L; @Override protected void respond(AjaxRequestTarget target) { addMarkers(produceMarkers(), target); Component indicatorDone = new Label("indicator", "").setOutputMarkupId(true); indicatorDone.add(new SimpleAttributeModifier("style", "display:none;")); indicator.replaceWith(indicatorDone); indicator = indicatorDone; target.addComponent(indicatorDone); } @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.renderOnDomReadyJavascript(getCallbackScript().toString()); } }); }
From source file:nl.ru.cmbi.vase.web.page.AlignmentPage.java
License:Apache License
private void addToTabs(String id, String tabTitle, Component component, RepeatingView tabs) { // first added becomes the active tab String display = "none"; boolean bActive = false; if (tabids.size() == 0) { bActive = true;//from ww w. j a va 2s. c o m display = "block"; } tabids.add(id); component.add(new AttributeModifier("id", id)); component.add(new AttributeAppender("style", new Model("display:" + display), ";")); add(component); tabs.add(new TabFragment(tabs.newChildId(), id, tabTitle, bActive)); }