use of com.google.gwt.user.client.ui.ScrollPanel in project perun by CESNET.
the class MemberSponsoredUsersTabItem method draw.
public Widget draw() {
if (member.getUser().isSponsoredUser()) {
this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(member.getUser().getFullNameWithTitles().trim()) + ": sponsors");
} else {
this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(member.getUser().getFullNameWithTitles().trim()) + ": sponsored users");
}
VerticalPanel vp = new VerticalPanel();
vp.setSize("100%", "100%");
// MENU
TabMenu menu = new TabMenu();
vp.add(menu);
vp.setCellHeight(menu, "30px");
menu.addWidget(UiElements.getRefreshButton(this));
if (member.getUser().isSponsoredUser()) {
// request
final GetUsersBySpecificUser request = new GetUsersBySpecificUser(member.getUserId());
request.setCheckable(false);
// table
CellTable<User> table;
if (session.isPerunAdmin()) {
table = request.getTable(new FieldUpdater<User, String>() {
public void update(int i, User user, String s) {
session.getTabManager().addTab(new UserDetailTabItem(user));
}
});
} else {
table = request.getTable();
}
table.addStyleName("perun-table");
table.setWidth("100%");
ScrollPanel sp = new ScrollPanel(table);
sp.addStyleName("perun-tableScrollPanel");
vp.add(sp);
} else {
final GetSpecificUsersByUser request = new GetSpecificUsersByUser(member.getUserId());
request.setCheckable(false);
request.setHideService(true);
// table
CellTable<User> table;
if (session.isPerunAdmin()) {
table = request.getTable(new FieldUpdater<User, String>() {
public void update(int i, User user, String s) {
session.getTabManager().addTab(new UserDetailTabItem(user));
}
});
} else {
table = request.getTable();
}
table.addStyleName("perun-table");
table.setWidth("100%");
ScrollPanel sp = new ScrollPanel(table);
sp.addStyleName("perun-tableScrollPanel");
vp.add(sp);
}
contentWidget.setWidget(vp);
return getWidget();
}
use of com.google.gwt.user.client.ui.ScrollPanel in project perun by CESNET.
the class AddGroupUnionTabItem method draw.
@Override
public Widget draw() {
titleWidget.setText("Add group union");
VerticalPanel vp = new VerticalPanel();
vp.setSize("100%", "100%");
// menu
TabMenu menu = new TabMenu();
menu.addWidget(new HTML(""));
final GetAllGroups groups = new GetAllGroups(group.getVoId());
groups.setCoreGroupsCheckable(true);
// remove already added union groups from offering
JsonCallbackEvents localEvents = new JsonCallbackEvents() {
@Override
public void onFinished(JavaScriptObject jso) {
// second callback
final GetGroupUnions alreadyAssigned = new GetGroupUnions(group, false, new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
JsArray<Group> esToRemove = JsonUtils.jsoAsArray(jso);
for (int i = 0; i < esToRemove.length(); i++) {
groups.removeFromTable(esToRemove.get(i));
}
// remove itself
groups.removeFromTable(group);
}
});
alreadyAssigned.retrieveData();
}
};
groups.setEvents(localEvents);
final ExtendedSuggestBox box = new ExtendedSuggestBox(groups.getOracle());
// button
final CustomButton assignButton = TabMenu.getPredefinedButton(ButtonType.ADD, ButtonTranslation.INSTANCE.addSelectedExtSource());
final TabItem tab = this;
assignButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final ArrayList<Group> groupsToAdd = groups.getTableSelectedList();
if (UiElements.cantSaveEmptyListDialogBox(groupsToAdd)) {
// FIXME - Should have only one callback to core
for (int i = 0; i < groupsToAdd.size(); i++) {
final int n = i;
AddGroupUnion request = new AddGroupUnion(JsonCallbackEvents.disableButtonEvents(assignButton, new JsonCallbackEvents() {
@Override
public void onFinished(JavaScriptObject jso) {
// unselect added person
groups.getSelectionModel().setSelected(groupsToAdd.get(n), false);
alreadyAddedList.add(groupsToAdd.get(n));
rebuildAlreadyAddedWidget();
// clear search
box.getSuggestBox().setText("");
}
}));
request.createGroupUnion(group, groupsToAdd.get(i));
}
}
}
});
menu.addFilterWidget(box, new PerunSearchEvent() {
@Override
public void searchFor(String text) {
groups.filterTable(text);
}
}, "Filter by ext source name or type");
menu.addWidget(assignButton);
menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CLOSE, "", new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
session.getTabManager().closeTab(tab, !alreadyAddedList.isEmpty());
}
}));
vp.add(menu);
vp.setCellHeight(menu, "30px");
vp.add(alreadyAdded);
CellTable<Group> table = groups.getTable();
assignButton.setEnabled(false);
JsonUtils.addTableManagedButton(groups, table, assignButton);
table.addStyleName("perun-table");
ScrollPanel sp = new ScrollPanel(table);
sp.addStyleName("perun-tableScrollPanel");
vp.add(sp);
// do not use resizePerunTable() when tab is in overlay - wrong width is calculated
session.getUiElements().resizePerunTable(sp, 350, this);
this.contentWidget.setWidget(vp);
return getWidget();
}
use of com.google.gwt.user.client.ui.ScrollPanel in project perun by CESNET.
the class UserExtSourceSettingsTabItem method draw.
public Widget draw() {
this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(userExtSource.getLogin().trim()));
// MAIN TAB PANEL
VerticalPanel vp = new VerticalPanel();
vp.setSize("100%", "100%");
// MENU
TabMenu menu = new TabMenu();
vp.add(menu);
vp.setCellHeight(menu, "30px");
final GetAttributesV2 callback = new GetAttributesV2(true);
callback.getUserExtSourceAttributes(userExtSource.getId());
final CellTable<Attribute> table = callback.getEmptyTable();
table.addStyleName("perun-table");
ScrollPanel sp = new ScrollPanel(table);
sp.addStyleName("perun-tableScrollPanel");
session.getUiElements().resizePerunTable(sp, 350, this);
menu.addWidget(UiElements.getRefreshButton(this));
// save changes in attributes
final CustomButton saveChangesButton = TabMenu.getPredefinedButton(ButtonType.SAVE, ButtonTranslation.INSTANCE.saveChangesInAttributes());
saveChangesButton.setEnabled(false);
saveChangesButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (UiElements.cantSaveEmptyListDialogBox(callback.getTableSelectedList())) {
SetAttributes request = new SetAttributes(JsonCallbackEvents.disableButtonEvents(saveChangesButton, new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
callback.clearTable();
callback.getUserExtSourceAttributes(userExtSourceId);
callback.retrieveData();
}
}));
final Map<String, Integer> ids = new HashMap<String, Integer>();
ids.put("userExtSource", userExtSourceId);
request.setAttributes(ids, callback.getTableSelectedList());
}
}
});
menu.addWidget(saveChangesButton);
// buttons
CustomButton setNewMemberAttributeButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.setNewAttributes(), new ClickHandler() {
public void onClick(ClickEvent event) {
Map<String, Integer> ids = new HashMap<String, Integer>();
ids.put("userExtSource", userExtSource.getId());
session.getTabManager().addTabToCurrentTab(new SetNewAttributeTabItem(ids), true);
}
});
menu.addWidget(setNewMemberAttributeButton);
// REMOVE ATTRIBUTES BUTTON
final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeAttributes());
removeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
// if selected
if (UiElements.cantSaveEmptyListDialogBox(callback.getTableSelectedList())) {
Map<String, Integer> ids = new HashMap<String, Integer>();
ids.put("userExtSource", userExtSource.getId());
RemoveAttributes request = new RemoveAttributes(JsonCallbackEvents.disableButtonEvents(removeButton, new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
callback.clearTable();
callback.getUserExtSourceAttributes(userExtSource.getId());
callback.retrieveData();
}
}));
// make removeAttributes call
request.removeAttributes(ids, callback.getTableSelectedList());
}
}
});
removeButton.setEnabled(false);
JsonUtils.addTableManagedButton(callback, table, removeButton);
menu.addWidget(removeButton);
callback.retrieveData();
// ATTRIBUTES TABLE
vp.add(sp);
vp.setCellHeight(sp, "100%");
this.contentWidget.setWidget(vp);
return getWidget();
}
use of com.google.gwt.user.client.ui.ScrollPanel in project gerrit by GerritCodeReview.
the class ProjectListPopup method initPopup.
public void initPopup(final String popupText, final String currentPageLink) {
createWidgets(popupText, currentPageLink);
final FlowPanel pfp = new FlowPanel();
pfp.add(filterPanel);
pfp.add(closeTop);
sp = new ScrollPanel(projectsTab);
sp.setSize("100%", "100%");
pfp.add(sp);
pfp.add(closeBottom);
popup.setWidget(pfp);
popup.setHeight("100%");
popupPosition = getPositionCallback();
}
use of com.google.gwt.user.client.ui.ScrollPanel in project che by eclipse.
the class ImageViewer method go.
/** {@inheritDoc} */
@Override
public void go(AcceptsOneWidget container) {
VerticalPanel panel = new VerticalPanel();
panel.setSize("100%", "100%");
panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
panel.add(getImage());
editorView = new ScrollPanel(panel);
editorView.getElement().getFirstChildElement().getStyle().setHeight(100, Unit.PCT);
container.setWidget(editorView);
}
Aggregations