From 7f89872618fc45795d76ffd7c6a4e822f8c2f72f Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 23 Sep 2022 16:29:02 +0200 Subject: [PATCH] Improved CSS --- .../client/ui/table/ItemsTable.java | 90 ++++++++++--------- src/main/webapp/GeoPortalDataEntryApp.css | 11 ++- 2 files changed, 58 insertions(+), 43 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java index f5c621c..9c833b2 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java @@ -24,6 +24,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.StringUtil; import com.github.gwtbootstrap.client.ui.ButtonCell; import com.github.gwtbootstrap.client.ui.Pagination; import com.google.gwt.core.shared.GWT; +import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.safehtml.shared.SafeHtml; @@ -52,7 +53,9 @@ import com.google.gwt.view.client.SingleSelectionModel; */ public class ItemsTable extends AbstractItemsCellTable { - private static final String CSS_CLASS_BACK_SYSTEM_CELL = "back-system-cell"; + private static final String CSS_CLASS_BACK_SYSTEM_CELL_B = "back-system-cell-b"; + private static final String CSS_CLASS_BACK_SYSTEM_CELL_O = "back-system-cell-o"; + private static final String CSS_CLASS_BACK_SYSTEM_CELL_Y = "back-system-cell-y"; private static final int MAX_TEXT_DIMENSION = 350; private static final int ITEMS_PER_PAGE = 10; private static final String NO_DATA = "No data"; @@ -189,6 +192,43 @@ public class ItemsTable extends AbstractItemsCellTable sortedCellTable.addColumn(col, displayName, true); i++; } + + // COL RELATIONS + TextColumn colRelationship = new TextColumn() { + @Override + public String getValue(T object) { + + if (object == null) + return ""; + + ResultDocumentDV documentDV = (ResultDocumentDV) object; + String htmlValue = toDisplayClusterOfRelationships(documentDV.getListRelationshipDV()); + return htmlValue; + } + + @Override + public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) { + if (object == null) + return; + + ResultDocumentDV documentDV = (ResultDocumentDV) object; + List relations = documentDV.getListRelationshipDV(); + String color = "#333"; + if (relations == null || relations.isEmpty()) { + color = "#555"; + } + + sb.appendHtmlConstant(""); + super.render(context, object, sb); + sb.appendHtmlConstant(""); + + }; + + }; + + colRelationship.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_B); + sortedCellTable.addColumn(colRelationship, DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS.getTitle(), true); + mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS, colRelationship); // COL CREATED TextColumn colCreated = new TextColumn() { @@ -213,8 +253,9 @@ public class ItemsTable extends AbstractItemsCellTable }; - colCreated.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL); + colCreated.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_O); sortedCellTable.addColumn(colCreated, DEFAULT_DISPLAYING_COLUMN_NAME.CREATED.getTitle(), true); + sortedCellTable.setColumnWidth(colCreated, 130, Unit.PX); mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.CREATED, colCreated); // COL PUBLISHER @@ -240,7 +281,7 @@ public class ItemsTable extends AbstractItemsCellTable }; - colPublisher.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL); + colPublisher.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_O); sortedCellTable.addColumn(colPublisher, DEFAULT_DISPLAYING_COLUMN_NAME.CREATED_BY.getTitle(), true); mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.CREATED_BY, colPublisher); @@ -264,8 +305,9 @@ public class ItemsTable extends AbstractItemsCellTable } }; - colPublicationPhase.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL); + colPublicationPhase.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_Y); sortedCellTable.addColumn(colPublicationPhase, DEFAULT_DISPLAYING_COLUMN_NAME.PHASE.getTitle(), true); + sortedCellTable.setColumnWidth(colPublicationPhase, 120, Unit.PX); mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.PHASE, colPublicationPhase); // COL OPERTION STATUS @@ -316,47 +358,11 @@ public class ItemsTable extends AbstractItemsCellTable }; - colOperationStatus.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL); + colOperationStatus.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_Y); sortedCellTable.addColumn(colOperationStatus, DEFAULT_DISPLAYING_COLUMN_NAME.STATUS.getTitle(), true); + sortedCellTable.setColumnWidth(colOperationStatus, 120, Unit.PX); mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.STATUS, colOperationStatus); - // COL OPERTION STATUS - TextColumn colRelationship = new TextColumn() { - @Override - public String getValue(T object) { - - if (object == null) - return ""; - - ResultDocumentDV documentDV = (ResultDocumentDV) object; - String htmlValue = toDisplayClusterOfRelationships(documentDV.getListRelationshipDV()); - return htmlValue; - } - - @Override - public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) { - if (object == null) - return; - - ResultDocumentDV documentDV = (ResultDocumentDV) object; - List relations = documentDV.getListRelationshipDV(); - String color = "#333"; - if (relations == null || relations.isEmpty()) { - color = "#555"; - } - - sb.appendHtmlConstant(""); - super.render(context, object, sb); - sb.appendHtmlConstant(""); - - }; - - }; - - colRelationship.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL); - sortedCellTable.addColumn(colRelationship, DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS.getTitle(), true); - mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS, colRelationship); - } public void removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME columnName) { diff --git a/src/main/webapp/GeoPortalDataEntryApp.css b/src/main/webapp/GeoPortalDataEntryApp.css index b765177..01b8cee 100644 --- a/src/main/webapp/GeoPortalDataEntryApp.css +++ b/src/main/webapp/GeoPortalDataEntryApp.css @@ -69,10 +69,19 @@ h1 { overflow: hidden !important; } -.back-system-cell { +.back-system-cell-b { background-color: #d9edf7 !important; } +.back-system-cell-o { + background-color: #FFE1BE !important; +} + +.back-system-cell-y { + background-color: #FFEDBE !important; +} + + .table-glor-vertical-middle td, th { height: 50%; vertical-align: middle !important;