use of com.google.gwt.safehtml.shared.SafeHtml in project rstudio by rstudio.
the class MarkerSetsToolbarButton method updateAvailableMarkerSets.
public void updateAvailableMarkerSets(String[] sets) {
ToolbarPopupMenu menu = getMenu();
menu.clearItems();
for (final String set : sets) {
// command for selection
Scheduler.ScheduledCommand cmd = new Scheduler.ScheduledCommand() {
@Override
public void execute() {
ValueChangeEvent.fire(MarkerSetsToolbarButton.this, set);
}
};
SafeHtml menuHTML = new SafeHtmlBuilder().appendHtmlConstant(set).toSafeHtml();
menu.addItem(new MenuItem(menuHTML, cmd));
}
}
use of com.google.gwt.safehtml.shared.SafeHtml in project blogwt by billy1380.
the class MetaNotificationsPage method modes.
SafeHtml modes(List<NotificationModeType> modes) {
SafeHtmlBuilder b = new SafeHtmlBuilder();
boolean first = true;
for (NotificationModeType t : Arrays.stream(NotificationModeType.values()).sorted((l, r) -> l.toString().compareTo(r.toString())).collect(Collectors.toList())) {
if (!first) {
b.appendEscaped(" ");
} else {
first = false;
}
b.appendEscaped(t.toString() + "(");
if (modes == null || !modes.contains(t)) {
b.append(PagesPageTemplates.INSTANCE.no());
} else {
b.append(PagesPageTemplates.INSTANCE.yes());
}
b.appendEscaped(")");
}
return b.toSafeHtml();
}
use of com.google.gwt.safehtml.shared.SafeHtml in project blogwt by billy1380.
the class UsersPage method createColumns.
/**
* create columns
*/
private void createColumns() {
Column<User, String> avatar = new Column<User, String>(UiHelper.IMAGE_PROTOTYPE) {
@Override
public String getValue(User object) {
return object.avatar + "?s=" + UserHelper.AVATAR_HEADER_SIZE + "&default=retro";
}
};
tblUsers.setColumnWidth(avatar, 20.0, Unit.PX);
TextColumn<User> username = new TextColumn<User>() {
@Override
public String getValue(User object) {
return object.username;
}
};
TextColumn<User> name = new TextColumn<User>() {
@Override
public String getValue(User object) {
return UserHelper.name(object);
}
};
Column<User, SafeHtml> email = new Column<User, SafeHtml>(UiHelper.SAFE_HTML_PROTOTYPE) {
@Override
public SafeHtml getValue(User object) {
return UsersPageTemplates.INSTANCE.emailLink(object.email, UserHelper.emailDescription(object));
}
};
TextColumn<User> lastLoggedIn = new TextColumn<User>() {
@Override
public String getValue(User object) {
return DateTimeHelper.ago(object.lastLoggedIn);
}
};
Column<User, SafeHtml> edit = new Column<User, SafeHtml>(UiHelper.SAFE_HTML_PROTOTYPE) {
@Override
public SafeHtml getValue(User object) {
return UiHelper.TEMPLATES.xsEdit(PageTypeHelper.asHref(PageType.ChangeDetailsPageType, "id", object.id.toString()));
}
};
tblUsers.setColumnWidth(edit, 1.0, Unit.PX);
Column<User, String> suspend = new Column<User, String>(UiHelper.ACTION_PROTOTYPE) {
@Override
public String getValue(User object) {
return UserHelper.isSuspended(object) ? "unsuspend" : "suspend";
}
};
suspend.setFieldUpdater(new FieldUpdater<User, String>() {
@Override
public void update(int index, User object, String value) {
boolean suspended = UserHelper.isSuspended(object);
if (suspended) {
UserController.get().unsuspendUser(object);
} else {
if (Window.confirm("Are you sure you want to suspend " + object.username + "'s account indefinitely?")) {
UserController.get().suspendUser(object);
}
}
}
});
tblUsers.setColumnWidth(suspend, 1.0, Unit.PX);
Column<User, String> admin = new Column<User, String>(UiHelper.ACTION_PROTOTYPE) {
@Override
public String getValue(User object) {
return "admin";
}
};
final Role adminRole = RoleHelper.createFullAdmin();
admin.setFieldUpdater(new FieldUpdater<User, String>() {
@Override
public void update(int index, User object, String value) {
if (Window.confirm("Are you sure you want to make " + object.username + " a " + adminRole.name + "?")) {
UserController.get().assignUserRoles(object, adminRole);
}
}
});
tblUsers.setColumnWidth(admin, 1.0, Unit.PX);
tblUsers.addColumn(avatar);
tblUsers.addColumn(username, "Username");
tblUsers.addColumn(name, "Name");
tblUsers.addColumn(email, "E-mail");
tblUsers.addColumn(lastLoggedIn, "Last seen");
tblUsers.addColumn(edit);
tblUsers.addColumn(admin);
tblUsers.addColumn(suspend);
}
use of com.google.gwt.safehtml.shared.SafeHtml in project drools-wb by kiegroup.
the class IssuePresenter method clear.
public void clear() {
view.setIssueTitle("");
view.setExplanation(new SafeHtml() {
@Override
public String asString() {
return "";
}
});
view.setLines("");
view.hideLines();
}
use of com.google.gwt.safehtml.shared.SafeHtml in project drools-wb by kiegroup.
the class AuditLogViewImpl method setup.
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<>();
events.setWidth("100%");
events.addStyleName(Styles.TABLE);
dlp = new ListDataProvider<AuditLogEntry>() {
@Override
public void setList(final List<AuditLogEntry> listToWrap) {
super.setList(listToWrap);
cellTablePagination.rebuild(pager);
}
};
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((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);
// Add the table to the container.
eventsContainer.add(events);
}
Aggregations