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.ToStringValueProvider;
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
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.IconProvider;
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
import com.sencha.gxt.data.shared.TreeStore;
|
import com.sencha.gxt.data.shared.TreeStore;
|
||||||
|
@ -92,6 +93,7 @@ MonitorDialogListener {
|
||||||
protected TreeDataGenerator gen;
|
protected TreeDataGenerator gen;
|
||||||
protected TreeStore<BaseDto> store;
|
protected TreeStore<BaseDto> store;
|
||||||
protected TreeGrid<BaseDto> tree;
|
protected TreeGrid<BaseDto> tree;
|
||||||
|
private boolean updateTR;
|
||||||
|
|
||||||
|
|
||||||
class KeyProvider implements ModelKeyProvider<BaseDto> {
|
class KeyProvider implements ModelKeyProvider<BaseDto> {
|
||||||
|
@ -111,6 +113,8 @@ MonitorDialogListener {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.thisPanel = this;
|
this.thisPanel = this;
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
|
updateTR=false;
|
||||||
|
init();
|
||||||
retrieveCurrentTR();
|
retrieveCurrentTR();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -127,29 +131,35 @@ MonitorDialogListener {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.thisPanel = this;
|
this.thisPanel = this;
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
|
updateTR=false;
|
||||||
init();
|
init();
|
||||||
draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void draw() {
|
|
||||||
if (tree != null) {
|
|
||||||
remove(tree);
|
|
||||||
}
|
|
||||||
|
|
||||||
retrieveValidations();
|
retrieveValidations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
setWidth(WIDTH);
|
setWidth(WIDTH);
|
||||||
setHeight(HEIGHT);
|
setHeight(HEIGHT);
|
||||||
setHeaderVisible(false);
|
setHeaderVisible(false);
|
||||||
setBodyBorder(false);
|
setBodyBorder(false);
|
||||||
forceLayoutOnResize = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createTreeData() {
|
protected void createTreeData() {
|
||||||
gen = new TreeDataGenerator(validationsTasksMetadata);
|
if(updateTR){
|
||||||
create();
|
store.clear();
|
||||||
|
store.commitChanges();
|
||||||
|
addChildrensToStore();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
create();
|
||||||
|
}
|
||||||
|
store.commitChanges();
|
||||||
|
tree.expandAll();
|
||||||
|
forceLayout();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create() {
|
protected void create() {
|
||||||
|
@ -157,15 +167,9 @@ MonitorDialogListener {
|
||||||
con.setScrollMode(ScrollMode.AUTO);
|
con.setScrollMode(ScrollMode.AUTO);
|
||||||
|
|
||||||
store = new TreeStore<BaseDto>(new KeyProvider());
|
store = new TreeStore<BaseDto>(new KeyProvider());
|
||||||
|
|
||||||
FolderDto root = gen.getRoot();
|
addChildrensToStore();
|
||||||
for (BaseDto base : root.getChildrens()) {
|
|
||||||
store.add(base);
|
|
||||||
if (base instanceof FolderDto) {
|
|
||||||
processFolder(store, (FolderDto) base);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnConfig<BaseDto, String> cc1 = new ColumnConfig<BaseDto, String>(
|
ColumnConfig<BaseDto, String> cc1 = new ColumnConfig<BaseDto, String>(
|
||||||
new ToStringValueProvider<BaseDto>("task"), 168, "Task");
|
new ToStringValueProvider<BaseDto>("task"), 168, "Task");
|
||||||
cc1.setHeader("Task");
|
cc1.setHeader("Task");
|
||||||
|
@ -220,7 +224,8 @@ MonitorDialogListener {
|
||||||
tree.getView().setAutoFill(true);
|
tree.getView().setAutoFill(true);
|
||||||
tree.setBorders(false);
|
tree.setBorders(false);
|
||||||
tree.setLoadMask(true);
|
tree.setLoadMask(true);
|
||||||
tree.setColumnResize(true);
|
tree.setColumnResize(true);
|
||||||
|
tree.setAutoExpand(true);
|
||||||
tree.getView().setAutoExpandColumn(cc1);
|
tree.getView().setAutoExpandColumn(cc1);
|
||||||
|
|
||||||
IconProvider<BaseDto> iconProvider = new IconProvider<BaseDto>() {
|
IconProvider<BaseDto> iconProvider = new IconProvider<BaseDto>() {
|
||||||
|
@ -295,13 +300,26 @@ MonitorDialogListener {
|
||||||
});
|
});
|
||||||
toolBar.add(btnCollapseAll);
|
toolBar.add(btnCollapseAll);
|
||||||
|
|
||||||
con.add(toolBar, new VerticalLayoutData(1, -1));
|
con.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
con.add(tree, new VerticalLayoutData(1, -1));
|
con.add(tree, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
|
||||||
add(con, new MarginData(0));
|
add(con, new MarginData(0));
|
||||||
|
}
|
||||||
forceLayout();
|
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void requestSolution(Context context) {
|
protected void requestSolution(Context context) {
|
||||||
|
@ -507,13 +525,14 @@ MonitorDialogListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
|
updateTR=true;
|
||||||
retrieveCurrentTR();
|
retrieveCurrentTR();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(TRId trId) {
|
public void update(TRId trId) {
|
||||||
this.trId = trId;
|
this.trId = trId;
|
||||||
draw();
|
updateTR=true;
|
||||||
|
retrieveValidations();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void retrieveCurrentTR() {
|
protected void retrieveCurrentTR() {
|
||||||
|
@ -534,8 +553,7 @@ MonitorDialogListener {
|
||||||
public void onSuccess(TRId result) {
|
public void onSuccess(TRId result) {
|
||||||
Log.debug("retrieved " + result);
|
Log.debug("retrieved " + result);
|
||||||
trId = result;
|
trId = result;
|
||||||
init();
|
retrieveValidations();
|
||||||
draw();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue