List of usage examples for org.apache.wicket.behavior AttributeAppender AttributeAppender
public AttributeAppender(String attribute, IModel<?> appendModel, String separator)
From source file:biz.turnonline.ecosystem.origin.frontend.page.DecoratedPage.java
License:Apache License
protected Component newLogoutNavbarItem() { String script = "firebase.auth().signOut().then(function(){window.location.href='" + FrontendApplication.LOGOUT + "'});"; return new NavbarExternalLink(Model.of(FrontendApplication.LOGOUT)).setIconType(GlyphIconType.off) .setLabel(new I18NResourceModel("label.logout")).add(new AttributeAppender("onclick", script, ";")); }
From source file:com.aipo.mobycket.wicket.markup.html.panel.CssFeedbackPanel.java
License:Apache License
/** * cssClass??FeedbackPanel/*from w w w . j a v a2 s. c o m*/ * * @see org.apache.wicket.Component#Component(String) * * @param id * @param filter * @param cssClass */ public CssFeedbackPanel(final String id, IFeedbackMessageFilter filter, String cssClass) { super(id); WebMarkupContainer messagesContainer = new WebMarkupContainer("feedbackul") { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return anyMessage(); } }; add(messagesContainer); messageListView = new MessageListView("messages"); messageListView.setVersioned(false); messagesContainer.add(messageListView); messagesContainer.add(new AttributeAppender("class", new Model<String>(cssClass), " ")); if (filter != null) { setFilter(filter); } }
From source file:com.aipo.mobycket.wicket.markup.html.panel.CssFeedbackPanel.java
License:Apache License
/** * *///ww w . ja v a 2 s . c o m public void appendCssClass(String css) { this.messageListView.add(new AttributeAppender("", new Model<String>(css), " ")); }
From source file:com.axway.ats.testexplorer.pages.model.RunSuiteLinkColumn.java
License:Apache License
@Override public Component newCell(WebMarkupContainer parent, String componentId, IModel rowModel) { final Run run = (Run) rowModel.getObject(); Link<RunsPage> link = new Link<RunsPage>(componentId) { private static final long serialVersionUID = 1L; @Override/*from ww w .ja v a2 s .co m*/ protected CharSequence getURL() { // generate Bookmarkable link url PageParameters parameters = new PageParameters(); // pass the run id parameters.add("runId", String.valueOf(run.runId)); //pass database name parameters.add("dbname", ((TestExplorerSession) Session.get()).getDbName()); return urlFor(SuitesPage.class, parameters); } @Override public void onClick() { // This link acts like Bookmarkable link and don't have a click handler. } @Override protected void onComponentTag(final ComponentTag tag) { // make tag <div wicket:id="item"> to link (<a wicket:id="item">) tag.setName("a"); super.onComponentTag(tag); } @Override public void onComponentTagBody(MarkupStream markupStream, ComponentTag tag) { replaceComponentTagBody(markupStream, tag, "<span title=\"" + run.runName + "\">" + run.runName + "</span>"); } }; link.add(new AttributeAppender("class", new Model<String>("link"), " ")); return link; }
From source file:com.axway.ats.testexplorer.pages.model.ScenarioTestcasesLinkColumn.java
License:Apache License
@Override public Component newCell(WebMarkupContainer parent, String componentId, IModel rowModel) { final Scenario scenario = (Scenario) rowModel.getObject(); Link<ScenariosPage> link = new Link<ScenariosPage>(componentId) { private static final long serialVersionUID = 1L; @Override/*from ww w .j a v a 2s.c o m*/ protected CharSequence getURL() { PageParameters parameters = new PageParameters(); // pass the suite id parameters.add("suiteId", String.valueOf(scenario.suiteId)); // pass the scenario id parameters.add("scenarioId", String.valueOf(scenario.scenarioId)); //pass database name parameters.add("dbname", ((TestExplorerSession) Session.get()).getDbName()); return urlFor(TestcasesPage.class, parameters); } @Override public void onClick() { // This link acts like Bookmarkable link and don't have a click handler. } @Override protected void onComponentTag(final ComponentTag tag) { // make the tag <div wicket:id="item"> as link (<a wicket:id="item">) tag.setName("a"); super.onComponentTag(tag); } @Override public void onComponentTagBody(MarkupStream markupStream, ComponentTag tag) { replaceComponentTagBody(markupStream, tag, "<span title=\"" + scenario.name + "\">" + scenario.name + "</span>"); } }; link.add(new AttributeAppender("class", new Model("link"), " ")); link.add(new AttributeAppender("class", new Model("scenario-link"), " ")); return link; }
From source file:com.axway.ats.testexplorer.pages.model.SuiteScenarioLinkColumn.java
License:Apache License
@Override public Component newCell(WebMarkupContainer parent, String componentId, IModel rowModel) { final Suite suite = (Suite) rowModel.getObject(); Link<SuitesPage> link = new Link<SuitesPage>(componentId) { private static final long serialVersionUID = 1L; @Override/* ww w . j a v a 2s . c o m*/ protected CharSequence getURL() { PageParameters parameters = new PageParameters(); // pass the suite id parameters.add("suiteId", String.valueOf(suite.suiteId)); //pass database name parameters.add("dbname", ((TestExplorerSession) Session.get()).getDbName()); return urlFor(ScenariosPage.class, parameters); } @Override public void onClick() { // This link acts like Bookmarkable link and don't have a click handler. } @Override protected void onComponentTag(final ComponentTag tag) { // make the tag <div wicket:id="item"> as link (<a wicket:id="item">) tag.setName("a"); super.onComponentTag(tag); } @Override public void onComponentTagBody(MarkupStream markupStream, ComponentTag tag) { replaceComponentTagBody(markupStream, tag, "<span title=\"" + suite.name + "\">" + suite.name + "</span>"); } }; link.add(new AttributeAppender("class", new Model("link"), " ")); return link; }
From source file:com.axway.ats.testexplorer.pages.model.TestcasesTestcaseLinkColumn.java
License:Apache License
@Override public Component newCell(WebMarkupContainer parent, String componentId, IModel rowModel) { final Testcase testcase = (Testcase) rowModel.getObject(); Link<TestcasesPage> link = new Link<TestcasesPage>(componentId) { private static final long serialVersionUID = 1L; @Override/* w w w . ja v a2s. c o m*/ protected CharSequence getURL() { PageParameters parameters = new PageParameters(); // pass the testcase id parameters.add("testcaseId", String.valueOf(testcase.testcaseId)); //pass database name parameters.add("dbname", ((TestExplorerSession) Session.get()).getDbName()); return urlFor(TestcasePage.class, parameters); } @Override public void onClick() { // This link acts like Bookmarkable link and don't have a click handler. } @Override protected void onComponentTag(final ComponentTag tag) { // make the tag <div wicket:id="item"> as link (<a wicket:id="item">) tag.setName("a"); super.onComponentTag(tag); } @Override public void onComponentTagBody(MarkupStream markupStream, ComponentTag tag) { replaceComponentTagBody(markupStream, tag, "<span title=\"" + TestExplorerUtils.escapeHtmlCharacters(testcase.name) + "\">" + TestExplorerUtils.escapeHtmlCharacters(testcase.name) + "</span>"); } }; link.add(new AttributeAppender("class", new Model("link"), " ")); return link; }
From source file:com.axway.ats.testexplorer.pages.testcase.statistics.DataPanel.java
License:Apache License
/** * Display the collected//from ww w . j a v a 2 s. c o m * @param statsForm */ public void displayStatisticDescriptions(Form<Object> statsForm) { boolean isDataPanelVisible = machineDescriptions.size() > 0; List<List<StatisticsTableCell>> rows = new ArrayList<List<StatisticsTableCell>>(); List<StatisticsTableCell> columns = new ArrayList<StatisticsTableCell>(); // add machine columns columns.add(new StatisticsTableCell("<img class=\"arrowUD\" src=\"images/up.png\">", false)); columns.add(new StatisticsTableCell(this.name, false)); for (MachineDescription machine : machineDescriptions) { String machineName = machine.getMachineAlias(); if (SQLServerDbReadAccess.MACHINE_NAME_FOR_ATS_AGENTS.equals(machineName)) { machineName = ""; } StatisticsTableCell cell = new StatisticsTableCell( "<b style=\"padding: 0 5px;\">" + machineName + "</b>", false, "centeredLabel"); cell.cssClass = "fixTableColumn"; columns.add(cell); } rows.add(columns); // add empty row columns = new ArrayList<StatisticsTableCell>(); for (int i = 0; i < 2 + machineDescriptions.size(); i++) { columns.add(NBSP_EMPTY_CELL); } rows.add(columns); final Set<Integer> hiddenRowIndexes = new HashSet<Integer>(); for (StatisticContainer statContainer : statContainers.values()) { List<DbStatisticDescription> statDescriptions = sortQueueItems(statContainer.getStatDescriptions()); String lastStatParent = ""; for (DbStatisticDescription statDescription : statDescriptions) { String statisticLabel = "<span class=\"statName\">" + statDescription.name + "</span><span class=\"statUnit\">(" + statDescription.unit + ")</span>"; // add parent table line if needed String statParent = statDescription.parentName; if (!StringUtils.isNullOrEmpty(statParent) && !statParent.equals(StatisticsPanel.SYSTEM_STATISTIC_CONTAINER) && !lastStatParent.equals(statParent)) { columns = new ArrayList<StatisticsTableCell>(); columns.add(NBSP_EMPTY_CELL); if (statParent.startsWith(PROCESS_STAT_PREFIX)) { // only Process parent element can hide its children (it is not a good idea to hide the User actions behind queue names) columns.add(new StatisticsTableCell( "<a href=\"#\" onclick=\"showHiddenStatChildren(this);return false;\">" + statParent + "</a>", false, "parentStatTd")); } else { columns.add(new StatisticsTableCell(statParent, false, "parentStatTd")); } for (int i = 0; i < machineDescriptions.size(); i++) { columns.add(NBSP_EMPTY_CELL); } rows.add(columns); } lastStatParent = statParent; columns = new ArrayList<StatisticsTableCell>(); columns.add(new StatisticsTableCell(true)); StatisticsTableCell statName = new StatisticsTableCell(statisticLabel, true); statName.title = statDescription.params; columns.add(statName); for (MachineDescription machine : machineDescriptions) { Model<Boolean> selectionModel = machine.getStatDescriptionSelectionModel(statDescription); // selectionModel.getObject() should sometimes return // NULL - when comparing with other testcases if (selectionModel != null && selectionModel.getObject() != null) { columns.add(new StatisticsTableCell(selectionModel)); } else { columns.add(EMPTY_CELL); } } // hide only the Process child elements if (!StringUtils.isNullOrEmpty(lastStatParent) && lastStatParent.startsWith(PROCESS_STAT_PREFIX)) { // add current row number as a child row which must be hidden hiddenRowIndexes.add(rows.size()); } rows.add(columns); } } statisticsUIContainer = new ListView<List<StatisticsTableCell>>(uiPrefix + "StatsRows", rows) { private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem<List<StatisticsTableCell>> item) { // table TR if (item.getIndex() == 0) { item.add(AttributeModifier.replace("class", "statisticsHeaderRow")); item.add(AttributeModifier.replace("onclick", "showOrHideTableRows('" + uiPrefix + "StatsTable',1,true);")); } else if (item.getIndex() > 3) { // skip the machines,label and // measurement rows item.add(AttributeModifier.replace("class", "statisticRow")); } if (hiddenRowIndexes.contains(item.getIndex())) { item.add(new AttributeAppender("class", new Model<String>("hiddenStatRow"), " ")); } item.add(new ListView<StatisticsTableCell>(uiPrefix + "StatsColumns", item.getModelObject()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem<StatisticsTableCell> item) { // table TD if (item.getIndex() > 0) { // skip the first (CheckBox) // column item.add(AttributeModifier.replace("class", "statisticColumn")); } StatisticsTableCell cell = item.getModelObject(); CheckBox checkBox = new CheckBox("checkbox", cell.checkboxModel); if (cell.isCheckbox) { if (item.getIndex() == 0) { // this is the first/main CheckBox // binding onclick function which will (un)select all the CheckBoxes on that row // and will change the line color if it is selected or not checkBox.add(AttributeModifier.replace("onclick", "selectAllCheckboxes(this,'" + uiPrefix + "StatsTable');")); checkBox.add(AttributeModifier.replace("class", "allMachinesCheckbox")); } else { // binding onclick function which will (un)select the main/first CheckBox on that row // when all the CheckBoxes are selected or some are unselected. // Also the row/cell color will be changed. checkBox.add(AttributeModifier.replace("onclick", "unselectMainTrCheckbox(this,'" + uiPrefix + "StatsTable');")); checkBox.add(AttributeModifier.replace("class", "machineCheckbox")); item.add(AttributeModifier.replace("class", "statisticColumnWithCheckboxOnly")); } } else { checkBox.setVisible(false); } item.add(checkBox); Label label = new Label("label", cell.labelText); label.setEscapeModelStrings(false).setVisible(!cell.isCheckbox && !cell.isInputText); if (cell.isCheckboxLabel) { // binding JavaScript function which will click on the first/main CheckBox of this statistic label.add(AttributeModifier.replace("onclick", "clickSelectAllCheckbox(this);")); label.add(AttributeModifier.replace("class", "checkboxLabel noselection")); if (cell.title != null && !cell.title.isEmpty()) { String title = cell.title; int readingStartIndex = cell.title.indexOf(PARAMS_READING_UNIQUENESS_MAKRER); if (readingStartIndex > 0) { title = cell.title.substring(0, readingStartIndex) + cell.title.substring(cell.title.indexOf("_", readingStartIndex + 1)); } label.add(AttributeModifier.replace("title", title.replace("_", ", ").trim())); } } else if (label.isVisible() && cell.cssClass != null) { label.add(AttributeModifier.replace("class", cell.cssClass)); } item.add(label); Label machineAliasLabel = new Label("inputText", cell.getMachineLabelModel()); machineAliasLabel.setVisible(cell.isInputText); if (cell.getMachineLabelModel() != null && cell.getMachineLabelModel().getObject() != null) { machineAliasLabel.setOutputMarkupId(true); machineAliasLabel.add( AttributeModifier.replace("title", cell.getMachineLabelModel().getObject())); globalPanel.rememberMachineAliasLabel(machineAliasLabel); } item.add(machineAliasLabel); } }); } }; statisticsUIContainer.setVisible(isDataPanelVisible); statsForm.add(statisticsUIContainer); }
From source file:com.evolveum.midpoint.gui.api.component.result.OperationResultPanel.java
License:Apache License
private void initDetails(WebMarkupContainer box, Page parentPage) { final WebMarkupContainer details = new WebMarkupContainer("details", getModel()); details.setOutputMarkupId(true);//from w ww . j a v a2 s. com details.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return getModel().getObject().isShowMore(); } }); box.add(details); WebMarkupContainer operationPanel = new WebMarkupContainer("type"); operationPanel.setOutputMarkupId(true); operationPanel.add(new AttributeAppender("class", new LoadableModel<String>() { private static final long serialVersionUID = 1L; @Override protected String load() { return getLabelCss(getModel()); } }, " ")); details.add(operationPanel); Label operationLabel = new Label("operationLabel", parentPage.getString("FeedbackAlertMessageDetails.operation")); operationLabel.setOutputMarkupId(true); operationPanel.add(operationLabel); Label operation = new Label("operation", new LoadableModel<Object>() { private static final long serialVersionUID = 1L; @Override protected Object load() { OpResult result = getModelObject(); String resourceKey = OPERATION_RESOURCE_KEY_PREFIX + result.getOperation(); return getPage().getString(resourceKey, null, resourceKey); } }); operation.setOutputMarkupId(true); operationPanel.add(operation); Label count = new Label("countLabel", parentPage.getString("FeedbackAlertMessageDetails.count")); count.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { OpResult result = getModelObject(); return result.getCount() > 1; } }); operationPanel.add(count); operationPanel.add(initCountPanel(getModel())); Label message = new Label("resultMessage", new PropertyModel<String>(getModel(), "message").getObject());// PageBase.new // PropertyModel<String>(model, // "message")); message.setOutputMarkupId(true); message.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return StringUtils.isNotBlank(getModelObject().getMessage()); } }); operationPanel.add(message); Label messageLabel = new Label("messageLabel", parentPage.getString("FeedbackAlertMessageDetails.message")); messageLabel.setOutputMarkupId(true); messageLabel.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return StringUtils.isNotBlank(getModelObject().getMessage()); } }); operationPanel.add(messageLabel); initParams(operationPanel, getModel(), parentPage); initContexts(operationPanel, getModel(), parentPage); initError(operationPanel, getModel(), parentPage); }
From source file:com.evolveum.midpoint.web.component.accordion.Accordion.java
License:Apache License
public Accordion(String id) { super(id);//from www. j ava 2 s .co m add(new AttributeAppender("class", new Model<String>("accordions"), " ")); WebMarkupContainer parent = new WebMarkupContainer("parent"); parent.setOutputMarkupId(true); addToBorder(parent); }