use of com.google.gwt.user.client.ui.SimplePanel in project perun by CESNET.
the class FindPublicationsByGUIFilter method getEmptyTable.
/**
* Returns table of users publications
* @return
*/
public CellTable<Publication> getEmptyTable() {
// Table data provider.
dataProvider = new ListDataProvider<Publication>(list);
// Cell table
table = new PerunTable<Publication>(list);
// display row-count for perun admin only
if (!session.isPerunAdmin()) {
table.removeRowCountChangeHandler();
}
// Connect the table to the data provider.
dataProvider.addDataDisplay(table);
// Sorting
ListHandler<Publication> columnSortHandler = new ListHandler<Publication>(dataProvider.getList());
table.addColumnSortHandler(columnSortHandler);
// table selection
table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<Publication>createCheckboxManager());
// set empty content & loader
table.setEmptyTableWidget(loaderImage);
loaderImage.setEmptyResultMessage("No publications found. Try to change filtering options.");
// show checkbox column
if (this.checkable) {
table.addCheckBoxColumn();
}
// ID COLUMN
table.addIdColumn("Publication ID", tableFieldUpdater, 60);
Column<Publication, ImageResource> lockedColumn = new Column<Publication, ImageResource>(new CustomImageResourceCell("click")) {
public ImageResource getValue(Publication object) {
if (object.isLocked()) {
return SmallIcons.INSTANCE.lockIcon();
} else {
return SmallIcons.INSTANCE.lockOpenIcon();
}
}
public void onBrowserEvent(final Context context, final Element elem, final Publication object, NativeEvent event) {
// on click and for perun admin
if ("click".equals(event.getType()) && session.isPerunAdmin()) {
final ImageResource value;
if (object.isLocked()) {
value = SmallIcons.INSTANCE.lockOpenIcon();
object.setLocked(false);
} else {
value = SmallIcons.INSTANCE.lockIcon();
object.setLocked(true);
}
LockUnlockPublications request = new LockUnlockPublications(new JsonCallbackEvents() {
@Override
public void onLoadingStart() {
getCell().setValue(context, elem, SmallIcons.INSTANCE.updateIcon());
}
@Override
public void onFinished(JavaScriptObject jso) {
// change picture (object already changed)
getCell().setValue(context, elem, value);
}
@Override
public void onError(PerunError error) {
// on error switch object back
if (object.isLocked()) {
object.setLocked(false);
getCell().setValue(context, elem, SmallIcons.INSTANCE.lockOpenIcon());
} else {
object.setLocked(true);
getCell().setValue(context, elem, SmallIcons.INSTANCE.lockIcon());
}
}
});
// send request
ArrayList<Publication> list = new ArrayList<Publication>();
list.add(object);
request.lockUnlockPublications(object.isLocked(), list);
}
}
};
table.addColumn(lockedColumn, "Lock");
// TITLE COLUMN
Column<Publication, String> titleColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Publication, String>() {
public String getValue(Publication object) {
return object.getTitle();
}
}, this.tableFieldUpdater);
titleColumn.setSortable(true);
columnSortHandler.setComparator(titleColumn, new PublicationComparator(PublicationComparator.Column.TITLE));
table.addColumn(titleColumn, "Title");
// if display authors
if (ids.containsKey("authors")) {
if ((Integer) ids.get("authors") == 1) {
// AUTHORS COLUMN
Column<Publication, String> authorColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Publication, String>() {
public String getValue(Publication object) {
return object.getAuthorsFormatted();
}
}, this.tableFieldUpdater);
authorColumn.setSortable(true);
columnSortHandler.setComparator(authorColumn, new PublicationComparator(PublicationComparator.Column.AUTHORS));
table.addColumn(authorColumn, "Reported by");
}
}
// YEAR COLUMN
Column<Publication, String> yearColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Publication, String>() {
public String getValue(Publication object) {
return String.valueOf(object.getYear());
}
}, this.tableFieldUpdater);
yearColumn.setSortable(true);
columnSortHandler.setComparator(yearColumn, new PublicationComparator(PublicationComparator.Column.YEAR));
table.addColumn(yearColumn, "Year");
// CATEGORY COLUMN
Column<Publication, String> categoryColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Publication, String>() {
public String getValue(Publication object) {
return object.getCategoryName();
}
}, this.tableFieldUpdater);
categoryColumn.setSortable(true);
columnSortHandler.setComparator(categoryColumn, new PublicationComparator(PublicationComparator.Column.CATEGORY));
table.addColumn(categoryColumn, "Category");
// THANKS COLUMN
Column<Publication, String> thanksColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Publication, String>() {
public String getValue(Publication object) {
String result = "";
JsArray<Thanks> thks = object.getThanks();
for (int i = 0; i < thks.length(); i++) {
result += thks.get(i).getOwnerName() + ", ";
}
if (result.length() >= 2) {
result = result.substring(0, result.length() - 2);
}
return result;
}
}, this.tableFieldUpdater);
thanksColumn.setSortable(true);
columnSortHandler.setComparator(thanksColumn, new PublicationComparator(PublicationComparator.Column.THANKS));
table.addColumn(thanksColumn, "Thanked to");
/*
* HIDE ISBN COLUMN FOR NOW
// ISBN COLUMN
Column<Publication, String> isbnColumn = JsonUtils.addColumn(
new CustomClickableTextCell(), "",
new JsonUtils.GetValue<Publication, String>() {
public String getValue(Publication object) {
return object.getIsbn();
}
}, this.tableFieldUpdater);
isbnColumn.setSortable(true);
columnSortHandler.setComparator(isbnColumn, new PublicationComparator(PublicationComparator.Column.ISBN));
table.addColumn(isbnColumn, "ISBN");
*/
// CITE COLUMN
Column<Publication, String> citaceColumn = JsonUtils.addColumn(new JsonUtils.GetValue<Publication, String>() {
public String getValue(Publication object) {
return "Cite";
}
}, new FieldUpdater<Publication, String>() {
public void update(int index, Publication object, String value) {
SimplePanel sp = new SimplePanel();
sp.add(new HTML(object.getMain()));
Confirm cf = new Confirm("Cite publication", sp, true);
cf.show();
}
});
table.addColumn(citaceColumn, "Cite");
return table;
}
use of com.google.gwt.user.client.ui.SimplePanel in project pentaho-platform by pentaho.
the class SolutionBrowserPanel method buildUI.
private void buildUI() {
FlowPanel topPanel = new FlowPanel();
SimplePanel toolbarWrapper = new SimplePanel();
toolbarWrapper.setWidget(new BrowserToolbar());
// $NON-NLS-1$
toolbarWrapper.setStyleName("files-toolbar");
topPanel.add(toolbarWrapper);
topPanel.add(new SolutionTreeWrapper(solutionTree));
solutionNavigatorPanel.setStyleName("puc-vertical-split-panel");
solutionNavigatorPanel.setWidth("100%");
solutionNavigatorPanel.addNorth(topPanel, 500);
solutionNavigatorPanel.add(filesListPanel);
navigatorAndContentSplit.setStyleName("puc-horizontal-split-panel");
navigatorAndContentSplit.addWest(solutionNavigatorPanel, 300);
navigatorAndContentSplit.add(contentTabPanel);
navigatorAndContentSplit.getElement().setAttribute("id", "solutionNavigatorAndContentPanel");
Window.addResizeHandler(new ResizeHandler() {
@Override
public void onResize(ResizeEvent event) {
adjustContentPanelSize();
}
});
solutionNavigatorPanel.getElement().getParentElement().addClassName("puc-navigator-panel");
solutionNavigatorPanel.getElement().getParentElement().removeAttribute("style");
// $NON-NLS-1$
setStyleName("panelWithTitledToolbar");
// $NON-NLS-1$
setHeight("100%");
// $NON-NLS-1$
setWidth("100%");
add(navigatorAndContentSplit);
sinkEvents(Event.MOUSEEVENTS);
navigatorAndContentSplit.getWidget(1).setWidth("100%");
navigatorAndContentSplit.getElement().getStyle().setHeight(1, Unit.PX);
contentTabPanel.getElement().getStyle().setHeight(1, Unit.PX);
}
use of com.google.gwt.user.client.ui.SimplePanel in project pentaho-platform by pentaho.
the class UserRolesAdminPanel method createRolesPanel.
private Widget createRolesPanel() {
HorizontalPanel mainRolesPanel = new HorizontalPanel();
mainRolesPanel.getElement().setId("admin-roles-panel");
SimplePanel hSpacer = new SimplePanel();
hSpacer.setWidth("15px");
mainRolesPanel.add(hSpacer);
VerticalPanel availablePanel = new VerticalPanel();
mainRolesPanel.add(availablePanel);
hSpacer = new SimplePanel();
hSpacer.setHeight("15px");
availablePanel.add(hSpacer);
HorizontalPanel labelAndButtonsPanel = new HorizontalPanel();
labelAndButtonsPanel.setWidth("100%");
availablePanel.add(labelAndButtonsPanel);
Label rolesLabel = new Label(Messages.getString("roles"));
labelAndButtonsPanel.add(rolesLabel);
labelAndButtonsPanel.setCellWidth(rolesLabel, "100%");
hSpacer = new SimplePanel();
hSpacer.setWidth("100%");
labelAndButtonsPanel.add(hSpacer);
labelAndButtonsPanel.setCellWidth(hSpacer, "100%");
newRoleButton = new ThemeableImageButton(addButtonStyles, null, Messages.getString("new"));
labelAndButtonsPanel.add(newRoleButton);
hSpacer = new SimplePanel();
hSpacer.setWidth("7px");
labelAndButtonsPanel.add(hSpacer);
deleteRoleButton = new ThemeableImageButton(removeButtonStyles, null, Messages.getString("delete"));
labelAndButtonsPanel.add(deleteRoleButton);
rolesListBox = new ListBoxTitle(true);
HorizontalScrollWrapper rolesListBoxWrapper = new HorizontalScrollWrapper(rolesListBox);
availablePanel.add(rolesListBoxWrapper);
availablePanel.setCellHeight(rolesListBoxWrapper, "100%");
rolesListBox.setVisibleItemCount(20);
rolesListBox.addStyleName("users-roles-list");
hSpacer = new SimplePanel();
hSpacer.setWidth("24px");
mainRolesPanel.add(hSpacer);
VerticalPanel detailsPanel = new VerticalPanel();
mainRolesPanel.add(detailsPanel);
mainRolesPanel.setCellWidth(detailsPanel, "100%");
hSpacer = new SimplePanel();
hSpacer.setHeight("15px");
detailsPanel.add(hSpacer);
// todo check if replacement required
rolesPermissionsPanel = new PermissionsPanel(rolesListBox);
detailsPanel.add(rolesPermissionsPanel);
usersLabelPanel = new VerticalPanel();
Label usersLabel = new Label(Messages.getString("users"));
usersLabel.setStyleName("pentaho-fieldgroup-minor");
hSpacer = new SimplePanel();
hSpacer.setHeight("15px");
usersLabelPanel.add(hSpacer);
usersLabelPanel.add(usersLabel);
hSpacer = new SimplePanel();
hSpacer.setHeight("15px");
usersLabelPanel.add(hSpacer);
detailsPanel.add(usersLabelPanel);
usersPanel = new HorizontalPanel();
usersPanel.getElement().setId("users-panel");
detailsPanel.add(usersPanel);
VerticalPanel availableMembersPanel = new VerticalPanel();
usersPanel.add(availableMembersPanel);
availableMembersPanel.add(new Label(Messages.getString("available") + ":"));
availableMembersListBox = new ListBoxTitle(true);
HorizontalScrollWrapper availableMembersListBoxWrapper = new HorizontalScrollWrapper(availableMembersListBox);
availableMembersPanel.add(availableMembersListBoxWrapper);
availableMembersListBox.setVisibleItemCount(20);
availableMembersListBox.addStyleName("users-roles-selection-list");
VerticalPanel vSpacer = new VerticalPanel();
vSpacer.setWidth("15px");
usersPanel.add(vSpacer);
VerticalPanel arrowsPanel = new VerticalPanel();
usersPanel.add(arrowsPanel);
arrowsPanel.setWidth("35px");
hSpacer = new SimplePanel();
hSpacer.setHeight("80px");
arrowsPanel.add(hSpacer);
addUserButton = new ThemeableImageButton(accumAddButtonStyles, null, null);
arrowsPanel.add(addUserButton);
hSpacer = new SimplePanel();
hSpacer.setHeight("10px");
arrowsPanel.add(hSpacer);
removeUserButton = new ThemeableImageButton(accumRemoveButtonStyles, null, null);
arrowsPanel.add(removeUserButton);
hSpacer = new SimplePanel();
hSpacer.setHeight("30px");
arrowsPanel.add(hSpacer);
addAllUsersButton = new ThemeableImageButton(accumAddAllButtonStyles, null, null);
arrowsPanel.add(addAllUsersButton);
hSpacer = new SimplePanel();
hSpacer.setHeight("10px");
arrowsPanel.add(hSpacer);
removeAllUsersButton = new ThemeableImageButton(accumRemoveAllButtonStyles, null, null);
arrowsPanel.add(removeAllUsersButton);
VerticalPanel selectedMembersPanel = new VerticalPanel();
usersPanel.add(selectedMembersPanel);
selectedMembersPanel.add(new Label(Messages.getString("selected") + ":"));
selectedMembersListBox = new ListBoxTitle(true);
HorizontalScrollWrapper selectedMembersListBoxWrapper = new HorizontalScrollWrapper(selectedMembersListBox);
selectedMembersPanel.add(selectedMembersListBoxWrapper);
selectedMembersListBox.setVisibleItemCount(20);
selectedMembersListBox.addStyleName("users-roles-selection-list");
return mainRolesPanel;
}
use of com.google.gwt.user.client.ui.SimplePanel in project pentaho-platform by pentaho.
the class UserRolesAdminPanel method createUsersPanel.
private Widget createUsersPanel() {
HorizontalPanel mainUsersPanel = new HorizontalPanel();
mainUsersPanel.getElement().setId("admin-users-panel");
// mainUsersPanel.setWidth("376px");
SimplePanel hSpacer = new SimplePanel();
hSpacer.setWidth("15px");
mainUsersPanel.add(hSpacer);
VerticalPanel availablePanel = new VerticalPanel();
mainUsersPanel.add(availablePanel);
hSpacer = new SimplePanel();
hSpacer.setHeight("15px");
availablePanel.add(hSpacer);
HorizontalPanel labelAndButtonsPanel = new HorizontalPanel();
labelAndButtonsPanel.setWidth("100%");
availablePanel.add(labelAndButtonsPanel);
Label usersColonLabel = new Label(Messages.getString("usersColon"));
labelAndButtonsPanel.add(usersColonLabel);
labelAndButtonsPanel.setCellWidth(usersColonLabel, "100%");
hSpacer = new SimplePanel();
hSpacer.setWidth("100%");
labelAndButtonsPanel.add(hSpacer);
labelAndButtonsPanel.setCellWidth(hSpacer, "100%");
newUserButton = new ThemeableImageButton(addButtonStyles, null, Messages.getString("new"));
labelAndButtonsPanel.add(newUserButton);
hSpacer = new SimplePanel();
hSpacer.setWidth("7px");
labelAndButtonsPanel.add(hSpacer);
deleteUserButton = new ThemeableImageButton(removeButtonStyles, null, Messages.getString("delete"));
labelAndButtonsPanel.add(deleteUserButton);
usersListBox = new ListBoxTitle(true);
usersListBox.addStyleName("users-roles-list");
HorizontalScrollWrapper usersListBoxWrapper = new HorizontalScrollWrapper(usersListBox);
availablePanel.add(usersListBoxWrapper);
availablePanel.setCellHeight(usersListBoxWrapper, "100%");
usersListBox.setVisibleItemCount(20);
hSpacer = new SimplePanel();
hSpacer.setWidth("24px");
mainUsersPanel.add(hSpacer);
VerticalPanel detailsPanel = new VerticalPanel();
mainUsersPanel.add(detailsPanel);
mainUsersPanel.setCellWidth(detailsPanel, "100%");
hSpacer = new SimplePanel();
hSpacer.setHeight("32px");
detailsPanel.add(hSpacer);
detailsPanel.add(new Label(Messages.getString("password") + ":"));
userPasswordTextBox = new PasswordTextBox();
userPasswordTextBox.setEnabled(false);
userPasswordTextBox.setWidth("200px");
HorizontalPanel passwordPanel = new HorizontalPanel();
passwordPanel.add(userPasswordTextBox);
hSpacer = new SimplePanel();
hSpacer.setWidth("10px");
passwordPanel.add(hSpacer);
editPasswordButton = new Button(Messages.getString("edit") + "...");
editPasswordButton.setStylePrimaryName("pentaho-button");
editPasswordButton.setEnabled(false);
passwordPanel.add(editPasswordButton);
detailsPanel.add(passwordPanel);
hSpacer = new SimplePanel();
hSpacer.setHeight("15px");
detailsPanel.add(hSpacer);
Label roleLabel = new Label(Messages.getString("roles"));
roleLabel.setStyleName("pentaho-fieldgroup-minor");
detailsPanel.add(roleLabel);
hSpacer = new SimplePanel();
hSpacer.setHeight("15px");
detailsPanel.add(hSpacer);
HorizontalPanel groupsPanel = new HorizontalPanel();
groupsPanel.getElement().setId("groups-panel");
detailsPanel.add(groupsPanel);
VerticalPanel availableRolesPanel = new VerticalPanel();
groupsPanel.add(availableRolesPanel);
availableRolesPanel.add(new Label(Messages.getString("available") + ":"));
availableRolesListBox = new ListBoxTitle(true);
HorizontalScrollWrapper availableRolesListBoxWrapper = new HorizontalScrollWrapper(availableRolesListBox);
availableRolesPanel.add(availableRolesListBoxWrapper);
availableRolesListBox.setVisibleItemCount(20);
availableRolesListBox.addStyleName("users-roles-selection-list");
VerticalPanel vSpacer = new VerticalPanel();
vSpacer.setWidth("15px");
groupsPanel.add(vSpacer);
VerticalPanel arrowsPanel = new VerticalPanel();
groupsPanel.add(arrowsPanel);
arrowsPanel.setWidth("35px");
hSpacer = new SimplePanel();
hSpacer.setHeight("110px");
arrowsPanel.add(hSpacer);
addRoleButton = new ThemeableImageButton(accumAddButtonStyles, null, null);
arrowsPanel.add(addRoleButton);
hSpacer = new SimplePanel();
hSpacer.setHeight("10px");
arrowsPanel.add(hSpacer);
removeRoleButton = new ThemeableImageButton(accumRemoveButtonStyles, null, null);
arrowsPanel.add(removeRoleButton);
hSpacer = new SimplePanel();
hSpacer.setHeight("30px");
arrowsPanel.add(hSpacer);
addAllRolesButton = new ThemeableImageButton(accumAddAllButtonStyles, null, null);
arrowsPanel.add(addAllRolesButton);
hSpacer = new SimplePanel();
hSpacer.setHeight("10px");
arrowsPanel.add(hSpacer);
removeAllRolesButton = new ThemeableImageButton(accumRemoveAllButtonStyles, null, null);
arrowsPanel.add(removeAllRolesButton);
VerticalPanel selectedRolesPanel = new VerticalPanel();
groupsPanel.add(selectedRolesPanel);
selectedRolesPanel.add(new Label(Messages.getString("selected") + ":"));
selectedRolesListBox = new ListBoxTitle(true);
HorizontalScrollWrapper selectedRolesListBoxWrapper = new HorizontalScrollWrapper(selectedRolesListBox);
selectedRolesPanel.add(selectedRolesListBoxWrapper);
selectedRolesListBox.setVisibleItemCount(20);
selectedRolesListBox.addStyleName("users-roles-selection-list");
return mainUsersPanel;
}
use of com.google.gwt.user.client.ui.SimplePanel in project pentaho-platform by pentaho.
the class ChangePasswordByUserDialog method addSpacer.
private void addSpacer(VerticalPanel vp, boolean addLineSeparator) {
SimplePanel separatorSpacer = new SimplePanel();
separatorSpacer.setStylePrimaryName(SPACER_STYLE_NAME);
if (addLineSeparator) {
separatorSpacer.addStyleDependentName("border-top");
}
vp.add(separatorSpacer);
}
Aggregations