Minor glitch fixed to Liferay 6.2
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@128955 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
916c472009
commit
9aa990a944
|
@ -47,14 +47,31 @@ 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;
|
||||||
import com.extjs.gxt.ui.client.widget.tips.QuickTip;
|
import com.extjs.gxt.ui.client.widget.tips.QuickTip;
|
||||||
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||||
|
|
||||||
public class MultiDragContact extends Dialog {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class MultiDragContact.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 1, 2016
|
||||||
|
*/
|
||||||
|
public class MultiDragContact extends Dialog {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final int HEIGHT_CONTAINER_GRID = 395;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final int HEIGHT_CONTAINER_TEXT_AREA = 72;
|
||||||
|
private static final int HEIGHT_TEXT_AREA = 55;
|
||||||
private static final int WIDTH_CP = 597;
|
private static final int WIDTH_CP = 597;
|
||||||
private static final int HEIGHT_DIALOG = 542;
|
// private static final int HEIGHT_DIALOG = 542;
|
||||||
private static final int WIDTH_DIALOG = 625;
|
private static final int HEIGHT_DIALOG = 580;
|
||||||
|
private static final int WIDTH_DIALOG = 630;
|
||||||
|
// private static final int WIDTH_DIALOG = 625;
|
||||||
private static final int HEIGHT_GRID = 310;
|
private static final int HEIGHT_GRID = 310;
|
||||||
|
|
||||||
private GridDropTarget dropSource;
|
private GridDropTarget dropSource;
|
||||||
private GridDropTarget dropTarget;
|
private GridDropTarget dropTarget;
|
||||||
private ListStore<ExtendedInfoContactModel> storeSource = new ListStore<ExtendedInfoContactModel>();
|
private ListStore<ExtendedInfoContactModel> storeSource = new ListStore<ExtendedInfoContactModel>();
|
||||||
|
@ -67,9 +84,12 @@ public class MultiDragContact extends Dialog {
|
||||||
private Button buttonSelectedRight;
|
private Button buttonSelectedRight;
|
||||||
private Button buttonAllRight;
|
private Button buttonAllRight;
|
||||||
private Button buttonAllLeft;
|
private Button buttonAllLeft;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new multi drag contact.
|
||||||
|
*/
|
||||||
public MultiDragContact() {
|
public MultiDragContact() {
|
||||||
setStyleAttribute("margin", "10px");
|
setStyleAttribute("margin", "10px");
|
||||||
setSize(WIDTH_DIALOG, HEIGHT_DIALOG);
|
setSize(WIDTH_DIALOG, HEIGHT_DIALOG);
|
||||||
setHeading("Group dragging contacts");
|
setHeading("Group dragging contacts");
|
||||||
setResizable(false);
|
setResizable(false);
|
||||||
|
@ -79,19 +99,19 @@ public class MultiDragContact extends Dialog {
|
||||||
setScrollMode(Scroll.AUTOY);
|
setScrollMode(Scroll.AUTOY);
|
||||||
setBodyStyle("padding: 9px; background: none");
|
setBodyStyle("padding: 9px; background: none");
|
||||||
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(WIDTH_CP, 60);
|
cpAlreadyShared.setSize(WIDTH_CP, HEIGHT_CONTAINER_TEXT_AREA);
|
||||||
cpAlreadyShared.setHeaderVisible(false);
|
cpAlreadyShared.setHeaderVisible(false);
|
||||||
|
|
||||||
cpAlreadyShared.setLayout(new FitLayout());
|
cpAlreadyShared.setLayout(new FitLayout());
|
||||||
|
|
||||||
VerticalPanel vpShared = new VerticalPanel();
|
VerticalPanel vpShared = new VerticalPanel();
|
||||||
vpShared.setVerticalAlign(VerticalAlignment.MIDDLE);
|
vpShared.setVerticalAlign(VerticalAlignment.MIDDLE);
|
||||||
vpShared.setHorizontalAlign(HorizontalAlignment.CENTER);
|
vpShared.setHorizontalAlign(HorizontalAlignment.CENTER);
|
||||||
|
@ -104,73 +124,74 @@ public class MultiDragContact extends Dialog {
|
||||||
// textField.setFieldLabel("Already shared with");
|
// textField.setFieldLabel("Already shared with");
|
||||||
// textField.setHeight(30);
|
// textField.setHeight(30);
|
||||||
textAreaAlreadyShared.setWidth(501);
|
textAreaAlreadyShared.setWidth(501);
|
||||||
textAreaAlreadyShared.setHeight(43);
|
textAreaAlreadyShared.setHeight(HEIGHT_TEXT_AREA);
|
||||||
cpAlreadyShared.setStyleAttribute("padding-bottom", "5px");
|
cpAlreadyShared.setStyleAttribute("padding-bottom", "5px");
|
||||||
textAreaAlreadyShared.setReadOnly(true);
|
textAreaAlreadyShared.setReadOnly(true);
|
||||||
cpAlreadyShared.add(textAreaAlreadyShared);
|
cpAlreadyShared.add(textAreaAlreadyShared);
|
||||||
|
|
||||||
Label label = new Label("Already shared with");
|
Label label = new Label("Already shared with");
|
||||||
label.setStyleAttribute("padding-right", "10px");
|
label.setStyleAttribute("padding-right", "10px");
|
||||||
|
label.setStyleAttribute("font-size", "12px");
|
||||||
|
|
||||||
hpSharedContacts.add(label);
|
hpSharedContacts.add(label);
|
||||||
hpSharedContacts.add(textAreaAlreadyShared);
|
hpSharedContacts.add(textAreaAlreadyShared);
|
||||||
vpShared.add(hpSharedContacts);
|
vpShared.add(hpSharedContacts);
|
||||||
cpAlreadyShared.add(vpShared);
|
cpAlreadyShared.add(vpShared);
|
||||||
add(cpAlreadyShared);
|
add(cpAlreadyShared);
|
||||||
|
|
||||||
|
|
||||||
final ContentPanel cp = new ContentPanel();
|
|
||||||
cp.setSize(WIDTH_CP, 370);
|
|
||||||
cp.setHeaderVisible(false);
|
|
||||||
cp.setLayout(new RowLayout(Orientation.HORIZONTAL));
|
|
||||||
|
|
||||||
ToolBar toolBar = new ToolBar();
|
|
||||||
|
final ContentPanel cp = new ContentPanel();
|
||||||
|
cp.setSize(WIDTH_CP, HEIGHT_CONTAINER_GRID);
|
||||||
|
cp.setHeaderVisible(false);
|
||||||
|
cp.setLayout(new RowLayout(Orientation.HORIZONTAL));
|
||||||
|
|
||||||
|
ToolBar toolBar = new ToolBar();
|
||||||
Button buttonHelp = new Button();
|
Button buttonHelp = new Button();
|
||||||
buttonHelp.setIcon(Resources.getIconInfo());
|
buttonHelp.setIcon(Resources.getIconInfo());
|
||||||
|
|
||||||
buttonHelp.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
buttonHelp.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@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);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
toolBar.add(buttonHelp);
|
toolBar.add(buttonHelp);
|
||||||
setTopComponent(toolBar);
|
setTopComponent(toolBar);
|
||||||
|
|
||||||
final VerticalPanel vpAllContacts = new VerticalPanel();
|
final VerticalPanel vpAllContacts = new VerticalPanel();
|
||||||
vpAllContacts.setHorizontalAlign(HorizontalAlignment.CENTER);
|
vpAllContacts.setHorizontalAlign(HorizontalAlignment.CENTER);
|
||||||
vpAllContacts.add(new Label("All Contacts"));
|
vpAllContacts.add(new Label("All Contacts"));
|
||||||
|
|
||||||
gridAllContacts = new Grid<ExtendedInfoContactModel>(storeSource, createColumnModel());
|
gridAllContacts = new Grid<ExtendedInfoContactModel>(storeSource, createColumnModel());
|
||||||
|
|
||||||
|
|
||||||
GridCellRenderer<ExtendedInfoContactModel> displayNameCellRender = new GridCellRenderer<ExtendedInfoContactModel>() {
|
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){
|
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>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
columnConfigDisplayName.setRenderer(displayNameCellRender);
|
columnConfigDisplayName.setRenderer(displayNameCellRender);
|
||||||
|
|
||||||
storeSource.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
|
storeSource.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
storeSource.sort(InfoContactModel.FULLNAME, SortDir.ASC);
|
storeSource.sort(InfoContactModel.FULLNAME, SortDir.ASC);
|
||||||
|
|
||||||
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<ExtendedInfoContactModel> filter = new StoreFilterField<ExtendedInfoContactModel>() {
|
final StoreFilterField<ExtendedInfoContactModel> filter = new StoreFilterField<ExtendedInfoContactModel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -187,39 +208,39 @@ public class MultiDragContact extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
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");
|
||||||
hp.setStyleAttribute("padding-bottom", "5px");
|
hp.setStyleAttribute("padding-bottom", "5px");
|
||||||
hp.add(filter);
|
hp.add(filter);
|
||||||
filter.bind(storeSource);
|
filter.bind(storeSource);
|
||||||
|
|
||||||
gridAllContacts.setHeight(HEIGHT_GRID);
|
gridAllContacts.setHeight(HEIGHT_GRID);
|
||||||
gridAllContacts.setBorders(false);
|
gridAllContacts.setBorders(false);
|
||||||
gridAllContacts.getView().setAutoFill(true);
|
gridAllContacts.getView().setAutoFill(true);
|
||||||
gridAllContacts.setBorders(true);
|
gridAllContacts.setBorders(true);
|
||||||
|
|
||||||
vpAllContacts.add(hp);
|
vpAllContacts.add(hp);
|
||||||
vpAllContacts.add(gridAllContacts);
|
vpAllContacts.add(gridAllContacts);
|
||||||
|
|
||||||
RowData rowData = new RowData(.4, 1);
|
|
||||||
rowData.setMargins(new Margins(6));
|
|
||||||
cp.add(vpAllContacts, rowData);
|
|
||||||
|
|
||||||
rowData = new RowData(.2, 1);
|
|
||||||
rowData.setMargins(new Margins(6));
|
|
||||||
LayoutContainer lc = createMoveContactsContainer();
|
|
||||||
cp.add(lc, rowData);
|
|
||||||
|
|
||||||
rowData = new RowData(.4, 1);
|
RowData rowData = new RowData(.4, 1);
|
||||||
rowData.setMargins(new Margins(6, 6, 6, 0));
|
rowData.setMargins(new Margins(6));
|
||||||
|
cp.add(vpAllContacts, rowData);
|
||||||
|
|
||||||
|
rowData = new RowData(.2, 1);
|
||||||
|
rowData.setMargins(new Margins(6));
|
||||||
|
LayoutContainer lc = createMoveContactsContainer();
|
||||||
|
cp.add(lc, rowData);
|
||||||
|
|
||||||
|
rowData = new RowData(.4, 1);
|
||||||
|
rowData.setMargins(new Margins(6, 6, 6, 0));
|
||||||
|
|
||||||
final VerticalPanel vpShareWith = new VerticalPanel();
|
final VerticalPanel vpShareWith = new VerticalPanel();
|
||||||
vpShareWith.setHorizontalAlign(HorizontalAlignment.CENTER);
|
vpShareWith.setHorizontalAlign(HorizontalAlignment.CENTER);
|
||||||
vpShareWith.add(new Label("Share with..."));
|
vpShareWith.add(new Label("Share with..."));
|
||||||
gridShareWith = new Grid<ExtendedInfoContactModel>(storeTarget, createColumnModel());
|
gridShareWith = new Grid<ExtendedInfoContactModel>(storeTarget, createColumnModel());
|
||||||
|
|
||||||
final StoreFilterField<ExtendedInfoContactModel> filter2 = new StoreFilterField<ExtendedInfoContactModel>() {
|
final StoreFilterField<ExtendedInfoContactModel> filter2 = new StoreFilterField<ExtendedInfoContactModel>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -236,35 +257,35 @@ public class MultiDragContact extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
filter2.setEmptyText("Filter Share with");
|
filter2.setEmptyText("Filter Share with");
|
||||||
|
|
||||||
hp = new HorizontalPanel();
|
hp = new HorizontalPanel();
|
||||||
hp.setStyleAttribute("padding-top", "5px");
|
hp.setStyleAttribute("padding-top", "5px");
|
||||||
hp.setStyleAttribute("padding-bottom", "5px");
|
hp.setStyleAttribute("padding-bottom", "5px");
|
||||||
hp.add(filter2);
|
hp.add(filter2);
|
||||||
filter2.bind(storeTarget);
|
filter2.bind(storeTarget);
|
||||||
|
|
||||||
gridShareWith.setHeight(HEIGHT_GRID);
|
gridShareWith.setHeight(HEIGHT_GRID);
|
||||||
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);
|
||||||
vpShareWith.add(hp);
|
vpShareWith.add(hp);
|
||||||
vpShareWith.add(gridShareWith);
|
vpShareWith.add(gridShareWith);
|
||||||
|
|
||||||
cp.add(vpShareWith, rowData);
|
cp.add(vpShareWith, rowData);
|
||||||
|
|
||||||
new GridDragSource(gridAllContacts);
|
new GridDragSource(gridAllContacts);
|
||||||
new GridDragSource(gridShareWith);
|
new GridDragSource(gridShareWith);
|
||||||
|
|
||||||
dropSource = new GridDropTarget(gridAllContacts);
|
dropSource = new GridDropTarget(gridAllContacts);
|
||||||
dropSource.setAllowSelfAsSource(false);
|
dropSource.setAllowSelfAsSource(false);
|
||||||
|
|
||||||
dropTarget = new GridDropTarget(gridShareWith);
|
dropTarget = new GridDropTarget(gridShareWith);
|
||||||
dropTarget.setAllowSelfAsSource(false);
|
dropTarget.setAllowSelfAsSource(false);
|
||||||
|
|
||||||
add(cp);
|
add(cp);
|
||||||
|
|
||||||
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@ -273,16 +294,16 @@ public class MultiDragContact extends Dialog {
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
List<ExtendedInfoContactModel> shareContacts = storeTarget.getModels();
|
List<ExtendedInfoContactModel> shareContacts = storeTarget.getModels();
|
||||||
|
|
||||||
if(shareContacts==null || shareContacts.isEmpty()){
|
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>() {
|
mbc.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() {
|
||||||
|
@ -298,11 +319,11 @@ public class MultiDragContact extends Dialog {
|
||||||
}else
|
}else
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// needed to enable quicktips (qtitle for the heading and qtip for the
|
// needed to enable quicktips (qtitle for the heading and qtip for the
|
||||||
// content) that are setup in the change GridCellRenderer
|
// content) that are setup in the change GridCellRenderer
|
||||||
|
|
||||||
cp.addListener(Events.Render, new Listener<BaseEvent>() {
|
cp.addListener(Events.Render, new Listener<BaseEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -319,10 +340,15 @@ public class MultiDragContact extends Dialog {
|
||||||
cp.layout();
|
cp.layout();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
new QuickTip(gridAllContacts);
|
new QuickTip(gridAllContacts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the move contacts container.
|
||||||
|
*
|
||||||
|
* @return the layout container
|
||||||
|
*/
|
||||||
private LayoutContainer createMoveContactsContainer() {
|
private LayoutContainer createMoveContactsContainer() {
|
||||||
|
|
||||||
LayoutContainer lc = new LayoutContainer();
|
LayoutContainer lc = new LayoutContainer();
|
||||||
|
@ -428,7 +454,7 @@ public class MultiDragContact extends Dialog {
|
||||||
vp1.add(buttonAllRight);
|
vp1.add(buttonAllRight);
|
||||||
|
|
||||||
lc.add(vp1);
|
lc.add(vp1);
|
||||||
|
|
||||||
vp1.addListener(Events.Render, new Listener<BaseEvent>() {
|
vp1.addListener(Events.Render, new Listener<BaseEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -443,24 +469,29 @@ public class MultiDragContact extends Dialog {
|
||||||
|
|
||||||
return lc;
|
return lc;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ColumnModel createColumnModel() {
|
/**
|
||||||
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
* Creates the column model.
|
||||||
|
*
|
||||||
|
* @return the column model
|
||||||
|
*/
|
||||||
|
private ColumnModel createColumnModel() {
|
||||||
|
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||||
|
|
||||||
ColumnConfig icon = new ColumnConfig(ExtendedInfoContactModel.ICON, "", 25);
|
ColumnConfig icon = new ColumnConfig(ExtendedInfoContactModel.ICON, "", 25);
|
||||||
configs.add(icon);
|
configs.add(icon);
|
||||||
|
|
||||||
columnConfigDisplayName = new ColumnConfig(ExtendedInfoContactModel.FULLNAME, "Name", 150);
|
columnConfigDisplayName = new ColumnConfig(ExtendedInfoContactModel.FULLNAME, "Name", 150);
|
||||||
configs.add(columnConfigDisplayName);
|
configs.add(columnConfigDisplayName);
|
||||||
|
|
||||||
ColumnConfig type = new ColumnConfig(ExtendedInfoContactModel.ISGROUP, "Type", 50);
|
ColumnConfig type = new ColumnConfig(ExtendedInfoContactModel.ISGROUP, "Type", 50);
|
||||||
configs.add(type);
|
configs.add(type);
|
||||||
|
|
||||||
|
|
||||||
GridCellRenderer<ExtendedInfoContactModel> typeRender = new GridCellRenderer<ExtendedInfoContactModel>() {
|
GridCellRenderer<ExtendedInfoContactModel> typeRender = new GridCellRenderer<ExtendedInfoContactModel>() {
|
||||||
@Override
|
@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);
|
Boolean isGroup = (Boolean) model.get(property);
|
||||||
String color = "#0F4FA8";
|
String color = "#0F4FA8";
|
||||||
String val = "";
|
String val = "";
|
||||||
if(isGroup){
|
if(isGroup){
|
||||||
|
@ -471,15 +502,20 @@ public class MultiDragContact extends Dialog {
|
||||||
val = "User";
|
val = "User";
|
||||||
return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>";
|
return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
type.setRenderer(typeRender);
|
type.setRenderer(typeRender);
|
||||||
return new ColumnModel(configs);
|
return new ColumnModel(configs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the source contacts.
|
||||||
|
*
|
||||||
|
* @param listContact the list contact
|
||||||
|
*/
|
||||||
public void addSourceContacts(List<InfoContactModel> listContact){
|
public void addSourceContacts(List<InfoContactModel> listContact){
|
||||||
|
|
||||||
gridAllContacts.mask("", ConstantsExplorer.LOADINGSTYLE);
|
gridAllContacts.mask("", ConstantsExplorer.LOADINGSTYLE);
|
||||||
if(listContact!=null && listContact.size()>0){
|
if(listContact!=null && listContact.size()>0){
|
||||||
List<ExtendedInfoContactModel> listExtended = new ArrayList<ExtendedInfoContactModel>();
|
List<ExtendedInfoContactModel> listExtended = new ArrayList<ExtendedInfoContactModel>();
|
||||||
|
@ -489,40 +525,56 @@ public class MultiDragContact extends Dialog {
|
||||||
ext.setIcon();
|
ext.setIcon();
|
||||||
listExtended.add(ext);
|
listExtended.add(ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
storeSource.add(listExtended);
|
storeSource.add(listExtended);
|
||||||
// GWT.log("Added sources: "+listExtended.toString());
|
// GWT.log("Added sources: "+listExtended.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
gridAllContacts.unmask();
|
gridAllContacts.unmask();
|
||||||
gridAllContacts.repaint();
|
gridAllContacts.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the already shared contacts.
|
||||||
|
*
|
||||||
|
* @param listContact the list contact
|
||||||
|
*/
|
||||||
public void addAlreadySharedContacts(List<InfoContactModel> listContact){
|
public void addAlreadySharedContacts(List<InfoContactModel> listContact){
|
||||||
|
|
||||||
gridShareWith.mask("", ConstantsExplorer.LOADINGSTYLE);
|
gridShareWith.mask("", ConstantsExplorer.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);
|
||||||
}
|
}
|
||||||
gridShareWith.unmask();
|
gridShareWith.unmask();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the target contacts.
|
||||||
|
*
|
||||||
|
* @param listContact the list contact
|
||||||
|
*/
|
||||||
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(convertFromInfoContactModel(listContact));
|
storeTarget.add(convertFromInfoContactModel(listContact));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert from info contact model.
|
||||||
|
*
|
||||||
|
* @param listContact the list contact
|
||||||
|
* @return the list
|
||||||
|
*/
|
||||||
private List<ExtendedInfoContactModel> convertFromInfoContactModel(List<InfoContactModel> listContact){
|
private List<ExtendedInfoContactModel> convertFromInfoContactModel(List<InfoContactModel> listContact){
|
||||||
|
|
||||||
if(listContact!=null){
|
if(listContact!=null){
|
||||||
List<ExtendedInfoContactModel> listExtended = new ArrayList<ExtendedInfoContactModel>(listContact.size());
|
List<ExtendedInfoContactModel> listExtended = new ArrayList<ExtendedInfoContactModel>(listContact.size());
|
||||||
//SETTING ICONS
|
//SETTING ICONS
|
||||||
|
@ -531,36 +583,57 @@ public class MultiDragContact extends Dialog {
|
||||||
}
|
}
|
||||||
return listExtended;
|
return listExtended;
|
||||||
}
|
}
|
||||||
return new ArrayList<ExtendedInfoContactModel>();
|
return new ArrayList<ExtendedInfoContactModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert from info contact model.
|
||||||
|
*
|
||||||
|
* @param infoContactModel the info contact model
|
||||||
|
* @return the extended info contact model
|
||||||
|
*/
|
||||||
private ExtendedInfoContactModel convertFromInfoContactModel(InfoContactModel infoContactModel){
|
private ExtendedInfoContactModel convertFromInfoContactModel(InfoContactModel infoContactModel){
|
||||||
if(infoContactModel!=null){
|
if(infoContactModel!=null){
|
||||||
String fullName = infoContactModel.getName();
|
String fullName = infoContactModel.getName();
|
||||||
if(fullName==null || fullName.isEmpty())
|
if(fullName==null || fullName.isEmpty())
|
||||||
fullName = infoContactModel.getLogin();
|
fullName = infoContactModel.getLogin();
|
||||||
|
|
||||||
ExtendedInfoContactModel ext = new ExtendedInfoContactModel(infoContactModel.getId(), infoContactModel.getLogin(), fullName, infoContactModel.isGroup());
|
ExtendedInfoContactModel ext = new ExtendedInfoContactModel(infoContactModel.getId(), infoContactModel.getLogin(), fullName, infoContactModel.isGroup());
|
||||||
ext.setIcon();
|
ext.setIcon();
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
return new ExtendedInfoContactModel();
|
return new ExtendedInfoContactModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the target contact.
|
||||||
|
*
|
||||||
|
* @param contact the contact
|
||||||
|
*/
|
||||||
public void addTargetContact(InfoContactModel contact){
|
public void addTargetContact(InfoContactModel contact){
|
||||||
if(contact!=null)
|
if(contact!=null)
|
||||||
storeTarget.add(convertFromInfoContactModel(contact));
|
storeTarget.add(convertFromInfoContactModel(contact));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the target list contact.
|
||||||
|
*
|
||||||
|
* @return the target list contact
|
||||||
|
*/
|
||||||
public List<InfoContactModel> getTargetListContact(){
|
public List<InfoContactModel> getTargetListContact(){
|
||||||
|
|
||||||
List<? extends InfoContactModel> infoContacts = storeTarget.getModels();
|
List<? extends InfoContactModel> infoContacts = storeTarget.getModels();
|
||||||
return (List<InfoContactModel>) infoContacts;
|
return (List<InfoContactModel>) infoContacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the grop user store sorter.
|
||||||
|
*
|
||||||
|
* @param store the new grop user store sorter
|
||||||
|
*/
|
||||||
private void setGropUserStoreSorter(ListStore<ExtendedInfoContactModel> store){
|
private void setGropUserStoreSorter(ListStore<ExtendedInfoContactModel> store){
|
||||||
|
|
||||||
// Sorting files
|
// Sorting files
|
||||||
store.setStoreSorter(new StoreSorter<ExtendedInfoContactModel>() {
|
store.setStoreSorter(new StoreSorter<ExtendedInfoContactModel>() {
|
||||||
|
|
||||||
|
@ -574,10 +647,10 @@ public class MultiDragContact extends Dialog {
|
||||||
} else if (!m1Folder && m2Folder) {
|
} else if (!m1Folder && m2Folder) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m1.getName().compareToIgnoreCase(m2.getName());
|
return m1.getName().compareToIgnoreCase(m2.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue