Search in sources :

Example 11 with CoreLocale

use of io.github.ihongs.CoreLocale in project HongsCORE by ihongs.

the class NaviMap method getMenuTranslated.

public List<Map> getMenuTranslated(String name, int d, Set<String> rolez) {
    CoreLocale lang = getCurrTranslator();
    Map menu = getMenu(name);
    if (menu == null) {
        throw new NullPointerException("Menu for href '" + name + "' is not in " + this.name);
    }
    return getMenuTranslated((Map) menu.get("menus"), rolez, lang, d, 0);
}
Also used : CoreLocale(io.github.ihongs.CoreLocale) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 12 with CoreLocale

use of io.github.ihongs.CoreLocale in project HongsCORE by ihongs.

the class NaviMap method getRoleTranslated.

public List<Map> getRoleTranslated(String name, int d, Set<String> rolez) {
    CoreLocale lang = getCurrTranslator();
    Map menu = getMenu(name);
    if (menu == null) {
        throw new NullPointerException("Menu for href '" + name + "' is not in " + this.name);
    }
    return getRoleTranslated((Map) menu.get("menus"), rolez, lang, d, 0);
}
Also used : CoreLocale(io.github.ihongs.CoreLocale) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 13 with CoreLocale

use of io.github.ihongs.CoreLocale in project HongsCORE by ihongs.

the class AuthKit method getWrong.

/**
 * 快速输出登录的错误
 * @param k 字段
 * @param w 错误
 * @return
 */
public static Map getWrong(String k, String w) {
    CoreLocale l = CoreLocale.getInstance("master");
    Map e = new HashMap();
    if (k != null && !"".equals(k)) {
        Map m = new HashMap();
        m.put(k, new Wrong(w));
        e.put("errs", new Wrongs(m).setLocalizedContext(l).getErrors());
        e.put("msg", l.translate(w));
    } else {
        e.put("msg", l.translate(w));
    }
    e.put("ok", false);
    return e;
}
Also used : CoreLocale(io.github.ihongs.CoreLocale) Wrong(io.github.ihongs.util.verify.Wrong) HashMap(java.util.HashMap) Wrongs(io.github.ihongs.util.verify.Wrongs) HashMap(java.util.HashMap) Map(java.util.Map)

Example 14 with CoreLocale

use of io.github.ihongs.CoreLocale in project HongsCORE by ihongs.

the class DeptAction method doDelete.

@Action("delete")
@CommitSuccess
public void doDelete(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    int rn = model.delete(rd);
    CoreLocale ln = CoreLocale.getInstance().clone();
    ln.load("master");
    String ms = ln.translate("core.delete.dept.success", null, Integer.toString(rn));
    helper.reply(ms, rn);
}
Also used : CoreLocale(io.github.ihongs.CoreLocale) HashMap(java.util.HashMap) NaviMap(io.github.ihongs.action.NaviMap) Map(java.util.Map) Action(io.github.ihongs.action.anno.Action) CommitSuccess(io.github.ihongs.action.anno.CommitSuccess)

Example 15 with CoreLocale

use of io.github.ihongs.CoreLocale in project HongsCORE by ihongs.

the class FormAction method doDelete.

@Action("delete")
@CommitSuccess
public void doDelete(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    int rn = model.delete(rd);
    CoreLocale ln = CoreLocale.getInstance().clone();
    ln.load("matrix");
    String ms = ln.translate("core.delete.form.success", null, Integer.toString(rn));
    helper.reply(ms, rn);
}
Also used : CoreLocale(io.github.ihongs.CoreLocale) Map(java.util.Map) Action(io.github.ihongs.action.anno.Action) CommitSuccess(io.github.ihongs.action.anno.CommitSuccess)

Aggregations

CoreLocale (io.github.ihongs.CoreLocale)21 Map (java.util.Map)15 Action (io.github.ihongs.action.anno.Action)12 HashMap (java.util.HashMap)11 CommitSuccess (io.github.ihongs.action.anno.CommitSuccess)7 NaviMap (io.github.ihongs.action.NaviMap)5 IAction (io.github.ihongs.dh.IAction)4 File (java.io.File)4 LinkedHashMap (java.util.LinkedHashMap)4 HongsException (io.github.ihongs.HongsException)2 ActionRunner (io.github.ihongs.action.ActionRunner)2 Verify (io.github.ihongs.action.anno.Verify)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 Wrong (io.github.ihongs.util.verify.Wrong)1 Wrongs (io.github.ihongs.util.verify.Wrongs)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 Comparator (java.util.Comparator)1