removed commented code
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@142706 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4ce9b3ae3a
commit
3cabd41cdf
|
@ -1176,13 +1176,18 @@ public class AppController implements SubscriberInterface {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<ExtendedWorkspaceACL> res) {
|
public void onSuccess(List<ExtendedWorkspaceACL> res) {
|
||||||
FileModel parent = wsPortlet.getToolBarPath().getLastParent();
|
FileModel parent = wsPortlet.getToolBarPath().getLastParent();
|
||||||
GWT.log("Validating correct ACL id: "+parentId +" and "+parent.getIdentifier());
|
ConstantsExplorer.log("Validating correct ACL id: "+parentId +" and "+parent.getIdentifier());
|
||||||
if(parentId.compareTo(parent.getIdentifier())==0){
|
if(parentId.compareTo(parent.getIdentifier())==0){
|
||||||
if(res!=null && res.size()>0){
|
if(res!=null && res.size()>0){
|
||||||
wsPortlet.getToolBarItemDetails().updateACLInfo(res.get(0));
|
wsPortlet.getToolBarItemDetails().updateACLInfo(res.get(0));
|
||||||
wsPortlet.getToolBarItemDetails().updateAddAdministatorInfo(appContrExplorer.myLogin, res.get(0));
|
wsPortlet.getToolBarItemDetails().updateAddAdministatorInfo(AppControllerExplorer.myLogin, res.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if(res!=null && res.size()>0){
|
||||||
|
// wsPortlet.getToolBarItemDetails().updateACLInfo(res.get(0));
|
||||||
|
// wsPortlet.getToolBarItemDetails().updateAddAdministatorInfo(AppControllerExplorer.myLogin, res.get(0));
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.user.workspace.client.view.toolbars;
|
package org.gcube.portlets.user.workspace.client.view.toolbars;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspace.client.AppController;
|
import org.gcube.portlets.user.workspace.client.AppController;
|
||||||
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||||
import org.gcube.portlets.user.workspace.client.event.AccountingHistoryEvent;
|
import org.gcube.portlets.user.workspace.client.event.AccountingHistoryEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.AccountingReadersEvent;
|
import org.gcube.portlets.user.workspace.client.event.AccountingReadersEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.AddAdministratorEvent;
|
import org.gcube.portlets.user.workspace.client.event.AddAdministratorEvent;
|
||||||
|
@ -19,6 +20,7 @@ import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||||
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
||||||
import com.extjs.gxt.ui.client.widget.Label;
|
import com.extjs.gxt.ui.client.widget.Label;
|
||||||
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||||
import com.extjs.gxt.ui.client.widget.Text;
|
import com.extjs.gxt.ui.client.widget.Text;
|
||||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||||
import com.extjs.gxt.ui.client.widget.form.TextField;
|
import com.extjs.gxt.ui.client.widget.form.TextField;
|
||||||
|
@ -32,26 +34,26 @@ import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GxtBottomToolBarItem extends ToolBar{
|
public class GxtBottomToolBarItem extends ToolBar{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected static final String INFO = "Info";
|
protected static final String INFO = "Info";
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected static final String READ = "Read";
|
protected static final String READ = "Read";
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected static final String HISTORY = "History";
|
protected static final String HISTORY = "History";
|
||||||
private static final String EDIT_ADMINISTRATOR = "Edit Admnistrator/s";
|
private static final String EDIT_ADMINISTRATOR = "Edit Administrator/s";
|
||||||
|
|
||||||
private TextField<String> txfName = new TextField<String>();
|
private TextField<String> txfName = new TextField<String>();
|
||||||
private Text txtOwner = new Text("Empty");
|
private Text txtOwner = new Text("Empty");
|
||||||
private Text txtCreationTime = new Text("Empty");
|
private Text txtCreationTime = new Text("Empty");
|
||||||
private Text txtDimension = new Text("Empty");
|
private Text txtDimension = new Text("Empty");
|
||||||
|
|
||||||
private Button btnGetInfo;
|
private Button btnGetInfo;
|
||||||
private Button bHistory;
|
private Button bHistory;
|
||||||
private Button bRead;
|
private Button bRead;
|
||||||
|
@ -60,12 +62,12 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
private Label labelItemsNumber = new Label();
|
private Label labelItemsNumber = new Label();
|
||||||
private HorizontalPanel hpItemsNumber;
|
private HorizontalPanel hpItemsNumber;
|
||||||
private Button btnAddAdmin;
|
private Button btnAddAdmin;
|
||||||
|
|
||||||
public GxtBottomToolBarItem(){
|
public GxtBottomToolBarItem(){
|
||||||
super();
|
super();
|
||||||
initToolbar();
|
initToolbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.extjs.gxt.ui.client.widget.Component#onLoad()
|
* @see com.extjs.gxt.ui.client.widget.Component#onLoad()
|
||||||
*/
|
*/
|
||||||
|
@ -74,9 +76,9 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
super.onLoad();
|
super.onLoad();
|
||||||
setItemsNumberToCenter();
|
setItemsNumberToCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initToolbar(){
|
private void initToolbar(){
|
||||||
|
|
||||||
btnGetTrash = new Button("Trash");
|
btnGetTrash = new Button("Trash");
|
||||||
btnGetTrash.setIcon(Resources.getTrashEmpty());
|
btnGetTrash.setIcon(Resources.getTrashEmpty());
|
||||||
btnGetTrash.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
btnGetTrash.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
@ -88,33 +90,33 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bHistory = new Button(HISTORY);
|
bHistory = new Button(HISTORY);
|
||||||
bHistory.setIcon(Resources.getIconHistory());
|
bHistory.setIcon(Resources.getIconHistory());
|
||||||
|
|
||||||
bHistory.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
bHistory.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
AppController.getEventBus().fireEvent(new AccountingHistoryEvent(null));
|
AppController.getEventBus().fireEvent(new AccountingHistoryEvent(null));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bRead = new Button(READ);
|
bRead = new Button(READ);
|
||||||
bRead.setIcon(Resources.getIconNotRead());
|
bRead.setIcon(Resources.getIconNotRead());
|
||||||
|
|
||||||
bRead.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
bRead.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
AppController.getEventBus().fireEvent(new AccountingReadersEvent(null));
|
AppController.getEventBus().fireEvent(new AccountingReadersEvent(null));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
btnGetInfo = new Button(INFO);
|
btnGetInfo = new Button(INFO);
|
||||||
btnGetInfo.setIcon(Resources.getIconInfo());
|
btnGetInfo.setIcon(Resources.getIconInfo());
|
||||||
btnGetInfo.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
btnGetInfo.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
@ -126,8 +128,7 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
btnAddAdmin = new Button(EDIT_ADMINISTRATOR);
|
btnAddAdmin = new Button(EDIT_ADMINISTRATOR);
|
||||||
//TODO CHANGE ICON
|
//TODO CHANGE ICON
|
||||||
btnAddAdmin.setIcon(Resources.getIconManageAdministrator());
|
btnAddAdmin.setIcon(Resources.getIconManageAdministrator());
|
||||||
|
@ -141,126 +142,91 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
AppController.getEventBus().fireEvent(new AddAdministratorEvent(null));
|
AppController.getEventBus().fireEvent(new AddAdministratorEvent(null));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setVisibleAddAdministrators(false);
|
|
||||||
|
|
||||||
aclDivInfo = new ACLDivInfo("", null);
|
|
||||||
|
|
||||||
//COMMENTED AT 29/08/2013
|
|
||||||
// add(new SeparatorToolItem());
|
|
||||||
// add(bRead);
|
|
||||||
|
|
||||||
|
setVisibleAddAdministrators(false);
|
||||||
|
|
||||||
|
aclDivInfo = new ACLDivInfo("", null);
|
||||||
add(btnGetTrash);
|
add(btnGetTrash);
|
||||||
// add(new SeparatorMenuItem());
|
|
||||||
add(btnGetInfo);
|
add(btnGetInfo);
|
||||||
add(bHistory);
|
add(bHistory);
|
||||||
|
|
||||||
hpItemsNumber = new HorizontalPanel();
|
hpItemsNumber = new HorizontalPanel();
|
||||||
hpItemsNumber.setId("HP-ItemsNumber");
|
hpItemsNumber.setId("HP-ItemsNumber");
|
||||||
hpItemsNumber.setStyleAttribute("margin-right", "50px");
|
hpItemsNumber.setStyleAttribute("margin-right", "50px");
|
||||||
|
|
||||||
hpItemsNumber.setHorizontalAlign(HorizontalAlignment.RIGHT);
|
hpItemsNumber.setHorizontalAlign(HorizontalAlignment.RIGHT);
|
||||||
hpItemsNumber.add(labelItemsNumber);
|
hpItemsNumber.add(labelItemsNumber);
|
||||||
|
|
||||||
// hpItemsNumber.addListener(Events.Render, new Listener<BaseEvent>() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void handleEvent(BaseEvent be) {
|
|
||||||
// setItemsNumberToCenter();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// add(new FillToolItem());
|
|
||||||
add(hpItemsNumber);
|
add(hpItemsNumber);
|
||||||
FillToolItem filler = new FillToolItem();
|
FillToolItem filler = new FillToolItem();
|
||||||
filler.setId("filler-item");
|
filler.setId("filler-item");
|
||||||
add(filler);
|
add(filler);
|
||||||
add(btnAddAdmin);
|
add(btnAddAdmin);
|
||||||
add(aclDivInfo);
|
add(aclDivInfo);
|
||||||
|
|
||||||
enableInfoHistoryButtons(false);
|
enableInfoHistoryButtons(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setVisibleAddAdministrators(boolean bool){
|
private void setVisibleAddAdministrators(boolean bool){
|
||||||
btnAddAdmin.setVisible(bool);
|
btnAddAdmin.setVisible(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void resetDetails(){
|
public void resetDetails(){
|
||||||
|
|
||||||
this.txtDimension.setText("");
|
this.txtDimension.setText("");
|
||||||
this.txtCreationTime.setText("");
|
this.txtCreationTime.setText("");
|
||||||
this.txfName.reset();
|
this.txfName.reset();
|
||||||
this.txtOwner.setText("");
|
this.txtOwner.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableInfoHistoryButtons(boolean enable){
|
public void enableInfoHistoryButtons(boolean enable){
|
||||||
bHistory.setEnabled(enable);
|
bHistory.setEnabled(enable);
|
||||||
bRead.setEnabled(enable);
|
bRead.setEnabled(enable);
|
||||||
btnGetInfo.setEnabled(enable);
|
btnGetInfo.setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDetails(String itemName, String description, String dimension, String creationTime, String owner){
|
public void setDetails(String itemName, String description, String dimension, String creationTime, String owner){
|
||||||
|
|
||||||
this.resetDetails();
|
this.resetDetails();
|
||||||
|
|
||||||
this.txtDimension.setText(dimension);
|
this.txtDimension.setText(dimension);
|
||||||
this.txtCreationTime.setText(creationTime);
|
this.txtCreationTime.setText(creationTime);
|
||||||
this.txfName.setValue(itemName);
|
this.txfName.setValue(itemName);
|
||||||
this.txtOwner.setText(owner);
|
this.txtOwner.setText(owner);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @param markAsRead
|
|
||||||
// */
|
|
||||||
// public void setRead(boolean markAsRead) {
|
|
||||||
// if(markAsRead)
|
|
||||||
// bRead.setIcon(Resources.getIconRead());
|
|
||||||
// else
|
|
||||||
// bRead.setIcon(Resources.getIconNotRead());
|
|
||||||
//
|
|
||||||
// bRead.setEnabled(markAsRead);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
public void updateACLInfo(WorkspaceACL acl){
|
public void updateACLInfo(WorkspaceACL acl){
|
||||||
setVisibleAddAdministrators(false);
|
setVisibleAddAdministrators(false);
|
||||||
|
|
||||||
if(acl==null){
|
if(acl==null){
|
||||||
aclDivInfo.updateInfo(null, null);
|
aclDivInfo.updateInfo(null, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractImagePrototype img = GetPermissionIconByACL.getImage(acl);
|
AbstractImagePrototype img = GetPermissionIconByACL.getImage(acl);
|
||||||
|
|
||||||
// if(acl.getUserType().equals(USER_TYPE.ADMINISTRATOR)){
|
|
||||||
// setVisibleAddAdministrators(true);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
aclDivInfo.updateInfo(acl.getLabel(), img);
|
aclDivInfo.updateInfo(acl.getLabel(), img);
|
||||||
this.layout();
|
this.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateAddAdministatorInfo(String loginUserLogger, ExtendedWorkspaceACL acl){
|
public void updateAddAdministatorInfo(String loginUserLogger, ExtendedWorkspaceACL acl){
|
||||||
setVisibleAddAdministrators(false);
|
setVisibleAddAdministrators(false);
|
||||||
|
|
||||||
String loginOwner = acl.getLoginOwner();
|
if(loginUserLogger==null || loginUserLogger.isEmpty())
|
||||||
|
MessageBox.alert("Error", "I could not get you username yet.. please try again", null);
|
||||||
if(loginOwner!=null && !loginOwner.isEmpty() && loginUserLogger!=null && !loginUserLogger.isEmpty() && acl.isBaseSharedFolder()){
|
|
||||||
GWT.log("Comparing loginUserLogger: "+loginUserLogger +" and loginUserLogger: "+loginUserLogger +" to update AdministorInfo");
|
ConstantsExplorer.log("acl isBaseSharedFolder: "+acl.isBaseSharedFolder() +", user type: "+acl.getUserType() + ", owner: "+acl.getLoginOwner() + ", acl item id: "+acl.getWorkspaceItemId());
|
||||||
if((loginOwner.compareToIgnoreCase(loginUserLogger)==0) && acl.getUserType().equals(USER_TYPE.ADMINISTRATOR)){
|
|
||||||
|
if(acl.isBaseSharedFolder()){
|
||||||
|
if(acl.getUserType().equals(USER_TYPE.ADMINISTRATOR)){
|
||||||
setVisibleAddAdministrators(true);
|
setVisibleAddAdministrators(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.layout();
|
this.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTrashIcon(boolean trashIsFull){
|
public void updateTrashIcon(boolean trashIsFull){
|
||||||
|
|
||||||
if(trashIsFull)
|
if(trashIsFull)
|
||||||
btnGetTrash.setIcon(Resources.getTrashFull());
|
btnGetTrash.setIcon(Resources.getTrashFull());
|
||||||
else
|
else
|
||||||
|
@ -277,19 +243,19 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
labelItemsNumber.setText("1 Item");
|
labelItemsNumber.setText("1 Item");
|
||||||
else if(size>1)
|
else if(size>1)
|
||||||
labelItemsNumber.setText(size +" Items");
|
labelItemsNumber.setText(size +" Items");
|
||||||
|
|
||||||
hpItemsNumber.layout();
|
hpItemsNumber.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItemsNumberToCenter(){
|
public void setItemsNumberToCenter(){
|
||||||
|
|
||||||
if(this.isRendered()){
|
if(this.isRendered()){
|
||||||
String width = this.getElement().getStyle().getWidth();
|
String width = this.getElement().getStyle().getWidth();
|
||||||
width = width.replace("px", "");
|
width = width.replace("px", "");
|
||||||
try{
|
try{
|
||||||
long intWidth = Long.parseLong(width);
|
long intWidth = Long.parseLong(width);
|
||||||
intWidth = (intWidth/2)-30; //calculate the center
|
intWidth = intWidth/2-30; //calculate the center
|
||||||
intWidth = intWidth-(60*3); //previous buttons
|
intWidth = intWidth-60*3; //previous buttons
|
||||||
GWT.log("refreshSize width is "+width);
|
GWT.log("refreshSize width is "+width);
|
||||||
// hpItemsNumber.setWidth(intWidth+"px");
|
// hpItemsNumber.setWidth(intWidth+"px");
|
||||||
hpItemsNumber.setStyleAttribute("margin-left", intWidth+"px");
|
hpItemsNumber.setStyleAttribute("margin-left", intWidth+"px");
|
||||||
|
|
Loading…
Reference in New Issue