org.apache.wicket.behavior.AttributeAppender Java Examples
The following examples show how to use
org.apache.wicket.behavior.AttributeAppender.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IssueActivitiesPanel.java From onedev with MIT License | 6 votes |
@Override protected void onBeforeRender() { activitiesView = new RepeatingView("activities"); addOrReplace(activitiesView); Issue issue = getIssue(); for (IssueActivity activity: getActivities()) { if (issue.isVisitedAfter(activity.getDate())) { activitiesView.add(newActivityRow(activitiesView.newChildId(), activity)); } else { Component row = newActivityRow(activitiesView.newChildId(), activity); row.add(AttributeAppender.append("class", "new")); activitiesView.add(row); } } super.onBeforeRender(); }
Example #2
Source File: StudentVisitsWidget.java From sakai with Educational Community License v2.0 | 6 votes |
private Fragment getLazyLoadedMiniStats(String markupId) { Fragment ministatFragment = new Fragment(markupId, "ministatFragment", this); int miniStatsCount = widgetMiniStats != null ? widgetMiniStats.size() : 0; Loop miniStatsLoop = new Loop("widgetRow", miniStatsCount) { private static final long serialVersionUID = 1L; @Override protected void populateItem(LoopItem item) { int index = item.getIndex(); WidgetMiniStat ms = widgetMiniStats.get(index); Label widgetValue = new Label("widgetValue", Model.of(ms.getValue())); Label widgetLabel = new Label("widgetLabel", Model.of(ms.getLabel())); WebMarkupContainer widgetIcon = new WebMarkupContainer("widgetIcon"); widgetIcon.add(new AttributeAppender("class", " " + ms.getSecondValue())); item.add(widgetValue); item.add(widgetLabel); item.add(widgetIcon); } }; ministatFragment.add(miniStatsLoop); return ministatFragment; }
Example #3
Source File: UserPage.java From onedev with MIT License | 6 votes |
@Override protected void onInitialize() { super.onInitialize(); add(new SideBar("userSidebar", null) { @Override protected Component newHead(String componentId) { Fragment fragment = new Fragment(componentId, "sidebarHeadFrag", UserPage.this); User user = userModel.getObject(); fragment.add(new UserAvatar("avatar", user) .add(AttributeAppender.append("title", user.getDisplayName()))); fragment.add(new Label("name", user.getDisplayName())); return fragment; } @Override protected List<? extends Tab> newTabs() { return UserPage.this.newTabs(); } }); }
Example #4
Source File: UserPasswordPage.java From onedev with MIT License | 6 votes |
@Override protected void onInitialize() { super.onInitialize(); if (getUser().getPassword().equals(User.EXTERNAL_MANAGED)) { String message; if (getUser().getSsoInfo().getConnector() != null) { message = "The user is currently authenticated via SSO provider '" + getUser().getSsoInfo().getConnector() + "', please change password there instead"; } else { message = "The user is currently authenticated via external system, " + "please change password there instead"; } add(new Label("content", message).add(AttributeAppender.append("class", "alert alert-warning"))); } else { add(new PasswordEditPanel("content", userModel)); } }
Example #5
Source File: MyPasswordPage.java From onedev with MIT License | 6 votes |
@Override protected void onInitialize() { super.onInitialize(); if (getLoginUser().getPassword().equals(User.EXTERNAL_MANAGED)) { String message; if (getLoginUser().getSsoInfo().getConnector() != null) { message = "You are currently authenticated via SSO provider '" + getLoginUser().getSsoInfo().getConnector() + "', please change password there instead"; } else { message = "You are currently authenticated via external system, " + "please change password there instead"; } add(new Label("content", message).add(AttributeAppender.append("class", "alert alert-warning"))); } else { add(new PasswordEditPanel("content", new AbstractReadOnlyModel<User>() { @Override public User getObject() { return getLoginUser(); } })); } }
Example #6
Source File: PasswordPropertyEditor.java From onedev with MIT License | 6 votes |
@Override protected void onInitialize() { super.onInitialize(); input = new PasswordTextField("input", Model.of(getModelObject())); input.setRequired(false); input.setResetPassword(false); input.setLabel(Model.of(getDescriptor().getDisplayName())); add(input); Password password = getDescriptor().getPropertyGetter().getAnnotation(Password.class); String autoComplete = password.autoComplete(); if (StringUtils.isNotBlank(autoComplete)) input.add(AttributeAppender.append("autocomplete", autoComplete)); input.add(new OnTypingDoneBehavior() { @Override protected void onTypingDone(AjaxRequestTarget target) { onPropertyUpdating(target); } }); }
Example #7
Source File: BlobIcon.java From onedev with MIT License | 6 votes |
@Override protected void onInitialize() { super.onInitialize(); add(AttributeAppender.append("class", new LoadableDetachableModel<String>() { @Override protected String load() { BlobIdent blobIdent = (BlobIdent) getDefaultModelObject(); if (blobIdent.isTree()) return " fa fa-folder-o"; else if (blobIdent.isGitLink()) return " fa fa-ext fa-folder-submodule-o"; else if (blobIdent.isSymbolLink()) return " fa fa-ext fa-folder-symbol-link-o"; else return " fa fa-file-text-o"; } })); }
Example #8
Source File: WatchStatusLink.java From onedev with MIT License | 6 votes |
@Override protected void onInitialize() { super.onInitialize(); add(AttributeAppender.append("class", new LoadableDetachableModel<String>() { @Override protected String load() { WatchStatus status = getWatchStatus(); if (status == WatchStatus.DO_NOT_WATCH) return "do-not-watch"; else if (status == WatchStatus.WATCH) return "watch"; else return "default"; } })); }
Example #9
Source File: ModalPanel.java From onedev with MIT License | 6 votes |
@Override protected void onBeforeRender() { if (!inited) { WebMarkupContainer dialog = new WebMarkupContainer("dialog"); add(dialog); dialog.add(newContent(CONTENT_ID)); String cssClass = getCssClass(); if (cssClass != null) dialog.add(AttributeAppender.append("class", cssClass)); inited = true; } super.onBeforeRender(); }
Example #10
Source File: SideBar.java From onedev with MIT License | 6 votes |
@Override protected void onInitialize() { super.onInitialize(); add(newHead("head")); add(new Tabbable("tabs", newTabs())); add(new WebMarkupContainer("miniToggle").setVisible(miniCookieKey!=null)); add(AttributeAppender.append("class", "sidebar")); if (miniCookieKey != null) { add(AttributeAppender.append("class", "minimizable")); WebRequest request = (WebRequest) RequestCycle.get().getRequest(); Cookie miniCookie = request.getCookie(miniCookieKey); if (miniCookie != null) { if ("yes".equals(miniCookie.getValue())) add(AttributeAppender.append("class", "minimized")); } else if (WicketUtils.isDevice()) { add(AttributeAppender.append("class", "minimized")); } } }
Example #11
Source File: PersonIdentPanel.java From onedev with MIT License | 6 votes |
@Override protected void onInitialize() { super.onInitialize(); add(new UserAvatar("avatar", personIdent).setVisible(mode != Mode.NAME)); add(new Label("name", personIdent.getName()).setVisible(mode != Mode.AVATAR)); add(AttributeAppender.append("class", "user")); add(new DropdownHoverBehavior(AlignPlacement.top(8), 350) { @Override protected Component newContent(String id) { return new PersonCardPanel(id, personIdent, gitRole); } }); }
Example #12
Source File: TextAreaFeatureEditor.java From webanno with Apache License 2.0 | 6 votes |
@Override protected AbstractTextComponent createInputField() { TextArea<String> textarea = new TextArea<>("value"); textarea.add(new AjaxPreventSubmitBehavior()); try { String traitsString = getModelObject().feature.getTraits(); StringFeatureTraits traits = JSONUtil.fromJsonString(StringFeatureTraits.class, traitsString); textarea.add(new AttributeModifier("rows", traits.getCollapsedRows())); textarea.add(new AttributeAppender("onfocus", "this.rows=" + traits.getExpandedRows() + ";")); textarea.add(new AttributeAppender("onblur", "this.rows=" + traits.getCollapsedRows() + ";")); } catch (IOException e) { e.printStackTrace(); } return textarea; }
Example #13
Source File: SideInfoPanel.java From onedev with MIT License | 6 votes |
@Override protected void onInitialize() { super.onInitialize(); add(newContent("content")); add(new AjaxLink<Void>("close") { @Override public void onClick(AjaxRequestTarget target) { String script = String.format("$('#%s').hide('slide', {direction: 'right', duration: 200});", SideInfoPanel.this.getMarkupId()); target.appendJavaScript(script); send(getPage(), Broadcast.BREADTH, new SideInfoClosed(target)); } }); add(AttributeAppender.append("class", "side-info closed")); }
Example #14
Source File: SidebarPanel.java From webanno with Apache License 2.0 | 6 votes |
public SidebarPanel(String aId, IModel<AnnotatorState> aModel, final AnnotationActionHandler aActionHandler, final CasProvider aCasProvider, AnnotationPage aAnnotationPage) { super(aId); Validate.notNull(aActionHandler, "Action handler must not be null"); setOutputMarkupId(true); setOutputMarkupPlaceholderTag(true); actionHandler = aActionHandler; casProvider = aCasProvider; annotationPage = aAnnotationPage; stateModel = aModel; tabsPanel = new SidebarTabbedPanel<>("leftSidebarContent", makeTabs()); add(tabsPanel); add(new AttributeAppender("class", () -> tabsPanel.isExpanded() ? "" : "collapsed", " ")); }
Example #15
Source File: BlobDiffPanel.java From onedev with MIT License | 5 votes |
private Fragment newFragment(String message, boolean warning) { Fragment fragment = new Fragment(CONTENT_ID, "noDiffFrag", this); fragment.add(new BlobDiffTitle("title", change)); if (warning) fragment.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", "fa fa-warning"))); else fragment.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", "fa fa-info-circle"))); fragment.add(new Label("message", message)); return fragment; }
Example #16
Source File: PullRequestActivitiesPage.java From onedev with MIT License | 5 votes |
private Component newSinceChangesRow(String id, Date sinceDate) { WebMarkupContainer row = new WebMarkupContainer(id); row.setOutputMarkupId(true); row.add(new WebMarkupContainer("avatar")); WebMarkupContainer contentColumn = new Fragment("content", "sinceChangesRowContentFrag", this); contentColumn.add(AttributeAppender.append("colspan", "2")); contentColumn.add(new SinceChangesLink("sinceChanges", requestModel, sinceDate)); row.add(contentColumn); row.add(AttributeAppender.append("class", "since-changes")); return row; }
Example #17
Source File: PullRequestActivitiesPage.java From onedev with MIT License | 5 votes |
private Component newActivityRow(String id, PullRequestActivity activity) { WebMarkupContainer row = new WebMarkupContainer(id, Model.of(activity)); row.setOutputMarkupId(true); String anchor = activity.getAnchor(); if (anchor != null) row.setMarkupId(anchor); if (activity.getUser() != null) row.add(new UserIdentPanel("avatar", activity.getUser(), Mode.AVATAR)); else row.add(new WebMarkupContainer("avatar")); Component content = activity.render("content", new DeleteCallback() { @Override public void onDelete(AjaxRequestTarget target) { row.remove(); target.appendJavaScript(String.format("$('#%s').remove();", row.getMarkupId())); } }); row.add(content); row.add(AttributeAppender.append("class", activity.getClass().getSimpleName())); return row; }
Example #18
Source File: GroupTabLink.java From onedev with MIT License | 5 votes |
@Override protected void onInitialize() { super.onInitialize(); GroupPage page = (GroupPage) getPage(); Link<Void> link = new ViewStateAwarePageLink<Void>("link", tab.getMainPageClass(), GroupPage.paramsOf(page.getGroup())); link.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", tab.getIconClass()))); link.add(new Label("label", tab.getTitleModel())); add(link); }
Example #19
Source File: NavigationPanel.java From the-app with Apache License 2.0 | 5 votes |
private Component homePageLink() { BookmarkablePageLink<Void> pageLink = new BookmarkablePageLink<>("home", ShopApplication.get().getHomePage()); pageLink.add(new AttributeAppender("class", Model.of("homePageLink"), " ")); if (((ShopSession) ShopSession.get()).isMicroServiceMode()) { return new ExternalLink("home", "http://shop.microservice.io"); } return pageLink; }
Example #20
Source File: StateStatsBar.java From onedev with MIT License | 5 votes |
@Override protected void onInitialize() { super.onInitialize(); int totalCount = getModelObject().values().stream().collect(Collectors.summingInt(it->it)); if (totalCount != 0) { RepeatingView statesView = new RepeatingView("states"); for (StateSpec state: OneDev.getInstance(SettingManager.class).getIssueSetting().getStateSpecs()) { Integer count = getModelObject().get(state.getName()); if (count != null) { Link<Void> link = newStateLink(statesView.newChildId(), state.getName()); link.add(AttributeAppender.append("title", count + " " + state.getName().toLowerCase() + " issues")); link.add(AttributeAppender.append("data-percent", count*1.0/totalCount)); link.add(AttributeAppender.append("style", "background-color: " + state.getColor())); statesView.add(link); } } add(statesView); } else { add(new Label("states", " ") { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.setName("span"); } }.setEscapeModelStrings(false)); add(AttributeAppender.append("title", "No issues in milestone")); } setOutputMarkupId(true); }
Example #21
Source File: PullRequestChangePanel.java From onedev with MIT License | 5 votes |
@Override protected void onInitialize() { super.onInitialize(); PullRequestChange change = getModelObject(); if (change.getUser() != null) add(new Label("user", change.getUser().getDisplayName())); else if (change.getUserName() != null) add(new Label("user", change.getUserName())); else add(new WebMarkupContainer("user").setVisible(false)); add(new Label("description", change.getData().getActivity(null))); add(new Label("age", DateUtils.formatAge(change.getDate()))); add(new SinceChangesLink("changes", new AbstractReadOnlyModel<PullRequest>() { @Override public PullRequest getObject() { return getChange().getRequest(); } }, getChange().getDate())); Component body = change.getData().render("body", change); if (body != null) { add(body); } else { add(new WebMarkupContainer("body").setVisible(false)); add(AttributeAppender.append("class", "no-body")); } }
Example #22
Source File: IssueStateLabel.java From onedev with MIT License | 5 votes |
@Override protected void onInitialize() { super.onInitialize(); Issue issue = issueModel.getObject(); StateSpec stateSpec = OneDev.getInstance(SettingManager.class).getIssueSetting().getStateSpec(issue.getState()); if (stateSpec != null) { String fontColor = ColorUtils.isLight(stateSpec.getColor())?"#333":"#f9f9f9"; String style = String.format("background-color: %s; color: %s;", stateSpec.getColor(), fontColor); add(AttributeAppender.append("style", style)); add(AttributeAppender.append("title", "State")); } add(AttributeAppender.append("class", "issue-state label")); }
Example #23
Source File: ModalPanel.java From onedev with MIT License | 5 votes |
@Override protected void onInitialize() { super.onInitialize(); add(new AbstractPostAjaxBehavior() { @Override protected void respond(AjaxRequestTarget target) { ModalPanel.this.remove(); onClosed(); } @Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(JavaScriptHeaderItem.forReference(new ModalResourceReference())); String script = String.format("onedev.server.modal.onDomReady('%s', %s);", getMarkupId(true), getCallbackFunction()); response.render(OnDomReadyHeaderItem.forScript(script)); } }); add(AttributeAppender.append("class", "modal")); setOutputMarkupId(true); }
Example #24
Source File: ProjectBlobPage.java From onedev with MIT License | 5 votes |
private void newSearchResult(@Nullable AjaxRequestTarget target, @Nullable List<QueryHit> hits) { Component content; if (hits != null) { content = new SearchResultPanel("content", this, hits) { @Override protected void onClose(AjaxRequestTarget target) { newSearchResult(target, null); resizeWindow(target); } }; if (target != null) { target.appendJavaScript("" + "$('#project-blob>.search-result').show(); " + "$('#project-blob .search-result>.body').focus();"); } } else { content = new WebMarkupContainer("content").setOutputMarkupId(true); if (target != null) target.appendJavaScript("$('#project-blob>.search-result').hide();"); else searchResult.add(AttributeAppender.replace("style", "display: none;")); } if (target != null) { searchResult.replace(content); target.add(content); } else { searchResult.add(content); } }
Example #25
Source File: UserTabLink.java From onedev with MIT License | 5 votes |
@Override protected void onInitialize() { super.onInitialize(); UserPage page = (UserPage) getPage(); Link<Void> link = new ViewStateAwarePageLink<Void>("link", tab.getMainPageClass(), UserPage.paramsOf(page.getUser())); if (tab.getIconClass() != null) link.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", tab.getIconClass()))); else link.add(new WebMarkupContainer("icon").setVisible(false)); link.add(new Label("label", tab.getTitleModel())); add(link); }
Example #26
Source File: TextFeatureEditorBase.java From webanno with Apache License 2.0 | 5 votes |
private Component createConstraintsInUseIndicatorContainer() { // Shows whether constraints are triggered or not // also shows state of constraints use. return new WebMarkupContainer("textIndicator") { private static final long serialVersionUID = 4346767114287766710L; @Override public boolean isVisible() { return getModelObject().indicator.isAffected(); } }.add(new AttributeAppender("class", new Model<String>() { private static final long serialVersionUID = -7683195283137223296L; @Override public String getObject() { // adds symbol to indicator return getModelObject().indicator.getStatusSymbol(); } })).add(new AttributeAppender("style", new Model<String>() { private static final long serialVersionUID = -5255873539738210137L; @Override public String getObject() { // adds color to indicator return "; color: " + getModelObject().indicator.getStatusColor(); } })); }
Example #27
Source File: AbstractActionItemLink.java From wicket-spring-boot with Apache License 2.0 | 5 votes |
public AbstractActionItemLink(IModel<T> label, IconType iconType){ AjaxLink<T> link = new AjaxLink<T>("link") { @Override public void onClick(AjaxRequestTarget target) { AbstractActionItemLink.this.onClick(target); } }; add(link); WebMarkupContainer webMarkupContainer = new WebMarkupContainer("icon-type"); webMarkupContainer.add(new AttributeAppender("class", "glyphicon glyphicon-" + iconType.getCssName())); link.add(webMarkupContainer); }
Example #28
Source File: VideoViewPanel.java From onedev with MIT License | 5 votes |
@Override protected void onInitialize() { super.onInitialize(); String url = RequestCycle.get().urlFor(new RawBlobDownloadResourceReference(), RawBlobDownloadResource.paramsOf(context.getProject(), context.getBlobIdent())).toString(); add(new WebMarkupContainer("video").add(AttributeAppender.append("src", url))); }
Example #29
Source File: WidgetPage.java From sakai with Educational Community License v2.0 | 5 votes |
@Override public void onInitialize() { super.onInitialize(); // setup the data for the page final Label data = new Label("data"); data.add(new AttributeAppender("data-siteid", getCurrentSiteId())); data.add(new AttributeAppender("data-tz", getUserTimeZone().getID())); data.add(new AttributeAppender("data-namespace", getNamespace())); add(data); }
Example #30
Source File: ProjectTabLink.java From onedev with MIT License | 5 votes |
@Override protected void onInitialize() { super.onInitialize(); Link<?> link = newLink("link", tab.getMainPageClass()); link.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", tab.getIconClass()))); link.add(new Label("text", tab.getTitleModel())); link.add(new Label("count", tab.getCount()).setVisible(tab.getCount()!=0)); add(link); }