public static String format(String expression, Object root) { return create(expression).format(root); }
public static String format(String expression, Object root) { return create(expression).format(root); }
public TextFormat createPkGenerator() { StringBuilder sb = new StringBuilder(); boolean first = true; for (PropertyAccessor property : classAccessor.getKeyProperties()) { if (first) { first = false; } else { sb.append("/"); } sb.append("%{"); sb.append(property.getName()); sb.append("}"); } return OgnlTextFormat.create(sb.toString()); }
public TextFormat createPkGenerator() { StringBuilder sb = new StringBuilder(); boolean first = true; for (PropertyAccessor property : classAccessor.getKeyProperties()) { if (first) { first = false; } else { sb.append("/"); } sb.append("%{"); sb.append(property.getName()); sb.append("}"); } return OgnlTextFormat.create(sb.toString()); }
public ChartPieUrlGenerator(String expression) { format = OgnlTextFormat.create(expression); format.setUrl(true); value = new PieURLGeneratorValue(); }
public ChartBarUrlGenerator(String expression) { format = OgnlTextFormat.create(expression); format.setUrl(true); value = new BarURLGeneratorValue(); }
public String getCreateTitle() { String title = crudConfiguration.getCreateTitle(); if(StringUtils.isBlank(title)) { title = getPage().getTitle(); } OgnlTextFormat textFormat = OgnlTextFormat.create(StringUtils.defaultString(title)); return textFormat.format(this); }
public String getSearchTitle() { String title = crudConfiguration.getSearchTitle(); if(StringUtils.isBlank(title)) { title = getPage().getTitle(); } OgnlTextFormat textFormat = OgnlTextFormat.create(StringUtils.defaultString(title)); return textFormat.format(this); }
public String getEditTitle() { String title = crudConfiguration.getEditTitle(); if(StringUtils.isEmpty(title)) { return ShortNameUtils.getName(getClassAccessor(), object); } else { OgnlTextFormat textFormat = OgnlTextFormat.create(StringUtils.defaultString(title)); return textFormat.format(this); } }
public String getReadTitle() { String title = crudConfiguration.getReadTitle(); if(StringUtils.isEmpty(title)) { return ShortNameUtils.getName(getClassAccessor(), object); } else { OgnlTextFormat textFormat = OgnlTextFormat.create(title); return textFormat.format(this); } }
public static String getName(ClassAccessor classAccessor, Object object) { ShortName annotation = classAccessor.getAnnotation(ShortName.class); String formatString; if (annotation == null) { StringBuilder sb = new StringBuilder(); boolean first = true; // sintetizziamo una stringa a partire dalla chiave primaria for (PropertyAccessor propertyAccessor : classAccessor.getKeyProperties()) { if (first) { first = false; } else { sb.append(PK_ELEMENT_SEPARATOR); } sb.append(String.format("%%{%s}", propertyAccessor.getName())); } formatString = sb.toString(); } else { formatString = annotation.value(); } OgnlTextFormat ognlTextFormat = OgnlTextFormat.create(formatString); return ognlTextFormat.format(object); } }
public static String getName(ClassAccessor classAccessor, Object object) { ShortName annotation = classAccessor.getAnnotation(ShortName.class); String formatString; if (annotation == null) { StringBuilder sb = new StringBuilder(); boolean first = true; // sintetizziamo una stringa a partire dalla chiave primaria for (PropertyAccessor propertyAccessor : classAccessor.getKeyProperties()) { if (first) { first = false; } else { sb.append(PK_ELEMENT_SEPARATOR); } sb.append(String.format("%%{%s}", propertyAccessor.getName())); } formatString = sb.toString(); } else { formatString = annotation.value(); } OgnlTextFormat ognlTextFormat = OgnlTextFormat.create(formatString); return ognlTextFormat.format(object); } }
/** * Computes an OgnlTextFormat from the result of getReadLinkExpression(), with the correct URL encoding. * @return the OgnlTextFormat. */ protected OgnlTextFormat getReadURLFormat() { String readLinkExpression = getReadLinkExpression(); OgnlTextFormat hrefFormat = OgnlTextFormat.create(readLinkExpression); hrefFormat.setUrl(true); String encoding = getUrlEncoding(); hrefFormat.setEncoding(encoding); return hrefFormat; }
/** * Computes an OgnlTextFormat from the result of getReadLinkExpression(), with the correct URL encoding. * @return the OgnlTextFormat. */ protected OgnlTextFormat getReadURLFormat() { String readLinkExpression = getReadLinkExpression(); OgnlTextFormat hrefFormat = OgnlTextFormat.create(readLinkExpression); hrefFormat.setUrl(true); String encoding = getUrlEncoding(); hrefFormat.setEncoding(encoding); return hrefFormat; }
OgnlTextFormat hrefFormat = OgnlTextFormat.create(xb.toString()); String encoding = getUrlEncoding(); hrefFormat.setEncoding(encoding);
OgnlTextFormat hrefFormat = OgnlTextFormat.create(xb.toString()); String encoding = getUrlEncoding(); hrefFormat.setEncoding(encoding);
OgnlTextFormat.create(shortNameAnnotation.value()) };
public DefaultSelectionProvider createSelectionProviderFromHql (String name, String databaseName, String hql, DisplayMode dm, SearchDisplayMode sdm) { Database database = DatabaseLogic.findDatabaseByName(persistence.getModel(), databaseName); Table table = QueryUtils.getTableFromQueryString(database, hql); String entityName = table.getActualEntityName(); Session session = persistence.getSession(databaseName); Collection<Object> objects = QueryUtils.getObjects(session, hql, null, null); TableAccessor tableAccessor = persistence.getTableAccessor(databaseName, entityName); ShortName shortNameAnnotation = tableAccessor.getAnnotation(ShortName.class); TextFormat[] textFormats = null; //L'ordinamento e' usato solo in caso di chiave singola if (shortNameAnnotation != null && tableAccessor.getKeyProperties().length == 1) { textFormats = new TextFormat[] { OgnlTextFormat.create(shortNameAnnotation.value()) }; } DefaultSelectionProvider selectionProvider = SelectionProviderLogic.createSelectionProvider (name, objects, tableAccessor.getKeyProperties(), textFormats); selectionProvider.setDisplayMode(dm); selectionProvider.setSearchDisplayMode(sdm); return selectionProvider; }
public DefaultSelectionProvider createSelectionProviderFromHql (String name, String databaseName, String hql, DisplayMode dm, SearchDisplayMode sdm) { Database database = DatabaseLogic.findDatabaseByName(persistence.getModel(), databaseName); Table table = QueryUtils.getTableFromQueryString(database, hql); String entityName = table.getActualEntityName(); Session session = persistence.getSession(databaseName); Collection<Object> objects = QueryUtils.getObjects(session, hql, null, null); TableAccessor tableAccessor = persistence.getTableAccessor(databaseName, entityName); ShortName shortNameAnnotation = tableAccessor.getAnnotation(ShortName.class); TextFormat[] textFormats = null; //L'ordinamento e' usato solo in caso di chiave singola if (shortNameAnnotation != null && tableAccessor.getKeyProperties().length == 1) { textFormats = new TextFormat[] { OgnlTextFormat.create(shortNameAnnotation.value()) }; } DefaultSelectionProvider selectionProvider = SelectionProviderLogic.createSelectionProvider (name, objects, tableAccessor.getKeyProperties(), textFormats); selectionProvider.setDisplayMode(dm); selectionProvider.setSearchDisplayMode(sdm); return selectionProvider; }