ref #9056:TabMan - Improve resource management in TabMan
https://support.d4science.org/issues/9056 Improve resources management git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-resources-widget@152495 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a9b730fe13
commit
a0e3458727
|
@ -147,8 +147,6 @@ public class ResourcesPanel extends FramedPanel {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void open(TRId trId) {
|
||||
this.trId = trId;
|
||||
create();
|
||||
|
@ -204,27 +202,19 @@ public class ResourcesPanel extends FramedPanel {
|
|||
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"
|
||||
+ msgs.descriptionLabelFixed() + "</b></td>"
|
||||
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
|
||||
+ SafeHtmlUtils.htmlEscape(value.getDescription()) +
|
||||
+ SafeHtmlUtils.htmlEscape(value.getDescription());
|
||||
|
||||
/*
|
||||
"</td>" + "</tr>" + "<tr>"
|
||||
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"
|
||||
+ msgs.creationDateLabelFixed() + "</b></td>"
|
||||
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
|
||||
+ SafeHtmlUtils.htmlEscape(value.getCreationDate()) +
|
||||
|
||||
/*
|
||||
* "</td>" + "</tr>" + "<tr>" +
|
||||
* "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"
|
||||
* + msgs.creatorIdLabelFixed() + "</b></td>" +
|
||||
* "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
|
||||
* + new SafeHtmlBuilder().append(value.getCreatorId()).
|
||||
* toSafeHtml().asString() +
|
||||
*/
|
||||
|
||||
"</td>" + "</tr>" + "<tr>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"
|
||||
+ msgs.typeLabelFixed() + "</b></td>"
|
||||
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
|
||||
+ SafeHtmlUtils.htmlEscape(value.getResourceType().toString()) + "</td>" + "</tr>";
|
||||
"</td>" + "</tr>" + "<tr>"
|
||||
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>" + msgs.typeLabelFixed()
|
||||
+ "</b></td>" + "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
|
||||
+ SafeHtmlUtils.htmlEscape(value.getResourceType().toString()) + "</td>" + "</tr>";*/
|
||||
|
||||
ResourceTD resource = value.getResourceTD();
|
||||
String resourceData = "";
|
||||
|
@ -273,15 +263,23 @@ public class ResourcesPanel extends FramedPanel {
|
|||
} else {
|
||||
if (resource instanceof SDMXResourceTD) {
|
||||
SDMXResourceTD sdmxResourceTD = (SDMXResourceTD) resource;
|
||||
if (sdmxResourceTD.getName() != null && !sdmxResourceTD.getName().isEmpty()) {
|
||||
resourceData = resourceData + "<tr>"
|
||||
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"
|
||||
+ msgs.sdmxNameIdLabelFixed() + "</b></td>"
|
||||
+ "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
|
||||
+ "<span>" + SafeHtmlUtils.htmlEscape(sdmxResourceTD.getName())
|
||||
+ "</span>" + "</td>" + "</tr>";
|
||||
|
||||
}
|
||||
/*
|
||||
* if (sdmxResourceTD.getName() != null
|
||||
* &&
|
||||
* !sdmxResourceTD.getName().isEmpty())
|
||||
* { resourceData = resourceData +
|
||||
* "<tr>" +
|
||||
* "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'><b>"
|
||||
* + msgs.sdmxNameIdLabelFixed() +
|
||||
* "</b></td>" +
|
||||
* "<td style='font-size: 12px; padding: 2px 1px 1px 1px;'>"
|
||||
* + "<span>" +
|
||||
* SafeHtmlUtils.htmlEscape(
|
||||
* sdmxResourceTD.getName()) + "</span>"
|
||||
* + "</td>" + "</tr>";
|
||||
*
|
||||
* }
|
||||
*/
|
||||
|
||||
if (sdmxResourceTD.getResourceUrl() != null
|
||||
&& !sdmxResourceTD.getResourceUrl().isEmpty()) {
|
||||
|
@ -346,11 +344,11 @@ public class ResourcesPanel extends FramedPanel {
|
|||
});
|
||||
|
||||
expanderColumn.setHideable(false);
|
||||
//SafeStylesBuilder styleB=new SafeStylesBuilder();
|
||||
//expanderColumn.setColumnStyle(styleB.margin(5.0, Unit.PX).toSafeStyles());
|
||||
// SafeStylesBuilder styleB=new SafeStylesBuilder();
|
||||
// expanderColumn.setColumnStyle(styleB.margin(5.0,
|
||||
// Unit.PX).toSafeStyles());
|
||||
expanderColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
||||
|
||||
|
||||
ColumnConfig<ResourceTDDescriptor, String> nameCol = new ColumnConfig<ResourceTDDescriptor, String>(
|
||||
props.name(), 140, msgs.nameCol());
|
||||
|
||||
|
@ -452,33 +450,33 @@ public class ResourcesPanel extends FramedPanel {
|
|||
listOfActionCells) {
|
||||
// override the default layout
|
||||
@Override
|
||||
protected <X> void render(Cell.Context context, ResourceTDDescriptor value,
|
||||
SafeHtmlBuilder sb, HasCell<ResourceTDDescriptor, X> hasCell) {
|
||||
protected <X> void render(Cell.Context context, ResourceTDDescriptor value, SafeHtmlBuilder sb,
|
||||
HasCell<ResourceTDDescriptor, X> hasCell) {
|
||||
// Override individual cell layout
|
||||
Cell<X> cell = hasCell.getCell();
|
||||
|
||||
// set the width of the text input cell
|
||||
if (value!=null&&value.getResourceType()!=null) {
|
||||
switch(value.getResourceType()){
|
||||
if (value != null && value.getResourceType() != null) {
|
||||
switch (value.getResourceType()) {
|
||||
case CHART:
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
break;
|
||||
case CODELIST:
|
||||
if(((String)hasCell.getValue(value)).compareTo("delete")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("delete") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
}
|
||||
break;
|
||||
case CSV:
|
||||
if(((String)hasCell.getValue(value)).compareTo("delete")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("delete") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
} else {
|
||||
if(((String)hasCell.getValue(value)).compareTo("save")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("save") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
|
@ -491,26 +489,26 @@ public class ResourcesPanel extends FramedPanel {
|
|||
sb.appendHtmlConstant("</div>");
|
||||
break;
|
||||
case GENERIC_TABLE:
|
||||
if(((String)hasCell.getValue(value)).compareTo("delete")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("delete") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
}
|
||||
break;
|
||||
case GUESSER:
|
||||
if(((String)hasCell.getValue(value)).compareTo("delete")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("delete") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
}
|
||||
break;
|
||||
case JSON:
|
||||
if(((String)hasCell.getValue(value)).compareTo("delete")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("delete") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
} else {
|
||||
if(((String)hasCell.getValue(value)).compareTo("save")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("save") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
|
@ -518,12 +516,12 @@ public class ResourcesPanel extends FramedPanel {
|
|||
}
|
||||
break;
|
||||
case MAP:
|
||||
if(((String)hasCell.getValue(value)).compareTo("delete")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("delete") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
} else {
|
||||
if(((String)hasCell.getValue(value)).compareTo("open")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("open") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
|
@ -531,12 +529,12 @@ public class ResourcesPanel extends FramedPanel {
|
|||
}
|
||||
break;
|
||||
case SDMX:
|
||||
if(((String)hasCell.getValue(value)).compareTo("delete")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("delete") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
} else {
|
||||
if(((String)hasCell.getValue(value)).compareTo("open")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("open") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
|
@ -544,7 +542,7 @@ public class ResourcesPanel extends FramedPanel {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
if(((String)hasCell.getValue(value)).compareTo("delete")==0){
|
||||
if (((String) hasCell.getValue(value)).compareTo("delete") == 0) {
|
||||
sb.appendHtmlConstant("<div style='display:block;float:left;'>");
|
||||
cell.render(context, hasCell.getValue(value), sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
|
@ -553,16 +551,12 @@ public class ResourcesPanel extends FramedPanel {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
ColumnConfig<ResourceTDDescriptor, ResourceTDDescriptor> actionColumn = new ColumnConfig<ResourceTDDescriptor, ResourceTDDescriptor>(
|
||||
new IdentityValueProvider<ResourceTDDescriptor>("Action"));
|
||||
|
||||
|
@ -652,7 +646,6 @@ public class ResourcesPanel extends FramedPanel {
|
|||
|
||||
expanderColumn.initPlugin(grid);
|
||||
|
||||
|
||||
createContextMenu();
|
||||
|
||||
SelectHandler sh = new SelectHandler() {
|
||||
|
@ -674,6 +667,8 @@ public class ResourcesPanel extends FramedPanel {
|
|||
private boolean select(ResourceTDDescriptor item, String searchTerm) {
|
||||
if (item.getName() != null && item.getName().toLowerCase().contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
if (item.getCreationDate() != null && item.getCreationDate().toLowerCase().contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue