protected BigDecimal toBigDecimal(String numberString) { if (StringUtility.isNullOrEmpty(numberString)) { return null; } return new BigDecimal(numberString); }
protected boolean isFontIcon(String imageId) { if (StringUtility.isNullOrEmpty(imageId)) { return false; } return imageId.startsWith("font:"); }
protected String createColumnConfigKey(IColumn col, String configName, String propertyKey) { StringBuilder sb = new StringBuilder(); if (!StringUtility.isNullOrEmpty(configName)) { sb.append(configName).append("."); } sb.append(propertyKey).append(getColumnKey(col)); return sb.toString(); }
@SuppressWarnings("unchecked") protected VALUE getLookupRowKeyForId(String id) { if (StringUtility.isNullOrEmpty(id)) { return null; } return (VALUE) m_idToKeyMap.get(NumberUtility.parseInt(id)); }
@Override public String getUserId() { String userId = super.getUserId(); if (StringUtility.isNullOrEmpty(userId)) { userId = System.getProperty("user.name"); } return userId; }
@Override public boolean canHandleDeepLink(String deepLinkPath) { if (StringUtility.isNullOrEmpty(deepLinkPath)) { return false; } for (IDeepLinkHandler handler : m_handlers) { if (handler.matches(deepLinkPath)) { return true; } } return false; }
protected String createTableCustomizerConfigKey(ITableCustomizer customizer, String configName) { StringBuilder sb = new StringBuilder(); if (!StringUtility.isNullOrEmpty(configName)) { sb.append(configName).append("."); } sb.append(TABLE_CUSTOMIZER_DATA).append(customizer.getPreferencesKey()); return sb.toString(); }
/** * @param wildcard */ @Override public void setWildcard(String wildcard) { if (StringUtility.isNullOrEmpty(wildcard)) { throw new IllegalArgumentException("Wildcard must not be null nor empty!"); } m_wildcard = wildcard; if (m_lookupCall != null) { m_lookupCall.setWildcard(wildcard); } }
protected void replaceBaseTags() { // <scout:base /> String basePath = m_params.getBasePath(); if (StringUtility.isNullOrEmpty(basePath)) { basePath = "/"; } else if (basePath.lastIndexOf('/') != basePath.length() - 1) { // add / at end of string (unless it already has a slash at the end) basePath += "/"; } String baseTag = "<base href=\"" + basePath + "\">"; m_workingContent = PATTERN_BASE_TAG.matcher(m_workingContent).replaceAll(baseTag); }
public static boolean acceptFile(String file) { if (StringUtility.isNullOrEmpty(file)) { return false; } if (!REGEX_PATTERN.matcher(file).matches()) { return false; } // Check if file can really be resolved return new JsonModelsLoader(null).getJsonFileUrl(file) != null; }
protected void renameAllTableColumnPreferences(ITable table, String oldConfigName, String newConfigName) { if (table == null || StringUtility.isNullOrEmpty(oldConfigName) || StringUtility.isNullOrEmpty(newConfigName)) { throw new IllegalArgumentException(); } for (IColumn col : table.getColumns()) { if (col.isDisplayable()) { renameTableColumnPreferences(col, oldConfigName, newConfigName); } } flush(); }
@Override public void addTag(String tag) { if (StringUtility.isNullOrEmpty(tag)) { return; } Set<String> tags = getOrCreateValue(); if (tags.contains(tag)) { return; } Set<String> newTags = newSet(tags); newTags.add(tag); setValue(newTags); }
@Override public void removeTag(String tag) { if (StringUtility.isNullOrEmpty(tag)) { return; } Set<String> tags = getOrCreateValue(); if (!tags.contains(tag)) { return; } Set<String> newTags = newSet(tags); newTags.remove(tag); setValue(newTags); }
protected void appendHtmlForSpacerLine(StringBuilder buf, String cssClass, int height, String anchor) { buf.append(HTML .tr( td( StringUtility.isNullOrEmpty(anchor) ? null : buf.append("<a name=\"").append(anchor).append("\"/>"), imgByBinaryResource("empty.png").addAttribute("width", "1").addAttribute("height", String.valueOf(height))).addAttribute("colspan", "5")) .cssClass(cssClass)); }
public void removeAllTableColumnPreferences(ITable table, String configName) { if (table == null || StringUtility.isNullOrEmpty(configName)) { throw new IllegalArgumentException(); } for (IColumn col : table.getColumns()) { if (col.isDisplayable()) { removeAllTableColumnPreferences(col, configName, false); } } flush(); }
@Override public void consumeBinaryResource(List<BinaryResource> binaryResources, Map<String, String> uploadProperties) { if ((getModel().getDropType() & IDNDSupport.TYPE_FILE_TRANSFER) == IDNDSupport.TYPE_FILE_TRANSFER) { ResourceListTransferObject transferObject = new ResourceListTransferObject(binaryResources); ITableRow row = null; if (uploadProperties != null && uploadProperties.containsKey("rowId")) { String rowId = uploadProperties.get("rowId"); if (!StringUtility.isNullOrEmpty(rowId)) { row = getTableRow(rowId); } } getModel().getUIFacade().fireRowDropActionFromUI(row, transferObject); } }
@Override public void consumeBinaryResource(List<BinaryResource> binaryResources, Map<String, String> uploadProperties) { if ((getModel().getDropType() & IDNDSupport.TYPE_FILE_TRANSFER) == IDNDSupport.TYPE_FILE_TRANSFER) { ResourceListTransferObject transferObject = new ResourceListTransferObject(binaryResources); ITreeNode node = null; if (uploadProperties != null && uploadProperties.containsKey("nodeId")) { String nodeId = uploadProperties.get("nodeId"); if (!StringUtility.isNullOrEmpty(nodeId)) { node = getTreeNodeForNodeId(nodeId); } } getModel().getUIFacade().fireNodeDropActionFromUI(node, transferObject); } }
protected boolean isObfuscateDisplayTextRequired() { return !getModel().isMultilineText() // Multiline text doesn't support input masked. && getModel().isInputMasked() && !StringUtility.isNullOrEmpty(getModel().getDisplayText()); // Only obfuscate text when there is a display text. } }
public void setTooltipText(String s) { if (m_cellSpecialization instanceof CellStyle) { if (!StringUtility.isNullOrEmpty(s)) { ICellSpecialization newStyle = new CellExtension(m_cellSpecialization); newStyle.setTooltipText(s); setValueInternal(TOOLTIP_BIT, newStyle); } } else if (ObjectUtility.notEquals(m_cellSpecialization.getIconId(), s)) { ICellSpecialization newStyle = m_cellSpecialization.copy(); newStyle.setTooltipText(s); setValueInternal(TOOLTIP_BIT, newStyle); } }
public void renameTableColumnPreferences(IColumn col, String oldConfigName, String newConfigName) { if (col == null || StringUtility.isNullOrEmpty(oldConfigName) || StringUtility.isNullOrEmpty(newConfigName)) { throw new IllegalArgumentException(); } renameEntry(createColumnConfigKey(col, oldConfigName, TABLE_COLUMN_UIINDEX), createColumnConfigKey(col, newConfigName, TABLE_COLUMN_UIINDEX)); renameEntry(createColumnConfigKey(col, oldConfigName, TABLE_COLUMN_VISIBLE), createColumnConfigKey(col, newConfigName, TABLE_COLUMN_VISIBLE)); renameEntry(getUserAgentPrefix() + createColumnConfigKey(col, oldConfigName, TABLE_COLUMN_WIDTH), getUserAgentPrefix() + createColumnConfigKey(col, newConfigName, TABLE_COLUMN_WIDTH)); renameEntry(createColumnConfigKey(col, oldConfigName, TABLE_COLUMN_SORT_INDEX), createColumnConfigKey(col, newConfigName, TABLE_COLUMN_SORT_INDEX)); renameEntry(createColumnConfigKey(col, oldConfigName, TABLE_COLUMN_SORT_ASC), createColumnConfigKey(col, newConfigName, TABLE_COLUMN_SORT_ASC)); renameEntry(createColumnConfigKey(col, oldConfigName, TABLE_COLUMN_GROUPED), createColumnConfigKey(col, newConfigName, TABLE_COLUMN_GROUPED)); renameEntry(createColumnConfigKey(col, oldConfigName, TABLE_COLUMN_AGGR_FUNCTION), createColumnConfigKey(col, newConfigName, TABLE_COLUMN_AGGR_FUNCTION)); renameEntry(createColumnConfigKey(col, oldConfigName, TABLE_COLUMN_SORT_EXPLICIT), createColumnConfigKey(col, newConfigName, TABLE_COLUMN_SORT_EXPLICIT)); renameEntry(createColumnConfigKey(col, oldConfigName, TABLE_COLUMN_BACKGROUND_EFFECT), createColumnConfigKey(col, newConfigName, TABLE_COLUMN_BACKGROUND_EFFECT)); }