|
|
|
@ -137,7 +137,6 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
cpAlreadyShared.add(vpShared);
|
|
|
|
|
add(cpAlreadyShared);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final ContentPanel cp = new ContentPanel();
|
|
|
|
|
cp.setSize(WIDTH_CP, HEIGHT_CONTAINER_GRID);
|
|
|
|
|
cp.setHeaderVisible(false);
|
|
|
|
@ -151,7 +150,9 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -165,9 +166,9 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
|
|
|
|
|
gridAllContacts = new Grid<ExtendedInfoContactModel>(storeSource, createColumnModel());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GridCellRenderer<ExtendedInfoContactModel> displayNameCellRender = new GridCellRenderer<ExtendedInfoContactModel>() {
|
|
|
|
|
public String render(ExtendedInfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ExtendedInfoContactModel> store, Grid<ExtendedInfoContactModel> grid) {
|
|
|
|
|
public String render(ExtendedInfoContactModel model, String property, ColumnData config, int rowIndex,
|
|
|
|
|
int colIndex, ListStore<ExtendedInfoContactModel> store, Grid<ExtendedInfoContactModel> grid) {
|
|
|
|
|
|
|
|
|
|
if (model != null) {
|
|
|
|
|
|
|
|
|
@ -189,13 +190,11 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
storeTarget.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
|
|
|
|
|
storeTarget.sort(InfoContactModel.FULLNAME, SortDir.ASC);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final StoreFilterField<ExtendedInfoContactModel> filter = new StoreFilterField<ExtendedInfoContactModel>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean doSelect(Store<ExtendedInfoContactModel> store,
|
|
|
|
|
ExtendedInfoContactModel parent, ExtendedInfoContactModel record,
|
|
|
|
|
String property, String filter) {
|
|
|
|
|
protected boolean doSelect(Store<ExtendedInfoContactModel> store, ExtendedInfoContactModel parent,
|
|
|
|
|
ExtendedInfoContactModel record, String property, String filter) {
|
|
|
|
|
|
|
|
|
|
String name = record.getName();
|
|
|
|
|
name = name.toLowerCase();
|
|
|
|
@ -242,9 +241,8 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
final StoreFilterField<ExtendedInfoContactModel> filter2 = new StoreFilterField<ExtendedInfoContactModel>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean doSelect(Store<ExtendedInfoContactModel> store,
|
|
|
|
|
ExtendedInfoContactModel parent, ExtendedInfoContactModel record,
|
|
|
|
|
String property, String filter) {
|
|
|
|
|
protected boolean doSelect(Store<ExtendedInfoContactModel> store, ExtendedInfoContactModel parent,
|
|
|
|
|
ExtendedInfoContactModel record, String property, String filter) {
|
|
|
|
|
|
|
|
|
|
String name = record.getName();
|
|
|
|
|
name = name.toLowerCase();
|
|
|
|
@ -293,7 +291,6 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -302,7 +299,8 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
|
|
|
|
|
if (shareContacts == null || shareContacts.isEmpty()) {
|
|
|
|
|
|
|
|
|
|
MessageBoxConfirm mbc = new MessageBoxConfirm("Confirm exit?", "You have not selected any contact to share, confirm exit?");
|
|
|
|
|
MessageBoxConfirm mbc = new MessageBoxConfirm("Confirm exit?",
|
|
|
|
|
"You have not selected any contact to share, confirm exit?");
|
|
|
|
|
|
|
|
|
|
mbc.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() {
|
|
|
|
|
|
|
|
|
@ -357,16 +355,13 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
|
|
|
|
|
buttonSelectedLeft = new Button();
|
|
|
|
|
buttonSelectedLeft.setIcon(Resources.getSelectedLeft());
|
|
|
|
|
buttonSelectedLeft
|
|
|
|
|
.setToolTip("Move selected contact/s from 'All Contact' to 'Share with'");
|
|
|
|
|
buttonSelectedLeft
|
|
|
|
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
|
|
|
buttonSelectedLeft.setToolTip("Move selected contact/s from 'All Contact' to 'Share with'");
|
|
|
|
|
buttonSelectedLeft.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void componentSelected(ButtonEvent ce) {
|
|
|
|
|
|
|
|
|
|
List<ExtendedInfoContactModel> selectedItems = gridAllContacts
|
|
|
|
|
.getSelectionModel().getSelectedItems();
|
|
|
|
|
List<ExtendedInfoContactModel> selectedItems = gridAllContacts.getSelectionModel().getSelectedItems();
|
|
|
|
|
|
|
|
|
|
if (selectedItems != null && selectedItems.size() > 0) {
|
|
|
|
|
|
|
|
|
@ -380,17 +375,14 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
|
|
|
|
|
buttonSelectedRight = new Button();
|
|
|
|
|
buttonSelectedRight.setIcon(Resources.getSelectedRight());
|
|
|
|
|
buttonSelectedRight
|
|
|
|
|
.setToolTip("Move selected contact/s from 'Share with' to 'All Contact'");
|
|
|
|
|
buttonSelectedRight.setToolTip("Move selected contact/s from 'Share with' to 'All Contact'");
|
|
|
|
|
|
|
|
|
|
buttonSelectedRight
|
|
|
|
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
|
|
|
buttonSelectedRight.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void componentSelected(ButtonEvent ce) {
|
|
|
|
|
|
|
|
|
|
List<ExtendedInfoContactModel> selectedItems = gridShareWith
|
|
|
|
|
.getSelectionModel().getSelectedItems();
|
|
|
|
|
List<ExtendedInfoContactModel> selectedItems = gridShareWith.getSelectionModel().getSelectedItems();
|
|
|
|
|
|
|
|
|
|
if (selectedItems != null && selectedItems.size() > 0) {
|
|
|
|
|
|
|
|
|
@ -404,18 +396,15 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
|
|
|
|
|
buttonAllLeft = new Button();
|
|
|
|
|
buttonAllLeft.setIcon(Resources.getAllLeft());
|
|
|
|
|
buttonAllLeft
|
|
|
|
|
.setToolTip("Move all contact/s from 'All Contact' to 'Share with'");
|
|
|
|
|
buttonAllLeft.setToolTip("Move all contact/s from 'All Contact' to 'Share with'");
|
|
|
|
|
|
|
|
|
|
buttonAllLeft
|
|
|
|
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
|
|
|
buttonAllLeft.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void componentSelected(ButtonEvent ce) {
|
|
|
|
|
|
|
|
|
|
if (storeSource != null && storeSource.getCount() > 0) {
|
|
|
|
|
for (ExtendedInfoContactModel extendedInfoContactModel : storeSource
|
|
|
|
|
.getModels()) {
|
|
|
|
|
for (ExtendedInfoContactModel extendedInfoContactModel : storeSource.getModels()) {
|
|
|
|
|
storeTarget.add(extendedInfoContactModel);
|
|
|
|
|
storeSource.remove(extendedInfoContactModel);
|
|
|
|
|
}
|
|
|
|
@ -426,18 +415,15 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
|
|
|
|
|
buttonAllRight = new Button();
|
|
|
|
|
buttonAllRight.setIcon(Resources.getAllRight());
|
|
|
|
|
buttonAllRight
|
|
|
|
|
.setToolTip("Move all contact/s from 'Share with' to 'All Contact'");
|
|
|
|
|
buttonAllRight.setToolTip("Move all contact/s from 'Share with' to 'All Contact'");
|
|
|
|
|
|
|
|
|
|
buttonAllRight
|
|
|
|
|
.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
|
|
|
buttonAllRight.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void componentSelected(ButtonEvent ce) {
|
|
|
|
|
|
|
|
|
|
if (storeTarget != null && storeTarget.getCount() > 0) {
|
|
|
|
|
for (ExtendedInfoContactModel extendedInfoContactModel : storeTarget
|
|
|
|
|
.getModels()) {
|
|
|
|
|
for (ExtendedInfoContactModel extendedInfoContactModel : storeTarget.getModels()) {
|
|
|
|
|
storeSource.add(extendedInfoContactModel);
|
|
|
|
|
storeTarget.remove(extendedInfoContactModel);
|
|
|
|
|
}
|
|
|
|
@ -485,10 +471,10 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
ColumnConfig type = new ColumnConfig(ExtendedInfoContactModel.ISGROUP, "Type", 50);
|
|
|
|
|
configs.add(type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GridCellRenderer<ExtendedInfoContactModel> typeRender = new GridCellRenderer<ExtendedInfoContactModel>() {
|
|
|
|
|
@Override
|
|
|
|
|
public String render(ExtendedInfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ExtendedInfoContactModel> store, Grid<ExtendedInfoContactModel> grid) {
|
|
|
|
|
public String render(ExtendedInfoContactModel model, String property, ColumnData config, int rowIndex,
|
|
|
|
|
int colIndex, ListStore<ExtendedInfoContactModel> store, Grid<ExtendedInfoContactModel> grid) {
|
|
|
|
|
Boolean isGroup = (Boolean) model.get(property);
|
|
|
|
|
String color = "#0F4FA8";
|
|
|
|
|
String val = "";
|
|
|
|
@ -510,7 +496,8 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
/**
|
|
|
|
|
* Adds the source contacts.
|
|
|
|
|
*
|
|
|
|
|
* @param listContact the list contact
|
|
|
|
|
* @param listContact
|
|
|
|
|
* the list contact
|
|
|
|
|
*/
|
|
|
|
|
public void addSourceContacts(List<InfoContactModel> listContact) {
|
|
|
|
|
|
|
|
|
@ -519,7 +506,9 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
List<ExtendedInfoContactModel> listExtended = new ArrayList<ExtendedInfoContactModel>();
|
|
|
|
|
// SETTING ICONS
|
|
|
|
|
for (InfoContactModel infoContactModel : listContact) {
|
|
|
|
|
ExtendedInfoContactModel ext = new ExtendedInfoContactModel(infoContactModel.getId(), infoContactModel.getLogin(), infoContactModel.getName(), infoContactModel.isGroup());
|
|
|
|
|
ExtendedInfoContactModel ext = new ExtendedInfoContactModel(infoContactModel.getId(),
|
|
|
|
|
infoContactModel.getLogin(), infoContactModel.getName(), infoContactModel.getEmailDomain(),
|
|
|
|
|
infoContactModel.isGroup());
|
|
|
|
|
ext.setIcon();
|
|
|
|
|
listExtended.add(ext);
|
|
|
|
|
}
|
|
|
|
@ -535,7 +524,8 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
/**
|
|
|
|
|
* Adds the already shared contacts.
|
|
|
|
|
*
|
|
|
|
|
* @param listContact the list contact
|
|
|
|
|
* @param listContact
|
|
|
|
|
* the list contact
|
|
|
|
|
*/
|
|
|
|
|
public void addAlreadySharedContacts(List<InfoContactModel> listContact) {
|
|
|
|
|
|
|
|
|
@ -557,7 +547,8 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
/**
|
|
|
|
|
* Adds the target contacts.
|
|
|
|
|
*
|
|
|
|
|
* @param listContact the list contact
|
|
|
|
|
* @param listContact
|
|
|
|
|
* the list contact
|
|
|
|
|
*/
|
|
|
|
|
public void addTargetContacts(List<InfoContactModel> listContact) {
|
|
|
|
|
if (listContact != null && listContact.size() > 0) {
|
|
|
|
@ -568,7 +559,8 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
/**
|
|
|
|
|
* Convert from info contact model.
|
|
|
|
|
*
|
|
|
|
|
* @param listContact the list contact
|
|
|
|
|
* @param listContact
|
|
|
|
|
* the list contact
|
|
|
|
|
* @return the list
|
|
|
|
|
*/
|
|
|
|
|
private List<ExtendedInfoContactModel> convertFromInfoContactModel(List<InfoContactModel> listContact) {
|
|
|
|
@ -587,7 +579,8 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
/**
|
|
|
|
|
* Convert from info contact model.
|
|
|
|
|
*
|
|
|
|
|
* @param infoContactModel the info contact model
|
|
|
|
|
* @param infoContactModel
|
|
|
|
|
* the info contact model
|
|
|
|
|
* @return the extended info contact model
|
|
|
|
|
*/
|
|
|
|
|
private ExtendedInfoContactModel convertFromInfoContactModel(InfoContactModel infoContactModel) {
|
|
|
|
@ -596,7 +589,9 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
if (fullName == null || fullName.isEmpty())
|
|
|
|
|
fullName = infoContactModel.getLogin();
|
|
|
|
|
|
|
|
|
|
ExtendedInfoContactModel ext = new ExtendedInfoContactModel(infoContactModel.getId(), infoContactModel.getLogin(), fullName, infoContactModel.isGroup());
|
|
|
|
|
ExtendedInfoContactModel ext = new ExtendedInfoContactModel(infoContactModel.getId(),
|
|
|
|
|
infoContactModel.getLogin(), fullName, infoContactModel.getEmailDomain(),
|
|
|
|
|
infoContactModel.isGroup());
|
|
|
|
|
ext.setIcon();
|
|
|
|
|
return ext;
|
|
|
|
|
}
|
|
|
|
@ -606,7 +601,8 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
/**
|
|
|
|
|
* Adds the target contact.
|
|
|
|
|
*
|
|
|
|
|
* @param contact the contact
|
|
|
|
|
* @param contact
|
|
|
|
|
* the contact
|
|
|
|
|
*/
|
|
|
|
|
public void addTargetContact(InfoContactModel contact) {
|
|
|
|
|
if (contact != null)
|
|
|
|
@ -624,11 +620,11 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
return (List<InfoContactModel>) infoContacts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the grop user store sorter.
|
|
|
|
|
*
|
|
|
|
|
* @param store the new grop user store sorter
|
|
|
|
|
* @param store
|
|
|
|
|
* the new grop user store sorter
|
|
|
|
|
*/
|
|
|
|
|
private void setGropUserStoreSorter(ListStore<ExtendedInfoContactModel> store) {
|
|
|
|
|
|
|
|
|
@ -636,7 +632,8 @@ public class MultiDragContact extends Dialog {
|
|
|
|
|
store.setStoreSorter(new StoreSorter<ExtendedInfoContactModel>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int compare(Store<ExtendedInfoContactModel> store, ExtendedInfoContactModel m1, ExtendedInfoContactModel m2, String property) {
|
|
|
|
|
public int compare(Store<ExtendedInfoContactModel> store, ExtendedInfoContactModel m1,
|
|
|
|
|
ExtendedInfoContactModel m2, String property) {
|
|
|
|
|
boolean m1Folder = m1.isGroup();
|
|
|
|
|
boolean m2Folder = m2.isGroup();
|
|
|
|
|
|
|
|
|
|