Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@94701 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
030e8964ca
commit
169b7745b6
|
@ -33,7 +33,6 @@ import com.sencha.gxt.widget.core.client.FramedPanel;
|
|||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||
|
@ -76,9 +75,7 @@ public class ValidationsTablePanel extends FramedPanel {
|
|||
}
|
||||
|
||||
protected void create() {
|
||||
ValidationsProperties props = GWT
|
||||
.create(ValidationsProperties.class);
|
||||
|
||||
ValidationsProperties props = GWT.create(ValidationsProperties.class);
|
||||
|
||||
ColumnConfig<Validations, String> descriptionCol = new ColumnConfig<Validations, String>(
|
||||
props.description(), 168, "Description");
|
||||
|
@ -91,18 +88,20 @@ public class ValidationsTablePanel extends FramedPanel {
|
|||
SafeHtmlBuilder sb) {
|
||||
|
||||
if (value) {
|
||||
sb.appendHtmlConstant("<img src='"+ResourceBundle.INSTANCE.ok().getSafeUri().asString()+"' alt='true'>");
|
||||
sb.appendHtmlConstant("<img src='"
|
||||
+ ResourceBundle.INSTANCE.ok().getSafeUri()
|
||||
.asString() + "' alt='true'>");
|
||||
|
||||
} else {
|
||||
sb.appendHtmlConstant("<img src='"+ResourceBundle.INSTANCE.exit().getSafeUri().asString()+"' alt='true'>");
|
||||
sb.appendHtmlConstant("<img src='"
|
||||
+ ResourceBundle.INSTANCE.exit().getSafeUri()
|
||||
.asString() + "' alt='true'>");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
List<ColumnConfig<Validations, ?>> l = new ArrayList<ColumnConfig<Validations, ?>>();
|
||||
l.add(descriptionCol);
|
||||
l.add(validCol);
|
||||
|
@ -111,8 +110,6 @@ public class ValidationsTablePanel extends FramedPanel {
|
|||
|
||||
storeValidations = new ListStore<Validations>(props.id());
|
||||
|
||||
|
||||
|
||||
RpcProxy<ListLoadConfig, ListLoadResult<Validations>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<Validations>>() {
|
||||
|
||||
public void load(ListLoadConfig loadConfig,
|
||||
|
@ -120,7 +117,6 @@ public class ValidationsTablePanel extends FramedPanel {
|
|||
loadData(loadConfig, callback);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
loader = new ListLoader<ListLoadConfig, ListLoadResult<Validations>>(
|
||||
|
@ -131,9 +127,6 @@ public class ValidationsTablePanel extends FramedPanel {
|
|||
storeValidations) {
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
grid = new Grid<Validations>(storeValidations, cm) {
|
||||
@Override
|
||||
protected void onAfterFirstAttach() {
|
||||
|
@ -157,19 +150,20 @@ public class ValidationsTablePanel extends FramedPanel {
|
|||
grid.setColumnReordering(true);
|
||||
grid.setColumnResize(true);
|
||||
grid.getView().setAutoExpandColumn(descriptionCol);
|
||||
grid.getView().setEmptyText("No validations");
|
||||
|
||||
// FieldLabel validationsLabel = new FieldLabel(null, "Validations");
|
||||
// validationsLabel.getElement().applyStyles("font-weight:bold");
|
||||
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
v.setScrollMode(ScrollMode.AUTO);
|
||||
//v.add(validationsLabel, new VerticalLayoutData(-1, -1, new Margins(2,1,5,1)));
|
||||
// v.add(validationsLabel, new VerticalLayoutData(-1, -1, new
|
||||
// Margins(2,1,5,1)));
|
||||
v.add(grid, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
add(v);
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void loadData(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<Validations>> callback) {
|
||||
|
||||
|
@ -177,36 +171,34 @@ public class ValidationsTablePanel extends FramedPanel {
|
|||
new AsyncCallback<TabValidationsMetadata>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("load validations metadata failure:"
|
||||
Log.error("Load validations metadata failure: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving validations metadata",
|
||||
UtilsGXT3.alert(
|
||||
"Error retrieving validations metadata",
|
||||
"Error retrieving validations metadata");
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
public void onSuccess(TabValidationsMetadata result) {
|
||||
Log.trace("loaded " + result.getId());
|
||||
Log.debug("loaded " + result.getId());
|
||||
if (result.getValidations() != null) {
|
||||
Log.debug("Validations Retrieved: "
|
||||
+ result.getValidations().size());
|
||||
callback.onSuccess(new ListLoadResultBean<Validations>(
|
||||
result.getValidations()));
|
||||
} else {
|
||||
Log.error("load validations metadata failure: null");
|
||||
UtilsGXT3.alert("Error retrieving validations metadata",
|
||||
"Error retrieving validations metadata");
|
||||
callback.onFailure(new Exception("Error retrieving validations metadata"));
|
||||
Log.debug("No validations");
|
||||
ArrayList<Validations> empty=new ArrayList<Validations>();
|
||||
callback.onSuccess(new ListLoadResultBean<Validations>(
|
||||
empty));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void update(TRId trId) {
|
||||
this.trId = trId;
|
||||
loader.load();
|
||||
|
|
Loading…
Reference in New Issue