Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@99569 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
62f833a10a
commit
e94ad04df7
|
@ -44,6 +44,7 @@ import com.google.web.bindery.event.shared.EventBus;
|
|||
import com.sencha.gxt.core.client.ToStringValueProvider;
|
||||
import com.sencha.gxt.core.client.ValueProvider;
|
||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.shared.IconProvider;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
import com.sencha.gxt.data.shared.TreeStore;
|
||||
|
@ -92,6 +93,7 @@ MonitorDialogListener {
|
|||
protected TreeDataGenerator gen;
|
||||
protected TreeStore<BaseDto> store;
|
||||
protected TreeGrid<BaseDto> tree;
|
||||
private boolean updateTR;
|
||||
|
||||
|
||||
class KeyProvider implements ModelKeyProvider<BaseDto> {
|
||||
|
@ -111,6 +113,8 @@ MonitorDialogListener {
|
|||
this.eventBus = eventBus;
|
||||
this.thisPanel = this;
|
||||
forceLayoutOnResize = true;
|
||||
updateTR=false;
|
||||
init();
|
||||
retrieveCurrentTR();
|
||||
|
||||
}
|
||||
|
@ -127,30 +131,36 @@ MonitorDialogListener {
|
|||
this.eventBus = eventBus;
|
||||
this.thisPanel = this;
|
||||
forceLayoutOnResize = true;
|
||||
updateTR=false;
|
||||
init();
|
||||
draw();
|
||||
}
|
||||
|
||||
protected void draw() {
|
||||
if (tree != null) {
|
||||
remove(tree);
|
||||
}
|
||||
|
||||
retrieveValidations();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void init() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
forceLayoutOnResize = true;
|
||||
|
||||
}
|
||||
|
||||
protected void createTreeData() {
|
||||
gen = new TreeDataGenerator(validationsTasksMetadata);
|
||||
if(updateTR){
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
addChildrensToStore();
|
||||
|
||||
} else {
|
||||
create();
|
||||
}
|
||||
store.commitChanges();
|
||||
tree.expandAll();
|
||||
forceLayout();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
con = new VerticalLayoutContainer();
|
||||
|
@ -158,13 +168,7 @@ MonitorDialogListener {
|
|||
|
||||
store = new TreeStore<BaseDto>(new KeyProvider());
|
||||
|
||||
FolderDto root = gen.getRoot();
|
||||
for (BaseDto base : root.getChildrens()) {
|
||||
store.add(base);
|
||||
if (base instanceof FolderDto) {
|
||||
processFolder(store, (FolderDto) base);
|
||||
}
|
||||
}
|
||||
addChildrensToStore();
|
||||
|
||||
ColumnConfig<BaseDto, String> cc1 = new ColumnConfig<BaseDto, String>(
|
||||
new ToStringValueProvider<BaseDto>("task"), 168, "Task");
|
||||
|
@ -221,6 +225,7 @@ MonitorDialogListener {
|
|||
tree.setBorders(false);
|
||||
tree.setLoadMask(true);
|
||||
tree.setColumnResize(true);
|
||||
tree.setAutoExpand(true);
|
||||
tree.getView().setAutoExpandColumn(cc1);
|
||||
|
||||
IconProvider<BaseDto> iconProvider = new IconProvider<BaseDto>() {
|
||||
|
@ -295,12 +300,25 @@ MonitorDialogListener {
|
|||
});
|
||||
toolBar.add(btnCollapseAll);
|
||||
|
||||
con.add(toolBar, new VerticalLayoutData(1, -1));
|
||||
con.add(tree, new VerticalLayoutData(1, -1));
|
||||
con.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
con.add(tree, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
||||
add(con, new MarginData(0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void addChildrensToStore() {
|
||||
gen = new TreeDataGenerator(validationsTasksMetadata);
|
||||
|
||||
FolderDto root = gen.getRoot();
|
||||
for (BaseDto base : root.getChildrens()) {
|
||||
store.add(base);
|
||||
if (base instanceof FolderDto) {
|
||||
processFolder(store, (FolderDto) base);
|
||||
}
|
||||
}
|
||||
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
|
@ -507,13 +525,14 @@ MonitorDialogListener {
|
|||
}
|
||||
|
||||
public void update() {
|
||||
updateTR=true;
|
||||
retrieveCurrentTR();
|
||||
}
|
||||
|
||||
public void update(TRId trId) {
|
||||
this.trId = trId;
|
||||
draw();
|
||||
|
||||
updateTR=true;
|
||||
retrieveValidations();
|
||||
}
|
||||
|
||||
protected void retrieveCurrentTR() {
|
||||
|
@ -534,8 +553,7 @@ MonitorDialogListener {
|
|||
public void onSuccess(TRId result) {
|
||||
Log.debug("retrieved " + result);
|
||||
trId = result;
|
||||
init();
|
||||
draw();
|
||||
retrieveValidations();
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue