shared panel enhanced, see https://issue.imarine.research-infrastructures.eu/ticket/2798
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@98219 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -37,5 +37,28 @@ public interface Icons extends ClientBundle {
|
||||||
*/
|
*/
|
||||||
@Source("sharegroup.png")
|
@Source("sharegroup.png")
|
||||||
ImageResource group();
|
ImageResource group();
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Source("aoneleft.png")
|
||||||
|
ImageResource selectedLeft();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Source("aoneright.png")
|
||||||
|
ImageResource selectedRight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Source("amoreleft.png")
|
||||||
|
ImageResource allLeft();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Source("amoreright.png")
|
||||||
|
ImageResource allRight();
|
||||||
|
}
|
||||||
|
|
|
@ -60,5 +60,20 @@ public class Resources {
|
||||||
return AbstractImagePrototype.create(ICONS.group());
|
return AbstractImagePrototype.create(ICONS.group());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getAllLeft() {
|
||||||
|
return AbstractImagePrototype.create(ICONS.allLeft());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getAllRight() {
|
||||||
|
return AbstractImagePrototype.create(ICONS.allRight());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getSelectedLeft() {
|
||||||
|
return AbstractImagePrototype.create(ICONS.selectedLeft());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getSelectedRight() {
|
||||||
|
return AbstractImagePrototype.create(ICONS.selectedRight());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.3 KiB |
|
@ -14,7 +14,11 @@ import com.extjs.gxt.ui.client.Style.SortDir;
|
||||||
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
|
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
|
||||||
import com.extjs.gxt.ui.client.dnd.GridDragSource;
|
import com.extjs.gxt.ui.client.dnd.GridDragSource;
|
||||||
import com.extjs.gxt.ui.client.dnd.GridDropTarget;
|
import com.extjs.gxt.ui.client.dnd.GridDropTarget;
|
||||||
|
import com.extjs.gxt.ui.client.event.BaseEvent;
|
||||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||||
|
import com.extjs.gxt.ui.client.event.Events;
|
||||||
|
import com.extjs.gxt.ui.client.event.Listener;
|
||||||
|
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
||||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||||
import com.extjs.gxt.ui.client.store.ListStore;
|
import com.extjs.gxt.ui.client.store.ListStore;
|
||||||
import com.extjs.gxt.ui.client.store.Store;
|
import com.extjs.gxt.ui.client.store.Store;
|
||||||
|
@ -24,6 +28,7 @@ import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||||
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.LayoutContainer;
|
||||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||||
import com.extjs.gxt.ui.client.widget.VerticalPanel;
|
import com.extjs.gxt.ui.client.widget.VerticalPanel;
|
||||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||||
|
@ -34,6 +39,7 @@ import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
||||||
|
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.RowData;
|
import com.extjs.gxt.ui.client.widget.layout.RowData;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
|
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
|
||||||
|
@ -42,6 +48,11 @@ import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||||
|
|
||||||
public class MultiDragContact extends Dialog {
|
public class MultiDragContact extends Dialog {
|
||||||
|
|
||||||
|
private static final int WIDTH_CP = 597;
|
||||||
|
private static final int HEIGHT_DIALOG = 542;
|
||||||
|
private static final int WIDTH_DIALOG = 625;
|
||||||
|
private static final int HEIGHT_GRID = 310;
|
||||||
|
|
||||||
private GridDropTarget dropSource;
|
private GridDropTarget dropSource;
|
||||||
private GridDropTarget dropTarget;
|
private GridDropTarget dropTarget;
|
||||||
private ListStore<InfoContactModel> storeSource = new ListStore<InfoContactModel>();
|
private ListStore<InfoContactModel> storeSource = new ListStore<InfoContactModel>();
|
||||||
|
@ -50,10 +61,17 @@ public class MultiDragContact extends Dialog {
|
||||||
private Grid<InfoContactModel> gridAllContacts;
|
private Grid<InfoContactModel> gridAllContacts;
|
||||||
private Grid<InfoContactModel> gridShareWith;
|
private Grid<InfoContactModel> gridShareWith;
|
||||||
|
|
||||||
|
private Button buttonSelectedLeft;
|
||||||
|
private Button buttonSelectedRight;
|
||||||
|
private Button buttonAllRight;
|
||||||
|
private Button buttonAllLeft;
|
||||||
|
|
||||||
public MultiDragContact() {
|
public MultiDragContact() {
|
||||||
setStyleAttribute("margin", "10px");
|
setStyleAttribute("margin", "10px");
|
||||||
setSize(563, 542);
|
setSize(WIDTH_DIALOG, HEIGHT_DIALOG);
|
||||||
setHeading("Group dragging contacts");
|
setHeading("Group dragging contacts");
|
||||||
|
setResizable(false);
|
||||||
|
setMaximizable(false);
|
||||||
setIcon(Resources.getIconUsers());
|
setIcon(Resources.getIconUsers());
|
||||||
setModal(true);
|
setModal(true);
|
||||||
setScrollMode(Scroll.AUTOY);
|
setScrollMode(Scroll.AUTOY);
|
||||||
|
@ -61,13 +79,12 @@ public class MultiDragContact extends Dialog {
|
||||||
setResizable(true);
|
setResizable(true);
|
||||||
setButtonAlign(HorizontalAlignment.CENTER);
|
setButtonAlign(HorizontalAlignment.CENTER);
|
||||||
setButtons(Dialog.OKCANCEL);
|
setButtons(Dialog.OKCANCEL);
|
||||||
//SORTING STORE
|
// SORTING STORE
|
||||||
setGropUserStoreSorter(storeSource);
|
setGropUserStoreSorter(storeSource);
|
||||||
setGropUserStoreSorter(storeTarget);
|
setGropUserStoreSorter(storeTarget);
|
||||||
|
|
||||||
|
|
||||||
ContentPanel cpAlreadyShared = new ContentPanel();
|
ContentPanel cpAlreadyShared = new ContentPanel();
|
||||||
cpAlreadyShared.setSize(530, 60);
|
cpAlreadyShared.setSize(WIDTH_CP, 60);
|
||||||
cpAlreadyShared.setHeaderVisible(false);
|
cpAlreadyShared.setHeaderVisible(false);
|
||||||
|
|
||||||
cpAlreadyShared.setLayout(new FitLayout());
|
cpAlreadyShared.setLayout(new FitLayout());
|
||||||
|
@ -81,9 +98,9 @@ public class MultiDragContact extends Dialog {
|
||||||
hpSharedContacts.setHorizontalAlign(HorizontalAlignment.CENTER);
|
hpSharedContacts.setHorizontalAlign(HorizontalAlignment.CENTER);
|
||||||
hpSharedContacts.setVerticalAlign(VerticalAlignment.MIDDLE);
|
hpSharedContacts.setVerticalAlign(VerticalAlignment.MIDDLE);
|
||||||
textAreaAlreadyShared = new TextArea();
|
textAreaAlreadyShared = new TextArea();
|
||||||
// textField.setFieldLabel("Already shared with");
|
// textField.setFieldLabel("Already shared with");
|
||||||
// textField.setHeight(30);
|
// textField.setHeight(30);
|
||||||
textAreaAlreadyShared.setWidth(401);
|
textAreaAlreadyShared.setWidth(501);
|
||||||
textAreaAlreadyShared.setHeight(43);
|
textAreaAlreadyShared.setHeight(43);
|
||||||
cpAlreadyShared.setStyleAttribute("padding-bottom", "5px");
|
cpAlreadyShared.setStyleAttribute("padding-bottom", "5px");
|
||||||
textAreaAlreadyShared.setReadOnly(true);
|
textAreaAlreadyShared.setReadOnly(true);
|
||||||
|
@ -98,9 +115,8 @@ public class MultiDragContact extends Dialog {
|
||||||
cpAlreadyShared.add(vpShared);
|
cpAlreadyShared.add(vpShared);
|
||||||
add(cpAlreadyShared);
|
add(cpAlreadyShared);
|
||||||
|
|
||||||
|
final ContentPanel cp = new ContentPanel();
|
||||||
ContentPanel cp = new ContentPanel();
|
cp.setSize(WIDTH_CP, 370);
|
||||||
cp.setSize(530, 370);
|
|
||||||
cp.setHeaderVisible(false);
|
cp.setHeaderVisible(false);
|
||||||
cp.setLayout(new RowLayout(Orientation.HORIZONTAL));
|
cp.setLayout(new RowLayout(Orientation.HORIZONTAL));
|
||||||
|
|
||||||
|
@ -112,7 +128,10 @@ public class MultiDragContact extends Dialog {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
MessageBox.info("Group dragging action", "Drag one or more contacts from the left (All Contacts) to the right (Share with) to add users in your sharing list.", null);
|
MessageBox
|
||||||
|
.info("Group dragging action",
|
||||||
|
"Drag one or more contacts from the left (All Contacts) to the right (Share with) to add users in your sharing list.",
|
||||||
|
null);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -120,10 +139,11 @@ public class MultiDragContact extends Dialog {
|
||||||
toolBar.add(buttonHelp);
|
toolBar.add(buttonHelp);
|
||||||
setTopComponent(toolBar);
|
setTopComponent(toolBar);
|
||||||
|
|
||||||
VerticalPanel vp = new VerticalPanel();
|
final VerticalPanel vpAllContacts = new VerticalPanel();
|
||||||
vp.setHorizontalAlign(HorizontalAlignment.CENTER);
|
vpAllContacts.setHorizontalAlign(HorizontalAlignment.CENTER);
|
||||||
vp.add(new Label("All Contacts"));
|
vpAllContacts.add(new Label("All Contacts"));
|
||||||
gridAllContacts = new Grid<InfoContactModel>(storeSource, createColumnModel());
|
gridAllContacts = new Grid<InfoContactModel>(storeSource,
|
||||||
|
createColumnModel());
|
||||||
|
|
||||||
storeSource.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
|
storeSource.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
storeSource.sort(InfoContactModel.FULLNAME, SortDir.ASC);
|
storeSource.sort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
|
@ -131,8 +151,7 @@ public class MultiDragContact extends Dialog {
|
||||||
storeTarget.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
|
storeTarget.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
storeTarget.sort(InfoContactModel.FULLNAME, SortDir.ASC);
|
storeTarget.sort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
|
|
||||||
|
final StoreFilterField<InfoContactModel> filter = new StoreFilterField<InfoContactModel>() {
|
||||||
StoreFilterField<InfoContactModel> filter = new StoreFilterField<InfoContactModel>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean doSelect(Store<InfoContactModel> store,
|
protected boolean doSelect(Store<InfoContactModel> store,
|
||||||
|
@ -149,8 +168,8 @@ public class MultiDragContact extends Dialog {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// filter.setFieldLabel("Filter Contacts");
|
// filter.setFieldLabel("Filter Contacts");
|
||||||
filter.setWidth(247);
|
// filter.setWidth(247);
|
||||||
filter.setEmptyText("Filter All Contacts");
|
filter.setEmptyText("Filter All Contacts");
|
||||||
HorizontalPanel hp = new HorizontalPanel();
|
HorizontalPanel hp = new HorizontalPanel();
|
||||||
hp.setStyleAttribute("padding-top", "5px");
|
hp.setStyleAttribute("padding-top", "5px");
|
||||||
|
@ -158,27 +177,33 @@ public class MultiDragContact extends Dialog {
|
||||||
hp.add(filter);
|
hp.add(filter);
|
||||||
filter.bind(storeSource);
|
filter.bind(storeSource);
|
||||||
|
|
||||||
gridAllContacts.setSize(250,310);
|
gridAllContacts.setHeight(HEIGHT_GRID);
|
||||||
gridAllContacts.setBorders(false);
|
gridAllContacts.setBorders(false);
|
||||||
gridAllContacts.getView().setAutoFill(true);
|
gridAllContacts.getView().setAutoFill(true);
|
||||||
// gridAllContacts.setAutoExpandColumn(InfoContactModel.FULLNAME);
|
// gridAllContacts.setAutoExpandColumn(InfoContactModel.FULLNAME);
|
||||||
gridAllContacts.setBorders(true);
|
gridAllContacts.setBorders(true);
|
||||||
|
|
||||||
vp.add(hp);
|
vpAllContacts.add(hp);
|
||||||
vp.add(gridAllContacts);
|
vpAllContacts.add(gridAllContacts);
|
||||||
|
|
||||||
|
RowData rowData = new RowData(.4, 1);
|
||||||
|
|
||||||
RowData rowData = new RowData(.5, 1);
|
|
||||||
rowData.setMargins(new Margins(6));
|
rowData.setMargins(new Margins(6));
|
||||||
cp.add(vp, rowData);
|
cp.add(vpAllContacts, rowData);
|
||||||
|
|
||||||
vp = new VerticalPanel();
|
rowData = new RowData(.2, 1);
|
||||||
vp.setHorizontalAlign(HorizontalAlignment.CENTER);
|
rowData.setMargins(new Margins(6));
|
||||||
vp.add(new Label("Share with..."));
|
LayoutContainer lc = createMoveContactsContainer();
|
||||||
gridShareWith = new Grid<InfoContactModel>(storeTarget, createColumnModel());
|
cp.add(lc, rowData);
|
||||||
|
|
||||||
StoreFilterField<InfoContactModel> filter2 = new StoreFilterField<InfoContactModel>() {
|
rowData = new RowData(.4, 1);
|
||||||
|
rowData.setMargins(new Margins(6, 6, 6, 0));
|
||||||
|
|
||||||
|
final VerticalPanel vpShareWith = new VerticalPanel();
|
||||||
|
vpShareWith.setHorizontalAlign(HorizontalAlignment.CENTER);
|
||||||
|
vpShareWith.add(new Label("Share with..."));
|
||||||
|
gridShareWith = new Grid<InfoContactModel>(storeTarget,createColumnModel());
|
||||||
|
|
||||||
|
final StoreFilterField<InfoContactModel> filter2 = new StoreFilterField<InfoContactModel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean doSelect(Store<InfoContactModel> store,
|
protected boolean doSelect(Store<InfoContactModel> store,
|
||||||
|
@ -195,8 +220,8 @@ public class MultiDragContact extends Dialog {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// filter.setFieldLabel("Filter Contacts");
|
// filter.setFieldLabel("Filter Contacts");
|
||||||
filter2.setWidth(247);
|
// filter2.setWidth(247);
|
||||||
filter2.setEmptyText("Filter Share with");
|
filter2.setEmptyText("Filter Share with");
|
||||||
|
|
||||||
hp = new HorizontalPanel();
|
hp = new HorizontalPanel();
|
||||||
|
@ -205,18 +230,15 @@ public class MultiDragContact extends Dialog {
|
||||||
hp.add(filter2);
|
hp.add(filter2);
|
||||||
filter2.bind(storeTarget);
|
filter2.bind(storeTarget);
|
||||||
|
|
||||||
|
gridShareWith.setHeight(HEIGHT_GRID);
|
||||||
gridShareWith.setSize(250, 310);
|
|
||||||
gridShareWith.setBorders(false);
|
gridShareWith.setBorders(false);
|
||||||
gridShareWith.getView().setAutoFill(true);
|
gridShareWith.getView().setAutoFill(true);
|
||||||
// gridShareWith.setAutoExpandColumn(InfoContactModel.FULLNAME);
|
// gridShareWith.setAutoExpandColumn(InfoContactModel.FULLNAME);
|
||||||
gridShareWith.setBorders(true);
|
gridShareWith.setBorders(true);
|
||||||
vp.add(hp);
|
vpShareWith.add(hp);
|
||||||
vp.add(gridShareWith);
|
vpShareWith.add(gridShareWith);
|
||||||
|
|
||||||
rowData = new RowData(.5, 1);
|
cp.add(vpShareWith, rowData);
|
||||||
rowData.setMargins(new Margins(6, 6, 6, 0));
|
|
||||||
cp.add(vp, rowData);
|
|
||||||
|
|
||||||
new GridDragSource(gridAllContacts);
|
new GridDragSource(gridAllContacts);
|
||||||
new GridDragSource(gridShareWith);
|
new GridDragSource(gridShareWith);
|
||||||
|
@ -229,7 +251,8 @@ public class MultiDragContact extends Dialog {
|
||||||
|
|
||||||
add(cp);
|
add(cp);
|
||||||
|
|
||||||
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
this.getButtonById(Dialog.CANCEL).addSelectionListener(
|
||||||
|
new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
@ -237,13 +260,53 @@ public class MultiDragContact extends Dialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.getButtonById(Dialog.OK).addSelectionListener(
|
||||||
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
List<InfoContactModel> shareContacts = storeTarget
|
||||||
|
.getModels();
|
||||||
|
|
||||||
|
if (shareContacts == null || shareContacts.isEmpty()) {
|
||||||
|
|
||||||
|
MessageBox mbc = MessageBox
|
||||||
|
.confirm(
|
||||||
|
"Confirm exit?",
|
||||||
|
"You have not selected any contact to share, confirm exit?",
|
||||||
|
null);
|
||||||
|
|
||||||
|
mbc.addCallback(new Listener<MessageBoxEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleEvent(MessageBoxEvent be) {
|
||||||
|
String clickedButton = be
|
||||||
|
.getButtonClicked().getItemId();
|
||||||
|
if (clickedButton.equals(Dialog.YES)) {
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cp.addListener(Events.Render, new Listener<BaseEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleEvent(BaseEvent be) {
|
||||||
|
int width = gridAllContacts.getWidth();
|
||||||
|
filter.setWidth(width-2);
|
||||||
|
filter2.setWidth(width-2);
|
||||||
|
gridAllContacts.setWidth(width);
|
||||||
|
vpAllContacts.setWidth(width+7);
|
||||||
|
gridShareWith.setWidth(width);
|
||||||
|
vpShareWith.setWidth(width+10);
|
||||||
|
vpShareWith.layout();
|
||||||
|
vpAllContacts.layout();
|
||||||
|
cp.layout();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// needed to enable quicktips (qtitle for the heading and qtip for the
|
// needed to enable quicktips (qtitle for the heading and qtip for the
|
||||||
|
@ -251,25 +314,151 @@ public class MultiDragContact extends Dialog {
|
||||||
new QuickTip(gridAllContacts);
|
new QuickTip(gridAllContacts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private LayoutContainer createMoveContactsContainer() {
|
||||||
|
|
||||||
|
LayoutContainer lc = new LayoutContainer();
|
||||||
|
lc.setLayout(new CenterLayout());
|
||||||
|
VerticalPanel vp1 = new VerticalPanel();
|
||||||
|
vp1.setHorizontalAlign(HorizontalAlignment.CENTER);
|
||||||
|
vp1.setVerticalAlign(VerticalAlignment.MIDDLE);
|
||||||
|
|
||||||
|
buttonSelectedLeft = new Button();
|
||||||
|
buttonSelectedLeft.setIcon(Resources.getSelectedLeft());
|
||||||
|
buttonSelectedLeft
|
||||||
|
.setToolTip("Move selected contact/s from 'All Contact' to 'Share with'");
|
||||||
|
buttonSelectedLeft
|
||||||
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
List<InfoContactModel> selectedItems = gridAllContacts
|
||||||
|
.getSelectionModel().getSelectedItems();
|
||||||
|
|
||||||
|
if (selectedItems != null && selectedItems.size() > 0) {
|
||||||
|
|
||||||
|
for (InfoContactModel extendedInfoContactModel : selectedItems) {
|
||||||
|
storeTarget.add(extendedInfoContactModel);
|
||||||
|
storeSource.remove(extendedInfoContactModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonSelectedRight = new Button();
|
||||||
|
buttonSelectedRight.setIcon(Resources.getSelectedRight());
|
||||||
|
buttonSelectedRight
|
||||||
|
.setToolTip("Move selected contact/s from 'Share with' to 'All Contact'");
|
||||||
|
|
||||||
|
buttonSelectedRight
|
||||||
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
List<InfoContactModel> selectedItems = gridShareWith
|
||||||
|
.getSelectionModel().getSelectedItems();
|
||||||
|
|
||||||
|
if (selectedItems != null && selectedItems.size() > 0) {
|
||||||
|
|
||||||
|
for (InfoContactModel extendedInfoContactModel : selectedItems) {
|
||||||
|
storeSource.add(extendedInfoContactModel);
|
||||||
|
storeTarget.remove(extendedInfoContactModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonAllLeft = new Button();
|
||||||
|
buttonAllLeft.setIcon(Resources.getAllLeft());
|
||||||
|
buttonAllLeft
|
||||||
|
.setToolTip("Move all contact/s from 'All Contact' to 'Share with'");
|
||||||
|
|
||||||
|
buttonAllLeft
|
||||||
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
if (storeSource != null && storeSource.getCount() > 0) {
|
||||||
|
for (InfoContactModel extendedInfoContactModel : storeSource
|
||||||
|
.getModels()) {
|
||||||
|
storeTarget.add(extendedInfoContactModel);
|
||||||
|
storeSource.remove(extendedInfoContactModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonAllRight = new Button();
|
||||||
|
buttonAllRight.setIcon(Resources.getAllRight());
|
||||||
|
buttonAllRight
|
||||||
|
.setToolTip("Move all contact/s from 'Share with' to 'All Contact'");
|
||||||
|
|
||||||
|
buttonAllRight
|
||||||
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
if (storeTarget != null && storeTarget.getCount() > 0) {
|
||||||
|
for (InfoContactModel extendedInfoContactModel : storeTarget
|
||||||
|
.getModels()) {
|
||||||
|
storeSource.add(extendedInfoContactModel);
|
||||||
|
storeTarget.remove(extendedInfoContactModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
vp1.add(buttonSelectedLeft);
|
||||||
|
vp1.add(buttonAllLeft);
|
||||||
|
vp1.add(buttonSelectedRight);
|
||||||
|
vp1.add(buttonAllRight);
|
||||||
|
|
||||||
|
lc.add(vp1);
|
||||||
|
|
||||||
|
vp1.addListener(Events.Render, new Listener<BaseEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleEvent(BaseEvent be) {
|
||||||
|
buttonSelectedLeft.el().setStyleAttribute("margin-top", "40px");
|
||||||
|
buttonAllLeft.el().setStyleAttribute("margin-top", "5px");
|
||||||
|
buttonSelectedRight.el()
|
||||||
|
.setStyleAttribute("margin-top", "20px");
|
||||||
|
buttonAllRight.el().setStyleAttribute("margin", "5px");
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return lc;
|
||||||
|
}
|
||||||
|
|
||||||
private ColumnModel createColumnModel() {
|
private ColumnModel createColumnModel() {
|
||||||
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||||
|
|
||||||
ColumnConfig icon = new ColumnConfig("Icon", "", 25);
|
ColumnConfig icon = new ColumnConfig("Icon", "", 25);
|
||||||
configs.add(icon);
|
configs.add(icon);
|
||||||
|
|
||||||
ColumnConfig columnConfigDisplayName = new ColumnConfig(InfoContactModel.FULLNAME, "Name", 150);
|
ColumnConfig columnConfigDisplayName = new ColumnConfig(
|
||||||
|
InfoContactModel.FULLNAME, "Name", 150);
|
||||||
configs.add(columnConfigDisplayName);
|
configs.add(columnConfigDisplayName);
|
||||||
|
|
||||||
ColumnConfig type = new ColumnConfig(InfoContactModel.ISGROUP, "Type", 50);
|
ColumnConfig type = new ColumnConfig(InfoContactModel.ISGROUP, "Type",
|
||||||
|
50);
|
||||||
configs.add(type);
|
configs.add(type);
|
||||||
|
|
||||||
|
|
||||||
GridCellRenderer<InfoContactModel> iconRender = new GridCellRenderer<InfoContactModel>() {
|
GridCellRenderer<InfoContactModel> iconRender = new GridCellRenderer<InfoContactModel>() {
|
||||||
@Override
|
@Override
|
||||||
public String render(InfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<InfoContactModel> store, Grid<InfoContactModel> grid) {
|
public String render(InfoContactModel model, String property,
|
||||||
if( model.isGroup()){
|
ColumnData config, int rowIndex, int colIndex,
|
||||||
|
ListStore<InfoContactModel> store,
|
||||||
|
Grid<InfoContactModel> grid) {
|
||||||
|
if (model.isGroup()) {
|
||||||
return Resources.getIconGroup().getHTML();
|
return Resources.getIconGroup().getHTML();
|
||||||
}else{
|
} else {
|
||||||
return Resources.getIconUser().getHTML();
|
return Resources.getIconUser().getHTML();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,13 +467,17 @@ public class MultiDragContact extends Dialog {
|
||||||
icon.setRenderer(iconRender);
|
icon.setRenderer(iconRender);
|
||||||
|
|
||||||
GridCellRenderer<InfoContactModel> displayNameCellRender = new GridCellRenderer<InfoContactModel>() {
|
GridCellRenderer<InfoContactModel> displayNameCellRender = new GridCellRenderer<InfoContactModel>() {
|
||||||
public String render(InfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<InfoContactModel> store, Grid<InfoContactModel> grid) {
|
public String render(InfoContactModel model, String property,
|
||||||
|
ColumnData config, int rowIndex, int colIndex,
|
||||||
|
ListStore<InfoContactModel> store,
|
||||||
|
Grid<InfoContactModel> grid) {
|
||||||
|
|
||||||
if(model!=null){
|
if (model != null) {
|
||||||
|
|
||||||
String value = model.get (property);
|
String value = model.get(property);
|
||||||
if (value != null){
|
if (value != null) {
|
||||||
return "<span qtitle='' qtip='" + model.getLogin() +"'>" + value + "</span>";
|
return "<span qtitle='' qtip='" + model.getLogin()
|
||||||
|
+ "'>" + value + "</span>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,17 +489,22 @@ public class MultiDragContact extends Dialog {
|
||||||
|
|
||||||
GridCellRenderer<InfoContactModel> typeRender = new GridCellRenderer<InfoContactModel>() {
|
GridCellRenderer<InfoContactModel> typeRender = new GridCellRenderer<InfoContactModel>() {
|
||||||
@Override
|
@Override
|
||||||
public String render(InfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<InfoContactModel> store, Grid<InfoContactModel> grid) {
|
public String render(InfoContactModel model, String property,
|
||||||
|
ColumnData config, int rowIndex, int colIndex,
|
||||||
|
ListStore<InfoContactModel> store,
|
||||||
|
Grid<InfoContactModel> grid) {
|
||||||
Boolean isGroup = (Boolean) model.get(property);
|
Boolean isGroup = (Boolean) model.get(property);
|
||||||
String color = "#0F4FA8";
|
String color = "#0F4FA8";
|
||||||
String val = "";
|
String val = "";
|
||||||
if(isGroup){
|
if (isGroup) {
|
||||||
val = "Group";
|
val = "Group";
|
||||||
color = "#05316D";
|
color = "#05316D";
|
||||||
return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>";
|
return "<span style='font-weight: bold; color:" + color
|
||||||
}else{
|
+ "'>" + val + "</span>";
|
||||||
|
} else {
|
||||||
val = "User";
|
val = "User";
|
||||||
return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>";
|
return "<span style='font-weight: bold; color:" + color
|
||||||
|
+ "'>" + val + "</span>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -315,32 +513,33 @@ public class MultiDragContact extends Dialog {
|
||||||
return new ColumnModel(configs);
|
return new ColumnModel(configs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSourceContacts(List<InfoContactModel> listContact){
|
public void addSourceContacts(List<InfoContactModel> listContact) {
|
||||||
|
|
||||||
gridAllContacts.mask("", ConstantsSharing.LOADINGSTYLE);
|
gridAllContacts.mask("", ConstantsSharing.LOADINGSTYLE);
|
||||||
if(listContact!=null && listContact.size()>0){
|
if (listContact != null && listContact.size() > 0) {
|
||||||
|
|
||||||
// for (InfoContactModel infoContactModel : listContact) {
|
// for (InfoContactModel infoContactModel : listContact) {
|
||||||
//
|
//
|
||||||
// if(infoContactModel.getName()!=null && !infoContactModel.getName().isEmpty())
|
// if(infoContactModel.getName()!=null &&
|
||||||
// storeSource.add(infoContactModel);
|
// !infoContactModel.getName().isEmpty())
|
||||||
// }
|
// storeSource.add(infoContactModel);
|
||||||
|
// }
|
||||||
|
|
||||||
storeSource.add(listContact);
|
storeSource.add(listContact);
|
||||||
}
|
}
|
||||||
gridAllContacts.unmask();
|
gridAllContacts.unmask();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAlreadySharedContacts(List<InfoContactModel> listContact){
|
public void addAlreadySharedContacts(List<InfoContactModel> listContact) {
|
||||||
|
|
||||||
gridShareWith.mask("", ConstantsSharing.LOADINGSTYLE);
|
gridShareWith.mask("", ConstantsSharing.LOADINGSTYLE);
|
||||||
if(listContact!=null && listContact.size()>0){
|
if (listContact != null && listContact.size() > 0) {
|
||||||
|
|
||||||
String alreadyShared = "";
|
String alreadyShared = "";
|
||||||
for (int i=0; i<listContact.size()-1; i++)
|
for (int i = 0; i < listContact.size() - 1; i++)
|
||||||
alreadyShared+=listContact.get(i).getName()+", ";
|
alreadyShared += listContact.get(i).getName() + ", ";
|
||||||
|
|
||||||
alreadyShared+=listContact.get(listContact.size()-1).getName();
|
alreadyShared += listContact.get(listContact.size() - 1).getName();
|
||||||
|
|
||||||
textAreaAlreadyShared.setValue(alreadyShared);
|
textAreaAlreadyShared.setValue(alreadyShared);
|
||||||
}
|
}
|
||||||
|
@ -348,27 +547,28 @@ public class MultiDragContact extends Dialog {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTargetContacts(List<InfoContactModel> listContact){
|
public void addTargetContacts(List<InfoContactModel> listContact) {
|
||||||
if(listContact!=null && listContact.size()>0)
|
if (listContact != null && listContact.size() > 0)
|
||||||
storeTarget.add(listContact);
|
storeTarget.add(listContact);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTargetContact(InfoContactModel contact){
|
public void addTargetContact(InfoContactModel contact) {
|
||||||
if(contact!=null)
|
if (contact != null)
|
||||||
storeTarget.add(contact);
|
storeTarget.add(contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InfoContactModel> getTargetListContact(){
|
public List<InfoContactModel> getTargetListContact() {
|
||||||
return storeTarget.getModels();
|
return storeTarget.getModels();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGropUserStoreSorter(ListStore<InfoContactModel> store){
|
private void setGropUserStoreSorter(ListStore<InfoContactModel> store) {
|
||||||
|
|
||||||
// Sorting files
|
// Sorting files
|
||||||
store.setStoreSorter(new StoreSorter<InfoContactModel>() {
|
store.setStoreSorter(new StoreSorter<InfoContactModel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(Store<InfoContactModel> store, InfoContactModel m1, InfoContactModel m2, String property) {
|
public int compare(Store<InfoContactModel> store,
|
||||||
|
InfoContactModel m1, InfoContactModel m2, String property) {
|
||||||
boolean m1Group = m1.isGroup();
|
boolean m1Group = m1.isGroup();
|
||||||
boolean m2Group = m2.isGroup();
|
boolean m2Group = m2.isGroup();
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.3 KiB |