Improved CSS

This commit is contained in:
Francesco Mangiacrapa 2022-09-23 16:29:02 +02:00
parent 30881a9d30
commit 7f89872618
2 changed files with 58 additions and 43 deletions

View File

@ -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<T extends DocumentDV> extends AbstractItemsCellTable<T> {
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<T extends DocumentDV> extends AbstractItemsCellTable<T>
sortedCellTable.addColumn(col, displayName, true);
i++;
}
// COL RELATIONS
TextColumn<T> colRelationship = new TextColumn<T>() {
@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<RelationshipDV> relations = documentDV.getListRelationshipDV();
String color = "#333";
if (relations == null || relations.isEmpty()) {
color = "#555";
}
sb.appendHtmlConstant("<span style='color:" + color + "; font-style: italic;'>");
super.render(context, object, sb);
sb.appendHtmlConstant("</span>");
};
};
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<T> colCreated = new TextColumn<T>() {
@ -213,8 +253,9 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
};
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<T extends DocumentDV> extends AbstractItemsCellTable<T>
};
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<T extends DocumentDV> extends AbstractItemsCellTable<T>
}
};
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<T extends DocumentDV> extends AbstractItemsCellTable<T>
};
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<T> colRelationship = new TextColumn<T>() {
@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<RelationshipDV> relations = documentDV.getListRelationshipDV();
String color = "#333";
if (relations == null || relations.isEmpty()) {
color = "#555";
}
sb.appendHtmlConstant("<span style='color:" + color + "; font-style: italic;'>");
super.render(context, object, sb);
sb.appendHtmlConstant("</span>");
};
};
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) {

View File

@ -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;