public static final String getHelp() { return ENV.translate("help", false); }
public IAction<Collection<?>> runner() { if (runner == null) { String id = "scripttool.go"; String lbl = ENV.translate(id, true); runner = new CommonAction(id, lbl, lbl) { @Override public Object action() throws Exception { FileUtil.save(SERIALIZED_SCRIPTOOL, ScriptTool.this); return selectedAction != null ? selectedAction.activate() : null; } }; } return runner; }
private static String createName(Method method) { final String name = method.getName().substring(ACTION_PREFIX.length()); return ENV.translate(name, true); }
@Commit protected void initDeserialization() { //try to translate after first loading translatedDescription = description; if (description != null && description.equals(label)) { String d = ENV.translate(label + Messages.POSTFIX_TOOLTIP, false); if (d != null && !d.startsWith(Messages.TOKEN_MSG_NOTFOUND)) { translatedDescription = d; } } if (label != null) { translatedLabel= ENV.translate(label, true); } initialized = true; }
String toStringEntries() { StringBuilder str = new StringBuilder(); String ks; for (Object k : properties.keySet()) { ks = StringUtil.substring((String) k, ".", null, true); str.append(StringUtil.fixString(ENV.translate(ks, true), 32, ' ', true) + " : " + properties.get(k) + "\n"); } return str.toString(); }
protected void shutdown() { save(refreshConfig || !new File(name).getAbsoluteFile().exists()); String shutdownInfo = ENV.translate("message.shutdown", false, name); printScreen(shutdownInfo, in, out, null, width, height, style, true, isInBatchMode()); LOG.info("si-shell " + name + " ended"); }
/** * usable to create an error status with an illegal argument description * * @param name attribute name * @param value attribute value that involves the error * @param assertion an assertion that was not fulfilled by the value. * @return new error status instance */ public static Status illegalArgument(String name, Object value, Object assertion) { /* * the toString() conversion should not break the application flow. * if a PersistentSet is not initialized but already serialized, the toString() * would throw a LazyInitializationException */ String strValue; try { strValue = String.valueOf(value); } catch (Exception ex) { strValue = (value != null ? value.getClass() : "null") + ": " + ex.toString(); } return new Status(new IllegalArgumentException(ENV.translate("tsl2nano.assertion.failed", true, strValue, name, assertion))); }
@Override public String toString() { if (asString == null && name != null) { //empty search-beans are possible asString = (useExtraCollectorDefinition() ? ENV.translate("tsl2nano.list", false) + " " : "") + StringUtil.substring(name, null, POSTFIX_COLLECTOR) + (lastCount > -1 ? " (" + lastCount + ")" : ""); } return asString; }
@Override public String ask(Properties env) { isactive = true; List<AItem<T>> children = getNodes(env); return isSequential() && seqIndex > -1 && seqIndex < children.size() ? children.get(seqIndex).ask(env) : ENV.translate("ask.number", false) + children.size() + POSTFIX_QUESTION; }
return Arrays.asList(ENV.translate("tsl2nano.searchdialog.searchresultcount", false, 0));
/** * generates resource entries for each attribute+tooltip and each action to be edited later. */ private void saveResourceEntries(Properties p, String fileName) { p.put(getId(), getName()); Collection<IAttributeDefinition<?>> attributes = getAttributeDefinitions().values(); String id; for (IAttributeDefinition<?> a : attributes) { id = a.getId(); if (ENV.translate(id, false).startsWith(Messages.TOKEN_MSG_NOTFOUND)) { if (a.getPresentation().getLabel() != null) p.put(id, a.getPresentation().getLabel()); if (a.getPresentation().getDescription() != null) p.put(id + Messages.POSTFIX_TOOLTIP, a.getPresentation().getDescription()); } } Collection<IAction> actions = getActions(); for (IAction a : actions) { id = a.getId(); if (ENV.translate(id, false).startsWith(Messages.TOKEN_MSG_NOTFOUND)) { p.put(a.getId(), a.getShortDescription()); p.put(a.getId() + Messages.POSTFIX_TOOLTIP, a.getShortDescription()); } } FileUtil.saveProperties(ENV.getConfigPath() + fileName, p); }
Action annAction = method().getAnnotation(Action.class); if (!annAction.name().isEmpty()) shortDescription = ENV.translate(annAction.name(), true); Annotation[][] cana; if ((cana = method.getParameterAnnotations()) != null) {
@Override public String getSummaryText(Object contextParameter, int columnIndex) { IPresentableColumn col = getColumn(columnIndex); //column may be filtered (e.g. id-columns) if (col != null) { if (col.getSummary() != null) { Object value = col.getSummary().getValue(contextParameter); return value != null ? col.getSummary().getName() + ": " + value.toString() : ""; } else if (col.isStandardSummary() && NumberUtil.isNumber(getAttribute(col.getName()).getType())) { double result = 0; for (T item : collection) { Bean b = Bean.getBean((Serializable) item); Number v = (Number) b.getValue(col.getName()); if (v != null) { result += v.doubleValue(); } } return ENV.translate("tsl2nano.total", true) + ": " + getAttribute(col.getName()).getFormat().format(result); } else { return ""; } } return ""; }
throw new Finished("si-shell stopped"); } else { throw new IllegalArgumentException(input + ENV.translate("unknown.command", false));