private Widget createValuePairItem( final Annotation annotation, final AnnotationValuePairDefinition valuePairDefinition, final AnnotationSource annotationSource) { final Row valuePairRow = new Row(); final FormGroup formGroup = new FormGroup(); valuePairRow.add(formGroup); final FormLabel formLabel = new FormLabel(); formLabel.addStyleName(ColumnSize.MD_3.getCssName()); formLabel.setText(valuePairDefinition.getName()); formGroup.add(formLabel); final Column column = new Column(ColumnSize.MD_9); formGroup.add(column); final TextBox content = new TextBox(); column.add(content); final String valuePairString = getValuePairStringValue(annotation, valuePairDefinition, annotationSource); content.setText(valuePairString); content.setReadOnly(true); content.setTitle(valuePairString); final Button editButton = new Button( Constants.INSTANCE.advanced_domain_annotation_list_editor_action_edit(), new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onEditValuePair(annotation, valuePairDefinition.getName()); } }); editButton.setEnabled(!readonly); editButton.setIcon(IconType.EDIT); final Button clearButton = new Button( Constants.INSTANCE.advanced_domain_annotation_list_editor_action_clear(), new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onClearValuePair(annotation, valuePairDefinition.getName()); } }); clearButton.setEnabled(!readonly); clearButton.setIcon(IconType.ERASER); final FormGroup formGroupButton = new FormGroup(); formGroupButton.add(editButton); formGroupButton.add(clearButton); final Column columnButton = new Column(ColumnSize.MD_9); columnButton.setOffset(ColumnOffset.MD_3); columnButton.add(formGroupButton); valuePairRow.add(columnButton); return valuePairRow; }
@Override public void onResize() { final int height = getParent().getOffsetHeight() - VERTICAL_MARGIN; row.setHeight((height > 0 ? height : 0) + "px"); drlContainer.setHeight(((height > 0 ? height : 0) + SCROLL_BAR_SIZE) + "px"); drlEditor.onResize(); }
private void generateColumns(Row rowWidget, List<LayoutColumn> layoutColumns) { for (LayoutColumn layoutColumn : layoutColumns) { Column column = createColumn(layoutColumn); ColumnEditorWidget parent = new ColumnEditorWidget(row, column, layoutColumn.getSpan()); // Create the drop panel always, but don't add it to the column in case we're reloading an // existing layout, and the column already contains elements DropColumnPanel dropColumnPanel = generateDropColumnPanel(column, parent, !layoutColumn.hasElements()); for (LayoutRow editor : layoutColumn.getRows()) { column.add(createRowView(parent, dropColumnPanel, editor)); } for (LayoutComponent layoutComponent : layoutColumn.getLayoutComponents()) { final LayoutDragComponent layoutDragComponent = getLayoutDragComponent(layoutComponent); column.add(createLayoutComponentView(parent, layoutComponent, layoutDragComponent)); } rowWidget.add(column); } }
public void setup() { // BZ-996917: Use a the gwtboostrap style "row-fluid" to allow display some events in the same // row. eventTypes.setStyleName(Styles.ROW); // Fill panel with available events. for (Map.Entry<String, Boolean> e : auditLog.getAuditLogFilter().getAcceptedTypes().entrySet()) { eventTypes.add(makeEventTypeCheckBox(e.getKey(), e.getValue())); } // Create the GWT Cell Table as events container. // BZ-996942: Set custom width and table css style. events = new CellTable<AuditLogEntry>(); events.setWidth("100%"); events.addStyleName(Styles.TABLE); final ListDataProvider<AuditLogEntry> dlp = new ListDataProvider<AuditLogEntry>(filterDeletedEntries(auditLog)); dlp.addDataDisplay(events); AuditLogEntrySummaryColumn summaryColumn = new AuditLogEntrySummaryColumn(style.auditLogDetailLabel(), style.auditLogDetailValue()); AuditLogEntryCommentColumn commentColumn = new AuditLogEntryCommentColumn(); events.addColumn(summaryColumn); events.addColumn(commentColumn); events.setColumnWidth(summaryColumn, 60.0, Unit.PCT); events.setColumnWidth(commentColumn, 40.0, Unit.PCT); // If the current user is not an Administrator include the delete comment column if (identity.getRoles().contains(new RoleImpl(AppRoles.ADMIN.getName()))) { AuditLogEntryDeleteCommentColumn deleteCommentColumn = new AuditLogEntryDeleteCommentColumn(); deleteCommentColumn.setFieldUpdater( new FieldUpdater<AuditLogEntry, SafeHtml>() { public void update(int index, AuditLogEntry row, SafeHtml value) { row.setDeleted(true); dlp.setList(filterDeletedEntries(auditLog)); dlp.refresh(); } }); events.addColumn(deleteCommentColumn); events.setColumnWidth(commentColumn, 35.0, Unit.PCT); events.setColumnWidth(deleteCommentColumn, 5.0, Unit.PCT); } events.setEmptyTableWidget( new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogNoEntries())); events.setKeyboardPagingPolicy(KeyboardPagingPolicy.CHANGE_PAGE); events.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED); events.setPageSize(PAGE_SIZE); // Configure the simple pager. pager.setDisplay(events); pager.setPageSize(PAGE_SIZE); events.addRangeChangeHandler( new RangeChangeEvent.Handler() { @Override public void onRangeChange(final RangeChangeEvent event) { cellTablePagination.rebuild(pager); } }); cellTablePagination.rebuild(pager); // Add the table to the container. eventsContainer.add(events); }
private void generateHeaderRow(final Row rowWidget) { rowWidget.add(generateButtonColumn()); }
private void generateColumns(Row rowWidget) { for (String span : row.getRowSpans()) { Column column = createColumn(span); rowWidget.add(column); } }