From 4bf160f04f24675ae1ab21a4ce9975079b28d4ab Mon Sep 17 00:00:00 2001 From: tomas-muller Date: Thu, 5 Dec 2024 17:30:27 +0100 Subject: [PATCH] Instructors: Note - a few adjustments to the Instructors table to avoid extremely wide tables - instructor notes can be wrapped and has a max-width (Note column) - positions (Position column) and teaching preferences (Teaching Preference column) can be wrapped --- .../org/unitime/commons/web/WebTable.java | 18 ++++++++++++++++-- .../webutil/InstructorListBuilder.java | 12 ++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/JavaSource/org/unitime/commons/web/WebTable.java b/JavaSource/org/unitime/commons/web/WebTable.java index 9afc61c933..f068786c3b 100644 --- a/JavaSource/org/unitime/commons/web/WebTable.java +++ b/JavaSource/org/unitime/commons/web/WebTable.java @@ -86,6 +86,7 @@ public class WebTable { protected boolean iBlankWhenSame = false; protected WebTableTweakStyle iWebTableTweakStyle = null; + protected WebTableCellStyle iWebTableCellStyle = null; /** creates a WebTable instance */ public WebTable(int columns, String name, String[] headers, String[] align, boolean[] asc) { @@ -114,11 +115,20 @@ public void setWebTableTweakStyle(WebTableTweakStyle style) { iWebTableTweakStyle = style; } + public void setCellStyle(WebTableCellStyle style) { + iWebTableCellStyle = style; + } + public String getStyle(WebTableLine line, WebTableLine next, int order) { String style = (iRowStyle==null?"":iRowStyle+";")+(iWebTableTweakStyle==null?"":iWebTableTweakStyle.getStyleHtml(line, next, order)); return (style==null || style.length()==0? "" : "style=\""+style+"\""); } + public String getCellStyle(WebTableLine line, int column, String defaultStyle) { + String style = (iWebTableCellStyle == null ? null : iWebTableCellStyle.getCellStyleHtml(line, column)); + return (style == null ? defaultStyle : "style=\""+style+"\""); + } + /** sets row (cell) style */ public void setRowStyle(String style) { iRowStyle = (iRowStyle == null ? "" : iRowStyle + ";") + style; @@ -369,7 +379,7 @@ public String printTable(int ordCol) { blank=false; if (!blank && line[i] != null) { sb.append(""); } else { sb.append("