2019-07-26 20:14:13 +02:00
/ * *
*
* /
package org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.admin ;
import org.gcube.portlets.widgets.workspacesharingwidget.client.resources.Resources ;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment ;
import com.extjs.gxt.ui.client.event.ButtonEvent ;
import com.extjs.gxt.ui.client.event.SelectionListener ;
import com.extjs.gxt.ui.client.widget.Dialog ;
import com.extjs.gxt.ui.client.widget.LayoutContainer ;
import com.extjs.gxt.ui.client.widget.MessageBox ;
import com.extjs.gxt.ui.client.widget.button.Button ;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar ;
import com.google.gwt.core.client.GWT ;
import com.google.gwt.user.client.Random ;
/ * *
* @author Francesco Mangiacrapa Jan 27 , 2015
*
* /
public class DialogMultiDragContactAdmin extends Dialog {
private static final String GROUP_DRAGGING_CONTACTS = " Group dragging contacts " ;
private static final int HEIGHT_DIALOG = 542 ;
private static final int WIDTH_DIALOG = 620 ;
2019-07-29 19:11:31 +02:00
private String txtHelp = " Select a VRE and after drag one or more contacts from the left (All Contacts) to the right (Administrators) to add users in the administrators list. " ;
2019-07-26 20:14:13 +02:00
private String titleHelp = " Group dragging action " ;
// private boolean hideOnPressOkButton=false;
2019-07-29 18:46:04 +02:00
private PanelMultiDragContactAdmin multiDragContactAdmin ;
2019-07-26 20:14:13 +02:00
// private boolean visibleTextArea=false;
private ToolBar toolBar ;
private LayoutContainer lcTop = new LayoutContainer ( ) ;
private LayoutContainer lcMiddle = new LayoutContainer ( ) ;
private LayoutContainer lcBottom = new LayoutContainer ( ) ;
2019-07-29 18:46:04 +02:00
private String workspaceItemId ;
2019-07-26 20:14:13 +02:00
2019-07-29 18:46:04 +02:00
public DialogMultiDragContactAdmin ( String workspaceItemId ) {
2019-07-26 20:14:13 +02:00
2019-07-29 18:46:04 +02:00
GWT . log ( " DialogMultiDragContactAdmin(): " + workspaceItemId ) ;
2019-07-26 20:14:13 +02:00
try {
2019-07-29 18:46:04 +02:00
this . workspaceItemId = workspaceItemId ;
2019-07-26 20:14:13 +02:00
init ( ) ;
2019-07-29 18:46:04 +02:00
create ( ) ;
2019-07-26 20:14:13 +02:00
} catch ( Throwable e ) {
GWT . log ( " Error in DialogMultiDragContactAdmin() " + e . getLocalizedMessage ( ) , e ) ;
}
}
public void showToolBar ( boolean bool ) {
this . toolBar . setVisible ( bool ) ;
}
private void init ( ) {
2019-07-29 18:46:04 +02:00
setHeading ( GROUP_DRAGGING_CONTACTS ) ;
2019-07-26 20:14:13 +02:00
setId ( DialogMultiDragContactAdmin . class . getName ( ) + Random . nextInt ( ) ) ;
setSize ( WIDTH_DIALOG , HEIGHT_DIALOG ) ;
setResizable ( false ) ;
setMaximizable ( false ) ;
setIcon ( Resources . getIconUsers ( ) ) ;
setModal ( true ) ;
// setScrollMode(Scroll.AUTOY);
2019-07-29 18:46:04 +02:00
}
private void create ( ) {
2019-07-26 20:14:13 +02:00
// setResizable(true);
setButtonAlign ( HorizontalAlignment . CENTER ) ;
setButtons ( Dialog . OKCANCEL ) ;
toolBar = new ToolBar ( ) ;
Button buttonHelp = new Button ( ) ;
buttonHelp . setIcon ( Resources . getIconInfo ( ) ) ;
buttonHelp . addSelectionListener ( new SelectionListener < ButtonEvent > ( ) {
@Override
public void componentSelected ( ButtonEvent ce ) {
MessageBox . info ( titleHelp , txtHelp , null ) ;
}
} ) ;
toolBar . add ( buttonHelp ) ;
setTopComponent ( toolBar ) ;
this . getButtonById ( Dialog . CANCEL ) . addSelectionListener ( new SelectionListener < ButtonEvent > ( ) {
@Override
public void componentSelected ( ButtonEvent ce ) {
hide ( ) ;
}
} ) ;
this . getButtonById ( Dialog . OK ) . addSelectionListener ( new SelectionListener < ButtonEvent > ( ) {
@Override
public void componentSelected ( ButtonEvent ce ) {
hide ( ) ;
}
} ) ;
2019-07-29 18:46:04 +02:00
this . multiDragContactAdmin = new PanelMultiDragContactAdmin ( workspaceItemId ) ;
2019-07-26 20:14:13 +02:00
lcMiddle . add ( multiDragContactAdmin ) ;
add ( lcTop ) ;
add ( lcMiddle ) ;
add ( lcBottom ) ;
}
2019-07-29 18:46:04 +02:00
public PanelMultiDragContactAdmin getMultiDrag ( ) {
2019-07-26 20:14:13 +02:00
return multiDragContactAdmin ;
}
public String getTxtHelp ( ) {
return txtHelp ;
}
public String getTitleHelp ( ) {
return titleHelp ;
}
public ToolBar getToolBar ( ) {
return toolBar ;
}
public void setTxtHelp ( String txtHelp ) {
this . txtHelp = txtHelp ;
}
public void setTitleHelp ( String titleHelp ) {
this . titleHelp = titleHelp ;
}
public void setToolBar ( ToolBar toolBar ) {
this . toolBar = toolBar ;
}
public LayoutContainer getLcTop ( ) {
return lcTop ;
}
public LayoutContainer getLcMiddle ( ) {
return lcMiddle ;
}
public LayoutContainer getLcBottom ( ) {
return lcBottom ;
}
}