Skip to content

Commit

Permalink
Merged HighlightGrid into Grid.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Feb 23, 2017
1 parent 36c722f commit 9694d4b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 50 deletions.
1 change: 0 additions & 1 deletion rapidoid-commons/src/main/resources/rapidoid-classes.txt
Expand Up @@ -270,7 +270,6 @@ org.rapidoid.gui.GUI
org.rapidoid.gui.GUIActions org.rapidoid.gui.GUIActions
org.rapidoid.gui.GuiJpaUtil org.rapidoid.gui.GuiJpaUtil
org.rapidoid.gui.Highlight org.rapidoid.gui.Highlight
org.rapidoid.gui.HighlightGrid
org.rapidoid.gui.HtmlPage org.rapidoid.gui.HtmlPage
org.rapidoid.gui.HtmlPageUtils org.rapidoid.gui.HtmlPageUtils
org.rapidoid.gui.I18N org.rapidoid.gui.I18N
Expand Down
14 changes: 14 additions & 0 deletions rapidoid-gui/src/main/java/org/rapidoid/gui/Grid.java
Expand Up @@ -51,6 +51,7 @@ public class Grid extends AbstractWidget<Grid> {
private volatile String[] columns = {}; private volatile String[] columns = {};
private volatile Object[] headers = {}; private volatile Object[] headers = {};
private volatile String rowCmd; private volatile String rowCmd;
private volatile String highlightRegex;


private volatile Mapper<Object, String> toUri; private volatile Mapper<Object, String> toUri;


Expand Down Expand Up @@ -214,6 +215,11 @@ protected String onClickScript(Item item) {
} }


protected TdTag cell(Object value) { protected TdTag cell(Object value) {
if (U.notEmpty(highlightRegex)) {
String s = String.valueOf(value);
value = GUI.highlight(s, highlightRegex);
}

return td(value); return td(value);
} }


Expand Down Expand Up @@ -290,4 +296,12 @@ public Grid headers(Iterable<?> headers) {
return headers(U.array(headers)); return headers(U.array(headers));
} }


public String highlightRegex() {
return highlightRegex;
}

public Grid highlightRegex(String highlightRegex) {
this.highlightRegex = highlightRegex;
return this;
}
} }
49 changes: 0 additions & 49 deletions rapidoid-gui/src/main/java/org/rapidoid/gui/HighlightGrid.java

This file was deleted.

0 comments on commit 9694d4b

Please sign in to comment.