From fc0fa49265f3ef512676a7b639bfec094ea7754e Mon Sep 17 00:00:00 2001 From: koutsoub Date: Thu, 13 Jan 2011 12:16:58 +0200 Subject: [PATCH] initial commit for celltable usage in filelist --- .classpath | 3 +- build.xml | 35 +- ear/META-INF/application.xml | 2 + src/gr/ebs/gss/admin/TwoAdmin.gwt.xml | 24 - src/gr/ebs/gss/admin/client/AdminService.java | 59 -- src/gr/ebs/gss/admin/client/AdminServiceAsync.java | 54 -- src/gr/ebs/gss/admin/client/TwoAdmin.java | 199 ------ src/gr/ebs/gss/admin/client/TwoAdmin.ui.xml | 62 -- .../gss/admin/client/ui/ConfirmationDialog.java | 117 ---- src/gr/ebs/gss/admin/client/ui/FilesPanel.java | 236 ------- src/gr/ebs/gss/admin/client/ui/FilesPanel.ui.xml | 49 -- src/gr/ebs/gss/admin/client/ui/FilesTable.java | 532 ---------------- src/gr/ebs/gss/admin/client/ui/HeaderPanel.java | 45 -- src/gr/ebs/gss/admin/client/ui/HeaderPanel.ui.xml | 45 -- .../ebs/gss/admin/client/ui/OperationsPanel.java | 85 --- .../ebs/gss/admin/client/ui/OperationsPanel.ui.xml | 31 - .../ebs/gss/admin/client/ui/PermissionsList.java | 223 ------- .../gss/admin/client/ui/UserClassListPanel.java | 219 ------- .../gss/admin/client/ui/UserClassListPanel.ui.xml | 32 - src/gr/ebs/gss/admin/client/ui/UserPanel.java | 515 ---------------- src/gr/ebs/gss/admin/client/ui/UserPanel.ui.xml | 57 -- src/gr/ebs/gss/admin/client/ui/UsersTable.java | 563 ----------------- src/gr/ebs/gss/admin/client/ui/VersionsList.java | 150 ----- .../gss/admin/client/ui/VisualizationPanel.java | 186 ------ src/gr/ebs/gss/admin/client/ui/service-logo.png | Bin 8062 -> 0 bytes src/gr/ebs/gss/admin/public/TwoAdmin.css | 285 --------- src/gr/ebs/gss/admin/public/TwoAdmin.html | 50 -- src/gr/ebs/gss/admin/public/gss.css | 301 --------- .../gss/admin/public/images/bg_header_gradient.gif | Bin 146 -> 0 bytes src/gr/ebs/gss/client/FileList.java | 644 +++++--------------- src/gr/ebs/gss/server/admin/AdminServiceImpl.java | 176 ------ 31 files changed, 174 insertions(+), 4805 deletions(-) delete mode 100644 src/gr/ebs/gss/admin/TwoAdmin.gwt.xml delete mode 100644 src/gr/ebs/gss/admin/client/AdminService.java delete mode 100644 src/gr/ebs/gss/admin/client/AdminServiceAsync.java delete mode 100644 src/gr/ebs/gss/admin/client/TwoAdmin.java delete mode 100644 src/gr/ebs/gss/admin/client/TwoAdmin.ui.xml delete mode 100644 src/gr/ebs/gss/admin/client/ui/ConfirmationDialog.java delete mode 100644 src/gr/ebs/gss/admin/client/ui/FilesPanel.java delete mode 100644 src/gr/ebs/gss/admin/client/ui/FilesPanel.ui.xml delete mode 100644 src/gr/ebs/gss/admin/client/ui/FilesTable.java delete mode 100644 src/gr/ebs/gss/admin/client/ui/HeaderPanel.java delete mode 100644 src/gr/ebs/gss/admin/client/ui/HeaderPanel.ui.xml delete mode 100644 src/gr/ebs/gss/admin/client/ui/OperationsPanel.java delete mode 100644 src/gr/ebs/gss/admin/client/ui/OperationsPanel.ui.xml delete mode 100644 src/gr/ebs/gss/admin/client/ui/PermissionsList.java delete mode 100644 src/gr/ebs/gss/admin/client/ui/UserClassListPanel.java delete mode 100644 src/gr/ebs/gss/admin/client/ui/UserClassListPanel.ui.xml delete mode 100644 src/gr/ebs/gss/admin/client/ui/UserPanel.java delete mode 100644 src/gr/ebs/gss/admin/client/ui/UserPanel.ui.xml delete mode 100644 src/gr/ebs/gss/admin/client/ui/UsersTable.java delete mode 100644 src/gr/ebs/gss/admin/client/ui/VersionsList.java delete mode 100644 src/gr/ebs/gss/admin/client/ui/VisualizationPanel.java delete mode 100644 src/gr/ebs/gss/admin/client/ui/service-logo.png delete mode 100644 src/gr/ebs/gss/admin/public/TwoAdmin.css delete mode 100644 src/gr/ebs/gss/admin/public/TwoAdmin.html delete mode 100644 src/gr/ebs/gss/admin/public/gss.css delete mode 100644 src/gr/ebs/gss/admin/public/images/bg_header_gradient.gif delete mode 100644 src/gr/ebs/gss/server/admin/AdminServiceImpl.java diff --git a/.classpath b/.classpath index 903618b..b382b19 100644 --- a/.classpath +++ b/.classpath @@ -26,7 +26,7 @@ - + @@ -180,7 +180,6 @@ - diff --git a/build.xml b/build.xml index 14ff4c7..4916235 100644 --- a/build.xml +++ b/build.xml @@ -26,9 +26,9 @@ - - - + + + @@ -43,8 +43,8 @@ - - + + @@ -129,7 +129,7 @@ - + @@ -141,22 +141,27 @@ - + - - + + + + + @@ -364,14 +369,14 @@ - + - + diff --git a/ear/META-INF/application.xml b/ear/META-INF/application.xml index 34c546e..0b838b5 100644 --- a/ear/META-INF/application.xml +++ b/ear/META-INF/application.xml @@ -7,12 +7,14 @@ /pithos + webdav.war diff --git a/src/gr/ebs/gss/admin/TwoAdmin.gwt.xml b/src/gr/ebs/gss/admin/TwoAdmin.gwt.xml deleted file mode 100644 index f172e35..0000000 --- a/src/gr/ebs/gss/admin/TwoAdmin.gwt.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gr/ebs/gss/admin/client/AdminService.java b/src/gr/ebs/gss/admin/client/AdminService.java deleted file mode 100644 index e03efa1..0000000 --- a/src/gr/ebs/gss/admin/client/AdminService.java +++ /dev/null @@ -1,59 +0,0 @@ -package gr.ebs.gss.admin.client; - -import gr.ebs.gss.client.exceptions.InsufficientPermissionsException; -import gr.ebs.gss.client.exceptions.ObjectNotFoundException; -import gr.ebs.gss.client.exceptions.RpcException; -import gr.ebs.gss.server.domain.dto.FileBodyDTO; -import gr.ebs.gss.server.domain.dto.FileHeaderDTO; -import gr.ebs.gss.server.domain.dto.PermissionDTO; -import gr.ebs.gss.server.domain.dto.StatsDTO; -import gr.ebs.gss.server.domain.dto.SystemStatsDTO; -import gr.ebs.gss.server.domain.dto.UserClassDTO; -import gr.ebs.gss.server.domain.dto.UserDTO; - -import java.util.Date; -import java.util.List; -import java.util.Set; - -import com.google.gwt.user.client.rpc.RemoteService; -import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; - -@RemoteServiceRelativePath("admin") -public interface AdminService extends RemoteService { - List getUsers() throws RpcException, ObjectNotFoundException; - - List searchUsers(String query) throws RpcException, ObjectNotFoundException; - - StatsDTO getUserStatistics(Long userId) throws RpcException, ObjectNotFoundException; - - void toggleActiveUser(Long userId) throws RpcException,ObjectNotFoundException; - - void setFilePermissions(String uri, Set permissions) throws RpcException, ObjectNotFoundException; - - SystemStatsDTO getSystemStatistics() throws RpcException,ObjectNotFoundException; - - public List getLastLoggedInUsers(Date lastLoginDate) throws RpcException; - - public void logout(); - - public List searchFiles(String query) throws RpcException, ObjectNotFoundException, InsufficientPermissionsException; - - UserDTO getUser(String username) throws ObjectNotFoundException, RpcException; - - FileHeaderDTO getFile(long fileId) throws ObjectNotFoundException, RpcException; - - public List getVersions(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException,RpcException; - - List getUsersWaitingActivation() throws RpcException; - - void changeUserClass(Long userId,Long userClassId) throws RpcException,ObjectNotFoundException; - - List getUserClasses() throws RpcException; - - void saveOrUpdateUserClass(UserClassDTO userClass) throws RpcException,ObjectNotFoundException; - - void removeUserClass(UserClassDTO userClass) throws RpcException,ObjectNotFoundException; - - void removeUser(Long userId) throws RpcException,ObjectNotFoundException,InsufficientPermissionsException; - -} diff --git a/src/gr/ebs/gss/admin/client/AdminServiceAsync.java b/src/gr/ebs/gss/admin/client/AdminServiceAsync.java deleted file mode 100644 index b13710e..0000000 --- a/src/gr/ebs/gss/admin/client/AdminServiceAsync.java +++ /dev/null @@ -1,54 +0,0 @@ -package gr.ebs.gss.admin.client; - -import gr.ebs.gss.server.domain.dto.FileBodyDTO; -import gr.ebs.gss.server.domain.dto.FileHeaderDTO; -import gr.ebs.gss.server.domain.dto.PermissionDTO; -import gr.ebs.gss.server.domain.dto.StatsDTO; -import gr.ebs.gss.server.domain.dto.SystemStatsDTO; -import gr.ebs.gss.server.domain.dto.UserClassDTO; -import gr.ebs.gss.server.domain.dto.UserDTO; - -import java.util.Date; -import java.util.List; -import java.util.Set; - -import com.google.gwt.user.client.rpc.AsyncCallback; - -public interface AdminServiceAsync { - void getUsers(AsyncCallback> callback); - - void getUserStatistics(Long userId, AsyncCallback callback); - - void toggleActiveUser(Long userId, AsyncCallback callback); - - void setFilePermissions(String uri, Set permissions, AsyncCallback callback); - - void searchUsers(String query, AsyncCallback> callback); - - void getSystemStatistics(AsyncCallback callback); - - void getLastLoggedInUsers(Date lastLoginDate, AsyncCallback> callback); - - void logout(AsyncCallback callback); - - void searchFiles(String query, AsyncCallback> callback); - - void getUser(String username, AsyncCallback callback); - - void getFile(long fileId, AsyncCallback callback); - - void getVersions(Long userId, Long fileId, AsyncCallback> callback); - - void getUsersWaitingActivation(AsyncCallback> callback); - - void changeUserClass(Long userId, Long userClassId, AsyncCallback callback); - - void getUserClasses(AsyncCallback> callback); - - void saveOrUpdateUserClass(UserClassDTO userClass, AsyncCallback callback); - - void removeUserClass(UserClassDTO userClass, AsyncCallback callback); - - void removeUser(Long userId, AsyncCallback callback); - -} diff --git a/src/gr/ebs/gss/admin/client/TwoAdmin.java b/src/gr/ebs/gss/admin/client/TwoAdmin.java deleted file mode 100644 index eb04b3f..0000000 --- a/src/gr/ebs/gss/admin/client/TwoAdmin.java +++ /dev/null @@ -1,199 +0,0 @@ -package gr.ebs.gss.admin.client; - -import gr.ebs.gss.admin.client.ui.HeaderPanel; -import gr.ebs.gss.admin.client.ui.UserPanel; -import gr.ebs.gss.admin.client.ui.VisualizationPanel; -import gr.ebs.gss.server.domain.dto.SystemStatsDTO; - -import com.google.gwt.core.client.EntryPoint; -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.logical.shared.ResizeEvent; -import com.google.gwt.event.logical.shared.ResizeHandler; -import com.google.gwt.event.logical.shared.SelectionEvent; -import com.google.gwt.event.logical.shared.SelectionHandler; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.DeferredCommand; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.DialogBox; -import com.google.gwt.user.client.ui.DockLayoutPanel; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.RootLayoutPanel; -import com.google.gwt.user.client.ui.TabLayoutPanel; -import com.google.gwt.user.client.ui.VerticalPanel; - -/** - * Entry point classes define onModuleLoad(). - */ -public class TwoAdmin implements EntryPoint { - - interface Binder extends UiBinder { - } - - private final AdminServiceAsync adminService = GWT.create(AdminService.class); - - private static final Binder binder = GWT.create(Binder.class); - - /** - * The single TwoAdmin instance. - */ - private static TwoAdmin singleton; - - /** - * Gets the singleton TwoAdmin instance. - * - * @return the TwoAdmin object - */ - public static TwoAdmin get() { - if (TwoAdmin.singleton == null) - TwoAdmin.singleton = new TwoAdmin(); - return TwoAdmin.singleton; - } - - @UiField(provided = true) - HeaderPanel headerPanel = new HeaderPanel(); - - @UiField UserPanel userPanel; - - @UiField - TabLayoutPanel tabPanel; - - @UiField VisualizationPanel chart2; - - final DialogBox loadingBox = new DialogBox(); - - @Override - public void onModuleLoad() { - TwoAdmin.singleton=this; - loadingBox.setHTML("Loading data"); - //scroll.setAlwaysShowScrollBars(true); - VerticalPanel vPanel = new VerticalPanel(); - loadingBox.setSize("50%", "50%"); - loadingBox.setWidget(vPanel); - vPanel.add(new Label("Fetching Requested Data")); - - DockLayoutPanel outer = binder.createAndBindUi(this); - tabPanel.addSelectionHandler(new SelectionHandler() { - - @Override - public void onSelection(SelectionEvent event) { - switch (event.getSelectedItem()) { - case 0: - loadStatistics(); - break; - default: - break; - } - - } - }); - - - // Get rid of scrollbars, and clear out the window's built-in margin, - // because we want to take advantage of the entire client area. - //Window.enableScrolling(true); - //Window.setMargin("0px"); - Window.addResizeHandler(new ResizeHandler(){ - - @Override - public void onResize(ResizeEvent event) { - int height=event.getHeight(); - resize(height); - - } - - }); - RootLayoutPanel root = RootLayoutPanel.get(); - root.add(outer); - // RootPanel.get().add(outer); - loadStatistics(); - tabPanel.selectTab(0); - - resize(Window.getClientHeight()); - } - - private void resize(int height){ - - int newHeight = height - tabPanel.getAbsoluteTop()-100; - if (newHeight < 1) - newHeight = 1; - tabPanel.setHeight("" + newHeight); - GWT.log("New Height:"+ newHeight); - } - /** - * Retrieve the adminService. - * - * @return the adminService - */ - public AdminServiceAsync getAdminService() { - return adminService; - } - - public void showErrorBox(String message) { - final DialogBox dialogBox = new DialogBox(); - dialogBox.setHTML("An error occured"); - VerticalPanel vPanel = new VerticalPanel(); - dialogBox.setSize("50%", "50%"); - ClickHandler cancelHandler = new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - dialogBox.hide(); - } - }; - dialogBox.setWidget(vPanel); - vPanel.add(new Label(message)); - Button close = new Button("Close"); - close.addClickHandler(cancelHandler); - vPanel.add(close); - dialogBox.center(); - dialogBox.show(); - } - - - - public void showLoadingBox() { - loadingBox.center(); - loadingBox.show(); - } - - public void hideLoadingBox(){ - loadingBox.hide(); - } - - - public void loadStatistics(){ - DeferredCommand.addCommand(new Command() { - - @Override - public void execute() { - showLoadingBox(); - getAdminService().getSystemStatistics(new AsyncCallback() { - - @Override - public void onFailure(Throwable caught) { - hideLoadingBox(); - // TODO Auto-generated method stub - - } - - @Override - public void onSuccess(SystemStatsDTO result) { - chart2.updateData(result); - hideLoadingBox(); - }}); - - } - }); - } - - public void searchUsers(String query){ - tabPanel.selectTab(1); - userPanel.populateTable(query); - } -} diff --git a/src/gr/ebs/gss/admin/client/TwoAdmin.ui.xml b/src/gr/ebs/gss/admin/client/TwoAdmin.ui.xml deleted file mode 100644 index 03b6297..0000000 --- a/src/gr/ebs/gss/admin/client/TwoAdmin.ui.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - Statistics - - - - - - - - Search Users - - - - - - - - Files Search - - - - - - - User Classes - - - - - - - - Operations - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/gr/ebs/gss/admin/client/ui/ConfirmationDialog.java b/src/gr/ebs/gss/admin/client/ui/ConfirmationDialog.java deleted file mode 100644 index cd4b9d9..0000000 --- a/src/gr/ebs/gss/admin/client/ui/ConfirmationDialog.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2009 Electronic Business Systems Ltd. - * - * This file is part of GSS. - * - * GSS is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GSS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GSS. If not, see . - */ -package gr.ebs.gss.admin.client.ui; - -import com.google.gwt.dom.client.NativeEvent; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.KeyCodes; -import com.google.gwt.user.client.Event.NativePreviewEvent; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.DialogBox; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.HasHorizontalAlignment; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.VerticalPanel; - - -/** - * A dialog for requesting confirmation from the user. - * - * @author kman - */ -public abstract class ConfirmationDialog extends DialogBox { - - /** - * The widget's constructor. - * - * @param message the message to display - * @param buttonLabel the label of the confirmation button - */ - public ConfirmationDialog(String message, String buttonLabel) { - // Set the dialog's caption. - setText("Confirmation"); - setAnimationEnabled(true); - // Create a VerticalPanel to contain the label and the buttons. - VerticalPanel outer = new VerticalPanel(); - HorizontalPanel buttons = new HorizontalPanel(); - - HTML text = new HTML("
" + - //AbstractImagePrototype.create(MessagePanel.images.warn()).getHTML() + - - "" + message + "
"); - text.setStyleName("gss-warnMessage"); - outer.add(text); - - // Create the 'Update' button, along with a listener that hides the dialog - // when the button is clicked and renames the file. - Button ok = new Button(buttonLabel, new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - confirm(); - hide(); - } - }); - buttons.add(ok); - buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER); - // Create the 'Cancel' button, along with a listener that hides the - // dialog when the button is clicked. - Button cancel = new Button("Cancel", new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - hide(); - cancel(); - } - }); - buttons.add(cancel); - buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER); - buttons.setSpacing(8); - buttons.setStyleName("gss-warnMessage"); - outer.setStyleName("gss-warnMessage"); - outer.add(buttons); - outer.setCellHorizontalAlignment(text, HasHorizontalAlignment.ALIGN_CENTER); - outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER); - setWidget(outer); - } - - @Override - protected void onPreviewNativeEvent(NativePreviewEvent preview) { - super.onPreviewNativeEvent(preview); - NativeEvent evt = preview.getNativeEvent(); - if (evt.getType().equals("keydown")) - // Use the popup's key preview hooks to close the dialog when either - // enter or escape is pressed. - switch (evt.getKeyCode()) { - case KeyCodes.KEY_ENTER: - hide(); - confirm(); - break; - case KeyCodes.KEY_ESCAPE: - hide(); - cancel(); - break; - } - } - - public abstract void confirm(); - - public abstract void cancel(); -} diff --git a/src/gr/ebs/gss/admin/client/ui/FilesPanel.java b/src/gr/ebs/gss/admin/client/ui/FilesPanel.java deleted file mode 100644 index b1f9307..0000000 --- a/src/gr/ebs/gss/admin/client/ui/FilesPanel.java +++ /dev/null @@ -1,236 +0,0 @@ -package gr.ebs.gss.admin.client.ui; - -import gr.ebs.gss.admin.client.TwoAdmin; -import gr.ebs.gss.server.domain.dto.FileBodyDTO; -import gr.ebs.gss.server.domain.dto.FileHeaderDTO; -import gr.ebs.gss.server.domain.dto.PermissionDTO; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.KeyPressEvent; -import com.google.gwt.event.dom.client.KeyPressHandler; -import com.google.gwt.gen2.table.event.client.RowSelectionEvent; -import com.google.gwt.gen2.table.event.client.RowSelectionHandler; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.DeferredCommand; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.TextBox; -import com.google.gwt.user.client.ui.Widget; - -public class FilesPanel extends Composite { - - private static UserPanelUiBinder uiBinder = GWT - .create(UserPanelUiBinder.class); - - interface UserPanelUiBinder extends UiBinder { - } - - - - @UiField TextBox searchBox; - @UiField Button searchButton; - @UiField(provided=true) final FilesTable filesTable = new FilesTable(); - @UiField(provided=true) Grid g =new Grid(9,6); - @UiField(provided=true) PermissionsList permissionsGrid = new PermissionsList(new HashSet(),"",true); - @UiField(provided=true) VersionsList versionsList = new VersionsList(new ArrayList()); - private Object lastQuery; - - public FilesPanel() { - g.setCellPadding(5); - g.setCellSpacing(5); - - initWidget(uiBinder.createAndBindUi(this)); - searchBox.addKeyPressHandler(new KeyPressHandler() { - - @Override - public void onKeyPress(KeyPressEvent event) { - char keyCode = event.getCharCode(); - if (keyCode == '\r') - handleClick(null); - } - }); - filesTable.addRowSelectionHandler(new RowSelectionHandler() { - - @Override - public void onRowSelection(RowSelectionEvent event) { - final FileHeaderDTO user = filesTable.getSelectedRowObject(event); - - TwoAdmin.get().showLoadingBox(); - if(user!=null) - DeferredCommand.addCommand(new Command() { - - @Override - public void execute() { - TwoAdmin.get().showLoadingBox(); - TwoAdmin.get().getAdminService().getFile(user.getId(), new AsyncCallback() { - - @Override - public void onSuccess(final FileHeaderDTO result) { - TwoAdmin.get().getAdminService().getVersions(result.getOwner().getId(), result.getId(), new AsyncCallback>() { - - @Override - public void onFailure(Throwable caught) { - GWT.log("Error requesting file details", caught); - TwoAdmin.get().hideLoadingBox(); - TwoAdmin.get().showErrorBox("Error requesting file details"); - - } - - @Override - public void onSuccess(List versions) { - clearFileDetails(); - displayFileDetails(result, versions); - TwoAdmin.get().hideLoadingBox(); - - - } - - }); - - } - - @Override - public void onFailure(Throwable caught) { - GWT.log("Error requesting user statistics file", caught); - TwoAdmin.get().hideLoadingBox(); - TwoAdmin.get().showErrorBox("Error requesting user statistics"); - - } - }); - - } - }); - - } - }); - - - clearFileDetails(); - - } - - @UiHandler("searchButton") - void handleClick(@SuppressWarnings("unused") ClickEvent e){ - final String toSearch = searchBox.getText(); - if(toSearch == null || "".equals(toSearch.trim())){ - TwoAdmin.get().showErrorBox("You must enter a query"); - return; - } - lastQuery = toSearch; - populateTable(toSearch); - } - - - - public void populateTable(String query){ - TwoAdmin.get().showLoadingBox(); - TwoAdmin.get().getAdminService().searchFiles(query,new AsyncCallback>() { - - @Override - public void onFailure(Throwable caught) { - TwoAdmin.get().hideLoadingBox(); - GWT.log("Error fetching files", caught); - TwoAdmin.get().showErrorBox("Unable to Find any Files"); - } - - @Override - public void onSuccess(List result) { - filesTable.showUsers(result); - clearFileDetails(); - TwoAdmin.get().hideLoadingBox(); - - } - - }); - } - - - - - public void displayFileDetails(final FileHeaderDTO file, List versions){ - clearFileDetails(); - versionsList.updateTable(versions); - g.setHTML(0, 0, "" + "Name:"); - g.setHTML(0, 1, file.getName()+""); - g.setHTML(1, 0, "" + "URI:"); - g.setHTML(1, 1, file.getURI()+""); - g.setHTML(2, 0, "" + "Owner:"); - HTML userLabel =new HTML(""+file.getOwner().getUsername()+""); - g.setWidget(2, 1, userLabel ); - - userLabel.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - TwoAdmin.get().searchUsers("username:"+file.getOwner().getUsername()); - - } - }); - g.setHTML(3, 0, "" + "Size:"); - g.setHTML(3, 1, file.getFileSizeAsString()+""); - g.setHTML(4, 0, "" + "Content Type:"); - g.setHTML(4, 1, file.getMimeType()+""); - - g.setHTML(5, 0, "" + "Creation Date:"); - g.setHTML(5, 1, file.getAuditInfo().getCreationDate()+""); - - g.setHTML(6, 0, "" + "Modification Date:"); - g.setHTML(6, 1, file.getAuditInfo().getModificationDate()+""); - if(file.isVersioned()) - g.setHTML(7, 0, "" + "File is Versioned:"); - else - g.setHTML(7, 0, "" + "File is NOT Versioned:"); - if(file.isReadForAll()){ - g.setHTML(8, 0, "" + "Read For All:"); - g.setHTML(8, 1, file.getURI()+""); - } - permissionsGrid.update(file.getPermissions(), file.getURI()); - } - - public void clearFileDetails(){ - g.setHTML(0, 0, "" + "Name:"); - g.setHTML(0, 1, ""+""); - g.setHTML(1, 0, "" + "URI:"); - g.setHTML(1, 1, ""+""); - g.setHTML(2, 0, "" + "Owner:"); - g.setHTML(2, 1, ""+""); - g.setHTML(3, 0, "" + "Size:"); - g.setHTML(3, 1, ""+""); - g.setHTML(4, 0, "" + "Content Type:"); - g.setHTML(4, 1, ""+""); - g.setHTML(5, 0, "" + "Creation Date:"); - g.setHTML(5, 1, ""); - - g.setHTML(6, 0, "" + "Modification Date:"); - g.setHTML(6, 1, ""); - g.setHTML(7, 0, "" + "File is Versioned:"); - g.setHTML(8, 0, "" + "Read For All:"); - g.setHTML(8, 1, ""); - permissionsGrid.clear(); - versionsList.updateTable(new ArrayList()); - - - } - - - /** - * Retrieve the lastQuery. - * - * @return the lastQuery - */ - public Object getLastQuery() { - return lastQuery; - } -} diff --git a/src/gr/ebs/gss/admin/client/ui/FilesPanel.ui.xml b/src/gr/ebs/gss/admin/client/ui/FilesPanel.ui.xml deleted file mode 100644 index 13828f3..0000000 --- a/src/gr/ebs/gss/admin/client/ui/FilesPanel.ui.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - -
-

Files Search

-
-
- - - Search Files: - - - - - - Search - - - - - - - - - -
-

File Details

-
-
- - - - - - - -
-
- -
\ No newline at end of file diff --git a/src/gr/ebs/gss/admin/client/ui/FilesTable.java b/src/gr/ebs/gss/admin/client/ui/FilesTable.java deleted file mode 100644 index a830ef1..0000000 --- a/src/gr/ebs/gss/admin/client/ui/FilesTable.java +++ /dev/null @@ -1,532 +0,0 @@ -/* - * Copyright 2010 Electronic Business Systems Ltd. - * - * This file is part of GSS. - * - * GSS is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GSS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GSS. If not, see . - */ -package gr.ebs.gss.admin.client.ui; - -import gr.ebs.gss.admin.client.ui.FilesTable.FileSorter.FileComparator; -import gr.ebs.gss.server.domain.dto.FileHeaderDTO; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.gen2.table.client.AbstractColumnDefinition; -import com.google.gwt.gen2.table.client.AbstractScrollTable.ScrollPolicy; -import com.google.gwt.gen2.table.client.AbstractScrollTable.SortPolicy; -import com.google.gwt.gen2.table.client.CachedTableModel; -import com.google.gwt.gen2.table.client.CellRenderer; -import com.google.gwt.gen2.table.client.ColumnDefinition; -import com.google.gwt.gen2.table.client.DefaultRowRenderer; -import com.google.gwt.gen2.table.client.DefaultTableDefinition; -import com.google.gwt.gen2.table.client.FixedWidthGridBulkRenderer; -import com.google.gwt.gen2.table.client.MutableTableModel; -import com.google.gwt.gen2.table.client.PagingOptions; -import com.google.gwt.gen2.table.client.PagingScrollTable; -import com.google.gwt.gen2.table.client.ScrollTable; -import com.google.gwt.gen2.table.client.SelectionGrid.SelectionPolicy; -import com.google.gwt.gen2.table.client.TableDefinition; -import com.google.gwt.gen2.table.client.TableDefinition.AbstractCellView; -import com.google.gwt.gen2.table.client.TableModel; -import com.google.gwt.gen2.table.client.TableModelHelper.Request; -import com.google.gwt.gen2.table.client.TableModelHelper.Response; -import com.google.gwt.gen2.table.event.client.RowSelectionEvent; -import com.google.gwt.gen2.table.event.client.RowSelectionHandler; -import com.google.gwt.gen2.table.event.client.TableEvent.Row; -import com.google.gwt.i18n.client.DateTimeFormat; -import com.google.gwt.user.client.ui.CheckBox; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.FlexTable; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.HasHorizontalAlignment; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.VerticalPanel; - - -/** - * @author kman - * - */ -public class FilesTable extends Composite { - private CachedTableModel cachedTableModel = null; - private DefaultTableDefinition tableDefinition = null; - private PagingScrollTable pagingScrollTable = null; - private Label countLabel = new Label("There are no files to display."); - private DataSourceTableModel tableModel = null; - - private VerticalPanel vPanel = new VerticalPanel(); - private FlexTable flexTable = new FlexTable(); - - /** - * Constructor - */ - public FilesTable() { - super(); - pagingScrollTable = createScrollTable(); - pagingScrollTable.setHeight("200px"); - pagingScrollTable.setScrollPolicy(ScrollPolicy.DISABLED); - PagingOptions pagingOptions = new PagingOptions(pagingScrollTable); - - flexTable.setWidget(0, 0, pagingScrollTable); - flexTable.getFlexCellFormatter().setColSpan(0, 0, 2); - flexTable.setWidget(1, 0, pagingOptions); - - countLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); - vPanel.add(countLabel); - vPanel.add(flexTable); - - vPanel.setWidth("100%"); - flexTable.setWidth("100%"); - - super.initWidget(vPanel); - showUsers(new ArrayList()); - pagingScrollTable.setFooterGenerated(true); - } - - public void showUsers(List newList) { - countLabel.setText("There are "+ newList.size() + " files."); - tableModel.setData(newList); - tableModel.setRowCount(newList.size()); - cachedTableModel.clearCache(); - cachedTableModel.setRowCount(newList.size()); - - pagingScrollTable.gotoPage(0, true); - if(newList.size()<2) - flexTable.setWidget(1, 0, new HTML()); - else{ - PagingOptions pagingOptions = new PagingOptions(pagingScrollTable); - flexTable.setWidget(1, 0, pagingOptions); - } - } - - public FileHeaderDTO getUserOnRow(int rowIdx){ - String id = pagingScrollTable.getDataTable().getHTML(rowIdx, 0); - final FileHeaderDTO m = tableModel.getUserById(Long.parseLong(id)); - return m; - } - - - public FileHeaderDTO getSelectedRowObject(RowSelectionEvent event){ - Set set = event.getSelectedRows(); - if(set.size() == 1) { - int rowIdx = set.iterator().next().getRowIndex(); - String id = pagingScrollTable.getDataTable().getHTML(rowIdx, 0); - FileHeaderDTO m = tableModel.getUserById(Long.parseLong(id)); - return m; - } - return null; - } - - public FileHeaderDTO getUser(Long id){ - - return tableModel.getUserById(id); - } - - - - /** - * Initializes the scroll table - * @return - */ - private PagingScrollTable createScrollTable() { - // create our own table model - tableModel = new DataSourceTableModel(); - // add it to cached table model - cachedTableModel = createCachedTableModel(tableModel); - - // create the table definition - TableDefinition tableDef = createTableDefinition(); - - // create the paging scroll table - pagingScrollTable = new PagingScrollTable(cachedTableModel, tableDef); - pagingScrollTable.setPageSize(10); - pagingScrollTable.setEmptyTableWidget(new HTML("There is no data to display")); - pagingScrollTable.getDataTable().setSelectionPolicy(SelectionPolicy.ONE_ROW); - - FixedWidthGridBulkRenderer bulkRenderer = new FixedWidthGridBulkRenderer(pagingScrollTable.getDataTable(), pagingScrollTable); - pagingScrollTable.setBulkRenderer(bulkRenderer); - - - pagingScrollTable.setCellPadding(3); - pagingScrollTable.setCellSpacing(0); - pagingScrollTable.setResizePolicy(ScrollTable.ResizePolicy.FILL_WIDTH); - - pagingScrollTable.setSortPolicy(SortPolicy.SINGLE_CELL); - - return pagingScrollTable; - } - - public void addRowSelectionHandler(RowSelectionHandler handler){ - pagingScrollTable.getDataTable().addRowSelectionHandler(handler); - } - - /** - * Create the {@link CachedTableModel} - * @param aTableModel - * @return - */ - private CachedTableModel createCachedTableModel(DataSourceTableModel aTableModel) { - CachedTableModel tm = new CachedTableModel(aTableModel); - tm.setPreCachedRowCount(20); - tm.setPostCachedRowCount(20); - tm.setRowCount(20); - return tm; - } - - private DefaultTableDefinition createTableDefinition() { - tableDefinition = new DefaultTableDefinition(); - - final String[] rowColors = new String[] { "#FFFFDD", "EEEEEE" }; - tableDefinition.setRowRenderer(new DefaultRowRenderer(rowColors)); - - // id - { - IdColumnDefinition columnDef = new IdColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(false); - columnDef.setPreferredColumnWidth(35); - columnDef.setHeader(0, new HTML("Id")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - { - NameColumnDefinition columnDef = new NameColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("File Name")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - { - UriColumnDefinition columnDef = new UriColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("URI")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - // username - { - UserColumnDefinition columnDef = new UserColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("Username")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - { - FilesizeDefinition columnDef = new FilesizeDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("File Size")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - { - DeletedColumnDefinition columnDef = new DeletedColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("Deleted")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - columnDef.setCellRenderer(new CellRenderer() { - - @Override - public void renderRowValue(FileHeaderDTO rowValue, ColumnDefinition aColumnDef, AbstractCellView view) { - CheckBox check = new CheckBox(); - check.setValue(aColumnDef.getCellValue(rowValue)); - check.setEnabled(false); - view.setWidget(check); - - } - }); - tableDefinition.addColumnDefinition(columnDef); - } - - - { - CreationColumnDefinition columnDef = new CreationColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("Creation Date")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - - { - LastModifiedColumnDefinition columnDef = new LastModifiedColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("Modification Date")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - - - - return tableDefinition; - } - - - private class DataSourceTableModel extends MutableTableModel { - private Map map; - private FileSorter sorter = new FileSorter(); - public void setData(List list) { - // toss the list, index by id in a map. - map = new HashMap(list.size()); - for(FileHeaderDTO m : list) - map.put(m.getId(), m); - } - - public FileHeaderDTO getUserById(long id) { - return map.get(id); - } - - @Override - protected boolean onRowInserted(int beforeRow) { - return true; - } - - @Override - protected boolean onRowRemoved(int row) { - return true; - } - - @Override - protected boolean onSetRowValue(int row, FileHeaderDTO rowValue) { - - return true; - } - - @Override - public void requestRows( - final Request request, - TableModel.Callback callback) { - - callback.onRowsReady(request, new Response(){ - - @Override - public Iterator getRowValues() { - final int col = request.getColumnSortList().getPrimaryColumn(); - final boolean ascending = request.getColumnSortList().isPrimaryAscending(); - if(col < 0) - map = sorter.sort(map, new FileComparator(ascending,0)); - else - map = sorter.sort(map, new FileComparator(ascending,col)); - return map.values().iterator(); - }}); - } - - } - - - private final class IdColumnDefinition extends AbstractColumnDefinition { - @Override - public Long getCellValue(FileHeaderDTO rowValue) { - return rowValue.getId(); - } - @Override - public void setCellValue(FileHeaderDTO rowValue, Long cellValue) { } - } - - - private final class NameColumnDefinition extends - AbstractColumnDefinition { - @Override - public String getCellValue(final FileHeaderDTO rowValue) { - return rowValue.getName(); - } - - @Override - public void setCellValue(final FileHeaderDTO rowValue, final String cellValue) {} - } - - - private final class UriColumnDefinition extends - AbstractColumnDefinition { - @Override - public String getCellValue(final FileHeaderDTO rowValue) { - return rowValue.getURI(); - } - - @Override - public void setCellValue(final FileHeaderDTO rowValue, final String cellValue) {} - } - - - private final class FilesizeDefinition extends - AbstractColumnDefinition { - @Override - public String getCellValue(final FileHeaderDTO rowValue) { - return rowValue.getFileSizeAsString(); - } - - @Override - public void setCellValue(final FileHeaderDTO rowValue, final String cellValue) {} - } - - - private final class UserColumnDefinition extends - AbstractColumnDefinition { - @Override - public String getCellValue(final FileHeaderDTO rowValue) { - return rowValue.getOwner().getUsername(); - } - - @Override - public void setCellValue(final FileHeaderDTO rowValue, final String cellValue) {} - } - - - private final class DeletedColumnDefinition extends - AbstractColumnDefinition { - @Override - public Boolean getCellValue(final FileHeaderDTO rowValue) { - return rowValue.isDeleted(); - } - - @Override - public void setCellValue(final FileHeaderDTO rowValue, final Boolean cellValue) { - - } - } - - private final class CreationColumnDefinition extends AbstractColumnDefinition { - - @Override - public String getCellValue(final FileHeaderDTO rowValue) { - return DateTimeFormat.getFormat("dd/MM/yyyy hh:mm:ss tt").format(rowValue.getAuditInfo().getCreationDate()); - } - - @Override - public void setCellValue(final FileHeaderDTO rowValue, final String cellValue) {} - } - - private final class LastModifiedColumnDefinition extends AbstractColumnDefinition { - - @Override - public String getCellValue(final FileHeaderDTO rowValue) { - return DateTimeFormat.getFormat("dd/MM/yyyy hh:mm:ss tt").format(rowValue.getAuditInfo().getModificationDate()); - } - - @Override - public void setCellValue(final FileHeaderDTO rowValue, final String cellValue) {} - } - - - - public static class FileSorter { - - - public Map sort(Map map, Comparator comparator) { - final List list = new LinkedList(map.values()); - Collections.sort(list, comparator); - Map result = new LinkedHashMap(list.size()); - for(FileHeaderDTO p : list) - result.put(p.getId(), p); - return result; - } - - public final static class FileComparator implements Comparator { - - private final boolean ascending; - private int property; - public FileComparator(boolean isAscending, int aProperty) { - ascending = isAscending; - property = aProperty; - } - - @Override - public int compare(FileHeaderDTO m1, FileHeaderDTO m2) { - GWT.log("sorting:"+property+" "+m1.getFileSize()+" "+m2.getFileSize()); - switch(property){ - case 0://id - if(ascending) - return m1.getId().compareTo(m2.getId()); - return m2.getId().compareTo(m1.getId()); - case 1://name - if(ascending) - return m1.getName().compareTo(m2.getName()); - return m2.getName().compareTo(m1.getName()); - case 2://uri - if(ascending) - return m1.getURI().compareTo(m2.getURI()); - return m2.getURI().compareTo(m1.getURI()); - case 3://file size - if(ascending) - return new Long(m1.getFileSize()).compareTo(new Long(m2.getFileSize())); - return new Long(m2.getFileSize()).compareTo(new Long(m1.getFileSize())); - case 4://deleted - if(ascending) - return new Boolean(m1.isDeleted()).compareTo(new Boolean(m2.isDeleted())); - return new Boolean(m2.isDeleted()).compareTo(new Boolean(m1.isDeleted())); - case 5://created - return new DateComparator(ascending).compare(m1.getAuditInfo().getCreationDate(), m2.getAuditInfo().getCreationDate()); - case 6://modified - return new DateComparator(ascending).compare(m1.getAuditInfo().getModificationDate(), m2.getAuditInfo().getModificationDate()); - default: - if(ascending) - return m1.getId().compareTo(m2.getId()); - return m2.getId().compareTo(m1.getId()); - } - - } - } - - - public final static class DateComparator implements Comparator { - - private final boolean ascending; - - public DateComparator(boolean isAscending) { - ascending = isAscending; - } - - @Override - public int compare(Date d1, Date d2) { - if(d1==null && d2==null) - return 0; - if(d1==null && d2 != null) - return -1; - if(d2==null && d1 != null) - return 1; - if(ascending) - return d1.compareTo(d2); - return d2.compareTo(d1); - } - } - } - - - -} diff --git a/src/gr/ebs/gss/admin/client/ui/HeaderPanel.java b/src/gr/ebs/gss/admin/client/ui/HeaderPanel.java deleted file mode 100644 index 3b4e51f..0000000 --- a/src/gr/ebs/gss/admin/client/ui/HeaderPanel.java +++ /dev/null @@ -1,45 +0,0 @@ -package gr.ebs.gss.admin.client.ui; - -import gr.ebs.gss.admin.client.TwoAdmin; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Anchor; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Widget; - -public class HeaderPanel extends Composite { - - interface Binder extends UiBinder { } - private static final Binder binder = GWT.create(Binder.class); - - @UiField Anchor signOutLink; - - public HeaderPanel() { - initWidget(binder.createAndBindUi(this)); - } - - @UiHandler("signOutLink") - void onSignOutClicked(@SuppressWarnings("unused") ClickEvent event) { - TwoAdmin.get().getAdminService().logout(new AsyncCallback() { - - @Override - public void onSuccess(Void result) { - Window.open("/admin", "_self", null); - - } - - @Override - public void onFailure(Throwable caught) { - TwoAdmin.get().showErrorBox(caught.getMessage()); - - } - }); - } - -} diff --git a/src/gr/ebs/gss/admin/client/ui/HeaderPanel.ui.xml b/src/gr/ebs/gss/admin/client/ui/HeaderPanel.ui.xml deleted file mode 100644 index b01d51e..0000000 --- a/src/gr/ebs/gss/admin/client/ui/HeaderPanel.ui.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - .statusDiv { - text-align: right; - margin: 1em; - } - - .linksDiv { - text-align: right; - } - - @if user.agent ie6 { - .logo { - background-image: url(logo_ie6.gif); - width: 140px; - height: 75px; - position: absolute; - } - } @else { - @sprite .logo { - gwt-image: 'logo'; - position: absolute; - } - } - - - -
- -
-
- Administration Panel -
- -
- Sign Out -
-
- - diff --git a/src/gr/ebs/gss/admin/client/ui/OperationsPanel.java b/src/gr/ebs/gss/admin/client/ui/OperationsPanel.java deleted file mode 100644 index e30de4f..0000000 --- a/src/gr/ebs/gss/admin/client/ui/OperationsPanel.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2010 Electronic Business Systems Ltd. - * - * This file is part of GSS. - * - * GSS is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GSS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GSS. If not, see . - */ -package gr.ebs.gss.admin.client.ui; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Widget; - - -/** - * @author kman - * - */ -public class OperationsPanel extends Composite { - - private static UserPanelUiBinder uiBinder = GWT - .create(UserPanelUiBinder.class); - - interface UserPanelUiBinder extends UiBinder { - } - - - - - //@UiField Button fixButton; - - public OperationsPanel() { - - - initWidget(uiBinder.createAndBindUi(this)); - - - } - - /*@UiHandler("fixButton") - void handleClick(@SuppressWarnings("unused") ClickEvent e){ - DeferredCommand.addCommand(new Command() { - - @Override - public void execute() { - TwoAdmin.get().showLoadingBox(); - TwoAdmin.get().getAdminService().fixSharedFlagForAllFoldersAndFiles( new AsyncCallback() { - - @Override - public void onSuccess(Void result) { - TwoAdmin.get().hideLoadingBox(); - } - - @Override - public void onFailure(Throwable caught) { - GWT.log("Error Fixing Permissions", caught); - TwoAdmin.get().hideLoadingBox(); - TwoAdmin.get().showErrorBox("Error Fixing Permissions"); - - } - }); - - } - }); - }*/ - - - - - -} diff --git a/src/gr/ebs/gss/admin/client/ui/OperationsPanel.ui.xml b/src/gr/ebs/gss/admin/client/ui/OperationsPanel.ui.xml deleted file mode 100644 index a34cfbb..0000000 --- a/src/gr/ebs/gss/admin/client/ui/OperationsPanel.ui.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - -
-

Administrative Operations

-
-
- - - - -
- -
\ No newline at end of file diff --git a/src/gr/ebs/gss/admin/client/ui/PermissionsList.java b/src/gr/ebs/gss/admin/client/ui/PermissionsList.java deleted file mode 100644 index 4ff03ac..0000000 --- a/src/gr/ebs/gss/admin/client/ui/PermissionsList.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2008, 2009 Electronic Business Systems Ltd. - * - * This file is part of GSS. - * - * GSS is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GSS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GSS. If not, see . - */ -package gr.ebs.gss.admin.client.ui; - -import gr.ebs.gss.admin.client.TwoAdmin; -import gr.ebs.gss.server.domain.dto.PermissionDTO; - -import java.util.HashSet; -import java.util.Set; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.http.client.URL; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.CheckBox; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.FlexTable; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.HasHorizontalAlignment; -import com.google.gwt.user.client.ui.VerticalPanel; - - -/** - * @author kman - * - */ -public class PermissionsList extends Composite { - - int selectedRow = -1; - int permissionCount=-1; - Set permissions = null; - - final VerticalPanel permPanel = new VerticalPanel(); - final FlexTable permTable = new FlexTable(); - final String owner; - PermissionDTO toRemove = null; - private boolean hasChanges = false; - private boolean hasAddition = false; - private boolean allowEditPermissions = false; - private String uri; - public PermissionsList(Set thePermissions, String anOwner, boolean _allowEditPermissions){ - owner = anOwner; - permissions = new HashSet(); - permissions.addAll(thePermissions); - permTable.setText(0, 0, "Users/Groups"); - permTable.setText(0, 1, "Read"); - permTable.setText(0, 2, "Write"); - permTable.setText(0, 3, "Modify Access"); - permTable.setText(0, 4, ""); - permTable.getFlexCellFormatter().setStyleName(0, 0, "props-toplabels"); - permTable.getFlexCellFormatter().setStyleName(0, 1, "props-toplabels"); - permTable.getFlexCellFormatter().setStyleName(0, 2, "props-toplabels"); - permTable.getFlexCellFormatter().setStyleName(0, 3, "props-toplabels"); - permPanel.add(permTable); - Button savePermissions = new Button("Save"); - permPanel.add(savePermissions); - - savePermissions.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - updatePermissionsAccordingToInput(); - if(hasChanges()) - TwoAdmin.get().getAdminService().setFilePermissions(uri,permissions, new AsyncCallback() { - - @Override - public void onSuccess(Void result) { - - - } - - @Override - public void onFailure(Throwable caught) { - GWT.log("Error fetching file", caught); - TwoAdmin.get().showErrorBox("Unable to Find File"); - - } - }); - - } - }); - permPanel.addStyleName("gss-TabPanelBottom"); - allowEditPermissions = _allowEditPermissions; - initWidget(permPanel); - updateTable(); - } - - public boolean hasChanges(){ - return hasChanges || hasAddition; - } - - public void clear(){ - permissions= new HashSet(); - uri=null; - updateTable(); - } - public void update(Set per, String aUri){ - permissions=per; - uri=aUri; - updateTable(); - } - public void updateTable(){ - int i=1; - if(toRemove != null){ - permissions.remove(toRemove); - toRemove = null; - } - for(final PermissionDTO dto : permissions){ - - Button removeButton = new Button("remove", new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - toRemove = dto; - updateTable(); - hasChanges = true; - } - }); - - if(dto.getUser() !=null) - if(dto.getUser()!=null && dto.getUser().getUsername().equals(owner)){ - permTable.setHTML(i, 0, "" + " Owner"); - removeButton.setVisible(false); - } - else{ - HTML userLabel = new HTML(""+dto.getUser().getUsername()+""); - permTable.setWidget(i, 0, userLabel); - userLabel.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - TwoAdmin.get().searchUsers("username:"+dto.getUser().getUsername()); - - } - }); - } - else if(dto.getGroup() != null) { - //String user = GSS.get().getCurrentUserResource().getUsername(); - String[] names = dto.getGroup().getName().split("/"); - String name = URL.decodeComponent(names[names.length - 1]); - //String ownr = names.length>1 ? URL.decodeComponent(names[names.length - 3]) : user; - String groupName = name; - permTable.setHTML(i, 0, "" + " "+groupName+""); - } - CheckBox read = new CheckBox(); - read.setValue(dto.getRead()); - CheckBox write = new CheckBox(); - write.setValue(dto.getWrite()); - CheckBox modify = new CheckBox(); - modify.setValue(dto.getModifyACL()); - permTable.setWidget(i, 1, read); - permTable.setWidget(i, 2, write); - permTable.setWidget(i, 3, modify); - if (dto.getUser()!=null && dto.getUser().getUsername().equals(owner) || !allowEditPermissions) { - read.setEnabled(false); - write.setEnabled(false); - modify.setEnabled(false); - } - else - permTable.setWidget(i, 4, removeButton); - permTable.getFlexCellFormatter().setStyleName(i, 0, "props-labels"); - permTable.getFlexCellFormatter().setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_CENTER); - permTable.getFlexCellFormatter().setHorizontalAlignment(i, 2, HasHorizontalAlignment.ALIGN_CENTER); - permTable.getFlexCellFormatter().setHorizontalAlignment(i, 3, HasHorizontalAlignment.ALIGN_CENTER); - i++; - } - for(; i getPermissions() { - return permissions; - } - - public void addPermission(PermissionDTO permission){ - permissions.add(permission); - hasAddition = true; - } - - -} diff --git a/src/gr/ebs/gss/admin/client/ui/UserClassListPanel.java b/src/gr/ebs/gss/admin/client/ui/UserClassListPanel.java deleted file mode 100644 index 102e62f..0000000 --- a/src/gr/ebs/gss/admin/client/ui/UserClassListPanel.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright 2010 Electronic Business Systems Ltd. - * - * This file is part of GSS. - * - * GSS is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GSS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GSS. If not, see . - */ -package gr.ebs.gss.admin.client.ui; - -import gr.ebs.gss.admin.client.TwoAdmin; -import gr.ebs.gss.server.domain.dto.UserClassDTO; - -import java.util.List; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.FlexTable; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.HasHorizontalAlignment; -import com.google.gwt.user.client.ui.TextBox; -import com.google.gwt.user.client.ui.Widget; - - -/** - * @author kman - * - */ -public class UserClassListPanel extends Composite { - - private static UserClassListPanelUiBinder uiBinder = GWT.create(UserClassListPanelUiBinder.class); - - interface UserClassListPanelUiBinder extends UiBinder { - } - @UiField(provided=true) - FlexTable userClassList; - @UiField(provided=true) - FlexTable userClassEdit; - @UiField - Button saveButton; - @UiField - Button newButton; - TextBox nameBox = new TextBox(); - TextBox quotaBox = new TextBox(); - TextBox bandwithBox = new TextBox(); - UserClassDTO userClass; - - public UserClassListPanel() { - userClassList = new FlexTable(); - userClassEdit = new FlexTable(); - userClassList.setText(0, 0, "Name"); - userClassList.setText(0, 1, "Quota"); - userClassList.setText(0, 2, "Bandwith Quota"); - userClassList.setText(0, 3, ""); - userClassList.setText(0, 4, ""); - userClassList.getFlexCellFormatter().setStyleName(0, 0, "props-toplabels"); - userClassList.getFlexCellFormatter().setStyleName(0, 1, "props-toplabels"); - userClassList.getFlexCellFormatter().setStyleName(0, 2, "props-toplabels"); - userClassList.getFlexCellFormatter().setStyleName(0, 3, "props-toplabels"); - userClassList.getFlexCellFormatter().setStyleName(0, 4, "props-toplabels"); - userClassList.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); - userClassList.getFlexCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER); - userClassList.getFlexCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER); - userClassList.getFlexCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_CENTER); - userClassList.getFlexCellFormatter().setHorizontalAlignment(0, 4, HasHorizontalAlignment.ALIGN_CENTER); - userClassList.addStyleName("gss-permList"); - - - - userClassEdit.setText(0, 0, "Name"); - userClassEdit.setText(1, 0, "Quota"); - userClassEdit.setText(2, 0, "Bandwith Quota"); - userClassEdit.setText(3, 0, ""); - - userClassEdit.setWidget(0, 1, nameBox); - userClassEdit.setWidget(1, 1, quotaBox); - userClassEdit.setWidget(2, 1, bandwithBox); - userClassEdit.setText(3, 0, ""); - userClassList.getFlexCellFormatter().setStyleName(0, 0, "props-toplabels"); - userClassList.getFlexCellFormatter().setStyleName(1, 0, "props-toplabels"); - userClassList.getFlexCellFormatter().setStyleName(2, 0, "props-toplabels"); - userClassList.getFlexCellFormatter().setStyleName(3, 0, "props-toplabels"); - initWidget(uiBinder.createAndBindUi(this)); - - - updateTable(); - } - - public void updateTable(){ - clearInput(); - clearTable(); - TwoAdmin.get().getAdminService().getUserClasses(new AsyncCallback>() { - - @Override - public void onSuccess(List result) { - int i=1; - for(final UserClassDTO dto : result){ - userClassList.setHTML(i, 0, "" + dto.getName() + ""); - userClassList.setHTML(i, 1, "" + dto.getQuotaAsString() + ""); - userClassList.setHTML(i, 2, ""); // XXX - HTML edit = new HTML("Edit"); - edit.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - userClass = dto; - updateInput(); - } - }); - userClassList.setWidget(i, 3, edit); - HTML delete = new HTML("Remove"); - delete.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - clearInput(); - TwoAdmin.get().getAdminService().removeUserClass(dto, new AsyncCallback() { - - @Override - public void onFailure(Throwable caught) { - TwoAdmin.get().hideLoadingBox(); - GWT.log("Error deleting class", caught); - TwoAdmin.get().showErrorBox("Unable to Delete User Class"); - - } - - @Override - public void onSuccess(Void removeResult) { - updateTable(); - - }}); - } - }); - userClassList.setWidget(i, 4, delete); - userClassList.getFlexCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_CENTER); - userClassList.getFlexCellFormatter().setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_CENTER); - userClassList.getFlexCellFormatter().setHorizontalAlignment(i, 2, HasHorizontalAlignment.ALIGN_CENTER); - userClassList.getFlexCellFormatter().setHorizontalAlignment(i, 3, HasHorizontalAlignment.ALIGN_CENTER); - userClassList.getFlexCellFormatter().setHorizontalAlignment(i, 4, HasHorizontalAlignment.ALIGN_CENTER); - i++; - } - - } - - @Override - public void onFailure(Throwable caught) { - // TODO Auto-generated method stub - - } - }); - } - public void clearTable(){ - int count = userClassList.getRowCount(); - for(int i=1;i"); - userClassList.setHTML(i, 1, ""); - userClassList.setHTML(i, 2, ""); - userClassList.setHTML(i, 3, ""); - userClassList.setHTML(i, 4, ""); - } - } - public void clearInput(){ - userClass= new UserClassDTO(); - nameBox.setText(""); - quotaBox.setText(""); - bandwithBox.setText(""); - } - - public void updateInput(){ - nameBox.setText(userClass.getName()); - quotaBox.setText(String.valueOf(userClass.getQuota())); - bandwithBox.setText(""); // XXX - } - - @UiHandler("newButton") - public void handleNew(@SuppressWarnings("unused") ClickEvent e){ - clearInput(); - } - - @UiHandler("saveButton") - public void handleSave(@SuppressWarnings("unused") ClickEvent e){ - userClass.setName(nameBox.getText()); - userClass.setQuota(Long.parseLong(quotaBox.getText())); - TwoAdmin.get().getAdminService().saveOrUpdateUserClass(userClass, new AsyncCallback() { - - @Override - public void onFailure(Throwable caught) { - TwoAdmin.get().hideLoadingBox(); - GWT.log("Error saving class", caught); - TwoAdmin.get().showErrorBox("Unable to Save User Class"); - - } - - @Override - public void onSuccess(Void result) { - updateTable(); - - }}); - } - - -} \ No newline at end of file diff --git a/src/gr/ebs/gss/admin/client/ui/UserClassListPanel.ui.xml b/src/gr/ebs/gss/admin/client/ui/UserClassListPanel.ui.xml deleted file mode 100644 index f746e13..0000000 --- a/src/gr/ebs/gss/admin/client/ui/UserClassListPanel.ui.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - /* Add CSS here. See the GWT docs on UI Binder for more details */ - .important { - font-weight: bold; - } - - - -
-

User Classes

-
-
- - - - -
-

User Class

-
-
- - - - - New Save - - -
-
\ No newline at end of file diff --git a/src/gr/ebs/gss/admin/client/ui/UserPanel.java b/src/gr/ebs/gss/admin/client/ui/UserPanel.java deleted file mode 100644 index e569ed1..0000000 --- a/src/gr/ebs/gss/admin/client/ui/UserPanel.java +++ /dev/null @@ -1,515 +0,0 @@ -package gr.ebs.gss.admin.client.ui; - -import gr.ebs.gss.admin.client.TwoAdmin; -import gr.ebs.gss.server.domain.dto.StatsDTO; -import gr.ebs.gss.server.domain.dto.UserClassDTO; -import gr.ebs.gss.server.domain.dto.UserDTO; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.KeyPressEvent; -import com.google.gwt.event.dom.client.KeyPressHandler; -import com.google.gwt.gen2.table.event.client.RowSelectionEvent; -import com.google.gwt.gen2.table.event.client.RowSelectionHandler; -import com.google.gwt.i18n.client.DateTimeFormat; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Command; -import com.google.gwt.user.client.DeferredCommand; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.CheckBox; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.DialogBox; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.ListBox; -import com.google.gwt.user.client.ui.TextBox; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; -import com.google.gwt.user.datepicker.client.DateBox; - -public class UserPanel extends Composite { - - private static UserPanelUiBinder uiBinder = GWT - .create(UserPanelUiBinder.class); - - interface UserPanelUiBinder extends UiBinder { - } - - - @UiField(provided=true) DateBox dateBox = new DateBox(); - @UiField(provided=true) Button showLastLoginButton = new Button(); - @UiField TextBox searchBox; - @UiField Button searchButton; - @UiField Button showInactiveButton; - @UiField(provided=true) final UsersTable usersTable = new UsersTable(); - @UiField(provided=true) Grid g =new Grid(8,6); - private Object lastQuery; - - public UserPanel() { - DateTimeFormat dateFormat = DateTimeFormat.getLongDateFormat(); - dateBox.setFormat(new DateBox.DefaultFormat(dateFormat)); - g.setCellPadding(5); - g.setCellSpacing(5); - g.setText( 0, 0, "Username:" ); - g.getCellFormatter().setStyleName(0, 0, "props-toplabels"); - g.setText( 1, 0, "Name:" ); - g.getCellFormatter().setStyleName(1, 0, "props-toplabels"); - g.setText( 2, 0, "Email:" ); - g.getCellFormatter().setStyleName(2, 0, "props-toplabels"); - g.setText( 3, 0, "User Class:" ); - g.getCellFormatter().setStyleName(3, 0, "props-toplabels"); - g.setText( 4, 0, "Active:" ); - g.getCellFormatter().setStyleName(4, 0, "props-toplabels"); - g.setText( 0, 2, "Quota:" ); - g.getCellFormatter().setStyleName(0, 2, "props-toplabels"); - g.setText( 1, 2, "Bandwith Quota:" ); - g.getCellFormatter().setStyleName(1, 2, "props-toplabels"); - g.setText( 2, 2, "File Count:" ); - g.getCellFormatter().setStyleName(2, 2, "props-toplabels"); - g.setText( 3, 2, "Total File Size:" ); - g.getCellFormatter().setStyleName(3, 2, "props-toplabels"); - g.setText( 4, 2, "Quota Left:" ); - g.getCellFormatter().setStyleName(4, 2, "props-toplabels"); - g.setText( 5, 2, "Bandwith Quota Used:" ); - g.getCellFormatter().setStyleName(5, 2, "props-toplabels"); - g.setText( 0, 4, "Quota Used%:" ); - g.getCellFormatter().setStyleName(0, 4, "props-toplabels"); - g.setText( 1, 4, "Bandwith Quota Used%:" ); - g.getCellFormatter().setStyleName(1, 4, "props-toplabels"); - initWidget(uiBinder.createAndBindUi(this)); - searchBox.addKeyPressHandler(new KeyPressHandler() { - - @Override - public void onKeyPress(KeyPressEvent event) { - char keyCode = event.getCharCode(); - if (keyCode == '\r') - handleClick(null); - } - }); - usersTable.addRowSelectionHandler(new RowSelectionHandler() { - - @Override - public void onRowSelection(RowSelectionEvent event) { - final UserDTO user = usersTable.getSelectedRowObject(event); - clearProfile(); - if(user!=null) - DeferredCommand.addCommand(new Command() { - - @Override - public void execute() { - TwoAdmin.get().showLoadingBox(); - TwoAdmin.get().getAdminService().getUserStatistics(user.getId(), new AsyncCallback() { - - @Override - public void onSuccess(StatsDTO result) { - displayProfile(user,result); - TwoAdmin.get().hideLoadingBox(); - - } - - @Override - public void onFailure(Throwable caught) { - GWT.log("Error requesting user statistics file", caught); - TwoAdmin.get().hideLoadingBox(); - TwoAdmin.get().showErrorBox("Error requesting user statistics"); - - } - }); - - } - }); - - } - }); - - - clearProfile(); - - } - - @UiHandler("showInactiveButton") - void handleWaitingClick(@SuppressWarnings("unused") ClickEvent e){ - lastQuery = true; - populateTable(); - } - - @UiHandler("searchButton") - void handleClick(@SuppressWarnings("unused") ClickEvent e){ - final String toSearch = searchBox.getText(); - if(toSearch == null || "".equals(toSearch.trim())){ - TwoAdmin.get().showErrorBox("You must enter a query"); - return; - } - lastQuery = toSearch; - populateTable(toSearch); - } - - @UiHandler("showLastLoginButton") - void handleDateClick(@SuppressWarnings("unused") ClickEvent e){ - final Date toSearch = dateBox.getValue(); - if(toSearch == null){ - TwoAdmin.get().showErrorBox("You must enter a query"); - return; - } - lastQuery = toSearch; - populateTable(toSearch); - } - - - public void populateTable(String query){ - TwoAdmin.get().showLoadingBox(); - if(query.startsWith("username:")){ - String username = query.replaceAll("username:",""); - TwoAdmin.get().getAdminService().getUser(username, new AsyncCallback() { - - @Override - public void onFailure(Throwable caught) { - TwoAdmin.get().hideLoadingBox(); - GWT.log("Error fetching users", caught); - TwoAdmin.get().showErrorBox("Unable to Find any Users"); - - } - - @Override - public void onSuccess(final UserDTO user) { - List res = new ArrayList(); - res.add(user); - usersTable.showUsers(res); - TwoAdmin.get().getAdminService().getUserStatistics(user.getId(), new AsyncCallback() { - - @Override - public void onSuccess(StatsDTO result) { - displayProfile(user,result); - TwoAdmin.get().hideLoadingBox(); - - } - - @Override - public void onFailure(Throwable caught) { - GWT.log("Error requesting user statistics file", caught); - TwoAdmin.get().hideLoadingBox(); - TwoAdmin.get().showErrorBox("Error requesting user statistics"); - - } - }); - } - }); - } else - TwoAdmin.get().getAdminService().searchUsers(query,new AsyncCallback>() { - - @Override - public void onFailure(Throwable caught) { - TwoAdmin.get().hideLoadingBox(); - GWT.log("Error fetching users", caught); - TwoAdmin.get().showErrorBox("Unable to Find any Users"); - } - - @Override - public void onSuccess(List result) { - usersTable.showUsers(result); - TwoAdmin.get().hideLoadingBox(); - - } - - }); - } - - private void populateTable(){ - TwoAdmin.get().showLoadingBox(); - TwoAdmin.get().getAdminService().getUsersWaitingActivation(new AsyncCallback>() { - - @Override - public void onFailure(Throwable caught) { - GWT.log("Error fetching users", caught); - TwoAdmin.get().showErrorBox("Unable to Find any Users"); - TwoAdmin.get().hideLoadingBox(); - } - - @Override - public void onSuccess(List result) { - usersTable.showUsers(result); - TwoAdmin.get().hideLoadingBox(); - } - - }); - } - - private void populateTable(Date query){ - TwoAdmin.get().showLoadingBox(); - TwoAdmin.get().getAdminService().getLastLoggedInUsers(query,new AsyncCallback>() { - - @Override - public void onFailure(Throwable caught) { - GWT.log("Error fetching users", caught); - TwoAdmin.get().showErrorBox("Unable to Find any Users"); - TwoAdmin.get().hideLoadingBox(); - } - - @Override - public void onSuccess(List result) { - usersTable.showUsers(result); - TwoAdmin.get().hideLoadingBox(); - } - - }); - } - - - public void clearProfile(){ - g.getColumnFormatter().setWidth(1, "200px"); - g.setWidget( 0, 1, new HTML("") ); - g.setWidget( 1, 1, new HTML("") ); - g.setWidget( 2, 1, new HTML("") ); - g.setWidget( 3, 1, new HTML("") ); - - CheckBox ck = new CheckBox(); - ck.setValue(false); - ck.setEnabled(false); - g.setWidget( 4, 1, ck ); - g.getColumnFormatter().setWidth(3, "200px"); - g.setWidget( 0, 3, new HTML("") ); - g.setWidget( 1, 3, new HTML("") ); - g.setWidget( 2, 3, new HTML("") ); - g.setWidget( 3, 3, new HTML("") ); - g.setWidget( 4, 3, new HTML("") ); - g.setWidget( 5, 3, new HTML("") ); - g.setWidget( 0, 5, new HTML("") ); - g.setWidget( 1, 5, new HTML("") ); - g.setWidget( 2, 5, new HTML("") ); - - } - - public void displayProfile(final UserDTO user, StatsDTO stats){ - g.setWidget( 0, 1, new HTML(user.getUsername()) ); - g.setWidget( 1, 1, new HTML(user.getName()) ); - - g.setWidget( 2, 1, new HTML(user.getEmail()) ); - if(user.getUserClass()!=null){ - HTML userClass; - g.setWidget( 3, 1,userClass=new HTML(""+user.getUserClass().getName()+"") ); - userClass.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - TwoAdmin.get().getAdminService().getUserClasses(new AsyncCallback>() { - - @Override - public void onFailure(Throwable caught) { - // TODO Auto-generated method stub - - } - - @Override - public void onSuccess(List result) { - DialogBox cbox =createDialogBox(user, result); - cbox.center(); - cbox.show(); - - } - - }); - - } - }); - } - final CheckBox ck = new CheckBox(); - ck.setValue(user.isActive()); - ck.setEnabled(false); - g.setWidget( 4, 1, ck ); - Button status = new Button("Toggle Active"); - status.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - - ConfirmationDialog confirm = new ConfirmationDialog("Are you sure you want to toggle user State?","Toggle") { - - @Override - public void confirm() { - TwoAdmin.get().showLoadingBox(); - TwoAdmin.get().getAdminService().toggleActiveUser(user.getId(), new AsyncCallback() { - - @Override - public void onSuccess(Void result) { - ck.setValue(!user.isActive()); - if(getLastQuery() instanceof Date) - populateTable((Date)getLastQuery()); - else if(getLastQuery() instanceof String) - populateTable((String)getLastQuery()); - else - populateTable(); - TwoAdmin.get().hideLoadingBox(); - - } - - @Override - public void onFailure(Throwable caught) { - TwoAdmin.get().hideLoadingBox(); - - } - }); - - } - - @Override - public void cancel() { - // TODO Auto-generated method stub - - } - }; - confirm.center(); - confirm.show(); - - } - }); - g.setWidget(5,1,status); - - if(user.getUserClass()!=null){ - g.setWidget( 0, 3, new HTML(user.getUserClass().getQuotaAsString()) ); - g.setWidget( 1, 3, new HTML("") ); // XXX - g.setWidget( 1, 5, new HTML("") ); // XXX - } - g.setWidget( 2, 3, new HTML(""+stats.getFileCount()) ); - g.setWidget( 3, 3, new HTML(stats.getFileSizeAsString()) ); - g.setWidget( 4, 3, new HTML(stats.getQuotaLeftAsString()) ); - g.setWidget( 5, 3, new HTML("") ); // XXX - g.setWidget( 0, 5, new HTML(100-stats.percentOfFreeSpace()+"%")); - Button remove = new Button("Remove User"); - remove.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - - ConfirmationDialog confirm = new ConfirmationDialog("Are you" + - " sure you want to permanently " + - "remove user " + user.getUsername() + "?", "Remove") { - - @Override - public void confirm() { - TwoAdmin.get().showLoadingBox(); - TwoAdmin.get().getAdminService().removeUser(user.getId(), new AsyncCallback() { - - @Override - public void onSuccess(Void result) { - if(getLastQuery() instanceof Date) - populateTable((Date)getLastQuery()); - else if(getLastQuery() instanceof String) - populateTable((String)getLastQuery()); - else - populateTable(); - TwoAdmin.get().hideLoadingBox(); - - } - - @Override - public void onFailure(Throwable caught) { - GWT.log("",caught); - TwoAdmin.get().hideLoadingBox(); - - } - }); - - } - - @Override - public void cancel() { - // TODO Auto-generated method stub - - } - }; - confirm.center(); - confirm.show(); - - } - }); - g.setWidget(2,5,remove); - - - - } - - - /** - * Retrieve the lastQuery. - * - * @return the lastQuery - */ - public Object getLastQuery() { - return lastQuery; - } - - public DialogBox createDialogBox(final UserDTO m, List classes) { - - // Create a dialog box and set the caption text - final DialogBox dialogBox = new DialogBox(); - dialogBox.setHTML("User Class: "+m.getUserClass().getName()); - - // Create a table to layout the content - VerticalPanel dialogVPanel = new VerticalPanel(); - dialogBox.setSize("50%", "50%"); - - ClickHandler cancelHandler = new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - dialogBox.hide(); - } - }; - - dialogBox.setWidget(dialogVPanel); - final ListBox listbox = new ListBox(); - int i=0; - for(UserClassDTO u : classes){ - listbox.addItem(u.getName(), u.getId().toString()); - if(u.getName().equals(m.getUserClass().getName())) - listbox.setSelectedIndex(i); - i++; - } - dialogVPanel.add(listbox); - Button change = new Button("Change"); - change.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - TwoAdmin.get().getAdminService().changeUserClass(m.getId(), Long.parseLong(listbox.getValue(listbox.getSelectedIndex())), new AsyncCallback() { - - @Override - public void onFailure(Throwable caught) { - - - } - - @Override - public void onSuccess(Void result) { - if(getLastQuery() instanceof Date) - populateTable((Date)getLastQuery()); - else if(getLastQuery() instanceof String) - populateTable((String)getLastQuery()); - else - populateTable(); - TwoAdmin.get().hideLoadingBox(); - - } - - }); - dialogBox.hide(); - - } - }); - - Button close = new Button("Close"); - close.addClickHandler(cancelHandler); - dialogVPanel.add(change); - dialogVPanel.add(close); - - // Return the dialog box - return dialogBox; - } -} diff --git a/src/gr/ebs/gss/admin/client/ui/UserPanel.ui.xml b/src/gr/ebs/gss/admin/client/ui/UserPanel.ui.xml deleted file mode 100644 index c76cbfd..0000000 --- a/src/gr/ebs/gss/admin/client/ui/UserPanel.ui.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - -
-

User Search

-
-
- - - Search Users: - - - - - - Search - - - - Search Last Logged In Users: - - - - - - - Show - - - - Show Inactive Users - - - - - - - - - -
-

User Details

-
-
- -
-
- -
\ No newline at end of file diff --git a/src/gr/ebs/gss/admin/client/ui/UsersTable.java b/src/gr/ebs/gss/admin/client/ui/UsersTable.java deleted file mode 100644 index 6db24bd..0000000 --- a/src/gr/ebs/gss/admin/client/ui/UsersTable.java +++ /dev/null @@ -1,563 +0,0 @@ -/* - * Copyright 2010 Electronic Business Systems Ltd. - * - * This file is part of GSS. - * - * GSS is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GSS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GSS. If not, see . - */ -package gr.ebs.gss.admin.client.ui; - -import gr.ebs.gss.admin.client.ui.UsersTable.UserSorter.UserComparator; -import gr.ebs.gss.server.domain.dto.StatsDTO; -import gr.ebs.gss.server.domain.dto.UserDTO; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.gen2.table.client.AbstractColumnDefinition; -import com.google.gwt.gen2.table.client.AbstractScrollTable.ScrollPolicy; -import com.google.gwt.gen2.table.client.AbstractScrollTable.SortPolicy; -import com.google.gwt.gen2.table.client.CachedTableModel; -import com.google.gwt.gen2.table.client.CellRenderer; -import com.google.gwt.gen2.table.client.ColumnDefinition; -import com.google.gwt.gen2.table.client.DefaultRowRenderer; -import com.google.gwt.gen2.table.client.DefaultTableDefinition; -import com.google.gwt.gen2.table.client.FixedWidthGridBulkRenderer; -import com.google.gwt.gen2.table.client.MutableTableModel; -import com.google.gwt.gen2.table.client.PagingOptions; -import com.google.gwt.gen2.table.client.PagingScrollTable; -import com.google.gwt.gen2.table.client.ScrollTable; -import com.google.gwt.gen2.table.client.SelectionGrid.SelectionPolicy; -import com.google.gwt.gen2.table.client.TableDefinition; -import com.google.gwt.gen2.table.client.TableDefinition.AbstractCellView; -import com.google.gwt.gen2.table.client.TableModel; -import com.google.gwt.gen2.table.client.TableModelHelper.Request; -import com.google.gwt.gen2.table.client.TableModelHelper.Response; -import com.google.gwt.gen2.table.event.client.RowSelectionEvent; -import com.google.gwt.gen2.table.event.client.RowSelectionHandler; -import com.google.gwt.gen2.table.event.client.TableEvent.Row; -import com.google.gwt.i18n.client.DateTimeFormat; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.CheckBox; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.DialogBox; -import com.google.gwt.user.client.ui.FlexTable; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.HasHorizontalAlignment; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.VerticalPanel; - - -/** - * @author kman - * - */ -public class UsersTable extends Composite { - private CachedTableModel cachedTableModel = null; - private DefaultTableDefinition tableDefinition = null; - private PagingScrollTable pagingScrollTable = null; - private Label countLabel = new Label("There are no users to display."); - private DataSourceTableModel tableModel = null; - - private VerticalPanel vPanel = new VerticalPanel(); - private FlexTable flexTable = new FlexTable(); - - /** - * Constructor - */ - public UsersTable() { - super(); - pagingScrollTable = createScrollTable(); - pagingScrollTable.setHeight("200px"); - pagingScrollTable.setScrollPolicy(ScrollPolicy.DISABLED); - PagingOptions pagingOptions = new PagingOptions(pagingScrollTable); - - flexTable.setWidget(0, 0, pagingScrollTable); - flexTable.getFlexCellFormatter().setColSpan(0, 0, 2); - flexTable.setWidget(1, 0, pagingOptions); - - countLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); - vPanel.add(countLabel); - vPanel.add(flexTable); - - vPanel.setWidth("100%"); - flexTable.setWidth("100%"); - - super.initWidget(vPanel); - showUsers(new ArrayList()); - pagingScrollTable.setFooterGenerated(true); - } - - /** - * - * @param newList the list of users to show - */ - public void showUsers(List newList) { - countLabel.setText("There are "+ newList.size() + " users."); - tableModel.setData(newList); - tableModel.setRowCount(newList.size()); - cachedTableModel.clearCache(); - cachedTableModel.setRowCount(newList.size()); - - pagingScrollTable.gotoPage(0, true); - if(newList.size()<2) - flexTable.setWidget(1, 0, new HTML()); - else{ - PagingOptions pagingOptions = new PagingOptions(pagingScrollTable); - flexTable.setWidget(1, 0, pagingOptions); - } - } - - public UserDTO getUserOnRow(int rowIdx){ - String id = pagingScrollTable.getDataTable().getHTML(rowIdx, 0); - final UserDTO m = tableModel.getUserById(Long.parseLong(id)); - return m; - } - - - public UserDTO getSelectedRowObject(RowSelectionEvent event){ - Set set = event.getSelectedRows(); - if(set.size() == 1) { - int rowIdx = set.iterator().next().getRowIndex(); - String id = pagingScrollTable.getDataTable().getHTML(rowIdx, 0); - UserDTO m = tableModel.getUserById(Long.parseLong(id)); - return m; - } - return null; - } - - public UserDTO getUser(Long id){ - - return tableModel.getUserById(id); - } - - public DialogBox createDialogBox(UserDTO m, StatsDTO s) { - - // Create a dialog box and set the caption text - final DialogBox dialogBox = new DialogBox(); - dialogBox.setHTML("User Details: "+m.getUsername()); - - // Create a table to layout the content - VerticalPanel dialogVPanel = new VerticalPanel(); - dialogBox.setSize("50%", "50%"); - - ClickHandler cancelHandler = new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - dialogBox.hide(); - } - }; - - dialogBox.setWidget(dialogVPanel); - dialogVPanel.add(new Label("Username: "+m.getUsername())); - dialogVPanel.add(new Label("Email: "+m.getEmail())); - dialogVPanel.add(new Label("Name: "+m.getName())); - if(m.getUserClass()!=null) - dialogVPanel.add(new Label("Quota: "+m.getUserClass().getQuotaAsString())); - dialogVPanel.add(new Label("File Count: "+s.getFileCount())); - dialogVPanel.add(new Label("File Size: "+s.getFileSizeAsString())); - dialogVPanel.add(new Label("Quota Left: "+s.getQuotaLeftAsString())); - - Button close = new Button("Close"); - close.addClickHandler(cancelHandler); - dialogVPanel.add(close); - - // Return the dialog box - return dialogBox; - } - - /** - * Initializes the scroll table - * @return - */ - private PagingScrollTable createScrollTable() { - // create our own table model - tableModel = new DataSourceTableModel(); - // add it to cached table model - cachedTableModel = createCachedTableModel(tableModel); - - // create the table definition - TableDefinition tableDef = createTableDefinition(); - - // create the paging scroll table - pagingScrollTable = new PagingScrollTable(cachedTableModel, tableDef); - pagingScrollTable.setPageSize(10); - pagingScrollTable.setEmptyTableWidget(new HTML("There is no data to display")); - pagingScrollTable.getDataTable().setSelectionPolicy(SelectionPolicy.ONE_ROW); - - FixedWidthGridBulkRenderer bulkRenderer = new FixedWidthGridBulkRenderer(pagingScrollTable.getDataTable(), pagingScrollTable); - pagingScrollTable.setBulkRenderer(bulkRenderer); - - - pagingScrollTable.setCellPadding(3); - pagingScrollTable.setCellSpacing(0); - pagingScrollTable.setResizePolicy(ScrollTable.ResizePolicy.FILL_WIDTH); - - pagingScrollTable.setSortPolicy(SortPolicy.SINGLE_CELL); - - return pagingScrollTable; - } - - public void addRowSelectionHandler(RowSelectionHandler handler){ - pagingScrollTable.getDataTable().addRowSelectionHandler(handler); - } - - /** - * Create the {@link CachedTableModel} - * @param aTableModel - * @return - */ - private CachedTableModel createCachedTableModel(DataSourceTableModel aTableModel) { - CachedTableModel tm = new CachedTableModel(aTableModel); - tm.setPreCachedRowCount(20); - tm.setPostCachedRowCount(20); - tm.setRowCount(20); - return tm; - } - - private DefaultTableDefinition createTableDefinition() { - tableDefinition = new DefaultTableDefinition(); - - final String[] rowColors = new String[] { "#FFFFDD", "EEEEEE" }; - tableDefinition.setRowRenderer(new DefaultRowRenderer(rowColors)); - - // id - { - IdColumnDefinition columnDef = new IdColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(false); - columnDef.setPreferredColumnWidth(35); - columnDef.setHeader(0, new HTML("Id")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - { - UserClassColumnDefinition columnDef = new UserClassColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("User Class")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - { - ActiveColumnDefinition columnDef = new ActiveColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("Active")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - columnDef.setCellRenderer(new CellRenderer() { - - @Override - public void renderRowValue(UserDTO rowValue, ColumnDefinition aColumnDef, AbstractCellView view) { - CheckBox check = new CheckBox(); - check.setValue(aColumnDef.getCellValue(rowValue)); - check.setEnabled(false); - view.setWidget(check); - - } - }); - tableDefinition.addColumnDefinition(columnDef); - } - // username - { - UsernameColumnDefinition columnDef = new UsernameColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("Username")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - { - EmailColumnDefinition columnDef = new EmailColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("Email")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - { - FullNameColumnDefinition columnDef = new FullNameColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("Name")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - - { - LastLoginColumnDefinition columnDef = new LastLoginColumnDefinition(); - columnDef.setColumnSortable(true); - columnDef.setColumnTruncatable(true); - columnDef.setHeader(0, new HTML("Last Login")); - columnDef.setHeaderCount(1); - columnDef.setHeaderTruncatable(false); - tableDefinition.addColumnDefinition(columnDef); - } - - - - return tableDefinition; - } - - - private class DataSourceTableModel extends MutableTableModel { - private Map map; - private UserSorter sorter = new UserSorter(); - public void setData(List list) { - // toss the list, index by id in a map. - map = new HashMap(list.size()); - for(UserDTO m : list) - map.put(m.getId(), m); - } - - public UserDTO getUserById(long id) { - return map.get(id); - } - - @Override - protected boolean onRowInserted(int beforeRow) { - return true; - } - - @Override - protected boolean onRowRemoved(int row) { - return true; - } - - @Override - protected boolean onSetRowValue(int row, UserDTO rowValue) { - - return true; - } - - @Override - public void requestRows( - final Request request, - TableModel.Callback callback) { - - callback.onRowsReady(request, new Response(){ - - @Override - public Iterator getRowValues() { - final int col = request.getColumnSortList().getPrimaryColumn(); - final boolean ascending = request.getColumnSortList().isPrimaryAscending(); - if(col < 0) - map = sorter.sort(map, new UserComparator(ascending,0)); - else - map = sorter.sort(map, new UserComparator(ascending,col)); - return map.values().iterator(); - }}); - } - - } - - - private final class IdColumnDefinition extends AbstractColumnDefinition { - @Override - public Long getCellValue(UserDTO rowValue) { - return rowValue.getId(); - } - @Override - public void setCellValue(UserDTO rowValue, Long cellValue) { } - } - - - private final class UsernameColumnDefinition extends - AbstractColumnDefinition { - @Override - public String getCellValue(final UserDTO rowValue) { - return rowValue.getUsername(); - } - - @Override - public void setCellValue(final UserDTO rowValue, final String cellValue) {} - } - - - private final class FullNameColumnDefinition extends - AbstractColumnDefinition { - @Override - public String getCellValue(final UserDTO rowValue) { - return rowValue.getName(); - } - - @Override - public void setCellValue(final UserDTO rowValue, final String cellValue) {} - } - - - private final class EmailColumnDefinition extends - AbstractColumnDefinition { - @Override - public String getCellValue(final UserDTO rowValue) { - return rowValue.getEmail(); - } - - @Override - public void setCellValue(final UserDTO rowValue, final String cellValue) {} - } - - - private final class UserClassColumnDefinition extends - AbstractColumnDefinition { - @Override - public String getCellValue(final UserDTO rowValue) { - if(rowValue.getUserClass() != null) - return rowValue.getUserClass().getName(); - return ""; - } - - @Override - public void setCellValue(final UserDTO rowValue, final String cellValue) {} - } - - - private final class ActiveColumnDefinition extends - AbstractColumnDefinition { - @Override - public Boolean getCellValue(final UserDTO rowValue) { - if(rowValue.isActive() == null) - return true; - return rowValue.isActive(); - } - - @Override - public void setCellValue(final UserDTO rowValue, final Boolean cellValue) { - rowValue.setActive(cellValue); - } - } - - - private final class LastLoginColumnDefinition extends AbstractColumnDefinition { - - @Override - public String getCellValue(final UserDTO rowValue) { - if(rowValue.getCurrentLoginDate()==null) - return "no data"; - return DateTimeFormat.getFormat("dd/MM/yyyy hh:mm:ss tt").format(rowValue.getCurrentLoginDate()); - } - - @Override - public void setCellValue(final UserDTO rowValue, final String cellValue) {} - } - - - - public static class UserSorter { - - - public Map sort(Map map, Comparator comparator) { - final List list = new LinkedList(map.values()); - Collections.sort(list, comparator); - Map result = new LinkedHashMap(list.size()); - for(UserDTO p : list) - result.put(p.getId(), p); - return result; - } - - public final static class UserComparator implements Comparator { - - private final boolean ascending; - private int property; - public UserComparator(boolean isAscending, int aProperty) { - ascending = isAscending; - property = aProperty; - } - - @Override - public int compare(UserDTO m1, UserDTO m2) { - switch(property){ - case 0: - if(ascending) - return m1.getId().compareTo(m2.getId()); - return m2.getId().compareTo(m1.getId()); - case 1: - if(ascending) - return m1.getUserClass().getName().compareTo(m2.getUserClass().getName()); - return m2.getUserClass().getName().compareTo(m1.getUserClass().getName()); - case 2: - if(ascending) - return m1.isActive().compareTo(m2.isActive()); - return m2.isActive().compareTo(m1.isActive()); - case 3: - if(ascending) - return m1.getUsername().compareTo(m2.getUsername()); - return m2.getUsername().compareTo(m1.getUsername()); - case 4: - if(ascending) - return m1.getEmail().compareTo(m2.getEmail()); - return m2.getEmail().compareTo(m1.getEmail()); - case 5: - if(ascending) - return m1.getName().compareTo(m2.getName()); - return m2.getName().compareTo(m1.getName()); - case 6: - return new DateComparator(ascending).compare(m2, m1); - default: - - } - String s1 = m1.getUsername(); - String s2 = m2.getUsername(); - if(ascending) - return s1.compareTo(s2); - return s2.compareTo(s1); - } - } - - - public final static class DateComparator implements Comparator { - - private final boolean ascending; - - public DateComparator(boolean isAscending) { - ascending = isAscending; - } - - @Override - public int compare(UserDTO m1, UserDTO m2) { - final Date d1 = m1.getLastLoginDate(); - final Date d2 = m2.getLastLoginDate(); - if(d1==null && d2==null) - return 0; - if(d1==null && d2 != null) - return -1; - if(d2==null && d1 != null) - return 1; - if(ascending) - return d1.compareTo(d2); - return d2.compareTo(d1); - } - } - } - - - -} diff --git a/src/gr/ebs/gss/admin/client/ui/VersionsList.java b/src/gr/ebs/gss/admin/client/ui/VersionsList.java deleted file mode 100644 index 27817be..0000000 --- a/src/gr/ebs/gss/admin/client/ui/VersionsList.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2010 Electronic Business Systems Ltd. - * - * This file is part of GSS. - * - * GSS is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GSS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GSS. If not, see . - */ -package gr.ebs.gss.admin.client.ui; - -import gr.ebs.gss.admin.client.TwoAdmin; -import gr.ebs.gss.server.domain.dto.FileBodyDTO; - -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.List; - -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.i18n.client.DateTimeFormat; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.FlexTable; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.HasHorizontalAlignment; -import com.google.gwt.user.client.ui.VerticalPanel; - - -/** - * @author kman - * - */ -public class VersionsList extends Composite{ - - - final FlexTable permTable = new FlexTable(); - final VerticalPanel permPanel = new VerticalPanel(); - - /** - * - */ - public VersionsList(List versions) { - - permTable.setText(0, 0, "Version"); - permTable.setText(0, 1, "Created By"); - permTable.setText(0, 2, "Created"); - permTable.setText(0, 3, "Modified By"); - permTable.setText(0, 4, "Modified"); - permTable.setText(0, 5, "Size"); - permTable.setText(0, 6, ""); - permTable.getFlexCellFormatter().setStyleName(0, 0, "props-toplabels"); - permTable.getFlexCellFormatter().setStyleName(0, 1, "props-toplabels"); - permTable.getFlexCellFormatter().setStyleName(0, 2, "props-toplabels"); - permTable.getFlexCellFormatter().setStyleName(0, 3, "props-toplabels"); - permTable.getFlexCellFormatter().setStyleName(0, 4, "props-toplabels"); - permTable.getFlexCellFormatter().setStyleName(0, 5, "props-toplabels"); - permTable.getFlexCellFormatter().setStyleName(0, 6, "props-toplabels"); - permTable.getFlexCellFormatter().setColSpan(0, 1, 2); - permTable.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); - permTable.getFlexCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER); - permTable.getFlexCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER); - permTable.getFlexCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_CENTER); - permTable.getFlexCellFormatter().setHorizontalAlignment(0, 4, HasHorizontalAlignment.ALIGN_CENTER); - permTable.getFlexCellFormatter().setHorizontalAlignment(0, 5, HasHorizontalAlignment.ALIGN_CENTER); - permPanel.add(permTable); - permPanel.addStyleName("gss-TabPanelBottom"); - permTable.addStyleName("gss-permList"); - initWidget(permPanel); - updateTable(versions); - } - - public void updateTable(List versions) { - Collections.sort(versions, new Comparator(){ - - @Override - public int compare(FileBodyDTO o1, FileBodyDTO o2) { - return new Integer(o1.getVersion()).compareTo(new Integer(o2.getVersion())); - } - - }); - int i = 1; - for (final FileBodyDTO dto : versions) { - - permTable.setHTML(i, 0, "" + dto.getVersion() + ""); - HTML createdByLabel = new HTML(""+dto.getAuditInfo().getCreatedBy().getUsername()+""); - permTable.setWidget(i, 1, createdByLabel); - createdByLabel.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - TwoAdmin.get().searchUsers("username:"+dto.getAuditInfo().getCreatedBy().getUsername()); - - } - }); - permTable.setHTML(i, 2, "" + formatLocalDateTime(dto.getAuditInfo().getCreationDate()) + ""); - HTML modifiedByLabel = new HTML(""+dto.getAuditInfo().getModifiedBy().getUsername()+""); - permTable.setWidget(i, 3, modifiedByLabel); - modifiedByLabel.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - TwoAdmin.get().searchUsers("username:"+dto.getAuditInfo().getModifiedBy().getUsername()); - - } - }); - - permTable.setHTML(i, 4, "" + formatLocalDateTime(dto.getAuditInfo().getModificationDate()) + ""); - permTable.setHTML(i, 5, "" + dto.getFileSizeAsString() + ""); - HTML downloadHtml = new HTML(""+"
View this Version
"); - downloadHtml.addClickHandler( new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - - - } - }); - permTable.setWidget(i, 6, downloadHtml); - - permTable.getFlexCellFormatter().setStyleName(i, 0, "props-labels"); - permTable.getFlexCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_CENTER); - permTable.getFlexCellFormatter().setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_CENTER); - permTable.getFlexCellFormatter().setColSpan(i, 1, 2); - permTable.getFlexCellFormatter().setHorizontalAlignment(i, 2, HasHorizontalAlignment.ALIGN_CENTER); - permTable.getFlexCellFormatter().setHorizontalAlignment(i, 3, HasHorizontalAlignment.ALIGN_CENTER); - i++; - } - for (; i < permTable.getRowCount(); i++) - permTable.removeRow(i); - } - - public static String formatLocalDateTime(Date date) { - Date convertedDate = new Date(date.getTime() - date.getTimezoneOffset()); - final DateTimeFormat dateFormatter = DateTimeFormat.getShortDateFormat(); - final DateTimeFormat timeFormatter = DateTimeFormat.getFormat("HH:mm"); - String datePart = dateFormatter.format(convertedDate); - String timePart = timeFormatter.format(convertedDate); - return datePart + " " + timePart; - } - -} diff --git a/src/gr/ebs/gss/admin/client/ui/VisualizationPanel.java b/src/gr/ebs/gss/admin/client/ui/VisualizationPanel.java deleted file mode 100644 index 67faed2..0000000 --- a/src/gr/ebs/gss/admin/client/ui/VisualizationPanel.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 2010 Electronic Business Systems Ltd. - * - * This file is part of GSS. - * - * GSS is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GSS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GSS. If not, see . - */ -package gr.ebs.gss.admin.client.ui; - -import gr.ebs.gss.server.domain.dto.SystemStatsDTO; -import gr.ebs.gss.server.domain.dto.UserClassDTO; - -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.visualization.client.DataTable; -import com.google.gwt.visualization.client.AbstractDataTable.ColumnType; -import com.google.gwt.visualization.client.visualizations.PieChart; - - -/** - * @author kman - * - */ -public class VisualizationPanel extends Composite{ - - PieChart userCountChart; - PieChart fileCountChart; - PieChart fileSizeChart; - - PieChart lastWeekChart; - PieChart lastMonthChart; - PieChart bandwithChart; - - /** - * - */ - public VisualizationPanel() { - final VerticalPanel vp = new VerticalPanel(); - vp.getElement().getStyle().setPropertyPx("margin", 15); - userCountChart = new PieChart(); - userCountChart.addStyleName("stats"); - fileCountChart = new PieChart(); - fileCountChart.addStyleName("stats"); - fileSizeChart = new PieChart(); - fileSizeChart.addStyleName("stats"); - - lastWeekChart = new PieChart(); - lastWeekChart.addStyleName("stats"); - lastMonthChart = new PieChart(); - lastMonthChart.addStyleName("stats"); - bandwithChart = new PieChart(); - bandwithChart.addStyleName("stats"); - HorizontalPanel row1 = new HorizontalPanel(); - HorizontalPanel row2 = new HorizontalPanel(); - - row1.add(userCountChart); - row1.add(fileCountChart); - row1.add(fileSizeChart); - - row2.add(lastWeekChart); - row2.add(lastMonthChart); - row2.add(bandwithChart); - vp.add(row1); - vp.add(row2); - initWidget(vp); - } - - public void updateData(SystemStatsDTO stats){ - DataTable data = DataTable.create(); - data.addColumn(ColumnType.STRING, "UserClass"); - data.addColumn(ColumnType.NUMBER, "UserCount"); - data.addRows(stats.getUserClasses().size()); - for(int i=0;iPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iXM& z3I{aLu(v7z03QBHL_t(|+URMn|d^{f5u{o9WsYb~16l;bYkyaY{YBCjb; z65>zMIQN$kD?8?-2ftD!9s$WSwKi8hLFq*7AzF8AR%gh zSxB%TmLwz#K|-;RBqU2kLb8w~6bX?mvm_C3ERt2OABu=T)VzhSJLG|R#?p(n-u>PF z%}=r8DmTrJ$5OM@tQ?^FTOxzV&7cI^_5$I21f5!$61$fOohlhQ)z`k>N6 zYL*U3RRy9Nvr7$XQnOM*I_!AL%d(pyVj|e4#(O;@&ss}W07RA2@Se@3-o53%&QgD8 zSQs*4V8Q?dB0u=07Oj8L;}o23??E@23bM~I>@DH!mWwCL#x2)bz_^D zYa;Iu(!Y5fD~FhoXfH-Q)e;dgSb(Ui?GinQMAZ>c8>#&z5EIZe>YB(qggo?_<%Q1e z!c8ZJn&S!WvXe?oH^-COW5*TR6K+aqSLzfyp3t6fT%l7U{>Z5&#jpityAv zygZ1E#=B037LB7Twn_pOd_27meMM-2`8h0`huD;`uQQhDnE19epcD`6>3;5416!XC zOL+h!1hZtR*>Qw)g_{zNCv{4AY3ZbemzHi?dKss6md>^d?Y=4qlot=u1z0)@O1zHncdS^I_^>t5m?#MHLs6v^ z1!WtB$#*B=GRbk=LTRDgR}pC!qvQwcaPwM7fs&6~{}}IFJO(}S)gAHirC;FDoe%^b z8}qXkp@Cq${ZxGIadFs5WRUmqokwx^3vd-S_u$rb6N0#jyoR>|``7;L5C8r*CJL385l%{I zS7?{DC$uY)*lR-3k#eddUc%dr-!f(aU7FKkf=d?xz`h}@-u&7p`KH;Mxiy4H4&^Kp@nu>IV=@RO+v-9ElYJUHF%;)XdwvK zoQ0L=O}3d9uoh`OC6{IK3|zVhzuAs~61MbUNkf$?!pP)g6j z5%}JFtK`T8J~t6&q(FqOk*OZ|vlrsQEl4T+V(V)hc_*m*exe6z2}F>b&>s_>EE85N z1QT}j$SWkzI#zhXqg$#~k_SFYl4ewk8bv zx2y|G1r`FtaYk`W(bZG#s)GPmxjkm)gr7@t^%#ghO0tpTJ42(HJf_$U0mbTtnaC!e zRzEuEsu3Zw=pM$#ZtUnsbflLlGVmh=5tP6UZ$q3UO@!aSjDLR)y9UwX;vJ{rW6R;l z#`kYV3V(GO{_>aT&g0rUaPb1HJQrurh7ypRMAAk%Trd{1(y+jA1)al*?_vQh#(YH$ z89`(_^K}0v+`kFChini6K#Pm>=F)Xbap5VLnK}#(zP4F8L~jufZNtwuVdnsbD2<7-iNiAm&3!KtPg(t z9z3}xxk1Qk#|D{|1~t51)Skn|k0%5Fzg)?@tEz$YA$ieIzy$N5k&HE%y4=@I;g`C55t# zd|?7uGc$#}&&5cDtb?L+&xX{Rm()EUMn`%w&1Wq@@I(CheOR{_1PFqZ4NgoDmdtvE zeB0RZyzJ)3w*K_yJ&)WuvS%}K22$hLi?!BT%Pd$rEcH0f#R5e5LpSc<1Xm%5(CQ*v z4F&`e2Ff6y)q^_7zAXmG`(Q$whjFDxk;MfkkFk4rR61RYI~i$GQx)@D@Y4_Dv0eD} zc5LiM=LmZ8umH!|1EapNmd_GKFtz){V_^5dX8h$Zk>#=zj_9b^E=zA;P`P4Zuw;e- zED7$)%g6WY`?k4ThSG&7bM?QaZoNhm5wvRKga3L!5h?TF}%Yp-8))hC8_Zrt(UKX*T~M!IRi;+SF1SYxHla^$A5|~y-)&?K}zF)T!gF6KvqLAm|$!&)f$VA^fYAC93h`qdvIhbH}mWj zGtXXO0>A5-HN7wVF2DCB69qO3Z4||%F&Sg6r6l>idNb{4cQHxmBU{UnHvotQ2_=*( zy(FX&1I|uNb^w^0#ifhz!)qFlZIOXg=t!g88^5a~5@puvHu&^lez>M(XQiiVFV-Zj zkkJ6fKLD}ZxdG4a2Y^q!3Crh=(@YkiKl>>}SWHJlUN|^|N4|T>NS2D>NZAGzYr@zb zBB3JfNS*%Nd6mwgaBCsjcL3jhxaAvH@;KDQci@(_*wzO@uohRIj&HmRDb+wV=G+s8 zNsb|Ct!1U>z2)k8Z@Jn=QDvwnC=3Oq5r6Q2Khhr*N5axbP%4_E)lI#EXWrX6V!B4W+{ozmzwXq78jSK^1wL zwQJpq^8D*gGq*eoE5&^qeM7SPrMKau%Nx_<)620=PYh!;7)S`W zeU95c=O_bT4R@dXfRkUTatLdoxN#atWDmjgPNehZWE-1Jk-`2UtlNvTW@B;tRP#Np zMPL9xFq9boQDpJJi;-svZj^VU;Zsw?XXl23{E#V)m`cI=r6k{*1u4xs%~1dot(Z;! zMk0!2i_|wi;{Njo#%r^GcpL>Eit*0H_{bZ_Ke5M1j$vl#QN|&rJ&e&`0tkZZxEXU( zO?BFz!l7JQ-?2T_V1sgquRMgiUw~wU2ItMe53f1Me4IcAN{OG56cdfol=(7t_6FLN z98(Z}@m*);xiah*hfFaBUlCDY<18WNTCV~V0Wey;b&mSQUdLsxv%lD#&&^8LuWmWS z9qZvrFyX70gO68i;kB0hIte|wYhW^-B{uMlmrK$MljzU<>+tP?B3`Y5ZDBl+j_e8@7 z!r|Vi&>s~BqvEhB=Yvw=j9gJfC2cGDVr9>OA*%n#M|VIl{0JXgj#l^hrDjb@=lLW3 zPk#GPi8;xitF^dGy4j6d6_SJ?k|YJOWEMzT-^Fe4m{?X@=vBv)?s_tAr!uBP9t#!% z39*;#PR#Mf%mVRhmHDGa3|~!p@~}4X77vzqjx%;jIxnRX?P$=LLwN5!G2IAr}ItRdwh z3K+yfS?xr=H&a!lsTf-ce7`pz0rji&n;nphQh<-0KmEqs(IQW{X&Z&zPydRQOG2`g zB&vy=QnJt_lctL-6v?;~qvm8w$wE`Ir6QrKgNlR_Qj$<4#|+jRIo8relfI7Ck7P2) z^~R5Sk_kG#-`xdRU~Z$NnK-lnzyQWhb+)y3!mPXZoryie_~1E6D}3uw3|Fvc=+O6- z2tkM){fTZq*t^`-XB0xVA(?PdE{Fo(2EGl-)-RfJ-V_H-aoAeJPMQEnZFGu*iVggf z2-t*dLP1ea-i$tG*9ZtWV`k!RA2*pA@|1JYjsNeF8{R&$cPkN(Q%j?@4(iLCv{s2* zMb%=v)qq4i2(GnIiQ~58I;s%W;HIr*!w58_xB9KTFlQ)pw}Y+h+AGA zQZhPjh%f<;Ev`5nSDapl^$icAw=h*BuX7kV7dZzl2f;dD0mBk3Su?|nOccRHFp-Ty zM85UQQE>>755Tx7jslo4PK6vUM*@amm`wMG89lkjKfEJ-v|+|$V&_?FrJH`|KRvbl z^WSe@azRiWu~C2%L=uBq3+-4UngBS~;y?iwX!RO@S_uzB=cP4ZVQe*`ZyWp6@%XZN z2n`DUp}krFtG6V{q&cSn6c)B2vVesFWnHo$i&4)ZGf4&Mkf@at5Qv!2TTId&E#OER z{k+AAcwISfL`4 zmeq_j*Vr1tNklkbN$dyE35L9bgBC(NCtY&gNtav~RZ2l=BrJ{;x_0FEZ!dK1EOx(K z9yq{K39Vra0~Q2gYYf;>HDZ=@k%G0>kd6C_8W>|KL<9pck#N!~(;`zjmC6Y(Q!7pz z!!}QWUVfn)g5d`^W9A`zTQdc|cUC&-eU+VBZDL9xFnF#Li`pkFKO@3VHYTBqjDxdg zH!v$Q+MY7Q*|%Ru!r4CJynA6PaLOE35Jdo3Y7c_@oN&@R^4?(NhRO}t zO{MhwHZdAsvoo;3rXCo3TuHX0joSi<%Nfx+D>Lu3*~_mO#l;L%hWq@Hz92ss~0$)1Yrn7Cp;#b@W+17_b0Bdp9#EE609TUtLjfsX@ihyX8Z(G}D+{W?hvboqj zh-dbrw}6=wfc56JI8cCMXqh0O;bXOGnfl4IDJ9DzQDx1Z@XC{o4}h7KYl1SO5U|zg zS&H3EpUFMhlPif#MP%|wf9Nc49D8!bVtnNxcnY_y#kq5^Y+i#@_~Y%{+9Q>t*>}1m z4rlZhQ1J2W{v>1c^cfTW*jUvS1C)X>&Sqp9--9+6LFQW7mi&cJK^Zx@XJF&$}Kx(Ja)Wbv7M@!*#FBQ*LPraiVX zna+Fo3oE*w`n_<#0u-~yQjw6N#_P%|yE}&dl?fZ1aLbYs)>qaNkE`$csdh0Fit6LF zV+yMA((yRg_7YUzGJda6e0qX8rmW?FFF*A&JiQl!(UFF+hzu@XFqy9$M@zr{Fs{D{ z9U1f%u%QcUUc&#mEXfQVEpu`hs^I%ipd*dh8T1wL=uSMc1K++1Z<;^;$V)mfCyTx! ze)tsHJY2i9p77T>f*(GGpKMIb0AsQ8+y;^5x(0>)>N|PMf!xl0(LNuyZWNzerrKQB zFPCi?#92~AEVVjNc5Zt*wI@giGFue6l4`s48aXZ#BUZ_Obs4U`1EE1Nz+c>tH+0~V zMOfU9nHkKJ$Q4DhNp|S*j%J6=ROYSh!RZ*%QFUAumNj z#BnxeK_qI$KBG7%R9WKj#0gb>k+@)lU;$%ojm=5)E7g`^2_S**KY@*1Hs_MH376KM z!a1`i^g`lrJ~OuU;R~zb$b{>vgm`(d0rD<937Za}uZZhc!|k;WpVjw zxbt~1;qQKne|;JY+c7JR-9y+rm}E)=CU}g%}EXAtxAb8rqH(>=({AdhpTfgqxA1-w5WaT6}uQBqfx=jcc z3dx`#uB)X)DOO)%22n4(81>S#+AflXz}Q`=@h-Be^CU}2Bv@&o^`GC%kM0_iME=%O z@Q?3LqNoS!l7D&vx2+rhQD|^#J0AFGgX{CmK78mdIAToNX{(1dA8(u-A4K@0+p()3 zf&qdxvGX23bcwdR;3WLtYY%N^#ZO>gkv?*#=@~4zra(bS!#{UskkO`d#O@vD5E9Y} z*eOvuRGC%F8gkdZyA>Pk#aINH#5JnjB@yR#i8&@Qc$|1tLfVGs;_I+>Q zw5K20eA7`>9wq4}C>! z?oG<%s9JRvm$jEetlk1oVcEQCApQ_u!kfDK*fDI^?cXp#+DUEKaboYHd4X4{6~1JJ+q znZ7?fHn8ov!v1aL{%)2^XfN){bDWS@%~ufG6K-0%DdD78I}{fH#nlR10 z1U_a-QaQPHm1$Gy7M3dMD|*o5alCRB8c=tKyVnt8ZgRLB{b3u*$~&=sKmKGXzIEmC zWRgeyh!|ceH=Vj{<;j<=1Q3++#jc&j?%l9A5Hwa~6g%KRgq zXzFjikLvh8W}ADe1tKRx^sFHQh)5_0$~gv?pb5C+ZBAH=QiumO;l52!qH)pF2@$t# z%4-3301@^LomHv)#MT#qc=)7z2VmXDO%g=eH!b&LbX(<)_}3@E6|i<<;+@Ob_O3?-oWiR>e>A0 z60ah^)U)xi1J69P|MC07a$b2^;ii(_pi+~Nap%Uw!b@6z#%&(un0K(KWOg1i9mgF) ztEL`n*U8P0shn`UgV~m*yxQ!@X-fIC*7j|BqVtIddN=;gm{3SXQV~yrygJD0$cvZj zeQgyBEwrOsI-Hgcm2Rn3fi%s#Ch{6csdsv@uZuPshsq((o0J>-Mmjti@X94Ao{h7}G)^ z?t5H&0p!@a$)=KPBCjb;nI37{=}mcMWcs6LCJe^-?3JmIETyHck_vW+X86l+&HDdTv;cuA#{R8815 zk#{K1*4iZ>`m&!N+_&~#8wG%u6g5_3U!(fo(Lr|D(av0M2j}q`Iwifda8kla2{)y)ZEpKqw`C@p@v$cIj(FxBP5+h$x`X0ySjwBY z-w`awNl;3&ld9T(X*!xptfn-PHwgrr(iAjf7)^PNco div { -border:1px solid #D9E6F0; -border-collapse:collapse; -} -.Gmnuri3D h3 { --moz-background-clip:border; --moz-background-inline-policy:continuous; --moz-background-origin:padding; -background:#E3E9FF none repeat scroll 0 0; -border-bottom:1px solid #D9E6F0; -color:#375B91; -margin:0; -padding:2px; -} -.Gmnuri3F { --moz-background-clip:border; --moz-background-inline-policy:continuous; --moz-background-origin:padding; -background:transparent none repeat scroll 0 0; -border-collapse:collapse; -margin:4px; -} -.Gmnuri3F > tbody > tr > td { -border:1px solid #D9E6F0; -padding:2px; -} -.Gmnuri3F > tbody > tr { -color:#375B91; -} -.Gmnuri3F > tbody > tr:first-child { --moz-background-clip:border; --moz-background-inline-policy:continuous; --moz-background-origin:padding; -background:#E3E9FF none repeat scroll 0 0; -color:#000000; -} -.Gmnuri3E { --moz-background-clip:border; --moz-background-inline-policy:continuous; --moz-background-origin:padding; -background:transparent none repeat scroll 0 0; -border-collapse:collapse; -} -.Gmnuri3E > tbody > tr > td > div { -margin:4px; -padding:0; -} -.Gmnuri3E > tbody > tr > td > button { -margin:4px; -padding:2px 0 0; -width:80px; -} -.Gmnuri3B { -border:0 none; -border-collapse:collapse; -padding:0; -} -.Gmnuri3B > div { -border:1px solid #D9E6F0; -border-collapse:collapse; -} -.Gmnuri3B h3 { --moz-background-clip:border; --moz-background-inline-policy:continuous; --moz-background-origin:padding; -background:#E3E9FF none repeat scroll 0 0; -border-bottom:1px solid #D9E6F0; -color:#375B91; -margin:0; -padding:2px; -} -.Gmnuri3B > div > table > tbody > tr > td { --moz-background-clip:border; --moz-background-inline-policy:continuous; --moz-background-origin:padding; -background:#E3E9FF none repeat scroll 0 0; -border:1px solid #D9E6F0; -margin:0; -padding:2px; -width:150px; -} -.Gmnuri3B > div > button { -margin:4px; -padding:0; -width:92px; -} -.Gmnuri3C { --moz-background-clip:border; --moz-background-inline-policy:continuous; --moz-background-origin:padding; -background:transparent none repeat scroll 0 0; -border-collapse:collapse; -margin:4px; -} -.Gmnuri3A { -border:0 none; -border-collapse:collapse; -margin:0; -padding:0; -} -.Gmnuri3A > div { -border:1px solid #D9E6F0; -border-collapse:collapse; -} -.Gmnuri3A h3 { --moz-background-clip:border; --moz-background-inline-policy:continuous; --moz-background-origin:padding; -background:#E3E9FF none repeat scroll 0 0; -border-bottom:1px solid #D9E6F0; -color:#375B91; -margin:0; -padding:2px; -} -.Gmnuri3A > div > select { --moz-background-clip:border; --moz-background-inline-policy:continuous; --moz-background-origin:padding; -background:#E3E9FF none repeat scroll 0 0; -border:1px solid #D9E6F0; -margin:4px; -padding:2px 0 0; -} -.Gmnuri3A > div > button { -margin:4px; -padding:2px 0 0; -width:80px; -} - -body { - padding: 10px; -} - -/* - * ScrollTable - */ -.gwt-ScrollTable { - border-color: #aaa; - border-style: solid; - border-width: 1px 0px 1px 1px; -} - -.gwt-ScrollTable .headerWrapper { - background: #8bd url(images/bg_header_gradient.gif) repeat-x bottom left; -} - -.gwt-ScrollTable .footerWrapper { - border-top: 1px solid #aaa; - background: #8bd url(images/bg_header_gradient.gif) repeat-x bottom left; -} - -.gwt-ScrollTable .dataTable td, -.gwt-ScrollTable .headerTable td, -.gwt-ScrollTable .footerTable td { - border-color: #aaa; - border-style: solid; - border-width: 0px 1px 1px 0px; - white-space: nowrap; - overflow: hidden; -} - -.gwt-ScrollTable .headerTable td, -.gwt-ScrollTable .footerTable td { - color: #fff; -} - -.gwt-ScrollTable .dataTable tr.highlighted { - background: #C3D9FF; -} - -.gwt-ScrollTable .dataTable td.highlighted { - background: #FFFFAA; - cursor: hand; - cursor: pointer; -} - -.gwt-ScrollTable .dataTable tr.selected td { - background: #7AA5D6; -} - -.badGPA { - background: #FFAAAA; -} -.goodGPA { - background: #AAAAFF; -} -.greatGPA { - background: #AAFFAA; -} - -/** - * Applied to the options at the bottom of the page. - */ -.gwt-PagingOptions { - background: #e8eef7; - border: 1px solid #aaa; - border-top: none; -} - -.gwt-PagingOptions .errorMessage { - color: red; -} - -.pagingOptionsFirstPage, -.pagingOptionsLastPage, -.pagingOptionsNextPage, -.pagingOptionsPrevPage { - cursor: hand; - cursor: pointer; -} - -.gwt-InlineCellEditor { - border: 3px solid #7AA5D6; - padding: 4px; - background: white; - overflow: auto; -} -.gwt-InlineCellEditor .accept { - cursor: pointer; - cursor: hand; -} -.gwt-InlineCellEditor .cancel { - cursor: pointer; - cursor: hand; -} - -/** Applied to AbstractOptions */ -.AbstractOption-Label { - font-weight: bold; - text-align: right; -} - -.stats{ - border: 1px solid #92C1F0; - } - - - diff --git a/src/gr/ebs/gss/admin/public/TwoAdmin.html b/src/gr/ebs/gss/admin/public/TwoAdmin.html deleted file mode 100644 index 01cda0a..0000000 --- a/src/gr/ebs/gss/admin/public/TwoAdmin.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - Administration Application - - - - - - - - - - - - - - - - - - - - diff --git a/src/gr/ebs/gss/admin/public/gss.css b/src/gr/ebs/gss/admin/public/gss.css deleted file mode 100644 index b7236e8..0000000 --- a/src/gr/ebs/gss/admin/public/gss.css +++ /dev/null @@ -1,301 +0,0 @@ -body { - background-color: #f5f5f5; - color: black; - font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif; - font-size: small; - margin: 8px; - margin-top: 3px; -} - -a { - color: darkblue; -} - -a:visited { - color: darkblue; -} - -.hidden-link { - text-decoration: none !important; - color: black !important; -} - -.hidden-link:visited { - text-decoration: none !important; - color: black !important; -} - -.gss-TopPanel { - font-size: 100%; -} - -.gss-TopPanelLinks { - font-size: 100%; -} - -.gss-AboutText { - width: 24em; - /* Restore the padding we remove when overriding the gwt-DialogBox style */ - padding: 3px; -} - -.gss-Groups { - background-color: white; - font-size: 80%; -} - -.toolbar { - border-bottom: 1px solid darkgrey; - background-color: #F5F5F5; - font-size: 80%; - cursor: pointer; -} - -.toolbarmenu { - font-size: 80%; - cursor: pointer; -} - -.statusbar-inner { - border: none; - font-size: 90%; - vertical-align: middle; - font-weight: normal; -} - -.gss-List { - background-color: white; - font-size: 80%; - cursor: default; - border-collapse: collapse; - /* prevents selecting text in table with shift and ctrl*/ - -moz-user-select: none; -} - -.gss-ListHeader { - border: 1px darkgrey solid; - background-color: #DCDCDC; - font-weight: bold; - cursor: pointer; -} - -.gss-searchLabel { - font-weight: bold; - font-style: italic; - font-size: 90%; - padding:5px; -} - -.gss-ListNavBar { - font-size: 80%; -} - -.gss-SelectedRow { - background-color: #DCDCDC; -} -.gss-fileRow{ - cursor: pointer; -} - -.gss-Toolbar { - -} - -.gss-ToolButton { - font-size: 80%; - width: 10em; -} - -.props-labels { - font-size: 80%; - font-weight: bold; -} - -.props-toplabels { - font-size: 80%; - font-weight: bold; - font-style: italic; -} - -.props-values { - font-size: 80%; -} - -.gss-errorMessage { - font-size: 90%; - background-color: #ff9999; - cursor: pointer; -} - -.gss-warnMessage { - font-size: 90%; - background-color: #eeee99; - cursor: pointer; -} - -.gss-infoMessage { - font-size: 90%; - background-color: #ccffcc; - cursor: pointer; -} - -.gss-clearMessage { - font-size: 90%; - font-weight: bold; - text-decoration: none; - color: black; -} - -.gss-clearMessage:visited { - font-size: 90%; - font-weight: bold; - text-decoration: none; - color: black; -} - -.gss-search { - color: black; -} - -.gss-search-empty { - color: #d3d3d3; -} - -.gss-DialogBox { -} - -.gss-readForAllNote { - width: 240px; - text-align: justify; - font-style: italic; - font-size: 12px; - padding-left: 4; -} - -/* Tooltips */ -a.info { - position: relative; /*this is the key*/ - z-index: 24; - color: black; - text-decoration: none -} - -a.info:hover { - z-index: 25; - background-color: yellow; -} - -a.info div { - display: none -} - -a.info:hover span { - cursor: pointer; -} - -/* The span will only display on :hover state. */ -a.info:hover div { - display: block; - position: absolute; - bottom: 2em; - right: 1em; - width: 10em; - border: 1px solid darkgrey; - background-color: #DCDCDC; - color: black; - text-align: center -} - -table.gss-permList.props-labels { - font-weight: bold; -} - -table.gss-permList { - border-spacing: 3px; - border-collapse: collapse; - -} - -table.gss-permList td { - padding: 5px 5px 5px 5px; - font-size:80%; -} - -.progressbar-text { - font-weight: bold; -} - -.progressbar-remaining { - font-size: 12px; - font-style: italic; -} - -.progressbar-outer { -} - -.progressbar-inner { - border: 1px solid darkgrey; - margin: 1px; -} - -.progressbar-bar { - width: 5px; - height: 15px; - margin: 0px; -} - -.progressbar-fullbar { - background: #DCDCDC; -} - -.progressbar-blankbar { - background: white; -} - -.gss-uploadNote { - text-align: justify; - font-style: italic; - font-size: 12px; - padding-top: 16; - padding-bottom: 16; - padding-right: 4; - padding-left: 4; -} - -.gss-MainTabBar { - padding-top: 4px; -} - -.gss-MainTabPanelBottom { - border-bottom: none; - border-left: none; - border-right: none; - overflow: hidden; - padding: 6px; -} - -.gss-TabPanelBottom { - border-color: darkgrey; - border-width: 1px 1px 1px; - overflow: hidden; - padding: 6px; -} - -.gss-splitPanel { - background-color: white; - border: 1px solid darkgrey; -} - -/* Avoid extended background color in tree nodes. */ -.gwt-TreeItem-selected .gwt-HTML { - display: inline; -} - -/* - * Remove the padding inside the dialog boxes so that our background color - * appears uniform in warnings and errors. - */ -.gwt-DialogBox .dialogMiddleCenter { - background:none repeat scroll 0 0 white; - padding: 0; -} diff --git a/src/gr/ebs/gss/admin/public/images/bg_header_gradient.gif b/src/gr/ebs/gss/admin/public/images/bg_header_gradient.gif deleted file mode 100644 index 48e5c326367e1b7242d9f079f98292eb607f2abf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 146 zcmZ?wbhEHbWMmLxIKse?vfy;U#DgVkE+@=A>C?BrWykG;l^0`X9rx(o+pzU!&a(3n z(~s6{x}LH4Y{-dAB0+XCu<|Rgh;n}BXuHI4c%ublV+(^d E0Oh7A%K!iX diff --git a/src/gr/ebs/gss/client/FileList.java b/src/gr/ebs/gss/client/FileList.java index 7cd33c1..1024ab8 100644 --- a/src/gr/ebs/gss/client/FileList.java +++ b/src/gr/ebs/gss/client/FileList.java @@ -17,7 +17,6 @@ * along with GSS. If not, see . */ package gr.ebs.gss.client; -import gr.ebs.gss.client.commands.GetUserCommand; import gr.ebs.gss.client.dnd.DnDSimpleFocusPanel; import gr.ebs.gss.client.dnd.DnDTreeItem; import gr.ebs.gss.client.rest.GetCommand; @@ -34,21 +33,24 @@ import gr.ebs.gss.client.rest.resource.UserResource; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.Iterator; import java.util.List; +import com.google.gwt.cell.client.ImageResourceCell; import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.NativeEvent; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.core.client.Scheduler; +import com.google.gwt.core.client.Scheduler.RepeatingCommand; import com.google.gwt.http.client.URL; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ImageResource; -import com.google.gwt.resources.client.ClientBundle.Source; +import com.google.gwt.user.cellview.client.CellTable; +import com.google.gwt.user.cellview.client.Column; +import com.google.gwt.user.cellview.client.TextColumn; +import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.DeferredCommand; import com.google.gwt.user.client.Event; -import com.google.gwt.user.client.IncrementalCommand; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AbstractImagePrototype; import com.google.gwt.user.client.ui.Composite; @@ -58,17 +60,18 @@ import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.TreeItem; import com.google.gwt.user.client.ui.Widget; -import com.google.gwt.user.client.ui.HTMLTable.Cell; +import com.google.gwt.view.client.DefaultSelectionEventManager; +import com.google.gwt.view.client.MultiSelectionModel; +import com.google.gwt.view.client.ProvidesKey; +import com.google.gwt.view.client.SelectionChangeEvent; +import com.google.gwt.view.client.SelectionChangeEvent.Handler; /** * A composite that displays the list of files in a particular folder. */ -public class FileList extends Composite implements ClickHandler { - - private HTML prevButton = new HTML("< Previous", true); - - private HTML nextButton = new HTML("Next >", true); +public class FileList extends Composite { + private String showingStats = ""; private int startIndex = 0; @@ -78,18 +81,12 @@ public class FileList extends Composite implements ClickHandler { */ public static final boolean DONE = false; - private boolean clickControl = false; - - private boolean clickShift = false; - - private int firstShift = -1; - - private ArrayList selectedRows = new ArrayList(); - /** * The context menu for the selected file. */ final DnDSimpleFocusPanel contextMenu; + + private final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a"); /** * Specifies that the images available for this composite will be the ones @@ -179,7 +176,7 @@ public class FileList extends Composite implements ClickHandler { /** * The table widget with the file list. */ - private FileTable table = new FileTable(GSS.VISIBLE_FILE_COUNT + 1, 8); + //private FileTable table = new FileTable(GSS.VISIBLE_FILE_COUNT + 1, 8); /** * The navigation bar for paginating the results. @@ -206,22 +203,11 @@ public class FileList extends Composite implements ClickHandler { */ private final Images images; - private String sortingProperty = "name"; - - private boolean sortingType = true; - - private HTML nameLabel; - - private HTML versionLabel; - - private HTML sizeLabel; - - private HTML dateLabel; - - private HTML ownerLabel; - - private HTML pathLabel; + private FileContextMenu menuShowing; + private CellTable celltable; + private final MultiSelectionModel selectionModel; + /** * Construct the file list widget. This entails setting up the widget * layout, fetching the number of files in the current folder from the @@ -233,44 +219,103 @@ public class FileList extends Composite implements ClickHandler { public FileList(Images _images) { images = _images; - prevButton.addClickHandler(this); - nextButton.addClickHandler(this); - + contextMenu = new DnDSimpleFocusPanel(new HTML(AbstractImagePrototype.create(images.fileContextMenu()).getHTML())); GSS.get().getDragController().makeDraggable(contextMenu); // Setup the table. - table.setCellSpacing(0); - table.setCellPadding(2); - table.setWidth("100%"); - - // Hook up events. - table.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - Cell cell = table.getCellForEvent(event); - GWT.log("row clicked:"+cell.getRowIndex(), null); - onRowClicked(cell.getRowIndex(), true); - } - }); + // Create the 'navigation' bar at the upper-right. HorizontalPanel innerNavBar = new HorizontalPanel(); innerNavBar.setStyleName("gss-ListNavBar"); innerNavBar.setSpacing(8); - innerNavBar.add(prevButton); innerNavBar.add(countLabel); - innerNavBar.add(nextButton); navBar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); navBar.add(innerNavBar); navBar.setWidth("100%"); + ProvidesKey keyProvider = new ProvidesKey(){ - initWidget(table); - setStyleName("gss-List"); + @Override + public Object getKey(FileResource item) { + return item.getUri(); + } + + }; + celltable = new CellTable(keyProvider); + + + Column status = new Column(new ImageResourceCell()) { + @Override + public ImageResource getValue(FileResource entity) { + return getFileIcon(entity); + } + }; + celltable.addColumn(status,""); + TextColumn nameColumn = new TextColumn() { - initTable(); - DeferredCommand.addCommand(new IncrementalCommand() { + @Override + public String getValue(FileResource object) { + // TODO Auto-generated method stub + return object.getName(); + }}; + + celltable.addColumn(nameColumn,"Name"); + celltable.addColumn(new TextColumn() { + @Override + public String getValue(FileResource object) { + // TODO Auto-generated method stub + return object.getOwner(); + } + },"Owner"); + celltable.addColumn(new TextColumn() { + @Override + public String getValue(FileResource object) { + // TODO Auto-generated method stub + return object.getPath(); + } + },"Path"); + celltable.addColumn(new TextColumn() { + @Override + public String getValue(FileResource object) { + // TODO Auto-generated method stub + return object.getVersion().toString(); + } + },"Version"); + celltable.addColumn(new TextColumn() { + @Override + public String getValue(FileResource object) { + // TODO Auto-generated method stub + return object.getFileSizeAsString(); + } + },"Size"); + celltable.addColumn(new TextColumn() { + @Override + public String getValue(FileResource object) { + return formatter.format(object.getModificationDate()); + } + },"Last Modified"); + initWidget(celltable); + setStyleName("gss-List"); + selectionModel = new MultiSelectionModel(); + + + Handler selectionHandler = new SelectionChangeEvent.Handler() { + @Override + public void onSelectionChange(com.google.gwt.view.client.SelectionChangeEvent event) { + if(getSelectedFiles().size()==1) + GSS.get().setCurrentSelection(getSelectedFiles().get(0)); + else + GSS.get().setCurrentSelection(getSelectedFiles()); + contextMenu.setFiles(getSelectedFiles()); + } + }; + selectionModel.addSelectionChangeHandler(selectionHandler); + + celltable.setSelectionModel(selectionModel,DefaultSelectionEventManager.createDefaultManager()); + celltable.setPageSize(GSS.VISIBLE_FILE_COUNT); + celltable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); + Scheduler.get().scheduleIncremental(new RepeatingCommand() { @Override public boolean execute() { @@ -285,62 +330,28 @@ public class FileList extends Composite implements ClickHandler { sinkEvents(Event.ONDBLCLICK); GSS.preventIESelection(); } - - @Override - public void onClick(ClickEvent event) { - if(event.getSource() == nextButton){ - // Move forward a page. - clearSelectedRows(); - startIndex += GSS.VISIBLE_FILE_COUNT; - if (startIndex >= folderFileCount) - startIndex -= GSS.VISIBLE_FILE_COUNT; - else - update(false); - } else if (event.getSource() == prevButton) { - clearSelectedRows(); - // Move back a page. - startIndex -= GSS.VISIBLE_FILE_COUNT; - if (startIndex < 0) - startIndex = 0; - else - update(false); - } - } + + public List getSelectedFiles() { + return new ArrayList(selectionModel.getSelectedSet()); + } + + @Override public void onBrowserEvent(Event event) { - if (DOM.eventGetType(event) == Event.ONMOUSEDOWN && DOM.eventGetButton(event) == NativeEvent.BUTTON_RIGHT){ - if (DOM.eventGetCtrlKey(event)) - clickControl = true; - else - clickControl = false; - if (DOM.eventGetShiftKey(event)) { - clickShift = true; - if (selectedRows.size() == 1) - firstShift = selectedRows.get(0) - startIndex; - //event.preventDefault(); - } else { - clickShift = false; - firstShift = -1; - //event.preventDefault(); - } - int ri = table.getRowForEvent2(event); - if(ri != -1) - if(!selectedRows.contains(ri-1)) - onRowClicked(ri, false); - } + if (files == null || files.size() == 0) { - if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && selectedRows.size() == 0) { + if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && getSelectedFiles().size() == 0) { menuShowing = new FileContextMenu(images, false, true); menuShowing=menuShowing.onEmptyEvent(event); } return; } - if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && selectedRows.size() != 0) { + if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && getSelectedFiles().size() != 0) { GWT.log("*****GOING TO SHOW CONTEXT MENU ****", null); menuShowing = new FileContextMenu(images, false, false); menuShowing=menuShowing.onEvent(event); - } else if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && selectedRows.size() == 0) { + } else if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && getSelectedFiles().size() == 0) { menuShowing = new FileContextMenu(images, false, true); menuShowing=menuShowing.onEmptyEvent(event); } else if (DOM.eventGetType(event) == Event.ONDBLCLICK) @@ -356,22 +367,6 @@ public class FileList extends Composite implements ClickHandler { event.preventDefault(); return; } - if (DOM.eventGetType(event) == Event.ONCLICK) { - if (DOM.eventGetCtrlKey(event)) - clickControl = true; - else - clickControl = false; - if (DOM.eventGetShiftKey(event)) { - clickShift = true; - if (selectedRows.size() == 1) - firstShift = selectedRows.get(0) - startIndex; - //event.preventDefault(); - } else { - clickShift = false; - firstShift = -1; - //event.preventDefault(); - } - } super.onBrowserEvent(event); } @@ -389,188 +384,9 @@ public class FileList extends Composite implements ClickHandler { return DONE; } - private void onRowClicked(int row, boolean toggleSelection) { - // Select the row that was clicked (-1 to account for header row). - if (row > folderFileCount) - return; - if (clickShift) { - GWT.log("Row is: " + row + " fs: " + firstShift, null); - if (firstShift == -1){ - firstShift = row; - makeRowDraggable(row); - } - else if (row > firstShift) { - clearSelectedRows(); - for (int i = firstShift; i < row; i++) { - selectedRows.add(startIndex + i); - styleRow(i, true); - makeRowDraggable(i+1); - } - GSS.get().setCurrentSelection(getSelectedFiles()); - contextMenu.setFiles(getSelectedFiles()); - //makeRowDraggable(row); - } else if (row != -1 && row == firstShift) { - selectedRows.add(row - 1); - styleRow(row, true); - styleRow(row - 1, true); - GSS.get().setCurrentSelection(getSelectedFiles()); - contextMenu.setFiles(getSelectedFiles()); - makeRowDraggable(row); - makeRowDraggable(row+1); - } else if (row < firstShift) { - GWT.log("Row is:" + row + " fs:" + firstShift, null); - clearSelectedRows(); - - for (int i = firstShift; i >= row - 1; i--) { - selectedRows.add(startIndex + i); - styleRow(i, true); - makeRowDraggable(i+1); - } - GSS.get().setCurrentSelection(getSelectedFiles()); - //makeRowDraggable(row); - contextMenu.setFiles(getSelectedFiles()); - } - } else if (row > 0) - selectRow(row - 1, toggleSelection); - } - - /** - * Initializes the table so that it contains enough rows for a full page of - * files. - */ - private void initTable() { - nameLabel = new HTML("Name"); - nameLabel.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - sortFiles("name"); - } - - }); - versionLabel = new HTML("Version"); - versionLabel.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - sortFiles("version"); - } - - }); - sizeLabel = new HTML("Size"); - sizeLabel.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - sortFiles("size"); - } - - }); - dateLabel = new HTML("Last modified"); - dateLabel.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - sortFiles("date"); - } - - }); - ownerLabel = new HTML("Owner"); - ownerLabel.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - sortFiles("owner"); - } - - }); - pathLabel = new HTML("Path"); - pathLabel.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - sortFiles("path"); - } - - }); - // Create the header row. - table.setText(0, 0, ""); - table.setWidget(0, 1, nameLabel); - table.setWidget(0, 2, ownerLabel); - table.setWidget(0, 3, pathLabel); - table.setWidget(0, 4, versionLabel); - table.setWidget(0, 5, sizeLabel); - table.setWidget(0, 6, dateLabel); - table.setWidget(0, 7, navBar); - table.getRowFormatter().setStyleName(0, "gss-ListHeader"); - - // Initialize the rest of the rows. - for (int i = 1; i < GSS.VISIBLE_FILE_COUNT + 1; ++i) { - table.setText(i, 0, ""); - table.setText(i, 1, ""); - table.setText(i, 2, ""); - table.setText(i, 3, ""); - table.setText(i, 4, ""); - table.setText(i, 5, ""); - table.setText(i, 6, ""); - table.setText(i, 7, ""); - table.getCellFormatter().setWordWrap(i, 0, false); - table.getCellFormatter().setWordWrap(i, 1, false); - table.getCellFormatter().setWordWrap(i, 2, false); - table.getCellFormatter().setWordWrap(i, 3, false); - table.getCellFormatter().setWordWrap(i, 4, false); - table.getCellFormatter().setWordWrap(i, 5, false); - table.getCellFormatter().setWordWrap(i, 6, false); - table.getCellFormatter().setWordWrap(i, 7, false); - table.getCellFormatter().setHorizontalAlignment(i, 4, HasHorizontalAlignment.ALIGN_CENTER); - } - prevButton.setVisible(false); - nextButton.setVisible(false); - } - - /** - * Selects the given row (relative to the current page). - * - * @param row the row to be selected - */ - private void selectRow(final int row, boolean toggleSelection) { - if (row < folderFileCount) { - if (clickControl) - if (selectedRows.contains(row) && toggleSelection) { - int i = selectedRows.indexOf(startIndex + row); - selectedRows.remove(i); - styleRow(row, false); - } else { - selectedRows.add(startIndex + row); - styleRow(row, true); - } - else if (selectedRows.size() == 1 && selectedRows.contains(row) && toggleSelection){ - clearSelectedRows(); - return; - } - else { - clearSelectedRows(); - selectedRows.add(startIndex + row); - styleRow(row, true); - } - if (selectedRows.size() == 1) - GSS.get().setCurrentSelection(files.get(selectedRows.get(0))); - else if(selectedRows.size() == 0) - GSS.get().setCurrentSelection(null); - else - GSS.get().setCurrentSelection(getSelectedFiles()); - contextMenu.setFiles(getSelectedFiles()); - makeRowDraggable(row+1); - } - } - - public List getSelectedFiles() { - List result = new ArrayList(); - for (int i : selectedRows) - result.add(files.get(i)); - return result; - } + + /** * Make the specified row look like selected or not, according to the * selected flag. @@ -579,11 +395,7 @@ public class FileList extends Composite implements ClickHandler { * @param selected */ void styleRow(final int row, final boolean selected) { - if (row != -1 && row >= 0) - if (selected) - table.getRowFormatter().addStyleName(row + 1, "gss-SelectedRow"); - else - table.getRowFormatter().removeStyleName(row + 1, "gss-SelectedRow"); + } /** @@ -596,137 +408,18 @@ public class FileList extends Composite implements ClickHandler { max = count; folderTotalSize = 0; - if (sort && files != null && files.size() != 0) { - clearLabels(); - clearSelectedRows(); - - Collections.sort(files, new Comparator() { - - @Override - public int compare(FileResource arg0, FileResource arg1) { - AbstractImagePrototype descPrototype = AbstractImagePrototype.create(images.desc()); - AbstractImagePrototype ascPrototype = AbstractImagePrototype.create(images.asc()); - if (sortingType) - if (sortingProperty.equals("version")) { - versionLabel.setHTML("Version " + descPrototype.getHTML()); - return arg0.getVersion().compareTo(arg1.getVersion()); - } else if (sortingProperty.equals("owner")) { - ownerLabel.setHTML("Owner " + descPrototype.getHTML()); - return arg0.getOwner().compareTo(arg1.getOwner()); - } else if (sortingProperty.equals("date")) { - dateLabel.setHTML("Date modified " + descPrototype.getHTML()); - return arg0.getModificationDate().compareTo(arg1.getModificationDate()); - } else if (sortingProperty.equals("size")) { - sizeLabel.setHTML("Size " + descPrototype.getHTML()); - return arg0.getContentLength().compareTo(arg1.getContentLength()); - } else if (sortingProperty.equals("name")) { - nameLabel.setHTML("Name " + descPrototype.getHTML()); - return arg0.getName().compareTo(arg1.getName()); - } else if (sortingProperty.equals("path")) { - pathLabel.setHTML("Path " + descPrototype.getHTML()); - return arg0.getUri().compareTo(arg1.getUri()); - } else { - nameLabel.setHTML("Name " + descPrototype.getHTML()); - return arg0.getName().compareTo(arg1.getName()); - } - else if (sortingProperty.equals("version")) { - versionLabel.setHTML("Version " + ascPrototype.getHTML()); - return arg1.getVersion().compareTo(arg0.getVersion()); - } else if (sortingProperty.equals("owner")) { - ownerLabel.setHTML("Owner " + ascPrototype.getHTML()); - return arg1.getOwner().compareTo(arg0.getOwner()); - } else if (sortingProperty.equals("date")) { - dateLabel.setHTML("Date modified " + ascPrototype.getHTML()); - return arg1.getModificationDate().compareTo(arg0.getModificationDate()); - } else if (sortingProperty.equals("size")) { - sizeLabel.setHTML("Size " + ascPrototype.getHTML()); - return arg1.getContentLength().compareTo(arg0.getContentLength()); - } else if (sortingProperty.equals("name")) { - nameLabel.setHTML("Name " + ascPrototype.getHTML()); - return arg1.getName().compareTo(arg0.getName()); - } else if (sortingProperty.equals("path")) { - pathLabel.setHTML("Path " + ascPrototype.getHTML()); - return arg1.getUri().compareTo(arg0.getUri()); - } else { - nameLabel.setHTML("Name " + ascPrototype.getHTML()); - return arg1.getName().compareTo(arg0.getName()); - } - } - - }); - } - - - // Show the selected files. - int i = 1; - for (; i < GSS.VISIBLE_FILE_COUNT + 1; ++i) { - // Don't read past the end. - // if (i > folderFileCount) - // break; - if (startIndex + i > folderFileCount) - break; - // Add a new row to the table, then set each of its columns to the - // proper values. - FileResource file = files.get(startIndex + i - 1); - table.setWidget(i, 0, getFileIcon(file).createImage()); - table.getRowFormatter().addStyleName(i, "gss-fileRow"); - - //add view image link for image files - String contentType = file.getContentType(); - HTML nameHtml = null; - if (contentType.endsWith("png") || contentType.endsWith("gif") || contentType.endsWith("jpeg") ) - nameHtml = new HTML( file.getName() + " " + - "(view)" + ""); - else - nameHtml=new HTML( file.getName()); - table.setWidget(i, 1, nameHtml); - - if(GSS.get().findUserFullName(file.getOwner()) == null){ - GetUserCommand guc = new GetUserCommand(file.getOwner()); - guc.execute(); - GSS.get().putUserToMap(file.getOwner(), file.getOwner()); - } - table.setText(i, 2, GSS.get().getUserFullName(file.getOwner())); - table.setText(i, 3, file.getPath()); - table.setText(i, 4, String.valueOf(file.getVersion())); - table.setText(i, 5, String.valueOf(file.getFileSizeAsString())); - final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a"); - table.setText(i, 6, formatter.format(file.getModificationDate())); - folderTotalSize += file.getContentLength(); - } - - // Clear any remaining slots. - for (; i < GSS.VISIBLE_FILE_COUNT + 1; ++i) { - table.setHTML(i, 0, " "); - table.setHTML(i, 1, " "); - table.setHTML(i, 2, " "); - table.setHTML(i, 3, " "); - table.setHTML(i, 4, " "); - table.setHTML(i, 5, " "); - table.setHTML(i, 6, " "); - table.setHTML(i, 7, " "); - } - + celltable.setRowCount(files.size()); + celltable.setRowData(0,files); if (folderFileCount == 0) { showingStats = "no files"; - prevButton.setVisible(false); - nextButton.setVisible(false); } else if (folderFileCount < GSS.VISIBLE_FILE_COUNT) { if (folderFileCount == 1) showingStats = "1 file"; else showingStats = folderFileCount + " files"; showingStats += " (" + FileResource.getFileSizeAsString(folderTotalSize) + ")"; - prevButton.setVisible(false); - nextButton.setVisible(false); } else { showingStats = "" + (startIndex + 1) + " - " + max + " of " + count + " files" + " (" + FileResource.getFileSizeAsString(folderTotalSize) + ")"; - prevButton.setVisible(startIndex != 0); - nextButton.setVisible(startIndex + GSS.VISIBLE_FILE_COUNT < count); } updateCurrentlyShowingStats(); @@ -738,7 +431,7 @@ public class FileList extends Composite implements ClickHandler { * @param file * @return the icon */ - private AbstractImagePrototype getFileIcon(FileResource file) { + private ImageResource getFileIcon(FileResource file) { String mimetype = file.getContentType(); boolean shared = false; Folders folders = GSS.get().getFolders(); @@ -757,33 +450,33 @@ public class FileList extends Composite implements ClickHandler { else shared = file.isShared(); if (mimetype == null) - return shared ? AbstractImagePrototype.create(images.documentShared()) : AbstractImagePrototype.create(images.document()); + return shared ? images.documentShared() : images.document(); mimetype = mimetype.toLowerCase(); if (mimetype.startsWith("application/pdf")) - return shared ? AbstractImagePrototype.create(images.pdfShared()) : AbstractImagePrototype.create(images.pdf()); + return shared ? images.pdfShared() : images.pdf(); else if (mimetype.endsWith("excel")) - return shared ? AbstractImagePrototype.create(images.spreadsheetShared()) : AbstractImagePrototype.create(images.spreadsheet()); + return shared ? images.spreadsheetShared() : images.spreadsheet(); else if (mimetype.endsWith("msword")) - return shared ? AbstractImagePrototype.create(images.wordprocessorShared()) : AbstractImagePrototype.create(images.wordprocessor()); + return shared ? images.wordprocessorShared() : images.wordprocessor(); else if (mimetype.endsWith("powerpoint")) - return shared ? AbstractImagePrototype.create(images.presentationShared()) : AbstractImagePrototype.create(images.presentation()); + return shared ? images.presentationShared() : images.presentation(); else if (mimetype.startsWith("application/zip") || mimetype.startsWith("application/gzip") || mimetype.startsWith("application/x-gzip") || mimetype.startsWith("application/x-tar") || mimetype.startsWith("application/x-gtar")) - return shared ? AbstractImagePrototype.create(images.zipShared()) : AbstractImagePrototype.create(images.zip()); + return shared ? images.zipShared() : images.zip(); else if (mimetype.startsWith("text/html")) - return shared ? AbstractImagePrototype.create(images.htmlShared()) : AbstractImagePrototype.create(images.html()); + return shared ? images.htmlShared() : images.html(); else if (mimetype.startsWith("text/plain")) - return shared ? AbstractImagePrototype.create(images.txtShared()) : AbstractImagePrototype.create(images.txt()); + return shared ? images.txtShared() : images.txt(); else if (mimetype.startsWith("image/")) - return shared ? AbstractImagePrototype.create(images.imageShared()) : AbstractImagePrototype.create(images.image()); + return shared ? images.imageShared() : images.image(); else if (mimetype.startsWith("video/")) - return shared ? AbstractImagePrototype.create(images.videoShared()) : AbstractImagePrototype.create(images.video()); + return shared ? images.videoShared() : images.video(); else if (mimetype.startsWith("audio/")) - return shared ? AbstractImagePrototype.create(images.audioShared()) : AbstractImagePrototype.create(images.audio()); - return shared ? AbstractImagePrototype.create(images.documentShared()) : AbstractImagePrototype.create(images.document()); + return shared ? images.audioShared() : images.audio(); + return shared ? images.documentShared() : images.document(); } /** @@ -799,7 +492,7 @@ public class FileList extends Composite implements ClickHandler { * @param newHeight the new height to reach */ void resizeTableHeight(final int newHeight) { - GWT.log("Panel: " + newHeight + ", parent: " + table.getParent().getOffsetHeight(), null); + /*GWT.log("Panel: " + newHeight + ", parent: " + table.getParent().getOffsetHeight(), null); // Fill the rest with empty slots. if (newHeight > table.getOffsetHeight()) while (newHeight > table.getOffsetHeight()) { @@ -810,7 +503,7 @@ public class FileList extends Composite implements ClickHandler { while (newHeight < table.getOffsetHeight()) { table.resizeRows(table.getRowCount() - 1); GWT.log("Table: " + table.getOffsetHeight() + ", rows: " + table.getRowCount(), null); - } + }*/ } public void updateFileCache(boolean updateSelectedFolder, final boolean clearSelection) { @@ -974,7 +667,6 @@ public class FileList extends Composite implements ClickHandler { private void updateFileCache(boolean clearSelection, String newFilename) { if (clearSelection) clearSelectedRows(); - clearLabels(); startIndex = 0; final TreeItem folderItem = GSS.get().getFolders().getCurrent(); // Validation. @@ -1001,21 +693,6 @@ public class FileList extends Composite implements ClickHandler { setFiles(dnd.getFolderResource().getFiles()); update(true); - if (!clearSelection && selectedRows.size()==1 && newFilename!=null) { - int row = -1; - for (int i=1; i < GSS.VISIBLE_FILE_COUNT + 1; ++i) { - if (startIndex + i > folderFileCount) - break; - FileResource file = files.get(startIndex + i - 1); - if (newFilename.equals(file.getName())) { - row = i-1; - break; - } - } - clearSelectedRows(); - if (row!=-1) - selectRow(row, true); - } } } @@ -1041,34 +718,9 @@ public class FileList extends Composite implements ClickHandler { folderFileCount = files.size(); } - private void sortFiles(final String sortProperty) { - if (sortProperty.equals(sortingProperty)) - sortingType = !sortingType; - else { - sortingProperty = sortProperty; - sortingType = true; - } - update(true); - } - - private void clearLabels() { - nameLabel.setText("Name"); - versionLabel.setText("Version"); - sizeLabel.setText("Size"); - dateLabel.setText("Last modified"); - ownerLabel.setText("Owner"); - pathLabel.setText("Path"); - } - - /** - * Retrieve the table. - * - * @return the table - */ - Grid getTable() { - return table; - } + + /** * Does the list contains the requested filename * @@ -1083,7 +735,12 @@ public class FileList extends Composite implements ClickHandler { } public void clearSelectedRows() { - for (int r : selectedRows) { + Iterator it = selectionModel.getSelectedSet().iterator(); + while(it.hasNext()){ + selectionModel.setSelected(it.next(),false); + } + + /*for (int r : selectedRows) { int row = r - startIndex; styleRow(row, false); makeRowNotDraggable(row+1); @@ -1095,14 +752,14 @@ public class FileList extends Composite implements ClickHandler { if(menuShowing != null && menuShowing.isShowing()){ menuShowing.hide(); menuShowing=null; - } + }*/ } /** * */ public void selectAllRows() { - clearSelectedRows(); + /*clearSelectedRows(); int count = folderFileCount; if (count == 0) return; @@ -1121,13 +778,13 @@ public class FileList extends Composite implements ClickHandler { makeRowDraggable(i); } GSS.get().setCurrentSelection(getSelectedFiles()); - contextMenu.setFiles(getSelectedFiles()); + contextMenu.setFiles(getSelectedFiles());*/ } private void makeRowDraggable(int row){ - int contextRow = getWidgetRow(contextMenu, table); + /* int contextRow = getWidgetRow(contextMenu, table); if (contextRow != -1) table.setWidget(contextRow, 0, getFileIcon(files.get(contextRow - 1)).createImage()); contextMenu.setWidget(new HTML(getFileIcon(files.get(row - 1)).getHTML())); @@ -1136,24 +793,25 @@ public class FileList extends Composite implements ClickHandler { //GSS.get().getDragController().makeDraggable(table.getWidget(row, i)); table.setWidget(row, 1, new DnDSimpleFocusPanel(table.getWidget(row, 1))); ((DnDSimpleFocusPanel)table.getWidget(row, 1)).setFiles(getSelectedFiles()); - GSS.get().getDragController().makeDraggable(table.getWidget(row, 1)); + GSS.get().getDragController().makeDraggable(table.getWidget(row, 1));*/ } private void makeRowNotDraggable(int row){ - if(table.getWidget(row, 1) instanceof DnDSimpleFocusPanel){ + /*if(table.getWidget(row, 1) instanceof DnDSimpleFocusPanel){ ((DnDSimpleFocusPanel)table.getWidget(row, 1)).setFiles(null); GSS.get().getDragController().makeNotDraggable(table.getWidget(row, 1)); table.setWidget(row, 1, new DnDSimpleFocusPanel(((DnDSimpleFocusPanel)table.getWidget(row, 1)).getWidget())); } + */ } private int getWidgetRow(Widget widget, Grid grid) { - for (int row = 0; row < grid.getRowCount(); row++) + /*for (int row = 0; row < grid.getRowCount(); row++) for (int col = 0; col < grid.getCellCount(row); col++) { Widget w = table.getWidget(row, col); if (w == widget) return row; - } + }*/ return -1; } diff --git a/src/gr/ebs/gss/server/admin/AdminServiceImpl.java b/src/gr/ebs/gss/server/admin/AdminServiceImpl.java deleted file mode 100644 index 98df25f..0000000 --- a/src/gr/ebs/gss/server/admin/AdminServiceImpl.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright 2010 Electronic Business Systems Ltd. - * - * This file is part of GSS. - * - * GSS is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GSS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GSS. If not, see . - */ -package gr.ebs.gss.server.admin; - -import static gr.ebs.gss.server.configuration.GSSConfigurationFactory.getConfiguration; -import gr.ebs.gss.admin.client.AdminService; -import gr.ebs.gss.client.exceptions.InsufficientPermissionsException; -import gr.ebs.gss.client.exceptions.ObjectNotFoundException; -import gr.ebs.gss.client.exceptions.RpcException; -import gr.ebs.gss.server.configuration.GSSConfigurationFactory; -import gr.ebs.gss.server.domain.dto.FileBodyDTO; -import gr.ebs.gss.server.domain.dto.FileHeaderDTO; -import gr.ebs.gss.server.domain.dto.PermissionDTO; -import gr.ebs.gss.server.domain.dto.StatsDTO; -import gr.ebs.gss.server.domain.dto.SystemStatsDTO; -import gr.ebs.gss.server.domain.dto.UserClassDTO; -import gr.ebs.gss.server.domain.dto.UserDTO; -import gr.ebs.gss.server.ejb.AdminAPI; - -import java.util.Date; -import java.util.List; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.rmi.PortableRemoteObject; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.google.gwt.user.server.rpc.RemoteServiceServlet; - -public class AdminServiceImpl extends RemoteServiceServlet implements AdminService { - /** - * The logger. - */ - private static Log logger = LogFactory.getLog(AdminServiceImpl.class); - - /** - * A helper method that retrieves a reference to the AdminAPI bean and - * stores it for future use. - * - * @return an AdminAPI instance - * @throws RpcException in case an error occurs - */ - protected AdminAPI getService() throws RpcException { - try { - final Context ctx = new InitialContext(); - final Object ref = ctx.lookup(getConfiguration().getString("adminApiPath")); - return (AdminAPI) PortableRemoteObject.narrow(ref, AdminAPI.class); - } catch (final NamingException e) { - logger.error("Unable to retrieve the AdminAPI EJB", e); - throw new RpcException("An error occurred while contacting the naming service"); - } - } - - @Override - public List getUsers() throws RpcException, ObjectNotFoundException { - return getService().searchUsers(""); - } - - @Override - public StatsDTO getUserStatistics(Long userId) throws RpcException, ObjectNotFoundException { - return getService().getUserStatistics(userId); - } - - - - @Override - public void toggleActiveUser(Long userId) throws RpcException, ObjectNotFoundException { - getService().toggleActiveUser(userId); - - } - - @Override - public void setFilePermissions(String uri, Set permissions) throws ObjectNotFoundException, RpcException { - getService().setFilePermissions(uri, permissions); - } - - @Override - public List searchUsers(String query) throws RpcException, ObjectNotFoundException { - return getService().searchUsers(query); - } - - @Override - public SystemStatsDTO getSystemStatistics() throws RpcException { - return getService().getSystemStatistics(); - } - - @Override - public List getLastLoggedInUsers(Date lastLoginDate) throws RpcException { - return getService().getLastLoggedInUsers(lastLoginDate); - } - - @Override - public void logout() { - getThreadLocalRequest().getSession().invalidate(); - } - - @Override - public List searchFiles(String query) throws RpcException, ObjectNotFoundException, InsufficientPermissionsException { - if(query==null) - throw new ObjectNotFoundException("Invalid query"); - String restUrl = GSSConfigurationFactory.getConfiguration().getString("restUrl"); - if(query.startsWith(restUrl)) - query= query.substring(restUrl.length(),query.length()); - if(query.indexOf("/")==-1)//do only a name search - return getService().searchFileByFilename(query); - return getService().getFiles(query); - } - - @Override - public UserDTO getUser(String username) throws ObjectNotFoundException, RpcException{ - return getService().getUser(username); - } - - @Override - public FileHeaderDTO getFile(long fileId) throws ObjectNotFoundException, RpcException { - return getService().getFile(fileId); - } - - @Override - public List getVersions(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException, RpcException { - return getService().getVersions(userId, fileId); - } - - @Override - public List getUsersWaitingActivation() throws RpcException { - return getService().getUsersWaitingActivation(); - } - - @Override - public void changeUserClass(Long userId, Long userClassId) throws RpcException, ObjectNotFoundException { - getService().changeUserClass(userId, userClassId); - - } - - @Override - public List getUserClasses() throws RpcException { - return getService().getUserClasses(); - } - - @Override - public void saveOrUpdateUserClass(UserClassDTO userClass) throws RpcException, ObjectNotFoundException { - getService().saveOrUpdateUserClass(userClass); - } - - @Override - public void removeUserClass(UserClassDTO userClass) throws RpcException, ObjectNotFoundException { - getService().removeUserClass(userClass); - } - - @Override - public void removeUser(Long userId) throws RpcException, ObjectNotFoundException, InsufficientPermissionsException { - getService().removeUser(userId); - - } - -} -- 1.7.10.4