1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Cfg: Convert 'lang - variants'

This commit is contained in:
gnosygnu
2016-12-26 12:48:31 -05:00
parent dad76714d5
commit ac9e79bfa0
9 changed files with 15 additions and 153 deletions

View File

@@ -46,7 +46,6 @@ public class Xoapi_root implements Gfo_invk {
public Xoapi_bldr Bldr() {return bldr_api;} private final Xoapi_bldr bldr_api = new Xoapi_bldr();
public Xoapi_usr Usr() {return usr_api;} private final Xoapi_usr usr_api = new Xoapi_usr();
public Xoapi_xtns Xtns() {return xtns_api;} private final Xoapi_xtns xtns_api = new Xoapi_xtns();
public Xoapi_app_wikis Wikis() {return app_wikis;} private final Xoapi_app_wikis app_wikis = new Xoapi_app_wikis();
public String Test_str() {return test_str;} public void Test_str_(String v) {test_str = v;} private String test_str; // TEST
private void Exec(String key) {
Xog_cmd_itm cmd_itm = app.Gui_mgr().Cmd_mgr().Get_or_null(key);
@@ -63,16 +62,11 @@ public class Xoapi_root implements Gfo_invk {
else if (ctx.Match(k, Invk_usr)) return usr_api;
else if (ctx.Match(k, Invk_xtns)) return xtns_api;
else if (ctx.Match(k, Invk_exec)) Exec(m.ReadStr("v"));
else if (ctx.Match(k, Invk_wikis)) return app_wikis;
else if (ctx.Match(k, Invk_test_str)) return test_str;
else if (ctx.Match(k, Invk_test_str_)) test_str = m.ReadStr("v");
return this;
}
private static final String
Invk_exec = "exec"
private static final String Invk_exec = "exec", Invk_test_str = "test_str", Invk_test_str_ = "test_str_"
, Invk_app = "app", Invk_addon = "addon"
, Invk_bldr = "bldr", Invk_nav = "nav", Invk_gui = "gui", Invk_html = "html", Invk_usr = "usr", Invk_xtns = "xtns"
, Invk_test_str = "test_str", Invk_test_str_ = "test_str_"
, Invk_wikis = "wikis"
;
, Invk_bldr = "bldr", Invk_nav = "nav", Invk_gui = "gui", Invk_html = "html", Invk_usr = "usr", Invk_xtns = "xtns";
}

View File

@@ -1,29 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
import gplx.xowa.apps.apis.xowa.wikis.*;
public class Xoapi_app_wiki implements Gfo_invk {
public Xoapi_wiki_lang Lang() {return lang;} private final Xoapi_wiki_lang lang = new Xoapi_wiki_lang();
public void Subscribe(Gfo_evt_itm sub) {lang.Subscribe(sub);}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_lang)) return lang;
else return Gfo_invk_.Rv_unhandled;
}
private static final String Invk_lang = "lang";
public static final Xoapi_app_wiki Dflt = new Xoapi_app_wiki();
}

View File

@@ -1,34 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*;
public class Xoapi_app_wikis implements Gfo_invk {
private final Ordered_hash hash = Ordered_hash_.New_bry();
public Xoapi_app_wiki Get(byte[] domain) {
Xoapi_app_wiki rv = (Xoapi_app_wiki)hash.Get_by(domain);
if (rv == null) {
rv = new Xoapi_app_wiki();
hash.Add(domain, rv);
}
return rv;
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_get)) return Get(m.ReadBry("v"));
else return Gfo_invk_.Rv_unhandled;
}
private static final String Invk_get = "get";
}

View File

@@ -1,28 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.wikis; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*;
import gplx.xowa.apps.apis.xowa.wikis.langs.*;
public class Xoapi_wiki_lang implements Gfo_invk {
public Xoap_lang_variants Variants() {return variants;} private final Xoap_lang_variants variants = new Xoap_lang_variants();
public void Subscribe(Gfo_evt_itm sub) {variants.Subscribe(sub);}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_variants)) return variants;
else return Gfo_invk_.Rv_unhandled;
}
private static final String Invk_variants = "variants";
}

View File

@@ -1,43 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.apps.apis.xowa.wikis.langs; import gplx.*; import gplx.xowa.*; import gplx.xowa.apps.*; import gplx.xowa.apps.apis.*; import gplx.xowa.apps.apis.xowa.*; import gplx.xowa.apps.apis.xowa.wikis.*;
public class Xoap_lang_variants implements Gfo_invk, Gfo_evt_mgr_owner {
public Xoap_lang_variants() {
this.ev_mgr = new Gfo_evt_mgr(this);
}
public Gfo_evt_mgr Evt_mgr() {return ev_mgr;} private final Gfo_evt_mgr ev_mgr;
public byte[] Current() {return current;} private byte[] current;
public void Current_(byte[] v) {
this.current = v;
Gfo_evt_mgr_.Pub_val(this, Evt_current_changed, v);
}
public void Subscribe(Gfo_evt_itm sub) {
Gfo_evt_mgr_.Sub_same(this, Evt_current_changed, sub);
if (current != null) Gfo_invk_.Invk_by_val(sub, Evt_current_changed, current);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_current)) return String_.new_u8(current);
else if (ctx.Match(k, Invk_current_)) Current_(m.ReadBry("v"));
else return Gfo_invk_.Rv_unhandled;
return this;
}
private static final String Invk_current = "current", Invk_current_ = "current_";
public static final String
Evt_current_changed = "current_changed"
;
}