List of usage examples for org.apache.wicket AttributeModifier prepend
public static AttributeAppender prepend(String attributeName, Serializable value)
From source file:com.evolveum.midpoint.web.component.data.TablePanel.java
License:Apache License
public TablePanel(String id, ISortableDataProvider provider, List<IColumn<T, String>> columns, int itemsPerPage) { super(id);// ww w .j a va 2 s .c o m Validate.notNull(provider, "Object type must not be null."); Validate.notNull(columns, "Columns must not be null."); add(AttributeModifier.prepend("style", "display: table; width: 100%;")); initLayout(columns, itemsPerPage, provider); }
From source file:org.devgateway.eudevfin.projects.module.components.panels.TransactionTableListPanel.java
@Override protected void populateTable() { final ModalWindow modal = AddModalWindow(null); // refreshItems(); this.itemsListView = new ListView<FinancialTransaction>("projectTransactionsList", items) { private static final long serialVersionUID = -8758662617501215830L; @Override//from w ww .j a v a 2 s . c om protected void populateItem(ListItem<FinancialTransaction> listItem) { final FinancialTransaction transaction = listItem.getModelObject(); AjaxLink linkToEdit = new AjaxLink("linkToEditTransaction") { @Override public void onClick(AjaxRequestTarget target) { PageParameters parameters = new PageParameters() .add(TransactionsTableModal.PARAM_TRANSACTION_ID, transaction.getId()); setParameters(parameters); AddModalWindow(parameters); modal.show(target); } }; linkToEdit.setBody(Model.of(transaction.getShortDescription())); String CRSId = transaction.getCrsIdentificationNumber() == null ? "" : transaction.getCrsIdentificationNumber(); Label CRSIdLabel = new Label("CRSId", CRSId); String geographicName = transaction.getRecipient() == null ? "" : transaction.getRecipient().getName(); Label geographicFocusLabel = new Label("geographicFocus", geographicName); String agencyName = transaction.getExtendingAgency() == null ? "" : transaction.getExtendingAgency().getName(); Label financingInstitutionLabel = new Label("financingInstitution", agencyName); Label reportingYearLabel = new Label("reportingYear", transaction.getReportingYear().getYear()); final CustomFinancialTransaction ctx = (CustomFinancialTransaction) transaction; Label amountUSD = new Label("amountUSD", RateUtil.moneyToString(rateUtil.exchange(transaction.getAmountsExtended(), CurrencyUnit.USD, ctx.getFixedRate(), RateUtil.getStartOfMonth(ctx.getCommitmentDate())))); Label amountRON = new Label("amountRON", transaction.getAmountsExtended().getAmount().toString()); Label amountEUR = new Label("amountEUR", RateUtil.moneyToString(rateUtil.exchange(transaction.getAmountsExtended(), CurrencyUnit.EUR, ctx.getFixedRate(), RateUtil.getStartOfMonth(ctx.getCommitmentDate())))); BootstrapDeleteButton delete = new BootstrapDeleteButton("delete", new StringResourceModel("delete", this, null)) { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { NewProjectPage.project.removeTransaction(transaction); TransactionTableListPanel newComp = new TransactionTableListPanel(WICKETID_LIST_PANEL, new ProjectTransactionsListGenerator( NewProjectPage.project.getProjectTransactions())); newComp.add(new AttributeAppender("class", "budget-table")); TransactionTableListPanel.this.replaceWith(newComp); target.add(newComp); } }; delete.add(AttributeModifier.remove("class")); delete.add(AttributeModifier.prepend("class", "round_delete")); listItem.add(linkToEdit); listItem.add(CRSIdLabel); listItem.add(geographicFocusLabel); listItem.add(financingInstitutionLabel); listItem.add(reportingYearLabel); listItem.add(amountUSD); listItem.add(amountRON); listItem.add(amountEUR); listItem.add(delete); } }; itemsListView.setOutputMarkupId(true); this.add(modal); this.add(itemsListView); }
From source file:org.projectforge.web.humanresources.HRPlanningEditForm.java
License:Open Source License
@SuppressWarnings("serial") void refresh() {//from w w w.j a v a2 s .com if (hasError() == true) { // Do nothing. return; } if (data.hasDeletedEntries() == false) { this.showDeletedOnly = false; } if (isNew() == true) { this.predecessorUpdToDate = false; } entriesRepeater.removeAll(); if (CollectionUtils.isEmpty(data.getEntries()) == true) { // Ensure that at least one entry is available: data.addEntry(new HRPlanningEntryDO()); } int idx = -1; dependentEntryFormComponents.clear(); dependentEntryFormComponentsArray = null; for (final HRPlanningEntryDO entry : data.getEntries()) { ++idx; if (entry.isDeleted() != showDeletedOnly) { // Don't show deleted/undeleted entries. continue; } final ToggleContainerPanel positionsPanel = new ToggleContainerPanel(entriesRepeater.newChildId()); positionsPanel.getContainer().setOutputMarkupId(true); entriesRepeater.add(positionsPanel); String heading = escapeHtml(entry.getProjektNameOrStatus()); if (StringUtils.isBlank(heading) == true) { heading = "???"; } final BigDecimal totalHours = entry.getTotalHours(); if (NumberHelper.isNotZero(totalHours) == true) { heading += ": " + NumberHelper.formatFraction2(totalHours); } positionsPanel.setHeading(new HtmlCodePanel(ToggleContainerPanel.HEADING_TEXT_ID, heading)); final DivPanel content = new DivPanel(ToggleContainerPanel.CONTENT_ID); positionsPanel.add(content); final GridBuilder posGridBuilder = new GridBuilder(content, content.newChildId(), true); { // DropDownChoice status / project final FieldsetPanel fs = posGridBuilder.newFieldset( WicketUtils.createMultipleFieldsetLabel(getString("status"), getString("fibu.projekt"))); final LabelValueChoiceRenderer<HRPlanningEntryStatus> statusChoiceRenderer = new LabelValueChoiceRenderer<HRPlanningEntryStatus>( fs, HRPlanningEntryStatus.values()); final DropDownChoice<HRPlanningEntryStatus> statusChoice = new DropDownChoice<HRPlanningEntryStatus>( fs.getDropDownChoiceId(), new PropertyModel<HRPlanningEntryStatus>(entry, "status"), statusChoiceRenderer.getValues(), statusChoiceRenderer); statusChoice.setNullValid(true).setRequired(false).setEnabled(!entry.isDeleted()); fs.add(statusChoice); dependentEntryFormComponents.add(statusChoice); final ProjektSelectPanel projektSelectPanel = new ProjektSelectPanel(fs.newChildId(), new PropertyModel<ProjektDO>(entry, "projekt"), parentPage, "projektId:" + idx); projektSelectPanel.setRequired(false).setEnabled(!entry.isDeleted()); fs.add(projektSelectPanel); projektSelectPanel.init(); dependentEntryFormComponents.add(projektSelectPanel); final Button button = new Button(SingleButtonPanel.WICKET_ID, new Model<String>("deleteUndelete")) { @Override public final void onSubmit() { if (entry.isDeleted() == true) { // Undelete entry.setDeleted(false); } else { getData().deleteEntry(entry); } refresh(); } }; final String buttonLabel, classNames; if (entry.isDeleted() == true) { buttonLabel = getString("undelete"); classNames = SingleButtonPanel.GREY; } else { buttonLabel = getString("delete"); classNames = SingleButtonPanel.DELETE; if (entry.getId() != null) { button.add(AttributeModifier.prepend("onclick", "if (showDeleteQuestionDialog() == false) return false;")); } } button.setDefaultFormProcessing(false); fs.add(new SingleButtonPanel(fs.newChildId(), button, buttonLabel, classNames) { }); } posGridBuilder.newSplitPanel(GridSize.COL50); { // DropDownChoice Priority final FieldsetPanel fs = posGridBuilder.newFieldset(getString("hr.planning.priority")); final LabelValueChoiceRenderer<Priority> priorityChoiceRenderer = new LabelValueChoiceRenderer<Priority>( fs, Priority.values()); final DropDownChoice<Priority> priorityChoice = new DropDownChoice<Priority>( fs.getDropDownChoiceId(), new PropertyModel<Priority>(entry, "priority"), priorityChoiceRenderer.getValues(), priorityChoiceRenderer); priorityChoice.setNullValid(true).setEnabled(!entry.isDeleted()); fs.add(priorityChoice); } posGridBuilder.newSplitPanel(GridSize.COL50); { // DropDownChoice probability final FieldsetPanel fs = posGridBuilder.newFieldset(getString("hr.planning.probability")); final LabelValueChoiceRenderer<Integer> probabilityChoiceRenderer = new LabelValueChoiceRenderer<Integer>(); probabilityChoiceRenderer.addValue(25, "25%"); probabilityChoiceRenderer.addValue(50, "50%"); probabilityChoiceRenderer.addValue(75, "75%"); probabilityChoiceRenderer.addValue(95, "95%"); probabilityChoiceRenderer.addValue(100, "100%"); final DropDownChoice<Integer> probabilityChoice = new DropDownChoice<Integer>( fs.getDropDownChoiceId(), new PropertyModel<Integer>(entry, "probability"), probabilityChoiceRenderer.getValues(), probabilityChoiceRenderer); probabilityChoice.setNullValid(true).setEnabled(!entry.isDeleted()); fs.add(probabilityChoice); } posGridBuilder.newSplitPanel(GridSize.COL50); { // Hours final FieldsetPanel fs = posGridBuilder.newFieldset(getString("hours")).supressLabelForWarning(); final HRPlanningEditTablePanel table = new HRPlanningEditTablePanel(fs.newChildId()); fs.add(table); table.init(entry); } posGridBuilder.newSplitPanel(GridSize.COL50); { // Description final FieldsetPanel fs = posGridBuilder.newFieldset(getString("hr.planning.description")); final IModel<String> model = new PropertyModel<String>(entry, "description"); final MaxLengthTextArea description = new MaxLengthTextArea(TextAreaPanel.WICKET_ID, model); if (entry.isDeleted() == true) { description.setEnabled(false); } fs.add(description); fs.add(new JiraIssuesPanel(fs.newChildId(), entry.getDescription())); fs.addJIRAField(model); } } }
From source file:sk.lazyman.gizmo.component.data.TablePanel.java
License:Apache License
public TablePanel(String id, ISortableDataProvider provider, List<IColumn<T, String>> columns, int rowsPerPage) { super(id);//www. ja va 2 s . c om Validate.notNull(provider, "Provider must not be null."); Validate.notNull(columns, "Columns must not be null."); add(AttributeModifier.prepend("style", "display: table; width: 100%;")); initLayout(columns, provider, rowsPerPage); }