/** * @return - similar to nvl(), but returns replaceWithIfEmpty in case of null and empty, * otherwise just value. */ public static String nonEmpty(String value, String replaceWithIfEmpty) { return Empty.is(value) ? replaceWithIfEmpty : value; }
/** * @return - similar to nvl(), but returns replaceWithIfEmpty in case of null and empty, * otherwise just value. */ public static String nonEmpty(String value, String replaceWithIfEmpty) { return Empty.is(value) ? replaceWithIfEmpty : value; }
public int findColumnIndex(ColumnDefEx col) { if (col == null) return -1; if (!Empty.is(datacols)) return datacols.indexOf(col); else return -1; }
@Override public String getMenuStyleNames() { String s = super.getMenuStyleNames(); // for CSS styling String rslt = "ui-select-filterable"; if (!Empty.is(s)) rslt += " " + s; return rslt; }
public int getColumnCount() { if (!Empty.is(datacols)) { int i = 0; for (ColumnDefEx col : datacols) { if (!col.isGroup()) i++; } return i; } return 0; }
@Override public String getMenuStyleNames() { String s = super.getMenuStyleNames(); // for CSS styling String rslt = "ui-select-filterable"; if (!Empty.is(s)) rslt += " " + s; return rslt; }
/** * The destination URL of the link * * @param href */ public void setHref(String href) { JQMCommon.setAttribute(a, "href", href); if (external == null /*only if not explicitly set*/ && !Empty.is(href) && (href.startsWith("http:") || href.startsWith("https:"))) { setExternal(true); } }
public static PagingType fromJsName(String jsName) { if (Empty.is(jsName)) return null; for (PagingType v : values()) { if (jsName.equalsIgnoreCase(v.getJsName())) return v; } return null; } }
public static ColSortDir fromJsName(String jsName) { if (Empty.is(jsName)) return null; for (ColSortDir v : values()) { if (jsName.equalsIgnoreCase(v.getJsName())) return v; } return null; } }
/** * @param eltSelector - some selector to specific widgets, for example: a.ui-btn.special-btn * @param handler - in custom case callback of handler.onClick() may occur * with undefined rowIndex and colIndex, i.e. -1 values. */ public void addCellCustomClickHandler(CellClickHandler handler, String eltSelector) { if (handler == null || Empty.is(eltSelector)) return; JsDataTable.addCellClickHandler(getElement(), eltSelector, handler, false); }
public void setContentTheme(String themeName) { setAttribute("data-content-theme", themeName); if (collapsibleContent != null) { String s = Empty.is(themeName) ? JQMCommon.THEME_INHERIT : themeName; JQMCommon.setThemeEx(collapsibleContent, s, JQMCommon.STYLE_UI_BODY); } }
public void setContentTheme(String themeName) { setAttribute("data-content-theme", themeName); if (collapsibleContent != null) { String s = Empty.is(themeName) ? JQMCommon.THEME_INHERIT : themeName; JQMCommon.setThemeEx(collapsibleContent, s, JQMCommon.STYLE_UI_BODY); } }
private String getRowId(JavaScriptObject rowData) { String rowId = JsUtils.getObjValue(rowData, DT_ROWID); if (Empty.is(rowId) && rowIdHelper != null) { rowId = rowIdHelper.calcRowId(this, rowData); } return rowId; }
public List<Widget> getAllVisibleCells() { List<Widget> rslt = null; for (int i = 0; i < flow.getWidgetCount(); i++) { Widget w = flow.getWidget(i); String disp = w.getElement().getStyle().getDisplay(); if (!Empty.is(disp) && Display.NONE.getCssName().equals(disp)) continue; if (rslt == null) rslt = new ArrayList<>(); rslt.add(w); } return rslt; }
public List<Widget> getAllVisibleCells() { List<Widget> rslt = null; for (int i = 0; i < flow.getWidgetCount(); i++) { Widget w = flow.getWidget(i); String disp = w.getElement().getStyle().getDisplay(); if (!Empty.is(disp) && Display.NONE.getCssName().equals(disp)) continue; if (rslt == null) rslt = new ArrayList<>(); rslt.add(w); } return rslt; }
@Override public void afterDraw(Element tableElt, JavaScriptObject settings) { if (!Empty.is(serverRowDetails)) { JsArrayString rowIds = JavaScriptObject.createArray(serverRowDetails.size()).cast(); int i = 0; for (String s : serverRowDetails) { rowIds.set(i, s); i++; } JsDataTable.openRowDetails(tableElt, rowIds); } }
public void adjustAllSizes() { boolean isScrollX = isScrollX() || !Empty.is(scrollXcss); boolean isParentHeight = isUseParentHeight(); if (isParentHeight) adjustToParentHeight(); if (isParentHeight || isScrollX) adjustColumnSizing(); }
@UiChild(tagname = "colGroup") public void addColGroupWidget(Widget w, String priority, String text, String colName, Integer colspan, Integer rowspan) { clearColGroups(); ColumnDef colDef = new ColumnDef(text, priority); if (!Empty.is(colName)) colDef.setName(colName); if (colspan != null && colspan > 0) colDef.setColspan(colspan); if (rowspan != null && rowspan > 0) colDef.setRowspan(rowspan); colGroupWidgets.put(w, colDef); addToHeadGroups(w, colDef, colGroupWidgets.size() - 1); }
private JsSortItems prepareJsOrder() { if (Empty.is(sorts)) return null; JsSortItems rslt = null; for (ColSort sort : sorts) { JsSortItem jsSort = JsSortItem.create(sort.num, sort.sortDir.getJsName()); if (rslt == null) rslt = JsSortItems.create(jsSort); else rslt.push(jsSort); } return rslt; }
@UiChild(tagname = "colTitle") public void addColTitleWidget(Widget w, String priority, String text, String colName) { clearColNames(); ColumnDef colDef = new ColumnDef(text, priority); if (!Empty.is(colName)) colDef.setName(colName); colTitleWidgets.put(w, colDef); addToHead(w, colDef.getTitle(), colDef.getPriority(), colTitleWidgets.size() - 1); }