mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Cfg: Refactor 'Gui - Url bar'; Add better support for buttons
This commit is contained in:
@@ -31,26 +31,23 @@ public class Xocfg_mgr {
|
||||
, app.User().User_db_mgr().Conn());
|
||||
dflt_mgr.Init_by_app(app);
|
||||
}
|
||||
public void Bind_many_app (Gfo_invk sub, String... keys) {Bind_many(sub, Xocfg_mgr.Ctx__app, keys);}
|
||||
public void Bind_many_wiki (Gfo_invk sub, Xow_wiki wiki, String... keys) {Bind_many(sub, wiki.Domain_itm().Abrv_xo_str(), keys);}
|
||||
public void Bind_many(Gfo_invk sub, String ctx, String... keys) {
|
||||
public void Sub_many_app (Gfo_invk sub, String... keys) {Bind_many(Bool_.N, sub, Xocfg_mgr.Ctx__app, keys);}
|
||||
public void Bind_many_app (Gfo_invk sub, String... keys) {Bind_many(Bool_.Y, sub, Xocfg_mgr.Ctx__app, keys);}
|
||||
public void Bind_many_wiki (Gfo_invk sub, Xow_wiki wiki, String... keys) {Bind_many(Bool_.Y, sub, wiki.Domain_itm().Abrv_xo_str(), keys);}
|
||||
private void Bind_many(boolean pub, Gfo_invk sub, String ctx, String... keys) {
|
||||
try {
|
||||
for (String key : keys) {
|
||||
String val = Bind_str(ctx, key, sub);
|
||||
cache_mgr.Pub(ctx, key, val);
|
||||
cache_mgr.Sub(sub, ctx, key, key);
|
||||
if (pub) {
|
||||
String val = cache_mgr.Get(ctx, key);
|
||||
cache_mgr.Pub(ctx, key, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
Gfo_usr_dlg_.Instance.Warn_many("", "", "bind failed: ctx=~{0} keys=~{1} err=~{2}", ctx, String_.AryXtoStr(keys), Err_.Message_gplx_log(e));
|
||||
}
|
||||
}
|
||||
public boolean Bind_bool_app(String key, Gfo_invk sub) {return Yn.parse_or(Bind_str(Xocfg_mgr.Ctx__app, key, sub), false);}
|
||||
public boolean Bind_bool(Xow_wiki wiki, String key, Gfo_invk sub) {return Yn.parse_or(Bind_str(wiki, key, sub), false);}
|
||||
public String Bind_str(Xow_wiki wiki, String key, Gfo_invk sub) {return Bind_str(wiki.Domain_itm().Abrv_xo_str(), key, sub);}
|
||||
public String Bind_str(String ctx, String key, Gfo_invk sub) {
|
||||
cache_mgr.Sub(sub, ctx, key, key);
|
||||
return cache_mgr.Get(ctx, key);
|
||||
}
|
||||
public boolean Get_bool_app_or(String key, boolean or) {
|
||||
String rv = Get_str(Ctx__app, key);
|
||||
return rv == null ? or : Yn.parse_or(rv, or);
|
||||
|
||||
@@ -51,7 +51,8 @@ public class Xoedit_itm implements Xoedit_nde, Mustache_doc_itm {
|
||||
this.val = val;
|
||||
this.date = date;
|
||||
this.edited = true;
|
||||
if (String_.Has(gui_args, "read"+"only=") || String_.Has(gui_args, "disabled="))
|
||||
if ( String_.Has(gui_args, "read"+"only=") || String_.Has(gui_args, "disabled=")
|
||||
|| String_.Eq(gui_type, gplx.xowa.addons.apps.cfgs.enums.Xoitm_gui_tid.Itm__btn.Key()))
|
||||
edited = false;
|
||||
}
|
||||
public void Set_data_by_dflt() {
|
||||
|
||||
@@ -69,7 +69,7 @@ public class Xoedit_itm_html {
|
||||
, gui_type_key, gui_args, key, lines[1]);
|
||||
break;
|
||||
case Xoitm_gui_tid.Tid__btn:
|
||||
bfr.Add_str_u8_fmt("<input id=\"{2}\" data-xocfg-key=\"{2}\" data-xocfg-gui=\"{0}\" class=\"xocfg__btn\" type=\"button\"{1}{3}></input>", gui_type_key, gui_args, key, key);
|
||||
bfr.Add_str_u8_fmt("<button id=\"{2}\" data-xocfg-key=\"{2}\" data-xocfg-gui=\"{0}\" class=\"xocfg__btn\" {1}>{3}</button>", gui_type_key, gui_args, key, name);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user