List of usage examples for org.apache.wicket.markup.html WebMarkupContainer replaceWith
public Component replaceWith(Component replacement)
From source file:com.genericconf.bbbgateway.web.pages.HomePage.java
License:Apache License
public HomePage(final PageParameters parameters) { IModel<? extends List<? extends Meeting>> model = new LoadableDetachableModel<List<? extends Meeting>>() { private static final long serialVersionUID = 1L; @Override//w w w . j a v a 2 s. co m protected List<? extends Meeting> load() { return new ArrayList<Meeting>(meetingService.getMeetings()); } }; final WebMarkupContainer joinContainer = new WebMarkupContainer("joinContainer"); joinContainer.setOutputMarkupPlaceholderTag(true).setVisible(false); add(joinContainer); final WebMarkupContainer placeholder = new WebMarkupContainer("tablePlaceholder"); placeholder.add(new AbstractAjaxTimerBehavior( Duration.seconds(TimerSettings.INSTANCE.getSecondsBetweenHomePagePolls())) { private static final long serialVersionUID = 1L; @Override protected void onTimer(AjaxRequestTarget target) { target.addComponent(placeholder); target.appendJavascript("initializeTableStuff();"); } }); final PropertyListView<Meeting> meetingList = new PropertyListView<Meeting>("meetings", model) { private static final long serialVersionUID = 1L; @Override protected void populateItem(final ListItem<Meeting> item) { item.add(new Label("name")); item.add(new DateTimeLabel("startTime")); item.add(new Label("attendeesInMeeting")); item.add(new Label("attendeesWaiting")); item.add(new AjaxLink<Void>("join") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { JoinMeetingFormPanel panel = new JoinMeetingFormPanel(joinContainer.getId(), item.getModel()); joinContainer.replaceWith(panel); target.addComponent(panel); panel.add(new SimpleAttributeModifier("style", "display: none;")); panel.onAjaxRequest(target); StringBuffer js = new StringBuffer().append("$('#").append(panel.getMarkupId()) .append("').dialog({ modal: true, title: 'Join Meeting' });"); target.appendJavascript(js.toString()); } }); } }; meetingList.setOutputMarkupId(true); add(placeholder.setOutputMarkupId(true)); placeholder.add(meetingList); }
From source file:com.genericconf.bbbgateway.web.pages.WaitingRoom.java
License:Apache License
public WaitingRoom(PageParameters params) { final String meetingID = params.getString("0"); final String attName = params.getString("1"); if (StringUtils.isEmpty(meetingID) || StringUtils.isEmpty(attName)) { throw new RestartResponseAtInterceptPageException(getApplication().getHomePage()); }/*from w w w . j a v a 2 s.c o m*/ meeting = new LoadableDetachableModel<Meeting>() { private static final long serialVersionUID = 1L; @Override protected Meeting load() { return meetingService.findByMeetingID(meetingID); } }; attendee = new LoadableDetachableModel<Attendee>() { private static final long serialVersionUID = 1L; @Override protected Attendee load() { return meeting.getObject().getAttendeeByName(attName); } }; add(new Label("name", new PropertyModel<String>(meeting, "name"))); add(new Label("meetingID", new PropertyModel<String>(meeting, "meetingID"))); add(new Label("attName", new PropertyModel<String>(attendee, "name"))); add(new Label("attRole", new PropertyModel<String>(attendee, "role"))); final AttendeeAndWaitingListPanel attendeeList = new AttendeeAndWaitingListPanel("attendeeList", meeting); add(attendeeList); final DateTimeLabel checked = new DateTimeLabel("checkedTime", new AlwaysReturnCurrentDateModel()); add(checked.setOutputMarkupId(true)); final WebMarkupContainer joinDialog = new WebMarkupContainer("joinDialog"); add(joinDialog.setOutputMarkupId(true)); add(new AbstractAjaxTimerBehavior( Duration.seconds(TimerSettings.INSTANCE.getSecondsBeforeFirstWaitingRoomPagePoll())) { private static final long serialVersionUID = 1L; @Override protected void onTimer(AjaxRequestTarget target) { target.addComponent(checked); setUpdateInterval(Duration.seconds(TimerSettings.INSTANCE.getSecondsBetweenWaitingRoomPagePolls())); attendeeList.onAjaxRequest(target); final Attendee att = attendee.getObject(); att.pinged(); if (att.isAllowedToJoin()) { stop(); final JoinMeetingLinkPanel panel = new JoinMeetingLinkPanel(joinDialog.getId(), meeting, attendee); joinDialog.replaceWith(panel); target.addComponent(panel); StringBuffer js = new StringBuffer().append("$('#").append(panel.getMarkupId()) .append("').dialog({ modal: true, title: 'Join Meeting' });"); target.appendJavascript(js.toString()); } } }); }
From source file:jp.javelindev.wicket.repeat.RepeatingPanel.java
License:Apache License
private void construct() { add(new ListView<String>("repeatingList", getModel()) { private static final long serialVersionUID = 1L; @Override//from w w w. ja v a 2s . c om protected void populateItem(final ListItem<String> item) { item.add(new Label("content", item.getModelObject().toString())); } }); final WebMarkupContainer next = new WebMarkupContainer("next"); next.setOutputMarkupId(true); next.setOutputMarkupPlaceholderTag(true); next.setVisible(false); add(next); final WebMarkupContainer container = new WebMarkupContainer("container"); container.setOutputMarkupId(true); add(container); AjaxLink<Void> button = new AjaxLink<Void>("repeatingButton") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { LOGGER.info("clicked"); Panel panel = new RepeatingPanel(next.getId(), Model.ofList(Arrays.asList("1", "2", "3"))); next.replaceWith(panel); container.setVisible(false); target.add(container, panel); } }; container.add(button); }
From source file:org.artifactory.webapp.wicket.page.browse.treebrowser.tabs.general.panels.GeneralInfoPanel.java
License:Open Source License
public GeneralInfoPanel init(RepoAwareActionableItem repoItem) { final boolean itemIsRepo = repoItem instanceof LocalRepoActionableItem; LocalRepoDescriptor repoDescriptor = repoItem.getRepo(); final boolean isCache = repoDescriptor.isCache(); RemoteRepoDescriptor remoteRepo = null; if (isCache) { remoteRepo = ((LocalCacheRepoDescriptor) repoDescriptor).getRemoteRepo(); }/*www . j a v a2 s. com*/ FieldSetBorder infoBorder = new FieldSetBorder("infoBorder"); add(infoBorder); LabeledValue nameLabel = new LabeledValue("name", "Name: "); infoBorder.add(nameLabel); String itemDisplayName = repoItem.getDisplayName(); String pathUrl = BrowseRepoPage.getWicketDependableRepoPathUrl(repoItem); if (StringUtils.isBlank(pathUrl)) { pathUrl = ""; } ExternalLink treeUrl = new ExternalLink("nameLink", pathUrl, itemDisplayName); infoBorder.add(treeUrl); infoBorder.add(new HelpBubble("nameLink.help", "Copy this link to navigate directly to this item in the tree browser.")); LabeledValue descriptionLabel = new LabeledValue("description", "Description: "); descriptionLabel.setEscapeValue(false); String description = null; if (itemIsRepo) { if (isCache) { description = remoteRepo.getDescription(); } else { description = repoDescriptor.getDescription(); } if (description != null) { descriptionLabel.setValue(description.replace("\n", "<br/>")); } } descriptionLabel.setVisible(!StringUtils.isEmpty(description)); infoBorder.add(descriptionLabel); ItemInfo itemInfo = repoItem.getItemInfo(); LabeledValue deployedByLabel = new LabeledValue("deployed-by", "Deployed by: ", itemInfo.getModifiedBy()) { @Override public boolean isVisible() { return !itemIsRepo; } }; infoBorder.add(deployedByLabel); //Add markup container in case we need to set the remote repo url WebMarkupContainer urlLabelContainer = new WebMarkupContainer("urlLabel"); WebMarkupContainer urlContainer = new WebMarkupContainer("url"); infoBorder.add(urlLabelContainer); infoBorder.add(urlContainer); if (isCache) { urlLabelContainer.replaceWith(new Label("urlLabel", "Remote URL: ")); String remoteRepoUrl = remoteRepo.getUrl(); if ((remoteRepoUrl != null) && (!StringUtils.endsWith(remoteRepoUrl, "/"))) { remoteRepoUrl += "/"; if (repoItem instanceof FolderActionableItem) { remoteRepoUrl += ((FolderActionableItem) repoItem).getCanonicalPath().getPath(); } else { remoteRepoUrl += repoItem.getRepoPath().getPath(); } } ExternalLink externalLink = new ExternalLink("url", remoteRepoUrl, remoteRepoUrl); urlContainer.replaceWith(externalLink); } addOnlineStatusPanel(itemIsRepo, isCache, remoteRepo, infoBorder); final boolean repoIsBlackedOut = repoDescriptor.isBlackedOut(); LabeledValue blackListedLabel = new LabeledValue("blackListed", "This repository is black-listed!") { @Override public boolean isVisible() { return repoIsBlackedOut; } }; infoBorder.add(blackListedLabel); addArtifactCount(repoItem, infoBorder); addWatcherInfo(repoItem, infoBorder); final RepoPath path; if (repoItem instanceof FolderActionableItem) { path = ((FolderActionableItem) repoItem).getCanonicalPath(); } else { path = repoItem.getRepoPath(); } LabeledValue repoPath = new LabeledValue("repoPath", "Repository Path: "); infoBorder.add(repoPath); String pathLink = RequestUtils.getWicketServletContextUrl(); if (!pathLink.endsWith("/")) { pathLink += "/"; } pathLink += ArtifactoryRequest.SIMPLE_BROWSING_PATH + "/" + repoItem.getRepoPath().getRepoKey() + "/"; if (repoItem instanceof CannonicalEnabledActionableFolder) { pathLink += ((CannonicalEnabledActionableFolder) repoItem).getCanonicalPath().getPath(); } else { pathLink += PathUtils.getParent(repoItem.getRepoPath().getPath()); } ExternalLink repoPathUrl = new ExternalLink("repoPathLink", pathLink, path + ""); infoBorder.add(repoPathUrl); infoBorder.add(new HelpBubble("repoPathLink.help", "Copy this link to navigate directly to this item in the simple browser.")); addItemInfoLabels(infoBorder, itemInfo); infoBorder.add(getLicenseInfo(repoItem)); addLocalLayoutInfo(infoBorder, repoDescriptor, itemIsRepo); addRemoteLayoutInfo(infoBorder, remoteRepo, itemIsRepo); addLastReplicationInfo(infoBorder, path, isCache); addFilteredResourceCheckbox(infoBorder, itemInfo); infoBorder.add(new StatsTabPanel("statistics", itemInfo)); addBintrayInfoPanel(infoBorder, itemInfo); return this; }
From source file:org.artifactory.webapp.wicket.page.browse.treebrowser.tabs.general.panels.GeneralInfoPanel.java
License:Open Source License
private void addArtifactCount(final RepoAwareActionableItem repoItem, final FieldSetBorder infoBorder) { if (!repoItem.getItemInfo().isFolder()) { infoBorder.add(new WebMarkupContainer("artifactCountLabel")); infoBorder.add(new WebMarkupContainer("artifactCountValue")); WebMarkupContainer linkContainer = new WebMarkupContainer("link"); linkContainer.setVisible(false); infoBorder.add(linkContainer);/*from w w w . j a v a2 s.co m*/ } else { infoBorder.add(new Label("artifactCountLabel", "Artifact Count: ")); final WebMarkupContainer container = new WebMarkupContainer("artifactCountValue"); infoBorder.add(container); AjaxLink<String> link = new AjaxLink<String>("link") { @Override public void onClick(AjaxRequestTarget target) { setVisible(false); container.replaceWith( new ArtifactCountLazySpanPanel("artifactCountValue", repoItem.getRepoPath())); target.add(infoBorder); } }; infoBorder.add(link); } }
From source file:org.artifactory.webapp.wicket.page.browse.treebrowser.tabs.general.panels.GeneralInfoPanel.java
License:Open Source License
private void addFilteredResourceCheckbox(FieldSetBorder infoBorder, ItemInfo itemInfo) { WebMarkupContainer filteredResourceContainer = new WebMarkupContainer("filteredResourceContainer"); filteredResourceContainer.setVisible(false); infoBorder.add(filteredResourceContainer); WebMarkupContainer filteredResourceCheckbox = new WebMarkupContainer("filteredResourceCheckbox"); filteredResourceContainer.add(filteredResourceCheckbox); final WebMarkupContainer filteredResourceHelpBubble = new WebMarkupContainer("filteredResource.help"); filteredResourceContainer.add(filteredResourceHelpBubble); if (!itemInfo.isFolder() && authorizationService.canAnnotate(itemInfo.getRepoPath())) { FilteredResourcesWebAddon filteredResourcesWebAddon = addonsManager .addonByType(FilteredResourcesWebAddon.class); filteredResourceCheckbox.replaceWith( filteredResourcesWebAddon.getFilteredResourceCheckbox("filteredResourceCheckbox", itemInfo)); filteredResourceHelpBubble//from w w w . j a v a 2s. c o m .replaceWith(new HelpBubble("filteredResource.help", getString("filteredResource.help"))); filteredResourceContainer.setVisible(true); } }
From source file:org.artifactory.webapp.wicket.page.build.tabs.BuildGeneralInfoTabPanel.java
License:Open Source License
private void addIssueTrackerInformation(FieldSetBorder infoBorder, Issues issues) { WebMarkupContainer issueTrackerContainer = new WebMarkupContainer("issueTracker"); infoBorder.add(issueTrackerContainer); if (issues != null) { IssueTracker tracker = issues.getTracker(); if (tracker != null) { String trackerName = tracker.getName(); if (StringUtils.isNotBlank(trackerName)) { StringBuilder trackerInfoBuilder = new StringBuilder(trackerName); String version = tracker.getVersion(); if (StringUtils.isNotBlank(version)) { trackerInfoBuilder.append("/").append(version); }//from w w w . ja v a 2 s .c o m issueTrackerContainer.replaceWith( new LabeledValue("issueTracker", "Issue Tracker: ", trackerInfoBuilder.toString())); } } } }
From source file:org.artifactory.webapp.wicket.page.build.tabs.IssuesTabPanel.java
License:Open Source License
public IssuesTabPanel(String panelId, Build build) { super(panelId); WebMarkupContainer emptyLabel = new WebMarkupContainer("emptyLabel"); add(emptyLabel);// w w w. ja va 2 s .com FieldSetBorder affectedIssuesBorder = new FieldSetBorder("affectedIssuesBorder"); add(affectedIssuesBorder); Issues issues = build.getIssues(); List<Issue> affectedIssues = null; if (issues != null) { Set<Issue> affectedIssuesSet = issues.getAffectedIssues(); if (affectedIssuesSet != null) { affectedIssues = Lists.newArrayList(affectedIssuesSet); } } if (affectedIssues == null) { affectedIssues = Lists.newArrayList(); } if (affectedIssues.isEmpty()) { emptyLabel.replaceWith(new Label("emptyLabel", "No issues were recorded during this build.")); affectedIssuesBorder.setVisible(false); } List<IColumn<Issue>> columns = Lists.newArrayList(); columns.add(new PropertyColumn<Issue>(Model.of("Key"), "key") { @Override public void populateItem(Item cellItem, String componentId, IModel rowModel) { final Issue issue = (Issue) cellItem.getParent().getParent().getDefaultModelObject(); ExternalLink link = new ExternalLink(componentId, issue.getUrl(), issue.getKey()) { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("onclick", "window.open('" + issue.getUrl() + "', '_blank')"); } }; if (!issue.isAggregated()) { link.add(new CssClass("bold-listed-label")); } cellItem.add(link.add(new CssClass("item-link"))); } }); columns.add(new PropertyColumn<Issue>(Model.of("Summary"), "summary")); columns.add(new BooleanColumn<Issue>(Model.of("Previous Build"), "aggregated")); IssueDataProvider dataProvider = new IssueDataProvider(affectedIssues); affectedIssuesBorder.add(new SortableTable<>("issues", columns, dataProvider, 50)); }
From source file:org.artifactory.webapp.wicket.page.build.tabs.ReleaseHistoryTabPanel.java
License:Open Source License
public ReleaseHistoryTabPanel(String id, Build build) { super(id);//from w w w . j av a 2 s. c om WebMarkupContainer emptyLabel = new WebMarkupContainer("emptyLabel"); add(emptyLabel); List<PromotionStatus> statuses = build.getStatuses(); if (statuses == null) { statuses = Lists.newArrayList(); } if (statuses.isEmpty()) { emptyLabel.replaceWith(new Label("emptyLabel", "This build has no release history.")); } else { Comparator<PromotionStatus> reverseDate = Collections.reverseOrder(new Comparator<PromotionStatus>() { @Override public int compare(PromotionStatus o1, PromotionStatus o2) { return o1.getTimestampDate().compareTo(o2.getTimestampDate()); } }); Collections.sort(statuses, reverseDate); } add(new ListView<PromotionStatus>("historyList", statuses) { @Override protected void populateItem(ListItem<PromotionStatus> statusListItem) { statusListItem.add(new ReleaseHistoryItem("historyItem", statusListItem.getModelObject())); } }); }
From source file:org.artifactory.webapp.wicket.page.config.repos.virtual.VirtualRepoBasicPanel.java
License:Open Source License
public VirtualRepoBasicPanel(String id, CreateUpdateAction action, VirtualRepoDescriptor repoDescriptor, CachingDescriptorHelper cachingDescriptorHelper) { super(id);/* www. j a v a 2 s. c o m*/ this.action = action; this.repoDescriptor = repoDescriptor; this.cachingDescriptorHelper = cachingDescriptorHelper; add(new RepoGeneralSettingsPanel("generalSettings")); // resolved repos final WebMarkupContainer resolvedRepo = new WebMarkupContainer("resolvedRepoWrapper"); resolvedRepo.setOutputMarkupId(true); add(resolvedRepo); add(new HelpBubble("resolvedRepo.help", new ResourceModel("resolvedRepo.help"))); resolvedRepo.add(new DataView<RealRepoDescriptor>("resolvedRepo", new ResolvedReposDataProvider()) { @Override protected void populateItem(Item<RealRepoDescriptor> item) { RepoDescriptor repo = item.getModelObject(); item.add(new Label("key", repo.getKey())); WebMarkupContainer note = new WebMarkupContainer("note"); item.add(note); if (!isLayoutCompatible(repo)) { note.replaceWith(new Label("note", "!")); } } }); // repositories List<RepoDescriptor> repos = getReposExcludingCurrent(); DragDropSelection<RepoDescriptor> reposSelection = new IconDragDropSelection<RepoDescriptor>("repositories", repos) { @Override protected void onOrderChanged(AjaxRequestTarget target) { super.onOrderChanged(target); target.add(resolvedRepo); ModalHandler.resizeCurrent(); } }; add(reposSelection); add(new SchemaHelpBubble("repositories.help")); }