1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-05-24 22:43:55 -04:00
parent 6eec99a713
commit 51e6188c1e
1577 changed files with 11555 additions and 10080 deletions

View File

@@ -46,11 +46,11 @@ public class ColorAdp {
}
class ColorAdpCache {
public java.awt.Color GetNativeColor(ColorAdp color) {
Object rv = hash.Fetch(color.Value()); if (rv != null) return (java.awt.Color)rv;
Object rv = hash.Get_by(color.Value()); if (rv != null) return (java.awt.Color)rv;
rv = new java.awt.Color(color.Red(), color.Green(), color.Blue(), color.Alpha());
hash.Add(color.Value(), rv);
return (java.awt.Color)rv;
}
HashAdp hash = HashAdp_.new_();
Hash_adp hash = Hash_adp_.new_();
public static final ColorAdpCache _ = new ColorAdpCache(); ColorAdpCache() {}
}

View File

@@ -66,13 +66,13 @@ public class FontAdp implements GfoInvkAble {
class FontAdpCache {
public Font GetNativeFont(FontAdp fontAdp) {
String key = fontAdp.toString();
Font rv = (Font)hash.Fetch(key); if (rv != null) return rv;
Font rv = (Font)hash.Get_by(key); if (rv != null) return rv;
if (screenResolutionInDpi == -1) ScreenResolution_set();
int fontSize = XtoJavaDpi(fontAdp.Size());
rv = new Font(fontAdp.Name(), fontAdp.Style().Val(), fontSize);
hash.Add(key, rv);
return rv;
} HashAdp hash = HashAdp_.new_();
} Hash_adp hash = Hash_adp_.new_();
public static void ScreenResolution_set() {screenResolutionInDpi = Toolkit.getDefaultToolkit().getScreenResolution();} // usually either 96 or 120
public static int XtoOsDpi(float v) {return Math.round((v * 72) / screenResolutionInDpi);} // WORKAROUND/JAVA: Java needs 72 dpi screen resolution; wnt uses 96 or 120 dpi
public static int XtoJavaDpi(float v) {return Math.round((v * screenResolutionInDpi) / 72);}

View File

@@ -41,13 +41,13 @@ public class PenAdp implements GfoInvkAble {
}
class PenAdpCache {
public BasicStroke Fetch(float width) {
Object rv = hash.Fetch(width);
Object rv = hash.Get_by(width);
if (rv == null) {
rv = new BasicStroke(width);
hash.Add(width, rv);
}
return (BasicStroke)rv;
}
HashAdp hash = HashAdp_.new_();
Hash_adp hash = Hash_adp_.new_();
public static final PenAdpCache _ = new PenAdpCache(); PenAdpCache() {}
}

View File

@@ -22,17 +22,17 @@ public class SolidBrushAdp_ {
public static final SolidBrushAdp Black = new_(ColorAdp_.Black);
public static final SolidBrushAdp White = new_(ColorAdp_.White);
public static final SolidBrushAdp Null = new_(ColorAdp_.Null);
public static SolidBrushAdp new_(ColorAdp color) {return SolidBrushAdpCache._.Fetch(color);}
public static SolidBrushAdp new_(ColorAdp color) {return SolidBrushAdpCache._.Get_by(color);}
}
class SolidBrushAdpCache {
public SolidBrushAdp Fetch(ColorAdp color) {
SolidBrushAdp rv = (SolidBrushAdp)hash.Fetch(color.Value());
public SolidBrushAdp Get_by(ColorAdp color) {
SolidBrushAdp rv = (SolidBrushAdp)hash.Get_by(color.Value());
if (rv == null) {
rv = SolidBrushAdp.new_(color);
hash.Add(color.Value(), rv);
}
return rv;
}
HashAdp hash = HashAdp_.new_();
Hash_adp hash = Hash_adp_.new_();
public static final SolidBrushAdpCache _ = new SolidBrushAdpCache(); SolidBrushAdpCache() {}
}

View File

@@ -81,15 +81,15 @@ public class IptArg_ {
class IptMacro {
public void Reg(String prefix, String alias, IptArg arg) {
if (regy == null) Init();
OrderedHash list = (OrderedHash)regy.Fetch(prefix);
Ordered_hash list = (Ordered_hash)regy.Get_by(prefix);
if (list == null) {
list = OrderedHash_.new_();
list = Ordered_hash_.new_();
regy.Add(prefix, list);
}
list.AddReplace(alias, arg);
list.Add_if_dupe_use_nth(alias, arg);
}
void Init() {
regy = OrderedHash_.new_();
regy = Ordered_hash_.new_();
Reg("mod", "c", IptKey_.add_(IptKey_.Ctrl));
Reg("mod", "a", IptKey_.add_(IptKey_.Alt));
Reg("mod", "s", IptKey_.add_(IptKey_.Shift));
@@ -103,16 +103,16 @@ class IptMacro {
String[] plusAry = String_.Split(raw, "+");
String[] dotAry = String_.Split(plusAry[0], ".");
String bgn = dotAry[0], end = dotAry[1];
OrderedHash list = (OrderedHash)regy.Fetch(bgn);
Ordered_hash list = (Ordered_hash)regy.Get_by(bgn);
if (list == null) throw parse_err(raw, "list not found").Add("list", bgn);
IptKey rv = (IptKey)list.Fetch(end);
IptKey rv = (IptKey)list.Get_by(end);
if (rv == null) throw parse_err(raw, "arg not found").Add("arg", end);
for (int i = 1; i < plusAry.length; i++) {
rv = rv.Add((IptKey)IptKey_.parse_(plusAry[i]));
}
return rv;
}
OrderedHash regy;
Ordered_hash regy;
static Err parse_err(String raw, String loc) {return Err_.new_key_("gfui", "could not parse IptArg").Add("raw", raw).Add("loc", loc);}
public static final IptMacro _ = new IptMacro(); IptMacro() {}
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public interface IptBnd extends SrlAble {
String Key();
ListAdp Ipts();
List_adp Ipts();
IptEventType EventTypes();
void Exec(IptEventData iptData);
}

View File

@@ -27,22 +27,22 @@ public class IptBndMgr implements SrlAble {
if (IptEventType_.Has(bnd.EventTypes(), list.EventType()))
list.Add(bnd);
for (int i = 0; i < bnd.Ipts().Count(); i++) {
IptArg arg = (IptArg)bnd.Ipts().FetchAt(i);
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
chainMgr.Add(arg);
}
}
@gplx.Internal protected ListAdp Cfgs() {return cfgs;} ListAdp cfgs = ListAdp_.new_();
@gplx.Internal protected List_adp Cfgs() {return cfgs;} List_adp cfgs = List_adp_.new_();
@gplx.Internal protected void Cfgs_delAll() {
ListAdp del = ListAdp_.new_();
List_adp del = List_adp_.new_();
for (int i = 0; i < cfgs.Count(); i++) {
IptCfgPtr ptr = (IptCfgPtr)cfgs.FetchAt(i);
IptCfgPtr ptr = (IptCfgPtr)cfgs.Get_at(i);
IptCfg cfg = IptCfgRegy._.GetOrNew(ptr.CfgKey());
cfg.Owners_del(ptr.CfgKey());
for (IptBndHash list : regy) {
for (int j = 0; j < list.Count(); j++) {
IptBndListItm itmList = list.Get_at(j);
for (int k = 0; k < itmList.Count(); k++) {
IptBnd bnd = itmList.FetchAt(k);
IptBnd bnd = itmList.Get_at(k);
if (String_.Eq(ptr.BndKey(), bnd.Key())) {
list.Del(bnd);
}
@@ -52,7 +52,7 @@ public class IptBndMgr implements SrlAble {
del.Add(cfg);
}
for (int i = 0; i < del.Count(); i++) {
IptCfg cfg = (IptCfg)del.FetchAt(i);
IptCfg cfg = (IptCfg)del.Get_at(i);
cfgs.Del(cfg);
}
}
@@ -62,7 +62,7 @@ public class IptBndMgr implements SrlAble {
for (int j = 0; j < list.Count(); j++) {
IptBndListItm itmList = list.Get_at(j);
for (int i = 0; i < itmList.Count(); i++) {
IptBnd bnd = itmList.FetchAt(i);
IptBnd bnd = itmList.Get_at(i);
if (String_.Eq(key, bnd.Key())) {
old = bnd;
break;
@@ -74,7 +74,7 @@ public class IptBndMgr implements SrlAble {
this.Del(old);
old.Ipts().Clear();
if (ary == IptArg_.Ary_empty) return; // "unbind"; exit after deleting; DATE:2014-05-13
old.Ipts().AddMany((Object[])ary);
old.Ipts().Add_many((Object[])ary);
this.Add(old);
}
public void Del_by_key(String key) {Del_by(true, key);}
@@ -84,7 +84,7 @@ public class IptBndMgr implements SrlAble {
}
private void Del_by(boolean del_by_key, String del_key) {
int regy_len = regy.length;
ListAdp deleted = ListAdp_.new_();
List_adp deleted = List_adp_.new_();
for (int i = 0; i < regy_len; i++) {
IptBndHash list = regy[i];
int list_len = list.Count();
@@ -92,7 +92,7 @@ public class IptBndMgr implements SrlAble {
IptBndListItm bnds = list.Get_at(j);
int bnds_len = bnds.Count();
for (int k = 0; k < bnds_len; k++) {
IptBnd itm_bnd = bnds.FetchAt(k);
IptBnd itm_bnd = bnds.Get_at(k);
if (del_by_key) {
if (String_.Eq(del_key, itm_bnd.Key())) {
deleted.Add(itm_bnd);
@@ -100,7 +100,7 @@ public class IptBndMgr implements SrlAble {
}
else {
if (itm_bnd.Ipts().Count() != 1) continue; // only delete if bnd has 1 ipt; should only be called by xowa which does 1 bnd per ipt
IptArg itm_ipt = (IptArg)itm_bnd.Ipts().FetchAt(0);
IptArg itm_ipt = (IptArg)itm_bnd.Ipts().Get_at(0);
if (String_.Eq(del_key, itm_ipt.Key()))
deleted.Add(itm_bnd);
}
@@ -109,7 +109,7 @@ public class IptBndMgr implements SrlAble {
}
int deleted_len = deleted.Count();
for (int i = 0; i < deleted_len; i++) {
IptBnd bnd = (IptBnd)deleted.FetchAt(i);
IptBnd bnd = (IptBnd)deleted.Get_at(i);
this.Del(bnd);
bnd.Ipts().Clear();
}
@@ -121,7 +121,7 @@ public class IptBndMgr implements SrlAble {
}
}
for (int i = 0; i < bnd.Ipts().Count(); i++) {
IptArg arg = (IptArg)bnd.Ipts().FetchAt(i);
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
chainMgr.Del(arg);
}
}
@@ -144,11 +144,11 @@ public class IptBndMgr implements SrlAble {
public Object Srl(GfoMsg owner) {
GfoMsg m = GfoMsg_.srl_(owner, "mgr");
for (int i = 0; i < hash.Count(); i++)
((IptBnd)hash.FetchAt(i)).Srl(m);
((IptBnd)hash.Get_at(i)).Srl(m);
return this;
}
IptArgChainMgr chainMgr = new IptArgChainMgr();
OrderedHash hash = OrderedHash_.new_(); IptEventType curTypes = IptEventType_.None;
Ordered_hash hash = Ordered_hash_.new_(); IptEventType curTypes = IptEventType_.None;
public static IptBndMgr new_() {return new IptBndMgr();}
IptBndHash[] regy = new IptBndHash[8];
IptBndMgr() {ClearLists();}
@@ -173,18 +173,18 @@ class IptBndHash implements SrlAble {
private IptBndListItm wildcard_list;
public IptEventType EventType() {return eventType;} IptEventType eventType;
public int Count() {return hash.Count();}
public IptBndListItm Get_by(String key) {return wildcard_list == null ? (IptBndListItm)hash.Fetch(key) : wildcard_list;}
public IptBndListItm Get_at(int i) {return (IptBndListItm)hash.FetchAt(i);}
public IptBndListItm Get_by(String key) {return wildcard_list == null ? (IptBndListItm)hash.Get_by(key) : wildcard_list;}
public IptBndListItm Get_at(int i) {return (IptBndListItm)hash.Get_at(i);}
public void Add(IptBnd bnd) {
for (int i = 0; i < bnd.Ipts().Count(); i++) {
IptArg arg = (IptArg)bnd.Ipts().FetchAt(i);
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
if (!IptArg_.EventType_match(arg, eventType)) continue; // bnd may have multiple ipts of different evTypes; only add bnd if evType matches
if (String_.Eq(arg.Key(), IptArg_.Wildcard_key)) {
if (wildcard_list == null) wildcard_list = new IptBndListItm(IptArg_.Wildcard_key);
wildcard_list.Add(bnd);
}
else {
IptBndListItm itm = (IptBndListItm)hash.Fetch(arg.Key());
IptBndListItm itm = (IptBndListItm)hash.Get_by(arg.Key());
if (itm == null) {
itm = new IptBndListItm(arg.Key());
hash.Add(arg.Key(), itm);
@@ -195,7 +195,7 @@ class IptBndHash implements SrlAble {
}
public void Del(IptBnd bnd) {
for (int i = 0; i < bnd.Ipts().Count(); i++) {
IptArg arg = (IptArg)bnd.Ipts().FetchAt(i);
IptArg arg = (IptArg)bnd.Ipts().Get_at(i);
if (!IptArg_.EventType_match(arg, eventType)) continue; // bnd may have multiple ipts of different evTypes; only add bnd if evType matches
hash.Del(arg.Key());
}
@@ -203,20 +203,20 @@ class IptBndHash implements SrlAble {
public Object Srl(GfoMsg owner) {
GfoMsg m = GfoMsg_.srl_(owner, "list").Add("eventType", eventType.Name());
for (int i = 0; i < hash.Count(); i++)
((IptBndListItm)hash.FetchAt(i)).Srl(m);
((IptBndListItm)hash.Get_at(i)).Srl(m);
return this;
}
OrderedHash hash = OrderedHash_.new_();
Ordered_hash hash = Ordered_hash_.new_();
public IptBndHash(IptEventType eventType) {this.eventType = eventType;}
}
class IptBndListItm implements SrlAble {
public String IptKey() {return iptKey;} private String iptKey;
public int Count() {return list.Count();}
public IptBnd FetchAt(int i) {return (IptBnd)list.FetchAt(i);}
public void Add(IptBnd bnd) {list.AddAt(0, bnd);}
public IptBnd Get_at(int i) {return (IptBnd)list.Get_at(i);}
public void Add(IptBnd bnd) {list.Add_at(0, bnd);}
public boolean Exec(IptEventData evData) {
for (int i = 0; i < list.Count(); i++) {
IptBnd bnd = (IptBnd)list.FetchAt(i);
IptBnd bnd = (IptBnd)list.Get_at(i);
try {bnd.Exec(evData);}
catch (Exception exc) {
UsrDlg_._.Stop(UsrMsg.new_("Error while processing event").Add("bnd", SrlAble_.XtoStr(bnd)).Add("exc", Err_.Message_lang(exc)));
@@ -229,17 +229,17 @@ class IptBndListItm implements SrlAble {
public Object Srl(GfoMsg owner) {
GfoMsg m = GfoMsg_.srl_(owner, "itm").Add("iptKey", iptKey);
for (int i = 0; i < list.Count(); i++)
((IptBnd)list.FetchAt(i)).Srl(m);
((IptBnd)list.Get_at(i)).Srl(m);
return this;
}
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
public IptBndListItm(String iptKey) {this.iptKey = iptKey;}
}
class IptArgChainMgr {
public void Clear() {regy.Clear();}
public String Process(IptArg arg) {
// if (String_.Eq(arg.Key(), "key_7")) return "";
HashAdp hash = (HashAdp)active.Fetch(arg.Key());
Hash_adp hash = (Hash_adp)active.Get_by(arg.Key());
if (hash == null) {
active = regy;
String r = activeKey;
@@ -254,7 +254,7 @@ class IptArgChainMgr {
public String ActiveKey() {return activeKey;}
String activeKey = "";
public IptArgChainMgr() {active = regy;}
HashAdp active;
Hash_adp active;
public void Add(IptArg arg) {
if (arg.getClass() != IptKeyChain.class) return;
IptKeyChain chain = (IptKeyChain)arg;
@@ -265,23 +265,23 @@ class IptArgChainMgr {
IptKeyChain chain = (IptKeyChain)arg;
Del_recur(regy, chain.Chained(), 0);
}
void Add_recur(HashAdp cur, IptArg[] ary, int i) {
void Add_recur(Hash_adp cur, IptArg[] ary, int i) {
if (i == ary.length - 1) return; // -1 b/c last should not be registered; ex: key.a,key.b should register key.a only
IptArg ipt = ary[i];
HashAdp next = (HashAdp)cur.Fetch(ipt.Key());
Hash_adp next = (Hash_adp)cur.Get_by(ipt.Key());
if (next == null) {
next = HashAdp_.new_();
next = Hash_adp_.new_();
cur.Add(ipt.Key(), next);
}
Add_recur(next, ary, i + 1);
}// a,b,c
void Del_recur(HashAdp cur, IptArg[] ary, int i) {
void Del_recur(Hash_adp cur, IptArg[] ary, int i) {
IptArg ipt = ary[i];
if (i == ary.length - 1) {
cur.Del(ipt.Key());
return; // -1 b/c last should not be registered; ex: key.a,key.b should register key.a only
}
HashAdp next = (HashAdp)cur.Fetch(ipt.Key());
Hash_adp next = (Hash_adp)cur.Get_by(ipt.Key());
if (next == null) {
return;
}
@@ -289,5 +289,5 @@ class IptArgChainMgr {
if (cur.Count() == 1)
cur.Clear();
}
HashAdp regy = HashAdp_.new_();
Hash_adp regy = Hash_adp_.new_();
}

View File

@@ -36,7 +36,7 @@ public class IptBndMgr_tst {
public IptBndMgr_fx ini_Clear() {under.Clear(); return this;}
public IptBndMgr_fx run_Add(String raw) {
IptArg[] args = IptArg_.parse_ary_(raw);
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
for (IptArg arg : args)
list.Add(arg);
@@ -61,7 +61,7 @@ public class IptBndMgr_tst {
}
class IptBnd_mok implements IptBnd {
public String Key() {return key;} public IptBnd_mok Key_(String v) {key = v; return this;} private String key;
public ListAdp Ipts() {return args;} public IptBnd_mok Ipts_(ListAdp v) {args = v; return this;} ListAdp args;
public List_adp Ipts() {return args;} public IptBnd_mok Ipts_(List_adp v) {args = v; return this;} List_adp args;
public IptEventType EventTypes() {return eventTypes;} public IptBnd_mok EventTypes_(IptEventType v) {eventTypes = v; return this;} IptEventType eventTypes;
public Object Srl(GfoMsg owner) {return this;}
public void Exec(IptEventData iptData) {

View File

@@ -34,16 +34,16 @@ public class IptBnd_ {
box.IptBnds().Add(bnd);
}
public static Object Srl(GfoMsg owner, IptBnd bnd) {GfoMsg_.srl_(owner, "bnd").Add("key", bnd.Key()).Add("ipt", AryXtoStr(bnd.Ipts())); return bnd;}
static String AryXtoStr(ListAdp ary) {
static String AryXtoStr(List_adp ary) {
String_bldr sb = String_bldr_.new_();
for (int i = 0; i < ary.Count(); i++)
sb.Add_spr_unless_first(((IptArg)ary.FetchAt(i)).Key(), "|", i);
sb.Add_spr_unless_first(((IptArg)ary.Get_at(i)).Key(), "|", i);
return sb.XtoStr();
}
}
class IptBnd_invk implements IptBnd {
public String Key() {return key;} private String key;
public ListAdp Ipts() {return ipts;} ListAdp ipts;
public List_adp Ipts() {return ipts;} List_adp ipts;
public IptEventType EventTypes() {return eventTypes;} IptEventType eventTypes;
public void Exec(IptEventData iptData) {
GfoMsg newMsg = m.CloneNew();

View File

@@ -25,9 +25,9 @@ public interface IptCfg extends NewAble, GfoInvkAble {
class IptCfg_base implements IptCfg {
public String CfgKey() {return cfgKey;} private String cfgKey;
public IptCfgItm GetOrDefaultArgs(String bndKey, GfoMsg defaultMsg, IptArg[] defaultArgs) {
IptCfgItm rv = (IptCfgItm)hash.Fetch(bndKey);
IptCfgItm rv = (IptCfgItm)hash.Get_by(bndKey);
if (rv == null) { // no cfg
rv = IptCfgItm.new_().Key_(bndKey).Ipt_(ListAdp_.many_((Object[])defaultArgs)).Msg_(defaultMsg);
rv = IptCfgItm.new_().Key_(bndKey).Ipt_(List_adp_.many_((Object[])defaultArgs)).Msg_(defaultMsg);
hash.Add(bndKey, rv);
}
else { // cfg exists
@@ -39,38 +39,38 @@ class IptCfg_base implements IptCfg {
IptCfgItm rv = GetOrDefaultArgs(bndKey, m, argAry);
rv.Msg_(m); // always overwrite msg
if (Dif(rv.Ipt(), argAry)) {
rv.Ipt_(ListAdp_.many_((Object[])argAry));
rv.Ipt_(List_adp_.many_((Object[])argAry));
this.Change(bndKey, argAry);
}
return rv;
}
boolean Dif(ListAdp lhs, IptArg[] rhs) {
boolean Dif(List_adp lhs, IptArg[] rhs) {
if (lhs.Count() != rhs.length) return true;
for (int i = 0; i < rhs.length; i++) {
IptArg lhsArg = (IptArg)lhs.FetchAt(i);
IptArg lhsArg = (IptArg)lhs.Get_at(i);
IptArg rhsArg = rhs[i];
if (!lhsArg.Eq(rhsArg)) return true;
}
return false;
}
void Change(String bndKey, IptArg[] ary) {
ListAdp list = (ListAdp)owners.Fetch(bndKey);
List_adp list = (List_adp)owners.Get_by(bndKey);
if (list == null) return;
for (int i = 0; i < list.Count(); i++) {
IptBndsOwner owner = (IptBndsOwner)list.FetchAt(i);
IptBndsOwner owner = (IptBndsOwner)list.Get_at(i);
owner.IptBnds().Change(bndKey, ary);
}
}
public void Owners_del(String bndKey) {owners.Del(bndKey);}
public void Owners_add(String bndKey, IptBndsOwner owner) {
ListAdp list = (ListAdp)owners.Fetch(bndKey);
List_adp list = (List_adp)owners.Get_by(bndKey);
if (list == null) {
list = ListAdp_.new_();
list = List_adp_.new_();
owners.Add(bndKey, list);
}
list.Add(owner);
owner.IptBnds().Cfgs().Add(new IptCfgPtr(cfgKey, bndKey));
} OrderedHash owners = OrderedHash_.new_();
} Ordered_hash owners = Ordered_hash_.new_();
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.MatchIn(k, Invk_Add, Invk_set)) {
String bndKey = m.ReadStr("bndKey");
@@ -82,7 +82,7 @@ class IptCfg_base implements IptCfg {
return this;
} public static final String Invk_Add = "Add", Invk_set = "set";
public IptCfg_base(String cfgKey) {this.cfgKey = cfgKey;}
OrderedHash hash = OrderedHash_.new_();
Ordered_hash hash = Ordered_hash_.new_();
public Object NewByKey(Object o) {return new IptCfg_base((String)o);} @gplx.Internal protected static final IptCfg HashProto = new IptCfg_base(); @gplx.Internal protected IptCfg_base() {}
}
class IptCfgPtr {

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public class IptCfgItm {
public String Key() {return key;} public IptCfgItm Key_(String v) {key = v; return this;} private String key;
public ListAdp Ipt() {return ipt;} public IptCfgItm Ipt_(ListAdp v) {ipt = v; return this;} ListAdp ipt;
public List_adp Ipt() {return ipt;} public IptCfgItm Ipt_(List_adp v) {ipt = v; return this;} List_adp ipt;
public GfoMsg Msg() {return msg;} public IptCfgItm Msg_(GfoMsg v) {msg = v; return this;} GfoMsg msg;
public static IptCfgItm new_() {return new IptCfgItm();} IptCfgItm() {}
}

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public class IptCfgRegy implements GfoInvkAble {
public void Clear() {hash.Clear();}
public IptCfg GetOrNew(String k) {return (IptCfg)hash.FetchOrNew(k, IptCfg_base.HashProto);}
public IptCfg GetOrNew(String k) {return (IptCfg)hash.Get_by_or_new(k, IptCfg_base.HashProto);}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.MatchIn(k, Invk_Get, Invk_get)) {
String key = m.ReadStr("key");
@@ -27,7 +27,7 @@ public class IptCfgRegy implements GfoInvkAble {
}
return this;
} public static final String Invk_Get = "Get", Invk_get = "get";
OrderedHash hash = OrderedHash_.new_();
Ordered_hash hash = Ordered_hash_.new_();
public static final IptCfgRegy _ = new IptCfgRegy();
public IptCfgRegy() {}
}

View File

@@ -22,7 +22,7 @@ public class IptCfg_ {
}
class IptCfg_null implements IptCfg {
public String CfgKey() {return "<<NULL KEY>>";}
public IptCfgItm GetOrDefaultArgs(String bndKey, GfoMsg m, IptArg[] argAry) {return IptCfgItm.new_().Key_(bndKey).Ipt_(ListAdp_.many_((Object[])argAry)).Msg_(m);}
public IptCfgItm GetOrDefaultArgs(String bndKey, GfoMsg m, IptArg[] argAry) {return IptCfgItm.new_().Key_(bndKey).Ipt_(List_adp_.many_((Object[])argAry)).Msg_(m);}
public void Owners_add(String key, IptBndsOwner owner) {}
public void Owners_del(String key) {}
public Object NewByKey(Object o) {return this;}

View File

@@ -24,16 +24,16 @@ class IptKeyStrMgr {
}
public String XtoStr(IptKey key) {
if (literals == null) Init();
Object rv = literals.Fetch(key.Val());
Object rv = literals.Get_by(key.Val());
return rv == null ? String_.Empty : (String)rv;
}
public void XtoIptKeyAry(ListAdp list) {
public void XtoIptKeyAry(List_adp list) {
if (literals == null) Init();
for (int i = 0; i < keys.Count(); i++)
list.Add((IptKey)keys.FetchAt(i));
list.Add((IptKey)keys.Get_at(i));
}
void Init() {// default to US style keyboard
literals = HashAdp_.new_();
literals = Hash_adp_.new_();
charKeys = new IptKey[256];
RegLtr(IptKey_.A, 'a'); RegLtr(IptKey_.B, 'b'); RegLtr(IptKey_.C, 'c'); RegLtr(IptKey_.D, 'd'); RegLtr(IptKey_.E, 'e');
RegLtr(IptKey_.F, 'f'); RegLtr(IptKey_.G, 'g'); RegLtr(IptKey_.H, 'h'); RegLtr(IptKey_.I, 'i'); RegLtr(IptKey_.J, 'j');
@@ -70,6 +70,6 @@ class IptKeyStrMgr {
charKeys[charVal] = k;
}
IptKey[] charKeys;
HashAdp literals; OrderedHash keys = OrderedHash_.new_();
Hash_adp literals; Ordered_hash keys = Ordered_hash_.new_();
public static final IptKeyStrMgr _ = new IptKeyStrMgr(); IptKeyStrMgr() {}
}

View File

@@ -40,8 +40,8 @@ public class IptKey_ {
String val = rdr.ReadStrOr(key, ""); // NOTE: "" cannot be null, b/c nullRdr returns String.empty
return (String_.Eq(val, "")) ? or : parse_(val);
}
public static ListAdp printableKeys2_(IptKey[] add, IptKey[] del) {
ListAdp list = ListAdp_.new_();
public static List_adp printableKeys2_(IptKey[] add, IptKey[] del) {
List_adp list = List_adp_.new_();
for (IptKey key : add)
list.Add(key);
IptKeyStrMgr._.XtoIptKeyAry(list);
@@ -50,13 +50,13 @@ public class IptKey_ {
return list;
}
public static IptKey[] printableKeys_(IptKey[] add, IptKey[] del) {
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
for (IptKey key : add)
list.Add(key);
IptKeyStrMgr._.XtoIptKeyAry(list);
for (IptKey key : del)
list.Del(key);
return (IptKey[])list.Xto_ary(IptKey.class);
return (IptKey[])list.To_ary(IptKey.class);
}
private static IptKey get_or_new_(int val) {
IptKey rv = (IptKey)enm_mgr.Get(val);
@@ -102,10 +102,10 @@ public class IptKey_ {
, Shift = new_(KeyCode_Shift, "shift"), Ctrl = new_(KeyCode_Ctrl, "ctrl"), Alt = new_(KeyCode_Alt, "alt")
, Keypad_enter = new_(16777296, "keypad_enter")
;
private static OrderedHash ui_str_hash;
public static OrderedHash Ui_str_hash() {
private static Ordered_hash ui_str_hash;
public static Ordered_hash Ui_str_hash() {
if (ui_str_hash == null) {
ui_str_hash = OrderedHash_.new_();
ui_str_hash = Ordered_hash_.new_();
All_add(ui_str_hash
, IptKey_.Back, IptKey_.Tab, IptKey_.Clear, IptKey_.Enter
, IptKey_.Pause, IptKey_.CapsLock, IptKey_.Escape, IptKey_.Space
@@ -129,11 +129,11 @@ public class IptKey_ {
}
return ui_str_hash;
}
private static void All_add(OrderedHash hash, IptKey... ary) {
private static void All_add(Ordered_hash hash, IptKey... ary) {
int len = ary.length;
for (int i = 0; i < len; ++i) {
IptKey key = ary[i];
hash.AddReplace(Int_obj_ref.new_(key.Val()), key);
hash.Add_if_dupe_use_nth(Int_obj_ref.new_(key.Val()), key);
}
}
public static String To_str(int val) {
@@ -146,7 +146,7 @@ public class IptKey_ {
if (val == 0) return rv; // handle modifiers only, like "mod.cs"; else will be "mod.cs+key.#0"
rv += "+";
}
IptKey key = (IptKey)IptKey_.Ui_str_hash().Fetch(Int_obj_ref.new_(val));
IptKey key = (IptKey)IptKey_.Ui_str_hash().Get_by(Int_obj_ref.new_(val));
String key_str = key == null ? "key.#" + Int_.Xto_str(val) : key.Key();
return rv + key_str;
}

View File

@@ -23,7 +23,7 @@ public class GftBand {
public GftBand Len1_pct_(float val) {return Len1_(new GftSizeCalc_pct(val));}
public GftBand Len1_abs_(int v) {return Len1_(new GftSizeCalc_abs(v));}
public GftCell Cell_dfl() {return cell_dfl;} GftCell cell_dfl = new GftCell();
public ListAdp Cells() {return cells;} ListAdp cells = ListAdp_.new_();
public List_adp Cells() {return cells;} List_adp cells = List_adp_.new_();
public GftBand Cells_var_(int count) {
for (int i = 0; i < count; i++)
cells.Add(new GftCell().Len0_(new GftSizeCalc_var(count)));
@@ -37,28 +37,28 @@ public class GftBand {
cells.Add(new GftCell().Len0_(new GftSizeCalc_num(num)));
return this;
}
public ListAdp Items() {return items;} ListAdp items = ListAdp_.new_();
public List_adp Items() {return items;} List_adp items = List_adp_.new_();
public void Items_add(GftItem item) {items.Add(item);}
public void Calc(GftItem owner, int y, int h) {
int x = 0;
y = grid.Bands_dir().GetValByDir(y - h, y);
int availX = owner.Gft_w();
for (int i = 0; i < cells.Count(); i++) {
GftCell cell = (GftCell)cells.FetchAt(i);
GftCell cell = (GftCell)cells.Get_at(i);
if (cell.Len0().Key() == GftSizeCalc_abs.KEY) {
GftSizeCalc_abs calc = (GftSizeCalc_abs)cell.Len0();
availX -= calc.Val();
}
else if (cell.Len0().Key() == GftSizeCalc_var.KEY) {
if (i >= items.Count()) continue;
GftItem item = (GftItem)items.FetchAt(i);
GftItem item = (GftItem)items.Get_at(i);
GfuiElem elem = GfuiElem_.as_(item);
availX -= elem == null ? item.Gft_w() : elem.Width();
}
}
for (int i = 0; i < items.Count(); i++) {
GftItem item = (GftItem)items.FetchAt(i);
GftCell cell = i >= cells.Count() ? cell_dfl : (GftCell)cells.FetchAt(i);
GftItem item = (GftItem)items.Get_at(i);
GftCell cell = i >= cells.Count() ? cell_dfl : (GftCell)cells.Get_at(i);
int w = cell.Len0().Calc(grid, this, owner, item, availX);
item.Gft_rect_(RectAdp_.new_(x, y, w, h));
// Tfds.Write(item.Key_of_GfuiElem(), w, h, x, y);
@@ -71,7 +71,7 @@ public class GftBand {
rv.grid = grid;
rv.key = key; rv.idx = idx; rv.cell_dfl = cell_dfl.Clone(); rv.len1 = this.len1.Clone();
for (int i = 0; i < cells.Count(); i++) {
GftCell cell = (GftCell)cells.FetchAt(i);
GftCell cell = (GftCell)cells.Get_at(i);
rv.cells.Add(cell.Clone());
}
return rv;

View File

@@ -18,20 +18,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public class GftGrid {
public String Key() {return key;} public GftGrid Key_(String v) {key = v; return this;} private String key;
public ListAdp Bands() {return bands;} ListAdp bands = ListAdp_.new_();
public ListAdp SubLyts() {return subLyts;} ListAdp subLyts = ListAdp_.new_();
public List_adp Bands() {return bands;} List_adp bands = List_adp_.new_();
public List_adp SubLyts() {return subLyts;} List_adp subLyts = List_adp_.new_();
public void Clear() {bands.Clear(); subLyts.Clear(); bandDir = DirInt.Fwd;}
public DirInt Bands_dir() {return bandDir;} public GftGrid Bands_dir_(DirInt v) {bandDir = v; return this;} DirInt bandDir = DirInt.Fwd;
public GftGrid SubLyts_get(String key) {
for (int i = 0; i < subLyts.Count(); i++) {
GftGrid grid = (GftGrid)subLyts.FetchAt(i);
GftGrid grid = (GftGrid)subLyts.Get_at(i);
if (String_.Eq(key, grid.Key())) return grid;
}
return null;
}
public GftBand Bands_get(String key) {
for (int i = 0; i < bands.Count(); i++) {
GftBand band = (GftBand)bands.FetchAt(i);
GftBand band = (GftBand)bands.Get_at(i);
if (String_.Eq(key, band.Key())) return band;
}
return null;
@@ -47,16 +47,16 @@ public class GftGrid {
}
return this;
}
@gplx.Internal protected void Bands_delAt(int i) {bands.DelAt(i);}
@gplx.Internal protected boolean Bands_has(String key) {return Bands_indexOf(key) != ListAdp_.NotFound;}
@gplx.Internal protected void Bands_delAt(int i) {bands.Del_at(i);}
@gplx.Internal protected boolean Bands_has(String key) {return Bands_indexOf(key) != List_adp_.NotFound;}
@gplx.Internal protected void Bands_del(String key) {
int idx = Bands_indexOf(key);
if (idx != ListAdp_.NotFound) bands.DelAt(idx);
if (idx != List_adp_.NotFound) bands.Del_at(idx);
}
int Bands_indexOf(String key) {
int curIdx = ListAdp_.NotFound;
int curIdx = List_adp_.NotFound;
for (int i = 0; i < bands.Count(); i++) {
GftBand band = (GftBand)bands.FetchAt(i);
GftBand band = (GftBand)bands.Get_at(i);
if (String_.Eq(key, band.Key())) {
curIdx = i;
break;
@@ -80,7 +80,7 @@ public class GftGrid {
void ExecLyts(GftItem owner, GftItem[] ary) {
int idx = 0;
for (int i = 0; i < subLyts.Count(); i++) {
GftGrid subGrid = (GftGrid)subLyts.FetchAt(i);
GftGrid subGrid = (GftGrid)subLyts.Get_at(i);
GftItem[] subAry = new GftItem[subGrid.Bands_cellCount()];
for (int j = 0; j < subAry.length; j++) {
subAry[j] = ary[idx++];
@@ -92,17 +92,17 @@ public class GftGrid {
if (bands.Count() == 0) return;
int availY = owner.Gft_h();
GftBand band = null;
int bgn = bandDir.GetValByDir(bands.LastIndex(), 0);
int bgn = bandDir.GetValByDir(bands.Idx_last(), 0);
int end = bandDir.GetValByDir(-1, bands.Count());
for (int i = bgn; i != end; i += bandDir.Val()) {
band = (GftBand)bands.FetchAt(i);
band = (GftBand)bands.Get_at(i);
if (band.Len1().Key() == GftSizeCalc_abs.KEY) {
GftSizeCalc_abs calc = (GftSizeCalc_abs)band.Len1();
availY -= calc.Val();
}
}
int bandIdx = 0;
band = (GftBand)bands.FetchAt(bandIdx);
band = (GftBand)bands.Get_at(bandIdx);
band.Items().Clear();
int y = bandDir.GetValByDir(owner.Gft_h(), 0);
for (int itmIdx = 0; itmIdx < ary.length; itmIdx++) {
@@ -112,7 +112,7 @@ public class GftGrid {
band.Calc(owner, y, h);
y += h * bandDir.Val();
if (bandIdx + 1 >= bands.Count()) throw Err_.new_("error retrieving band").Add("owner", owner.Key_of_GfuiElem()).Add("item", itm.Key_of_GfuiElem()).Add("bandIdx", bandIdx + 1).Add("count", bands.Count());
band = (GftBand)bands.FetchAt(++bandIdx);
band = (GftBand)bands.Get_at(++bandIdx);
band.Items().Clear();
}
band.Items_add(itm);
@@ -122,7 +122,7 @@ public class GftGrid {
int Bands_cellCount() {
int rv = 0;
for (int i = 0; i < bands.Count(); i++) {
GftBand band = (GftBand)bands.FetchAt(i);
GftBand band = (GftBand)bands.Get_at(i);
rv += band.Cells().Count();
}
return rv;
@@ -131,7 +131,7 @@ public class GftGrid {
public static void LytExecRecur(GfuiElemBase owner) {
if (owner.Lyt() != null) owner.Lyt_exec();
for (int i = 0; i < owner.SubElems().Count(); i++) {
GfuiElemBase sub = (GfuiElemBase)owner.SubElems().FetchAt(i);
GfuiElemBase sub = (GfuiElemBase)owner.SubElems().Get_at(i);
LytExecRecur(sub);
}
}

View File

@@ -31,7 +31,7 @@ class GftGrid_fx {
return this;
}
public GftGrid_fx ini_ItmWidth(int i, int width) {
GftItem itm = (GftItem)itms.FetchAt(i);
GftItem itm = (GftItem)itms.Get_at(i);
itm.Gft_w_(width);
return this;
}
@@ -43,7 +43,7 @@ class GftGrid_fx {
return this;
}
public GftGrid_fx ini_Lyt(int num) {
curGrid = (GftGrid)grid.SubLyts().FetchAt(num);
curGrid = (GftGrid)grid.SubLyts().Get_at(num);
return this;
}
public GftGrid_fx ini_BandDir(DirInt dir) {curGrid.Bands_dir_(dir); return this;}
@@ -51,7 +51,7 @@ class GftGrid_fx {
public GftGrid_fx ini_Set(int idx, GftBand orig) {return ini_Set(idx, idx, orig);}
public GftGrid_fx ini_Set(int bgn, int end, GftBand orig) {curGrid.Bands_set(bgn, end, orig); return this;}
public GftGrid_fx run() {
GftItem[] ary = (GftItem[])itms.Xto_ary(GftItem.class);
GftItem[] ary = (GftItem[])itms.To_ary(GftItem.class);
grid.Exec(owner, ary);
return this;
}
@@ -70,7 +70,7 @@ class GftGrid_fx {
int len = end - bgn + 1;
int[] actl = new int[len];
for (int i = 0; i < len; i++) {
GftItem itm = (GftItem)itms.FetchAt(i + bgn);
GftItem itm = (GftItem)itms.Get_at(i + bgn);
actl[i] = GetVal(itm, name);
}
Tfds.Eq_ary(expd, actl, name);
@@ -89,5 +89,5 @@ class GftGrid_fx {
return rv;
}
GftGrid grid = GftGrid.new_(), curGrid;
ListAdp itms = ListAdp_.new_();
List_adp itms = List_adp_.new_();
}

View File

@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public interface GxwCheckListBox extends GxwElem {
int Items_count();
ListAdp Items_getAll();
ListAdp Items_getChecked();
List_adp Items_getAll();
List_adp Items_getChecked();
void Items_add(Object obj, boolean v);
void Items_reverse();

View File

@@ -70,14 +70,14 @@ public class GxwCheckListBox_lang extends JScrollPane implements GxwCheckListBox
// return listBox.requestFocusInWindow();
//// return super.requestFocusInWindow();
// }
public ListAdp Items_getAll() {return Items_get(Mode_All);}
public List_adp Items_getAll() {return Items_get(Mode_All);}
public int Items_count() {return internalItems.size();}
public boolean Items_getCheckedAt(int i) {return internalItems.get(i).selected;}
public void Items_setCheckedAt(int i, boolean v) {internalItems.get(i).selected = v;}
public ListAdp Items_getChecked() {return Items_get(Mode_Selected);}
public List_adp Items_getChecked() {return Items_get(Mode_Selected);}
static final int Mode_All = 1, Mode_Selected = 2;
ListAdp Items_get(int mode) {
ListAdp list = ListAdp_.new_();
List_adp Items_get(int mode) {
List_adp list = List_adp_.new_();
for (CheckListItem data: internalItems) {
boolean add = (mode == Mode_All) || (mode == Mode_Selected) && data.Selected();
if (add)

View File

@@ -41,5 +41,5 @@ public class GxwCore_mock extends GxwCore_base {
@Override public void Invalidate() {} @Override public void Dispose() {}
public void SendKey(IptKey key) {}
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
}

View File

@@ -26,7 +26,7 @@ public class GxwElem_mock_base implements GxwElem {
return this;
}
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
public static GxwElem_mock_base new_() {return new GxwElem_mock_base();} protected GxwElem_mock_base() {}
}
class MockTextBox extends GxwElem_mock_base implements GxwTextFld {

View File

@@ -176,7 +176,7 @@ class GxwTextFld_cls_lang extends JTextField implements GxwTextFld {
class GxwTextBox_overrideKeyCmd extends AbstractAction {
public void actionPerformed(ActionEvent e) {
if (focus) {
int z = owner.OwnerWin().FocusMgr().SubElems().IndexOf(owner);
int z = owner.OwnerWin().FocusMgr().SubElems().Idx_of(owner);
owner.OwnerWin().FocusMgr().Focus(focusDir, z);
return;
}

View File

@@ -196,7 +196,7 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
try {return this.getDocument().getText(sel_bgn, sel_end - sel_bgn);}
catch (Exception exc) {throw Err_.err_(exc, "Html_sel_text");}
}
static void Html_sel_atrs(AttributeSet atrs, ListAdp list, String ownerKey, String dlm) {
static void Html_sel_atrs(AttributeSet atrs, List_adp list, String ownerKey, String dlm) {
if (atrs == null) return;
Enumeration<?> keys = atrs.getAttributeNames();
while (true) {
@@ -214,9 +214,9 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
public KeyVal[] Html_sel_atrs() {
if (String_.Eq(this.getContentType(), "text/plain")) return KeyVal_.Ary_empty;
Element elm = Html_sel_elm(); if (elm == null) return KeyVal_.Ary_empty;
ListAdp sel_atrs_list = ListAdp_.new_();
List_adp sel_atrs_list = List_adp_.new_();
Html_sel_atrs(elm.getAttributes(), sel_atrs_list, null, ".");
return (KeyVal[])sel_atrs_list.Xto_ary(KeyVal.class);
return (KeyVal[])sel_atrs_list.To_ary(KeyVal.class);
}
@Override public void processKeyEvent(KeyEvent e) {

View File

@@ -38,43 +38,44 @@ import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoManager;
public class GxwTextMemo_lang extends JScrollPane implements GxwTextMemo {
public JTextArea Inner() {return txtBox;} GxwTextBox_lang txtBox;
public JTextArea Inner() {return txt_box;} GxwTextBox_lang txt_box;
public GxwCore_base Core() {return core;} GxwCore_base core;
public GxwCbkHost Host() {return host;} public void Host_set(GxwCbkHost host) {this.host = host; txtBox.Host_set(host);} GxwCbkHost host;
public GxwCbkHost Host() {return host;} public void Host_set(GxwCbkHost host) {this.host = host; txt_box.Host_set(host);} GxwCbkHost host;
@Override public void setBackground(Color c) {
if (c.getRGB() == Color.BLACK.getRGB()) txtBox.setCaretColor(Color.WHITE);
else if (c.getRGB() == Color.WHITE.getRGB()) txtBox.setCaretColor(Color.BLACK);
if (txt_box == null) return; // WORKAROUND.OSX: OSX LookAndFeel calls setBackground during ctor of Mem_html; DATE:2015-05-11
if (c.getRGB() == Color.BLACK.getRGB()) txt_box.setCaretColor(Color.WHITE);
else if (c.getRGB() == Color.WHITE.getRGB()) txt_box.setCaretColor(Color.BLACK);
super.setBackground(c);
}
public void ScrollTillCaretIsVisible() {throw Err_.not_implemented_();}
public void Margins_set(int left, int top, int right, int bot) {
if (left == 0 && right == 0) {
txtBox.setBorder(BorderFactory.createLineBorder(Color.BLACK));
txtBox.setMargin(new Insets(0, 0, 0,0));
txt_box.setBorder(BorderFactory.createLineBorder(Color.BLACK));
txt_box.setMargin(new Insets(0, 0, 0,0));
}
else {
// txtBox.setBorder(BasicBorders.getTextFieldBorder());
// txtBox.setMargin(new Insets(0, l, 0, r));
txtBox.setFont(new Font("Courier New", FontStyleAdp_.Plain.val, 12));
txtBox.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK), BorderFactory.createEmptyBorder(top, left, bot, right)));
// txt_box.setBorder(BasicBorders.getTextFieldBorder());
// txt_box.setMargin(new Insets(0, l, 0, r));
txt_box.setFont(new Font("Courier New", FontStyleAdp_.Plain.val, 12));
txt_box.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK), BorderFactory.createEmptyBorder(top, left, bot, right)));
}
}
public void ctor_MsTextBoxMultiline_() {
txtBox = new GxwTextBox_lang();
txtBox.ctor_MsTextBox_();
core = new GxwCore_host(GxwCore_lang.new_(this), txtBox.ctrlMgr);
this.setViewportView(txtBox);
txtBox.setLineWrap(true);
txtBox.setWrapStyleWord(true); // else text will wrap in middle of words
txt_box = new GxwTextBox_lang();
txt_box.ctor_MsTextBox_();
core = new GxwCore_host(GxwCore_lang.new_(this), txt_box.ctrlMgr);
this.setViewportView(txt_box);
txt_box.setLineWrap(true);
txt_box.setWrapStyleWord(true); // else text will wrap in middle of words
this.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
this.setBorder(null);
txtBox.setBorder(BorderFactory.createLineBorder(Color.BLACK));
txtBox.setCaretColor(Color.BLACK);
txtBox.getCaret().setBlinkRate(0);
txtBox.setMargin(new Insets(0, 200, 200,0));
txt_box.setBorder(BorderFactory.createLineBorder(Color.BLACK));
txt_box.setCaretColor(Color.BLACK);
txt_box.getCaret().setBlinkRate(0);
txt_box.setMargin(new Insets(0, 200, 200,0));
OverrideKeyBindings();
InitUndoMgr();
txtBox.setCaret(new javax.swing.text.DefaultCaret() {public void setSelectionVisible(boolean vis) {super.setSelectionVisible(true);}});// else highlighted selection will not be visible when text box loses focus
txt_box.setCaret(new javax.swing.text.DefaultCaret() {public void setSelectionVisible(boolean vis) {super.setSelectionVisible(true);}});// else highlighted selection will not be visible when text box loses focus
// this.setLayout(null);
// Object fontDefinition = new UIDefaults.ProxyLazyValue("javax.swing.plaf.FontUIResource", null, new Object[] { "dialog", new Integer(Font.PLAIN), new Integer(12) });
@@ -89,7 +90,7 @@ public class GxwTextMemo_lang extends JScrollPane implements GxwTextMemo {
} @gplx.Internal protected GxwTextMemo_lang() {}
void InitUndoMgr() {
final UndoManager undo = new UndoManager();
Document doc = txtBox.getDocument();
Document doc = txt_box.getDocument();
// Listen for undo and redo events
doc.addUndoableEditListener(new UndoableEditListener() {
@@ -99,7 +100,7 @@ public class GxwTextMemo_lang extends JScrollPane implements GxwTextMemo {
});
// Create an undo action and add it to the text component
txtBox.getActionMap().put("Undo",
txt_box.getActionMap().put("Undo",
new AbstractAction("Undo") {
public void actionPerformed(ActionEvent evt) {
try {
@@ -112,10 +113,10 @@ public class GxwTextMemo_lang extends JScrollPane implements GxwTextMemo {
});
// Bind the undo action to ctl-Z
txtBox.getInputMap().put(KeyStroke.getKeyStroke("control Z"), "Undo");
txt_box.getInputMap().put(KeyStroke.getKeyStroke("control Z"), "Undo");
// Create a redo action and add it to the text component
txtBox.getActionMap().put("Redo",
txt_box.getActionMap().put("Redo",
new AbstractAction("Redo") {
public void actionPerformed(ActionEvent evt) {
try {
@@ -128,20 +129,20 @@ public class GxwTextMemo_lang extends JScrollPane implements GxwTextMemo {
});
// Bind the redo action to ctl-Y
txtBox.getInputMap().put(KeyStroke.getKeyStroke("control Y"), "Redo");
txt_box.getInputMap().put(KeyStroke.getKeyStroke("control Y"), "Redo");
}
void OverrideKeyBindings() {
Set<AWTKeyStroke> forTraSet = new HashSet<AWTKeyStroke> ();
txtBox.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet);
txtBox.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, forTraSet);
txt_box.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet);
txt_box.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, forTraSet);
GxwTextBox_overrideKeyCmd.noop_((GfuiElem)host, txtBox, "control H"); // else ctrl+h deletes current char
// GxwTextBox_overrideKeyCmd.new_(txtBox, "ENTER", Env_.NewLine); // else enter will always use \n on window; jtextBox allows separation of \r from \n
GxwTextBox_overrideKeyCmd.noop_((GfuiElem)host, txt_box, "control H"); // else ctrl+h deletes current char
// GxwTextBox_overrideKeyCmd.new_(txt_box, "ENTER", Env_.NewLine); // else enter will always use \n on window; jtextBox allows separation of \r from \n
}
public void AlignH_(GfuiAlign val) {
// can't work with jtextArea
// if (val.Val() == GfuiAlign_.Mid.Val())
// txtBox.setAlignmentY(JTextArea.CENTER_ALIGNMENT);
// txt_box.setAlignmentY(JTextArea.CENTER_ALIGNMENT);
}
public int LinesPerScreen() {return LinesPerScreen(this);}
public int LinesTotal() {
@@ -256,44 +257,44 @@ public class GxwTextMemo_lang extends JScrollPane implements GxwTextMemo {
// String charactersPastEndOfLine = text.Substring(charIndexLastAccordingToApi, newLineLength);
// return charactersPastEndOfLine == String_.NewLine ? lineLength + newLineLength : lineLength;
}
public boolean Border_on() {return txtBox.Border_on();} public void Border_on_(boolean v) {txtBox.Border_on_(v);}
public void CreateControlIfNeeded() {txtBox.CreateControlIfNeeded();}
public boolean OverrideTabKey() {return txtBox.OverrideTabKey();}
public boolean Border_on() {return txt_box.Border_on();} public void Border_on_(boolean v) {txt_box.Border_on_(v);}
public void CreateControlIfNeeded() {txt_box.CreateControlIfNeeded();}
public boolean OverrideTabKey() {return txt_box.OverrideTabKey();}
public void OverrideTabKey_(boolean v) {
txtBox.OverrideTabKey_(v);
txt_box.OverrideTabKey_(v);
if (v) {
Set<AWTKeyStroke> forTraSet = new HashSet<AWTKeyStroke> ();
txtBox.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet);
txtBox.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, forTraSet);
txt_box.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet);
txt_box.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, forTraSet);
}
else {
Set<AWTKeyStroke> forTraSet = new HashSet<AWTKeyStroke> ();
txtBox.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet);
txtBox.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, forTraSet);
GxwTextBox_overrideKeyCmd.focus_((GfuiElem)host, txtBox, "TAB"); // else ctrl+h deletes current char
GxwTextBox_overrideKeyCmd.focusPrv_((GfuiElem)host, txtBox, "shift TAB"); // else ctrl+h deletes current char
txt_box.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet);
txt_box.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, forTraSet);
GxwTextBox_overrideKeyCmd.focus_((GfuiElem)host, txt_box, "TAB"); // else ctrl+h deletes current char
GxwTextBox_overrideKeyCmd.focusPrv_((GfuiElem)host, txt_box, "shift TAB"); // else ctrl+h deletes current char
// Set<AWTKeyStroke> forTraSet = new HashSet<AWTKeyStroke> ();
// forTraSet.add(AWTKeyStroke.getAWTKeyStroke("TAB"));
// Set<AWTKeyStroke> bwdTraSet = new HashSet<AWTKeyStroke> ();
// bwdTraSet.add(AWTKeyStroke.getAWTKeyStroke("control TAB"));
// txtBox.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet);
// txtBox.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, bwdTraSet);
// txtBox.OverrideTabKey_(false);
// txt_box.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, forTraSet);
// txt_box.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, bwdTraSet);
// txt_box.OverrideTabKey_(false);
}
}
public int SelBgn() {return txtBox.SelBgn();} public void SelBgn_set(int v) {txtBox.SelBgn_set(v);}
public int SelLen() {return txtBox.SelLen();} public void SelLen_set(int v) {txtBox.SelLen_set(v);}
public void EnableDoubleBuffering() {txtBox.EnableDoubleBuffering();}
public int SelBgn() {return txt_box.SelBgn();} public void SelBgn_set(int v) {txt_box.SelBgn_set(v);}
public int SelLen() {return txt_box.SelLen();} public void SelLen_set(int v) {txt_box.SelLen_set(v);}
public void EnableDoubleBuffering() {txt_box.EnableDoubleBuffering();}
public void SendKeyDown(IptKey key) {txtBox.SendKeyDown(key);}
public String TextVal() {return txtBox.TextVal();}
public void SendKeyDown(IptKey key) {txt_box.SendKeyDown(key);}
public String TextVal() {return txt_box.TextVal();}
public void TextVal_set(String v) {
txtBox.TextVal_set(v);
txtBox.setSelectionStart(0); txtBox.setSelectionEnd(0); // else selects whole text and scrolls to end of selection
txt_box.TextVal_set(v);
txt_box.setSelectionStart(0); txt_box.setSelectionEnd(0); // else selects whole text and scrolls to end of selection
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, GxwElem_lang.AlignH_cmd)) AlignH_(GfuiAlign_.cast_(m.CastObj("v")));
return txtBox.Invk(ctx, ikey, k, m);
return txt_box.Invk(ctx, ikey, k, m);
}
}
class GxwCore_host extends GxwCore_base {

View File

@@ -88,10 +88,10 @@ class GfoConsoleWinCmds implements GfoInvkAble {
GfuiWin win; GfuiTextBox consoleFilBox, consoleBox, statusBox, resultBox;
public void Owner_set(GfuiElem elem) {win = (GfuiWin)elem;}
public void Init() {
consoleFilBox = (GfuiTextBox)win.SubElems().Fetch("consoleFilBox");
consoleBox = (GfuiTextBox)win.SubElems().Fetch("consoleBox");
resultBox = (GfuiTextBox)win.SubElems().Fetch("resultBox");
statusBox = (GfuiTextBox)win.SubElems().Fetch("statusBox");
consoleFilBox = (GfuiTextBox)win.SubElems().Get_by("consoleFilBox");
consoleBox = (GfuiTextBox)win.SubElems().Get_by("consoleBox");
resultBox = (GfuiTextBox)win.SubElems().Get_by("resultBox");
statusBox = (GfuiTextBox)win.SubElems().Get_by("statusBox");
GfsCore._.AddObj(this, "gfoConsoleWin");
GfsCore._.ExecRegy("gplx.gfui.GfoConsoleWin.ini");
}
@@ -129,7 +129,7 @@ class GfoConsoleWinCmds implements GfoInvkAble {
}
void Save() {
String consoleFilStr = consoleFilBox.Text();
Io_url url = Io_url_.Null;
Io_url url = Io_url_.Empty;
if (String_.Len_eq_0(consoleFilStr)) {
url = GfuiIoDialogUtl.SelectFile();
consoleFilBox.Text_(url.Raw());
@@ -137,19 +137,19 @@ class GfoConsoleWinCmds implements GfoInvkAble {
}
else
url = Io_url_.new_any_(consoleFilStr);
Io_mgr._.SaveFilStr(url, consoleBox.Text());
Io_mgr.I.SaveFilStr(url, consoleBox.Text());
}
void Load() {
String consoleFilStr = consoleFilBox.Text();
Io_url dir = Io_url_.Null;
Io_url dir = Io_url_.Empty;
if (String_.Len_eq_0(consoleFilStr))
dir = Io_url_.Null;
dir = Io_url_.Empty;
else {
dir = Io_url_.new_any_(consoleFilStr);
dir = dir.OwnerDir();
}
Io_url url = GfuiIoDialogUtl.SelectFile(dir); if (url == Io_url_.Null) return;
consoleBox.Text_(Io_mgr._.LoadFilStr(url));
Io_url url = GfuiIoDialogUtl.SelectFile(dir); if (url == Io_url_.Empty) return;
consoleBox.Text_(Io_mgr.I.LoadFilStr(url));
}
String FixNewLines(String cmd) {
cmd = String_.Replace(cmd, "\n", "\r\n");
@@ -193,7 +193,7 @@ class GfoConsoleWinCmds implements GfoInvkAble {
Io_url v = m.ReadIoUrl("v");
if (ctx.Deny()) return this;
consoleFilBox.Text_(v.Xto_api());
consoleBox.Text_(Io_mgr._.LoadFilStr(v));
consoleBox.Text_(Io_mgr.I.LoadFilStr(v));
}
else return win.Invk(ctx, ikey, k, m);
return this;

View File

@@ -21,13 +21,13 @@ class GfuiFocusOrderer {
public static void OrderByX(GfuiElem owner) {Order(owner, xcomparer, 0);}
public static void OrderByY(GfuiElem owner) {Order(owner, ycomparer, 0);}
static int Order(GfuiElem owner, ComparerAble comparer, int order) {
ListAdp list = ListAdp_.new_();
List_adp list = List_adp_.new_();
for (int i = 0; i < owner.SubElems().Count(); i++) {
GfuiElem sub = (GfuiElem)owner.SubElems().FetchAt(i);
GfuiElem sub = (GfuiElem)owner.SubElems().Get_at(i);
if (sub.Focus_idx() != NullVal) continue;
list.Add(sub);
}
list.SortBy(comparer);
list.Sort_by(comparer);
for (Object subObj : list) {
GfuiElem sub = (GfuiElem)subObj;

View File

@@ -23,21 +23,21 @@ class GfuiFocusXferBnd implements InjectAble, GfoInvkAble {
IptBnd_.cmd_to_(IptCfg_.Null, elem, this, Invk_FocusPrev, IptKey_.Up);
}
@gplx.Internal protected void Focus(GfuiElem cur, boolean fwd) {
ListAdp allElemsInOwnerWin = ListAdp_.new_(); AddSubs(cur.OwnerWin(), allElemsInOwnerWin);
int curIdx = allElemsInOwnerWin.IndexOf(cur);
List_adp allElemsInOwnerWin = List_adp_.new_(); AddSubs(cur.OwnerWin(), allElemsInOwnerWin);
int curIdx = allElemsInOwnerWin.Idx_of(cur);
GfuiElem target = cur;
while (true) { // find next visible elem
int cycle = TabBox_.Cycle(fwd, curIdx, allElemsInOwnerWin.Count());
target = GfuiElem_.cast_(allElemsInOwnerWin.FetchAt(cycle));
target = GfuiElem_.cast_(allElemsInOwnerWin.Get_at(cycle));
if (target.Visible()) break;
if (cycle == curIdx) break; // either (a) one elem in allElemsInOwnerWin or (b) n elems, and cycled back to start; break, else infinite loop
curIdx = cycle;
}
target.Focus();
}
void AddSubs(GfuiElem owner, ListAdp allElemsInOwnerWin) {
void AddSubs(GfuiElem owner, List_adp allElemsInOwnerWin) {
for (int i = 0; i < owner.SubElems().Count(); i++) {
GfuiElemBase sub = (GfuiElemBase)owner.SubElems().FetchAt(i);
GfuiElemBase sub = (GfuiElemBase)owner.SubElems().Get_at(i);
if (sub.Click_able()) allElemsInOwnerWin.Add(sub);
AddSubs(sub, allElemsInOwnerWin);
}

View File

@@ -133,7 +133,7 @@ public class GfuiMenuBar implements GfoInvkAble {
IptBnd_.cmd_to_(GfuiEnv_.IptBndMgr_win, win, this, Invk_visible_toggle, IptKey_.add_(IptKey_.Ctrl, IptKey_.Shift, IptKey_.F12));
win.SubItms_add(SubItms_key, this);
}
HashAdp itms = HashAdp_.new_(); GfuiWin win;
Hash_adp itms = Hash_adp_.new_(); GfuiWin win;
public static final String SubItms_key = "menuBar";
public static GfuiMenuBar new_(GfuiWin win) {
GfuiMenuBar rv = new GfuiMenuBar();
@@ -242,10 +242,10 @@ class GfuiMenuBarItmType {
public String Name() {return name;} private String name;
GfuiMenuBarItmType(int v, String n) {val = v; name = n; regy.Add(n, this);}
public static GfuiMenuBarItmType parse_(String raw) {
try {return (GfuiMenuBarItmType)regy.Fetch(raw);}
try {return (GfuiMenuBarItmType)regy.Get_by(raw);}
catch (Exception e) {Err_.Noop(e); throw Err_.parse_("GfuiMenuBarItmType", raw);}
}
static HashAdp regy = HashAdp_.new_();
static Hash_adp regy = Hash_adp_.new_();
public static final GfuiMenuBarItmType Root = new GfuiMenuBarItmType(1, "root");
public static final GfuiMenuBarItmType Top = new GfuiMenuBarItmType(2, "top");
public static final GfuiMenuBarItmType Mnu = new GfuiMenuBarItmType(3, "mnu");

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
import java.awt.Window;
public class GfuiWin extends GfuiElemBase {
private GxwWin win; private ListAdp loadList = ListAdp_.new_();
private GxwWin win; private List_adp loadList = List_adp_.new_();
public void Show() {win.ShowWin();}
public void Hide() {win.HideWin();}
public void Close() {win.CloseWin();}

View File

@@ -20,7 +20,7 @@ import java.awt.Component;
import java.awt.Container;
import java.awt.FocusTraversalPolicy;
public class GfuiWinFocusMgr {
public ListAdp SubElems() {return subElems;} ListAdp subElems = ListAdp_.new_();
public List_adp SubElems() {return subElems;} List_adp subElems = List_adp_.new_();
public void InitForm() {this.Init(win);}
public void Init(GfuiWin win) {
subElems.Clear();
@@ -28,7 +28,7 @@ public class GfuiWinFocusMgr {
}
int InitRecursive(GfuiElem owner, int focusIdx) {
for (int i = 0; i < owner.SubElems().Count(); i++) {
GfuiElem sub = (GfuiElem)owner.SubElems().FetchAt(i);
GfuiElem sub = (GfuiElem)owner.SubElems().Get_at(i);
if (sub.Focus_able()) {
sub.Focus_idx_(focusIdx++);
subElems.Add(sub);
@@ -39,9 +39,9 @@ public class GfuiWinFocusMgr {
}
public GfuiElem Focus(boolean fwd, int cur) {
int nxt = fwd
? cur == subElems.LastIndex() ? 0 : ++cur
: cur == 0 ? subElems.LastIndex() : --cur;
GfuiElem elm = (GfuiElem)subElems.FetchAt(nxt);
? cur == subElems.Idx_last() ? 0 : ++cur
: cur == 0 ? subElems.Idx_last() : --cur;
GfuiElem elm = (GfuiElem)subElems.Get_at(nxt);
elm.Focus();
return elm;
}
@@ -53,7 +53,7 @@ public class GfuiWinFocusMgr {
} GfuiWinFocusMgr() {}
}
class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
ListAdp elems; GfuiWinFocusMgr formFocusMgr;
List_adp elems; GfuiWinFocusMgr formFocusMgr;
public FocusTraversalPolicy_cls_base(GfuiWinFocusMgr formFocusMgr) {
this.elems = formFocusMgr.subElems;
this.formFocusMgr = formFocusMgr;
@@ -70,7 +70,7 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
if (idx == elems.Count())
idx = 0;
GfuiElem elem = null;
try {elem = (GfuiElem)elems.FetchAt(idx);}
try {elem = (GfuiElem)elems.Get_at(idx);}
catch (Exception e) {
System.out.println(idx);
Err_.Noop(e);
@@ -97,10 +97,10 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
while (true) {
idx--;
if (idx == -1)
idx = elems.Count() - ListAdp_.Base1;
idx = elems.Count() - List_adp_.Base1;
GfuiElem elem = null;
try {
elem = (GfuiElem)elems.FetchAt(idx);
elem = (GfuiElem)elems.Get_at(idx);
// System.out.println(elem.Key_of_GfuiElem() + " " + elem.Focus_able() + " " + elem.Visible());
if (elem.getClass().getName().equals("gplx.gfds.gbu.GbuGrid") && elem.Key_of_GfuiElem().equals("grid0")) {
System.out.println(elem.Key_of_GfuiElem() + " " + elem.Focus_able() + " " + elem.Visible());
@@ -127,7 +127,7 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
public Component getDefaultComponent(Container focusCycleRoot) {return getFirstComponent(focusCycleRoot);}
public Component getFirstComponent(Container focusCycleRoot) {return elems_empty() ? focusCycleRoot : (Component)FetchAt(0).UnderElem();}
public Component getLastComponent(Container focusCycleRoot) {return elems_empty() ? focusCycleRoot : (Component)FetchAt(elems.Count() - 1).UnderElem();}
GfuiElem FetchAt(int idx) {return (GfuiElem)elems.FetchAt(idx);}
GfuiElem FetchAt(int idx) {return (GfuiElem)elems.Get_at(idx);}
GxwElem GxwElemOf(Component c) {
if (GxwElem.class.isAssignableFrom(c.getClass())) return (GxwElem)c;
return (GxwElem)c.getParent(); // HACK: occurs for JComboBox when editable is true; focus is on MetalComboBox, with parent of JComboBox

View File

@@ -16,9 +16,9 @@ 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.gfui; import gplx.*;
import gplx.lists.*; /*HashAdp_list*/
import gplx.lists.*; /*Hash_adp_list*/
class GfuiWinKeyCmdMgr implements GfuiWinOpenAble, GfoInvkAble, GfoEvObj {
private HashAdp_list listHash = HashAdp_list.new_();
private Hash_adp_list listHash = Hash_adp_list.new_();
public GfoEvMgr EvMgr() {if (evMgr == null) evMgr = GfoEvMgr.new_(this); return evMgr;} private GfoEvMgr evMgr;
public void Open_exec(GfuiWin form, GfuiElemBase owner, GfuiElemBase sub) {
int keyVal = sub.Click_key().Val(); if (sub.Click_key().Eq(IptKey_.None)) return;
@@ -32,9 +32,9 @@ class GfuiWinKeyCmdMgr implements GfuiWinOpenAble, GfoInvkAble, GfoEvObj {
if (GfuiTextBox_.as_(sender) != null // is sender textBox?
&& !Enm_.HasInt(keyVal, IptKey_.Alt.Val()) // does key not have alt
) return false; // ignore keys from textbox if they do not have alt
ListAdp elemList = (ListAdp)listHash.Fetch(keyVal); if (elemList == null) return false;
List_adp elemList = (List_adp)listHash.Get_by(keyVal); if (elemList == null) return false;
for (int i = 0; i < elemList.Count(); i++) {
GfuiElem elem = (GfuiElem)elemList.FetchAt(i);
GfuiElem elem = (GfuiElem)elemList.Get_at(i);
if (elem.Visible())
elem.Click();
}

View File

@@ -48,9 +48,9 @@ public class GfuiWin_ {
}
}
class GfuiWinUtl {
@gplx.Internal protected static void Open_exec(GfuiWin win, ListAdp loadList, GfuiElemBase owner) {
@gplx.Internal protected static void Open_exec(GfuiWin win, List_adp loadList, GfuiElemBase owner) {
for (int i = 0; i < owner.SubElems().Count(); i++) {
GfuiElemBase sub = (GfuiElemBase)owner.SubElems().FetchAt(i);
GfuiElemBase sub = (GfuiElemBase)owner.SubElems().Get_at(i);
sub.OwnerWin_(win);
for (Object itmObj : loadList) {
GfuiWinOpenAble itm = (GfuiWinOpenAble)itmObj;
@@ -61,7 +61,7 @@ class GfuiWinUtl {
}
@gplx.Internal protected static void SubElems_dispose(GfuiElem owner) {
for (int i = 0; i < owner.SubElems().Count(); i++) {
GfuiElem sub = (GfuiElem)owner.SubElems().FetchAt(i);
GfuiElem sub = (GfuiElem)owner.SubElems().Get_at(i);
sub.Dispose();
SubElems_dispose(sub);
}

View File

@@ -48,7 +48,7 @@ public class GfuiElemBase implements GfuiElem {
public void Lyt_exec() {
GftItem[] ary = new GftItem[subElems.Count()];
for (int i = 0; i < ary.length; i++)
ary[i] = (GfuiElemBase)subElems.FetchAt(i);
ary[i] = (GfuiElemBase)subElems.Get_at(i);
SizeChanged_ignore = true;
lyt.Exec(this, ary);
SizeChanged_ignore = false;
@@ -99,12 +99,12 @@ public class GfuiElemBase implements GfuiElem {
if (subElems.Count() == 0) // if no subs, focus self
underElem.Core().Focus();
else if (defaultFocusKey != null) { // if default is specified, focus it
GfuiElem focusTarget = subElems.Fetch(defaultFocusKey); if (focusTarget == null) throw Err_.new_("could not find defaultTarget for focus").Add("ownerKey", this.Key_of_GfuiElem()).Add("defaultTarget", defaultFocusKey);
GfuiElem focusTarget = subElems.Get_by(defaultFocusKey); if (focusTarget == null) throw Err_.new_("could not find defaultTarget for focus").Add("ownerKey", this.Key_of_GfuiElem()).Add("defaultTarget", defaultFocusKey);
focusTarget.Focus();
}
else { // else, activate first visible elem; NOTE: some elems are visible, but not Focus_able (ex: ImgGalleryBox)
for (int i = 0; i < subElems.Count(); i++) {
GfuiElem sub = subElems.FetchAt(i);
GfuiElem sub = subElems.Get_at(i);
if (sub.Visible() && !String_.Eq(sub.Key_of_GfuiElem(), "statusBox")) {
sub.Focus();
return;
@@ -138,7 +138,7 @@ public class GfuiElemBase implements GfuiElem {
@gplx.Virtual public boolean Opened_done() {return ownerForm == null ? false : ownerForm.Opened_done();}
@gplx.Virtual public void Opened_cbk() {
for (int i = 0; i < subElems.Count(); i++) {
GfuiElem elem = subElems.FetchAt(i);
GfuiElem elem = subElems.Get_at(i);
elem.Opened_cbk();
}
}
@@ -238,7 +238,7 @@ public class GfuiElemBase implements GfuiElem {
if (ctx.Help_browseMode()) {
String_bldr sb = String_bldr_.new_();
for (int i = 0; i < this.SubElems().Count(); i++) {
GfuiElem subE = (GfuiElem)this.SubElems().FetchAt(i);
GfuiElem subE = (GfuiElem)this.SubElems().Get_at(i);
sb.Add_str_w_crlf(subE.Key_of_GfuiElem());
}
return sb.XtoStr();
@@ -247,8 +247,8 @@ public class GfuiElemBase implements GfuiElem {
Object rv = this.InvkMgr().Invk(ctx, ikey, k, m, this);
if (rv != GfoInvkAble_.Rv_unhandled) return rv;
Object findObj = injected.Fetch(k);
if (findObj == null) findObj = this.subElems.Fetch(k);
Object findObj = injected.Get_by(k);
if (findObj == null) findObj = this.subElems.Get_by(k);
if (findObj == null) return GfoInvkAble_.Rv_unhandled;
return findObj; // necessary for gplx.images
}
@@ -283,10 +283,10 @@ public class GfuiElemBase implements GfuiElem {
// underMgr.Size_set(SizeAdp_.new_(20, 20)); // NOTE: CS inits to 20,20; JAVA inits to 0,0
}
@gplx.Virtual public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_._.control_();}
public Object SubItms_getObj(String key) {return injected.Fetch(key);}
public Object SubItms_getObj(String key) {return injected.Get_by(key);}
public GfuiElemBase SubItms_add(String key, Object v) {injected.Add(key, v); return this;}
public OrderedHash XtnAtrs() {return xtnAtrs;} OrderedHash xtnAtrs = OrderedHash_.new_();
HashAdp injected = HashAdp_.new_();
public Ordered_hash XtnAtrs() {return xtnAtrs;} Ordered_hash xtnAtrs = Ordered_hash_.new_();
Hash_adp injected = Hash_adp_.new_();
GxwCore_base underMgr;
@gplx.Internal protected static boolean SizeChanged_ignore = false;
}

View File

@@ -18,16 +18,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public class GfuiElemList {
public int Count() {return hash.Count();}
public GfuiElem FetchAt(int idx) {return (GfuiElem)hash.FetchAt(idx);}
public GfuiElem Fetch(String key) {return (GfuiElem)hash.Fetch(key);}
public GfuiElem Get_at(int idx) {return (GfuiElem)hash.Get_at(idx);}
public GfuiElem Get_by(String key) {return (GfuiElem)hash.Get_by(key);}
public void Add(GfuiElem box) {Add_exec(box);}
public void DelOrFail(GfuiElem box) {Del_exec(box);}
public void DelAt(int idx) {Del_exec(FetchAt(idx));}
public int IndexOfA(GfuiElem box) {return hash.IndexOf(box);}
public void MoveTo(int src, int trg) {hash.MoveTo(src, trg);}
public void Del_at(int idx) {Del_exec(Get_at(idx));}
public int IndexOfA(GfuiElem box) {return hash.Idx_of(box);}
public void Move_to(int src, int trg) {hash.Move_to(src, trg);}
public void Clear() {
for (int i = 0; i < this.Count(); i++)
Del_exec(this.FetchAt(i));
Del_exec(this.Get_at(i));
hash.Clear();
}
void Add_exec(GfuiElem box) {
@@ -44,7 +44,7 @@ public class GfuiElemList {
owner.IptBnds().Cfgs_delAll();
box.Dispose();
}
GfuiElem owner; OrderedHash hash = OrderedHash_.new_();
GfuiElem owner; Ordered_hash hash = Ordered_hash_.new_();
public static GfuiElemList new_(GfuiElem owner) {
GfuiElemList rv = new GfuiElemList();
rv.owner = owner;

View File

@@ -19,7 +19,7 @@ package gplx.gfui; import gplx.*;
public class GfuiLbl extends GfuiElemBase { // standard label does not support tooltips
@Override public void Click() {
int focusOrder = this.OwnerElem().SubElems().IndexOfA(this);
GfuiElem focusNext = this.OwnerElem().SubElems().FetchAt(focusOrder + 1); // FIXME: incorporate into new FocusOrder
GfuiElem focusNext = this.OwnerElem().SubElems().Get_at(focusOrder + 1); // FIXME: incorporate into new FocusOrder
focusNext.Focus();
}
@Override public boolean PaintCbk(PaintArgs args) {

View File

@@ -49,11 +49,11 @@ public class Gfui_html_cfg implements GfoInvkAble {
public String Window_vpos_(String node_path, String scroll_top) {return Exec_fmt(fmtr_window_vpos_, node_path, scroll_top);} private Bry_fmtr fmtr_window_vpos_ = Bry_fmtr.keys_("node_path", "scroll_top");
public String Window_print_preview() {return Exec_fmt(fmtr_window_print_preview);} private Bry_fmtr fmtr_window_print_preview = Bry_fmtr.keys_();
public String Active_atr_get_str(String atr_key) {return Exec_fmt(fmtr_active_atr_get, atr_key);} private Bry_fmtr fmtr_active_atr_get = Bry_fmtr.keys_("atr_key");
public Bry_fmtr Js_scripts_get(String name) {return (Bry_fmtr)js_scripts.Fetch(name);}
public Bry_fmtr Js_scripts_get(String name) {return (Bry_fmtr)js_scripts.Get_by(name);}
private void Js_scripts_add(String name, String text) {
Bry_fmtr fmtr = Bry_fmtr.new_(text);
js_scripts.AddReplace(name, fmtr);
} private OrderedHash js_scripts = OrderedHash_.new_();
js_scripts.Add_if_dupe_use_nth(name, fmtr);
} private Ordered_hash js_scripts = Ordered_hash_.new_();
private String Exec_fmt(Bry_fmtr fmtr, String... vals) {
if (debug_file != null) GfsCore._.ExecFile(debug_file);
return fmtr.Bld_str_many(vals);

View File

@@ -24,8 +24,8 @@ public class GfuiCheckListBox extends GfuiElemBase {
public void Items_setAll(boolean v) {checkListBox.Items_setAll(v);}
public void Items_clear() {checkListBox.Items_clear();}
public void Items_add(Object item, boolean v) {checkListBox.Items_add(item, v);}
public ListAdp Items_getAll() {return checkListBox.Items_getAll();}
public ListAdp Items_getChecked() {return checkListBox.Items_getChecked();}
public List_adp Items_getAll() {return checkListBox.Items_getAll();}
public List_adp Items_getChecked() {return checkListBox.Items_getChecked();}
GxwCheckListBox checkListBox;
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return new GxwCheckListBox_lang();}

View File

@@ -30,8 +30,8 @@ public class GfuiCheckListPanel extends GfuiElemBase {
}
public void Items_clear() {listBox.Items_clear();}
public void Items_add(Object item, boolean checkBoxState) {listBox.Items_add(item, checkBoxState);}
public ListAdp Items_getAll() {return listBox.Items_getAll();}
public ListAdp Items_getChecked() {return listBox.Items_getChecked();}
public List_adp Items_getAll() {return listBox.Items_getAll();}
public List_adp Items_getChecked() {return listBox.Items_getChecked();}
public void SetAllCheckStates(boolean v) {
listBox.Items_setAll(v);
}

View File

@@ -21,23 +21,23 @@ import java.awt.FileDialog;
import javax.swing.JFrame;
public class GfuiIoDialogUtl {
public static Io_url SelectDir() {return SelectDir(Io_url_.Null);}
public static Io_url SelectDir() {return SelectDir(Io_url_.Empty);}
public static Io_url SelectDir(Io_url startingDir) {
FileDialog openFileDialog = NewOpenFileDialog(startingDir);
// openFileDialog.FileName = @"press enter to select this folder";
openFileDialog.setVisible(true);
String selectedDir = openFileDialog.getDirectory();
if (selectedDir == null) return Io_url_.Null; // nothing selected
if (selectedDir == null) return Io_url_.Empty; // nothing selected
Io_url selected = Io_url_.new_any_(selectedDir);
Io_url selectedFil = selected.GenSubFil(openFileDialog.getFile());
return selectedFil.OwnerDir();
}
public static Io_url SelectFile() {return SelectFile(Io_url_.Null);}
public static Io_url SelectFile() {return SelectFile(Io_url_.Empty);}
public static Io_url SelectFile(Io_url startingDir) {
FileDialog openFileDialog = NewOpenFileDialog(startingDir);
openFileDialog.setVisible(true);
String selectedDir = openFileDialog.getDirectory();
if (selectedDir == null) return Io_url_.Null; // nothing selected
if (selectedDir == null) return Io_url_.Empty; // nothing selected
Io_url selected = Io_url_.new_any_(selectedDir);
Io_url selectedFil = selected.GenSubFil(openFileDialog.getFile());
return selectedFil;

View File

@@ -30,7 +30,7 @@ public abstract class GfuiIoUrlSelectBox extends GfuiElemBase {
public GfuiLbl Label() {return label;} GfuiLbl label;
public Io_url Url() {return Io_url_.new_any_(pathBox.TextMgr().Val());}
public Io_url StartingFolder() {return startingFolder;}
public void StartingFolder_set(Io_url v) {this.startingFolder = v;} Io_url startingFolder = Io_url_.Null;
public void StartingFolder_set(Io_url v) {this.startingFolder = v;} Io_url startingFolder = Io_url_.Empty;
@Override public void Focus() {pathBox.Focus();}
void SelectAction() {

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.gfui; import gplx.*;
public class GfuiMoveElemBnd implements IptBnd, GfoInvkAble, InjectAble {
public String Key() {return "gplx.gfui.moveWidget";}
public ListAdp Ipts() {return args;} ListAdp args = ListAdp_.new_();
public List_adp Ipts() {return args;} List_adp args = List_adp_.new_();
public IptEventType EventTypes() {return IptEventType_.add_(IptEventType_.KeyDown, IptEventType_.MouseDown, IptEventType_.MouseMove, IptEventType_.MouseUp);}
public void Exec(IptEventData iptData) {
int val = iptData.EventType().Val();
@@ -55,17 +55,17 @@ public class GfuiMoveElemBnd implements IptBnd, GfoInvkAble, InjectAble {
}
void ExecKeyDown(IptEventData msg) {
PointAdp current = targetElem.Pos();
PointAdp offset = PointAdp_.cast_(hash.Fetch(msg.EventArg()));
PointAdp offset = PointAdp_.cast_(hash.Get_by(msg.EventArg()));
targetElem.Pos_(current.Op_add(offset));
}
@gplx.Internal protected void Key_set(String key) {this.key = key;} private String key;
public Object Srl(GfoMsg owner) {return IptBnd_.Srl(owner, this);}
boolean moving = false;
PointAdp anchor = PointAdp_.Zero; HashAdp hash = HashAdp_.new_();
PointAdp anchor = PointAdp_.Zero; Hash_adp hash = Hash_adp_.new_();
public static GfuiMoveElemBnd new_() {return new GfuiMoveElemBnd();}
GfuiMoveElemBnd() {
args.AddMany(IptMouseBtn_.Left, IptMouseMove.AnyDirection);
args.Add_many(IptMouseBtn_.Left, IptMouseMove.AnyDirection);
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Up), PointAdp_.new_(0, -10));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Down), PointAdp_.new_(0, 10));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Left), PointAdp_.new_(-10, 0));
@@ -73,7 +73,7 @@ public class GfuiMoveElemBnd implements IptBnd, GfoInvkAble, InjectAble {
}
}
class IptBndArgsBldr {
public static void AddWithData(ListAdp list, HashAdp hash, IptArg arg, Object data) {
public static void AddWithData(List_adp list, Hash_adp hash, IptArg arg, Object data) {
list.Add(arg);
hash.Add(arg, data);
}

View File

@@ -37,7 +37,7 @@ public class GfuiMoveElemBtn extends GfuiBtn { @Override public GxwElem UnderEl
}
class GfuiResizeFormBnd implements IptBnd {
public String Key() {return "gplx.gfui.resizeForm";}
public ListAdp Ipts() {return args;} ListAdp args = ListAdp_.new_();
public List_adp Ipts() {return args;} List_adp args = List_adp_.new_();
public IptEventType EventTypes() {return IptEventType_.KeyDown.Add(IptEventType_.MouseDown).Add(IptEventType_.MouseUp).Add(IptEventType_.MouseMove);}
public void Exec(IptEventData iptData) {
int val = iptData.EventType().Val();
@@ -61,7 +61,7 @@ class GfuiResizeFormBnd implements IptBnd {
active = false;
}
void ExecKeyDown(IptEventData iptData) {
SizeAdp deltaSize = (SizeAdp)hash.Fetch(iptData.EventArg());
SizeAdp deltaSize = (SizeAdp)hash.Get_by(iptData.EventArg());
ResizeForm(iptData.Sender(), deltaSize);
}
void ResizeForm(GfuiElem elem, SizeAdp deltaSize) {
@@ -75,10 +75,10 @@ class GfuiResizeFormBnd implements IptBnd {
static SizeAdp Op_add(SizeAdp lhs, SizeAdp rhs) {return SizeAdp_.new_(lhs.Width() + rhs.Width(), lhs.Height() + rhs.Height());}
public Object Srl(GfoMsg owner) {return IptBnd_.Srl(owner, this);}
boolean active = false; PointAdp lastPos = PointAdp_.Zero; HashAdp hash = HashAdp_.new_();
boolean active = false; PointAdp lastPos = PointAdp_.Zero; Hash_adp hash = Hash_adp_.new_();
public static GfuiResizeFormBnd new_() {return new GfuiResizeFormBnd();}
GfuiResizeFormBnd() {
args.AddMany(IptMouseBtn_.Right, IptMouseMove.AnyDirection);
args.Add_many(IptMouseBtn_.Right, IptMouseMove.AnyDirection);
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Shift).Add(IptKey_.Up), SizeAdp_.new_(0, -10));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Shift).Add(IptKey_.Down), SizeAdp_.new_(0, 10));
IptBndArgsBldr.AddWithData(args, hash, IptKey_.Ctrl.Add(IptKey_.Shift).Add(IptKey_.Left), SizeAdp_.new_(-10, 0));

View File

@@ -23,7 +23,7 @@ class TabBoxEvt_nameChange {
}
public static void Rcvd(TabBox tabBox, GfsCtx ctx, GfoMsg m) {
TabPnlItm itm = (TabPnlItm)m.CastObj("v");
GfuiBtn btn = GfuiBtn_.as_(tabBox.BtnBox().SubElems().Fetch(itm.Key()));
GfuiBtn btn = GfuiBtn_.as_(tabBox.BtnBox().SubElems().Get_by(itm.Key()));
if (btn != null) // HACK: check needed b/c Gfds will raise UpdateCaption event before Creating tab
btn.Text_(itm.Name()).TipText_(itm.Name());
}
@@ -34,7 +34,7 @@ class TabBoxEvt_tabSelectByBtn {
GfuiBtn btn = (GfuiBtn)sender;
String key = btn.Key_of_GfuiElem();
TabBoxMgr mgr = tabBox.Mgr();
mgr.Select(mgr.Fetch(key));
mgr.Select(mgr.Get_by(key));
}
}
class TabBnd_selectTab implements InjectAble, GfoInvkAble {
@@ -64,14 +64,14 @@ class TabBnd_reorderTab implements InjectAble, GfoInvkAble {
IptBnd_.cmd_to_(IptCfg_.Null, btn, this, MoveNext_cmd, IptKey_.add_(IptKey_.Ctrl, IptKey_.Right));
}
@gplx.Internal protected void MoveTab(GfuiBtn curBtn, int delta) {
TabPnlItm curItm = tabBox.Mgr().Fetch(curBtn.Key_of_GfuiElem());
TabPnlItm curItm = tabBox.Mgr().Get_by(curBtn.Key_of_GfuiElem());
int curIdx = curItm.Idx();
int newIdx = TabBox_.Cycle(delta > 0, curIdx, tabBox.Mgr().Count());
tabBox.Mgr().MoveTo(curIdx, newIdx);
tabBox.Mgr().Move_to(curIdx, newIdx);
tabBox.Mgr().Reorder(0); // reorder all; exchanging curIdx for newIdx does not work when going from last to first (17 -> 0, but 0 -> 1)
tabBox.PnlBox().SubElems().MoveTo(curIdx, newIdx);
TabBtnAreaMgr.MoveTo(tabBox, curIdx, newIdx);
tabBox.PnlBox().SubElems().Move_to(curIdx, newIdx);
TabBtnAreaMgr.Move_to(tabBox, curIdx, newIdx);
TabBoxEvt_orderChanged.Publish(tabBox, curIdx, newIdx);
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {

View File

@@ -19,8 +19,8 @@ package gplx.gfui; import gplx.*;
public class TabBox extends GfuiElemBase {
public int Tabs_Count() {return mgr.Count();}
public TabPnlItm Tabs_SelectedItm() {return mgr.CurTab();}
public GfuiElem Tabs_FetchAt(int i) {return pnlBox.SubElems().Fetch(mgr.FetchAt(i).Key());}
public GfuiElem Tabs_SelectedPnl() {return pnlBox.SubElems().Fetch(mgr.CurTab().Key());}
public GfuiElem Tabs_FetchAt(int i) {return pnlBox.SubElems().Get_by(mgr.Get_at(i).Key());}
public GfuiElem Tabs_SelectedPnl() {return pnlBox.SubElems().Get_by(mgr.CurTab().Key());}
public void Tabs_Select(int idx) {mgr.Select(idx);}
public GfuiElem Tabs_Add(String key, String name) {
TabPnlItm newTab = mgr.Add(key, name);
@@ -30,9 +30,9 @@ public class TabBox extends GfuiElemBase {
return pnl;
}
public void Tabs_DelAt(int idx) {
TabBtnAreaMgr.Del(this, mgr.FetchAt(idx));
TabPnlAreaMgr.Del(this, mgr.FetchAt(idx));
mgr.DelAt(idx);
TabBtnAreaMgr.Del(this, mgr.Get_at(idx));
TabPnlAreaMgr.Del(this, mgr.Get_at(idx));
mgr.Del_at(idx);
}
@gplx.Internal protected TabBoxMgr Mgr() {return mgr;} TabBoxMgr mgr = TabBoxMgr.new_();
@gplx.Internal protected GfuiElem BtnBox() {return btnBox;} GfuiElem btnBox;
@@ -72,7 +72,7 @@ class TabBtnAreaMgr {
btn.Click_invk(GfoInvkAbleCmd.new_(tabBox, TabBoxEvt_tabSelectByBtn.Key));
btn.Inject_(TabBnd_reorderTab.new_(tabBox));
if (btnBox.SubElems().Count() > 0) { // place button after last
GfuiElem lastBtn = btnBox.SubElems().FetchAt(btnBox.SubElems().Count() - 1);
GfuiElem lastBtn = btnBox.SubElems().Get_at(btnBox.SubElems().Count() - 1);
btn.X_(lastBtn.X() + lastBtn.Width());
}
btnBox.SubElems().Add(btn);
@@ -81,27 +81,27 @@ class TabBtnAreaMgr {
public static void Del(TabBox tabBox, TabPnlItm itm) {
GfuiElem btnBox = tabBox.BtnBox();
int idx = itm.Idx();
GfuiBtn btn = (GfuiBtn)btnBox.SubElems().FetchAt(idx);
btnBox.SubElems().DelAt(idx);
GfuiBtn btn = (GfuiBtn)btnBox.SubElems().Get_at(idx);
btnBox.SubElems().Del_at(idx);
for (int i = idx; i < btnBox.SubElems().Count(); i++) {
GfuiBtn cur = (GfuiBtn)btnBox.SubElems().FetchAt(i);
GfuiBtn cur = (GfuiBtn)btnBox.SubElems().Get_at(i);
cur.X_(cur.X() - btn.Width());
}
}
public static void Select(TabBox tabBox, TabPnlItm curTabItm, TabPnlItm newTabItm) {
if (curTabItm != null) {
GfuiBtn curBtn = (GfuiBtn)tabBox.BtnBox().SubElems().FetchAt(curTabItm.Idx());
GfuiBtn curBtn = (GfuiBtn)tabBox.BtnBox().SubElems().Get_at(curTabItm.Idx());
Select(curBtn, false);
}
GfuiBtn newBtn = (GfuiBtn)tabBox.BtnBox().SubElems().FetchAt(newTabItm.Idx());
GfuiBtn newBtn = (GfuiBtn)tabBox.BtnBox().SubElems().Get_at(newTabItm.Idx());
Select(newBtn, true);
}
public static void MoveTo(TabBox tabBox, int curIdx, int newIdx) {
public static void Move_to(TabBox tabBox, int curIdx, int newIdx) {
GfuiElemList btns = tabBox.BtnBox().SubElems();
btns.MoveTo(curIdx, newIdx);
btns.Move_to(curIdx, newIdx);
int curX = 0;
for (int i = 0; i < btns.Count(); i++) {
GfuiBtn cur = (GfuiBtn)btns.FetchAt(i);
GfuiBtn cur = (GfuiBtn)btns.Get_at(i);
cur.X_(curX);
curX += cur.Width();
}
@@ -129,15 +129,15 @@ class TabPnlAreaMgr {
return pnl;
}
public static void Del(TabBox tabBox, TabPnlItm itm) {
tabBox.PnlBox().SubElems().DelAt(itm.Idx());
((GfuiElemBase)tabBox.PnlBox()).Lyt().SubLyts().DelAt(itm.Idx());
tabBox.PnlBox().SubElems().Del_at(itm.Idx());
((GfuiElemBase)tabBox.PnlBox()).Lyt().SubLyts().Del_at(itm.Idx());
}
public static void Select(TabBox tabBox, TabPnlItm curTabItm, TabPnlItm newTabItm) {
if (curTabItm != null) {
GfuiElem curTab = tabBox.PnlBox().SubElems().FetchAt(curTabItm.Idx());
GfuiElem curTab = tabBox.PnlBox().SubElems().Get_at(curTabItm.Idx());
curTab.Visible_set(false);
}
GfuiElem newTab = tabBox.PnlBox().SubElems().FetchAt(newTabItm.Idx());
GfuiElem newTab = tabBox.PnlBox().SubElems().Get_at(newTabItm.Idx());
newTab.Visible_set(true);
newTab.Zorder_front();
newTab.Focus();

View File

@@ -19,17 +19,17 @@ package gplx.gfui; import gplx.*;
public class TabBoxMgr implements GfoEvMgrOwner {
public GfoEvMgr EvMgr() {if (evMgr == null) evMgr = GfoEvMgr.new_(this); return evMgr;} GfoEvMgr evMgr;
public int Count() {return itms.Count();}
public TabPnlItm Fetch(String k) {return (TabPnlItm)itms.Fetch(k);}
public TabPnlItm FetchAt(int i) {return (TabPnlItm)itms.FetchAt(i);}
public TabPnlItm Get_by(String k) {return (TabPnlItm)itms.Get_by(k);}
public TabPnlItm Get_at(int i) {return (TabPnlItm)itms.Get_at(i);}
public TabPnlItm CurTab() {return curTab;} TabPnlItm curTab;
public TabPnlItm Add(String key, String name) {
TabPnlItm itm = TabPnlItm.new_(this, key).Name_(name).Idx_(itms.Count());
itms.Add(itm.Key(), itm);
return itm;
}
public void DelAt(int i) {
public void Del_at(int i) {
boolean isCur = i == curTab.Idx(), isLast = i == itms.Count() - 1;
TabPnlItm itm = this.FetchAt(i);
TabPnlItm itm = this.Get_at(i);
itms.Del(itm.Key());
this.Reorder(i);
if (isCur) {
@@ -39,11 +39,11 @@ public class TabBoxMgr implements GfoEvMgrOwner {
this.Select(i);
}
}
public void Select(int i) {Select((TabPnlItm)itms.FetchAt(i));}
@gplx.Internal protected void MoveTo(int src, int trg) {itms.MoveTo(src, trg);}
public void Select(int i) {Select((TabPnlItm)itms.Get_at(i));}
@gplx.Internal protected void Move_to(int src, int trg) {itms.Move_to(src, trg);}
@gplx.Internal protected void Reorder(int bgn) {
for (int i = bgn; i < itms.Count(); i++) {
TabPnlItm itm = (TabPnlItm)itms.FetchAt(i);
TabPnlItm itm = (TabPnlItm)itms.Get_at(i);
itm.Idx_(i);
}
}
@@ -52,6 +52,6 @@ public class TabBoxMgr implements GfoEvMgrOwner {
curTab = newTab;
TabBoxEvt_tabSelect.Send(this, oldTab, newTab);
}
OrderedHash itms = OrderedHash_.new_();
Ordered_hash itms = Ordered_hash_.new_();
@gplx.Internal protected static TabBoxMgr new_() {return new TabBoxMgr();} TabBoxMgr() {}
}

View File

@@ -24,7 +24,7 @@ import java.net.URL;
public class IconAdp {
public Icon UnderIcon() {return icon;} final Icon icon;
public Image XtoImage() {return ((ImageIcon)icon).getImage();}
public Io_url Url() {return url;} Io_url url = Io_url_.Null;
public Io_url Url() {return url;} Io_url url = Io_url_.Empty;
IconAdp(Icon icon) {this.icon = icon;}
public static IconAdp new_(Icon icon) {return new IconAdp(icon);}
public static IconAdp file_(Io_url url) {

View File

@@ -42,9 +42,9 @@ class ImageAdp_txt implements ImageAdp {
public void Rls() {disposed = true;}
public void SaveAsBmp(Io_url url) {SaveAs(url, ".bmp");}
public void SaveAsPng(Io_url url) {SaveAs(url, ".png");}
void SaveAs(Io_url url, String ext) {Io_mgr._.SaveFilStr(url.GenNewExt(ext), size.XtoStr());}
void SaveAs(Io_url url, String ext) {Io_mgr.I.SaveFilStr(url.GenNewExt(ext), size.XtoStr());}
public ImageAdp Extract_image(RectAdp src_rect, SizeAdp trg_size) {return Extract_image(src_rect.X(), src_rect.Y(), src_rect.Width(), src_rect.Height(), trg_size.Width(), trg_size.Height());}
public ImageAdp Extract_image(int src_x, int src_y, int src_w, int src_h, int trg_w, int trg_h) {return ImageAdp_.txt_mem_(Io_url_.Null, SizeAdp_.new_(trg_w, trg_h));}
public ImageAdp Resize(int width, int height) {return ImageAdp_.txt_mem_(Io_url_.Null, SizeAdp_.new_(width, height));}
public ImageAdp Extract_image(int src_x, int src_y, int src_w, int src_h, int trg_w, int trg_h) {return ImageAdp_.txt_mem_(Io_url_.Empty, SizeAdp_.new_(trg_w, trg_h));}
public ImageAdp Resize(int width, int height) {return ImageAdp_.txt_mem_(Io_url_.Empty, SizeAdp_.new_(width, height));}
public ImageAdp_txt(Io_url url, SizeAdp size) {this.url = url; this.size = size;}
}

View File

@@ -40,7 +40,7 @@ public class ImageAdp_ {
}
public static ImageAdp txt_mem_(Io_url url, SizeAdp size) {return new ImageAdp_txt(url, size);}
public static ImageAdp txt_fil_(Io_url url) {
String raw = Io_mgr._.LoadFilStr(url);
String raw = Io_mgr.I.LoadFilStr(url);
SizeAdp size = null;
if (String_.Eq(raw, "")) size = SizeAdp_.Zero;
else if (String_.Eq(url.Ext(), ".svg")) size = SizeOf_svg(url);
@@ -51,7 +51,7 @@ public class ImageAdp_ {
public static ImageAdp file_(Io_url url) {
if (url.EqNull()) throw Err_.new_("cannot load image from null url");
if (String_.Eq(url.Info().Key(), IoUrlInfo_.Mem.Key())) return txt_fil_(url);
if (!Io_mgr._.ExistsFil(url)) return Null;
if (!Io_mgr.I.ExistsFil(url)) return Null;
BufferedImage img = null;
try {
@@ -104,7 +104,7 @@ class Gfui_svg_util {
public static SizeAdp QuerySize(Io_url url) {
try {
// NOTE: not using XmlDoc b/c invalid doctypes can cause xml to hang; <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"><!-- Created with Inkscape (http://www.inkscape.org/) --> <svg xmlns="http://www.w3.org/2000/svg"
String xml = Io_mgr._.LoadFilStr(url);
String xml = Io_mgr.I.LoadFilStr(url);
int pos = String_.FindFwd(xml, "<svg", 0); if (pos == -1) return null;
Int_obj_ref pos_ref = Int_obj_ref.new_(pos);
double w = ParseAtr(xml, pos_ref, "width");

View File

@@ -36,7 +36,7 @@ public class ImageAdp_base implements ImageAdp, RlsAble {
} SizeAdp size = null;
public int Width() {return under.getWidth(null);}
public int Height() {return under.getHeight(null);}
public Io_url Url() {return url;} public ImageAdp Url_(Io_url v) {url = v; return this;} Io_url url = Io_url_.Null;
public Io_url Url() {return url;} public ImageAdp Url_(Io_url v) {url = v; return this;} Io_url url = Io_url_.Empty;
public Object Under() {return under;} Image under;
public boolean Disposed() {return disposed;} private boolean disposed = false;
@@ -44,7 +44,7 @@ public class ImageAdp_base implements ImageAdp, RlsAble {
public void SaveAsBmp(Io_url url) {SaveAs(url, "bmp");}
public void SaveAsPng(Io_url url) {SaveAs(url, "png");}
void SaveAs(Io_url url, String fmtStr) {
Io_mgr._.CreateDirIfAbsent(url.OwnerDir());
Io_mgr.I.CreateDirIfAbsent(url.OwnerDir());
File fil = new File(url.Xto_api());
// String[] formatNames = ImageIO.getWriterFormatNames();
// for (String s : formatNames)

View File

@@ -21,7 +21,7 @@ public class ImageAdp_null implements ImageAdp {
public SizeAdp Size() {return SizeAdp_.Zero;}
public int Width() {return 0;}
public int Height() {return 0;}
public Io_url Url() {return Io_url_.Null;} public ImageAdp Url_(Io_url v) {return this;}
public Io_url Url() {return Io_url_.Empty;} public ImageAdp Url_(Io_url v) {return this;}
public Object Under() {return null;}
public boolean Disposed() {return disposed;} private boolean disposed = false;
public void Rls() {disposed = true;}

View File

@@ -61,13 +61,13 @@ public class GfuiEnv_ {
IptBndMgr_win = IptCfg_.new_("gplx.gfui.GfuiWin");
// alias default dirs
Io_mgr._.AliasDir_sysEngine("app:\\", Env_.AppUrl().OwnerDir().Raw());
Io_mgr.I.AliasDir_sysEngine("app:\\", Env_.AppUrl().OwnerDir().Raw());
GfsCore._.MsgParser_(GfoMsgParser_gfml._);
GfsCore._.AddLib(GfsLibIni_core._);
GfsCore._.AddLib(GfsLibIni_gfui._);
Io_url iniFile = Env_.AppUrl().GenSubFil(".gfs");
if (Io_mgr._.ExistsFil(iniFile))
if (Io_mgr.I.ExistsFil(iniFile))
GfsCore._.ExecFile(iniFile);
}
public static void Init_swt(String[] args, Class<?> type) {

View File

@@ -47,7 +47,7 @@ import gplx.core.threads.Thread_adp_;
import gplx.core.threads.*;
public class Swt_kit implements Gfui_kit {
private final KeyValHash ctor_args = KeyValHash.new_(); private final KeyValHash ctor_args_null = KeyValHash.new_();
private final HashAdp kit_args = HashAdp_.new_(); private Swt_msg_wkr_stop msg_wkr_stop;
private final Hash_adp kit_args = Hash_adp_.new_(); private Swt_msg_wkr_stop msg_wkr_stop;
private Gfo_usr_dlg gui_wtr; private String xul_runner_path = null;
private final Bry_fmtr ask_fmtr = Bry_fmtr.new_().Fail_when_invalid_escapes_(false); private final Bry_bfr ask_bfr = Bry_bfr.new_();
private final Object thread_lock = new Object();
@@ -60,7 +60,7 @@ public class Swt_kit implements Gfui_kit {
public void Kit_mode_(int v) {synchronized (thread_lock) {mode = v;}}
public boolean Kit_mode__ready() {return Kit_mode() == Swt_kit_mode.Tid_ready;}
public boolean Kit_mode__term() {return Kit_mode() == Swt_kit_mode.Tid_term;}
public boolean Kit_sync_cmd_exists() {synchronized (thread_lock) {return sync_cmd_list.Count() != 0;}} private final ListAdp sync_cmd_list = ListAdp_.new_();
public boolean Kit_sync_cmd_exists() {synchronized (thread_lock) {return sync_cmd_list.Count() != 0;}} private final List_adp sync_cmd_list = List_adp_.new_();
public void Kit_sync_cmd_add(Swt_gui_cmd cmd) {synchronized (thread_lock) {sync_cmd_list.Add(cmd);}}
public void Kit_sync_cmd_del(Swt_gui_cmd cmd) {synchronized (thread_lock) {sync_cmd_list.Del(cmd);}}
public GfoInvkAbleCmd Kit_term_cbk() {return term_cbk;} public void Kit_term_cbk_(GfoInvkAbleCmd v) {this.term_cbk = v;} private GfoInvkAbleCmd term_cbk = GfoInvkAbleCmd.Null;
@@ -99,12 +99,12 @@ public class Swt_kit implements Gfui_kit {
return;
}
// add kv to widget_cfg_hash; new controls will get properties from cfg_hash
KeyValHash widget_cfg_hash = (KeyValHash)kit_args.Fetch(type);
KeyValHash widget_cfg_hash = (KeyValHash)kit_args.Get_by(type);
if (widget_cfg_hash == null) {
widget_cfg_hash = KeyValHash.new_();
kit_args.Add(type, widget_cfg_hash);
}
widget_cfg_hash.AddReplace(key, val);
widget_cfg_hash.Add_if_dupe_use_nth(key, val);
}
public boolean Ask_yes_no(String grp_key, String msg_key, String fmt, Object... args) {
Swt_dlg_msg dlg = (Swt_dlg_msg)New_dlg_msg(ask_fmtr.Bld_str_many(ask_bfr, fmt, args)).Init_btns_(Gfui_dlg_msg_.Btn_yes, Gfui_dlg_msg_.Btn_no).Init_ico_(Gfui_dlg_msg_.Ico_question);
@@ -149,7 +149,7 @@ public class Swt_kit implements Gfui_kit {
public Gfui_html New_html(String key, GfuiElem owner, KeyVal... args) {
ctor_args.Clear();
// check cfg for browser type
KeyValHash html_cfg_args = (KeyValHash)kit_args.Fetch(Gfui_kit_.Cfg_HtmlBox);
KeyValHash html_cfg_args = (KeyValHash)kit_args.Get_by(Gfui_kit_.Cfg_HtmlBox);
if (html_cfg_args != null) {
KeyVal browser_type = html_cfg_args.FetchOrNull(Cfg_Html_BrowserType);
if (browser_type != null) ctor_args.Add(browser_type);
@@ -190,7 +190,7 @@ public class Swt_kit implements Gfui_kit {
public Gfui_dlg_file New_dlg_file(byte type, String msg) {return new Swt_dlg_file(type, shell).Init_msg_(msg);}
public Gfui_dlg_msg New_dlg_msg(String msg) {return new Swt_dlg_msg(shell).Init_msg_(msg);}
public ImageAdp New_img_load(Io_url url) {
if (url == Io_url_.Null) return ImageAdp_.Null;
if (url == Io_url_.Empty) return ImageAdp_.Null;
Image img = new Image(display, url.Raw());
Rectangle rect = img.getBounds();
return new Swt_img(this, img, rect.width, rect.height).Url_(url);
@@ -242,6 +242,7 @@ public class Swt_kit implements Gfui_kit {
public static final String Cfg_Html_BrowserType = "BrowserType";
public static int Cfg_Html_BrowserType_parse(String v) {
if (String_.Eq(v, "mozilla")) return Swt_html.Browser_tid_mozilla;
else if (String_.Eq(v, "webkit")) return Swt_html.Browser_tid_webkit;
else return Swt_html.Browser_tid_none;
}
public static FontAdp Control_font_get(Font font, GxwCore_base owner) {

View File

@@ -20,7 +20,7 @@ import org.junit.*;
public class GfuiFocusOrderer_tst {
@Before public void setup() {
owner = GfuiElem_.new_();
list = ListAdp_.new_(); // list of all controls
list = List_adp_.new_(); // list of all controls
}
@Test public void Horizontal() {
ini_Subs(owner, list, xy_(40, 0), xy_(20, 0), xy_(0, 0));
@@ -57,8 +57,8 @@ public class GfuiFocusOrderer_tst {
ini_Subs(owner, list, xy_(0, 0), xy_(20, 0));
tst_FocusIndxs(owner, list, 0, 1);
GfuiElem sub1 = owner.SubElems().FetchAt(0);
GfuiElem sub2 = owner.SubElems().FetchAt(1);
GfuiElem sub1 = owner.SubElems().Get_at(0);
GfuiElem sub2 = owner.SubElems().Get_at(1);
sub1.Focus_idx_(1);
sub2.Focus_idx_(0);
@@ -66,8 +66,8 @@ public class GfuiFocusOrderer_tst {
tst_FocusIndxs(owner, list, 1, 0);
}
PointAdp xy_(int x, int y) {return PointAdp_.new_(x, y);}
GfuiElem sub_(GfuiElem owner, int i) {return owner.SubElems().FetchAt(i);}
void ini_Subs(GfuiElem owner, ListAdp list, PointAdp... points) {
GfuiElem sub_(GfuiElem owner, int i) {return owner.SubElems().Get_at(i);}
void ini_Subs(GfuiElem owner, List_adp list, PointAdp... points) {
for (int i = 0; i < points.length; i++) {
GfuiElem sub = GfuiElem_.sub_(Int_.Xto_str(i), owner);
sub.Pos_(points[i]);
@@ -75,13 +75,13 @@ public class GfuiFocusOrderer_tst {
list.Add(sub);
}
}
void tst_FocusIndxs(GfuiElem owner, ListAdp list, int... expd) {
void tst_FocusIndxs(GfuiElem owner, List_adp list, int... expd) {
int[] actl = new int[list.Count()];
for (int i = 0; i < actl.length; i++) {
GfuiElem sub = (GfuiElem)list.FetchAt(i);
GfuiElem sub = (GfuiElem)list.Get_at(i);
actl[i] = sub.UnderElem().Core().Focus_index();
}
Tfds.Eq_ary(expd, actl);
}
GfuiElem owner; ListAdp list;
GfuiElem owner; List_adp list;
}

View File

@@ -16,14 +16,14 @@ 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.gfui; import gplx.*;
public class GfxItmList extends ListAdp_base {
@gplx.New public GfxItm FetchAt(int i) {return (GfxItm)FetchAt_base(i);}
public class GfxItmList extends List_adp_base {
@gplx.New public GfxItm Get_at(int i) {return (GfxItm)Get_at_base(i);}
public void Add(GfxItm gfxItm) {Add_base(gfxItm);}
}
class GfxItmListFxt {
public void tst_SubItm_count(GfxAdpMok gfx, int expd) {Tfds.Eq(expd, gfx.SubItms().Count());}
public void tst_SubItm(GfxAdpMok gfx, int i, GfxItm expd) {
GfxItm actl = gfx.SubItms().FetchAt(i);
GfxItm actl = gfx.SubItms().Get_at(i);
Tfds.Eq(expd, actl);
}
public static GfxItmListFxt new_() {return new GfxItmListFxt();} GfxItmListFxt() {}

View File

@@ -33,13 +33,13 @@ public class ImageAdp_tst {
@Test public void SaveAsBmp() {
img = ImageAdp_.file_(load);
Io_url save = load.GenNewNameOnly("strawberry_temp");
DateAdp beforeModifiedTime = Io_mgr._.QueryFil(save).ModifiedTime();
DateAdp beforeModifiedTime = Io_mgr.I.QueryFil(save).ModifiedTime();
img.SaveAsBmp(save);
DateAdp afterModifiedTime = Io_mgr._.QueryFil(save).ModifiedTime();
DateAdp afterModifiedTime = Io_mgr.I.QueryFil(save).ModifiedTime();
Tfds.Eq_true(CompareAble_.Is_more(afterModifiedTime, beforeModifiedTime));
String loadHash = HashAlgo_.Md5.CalcHash(ConsoleDlg_.Null, Io_mgr._.OpenStreamRead(load));
String saveHash = HashAlgo_.Md5.CalcHash(ConsoleDlg_.Null, Io_mgr._.OpenStreamRead(save));
String loadHash = HashAlgo_.Md5.CalcHash(ConsoleDlg_.Null, Io_mgr.I.OpenStreamRead(load));
String saveHash = HashAlgo_.Md5.CalcHash(ConsoleDlg_.Null, Io_mgr.I.OpenStreamRead(save));
Tfds.Eq(loadHash, saveHash);
}
}

View File

@@ -25,16 +25,16 @@ public class TabBox_tst {
// fx.Make(1).tst_Selected("0").FetchBtnAt(0).tst_X(0);
// fx.Make(3).tst_Selected("2").FetchBtnAt(2).tst_X(160);
}
// @Test public void DelAt() {
// fx.Make(2).DelAt(1).tst_Btns("0");
// fx.Make(2).DelAt(0).tst_Btns("1");
// fx.Make(3).DelAt(0).tst_Btns("1", "2");
// fx.Make(3).DelAt(1).tst_Btns("0", "2");
// fx.Make(3).DelAt(2).tst_Btns("0", "1");
// @Test public void Del_at() {
// fx.Make(2).Del_at(1).tst_Btns("0");
// fx.Make(2).Del_at(0).tst_Btns("1");
// fx.Make(3).Del_at(0).tst_Btns("1", "2");
// fx.Make(3).Del_at(1).tst_Btns("0", "2");
// fx.Make(3).Del_at(2).tst_Btns("0", "1");
// fx.Make(3).Select(1).DelAt(1).tst_Selected("2"); // 1 deleted; 2 shifted down into slot
// fx.Make(3).Select(1).DelAt(0).tst_Selected("1"); // 0 deleted; 1 still remains active (but will have idx of 0
// fx.Make(3).Select(2).DelAt(2).tst_Selected("1"); // 2 deleted; 1 selected
// fx.Make(3).Select(1).Del_at(1).tst_Selected("2"); // 1 deleted; 2 shifted down into slot
// fx.Make(3).Select(1).Del_at(0).tst_Selected("1"); // 0 deleted; 1 still remains active (but will have idx of 0
// fx.Make(3).Select(2).Del_at(2).tst_Selected("1"); // 2 deleted; 1 selected
// }
// @Test public void Selected_byAdd() {
// fx.Make(2).Select(0).tst_Selected("0").Select(1).tst_Selected("1");
@@ -42,7 +42,7 @@ public class TabBox_tst {
// @Test public void Selected_byBtn() {
// fx.Make(2).tst_Selected("1");
//
// GfuiBtn btn = fx.TabBox().SubBtnArea().FetchAt(0);
// GfuiBtn btn = fx.TabBox().SubBtnArea().Get_at(0);
// btn.Click();
// fx.tst_Selected("0");
// }
@@ -73,27 +73,27 @@ class TabBoxFxt implements GfoInvkAble {
tabBox.Tabs_Add(Int_.Xto_str(i), Int_.Xto_str(i));
return this;
}
@gplx.Internal protected TabBoxFxt DelAt(int index) {tabBox.Tabs_DelAt(index); return this;}
@gplx.Internal protected TabBoxFxt Del_at(int index) {tabBox.Tabs_DelAt(index); return this;}
// @gplx.Internal protected TabBoxFxt Select(int index) {tabBox.Tabs_Select(index); return this;}
@gplx.Internal protected GfuiElemFxt FetchBtnAt(int index) {
GfuiBtn btn = (GfuiBtn)tabBox.BtnBox().SubElems().FetchAt(index);
GfuiBtn btn = (GfuiBtn)tabBox.BtnBox().SubElems().Get_at(index);
GfuiElemFxt fx_elem = GfuiElemFxt.new_(btn);
return fx_elem;
}
// @gplx.Internal protected TabBoxFxt tst_BtnX(int idx, int expdX) {
// Tfds.Eq(expdX, tabBox.SubBtnArea().FetchAt(idx).X());
// Tfds.Eq(expdX, tabBox.SubBtnArea().Get_at(idx).X());
// return this;
// }
@gplx.Internal protected TabBoxFxt tst_Selected(String expd) {
TabPnlItm curTab = tabBox.Tabs_SelectedItm();
GfuiBtn btn = (GfuiBtn)tabBox.BtnBox().SubElems().FetchAt(curTab.Idx());
GfuiBtn btn = (GfuiBtn)tabBox.BtnBox().SubElems().Get_at(curTab.Idx());
Tfds.Eq(expd, btn.Text());
return this;
}
@gplx.Internal protected TabBoxFxt tst_Btns(String... expd) {
String[] actl = new String[tabBox.Tabs_Count() ];
for (int i = 0; i < tabBox.Tabs_Count() ; i++) {
GfuiBtn button = (GfuiBtn)tabBox.BtnBox().SubElems().FetchAt(i);
GfuiBtn button = (GfuiBtn)tabBox.BtnBox().SubElems().Get_at(i);
actl[i] = button.TextMgr().Val();
}
Tfds.Eq_ary(expd, actl);
@@ -109,8 +109,8 @@ class TabBoxFxt implements GfoInvkAble {
// return this;
// }
// @gplx.Internal protected TabBoxFxt tst_FocusOrder() {
// for (int i = 0; i < tabBox.SubBtnArea().SubZones().FetchAt(0).Count(); i++) {
// GfuiElem subBtn = (GfuiElem)tabBox.SubBtnArea().SubZones().FetchAt(0).FetchAt(i);
// for (int i = 0; i < tabBox.SubBtnArea().SubZones().Get_at(0).Count(); i++) {
// GfuiElem subBtn = (GfuiElem)tabBox.SubBtnArea().SubZones().Get_at(0).Get_at(i);
// Tfds.Eq(i, subBtn.UnderElem().Core().Focus_index());
// }
// return this;

View File

@@ -61,11 +61,11 @@ class Swt_html implements Gxw_html, Swt_control, FocusListener {
public String Html_doc_html() {return Eval_script_as_str(kit.Html_cfg().Doc_html());}
public void Html_doc_html_load_by_mem(String html) {
html_doc_html_load_tid = Gxw_html_load_tid_.Tid_mem;
browser.setText(html); // DBG: Io_mgr._.SaveFilStr(Io_url_.new_fil_("C:\\temp.txt"), s)
browser.setText(html); // DBG: Io_mgr.I.SaveFilStr(Io_url_.new_fil_("C:\\temp.txt"), s)
}
public void Html_doc_html_load_by_url(String path, String html) {
html_doc_html_load_tid = Gxw_html_load_tid_.Tid_url;
Io_mgr._.SaveFilStr(path, html);
Io_mgr.I.SaveFilStr(path, html);
browser.setUrl(path);
}
public byte Html_doc_html_load_tid() {return html_doc_html_load_tid;} private byte html_doc_html_load_tid;
@@ -120,7 +120,7 @@ class Swt_html implements Gxw_html, Swt_control, FocusListener {
return Eval_script_as_exec(kit.Html_cfg().Window_vpos_(node_path.Val(), scroll_top.Val()));
} private String_obj_ref scroll_top = String_obj_ref.null_(), node_path = String_obj_ref.null_();
public boolean Html_doc_find(String elem_id, String find, boolean dir_fwd, boolean case_match, boolean wrap_find) {
if (String_.Eq(find, String_.Empty)) return false;
// if (String_.Eq(find, String_.Empty)) return false;
find = String_.Replace(find, "\\", "\\\\"); // escape \ -> \\
find = String_.Replace(find, "'", "\\'"); // escape ' -> \'; NOTE: \\' instead of \'
boolean search_text_is_diff = !String_.Eq(find, prv_find_str);
@@ -167,7 +167,7 @@ class Swt_html implements Gxw_html, Swt_control, FocusListener {
public static final int
Browser_tid_none = SWT.NONE
, Browser_tid_mozilla = SWT.MOZILLA
, Browser_tid_webKit = SWT.WEBKIT
, Browser_tid_webkit = SWT.WEBKIT
;
}
class Swt_core_cmds_html extends Swt_core_cmds {

View File

@@ -27,7 +27,7 @@ class Swt_img implements ImageAdp {
public SizeAdp Size() {if (size == null) size = SizeAdp_.new_(width, height); return size;} SizeAdp size;
public int Width() {return width;} int width;
public int Height() {return height;} int height;
public Io_url Url() {return url;} public ImageAdp Url_(Io_url v) {url = v; return this;} Io_url url = Io_url_.Null;
public Io_url Url() {return url;} public ImageAdp Url_(Io_url v) {url = v; return this;} Io_url url = Io_url_.Empty;
public Object Under() {return under;} Image under;
public boolean Disposed() {return under.isDisposed();}
public void Rls() {under.dispose();}

View File

@@ -65,7 +65,7 @@ class Swt_win implements GxwWin, Swt_control {
} boolean pin = false;
public IconAdp IconWin() {return icon;} IconAdp icon;
public void IconWin_set(IconAdp i) {
if (i == null || i.Url() == Io_url_.Null) return;
if (i == null || i.Url() == Io_url_.Empty) return;
icon = i;
Image image = null;
try {