mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Refactor: Pull more classes into baselib
This commit is contained in:
@@ -13,11 +13,14 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
import gplx.core.interfaces.*;
|
||||
package gplx.gfui;
|
||||
import gplx.core.interfaces.ParseAble;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GfuiAlign_ implements ParseAble {
|
||||
public static GfuiAlign as_(Object obj) {return obj instanceof GfuiAlign ? (GfuiAlign)obj : null;}
|
||||
public static GfuiAlign cast(Object obj) {try {return (GfuiAlign)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiAlign.class, obj);}}
|
||||
public static GfuiAlign cast(Object obj) {try {return (GfuiAlign)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, GfuiAlign.class, obj);}}
|
||||
public static final GfuiAlign
|
||||
Null = new_(0, "nil")
|
||||
, Lo = new_(1, "lo")
|
||||
@@ -38,9 +41,9 @@ public class GfuiAlign_ implements ParseAble {
|
||||
else return Null;
|
||||
}
|
||||
public static GfuiAlign parse(String raw) {
|
||||
if (String_.Eq(raw, "bot")) return Bot;
|
||||
else if (String_.Eq(raw, "mid")) return Mid;
|
||||
else if (String_.Eq(raw, "top")) return Top;
|
||||
if (StringUtl.Eq(raw, "bot")) return Bot;
|
||||
else if (StringUtl.Eq(raw, "mid")) return Mid;
|
||||
else if (StringUtl.Eq(raw, "top")) return Top;
|
||||
return Null;
|
||||
}
|
||||
public static PointAdp CalcInsideOf(GfuiAlign h, GfuiAlign v, SizeAdp inner, SizeAdp outer, PointAdp adjust) {
|
||||
@@ -50,11 +53,11 @@ public class GfuiAlign_ implements ParseAble {
|
||||
}
|
||||
public static int CalcInsideOfAxis(int posEnm, int innerSize, int outerSize) {
|
||||
int rv = 0;
|
||||
if (posEnm == GfuiAlign_.Null.Val()) rv = Int_.Min_value;
|
||||
if (posEnm == GfuiAlign_.Null.Val()) rv = IntUtl.MinValue;
|
||||
else if (posEnm == GfuiAlign_.Lo.Val()) rv = 0;
|
||||
else if (posEnm == GfuiAlign_.Mid.Val()) rv = (outerSize - innerSize) / 2;
|
||||
else if (posEnm == GfuiAlign_.Hi.Val()) rv = outerSize - innerSize;
|
||||
else throw Err_.new_unhandled(posEnm);
|
||||
else throw ErrUtl.NewUnhandled(posEnm);
|
||||
if (rv < 0) rv = 0;
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
import gplx.core.bits.*;
|
||||
package gplx.gfui;
|
||||
import gplx.core.bits.Bitmask_;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GfuiBorderEdge {
|
||||
public int Val() {return val;} int val;
|
||||
public boolean Has(GfuiBorderEdge comp) {return Bitmask_.Has_int(val, comp.val);}
|
||||
public GfuiBorderEdge Add(GfuiBorderEdge comp) {
|
||||
return new GfuiBorderEdge(comp.val + val);
|
||||
}
|
||||
@gplx.Internal protected GfuiBorderEdge(int v) {this.val = v;}
|
||||
public GfuiBorderEdge(int v) {this.val = v;}
|
||||
public static final GfuiBorderEdge Left = new GfuiBorderEdge(1);
|
||||
public static final GfuiBorderEdge Right = new GfuiBorderEdge(2);
|
||||
public static final GfuiBorderEdge Top = new GfuiBorderEdge(4);
|
||||
@@ -36,15 +38,15 @@ class GfuiBorderEdge_ {
|
||||
else if (val == GfuiBorderEdge.Top.Val()) return Top_raw;
|
||||
else if (val == GfuiBorderEdge.Bot.Val()) return Bot_raw;
|
||||
else if (val == GfuiBorderEdge.All.Val()) return All_raw;
|
||||
else throw Err_.new_unhandled(edge);
|
||||
else throw ErrUtl.NewUnhandled(edge);
|
||||
}
|
||||
public static GfuiBorderEdge parse(String raw) {
|
||||
if (String_.Eq(raw, Left_raw)) return GfuiBorderEdge.Left;
|
||||
else if (String_.Eq(raw, Right_raw)) return GfuiBorderEdge.Right;
|
||||
else if (String_.Eq(raw, Top_raw)) return GfuiBorderEdge.Top;
|
||||
else if (String_.Eq(raw, Bot_raw)) return GfuiBorderEdge.Bot;
|
||||
else if (String_.Eq(raw, All_raw)) return GfuiBorderEdge.All;
|
||||
else throw Err_.new_unhandled(raw);
|
||||
if (StringUtl.Eq(raw, Left_raw)) return GfuiBorderEdge.Left;
|
||||
else if (StringUtl.Eq(raw, Right_raw)) return GfuiBorderEdge.Right;
|
||||
else if (StringUtl.Eq(raw, Top_raw)) return GfuiBorderEdge.Top;
|
||||
else if (StringUtl.Eq(raw, Bot_raw)) return GfuiBorderEdge.Bot;
|
||||
else if (StringUtl.Eq(raw, All_raw)) return GfuiBorderEdge.All;
|
||||
else throw ErrUtl.NewUnhandled(raw);
|
||||
}
|
||||
public static final String
|
||||
All_raw = "all"
|
||||
|
||||
@@ -13,8 +13,10 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class PointAdp implements To_str_able {
|
||||
package gplx.gfui;
|
||||
import gplx.frameworks.objects.ToStrAble;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
public class PointAdp implements ToStrAble {
|
||||
public int X() {return x;} final int x;
|
||||
public int Y() {return y;} final int y;
|
||||
public PointAdp Op_add(PointAdp val) {return new PointAdp(x + val.x, y + val.y);}
|
||||
@@ -25,8 +27,8 @@ public class PointAdp implements To_str_able {
|
||||
PointAdp comp = PointAdp_.as_(compObj); if (comp == null) return false;
|
||||
return x == comp.x && y == comp.y;
|
||||
}
|
||||
public String To_str() {return String_.Concat_any(x, ",", y);}
|
||||
@Override public String toString() {return To_str();}
|
||||
public String ToStr() {return StringUtl.ConcatObjs(x, ",", y);}
|
||||
@Override public String toString() {return ToStr();}
|
||||
@Override public boolean equals(Object obj) {return Eq(obj);}
|
||||
@Override public int hashCode() {return super.hashCode();}
|
||||
public PointAdp(int x, int y) {this.x = x; this.y = y;}
|
||||
|
||||
@@ -13,18 +13,21 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
package gplx.gfui;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class PointAdp_ {
|
||||
public static final PointAdp Null = new PointAdp(Int_.Min_value, Int_.Min_value);
|
||||
public static final PointAdp Null = new PointAdp(IntUtl.MinValue, IntUtl.MinValue);
|
||||
public static final PointAdp Zero = new PointAdp(0, 0);
|
||||
public static PointAdp as_(Object obj) {return obj instanceof PointAdp ? (PointAdp)obj : null;}
|
||||
public static PointAdp cast(Object obj) {try {return (PointAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, PointAdp.class, obj);}}
|
||||
public static PointAdp cast(Object obj) {try {return (PointAdp)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, PointAdp.class, obj);}}
|
||||
public static PointAdp new_(int x, int y) {return new PointAdp(x, y);}
|
||||
public static PointAdp coerce_(Object o) {PointAdp rv = PointAdp_.as_(o); return (rv == null) ? parse((String)o) : rv;}
|
||||
public static PointAdp parse(String raw) {
|
||||
try {
|
||||
String[] ary = String_.Split(raw, ",");
|
||||
return new PointAdp(Int_.Parse(ary[0]), Int_.Parse(ary[1]));
|
||||
} catch (Exception exc) {throw Err_.new_parse_exc(exc, PointAdp.class, raw);}
|
||||
String[] ary = StringUtl.Split(raw, ",");
|
||||
return new PointAdp(IntUtl.Parse(ary[0]), IntUtl.Parse(ary[1]));
|
||||
} catch (Exception exc) {throw ErrUtl.NewParse(exc, PointAdp.class, raw);}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class RectAdp {
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
public class RectAdp {
|
||||
public SizeAdp Size() {return size;} SizeAdp size = SizeAdp_.Zero;
|
||||
public PointAdp Pos() {return pos;} PointAdp pos = PointAdp_.Zero;
|
||||
public int Width() {return size.Width();} public int Height() {return size.Height();}
|
||||
@@ -23,20 +24,20 @@ public class RectAdp {
|
||||
public PointAdp CornerTR() {return PointAdp_.new_(pos.X() + size.Width(), pos.Y());}
|
||||
public PointAdp CornerBL() {return PointAdp_.new_(pos.X(), pos.Y() + size.Height());}
|
||||
public PointAdp CornerBR() {return PointAdp_.new_(pos.X() + size.Width(), pos.Y() + size.Height());}
|
||||
@gplx.Internal protected boolean ContainsPoint(PointAdp point) {
|
||||
public boolean ContainsPoint(PointAdp point) {
|
||||
return point.X() >= pos.X() && point.X() <= pos.X() + size.Width()
|
||||
&& point.Y() >= pos.Y() && point.Y() <= pos.Y() + size.Height();
|
||||
}
|
||||
public RectAdp Op_add(RectAdp v) {
|
||||
return new RectAdp(pos.Op_add(v.Pos()), size.Op_add(v.Size()));
|
||||
}
|
||||
@Override public String toString() {return String_.Concat_any(pos, ";", size);}
|
||||
@Override public String toString() {return StringUtl.ConcatObjs(pos, ";", size);}
|
||||
@Override public boolean equals(Object obj) {
|
||||
RectAdp comp = (RectAdp)obj;
|
||||
return size.Eq(comp.size) && pos.Eq(comp.pos);
|
||||
}
|
||||
@Override public int hashCode() {return super.hashCode();}
|
||||
public String Xto_str() {return String_.Concat_any(pos, ",", size);}
|
||||
public String Xto_str() {return StringUtl.ConcatObjs(pos, ",", size);}
|
||||
|
||||
public RectAdp(PointAdp pos, SizeAdp size) {this.pos = pos; this.size = size;}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
package gplx.gfui;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
public class RectAdpF { //_20101206 // supports Graphics.MeasureString
|
||||
public float X() {return x;} float x; public float Y() {return y;} float y;
|
||||
public float Width() {return width;} float width; public float Height() {return height;} float height;
|
||||
@@ -22,7 +23,7 @@ public class RectAdpF { //_20101206 // supports Graphics.MeasureString
|
||||
return comp.x == x && comp.y == y && comp.width == width && comp.height == height;
|
||||
}
|
||||
|
||||
public static final RectAdpF Null = new_(Int_.Min_value, Int_.Min_value, Int_.Min_value, Int_.Min_value);
|
||||
public static final RectAdpF Null = new_(IntUtl.MinValue, IntUtl.MinValue, IntUtl.MinValue, IntUtl.MinValue);
|
||||
public static RectAdpF new_(float x, float y, float width, float height) {
|
||||
RectAdpF rv = new RectAdpF();
|
||||
rv.x = x; rv.y = y; rv.width = width; rv.height = height;
|
||||
|
||||
@@ -13,7 +13,10 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
package gplx.gfui;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class RectAdp_ {
|
||||
public static final RectAdp Zero = new RectAdp(PointAdp_.Zero, SizeAdp_.Zero);
|
||||
public static RectAdp new_(int x, int y, int width, int height) {return new RectAdp(PointAdp_.new_(x, y), SizeAdp_.new_(width, height));}
|
||||
@@ -21,12 +24,12 @@ public class RectAdp_ {
|
||||
public static RectAdp vector_(PointAdp pos, SizeAdp size) {return new RectAdp(pos, size);}
|
||||
public static RectAdp size_(int w, int h) {return new_(0, 0, w, h);}
|
||||
public static RectAdp size_(SizeAdp size) {return new RectAdp(PointAdp_.Zero, size);}
|
||||
public static RectAdp parse_ws_(String raw) {return parse(String_.Replace(raw, " ", ""));}
|
||||
public static RectAdp parse_ws_(String raw) {return parse(StringUtl.Replace(raw, " ", ""));}
|
||||
public static RectAdp parse(String raw) {
|
||||
try {
|
||||
String[] ary = String_.Split(raw, ",");
|
||||
return RectAdp_.new_(Int_.Parse(ary[0]), Int_.Parse(ary[1]), Int_.Parse(ary[2]), Int_.Parse(ary[3]));
|
||||
} catch(Exception exc) {throw Err_.new_parse_exc(exc, RectAdp.class, raw);}
|
||||
String[] ary = StringUtl.Split(raw, ",");
|
||||
return RectAdp_.new_(IntUtl.Parse(ary[0]), IntUtl.Parse(ary[1]), IntUtl.Parse(ary[2]), IntUtl.Parse(ary[3]));
|
||||
} catch(Exception exc) {throw ErrUtl.NewParse(exc, RectAdp.class, raw);}
|
||||
}
|
||||
public static String Xto_str(RectAdp rect) {return String_.Format("{0},{1},{2},{3}", rect.X(), rect.Y(), rect.Width(), rect.Height());}
|
||||
public static String Xto_str(RectAdp rect) {return StringUtl.Format("{0},{1},{2},{3}", rect.X(), rect.Y(), rect.Width(), rect.Height());}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class SizeAdp {
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
public class SizeAdp {
|
||||
public int Width() {return width;} int width;
|
||||
public int Height() {return height;} int height;
|
||||
public int AxisLength(GfuiAxisType axis) {return axis == GfuiAxisType.X ? width : height;}
|
||||
@@ -22,7 +23,7 @@ public class SizeAdp {
|
||||
public SizeAdp Op_add(SizeAdp s) {return SizeAdp_.new_(width + s.width, height + s.height);}
|
||||
public SizeAdp Op_subtract(int val) {return SizeAdp_.new_(width - val, height - val);}
|
||||
public SizeAdp Op_subtract(int w, int h) {return SizeAdp_.new_(width - w, height - h);}
|
||||
public String To_str() {return String_.Concat_any(width, ",", height);}
|
||||
public String To_str() {return StringUtl.ConcatObjs(width, ",", height);}
|
||||
public boolean Eq(Object o) {
|
||||
SizeAdp comp = (SizeAdp)o; if (comp == null) return false;
|
||||
return width == comp.width && height == comp.height;
|
||||
|
||||
@@ -13,12 +13,13 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
import gplx.core.interfaces.*;
|
||||
package gplx.gfui;
|
||||
import gplx.core.interfaces.*;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
public class SizeAdpF implements ParseAble {
|
||||
public float Width() {return width;} float width;
|
||||
public float Height() {return height;} float height;
|
||||
public Object ParseAsObj(String raw) {return SizeAdp_.parse(raw);}
|
||||
@Override public String toString() {return String_.Concat_any(width, ":", height);}
|
||||
@gplx.Internal protected SizeAdpF(float width, float height) {this.width = width; this.height = height;}
|
||||
}
|
||||
public float Width() {return width;} float width;
|
||||
public float Height() {return height;} float height;
|
||||
public Object ParseAsObj(String raw) {return SizeAdp_.parse(raw);}
|
||||
@Override public String toString() {return StringUtl.ConcatObjs(width, ":", height);}
|
||||
public SizeAdpF(float width, float height) {this.width = width; this.height = height;}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,13 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
package gplx.gfui;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
import gplx.types.basics.utls.FloatUtl;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
public class SizeAdpF_ {
|
||||
public static final SizeAdpF Null = new_(Int_.Min_value, Int_.Min_value);
|
||||
public static final SizeAdpF Null = new_(IntUtl.MinValue, IntUtl.MinValue);
|
||||
public static final SizeAdpF Zero = new_(0, 0);
|
||||
public static final SizeAdpF Parser = new SizeAdpF(0, 0);
|
||||
public static SizeAdpF as_(Object obj) {return obj instanceof SizeAdpF ? (SizeAdpF)obj : null;}
|
||||
@@ -23,10 +27,10 @@ public class SizeAdpF_ {
|
||||
public static SizeAdpF coerce_(Object obj) {SizeAdpF rv = as_(obj); return rv == null ? parse((String)obj) : rv;}
|
||||
public static SizeAdpF parse(String s) {
|
||||
try {
|
||||
String[] ary = String_.Split(s, ","); if (ary.length != 2) throw Err_.new_wo_type("SizeAdf should only have 2 numbers separated by 1 comma");
|
||||
float val1 = Float_.parse(ary[0]);
|
||||
float val2 = Float_.parse(ary[1]);
|
||||
String[] ary = StringUtl.Split(s, ","); if (ary.length != 2) throw ErrUtl.NewArgs("SizeAdf should only have 2 numbers separated by 1 comma");
|
||||
float val1 = FloatUtl.Parse(ary[0]);
|
||||
float val2 = FloatUtl.Parse(ary[1]);
|
||||
return new_(val1, val2);
|
||||
} catch (Exception e) {throw Err_.new_parse_exc(e, SizeAdpF.class, s);}
|
||||
} catch (Exception e) {throw ErrUtl.NewParse(e, SizeAdpF.class, s);}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,18 +13,21 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
package gplx.gfui;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class SizeAdp_ {
|
||||
public static final SizeAdp Null = new SizeAdp(Int_.Min_value, Int_.Min_value);
|
||||
public static final SizeAdp Null = new SizeAdp(IntUtl.MinValue, IntUtl.MinValue);
|
||||
public static final SizeAdp Zero = new SizeAdp(0, 0);
|
||||
public static final SizeAdp[] Ary_empty = new SizeAdp[0];
|
||||
public static SizeAdp cast(Object obj) {try {return (SizeAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, SizeAdp.class, obj);}}
|
||||
public static SizeAdp cast(Object obj) {try {return (SizeAdp)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, SizeAdp.class, obj);}}
|
||||
public static SizeAdp new_(int width, int height) {return new SizeAdp(width, height);}
|
||||
public static SizeAdp parse(String raw) {return parse_or(raw, SizeAdp_.Null);}
|
||||
public static SizeAdp parse_or(String raw, SizeAdp or) {
|
||||
String[] ary = String_.Split(raw, ","); if (ary.length != 2) return or;
|
||||
int w = Int_.Parse_or(ary[0], Int_.Min_value); if (w == Int_.Min_value) return or;
|
||||
int h = Int_.Parse_or(ary[1], Int_.Min_value); if (h == Int_.Min_value) return or;
|
||||
String[] ary = StringUtl.Split(raw, ","); if (ary.length != 2) return or;
|
||||
int w = IntUtl.ParseOr(ary[0], IntUtl.MinValue); if (w == IntUtl.MinValue) return or;
|
||||
int h = IntUtl.ParseOr(ary[1], IntUtl.MinValue); if (h == IntUtl.MinValue) return or;
|
||||
return new SizeAdp(w, h);
|
||||
}
|
||||
public static SizeAdp corners_(PointAdp topLeft, PointAdp bottomRight) {
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls; import gplx.*; import gplx.gfui.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.gfxs.*;
|
||||
import gplx.core.strings.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls;
|
||||
import gplx.gfui.GfuiBorderEdge;
|
||||
import gplx.gfui.RectAdp;
|
||||
import gplx.gfui.RectAdp_;
|
||||
import gplx.gfui.draws.ColorAdp;
|
||||
import gplx.gfui.draws.PenAdp;
|
||||
import gplx.gfui.draws.PenAdp_;
|
||||
import gplx.gfui.gfxs.GfxAdp;
|
||||
import gplx.types.basics.utls.FloatUtl;
|
||||
import gplx.types.commons.String_bldr_;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GfuiBorderMgr {
|
||||
public PenAdp All() {return all;} public GfuiBorderMgr All_(PenAdp v) {SyncPens(true); all = v; return this;} PenAdp all;
|
||||
public PenAdp Left() {return left;} public GfuiBorderMgr Left_(PenAdp v) {SyncPens(false); left = v; return this;} PenAdp left;
|
||||
@@ -39,7 +47,7 @@ public class GfuiBorderMgr {
|
||||
this.None_();
|
||||
else {
|
||||
Object[] ary = (Object[])o;
|
||||
this.Edge_set(GfuiBorderEdge.All, PenAdp_.new_((ColorAdp)ary[1], Float_.cast(ary[0])));
|
||||
this.Edge_set(GfuiBorderEdge.All, PenAdp_.new_((ColorAdp)ary[1], FloatUtl.Cast(ary[0])));
|
||||
}
|
||||
}
|
||||
public void Edge_set(GfuiBorderEdge edge, PenAdp pen) {
|
||||
@@ -49,7 +57,7 @@ public class GfuiBorderMgr {
|
||||
else if (val == GfuiBorderEdge.Right.Val()) {right = pen; return;}
|
||||
else if (val == GfuiBorderEdge.Top.Val()) {top = pen; return;}
|
||||
else if (val == GfuiBorderEdge.Bot.Val()) {bot = pen; return;}
|
||||
else throw Err_.new_unhandled(edge);
|
||||
else throw ErrUtl.NewUnhandled(edge);
|
||||
}
|
||||
void SyncPens(boolean isAll) {
|
||||
if (isAll) {
|
||||
@@ -62,7 +70,7 @@ public class GfuiBorderMgr {
|
||||
all = null;
|
||||
}
|
||||
}
|
||||
public String To_str() {return String_bldr_.new_().Add_kv_obj("all", all).Add_kv_obj("left", left).Add_kv_obj("right", right).Add_kv_obj("top", top).Add_kv_obj("bot", bot).To_str();}
|
||||
public String To_str() {return String_bldr_.new_().AddKvObj("all", all).AddKvObj("left", left).AddKvObj("right", right).AddKvObj("top", top).AddKvObj("bot", bot).ToStr();}
|
||||
@Override public String toString() {return To_str();}
|
||||
public static GfuiBorderMgr new_() {return new GfuiBorderMgr();} GfuiBorderMgr() {}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls; import gplx.*; import gplx.gfui.*;
|
||||
import org.junit.*; import gplx.gfui.draws.*; import gplx.gfui.imgs.*;
|
||||
package gplx.gfui.controls;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import org.junit.*; import gplx.gfui.draws.*;
|
||||
public class GfuiBorderMgr_tst {
|
||||
@Before public void setup() {
|
||||
borderMgr = GfuiBorderMgr.new_();
|
||||
@@ -40,11 +41,11 @@ public class GfuiBorderMgr_tst {
|
||||
tst_Eq(borderMgr, null, black, red, red, red);
|
||||
}
|
||||
void tst_Eq(GfuiBorderMgr borderMgr, PenAdp all, PenAdp top, PenAdp left, PenAdp right, PenAdp bottom) {
|
||||
Tfds.Eq(borderMgr.All(), all);
|
||||
Tfds.Eq(borderMgr.Top(), top);
|
||||
Tfds.Eq(borderMgr.Left(), left);
|
||||
Tfds.Eq(borderMgr.Right(), right);
|
||||
Tfds.Eq(borderMgr.Bot(), bottom);
|
||||
GfoTstr.EqObj(borderMgr.All(), all);
|
||||
GfoTstr.EqObj(borderMgr.Top(), top);
|
||||
GfoTstr.EqObj(borderMgr.Left(), left);
|
||||
GfoTstr.EqObj(borderMgr.Right(), right);
|
||||
GfoTstr.EqObj(borderMgr.Bot(), bottom);
|
||||
}
|
||||
GfuiBorderMgr borderMgr;
|
||||
PenAdp black = PenAdp_.black_(), red = PenAdp_.new_(ColorAdp_.Red, 1);
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.core.interfaces.*; import gplx.gfui.controls.elems.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs;
|
||||
import gplx.core.interfaces.*;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfoMsg_;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.controls.elems.*;
|
||||
import gplx.frameworks.evts.Gfo_evt_itm;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.types.basics.utls.ObjectUtl;
|
||||
public class DataBndr_whenEvt_execCmd implements InjectAble, Gfo_invk, Gfo_evt_itm {
|
||||
public Gfo_evt_mgr Evt_mgr() {if (evt_mgr == null) evt_mgr = new Gfo_evt_mgr(this); return evt_mgr;} Gfo_evt_mgr evt_mgr;
|
||||
public DataBndr_whenEvt_execCmd WhenArg_(String v) {whenArg = v; return this;} private String whenArg = "v";
|
||||
@@ -35,7 +45,7 @@ public class DataBndr_whenEvt_execCmd implements InjectAble, Gfo_invk, Gfo_evt_i
|
||||
if (ctx.Match(k, whenEvt)) {
|
||||
Object evtVal = m.CastObjOr(whenArg, "");
|
||||
Object getVal = getInvk.Invk(GfsCtx.Instance, 0, getCmd, GfoMsg_.new_cast_(getCmd).Add("v", evtVal));
|
||||
GfoMsg setMsg = GfoMsg_.new_cast_(setCmd).Add("v", Object_.Xto_str_strict_or_empty(getVal));
|
||||
GfoMsg setMsg = GfoMsg_.new_cast_(setCmd).Add("v", ObjectUtl.ToStrOrEmpty(getVal));
|
||||
setInvk.Invk(GfsCtx.Instance, 0, setCmd, setMsg);
|
||||
return Gfo_invk_.Rv_handled;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,14 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.customs;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.kits.core.*; import gplx.gfui.envs.*; import gplx.gfui.controls.windows.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
import gplx.libs.dlgs.UsrMsg;
|
||||
import gplx.libs.dlgs.UsrMsgWkr;
|
||||
public class GfuiBnd_box_status implements Gfo_invk, UsrMsgWkr {
|
||||
public GfuiElem Box() {return box;} GfuiElem box;
|
||||
public void ExecUsrMsg(int type, UsrMsg umsg) {
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.core.lists.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs;
|
||||
import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
public class GfuiCheckListBox extends GfuiElemBase {
|
||||
public void Items_reverse() {checkListBox.Items_reverse();}
|
||||
public void Items_count() {checkListBox.Items_count();}
|
||||
@@ -27,8 +28,8 @@ public class GfuiCheckListBox extends GfuiElemBase {
|
||||
public List_adp Items_getChecked() {return checkListBox.Items_getChecked();}
|
||||
|
||||
GxwCheckListBox checkListBox;
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return new GxwCheckListBox_lang();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return new GxwCheckListBox_lang();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.checkListBox = (GxwCheckListBox)UnderElem();
|
||||
}
|
||||
|
||||
@@ -13,10 +13,15 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.customs;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.*;
|
||||
import gplx.gfui.layouts.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
public class GfuiCheckListPanel extends GfuiElemBase {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
InitToggleWidget();
|
||||
InitReverseWidget();
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs;
|
||||
import gplx.gfui.layouts.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.windows.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GfuiFormPanel extends GfuiElemBase {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.Width_(60); // default to 60; do not force callers to always set width
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.Get_val_or(GfuiElem_.InitKey_ownerWin, null);
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.GetByValOr(GfuiElem_.InitKey_ownerWin, null);
|
||||
|
||||
GfoFactory_gfui.Btn_MoveBox(this, ownerForm);
|
||||
GfoFactory_gfui.Btn_MinWin2(this);
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import java.io.File;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs;
|
||||
import java.awt.FileDialog;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import gplx.gfui.controls.elems.*; import gplx.gfui.controls.windows.*;
|
||||
import gplx.libs.files.Io_url;
|
||||
import gplx.libs.files.Io_url_;
|
||||
public class GfuiIoDialogUtl {
|
||||
public static Io_url SelectDir() {return SelectDir(Io_url_.Empty);}
|
||||
public static Io_url SelectDir(Io_url startingDir) {
|
||||
|
||||
@@ -13,10 +13,16 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.customs;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.layouts.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.libs.files.Io_url;
|
||||
import gplx.libs.files.Io_url_;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public abstract class GfuiIoUrlSelectBox extends GfuiElemBase {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
label = GfuiLbl_.sub_("label", this);
|
||||
pathBox.Owner_(this, "pathBox");
|
||||
|
||||
@@ -13,14 +13,14 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.GfoMsg;
|
||||
import gplx.Gfo_invk;
|
||||
import gplx.Gfo_invk_;
|
||||
import gplx.GfsCtx;
|
||||
import gplx.Hash_adp;
|
||||
import gplx.Hash_adp_;
|
||||
import gplx.List_adp;
|
||||
import gplx.List_adp_;
|
||||
package gplx.gfui.controls.customs; import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.types.basics.lists.Hash_adp;
|
||||
import gplx.types.basics.lists.Hash_adp_;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
import gplx.core.interfaces.InjectAble;
|
||||
import gplx.gfui.PointAdp;
|
||||
import gplx.gfui.PointAdp_;
|
||||
@@ -76,7 +76,7 @@ public class GfuiMoveElemBnd implements IptBnd, Gfo_invk, InjectAble {
|
||||
PointAdp offset = PointAdp_.cast(hash.GetByOrNull(msg.EventArg()));
|
||||
targetElem.Pos_(current.Op_add(offset));
|
||||
}
|
||||
@gplx.Internal protected void Key_set(String key) {this.key = key;} private String key;
|
||||
public void Key_set(String key) {this.key = key;} private String key;
|
||||
public Object Srl(GfoMsg owner) {return IptBnd_.Srl(owner, this);}
|
||||
|
||||
boolean moving = false;
|
||||
|
||||
@@ -13,12 +13,12 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.GfoMsg;
|
||||
import gplx.Hash_adp;
|
||||
import gplx.Hash_adp_;
|
||||
import gplx.Keyval_hash;
|
||||
import gplx.List_adp;
|
||||
import gplx.List_adp_;
|
||||
package gplx.gfui.controls.customs; import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.types.basics.lists.Hash_adp;
|
||||
import gplx.types.basics.lists.Hash_adp_;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
import gplx.gfui.PointAdp;
|
||||
import gplx.gfui.PointAdp_;
|
||||
import gplx.gfui.SizeAdp;
|
||||
@@ -38,8 +38,8 @@ import gplx.gfui.ipts.IptKey_;
|
||||
import gplx.gfui.ipts.IptMouseBtn_;
|
||||
import gplx.gfui.ipts.IptMouseMove;
|
||||
import gplx.gfui.layouts.GftGrid;
|
||||
public class GfuiMoveElemBtn extends GfuiBtn { @Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
public class GfuiMoveElemBtn extends GfuiBtn { @Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.Text_("*");
|
||||
this.TipText_("move/resize");
|
||||
|
||||
@@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.Tfds;
|
||||
package gplx.gfui.controls.customs;
|
||||
import gplx.gfui.controls.standards.GfuiBtn;
|
||||
import gplx.gfui.controls.standards.GfuiBtn_;
|
||||
import gplx.gfui.controls.windows.GfuiWin;
|
||||
@@ -22,6 +22,7 @@ import gplx.gfui.ipts.IptEventMgr;
|
||||
import gplx.gfui.ipts.IptEvtDataKey;
|
||||
import gplx.gfui.ipts.IptKey;
|
||||
import gplx.gfui.ipts.IptKey_;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
public class GfuiMoveElemBtn_tst {
|
||||
@@ -32,9 +33,9 @@ public class GfuiMoveElemBtn_tst {
|
||||
moveBtn.IptBnds().Add(bnd);
|
||||
}
|
||||
@Test public void Basic() {
|
||||
Tfds.Eq(form.X(), 0);
|
||||
GfoTstr.EqObj(form.X(), 0);
|
||||
IptEventMgr.ExecKeyDown(moveBtn, IptEvtDataKey.test_(MoveRightArg()));
|
||||
Tfds.Eq(form.X(), 10);
|
||||
GfoTstr.EqObj(form.X(), 10);
|
||||
}
|
||||
|
||||
IptKey MoveRightArg() {return IptKey_.MOD_1ST.Add(IptKey_.Right);}
|
||||
|
||||
@@ -13,8 +13,11 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.customs;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.layouts.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GfuiStatusBar extends GfuiElemBase {
|
||||
public GfuiStatusBox Box() {return statusBox;} GfuiStatusBox statusBox;
|
||||
public GfuiMoveElemBtn MoveButton() {return moveBtn;} GfuiMoveElemBtn moveBtn;
|
||||
@@ -28,7 +31,7 @@ public class GfuiStatusBar extends GfuiElemBase {
|
||||
else return super.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
} public static final String StatusBarFocus_cmd = "StatusBarFocus";
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
moveBtn = GfuiMoveElemBtn.new_();
|
||||
statusBox = GfuiStatusBox_.new_("statusBox");
|
||||
|
||||
@@ -13,17 +13,18 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.Err_;
|
||||
package gplx.gfui.controls.customs;
|
||||
import gplx.core.interfaces.InjectAble;
|
||||
import gplx.gfui.controls.windows.GfuiWin;
|
||||
import gplx.gfui.controls.windows.GfuiWin_;
|
||||
import gplx.gfui.ipts.IptBnd_;
|
||||
import gplx.gfui.ipts.IptCfg_;
|
||||
import gplx.gfui.ipts.IptKey_;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GfuiStatusBarBnd implements InjectAble {
|
||||
public GfuiStatusBar Bar() {return statusBar;} GfuiStatusBar statusBar = GfuiStatusBar.new_();
|
||||
public void Inject(Object owner) {
|
||||
GfuiWin form = GfuiWin_.as_(owner); if (form == null) throw Err_.new_type_mismatch(GfuiWin.class, owner);
|
||||
GfuiWin form = GfuiWin_.as_(owner); if (form == null) throw ErrUtl.NewCast(GfuiWin.class, owner);
|
||||
statusBar.Owner_(form, "statusBar");
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, form, statusBar, GfuiStatusBar.StatusBarFocus_cmd, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.MOD_2ND, IptKey_.T));
|
||||
statusBar.MoveButton().TargetElem_set(form);
|
||||
|
||||
@@ -13,8 +13,18 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.core.envs.*; import gplx.gfui.kits.core.*; import gplx.gfui.envs.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.standards.*;
|
||||
package gplx.gfui.controls.customs;
|
||||
import gplx.core.envs.*;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.envs.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.standards.*;
|
||||
import gplx.libs.dlgs.UsrDlg_;
|
||||
import gplx.libs.dlgs.UsrMsg;
|
||||
import gplx.libs.dlgs.UsrMsgWkr;
|
||||
import gplx.libs.dlgs.UsrMsgWkr_;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GfuiStatusBox extends GfuiTextBox implements UsrMsgWkr { public GfuiStatusBox Active_(boolean v) {active = v; return this;} private boolean active = true;
|
||||
public GfuiStatusBox VisibilityDuration_(int v) {timer.Interval_(v); visibilityDuration = v; return this;} int visibilityDuration;
|
||||
@Override public void Opened_cbk() {
|
||||
@@ -28,7 +38,7 @@ public class GfuiStatusBox extends GfuiTextBox implements UsrMsgWkr { public Gf
|
||||
) return;
|
||||
this.CreateControlIfNeeded(); // WORKAROUND.WINFORMS: else will sometimes throw: Cannot call Invoke or InvokeAsync on a control until the window handle has been created
|
||||
this.VisibilityDuration_(umsg.VisibilityDuration());
|
||||
String text = String_.Replace(umsg.To_str(), Op_sys.Cur().Nl_str(), " "); // replace NewLine with " " since TextBox cannot show NewLine
|
||||
String text = StringUtl.Replace(umsg.To_str(), Op_sys.Cur().Nl_str(), " "); // replace NewLine with " " since TextBox cannot show NewLine
|
||||
Invoke(Gfo_invk_cmd.New_by_val(this, Invk_WriteText, text));
|
||||
}
|
||||
public void WriteText(String text) {
|
||||
@@ -66,14 +76,14 @@ public class GfuiStatusBox extends GfuiTextBox implements UsrMsgWkr { public Gf
|
||||
return this;
|
||||
} static final String Invk_HideWindow = "HideWindow", Invk_WriteText = "WriteText", Invk_Text_empty = "Text_empty";
|
||||
TimerAdp timer;
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.Border_on_(false);
|
||||
this.Focus_able_(false);
|
||||
this.Visible_set(false);
|
||||
timer = TimerAdp.new_(this, Invk_HideWindow, 2000, false);
|
||||
}
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
this.Border_on_(false);
|
||||
this.Focus_able_(false);
|
||||
@@ -81,7 +91,7 @@ public class GfuiStatusBox extends GfuiTextBox implements UsrMsgWkr { public Gf
|
||||
timerCmd = kit.New_cmd_sync(this);
|
||||
timer = TimerAdp.new_(timerCmd, GfuiInvkCmd_.Invk_sync, 2000, false);
|
||||
} GfuiInvkCmd timerCmd;
|
||||
public void ctor_kit_GfuiElemBase_drd(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
public void ctor_kit_GfuiElemBase_drd(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
this.Border_on_(false);
|
||||
this.Focus_able_(false);
|
||||
|
||||
@@ -13,13 +13,13 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.customs; import gplx.Datetime_now;
|
||||
import gplx.GfoMsg;
|
||||
import gplx.Gfo_invk;
|
||||
import gplx.Gfo_invk_;
|
||||
import gplx.GfsCtx;
|
||||
import gplx.UsrMsg;
|
||||
import gplx.UsrMsgWkr_;
|
||||
package gplx.gfui.controls.customs; import gplx.types.commons.GfoDateNow;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.libs.dlgs.UsrMsg;
|
||||
import gplx.libs.dlgs.UsrMsgWkr_;
|
||||
import gplx.gfui.DirInt;
|
||||
import gplx.gfui.controls.windows.GfuiWin;
|
||||
import gplx.gfui.draws.ColorAdp_;
|
||||
@@ -31,7 +31,7 @@ import gplx.gfui.layouts.GftGrid;
|
||||
public class GfuiStatusBoxBnd implements Gfo_invk {
|
||||
public GfuiStatusBox Box() {return statusBox;} GfuiStatusBox statusBox = GfuiStatusBox_.new_("statusBox");
|
||||
void ShowTime() {
|
||||
statusBox.ExecUsrMsg(UsrMsgWkr_.Type_Note, UsrMsg.new_(Datetime_now.Get().XtoStr_gplx_long()));
|
||||
statusBox.ExecUsrMsg(UsrMsgWkr_.Type_Note, UsrMsg.new_(GfoDateNow.Get().ToStrGplxLong()));
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_ShowTime)) ShowTime();
|
||||
|
||||
@@ -1,22 +1,29 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.elems; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.gfxs.*; import gplx.gfui.ipts.*; import gplx.gfui.layouts.*; import gplx.gfui.imgs.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.*; import gplx.gfui.controls.windows.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.elems;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.gfxs.*; import gplx.gfui.ipts.*; import gplx.gfui.layouts.*;
|
||||
import gplx.gfui.controls.gxws.*;
|
||||
import gplx.gfui.controls.windows.*;
|
||||
import gplx.gfui.layouts.swts.*;
|
||||
import gplx.core.interfaces.*;
|
||||
import gplx.frameworks.evts.Gfo_evt_itm;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public interface GfuiElem extends Gfo_invk, GxwCbkHost, IptBndsOwner, GftItem, Gfo_evt_itm {
|
||||
//% Layout
|
||||
int X(); GfuiElem X_(int val);
|
||||
@@ -72,7 +79,7 @@ public interface GfuiElem extends Gfo_invk, GxwCbkHost, IptBndsOwner, GftItem, G
|
||||
|
||||
//% Infrastructure
|
||||
GxwElem UnderElem();
|
||||
GxwElem UnderElem_make(Keyval_hash ctorArgs);
|
||||
void ctor_GfuiBox_base(Keyval_hash ctorArgs);
|
||||
GxwElem UnderElem_make(KeyValHash ctorArgs);
|
||||
void ctor_GfuiBox_base(KeyValHash ctorArgs);
|
||||
void Invoke(Gfo_invk_cmd cmd);
|
||||
}
|
||||
|
||||
@@ -13,22 +13,18 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.elems; import gplx.objects.primitives.BoolUtl;
|
||||
import gplx.Err_;
|
||||
import gplx.GfoMsg;
|
||||
import gplx.Gfo_evt_mgr;
|
||||
import gplx.Gfo_evt_mgr_;
|
||||
import gplx.Gfo_invk_;
|
||||
import gplx.Gfo_invk_cmd;
|
||||
import gplx.Gfo_invk_cmd_mgr;
|
||||
import gplx.GfsCtx;
|
||||
import gplx.Hash_adp;
|
||||
import gplx.Hash_adp_;
|
||||
import gplx.Keyval_hash;
|
||||
import gplx.Object_;
|
||||
import gplx.Ordered_hash;
|
||||
import gplx.Ordered_hash_;
|
||||
import gplx.String_;
|
||||
package gplx.gfui.controls.elems;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd_mgr;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.types.basics.lists.Hash_adp;
|
||||
import gplx.types.basics.lists.Hash_adp_;
|
||||
import gplx.types.basics.lists.Ordered_hash;
|
||||
import gplx.types.basics.lists.Ordered_hash_;
|
||||
import gplx.core.interfaces.InjectAble;
|
||||
import gplx.gfui.GfuiAlign;
|
||||
import gplx.gfui.GfuiAlign_;
|
||||
@@ -68,6 +64,11 @@ import gplx.gfui.layouts.GftGrid;
|
||||
import gplx.gfui.layouts.GftItem;
|
||||
import gplx.gfui.layouts.swts.Swt_layout_data;
|
||||
import gplx.gfui.layouts.swts.Swt_layout_mgr;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.basics.utls.BoolUtl;
|
||||
import gplx.types.basics.utls.ObjectUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
public class GfuiElemBase implements GfuiElem {
|
||||
//% Layout
|
||||
public Gfo_evt_mgr Evt_mgr() {if (evt_mgr == null) evt_mgr = new Gfo_evt_mgr(this); return evt_mgr;} Gfo_evt_mgr evt_mgr;
|
||||
@@ -125,7 +126,7 @@ public class GfuiElemBase implements GfuiElem {
|
||||
public GfuiElem Border_off_() {border.All_(null); return this;}
|
||||
public GfxStringData TextMgr() {return textMgr;} GfxStringData textMgr;
|
||||
public String Text() {return textMgr.Val();}
|
||||
public GfuiElem Text_any_(Object obj) {return Text_(Object_.Xto_str_strict_or_null_mark(obj));}
|
||||
public GfuiElem Text_any_(Object obj) {return Text_(ObjectUtl.ToStrOrNullMark(obj));}
|
||||
public GfuiElem Text_(String v) {
|
||||
this.TextMgr().Text_set(v);
|
||||
Click_key_set_(v);
|
||||
@@ -155,13 +156,13 @@ 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.Get_by(defaultFocusKey); if (focusTarget == null) throw Err_.new_wo_type("could not find defaultTarget for focus", "ownerKey", this.Key_of_GfuiElem(), "defaultTarget", defaultFocusKey);
|
||||
GfuiElem focusTarget = subElems.Get_by(defaultFocusKey); if (focusTarget == null) throw ErrUtl.NewArgs("could not find defaultTarget for focus", "ownerKey", this.Key_of_GfuiElem(), "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.Get_at(i);
|
||||
if (sub.Visible() && !String_.Eq(sub.Key_of_GfuiElem(), "statusBox")) {
|
||||
if (sub.Visible() && !StringUtl.Eq(sub.Key_of_GfuiElem(), "statusBox")) {
|
||||
sub.Focus();
|
||||
return;
|
||||
}
|
||||
@@ -177,7 +178,7 @@ public class GfuiElemBase implements GfuiElem {
|
||||
public void Click() {}
|
||||
public boolean Click_able() {return false;}
|
||||
public IptKey Click_key() {return clickKey;}
|
||||
@gplx.Internal protected void Click_key_set_(String v) {clickKey = GfuiWinKeyCmdMgr.ExtractKeyFromText(v);} IptKey clickKey = IptKey_.None;
|
||||
public void Click_key_set_(String v) {clickKey = GfuiWinKeyCmdMgr.ExtractKeyFromText(v);} IptKey clickKey = IptKey_.None;
|
||||
|
||||
//% Owner
|
||||
public String Key_of_GfuiElem() {return keyIdf;} public GfuiElem Key_of_GfuiElem_(String val) {keyIdf = val; return this;} private String keyIdf;
|
||||
@@ -317,17 +318,17 @@ public class GfuiElemBase implements GfuiElem {
|
||||
}
|
||||
public Gfui_kit Kit() {return kit;} private Gfui_kit kit = Gfui_kit_.Mem();
|
||||
|
||||
public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
this.kit = Swing_kit.Instance; // NOTE: assume that callers want Swing; SWT / Mem should be calling ctor_kit_GfuiElemBase
|
||||
underElem = UnderElem_make(ctorArgs);
|
||||
underElem.Host_set(this);
|
||||
underMgr = underElem.Core();
|
||||
subElems = GfuiElemList.new_(this);
|
||||
textMgr = GfxStringData.new_(this, underElem);
|
||||
this.Focus_able_(BoolUtl.Cast(ctorArgs.Get_val_or(GfuiElem_.InitKey_focusAble, true)));
|
||||
this.Focus_able_(BoolUtl.Cast(ctorArgs.GetByValOr(GfuiElem_.InitKey_focusAble, true)));
|
||||
underMgr.Size_set(SizeAdp_.new_(20, 20)); // NOTE: CS inits to 20,20; JAVA inits to 0,0
|
||||
}
|
||||
public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
this.kit = kit;
|
||||
this.keyIdf = key;
|
||||
this.underElem = underElem;
|
||||
@@ -335,14 +336,14 @@ public class GfuiElemBase implements GfuiElem {
|
||||
underMgr = underElem.Core();
|
||||
subElems = GfuiElemList.new_(this);
|
||||
textMgr = GfxStringData.new_(this, underElem);
|
||||
this.Focus_able_(BoolUtl.Cast(ctorArgs.Get_val_or(GfuiElem_.InitKey_focusAble, true)));
|
||||
this.Focus_able_(BoolUtl.Cast(ctorArgs.GetByValOr(GfuiElem_.InitKey_focusAble, true)));
|
||||
// underMgr.Size_set(SizeAdp_.new_(20, 20)); // NOTE: CS inits to 20,20; JAVA inits to 0,0
|
||||
}
|
||||
public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.control_();}
|
||||
public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.control_();}
|
||||
public Object SubItms_getObj(String key) {return injected.GetByOrNull(key);}
|
||||
public GfuiElemBase SubItms_add(String key, Object v) {injected.Add(key, v); return this;}
|
||||
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;
|
||||
public static boolean SizeChanged_ignore = false;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.elems; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
public class GfuiElemBase_ {
|
||||
public static GfuiElemBase as_(Object obj) {return obj instanceof GfuiElemBase ? (GfuiElemBase)obj : null;}
|
||||
public static GfuiElemBase cast(Object obj) {try {return (GfuiElemBase)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiElemBase.class, obj);}}
|
||||
}
|
||||
package gplx.gfui.controls.elems;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GfuiElemBase_ {
|
||||
public static GfuiElemBase as_(Object obj) {return obj instanceof GfuiElemBase ? (GfuiElemBase)obj : null;}
|
||||
public static GfuiElemBase cast(Object obj) {try {return (GfuiElemBase)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, GfuiElemBase.class, obj);}}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class GfuiElemKeys {
|
||||
, IptRcvd_evt = "IptRcvd_evt"
|
||||
, Evt_menu_detected = "menu_detected"
|
||||
;
|
||||
@gplx.Internal protected static final String
|
||||
public static final String
|
||||
Key_set = "Key_"
|
||||
, TipText = "TipText"
|
||||
, TipText_ = "TipText_"
|
||||
|
||||
@@ -13,30 +13,35 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.elems; import gplx.*;
|
||||
package gplx.gfui.controls.elems;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.types.basics.lists.Ordered_hash;
|
||||
import gplx.types.basics.lists.Ordered_hash_;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
public class GfuiElemList {
|
||||
public int Count() {return hash.Len();}
|
||||
public GfuiElem Get_at(int idx) {return (GfuiElem)hash.Get_at(idx);}
|
||||
public GfuiElem Get_at(int idx) {return (GfuiElem)hash.GetAt(idx);}
|
||||
public GfuiElem Get_by(String key) {return (GfuiElem)hash.GetByOrNull(key);}
|
||||
public void Add(GfuiElem box) {Add_exec(box);}
|
||||
public void DelOrFail(GfuiElem box) {Del_exec(box);}
|
||||
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 int IndexOfA(GfuiElem box) {return hash.IdxOf(box);}
|
||||
public void Move_to(int src, int trg) {hash.MoveTo(src, trg);}
|
||||
public void Clear() {
|
||||
for (int i = 0; i < this.Count(); i++)
|
||||
Del_exec(this.Get_at(i));
|
||||
hash.Clear();
|
||||
}
|
||||
void Add_exec(GfuiElem box) {
|
||||
String key = box.Key_of_GfuiElem(); if (String_.Eq(key, String_.Empty)) throw Err_.new_wo_type("box does not have key", "type", box.getClass(), "owner", owner.Key_of_GfuiElem(), "ownerSubs", owner.SubElems().Count());
|
||||
String key = box.Key_of_GfuiElem(); if (StringUtl.Eq(key, StringUtl.Empty)) throw ErrUtl.NewArgs("box does not have key", "type", box.getClass(), "owner", owner.Key_of_GfuiElem(), "ownerSubs", owner.SubElems().Count());
|
||||
hash.Add(key, box);
|
||||
owner.UnderElem().Core().Controls_add(box.UnderElem());
|
||||
box.OwnerElem_(owner).OwnerWin_(owner.OwnerWin()); // needed b/c box may be added after form is loaded
|
||||
Gfo_evt_mgr_.Sub_same(box, GfuiElemKeys.IptRcvd_evt, owner); // bubble iptEvts to owner
|
||||
}
|
||||
void Del_exec(GfuiElem box) {
|
||||
String key = box.Key_of_GfuiElem(); if (!hash.Has(key)) throw Err_.new_missing_key(key);
|
||||
String key = box.Key_of_GfuiElem(); if (!hash.Has(key)) throw ErrUtl.NewMissingKey(key);
|
||||
hash.Del(key);
|
||||
owner.UnderElem().Core().Controls_del(box.UnderElem());
|
||||
owner.IptBnds().Cfgs_delAll();
|
||||
|
||||
@@ -13,13 +13,15 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.elems; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.elems;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GfuiElem_ {
|
||||
public static final String
|
||||
InitKey_focusAble = "focusAble"
|
||||
, InitKey_ownerWin = "ownerForm";
|
||||
public static GfuiElem as_(Object obj) {return obj instanceof GfuiElem ? (GfuiElem)obj : null;}
|
||||
public static GfuiElem cast(Object obj) {try {return (GfuiElem)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiElem.class, obj);}}
|
||||
public static GfuiElem cast(Object obj) {try {return (GfuiElem)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, GfuiElem.class, obj);}}
|
||||
public static GfuiElemBase sub_(String key, GfuiElem owner) {
|
||||
GfuiElemBase rv = new_();
|
||||
rv.Owner_(owner, key);
|
||||
@@ -30,8 +32,8 @@ public class GfuiElem_ {
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_true_());
|
||||
return rv;
|
||||
}
|
||||
public static Keyval_hash init_focusAble_true_() {return new Keyval_hash().Add(GfuiElem_.InitKey_focusAble, true);}
|
||||
public static Keyval_hash init_focusAble_false_() {return new Keyval_hash().Add(GfuiElem_.InitKey_focusAble, false);}
|
||||
public static KeyValHash init_focusAble_true_() {return new KeyValHash().Add(GfuiElem_.InitKey_focusAble, true);}
|
||||
public static KeyValHash init_focusAble_false_() {return new KeyValHash().Add(GfuiElem_.InitKey_focusAble, false);}
|
||||
public static void Y_adj(int adj, GfuiElem... ary) {
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
||||
@@ -13,17 +13,18 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
public interface GxwCheckListBox extends GxwElem {
|
||||
int Items_count();
|
||||
List_adp Items_getAll();
|
||||
List_adp Items_getChecked();
|
||||
|
||||
void Items_add(Object obj, boolean v);
|
||||
void Items_reverse();
|
||||
boolean Items_getCheckedAt(int i);
|
||||
void Items_setCheckedAt(int i, boolean v);
|
||||
void Items_setAll(boolean v);
|
||||
|
||||
void Items_clear();
|
||||
}
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
public interface GxwCheckListBox extends GxwElem {
|
||||
int Items_count();
|
||||
List_adp Items_getAll();
|
||||
List_adp Items_getChecked();
|
||||
|
||||
void Items_add(Object obj, boolean v);
|
||||
void Items_reverse();
|
||||
boolean Items_getCheckedAt(int i);
|
||||
void Items_setCheckedAt(int i, boolean v);
|
||||
void Items_setAll(boolean v);
|
||||
|
||||
void Items_clear();
|
||||
}
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.*;
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
@@ -29,9 +31,10 @@ import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import java.util.Vector;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.gfxs.*; import gplx.gfui.controls.windows.*;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
import gplx.types.basics.utls.ObjectUtl;
|
||||
public class GxwCheckListBox_lang extends JScrollPane implements GxwCheckListBox, GxwElem {
|
||||
Vector<CheckListItem> internalItems;
|
||||
GxwListBox_lang listBox;
|
||||
@@ -195,5 +198,5 @@ class CheckListItem {
|
||||
public Object Data() {return data;} Object data;
|
||||
public boolean Selected() {return selected;} public void Selected_set(boolean selected) {this.selected = selected;} protected boolean selected;
|
||||
public void Selected_toggle() {selected = !selected;}
|
||||
public String toString() {return Object_.Xto_str_strict_or_null_mark(data);}
|
||||
public String toString() {return ObjectUtl.ToStrOrNullMark(data);}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,32 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import gplx.gfui.draws.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.gfxs.*;
|
||||
import gplx.types.basics.utls.ObjectUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
public class GxwComboBox_lang extends JComboBox implements GxwComboBox, GxwElem, ActionListener {
|
||||
public String[] DataSource_as_str_ary() {return String_.Ary_empty;}
|
||||
public String[] DataSource_as_str_ary() {return StringUtl.AryEmpty;}
|
||||
public void DataSource_set(Object... ary) {
|
||||
for (Object o : ary)
|
||||
this.insertItemAt(o, this.getItemCount());
|
||||
@@ -72,7 +77,7 @@ public class GxwComboBox_lang extends JComboBox implements GxwComboBox, GxwElem,
|
||||
@Override public void setBounds(Rectangle r) {super.setBounds(r); this.validate();}
|
||||
@Override public void setSize(int w, int h) {super.setSize(w, h); this.validate();}
|
||||
@Override public void setSize(Dimension d) {super.setSize(d); this.validate();}
|
||||
public String TextVal() {return Object_.Xto_str_strict_or_empty(this.SelectedItm());} public void TextVal_set(String v) {this.SelectedItm_set(v);}
|
||||
public String TextVal() {return ObjectUtl.ToStrOrEmpty(this.SelectedItm());} public void TextVal_set(String v) {this.SelectedItm_set(v);}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.gfui.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.ipts.*;
|
||||
import gplx.gfui.layouts.swts.*;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
public class GxwCore_mock extends GxwCore_base {
|
||||
@Override public int Width() {return size.Width();} @Override public void Width_set(int v) {size = SizeAdp_.new_(v, size.Height());}
|
||||
@Override public int Height() {return size.Height();} @Override public void Height_set(int v) {size = SizeAdp_.new_(size.Width(), v);}
|
||||
|
||||
@@ -13,12 +13,13 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
public interface GxwElem extends Gfo_invk {
|
||||
GxwCore_base Core();
|
||||
GxwCbkHost Host(); void Host_set(GxwCbkHost host);
|
||||
String TextVal(); void TextVal_set(String v);
|
||||
|
||||
|
||||
void EnableDoubleBuffering();
|
||||
}
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
public interface GxwElem extends Gfo_invk {
|
||||
GxwCore_base Core();
|
||||
GxwCbkHost Host(); void Host_set(GxwCbkHost host);
|
||||
String TextVal(); void TextVal_set(String v);
|
||||
|
||||
|
||||
void EnableDoubleBuffering();
|
||||
}
|
||||
|
||||
@@ -13,18 +13,19 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
public abstract class GxwElemFactory_base {
|
||||
public abstract GxwElem control_();
|
||||
public abstract GxwWin win_app_();
|
||||
public abstract GxwWin win_tool_(Keyval_hash ctorArgs);
|
||||
public abstract GxwWin win_toaster_(Keyval_hash ctorArgs);
|
||||
public abstract GxwElem lbl_();
|
||||
public abstract GxwTextFld text_fld_();
|
||||
public abstract GxwTextFld text_memo_();
|
||||
public abstract GxwTextHtml text_html_();
|
||||
public abstract GxwCheckListBox checkListBox_(Keyval_hash ctorArgs);
|
||||
public abstract GxwComboBox comboBox_();
|
||||
public abstract GxwListBox listBox_();
|
||||
// @gplx.Internal protected GxwElem spacer_() {return MockControl.new_();}
|
||||
}
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public abstract class GxwElemFactory_base {
|
||||
public abstract GxwElem control_();
|
||||
public abstract GxwWin win_app_();
|
||||
public abstract GxwWin win_tool_(KeyValHash ctorArgs);
|
||||
public abstract GxwWin win_toaster_(KeyValHash ctorArgs);
|
||||
public abstract GxwElem lbl_();
|
||||
public abstract GxwTextFld text_fld_();
|
||||
public abstract GxwTextFld text_memo_();
|
||||
public abstract GxwTextHtml text_html_();
|
||||
public abstract GxwCheckListBox checkListBox_(KeyValHash ctorArgs);
|
||||
public abstract GxwComboBox comboBox_();
|
||||
public abstract GxwListBox listBox_();
|
||||
// public GxwElem spacer_() {return MockControl.new_();}
|
||||
}
|
||||
|
||||
@@ -13,19 +13,21 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.controls.elems.*; import gplx.gfui.controls.windows.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GxwElemFactory_cls_lang extends GxwElemFactory_base {
|
||||
@Override public GxwElem control_() {return new GxwElem_lang();}
|
||||
@Override public GxwWin win_tool_(Keyval_hash ctorArgs) {
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.Get_val_or(GfuiElem_.InitKey_ownerWin, null);
|
||||
@Override public GxwWin win_tool_(KeyValHash ctorArgs) {
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.GetByValOr(GfuiElem_.InitKey_ownerWin, null);
|
||||
GxwWin ownerElem = ownerForm == null ? null : (GxwWin)ownerForm.UnderElem();
|
||||
return GxwWin_jdialog.new_(ownerElem);
|
||||
// return GxwWin_lang.new_();
|
||||
}
|
||||
@Override public GxwWin win_toaster_(Keyval_hash ctorArgs) {
|
||||
@Override public GxwWin win_toaster_(KeyValHash ctorArgs) {
|
||||
GfsCtx ctx = GfsCtx.new_(); ctx.Match("", "");
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.Get_val_or(GfuiElem_.InitKey_ownerWin, null);
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.GetByValOr(GfuiElem_.InitKey_ownerWin, null);
|
||||
GxwWin ownerElem = ownerForm == null ? null : (GxwWin)ownerForm.UnderElem();
|
||||
return GxwWin_jwindow.new_(ownerElem);
|
||||
// return GxwWin_lang.new_();
|
||||
@@ -35,7 +37,7 @@ public class GxwElemFactory_cls_lang extends GxwElemFactory_base {
|
||||
@Override public GxwTextFld text_fld_() {return GxwTextBox_lang_.fld_();}
|
||||
@Override public GxwTextFld text_memo_() {return GxwTextBox_lang_.memo_();}
|
||||
@Override public GxwTextHtml text_html_() {return new GxwTextHtml_lang().ctor();}
|
||||
@Override public GxwCheckListBox checkListBox_(Keyval_hash ctorArgs) {return new GxwCheckListBox_lang();}
|
||||
@Override public GxwCheckListBox checkListBox_(KeyValHash ctorArgs) {return new GxwCheckListBox_lang();}
|
||||
@Override public GxwComboBox comboBox_() {return GxwComboBox_lang.new_();}
|
||||
@Override public GxwListBox listBox_() {return GxwListBox_lang.new_();}
|
||||
}
|
||||
|
||||
@@ -13,17 +13,19 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
public class GxwElemFactory_cls_mock extends GxwElemFactory_base {
|
||||
@Override public GxwElem control_() {return GxwElem_mock_base.new_();}
|
||||
@Override public GxwWin win_app_() {return MockForm.Instance;}
|
||||
@Override public GxwWin win_tool_(Keyval_hash ctorArgs) {return MockForm.Instance;}
|
||||
@Override public GxwWin win_toaster_(Keyval_hash ctorArgs) {return MockForm.Instance;}
|
||||
@Override public GxwElem lbl_() {return GxwElem_mock_base.new_();}
|
||||
@Override public GxwTextFld text_fld_() {return new MockTextBox();}
|
||||
@Override public GxwTextFld text_memo_() {return new MockTextBoxMulti();}
|
||||
@Override public GxwTextHtml text_html_() {return new MockTextBoxMulti();}
|
||||
@Override public GxwCheckListBox checkListBox_(Keyval_hash ctorArgs) {throw Err_.new_unimplemented();}
|
||||
@Override public GxwComboBox comboBox_() {return new MockComboBox();}
|
||||
@Override public GxwListBox listBox_() {return new MockListBox();}
|
||||
}
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GxwElemFactory_cls_mock extends GxwElemFactory_base {
|
||||
@Override public GxwElem control_() {return GxwElem_mock_base.new_();}
|
||||
@Override public GxwWin win_app_() {return MockForm.Instance;}
|
||||
@Override public GxwWin win_tool_(KeyValHash ctorArgs) {return MockForm.Instance;}
|
||||
@Override public GxwWin win_toaster_(KeyValHash ctorArgs) {return MockForm.Instance;}
|
||||
@Override public GxwElem lbl_() {return GxwElem_mock_base.new_();}
|
||||
@Override public GxwTextFld text_fld_() {return new MockTextBox();}
|
||||
@Override public GxwTextFld text_memo_() {return new MockTextBoxMulti();}
|
||||
@Override public GxwTextHtml text_html_() {return new MockTextBoxMulti();}
|
||||
@Override public GxwCheckListBox checkListBox_(KeyValHash ctorArgs) {throw ErrUtl.NewUnimplemented();}
|
||||
@Override public GxwComboBox comboBox_() {return new MockComboBox();}
|
||||
@Override public GxwListBox listBox_() {return new MockListBox();}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.GfoMsg;
|
||||
import gplx.GfsCtx;
|
||||
package gplx.gfui.controls.gxws; import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.RectAdp;
|
||||
import gplx.gfui.gfxs.GfxAdpBase;
|
||||
import gplx.gfui.gfxs.PaintArgs;
|
||||
|
||||
@@ -13,9 +13,17 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.*;
|
||||
import gplx.gfui.ipts.*;
|
||||
import gplx.gfui.draws.*;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.commons.KeyVal;
|
||||
import gplx.types.commons.KeyValUtl;
|
||||
public class GxwElem_mock_base implements GxwElem {
|
||||
public GxwCore_base Core() {return ctrlMgr;} final GxwCore_mock ctrlMgr = new GxwCore_mock();
|
||||
public GxwCbkHost Host() {return host;} public void Host_set(GxwCbkHost host) {this.host = host;} GxwCbkHost host = GxwCbkHost_.Null;
|
||||
@@ -39,7 +47,7 @@ class MockTextBox extends GxwElem_mock_base implements GxwTextFld {
|
||||
public void CreateControlIfNeeded() {}
|
||||
public void Margins_set(int left, int top, int right, int bot) {}
|
||||
}
|
||||
class MockTextBoxMulti extends MockTextBox implements GxwTextMemo, GxwTextHtml { public Keyval[] Html_sel_atrs() {return Keyval_.Ary_empty;}
|
||||
class MockTextBoxMulti extends MockTextBox implements GxwTextMemo, GxwTextHtml { public KeyVal[] Html_sel_atrs() {return KeyValUtl.AryEmpty;}
|
||||
public void Html_enabled(boolean v) {}
|
||||
public String Html_doc_html() {return "";}
|
||||
public void Html_css_set(String s) {}
|
||||
@@ -67,7 +75,7 @@ class MockComboBox extends GxwElem_mock_base implements GxwComboBox {
|
||||
public int SelBgn() {return -1;} public void SelBgn_set(int v) {}
|
||||
public int SelLen() {return 0;} public void SelLen_set(int v) {}
|
||||
public void Sel_(int bgn, int end) {}
|
||||
public String[] DataSource_as_str_ary() {return String_.Ary_empty;}
|
||||
public String[] DataSource_as_str_ary() {return StringUtl.AryEmpty;}
|
||||
public void DataSource_set(Object... ary) {}
|
||||
public String Text_fallback() {return "";} public void Text_fallback_(String v) {}
|
||||
public int List_sel_idx() {return -1;} public void List_sel_idx_(int v) {}
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.gfxs.*;
|
||||
import gplx.types.basics.utls.ObjectUtl;
|
||||
class GxwListBox_lang extends JList implements GxwListBox {
|
||||
void ctor_() {
|
||||
ctrlMgr = GxwCore_lang.new_(this);
|
||||
@@ -49,7 +53,7 @@ class GxwListBox_lang extends JList implements GxwListBox {
|
||||
@Override public void setBounds(Rectangle r) {super.setBounds(r); this.validate();}
|
||||
@Override public void setSize(int w, int h) {super.setSize(w, h); this.validate();}
|
||||
@Override public void setSize(Dimension d) {super.setSize(d); this.validate();}
|
||||
public String TextVal() {return Object_.Xto_str_strict_or_empty(this.SelectedItm());} public void TextVal_set(String v) {this.SelectedItm_set(v);}
|
||||
public String TextVal() {return ObjectUtl.ToStrOrEmpty(this.SelectedItm());} public void TextVal_set(String v) {this.SelectedItm_set(v);}
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -13,9 +13,8 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.Err_;
|
||||
import gplx.GfoMsg;
|
||||
import gplx.GfsCtx;
|
||||
package gplx.gfui.controls.gxws; import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.GfuiAlign;
|
||||
import gplx.gfui.GfuiAlign_;
|
||||
import gplx.gfui.RectAdp_;
|
||||
@@ -29,11 +28,17 @@ import gplx.gfui.ipts.IptMouseBtn;
|
||||
import gplx.gfui.ipts.IptMouseBtn_;
|
||||
import gplx.gfui.ipts.IptMouseWheel;
|
||||
import gplx.gfui.ipts.IptMouseWheel_;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.text.JTextComponent;
|
||||
import java.awt.*;
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
@@ -109,7 +114,6 @@ class GxwTextFld_cls_lang extends JTextField implements GxwTextFld {
|
||||
try {
|
||||
this.setSelectionStart(v);
|
||||
} catch (Exception e) {
|
||||
Err_.Noop(e);
|
||||
} // NOTE: sometimes fails when skipping ahead in dvd player; v = 0, and start/end = 0
|
||||
}
|
||||
public int SelLen() {return this.getSelectionEnd() - this.getSelectionStart();} public void SelLen_set(int v) {this.setSelectionEnd(this.SelBgn() + v);}
|
||||
|
||||
@@ -13,10 +13,11 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
public interface GxwTextHtml extends GxwTextMemo {
|
||||
Keyval[] Html_sel_atrs();
|
||||
void Html_enabled(boolean v);
|
||||
String Html_doc_html();
|
||||
void Html_css_set(String s);
|
||||
}
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.types.commons.KeyVal;
|
||||
public interface GxwTextHtml extends GxwTextMemo {
|
||||
KeyVal[] Html_sel_atrs();
|
||||
void Html_enabled(boolean v);
|
||||
String Html_doc_html();
|
||||
void Html_css_set(String s);
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*;
|
||||
import gplx.core.strings.*;
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
@@ -36,6 +38,15 @@ import javax.swing.text.html.HTMLEditorKit;
|
||||
import javax.swing.text.html.StyleSheet;
|
||||
import gplx.gfui.draws.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.gfxs.*;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.commons.KeyVal;
|
||||
import gplx.types.commons.KeyValUtl;
|
||||
import gplx.types.commons.String_bldr;
|
||||
import gplx.types.commons.String_bldr_;
|
||||
public class GxwTextHtml_lang extends JScrollPane implements GxwTextHtml {
|
||||
@Override public GxwCore_base Core() {return core;} GxwCore_host core;
|
||||
public GxwCbkHost Host() {return host;} public void Host_set(GxwCbkHost host) {this.host = host; editor.Host_set(host);} GxwCbkHost host;
|
||||
@@ -62,7 +73,7 @@ public class GxwTextHtml_lang extends JScrollPane implements GxwTextHtml {
|
||||
editor.Html_enabled(v);
|
||||
}
|
||||
public GxwTextHtml_editor Editor() {return editor;} GxwTextHtml_editor editor;
|
||||
public void ScrollTillCaretIsVisible() {throw Err_.new_unimplemented();}
|
||||
public void ScrollTillCaretIsVisible() {throw ErrUtl.NewUnimplemented();}
|
||||
public GxwTextHtml_lang ctor() {
|
||||
editor = new GxwTextHtml_editor().ctor();
|
||||
core = new GxwCore_host(GxwCore_lang.new_(this), editor.core);
|
||||
@@ -72,7 +83,7 @@ public class GxwTextHtml_lang extends JScrollPane implements GxwTextHtml {
|
||||
this.setBorder(null);
|
||||
return this;
|
||||
}
|
||||
public Keyval[] Html_sel_atrs() {return editor.Html_sel_atrs();}
|
||||
public KeyVal[] Html_sel_atrs() {return editor.Html_sel_atrs();}
|
||||
public String Html_doc_html() {return editor.Html_doc_html();}
|
||||
public void Html_css_set(String s) {editor.Html_css_set(s);}
|
||||
@Override public void Margins_set(int left, int top, int right, int bot) {}
|
||||
@@ -128,22 +139,22 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
|
||||
// this.setEditorKit(v ? new StyledEditorKit() : new DefaultEditorKit());
|
||||
this.setEditorKit(v ? htmlKit : styledKit);
|
||||
}
|
||||
public void ScrollTillCaretIsVisible() {throw Err_.new_unimplemented();}
|
||||
public void ScrollTillCaretIsVisible() {throw ErrUtl.NewUnimplemented();}
|
||||
public void Html_css_set(String s) {
|
||||
StyleSheet styleSheet = htmlKit.getStyleSheet();
|
||||
styleSheet.addRule(s);
|
||||
}
|
||||
public String Html_print() {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
sb.Add("selBgn=").Add(Int_.To_str(Html_sel_bgn())).Add_char_crlf();
|
||||
sb.Add("selEnd=").Add(Int_.To_str(Html_sel_end())).Add_char_crlf();
|
||||
sb.Add("selTxt=").Add(Html_sel_text()).Add_char_crlf();
|
||||
Keyval[] atrs = Html_sel_atrs();
|
||||
sb.Add("selBgn=").Add(IntUtl.ToStr(Html_sel_bgn())).AddCharCrlf();
|
||||
sb.Add("selEnd=").Add(IntUtl.ToStr(Html_sel_end())).AddCharCrlf();
|
||||
sb.Add("selTxt=").Add(Html_sel_text()).AddCharCrlf();
|
||||
KeyVal[] atrs = Html_sel_atrs();
|
||||
for (int i = 0; i < atrs.length; i++) {
|
||||
Keyval atr = atrs[i];
|
||||
sb.Add(atr.Key() + "=").Add(atr.Val_to_str_or_null()).Add_char_crlf();
|
||||
KeyVal atr = atrs[i];
|
||||
sb.Add(atr.KeyToStr() + "=").Add(atr.ValToStrOrNull()).AddCharCrlf();
|
||||
}
|
||||
return sb.To_str();
|
||||
return sb.ToStr();
|
||||
}
|
||||
Element Html_sel_elm() {
|
||||
HTMLDocument doc = (HTMLDocument)this.getDocument();
|
||||
@@ -163,14 +174,14 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
|
||||
public String Html_doc_html() {
|
||||
Document doc = this.getDocument();
|
||||
try {return this.getDocument().getText(0, doc.getLength());}
|
||||
catch (Exception e) {throw Err_.new_exc(e, "ui", "Html_doc_html");}
|
||||
catch (Exception e) {throw ErrUtl.NewArgs(e, "Html_doc_html");}
|
||||
}
|
||||
public String Html_sel_text() {
|
||||
Element elm = Html_sel_elm();
|
||||
int sel_bgn = elm.getStartOffset();
|
||||
int sel_end = elm.getEndOffset();
|
||||
try {return this.getDocument().getText(sel_bgn, sel_end - sel_bgn);}
|
||||
catch (Exception e) {throw Err_.new_exc(e, "ui", "Html_sel_text");}
|
||||
catch (Exception e) {throw ErrUtl.NewArgs(e, "Html_sel_text");}
|
||||
}
|
||||
static void Html_sel_atrs(AttributeSet atrs, List_adp list, String ownerKey, String dlm) {
|
||||
if (atrs == null) return;
|
||||
@@ -184,15 +195,15 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
|
||||
if (atr_val instanceof javax.swing.text.AttributeSet)
|
||||
Html_sel_atrs((AttributeSet)atr_val, list, itm_key, dlm);
|
||||
else
|
||||
list.Add(Keyval_.new_(itm_key, atr_val));
|
||||
list.Add(KeyVal.NewStr(itm_key, atr_val));
|
||||
}
|
||||
}
|
||||
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;
|
||||
public KeyVal[] Html_sel_atrs() {
|
||||
if (StringUtl.Eq(this.getContentType(), "text/plain")) return KeyValUtl.AryEmpty;
|
||||
Element elm = Html_sel_elm(); if (elm == null) return KeyValUtl.AryEmpty;
|
||||
List_adp sel_atrs_list = List_adp_.New();
|
||||
Html_sel_atrs(elm.getAttributes(), sel_atrs_list, null, ".");
|
||||
return (Keyval[])sel_atrs_list.ToAry(Keyval.class);
|
||||
return (KeyVal[])sel_atrs_list.ToAry(KeyVal.class);
|
||||
}
|
||||
|
||||
@Override public void processKeyEvent(KeyEvent e) {
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws;
|
||||
import java.awt.AWTKeyStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Insets;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.swing.AbstractAction;
|
||||
@@ -35,7 +34,8 @@ import javax.swing.text.Document;
|
||||
import javax.swing.undo.CannotRedoException;
|
||||
import javax.swing.undo.CannotUndoException;
|
||||
import javax.swing.undo.UndoManager;
|
||||
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.GfuiAlign;
|
||||
import gplx.gfui.GfuiAlign_;
|
||||
import gplx.gfui.PointAdp;
|
||||
@@ -44,8 +44,10 @@ import gplx.gfui.RectAdp;
|
||||
import gplx.gfui.SizeAdp;
|
||||
import gplx.gfui.controls.elems.GfuiElem;
|
||||
import gplx.gfui.draws.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.controls.windows.*;
|
||||
import gplx.gfui.ipts.*;
|
||||
import gplx.gfui.layouts.swts.*;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GxwTextMemo_lang extends JScrollPane implements GxwTextMemo {
|
||||
public JTextArea Inner() {return txt_box;} GxwTextBox_lang txt_box;
|
||||
public GxwCore_base Core() {return core;} GxwCore_base core;
|
||||
@@ -56,7 +58,7 @@ public class GxwTextMemo_lang extends JScrollPane implements GxwTextMemo {
|
||||
else if (c.getRGB() == Color.WHITE.getRGB()) txt_box.setCaretColor(Color.BLACK);
|
||||
super.setBackground(c);
|
||||
}
|
||||
public void ScrollTillCaretIsVisible() {throw Err_.new_unimplemented();}
|
||||
public void ScrollTillCaretIsVisible() {throw ErrUtl.NewUnimplemented();}
|
||||
public void Margins_set(int left, int top, int right, int bot) {
|
||||
if (left == 0 && right == 0) {
|
||||
txt_box.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
@@ -96,7 +98,7 @@ public class GxwTextMemo_lang extends JScrollPane implements GxwTextMemo {
|
||||
// UIManager.put(key, fontDefinition);
|
||||
// }
|
||||
// }
|
||||
} @gplx.Internal protected GxwTextMemo_lang() {}
|
||||
} public GxwTextMemo_lang() {}
|
||||
void InitUndoMgr() {
|
||||
final UndoManager undo = new UndoManager();
|
||||
Document doc = txt_box.getDocument();
|
||||
@@ -158,7 +160,7 @@ public class GxwTextMemo_lang extends JScrollPane implements GxwTextMemo {
|
||||
return 40;
|
||||
// return this.getStyledDocument(). .getLineCount();
|
||||
}
|
||||
public int ScreenCount() {return Int_.DivAndRoundUp(this.LinesTotal(), this.LinesPerScreen());}
|
||||
public int ScreenCount() {return IntUtl.DivAndRoundUp(this.LinesTotal(), this.LinesPerScreen());}
|
||||
public int LineLength(int lineIndex) {return LineLength(this, lineIndex);}
|
||||
public int CharIndexOfFirst() {
|
||||
int firstLineIndex = LineIndexOfFirst();
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.gfui.imgs.*;
|
||||
public interface GxwWin extends GxwElem {
|
||||
IconAdp IconWin(); void IconWin_set(IconAdp v);
|
||||
|
||||
@@ -1,41 +1,36 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import javax.swing.JDesktopPane;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.*;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
@@ -58,7 +53,7 @@ public class GxwWin_lang extends JFrame implements GxwWin, WindowListener {
|
||||
icon = i;
|
||||
this.setIconImage(i.XtoImage());
|
||||
}
|
||||
public void OpenedCmd_set(Gfo_invk_cmd v) {whenLoadedCmd = v;} Gfo_invk_cmd whenLoadedCmd = Gfo_invk_cmd.Noop;
|
||||
public void OpenedCmd_set(Gfo_invk_cmd v) {whenLoadedCmd = v;} Gfo_invk_cmd whenLoadedCmd = Gfo_invk_cmd.Noop;
|
||||
public GxwCore_base Core() {return ctrlMgr;} GxwCore_base ctrlMgr;
|
||||
public GxwCbkHost Host() {return host;} public void Host_set(GxwCbkHost host) {this.host = host;} GxwCbkHost host = GxwCbkHost_.Null;
|
||||
public String TextVal() {return this.getTitle();} public void TextVal_set(String v) {this.setTitle(v);}
|
||||
@@ -251,17 +246,17 @@ class GxwElemFactory_swt extends GxwElemFactory_base {
|
||||
public GxwWin win_app_() {
|
||||
return new Swt_win(display);
|
||||
}
|
||||
public GxwWin win_tool_(Keyval_hash ctorArgs) {
|
||||
public GxwWin win_tool_(KeyValHash ctorArgs) {
|
||||
return null;
|
||||
}
|
||||
public GxwWin win_toaster_(Keyval_hash ctorArgs) {
|
||||
public GxwWin win_toaster_(KeyValHash ctorArgs) {
|
||||
return null;
|
||||
}
|
||||
public GxwElem lbl_() {return null;}
|
||||
public GxwTextFld text_fld_() {return null;}
|
||||
public GxwTextFld text_memo_() {return null;}
|
||||
public GxwTextHtml text_html_() {return null;}
|
||||
public GxwCheckListBox checkListBox_(Keyval_hash ctorArgs) {throw Err_.new_unimplemented();}
|
||||
public GxwCheckListBox checkListBox_(KeyValHash ctorArgs) {throw ErrUtl.NewUnimplemented();}
|
||||
public GxwComboBox comboBox_() {return null;}
|
||||
public GxwListBox listBox_() {return null;}
|
||||
}
|
||||
|
||||
@@ -13,18 +13,21 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
public interface Gxw_html extends GxwElem {
|
||||
void Html_doc_html_load_by_mem(String html);
|
||||
void Html_doc_html_load_by_url(Io_url path, String html);
|
||||
byte Html_doc_html_load_tid(); void Html_doc_html_load_tid_(byte v);
|
||||
void Html_js_enabled_(boolean v);
|
||||
String Html_js_eval_proc_as_str (String name, Object... args);
|
||||
boolean Html_js_eval_proc_as_bool (String name, Object... args);
|
||||
String Html_js_eval_script (String script);
|
||||
Object Html_js_eval_script_as_obj (String script);
|
||||
void Html_js_cbks_add (String js_func_name, Gfo_invk invk);
|
||||
String Html_js_send_json (String name, String data);
|
||||
void Html_invk_src_(Gfo_evt_itm v);
|
||||
void Html_dispose();
|
||||
}
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.evts.Gfo_evt_itm;
|
||||
import gplx.libs.files.Io_url;
|
||||
public interface Gxw_html extends GxwElem {
|
||||
void Html_doc_html_load_by_mem(String html);
|
||||
void Html_doc_html_load_by_url(Io_url path, String html);
|
||||
byte Html_doc_html_load_tid(); void Html_doc_html_load_tid_(byte v);
|
||||
void Html_js_enabled_(boolean v);
|
||||
String Html_js_eval_proc_as_str (String name, Object... args);
|
||||
boolean Html_js_eval_proc_as_bool (String name, Object... args);
|
||||
String Html_js_eval_script (String script);
|
||||
Object Html_js_eval_script_as_obj (String script);
|
||||
void Html_js_cbks_add (String js_func_name, Gfo_invk invk);
|
||||
String Html_js_send_json (String name, String data);
|
||||
void Html_invk_src_(Gfo_evt_itm v);
|
||||
void Html_dispose();
|
||||
}
|
||||
|
||||
@@ -13,12 +13,14 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
public class Gxw_html_load_tid_ {
|
||||
public static final byte Tid_mem = 0, Tid_url = 1;
|
||||
public static byte Xto_tid(String s) {
|
||||
if (String_.Eq(s, "mem")) return Tid_mem;
|
||||
else if (String_.Eq(s, "url")) return Tid_url;
|
||||
else throw Err_.new_unimplemented();
|
||||
}
|
||||
}
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class Gxw_html_load_tid_ {
|
||||
public static final byte Tid_mem = 0, Tid_url = 1;
|
||||
public static byte Xto_tid(String s) {
|
||||
if (StringUtl.Eq(s, "mem")) return Tid_mem;
|
||||
else if (StringUtl.Eq(s, "url")) return Tid_url;
|
||||
else throw ErrUtl.NewUnimplemented();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.gxws; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.gxws;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.gfui.imgs.*;
|
||||
public class MockForm extends GxwElem_mock_base implements GxwWin {
|
||||
public IconAdp IconWin() {return null;} public void IconWin_set(IconAdp v) {}
|
||||
|
||||
@@ -13,9 +13,18 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfoMsg_;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.langs.gfs.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.gfxs.*; import gplx.gfui.imgs.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.windows.*;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GfuiBtn extends GfuiElemBase {
|
||||
@Override public boolean Click_able() {return true;}
|
||||
@Override public void Click() {GfuiBtn.DoThis(this, clickMsg, clickInvkCmd);}
|
||||
@@ -34,8 +43,8 @@ public class GfuiBtn extends GfuiElemBase {
|
||||
Object o = Gfo_invk_.Invk_by_key(UnderElem(), Invk_btn_img);
|
||||
return o == UnderElem() ? null : (ImageAdp)o; // NOTE: lgc guard
|
||||
} public GfuiBtn Btn_img_(ImageAdp v) {Gfo_invk_.Invk_by_val(UnderElem(), Invk_btn_img_, v); return this;}
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.control_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.control_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
focusBorder = GfuiBorderMgr.new_().All_(PenAdp_.new_(ColorAdp_.Gray, 1));
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.TextMgr().AlignH_(GfuiAlign_.Mid);
|
||||
@@ -45,14 +54,14 @@ public class GfuiBtn extends GfuiElemBase {
|
||||
Inject_(GfuiFocusXferBnd.Instance);
|
||||
this.CustomDraw_set(true);
|
||||
}
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
this.kit = kit;
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
focusBorder = GfuiBorderMgr.new_().All_(PenAdp_.new_(ColorAdp_.Gray, 1));
|
||||
Inject_(GfuiBtnClickBnd.Instance);
|
||||
Inject_(GfuiFocusXferBnd.Instance);
|
||||
} Gfui_kit kit;
|
||||
@gplx.Internal protected static void DoThis(GfuiElem click, GfoMsg clickMsg, Gfo_invk_cmd clickInvkCmd) {
|
||||
public static void DoThis(GfuiElem click, GfoMsg clickMsg, Gfo_invk_cmd clickInvkCmd) {
|
||||
try {
|
||||
if (clickInvkCmd != null) {
|
||||
GfsCtx ctx = GfsCtx.new_().MsgSrc_(click);
|
||||
@@ -60,12 +69,12 @@ public class GfuiBtn extends GfuiElemBase {
|
||||
}
|
||||
else if (clickMsg != null && clickMsg != GfoMsg_.Null) {
|
||||
GfsCtx ctx = GfsCtx.new_().MsgSrc_(click);
|
||||
if (String_.Eq(clickMsg.Key(), "."))
|
||||
if (StringUtl.Eq(clickMsg.Key(), "."))
|
||||
GfsCore.Instance.ExecOne_to(ctx, click, clickMsg.Subs_getAt(0));
|
||||
else
|
||||
GfsCore.Instance.ExecOne(ctx, clickMsg);
|
||||
}
|
||||
} catch (Exception e) {GfuiEnv_.ShowMsg(Err_.Message_gplx_full(e));}
|
||||
} catch (Exception e) {GfuiEnv_.ShowMsg(ErrUtl.ToStrFull(e));}
|
||||
}
|
||||
public static final String Invk_btn_img = "btn_img", Invk_btn_img_ = "btn_img_";
|
||||
public static final String CFG_border_on_ = "border_on_";
|
||||
|
||||
@@ -13,7 +13,12 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.*;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.core.interfaces.*;
|
||||
class GfuiBtnClickBnd implements InjectAble, Gfo_invk {
|
||||
|
||||
@@ -1,23 +1,29 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.imgs.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GfuiBtn_ {
|
||||
public static GfuiBtn as_(Object obj) {return obj instanceof GfuiBtn ? (GfuiBtn)obj : null;}
|
||||
public static GfuiBtn cast(Object obj) {try {return (GfuiBtn)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiBtn.class, obj);}}
|
||||
public static GfuiBtn cast(Object obj) {try {return (GfuiBtn)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, GfuiBtn.class, obj);}}
|
||||
|
||||
public static GfuiBtn msg_(String key, GfuiElem owner, GfoMsg msg) {
|
||||
GfuiBtn rv = new_(key); rv.Owner_(owner);
|
||||
@@ -29,7 +35,7 @@ public class GfuiBtn_ {
|
||||
rv.Click_invk(Gfo_invk_cmd.New_by_key(invk, m));
|
||||
return rv;
|
||||
}
|
||||
public static GfuiBtn kit_(Gfui_kit kit, String key, GxwElem elm, Keyval_hash ctorArgs) {
|
||||
public static GfuiBtn kit_(Gfui_kit kit, String key, GxwElem elm, KeyValHash ctorArgs) {
|
||||
GfuiBtn rv = new GfuiBtn();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, elm, ctorArgs);
|
||||
return rv;
|
||||
@@ -40,7 +46,7 @@ public class GfuiBtn_ {
|
||||
rv.Key_of_GfuiElem_(key);
|
||||
return rv;
|
||||
}
|
||||
@gplx.Internal protected static void FocusBorderRect_set(GfuiBorderMgr borderMgr, GfuiElem elem) {
|
||||
public static void FocusBorderRect_set(GfuiBorderMgr borderMgr, GfuiElem elem) {
|
||||
borderMgr.Bounds_sync(RectAdp_.new_(3, 3, elem.Width() - 6, elem.Height() - 6));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.gfxs.*; import gplx.gfui.imgs.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.windows.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.gfxs.*;
|
||||
import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.windows.*;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GfuiChkBox extends GfuiElemBase {
|
||||
public boolean Val() {return val;} private boolean val;
|
||||
public void Val_set(boolean val) {
|
||||
@@ -26,8 +32,8 @@ public class GfuiChkBox extends GfuiElemBase {
|
||||
this.val = val;//(boolean)v; // NOTE: do not resend message
|
||||
this.Redraw();
|
||||
}
|
||||
@gplx.Internal protected void Click_msg_(GfoMsg v) {clickMsg = v;} GfoMsg clickMsg;
|
||||
@gplx.Internal protected GfuiChkBox Click_invk(Gfo_invk_cmd v) {clickInvkCmd = v; return this;} Gfo_invk_cmd clickInvkCmd;
|
||||
public void Click_msg_(GfoMsg v) {clickMsg = v;} GfoMsg clickMsg;
|
||||
public GfuiChkBox Click_invk(Gfo_invk_cmd v) {clickInvkCmd = v; return this;} Gfo_invk_cmd clickInvkCmd;
|
||||
public GfuiBorderMgr FocusBorder() {return focusBorder;} GfuiBorderMgr focusBorder = GfuiBorderMgr.new_();
|
||||
@Override public boolean Click_able() {return true;}
|
||||
@Override public void Click() {
|
||||
@@ -37,7 +43,7 @@ public class GfuiChkBox extends GfuiElemBase {
|
||||
public GfuiAlign AlignH() {return alignH;} public void AlignH_set(GfuiAlign v) {alignH = v;} GfuiAlign alignH = GfuiAlign_.Mid;
|
||||
public GfuiAlign AlignV() {return alignV;} public void AlignV_set(GfuiAlign v) {alignV = v;} GfuiAlign alignV = GfuiAlign_.Mid;
|
||||
public PointAdp ChkAlignCustom() {return chkAlignCustom;} public void ChkAlignCustom_set(PointAdp val) {chkAlignCustom = val;} PointAdp chkAlignCustom = PointAdp_.Zero;
|
||||
@gplx.Internal protected PenAdp ChkPen() {return chkPen;} PenAdp chkPen = PenAdp_.new_(ColorAdp_.Black);
|
||||
public PenAdp ChkPen() {return chkPen;} PenAdp chkPen = PenAdp_.new_(ColorAdp_.Black);
|
||||
@Override public boolean PaintCbk(PaintArgs args) {
|
||||
super.PaintCbk(args);
|
||||
GfuiChkBox_.DrawCheckBox(this, args.Graphics());
|
||||
@@ -50,8 +56,8 @@ public class GfuiChkBox extends GfuiElemBase {
|
||||
}
|
||||
@Override public boolean FocusGotCbk() {super.FocusGotCbk(); this.Redraw(); return true;} // Redraw for focusBorder
|
||||
@Override public boolean FocusLostCbk() {super.FocusLostCbk(); this.Redraw(); return true;} // Redraw for focusBorder
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
focusBorder.All_(PenAdp_.new_(ColorAdp_.Gray, 1));
|
||||
Inject_(GfuiFocusXferBnd.Instance).Inject_(GfuiBtnClickBnd.Instance);
|
||||
|
||||
@@ -1,24 +1,30 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.gfui.*;
|
||||
import gplx.gfui.gfxs.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.basics.utls.FloatUtl;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GfuiChkBox_ {
|
||||
public static GfuiChkBox as_(Object obj) {return obj instanceof GfuiChkBox ? (GfuiChkBox)obj : null;}
|
||||
public static GfuiChkBox cast(Object obj) {try {return (GfuiChkBox)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiChkBox.class, obj);}}
|
||||
@gplx.Internal protected static GfuiChkBox new_() {
|
||||
public static GfuiChkBox cast(Object obj) {try {return (GfuiChkBox)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, GfuiChkBox.class, obj);}}
|
||||
public static GfuiChkBox new_() {
|
||||
GfuiChkBox rv = new GfuiChkBox();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_true_());
|
||||
return rv;
|
||||
@@ -65,7 +71,7 @@ public class GfuiChkBox_ {
|
||||
if (box.Focus_has()) {
|
||||
// -1 so border does not start right on top of text; RoundUp to give a little more space to edges
|
||||
// +2 so that focusRect does not overlap mnemonic (in C#)
|
||||
box.FocusBorder().Bounds_sync(RectAdp_.new_((int)textRect.X() - 1, (int)cboxRect.Y(), Float_.RoundUp(textRect.Width()), Float_.RoundUp(cboxRect.Height())));
|
||||
box.FocusBorder().Bounds_sync(RectAdp_.new_((int)textRect.X() - 1, (int)cboxRect.Y(), FloatUtl.RoundUp(textRect.Width()), FloatUtl.RoundUp(cboxRect.Height())));
|
||||
box.FocusBorder().DrawData(gfx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.gfui.draws.*;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GfuiComboBox extends GfuiElemBase {
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.combo = (GxwComboBox)this.UnderElem();
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.comboBox_();} private GxwComboBox combo;
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.comboBox_();} private GxwComboBox combo;
|
||||
public ColorAdp Border_color() {return combo.Border_color();} public void Border_color_(ColorAdp v) {combo.Border_color_(v);}
|
||||
public int SelBgn() {return combo.SelBgn();} public void SelBgn_set(int v) {combo.SelBgn_set(v); Gfo_evt_mgr_.Pub(this, Evt__selection_start_changed);}
|
||||
public int SelLen() {return combo.SelLen();} public void SelLen_set(int v) {combo.SelLen_set(v);}
|
||||
@@ -57,7 +59,7 @@ public class GfuiComboBox extends GfuiElemBase {
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_true_());
|
||||
return rv;
|
||||
}
|
||||
public static GfuiComboBox kit_(Gfui_kit kit, String key, GxwElem elm, Keyval_hash ctorArgs) {
|
||||
public static GfuiComboBox kit_(Gfui_kit kit, String key, GxwElem elm, KeyValHash ctorArgs) {
|
||||
GfuiComboBox rv = new GfuiComboBox();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, elm, ctorArgs);
|
||||
rv.combo = (GxwComboBox)elm;
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.gfxs.*; import gplx.gfui.imgs.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.gfui.gfxs.*;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GfuiLbl extends GfuiElemBase { // standard label does not support tooltips
|
||||
@Override public void Click() {
|
||||
int focusOrder = this.OwnerElem().SubElems().IndexOfA(this);
|
||||
@@ -26,13 +28,13 @@ public class GfuiLbl extends GfuiElemBase { // standard label does not support t
|
||||
this.TextMgr().DrawData(args.Graphics());
|
||||
return true;
|
||||
}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.CustomDraw_set(true);
|
||||
}
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
this.CustomDraw_set(true);
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.lbl_();}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.standards; import gplx.gfui.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GfuiLbl_ {
|
||||
public static GfuiLbl sub_(String key, GfuiElem owner) {
|
||||
GfuiLbl rv = new_();
|
||||
@@ -22,7 +23,7 @@ public class GfuiLbl_ {
|
||||
rv.TextMgr().AlignH_(GfuiAlign_.Mid);
|
||||
return rv;
|
||||
}
|
||||
public static GfuiLbl kit_(Gfui_kit kit, String key, GxwElem elm, Keyval_hash ctorArgs) {
|
||||
public static GfuiLbl kit_(Gfui_kit kit, String key, GxwElem elm, KeyValHash ctorArgs) {
|
||||
GfuiLbl rv = new GfuiLbl();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, elm, ctorArgs);
|
||||
return rv;
|
||||
@@ -42,7 +43,7 @@ public class GfuiLbl_ {
|
||||
return rv;
|
||||
}
|
||||
public static final String Text_Null = null;
|
||||
@gplx.Internal protected static GfuiLbl new_() {
|
||||
public static GfuiLbl new_() {
|
||||
GfuiLbl rv = new GfuiLbl();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_false_());
|
||||
return rv;
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.core.lists.*; /*EnumerAble*/
|
||||
import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GfuiListBox extends GfuiElemBase {
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.listBox_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.listBox_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.listBox = (GxwListBox)UnderElem();
|
||||
}
|
||||
|
||||
@@ -13,9 +13,14 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.draws.*;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GfuiTextBox extends GfuiElemBase {
|
||||
public static final String SelectionStartChanged_evt = "SelectionStartChanged";
|
||||
|
||||
@@ -24,12 +29,12 @@ public class GfuiTextBox extends GfuiElemBase {
|
||||
public int SelBgn() {return textBox.SelBgn();} public void SelBgn_set(int v) {textBox.SelBgn_set(v); Gfo_evt_mgr_.Pub(this, SelectionStartChanged_evt);}
|
||||
public int SelLen() {return textBox.SelLen();} public void SelLen_set(int v) {textBox.SelLen_set(v);}
|
||||
public String SelText() {
|
||||
return String_.MidByLen(this.TextMgr().Val(), this.SelBgn(), this.SelLen());
|
||||
return StringUtl.MidByLen(this.TextMgr().Val(), this.SelBgn(), this.SelLen());
|
||||
}
|
||||
public void Focus_select_all() {
|
||||
this.Focus();
|
||||
this.SelBgn_set(0);
|
||||
int len = String_.Len(this.Text());
|
||||
int len = StringUtl.Len(this.Text());
|
||||
this.SelLen_set(len);
|
||||
}
|
||||
public boolean OverrideTabKey() {return textBox.OverrideTabKey();} public void OverrideTabKey_(boolean val) {textBox.OverrideTabKey_(val);}
|
||||
@@ -51,16 +56,16 @@ public class GfuiTextBox extends GfuiElemBase {
|
||||
if (val == false)
|
||||
this.Height_(13); // WORKAROUND (WinForms): if border is off, height automatically becomes 13 and immutable for singleLine fields; affects statusBox in opal.imgs which will show with small gap over bottom of screen
|
||||
}
|
||||
@gplx.Internal @Override protected void Click_key_set_(String v) {}// TextBox's shouldn't have clickKeys; among other things, .Text is used to set ClickKey, which for textBox may be very large
|
||||
@Override public void Click_key_set_(String v) {}// TextBox's shouldn't have clickKeys; among other things, .Text is used to set ClickKey, which for textBox may be very large
|
||||
|
||||
@gplx.Internal protected void SetTextBox(GxwTextFld textBox) {this.textBox = textBox;}
|
||||
public void SetTextBox(GxwTextFld textBox) {this.textBox = textBox;}
|
||||
public void CreateControlIfNeeded() {textBox.CreateControlIfNeeded();}
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.text_fld_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.text_fld_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
textBox = (GxwTextFld)this.UnderElem();
|
||||
} GxwTextFld textBox;
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
textBox = (GxwTextFld)underElem;
|
||||
}
|
||||
|
||||
@@ -13,11 +13,13 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GfuiTextBox_ {
|
||||
public static GfuiTextBox as_(Object obj) {return obj instanceof GfuiTextBox ? (GfuiTextBox)obj : null;}
|
||||
public static GfuiTextBox cast(Object obj) {try {return (GfuiTextBox)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiTextBox.class, obj);}}
|
||||
public static GfuiTextBox cast(Object obj) {try {return (GfuiTextBox)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, GfuiTextBox.class, obj);}}
|
||||
public static final String NewLine = "\n";
|
||||
public static final String Ctor_Memo = "TextBox_Memo";
|
||||
|
||||
@@ -37,7 +39,7 @@ public class GfuiTextBox_ {
|
||||
rv.Key_of_GfuiElem_(key).Owner_(owner);
|
||||
return rv;
|
||||
}
|
||||
public static GfuiTextBox kit_(Gfui_kit kit, String key, GxwTextFld wk_textBox, Keyval_hash ctorArgs) {
|
||||
public static GfuiTextBox kit_(Gfui_kit kit, String key, GxwTextFld wk_textBox, KeyValHash ctorArgs) {
|
||||
GfuiTextBox rv = new GfuiTextBox();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, wk_textBox, ctorArgs);
|
||||
return rv;
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.gfui.*;
|
||||
import gplx.gfui.controls.gxws.*;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class GfuiTextMemo extends GfuiTextBox { public int LinesPerScreen() {return textBox.LinesPerScreen();}
|
||||
public int LinesTotal() {return textBox.LinesTotal();}
|
||||
public int ScreenCount() {return Int_.DivAndRoundUp(this.LinesTotal(), this.LinesPerScreen());}
|
||||
public int ScreenCount() {return IntUtl.DivAndRoundUp(this.LinesTotal(), this.LinesPerScreen());}
|
||||
public int CharIndexOfFirst() {return textBox.CharIndexOfFirst();}
|
||||
public int CharIndexOf(int lineIndex) {return textBox.CharIndexOf(lineIndex);}
|
||||
public int CharIndexAtLine(int lineIndex) {return textBox.CharIndexOf(lineIndex);}
|
||||
@@ -31,8 +34,8 @@ public class GfuiTextMemo extends GfuiTextBox { public int LinesPerScreen() {re
|
||||
public void SelectionStart_toFirstChar() {textBox.SelectionStart_toFirstChar(); Gfo_evt_mgr_.Pub(this, SelectionStartChanged_evt);}
|
||||
public void ScrollTillSelectionStartIsFirstLine() {textBox.ScrollTillSelectionStartIsFirstLine();}
|
||||
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.text_memo_();}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.text_memo_();}
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
textBox = (GxwTextMemo)UnderElem();
|
||||
this.SetTextBox(textBox);
|
||||
|
||||
@@ -13,12 +13,13 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
public class Gfui_grp extends GfuiElemBase {
|
||||
public static Gfui_grp kit_(Gfui_kit kit, String key, GxwElem under, Keyval_hash ctor_args) {
|
||||
Gfui_grp rv = new Gfui_grp();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, under, ctor_args);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class Gfui_grp extends GfuiElemBase {
|
||||
public static Gfui_grp kit_(Gfui_kit kit, String key, GxwElem under, KeyValHash ctor_args) {
|
||||
Gfui_grp rv = new Gfui_grp();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, under, ctor_args);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,16 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfoMsg_;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.frameworks.evts.Gfo_evt_itm;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import gplx.libs.files.Io_url;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class Gfui_html extends GfuiElemBase {
|
||||
public void Under_html_(Gxw_html v) {under = v;} private Gxw_html under;
|
||||
public void Html_doc_html_load_by_mem(String html) {under.Html_doc_html_load_by_mem(html);}
|
||||
@@ -34,7 +42,7 @@ public class Gfui_html extends GfuiElemBase {
|
||||
this.Html_doc_html_load_by_mem(v);
|
||||
return this;
|
||||
}
|
||||
public static Gfui_html kit_(Gfui_kit kit, String key, Gxw_html under, Keyval_hash ctorArgs) {
|
||||
public static Gfui_html kit_(Gfui_kit kit, String key, Gxw_html under, KeyValHash ctorArgs) {
|
||||
Gfui_html rv = new Gfui_html();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, (GxwElem)under, ctorArgs);
|
||||
rv.under = under;
|
||||
@@ -54,7 +62,7 @@ public class Gfui_html extends GfuiElemBase {
|
||||
String proc = (String)args[0];
|
||||
GfoMsg rv = GfoMsg_.new_parse_(proc);
|
||||
for (int i = 1; i < args.length; i++)
|
||||
rv.Add(Int_.To_str(i), args[i]); // NOTE: args[i] can be either String or String[]
|
||||
rv.Add(IntUtl.ToStr(i), args[i]); // NOTE: args[i] can be either String or String[]
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,17 +13,18 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
public class Gfui_tab_itm extends GfuiElemBase {
|
||||
private Gxw_tab_itm under;
|
||||
public String Tab_name() {return under.Tab_name();} public void Tab_name_(String v) {under.Tab_name_(v);}
|
||||
public String Tab_tip_text() {return under.Tab_tip_text();} public void Tab_tip_text_(String v) {under.Tab_tip_text_(v);}
|
||||
public void Subs_add(GfuiElem elem) {under.Subs_add(elem);}
|
||||
public static Gfui_tab_itm kit_(Gfui_kit kit, String key, Gxw_tab_itm under, Keyval_hash ctor_args) {
|
||||
Gfui_tab_itm rv = new Gfui_tab_itm();
|
||||
// rv.ctor_kit_GfuiElemBase(kit, key, (GxwElem)under, ctor_args); // causes swt_tab_itm to break, since it's not a real Swt Control
|
||||
rv.under = under;
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class Gfui_tab_itm extends GfuiElemBase {
|
||||
private Gxw_tab_itm under;
|
||||
public String Tab_name() {return under.Tab_name();} public void Tab_name_(String v) {under.Tab_name_(v);}
|
||||
public String Tab_tip_text() {return under.Tab_tip_text();} public void Tab_tip_text_(String v) {under.Tab_tip_text_(v);}
|
||||
public void Subs_add(GfuiElem elem) {under.Subs_add(elem);}
|
||||
public static Gfui_tab_itm kit_(Gfui_kit kit, String key, Gxw_tab_itm under, KeyValHash ctor_args) {
|
||||
Gfui_tab_itm rv = new Gfui_tab_itm();
|
||||
// rv.ctor_kit_GfuiElemBase(kit, key, (GxwElem)under, ctor_args); // causes swt_tab_itm to break, since it's not a real Swt Control
|
||||
rv.under = under;
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import org.junit.*;
|
||||
public class Gfui_tab_itm_data_tst {
|
||||
@Before public void init() {} private Gfui_tab_itm_data_fxt fxt = new Gfui_tab_itm_data_fxt();
|
||||
@@ -25,6 +26,6 @@ public class Gfui_tab_itm_data_tst {
|
||||
}
|
||||
class Gfui_tab_itm_data_fxt {
|
||||
public void Test_Get_idx_after_closing(int cur, int len, int expd) {
|
||||
Tfds.Eq(expd, Gfui_tab_itm_data.Get_idx_after_closing(cur, len));
|
||||
GfoTstr.EqObj(expd, Gfui_tab_itm_data.Get_idx_after_closing(cur, len));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.standards;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class Gfui_tab_mgr extends GfuiElemBase {
|
||||
public void Under_tab_mgr_(Gxw_tab_mgr v) {under = v;} private Gxw_tab_mgr under;
|
||||
public ColorAdp Btns_selected_background() {return under.Btns_selected_background();} public void Btns_selected_background_(ColorAdp v) {under.Btns_selected_background_(v);}
|
||||
@@ -23,7 +24,7 @@ public class Gfui_tab_mgr extends GfuiElemBase {
|
||||
public ColorAdp Btns_unselected_foreground() {return under.Btns_unselected_foreground();} public void Btns_unselected_foreground_(ColorAdp v) {under.Btns_unselected_foreground_(v);}
|
||||
public Gfui_tab_itm Tabs_add(Gfui_tab_itm_data tab_data) {
|
||||
Gxw_tab_itm tab_itm = under.Tabs_add(tab_data);
|
||||
return Gfui_tab_itm.kit_(this.Kit(), tab_data.Key(), tab_itm, new Keyval_hash());
|
||||
return Gfui_tab_itm.kit_(this.Kit(), tab_data.Key(), tab_itm, new KeyValHash());
|
||||
}
|
||||
public int Btns_height() {return under.Btns_height();} public void Btns_height_(int v) {under.Btns_height_(v);}
|
||||
public boolean Btns_place_on_top() {return under.Btns_place_on_top();} public void Btns_place_on_top_(boolean v) {under.Btns_place_on_top_(v);}
|
||||
@@ -33,7 +34,7 @@ public class Gfui_tab_mgr extends GfuiElemBase {
|
||||
public void Tabs_select_by_idx(int idx) {under.Tabs_select_by_idx(idx);}
|
||||
public void Tabs_close_by_idx(int idx) {under.Tabs_close_by_idx(idx);}
|
||||
public void Tabs_switch(int src, int trg) {under.Tabs_switch(src, trg);}
|
||||
public static Gfui_tab_mgr kit_(Gfui_kit kit, String key, Gxw_tab_mgr under, Keyval_hash ctor_args) {
|
||||
public static Gfui_tab_mgr kit_(Gfui_kit kit, String key, Gxw_tab_mgr under, KeyValHash ctor_args) {
|
||||
Gfui_tab_mgr rv = new Gfui_tab_mgr();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, (GxwElem)under, ctor_args);
|
||||
rv.under = under;
|
||||
|
||||
@@ -13,11 +13,11 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.GfoMsg;
|
||||
import gplx.Gfo_evt_mgr_;
|
||||
import gplx.Gfo_invk;
|
||||
import gplx.Gfo_invk_;
|
||||
import gplx.GfsCtx;
|
||||
package gplx.gfui.controls.tabs; import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.core.interfaces.InjectAble;
|
||||
import gplx.gfui.controls.standards.GfuiBtn;
|
||||
import gplx.gfui.controls.standards.GfuiBtn_;
|
||||
@@ -71,7 +71,7 @@ class TabBnd_reorderTab implements InjectAble, Gfo_invk {
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, btn, this, MovePrev_cmd, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.Left));
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, btn, this, MoveNext_cmd, IptKey_.add_(IptKey_.MOD_1ST, IptKey_.Right));
|
||||
}
|
||||
@gplx.Internal protected void MoveTab(GfuiBtn curBtn, int delta) {
|
||||
public void MoveTab(GfuiBtn curBtn, int delta) {
|
||||
TabPnlItm curItm = tabBox.Mgr().Get_by(curBtn.Key_of_GfuiElem());
|
||||
int curIdx = curItm.Idx();
|
||||
int newIdx = TabBox_.Cycle(delta > 0, curIdx, tabBox.Mgr().Count());
|
||||
|
||||
@@ -13,8 +13,13 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.*;
|
||||
package gplx.gfui.controls.tabs;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.draws.*; import gplx.gfui.layouts.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
public class TabBox extends GfuiElemBase {
|
||||
public int Tabs_Count() {return mgr.Count();}
|
||||
public TabPnlItm Tabs_SelectedItm() {return mgr.CurTab();}
|
||||
@@ -33,9 +38,9 @@ public class TabBox extends GfuiElemBase {
|
||||
TabPnlAreaMgr.Del(this, mgr.Get_at(idx));
|
||||
mgr.Del_at(idx);
|
||||
}
|
||||
@gplx.Internal protected TabBoxMgr Mgr() {return mgr;} TabBoxMgr mgr = TabBoxMgr.new_();
|
||||
public TabBoxMgr Mgr() {return mgr;} TabBoxMgr mgr = TabBoxMgr.new_();
|
||||
public GfuiElem BtnBox() {return btnBox;} GfuiElem btnBox;
|
||||
@gplx.Internal protected GfuiElem PnlBox() {return pnlBox;} GfuiElem pnlBox;
|
||||
public GfuiElem PnlBox() {return pnlBox;} GfuiElem pnlBox;
|
||||
@Override public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, TabBoxEvt_tabSelectByBtn.Key)) TabBoxEvt_tabSelectByBtn.Rcvd(ctx.MsgSrc(), this);
|
||||
else if (ctx.Match(k, TabBoxEvt_tabSelect.Key)) TabBoxEvt_tabSelect.Select(this, ctx, m);
|
||||
@@ -43,7 +48,7 @@ public class TabBox extends GfuiElemBase {
|
||||
else return super.Invk(GfsCtx.Instance, 0, k, m);
|
||||
return this;
|
||||
}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
btnBox = TabBtnAreaMgr.new_("btnBox", this);
|
||||
pnlBox = TabPnlAreaMgr.new_("pnlBox", this);
|
||||
@@ -141,7 +146,7 @@ class TabPnlAreaMgr {
|
||||
newTab.Zorder_front();
|
||||
newTab.Focus();
|
||||
}
|
||||
@gplx.Internal protected static GfuiElemBase pnl_(TabBox tabBox, GfuiElem pnlBox, String key) {
|
||||
public static GfuiElemBase pnl_(TabBox tabBox, GfuiElem pnlBox, String key) {
|
||||
GfuiElemBase rv = new GfuiElemBase();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_false_());
|
||||
rv.Owner_(pnlBox, key);
|
||||
|
||||
@@ -13,14 +13,18 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.tabs;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.types.commons.KeyVal;
|
||||
public class TabBoxEvt_orderChanged {
|
||||
public int CurIdx() {return curIdx;} public TabBoxEvt_orderChanged CurIdx_(int v) {curIdx = v; return this;} int curIdx;
|
||||
public int NewIdx() {return newIdx;} public TabBoxEvt_orderChanged NewIdx_(int v) {newIdx = v; return this;} int newIdx;
|
||||
|
||||
public static final String OrderChanged_evt = "OrderChanged_evt";
|
||||
public static void Publish(TabBox tabBox, int curIdx, int newIdx) {
|
||||
Gfo_evt_mgr_.Pub_vals(tabBox, OrderChanged_evt, Keyval_.new_("curIdx", curIdx), Keyval_.new_("newIdx", newIdx));
|
||||
Gfo_evt_mgr_.Pub_vals(tabBox, OrderChanged_evt, KeyVal.NewStr("curIdx", curIdx), KeyVal.NewStr("newIdx", newIdx));
|
||||
}
|
||||
public static TabBoxEvt_orderChanged Handle(GfsCtx ctx, GfoMsg m) {
|
||||
TabBoxEvt_orderChanged rv = new TabBoxEvt_orderChanged();
|
||||
|
||||
@@ -13,18 +13,21 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.tabs;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
public class TabBoxEvt_tabSelect {
|
||||
public static String Key = "TabBoxEvt_tabSelect";
|
||||
public static final String SelectedChanged_evt = "SelectedChanged_evt";
|
||||
public static void Send(TabBoxMgr tabBoxMgr, TabPnlItm oldTab, TabPnlItm newTab) {
|
||||
Gfo_evt_mgr_.Pub_val(tabBoxMgr, Key, new TabPnlItm[] {oldTab, newTab});
|
||||
}
|
||||
@gplx.Internal protected static void Select(TabBox tabBox, GfsCtx ctx, GfoMsg m) {
|
||||
public static void Select(TabBox tabBox, GfsCtx ctx, GfoMsg m) {
|
||||
TabPnlItm[] ary = (TabPnlItm[])m.CastObj("v");
|
||||
Select(tabBox, ary[0], ary[1]);
|
||||
}
|
||||
@gplx.Internal protected static void Select(TabBox tabBox, TabPnlItm curTabItm, TabPnlItm newTabItm) {
|
||||
public static void Select(TabBox tabBox, TabPnlItm curTabItm, TabPnlItm newTabItm) {
|
||||
TabPnlAreaMgr.Select(tabBox, curTabItm, newTabItm);
|
||||
TabBtnAreaMgr.Select(tabBox, curTabItm, newTabItm);
|
||||
Gfo_evt_mgr_.Pub_val(tabBox, SelectedChanged_evt, newTabItm.Idx());
|
||||
|
||||
@@ -13,12 +13,16 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.*;
|
||||
package gplx.gfui.controls.tabs;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_owner;
|
||||
import gplx.types.basics.lists.Ordered_hash;
|
||||
import gplx.types.basics.lists.Ordered_hash_;
|
||||
public class TabBoxMgr implements Gfo_evt_mgr_owner {
|
||||
public Gfo_evt_mgr Evt_mgr() {if (evt_mgr == null) evt_mgr = new Gfo_evt_mgr(this); return evt_mgr;} Gfo_evt_mgr evt_mgr;
|
||||
public int Count() {return itms.Len();}
|
||||
public TabPnlItm Get_by(String k) {return (TabPnlItm)itms.GetByOrNull(k);}
|
||||
public TabPnlItm Get_at(int i) {return (TabPnlItm)itms.Get_at(i);}
|
||||
public TabPnlItm Get_at(int i) {return (TabPnlItm)itms.GetAt(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.Len());
|
||||
@@ -37,19 +41,19 @@ public class TabBoxMgr implements Gfo_evt_mgr_owner {
|
||||
this.Select(i);
|
||||
}
|
||||
}
|
||||
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) {
|
||||
public void Select(int i) {Select((TabPnlItm)itms.GetAt(i));}
|
||||
public void Move_to(int src, int trg) {itms.MoveTo(src, trg);}
|
||||
public void Reorder(int bgn) {
|
||||
for (int i = bgn; i < itms.Len(); i++) {
|
||||
TabPnlItm itm = (TabPnlItm)itms.Get_at(i);
|
||||
TabPnlItm itm = (TabPnlItm)itms.GetAt(i);
|
||||
itm.Idx_(i);
|
||||
}
|
||||
}
|
||||
@gplx.Internal protected void Select(TabPnlItm newTab) {
|
||||
public void Select(TabPnlItm newTab) {
|
||||
TabPnlItm oldTab = curTab;
|
||||
curTab = newTab;
|
||||
TabBoxEvt_tabSelect.Send(this, oldTab, newTab);
|
||||
}
|
||||
Ordered_hash itms = Ordered_hash_.New();
|
||||
@gplx.Internal protected static TabBoxMgr new_() {return new TabBoxMgr();} TabBoxMgr() {}
|
||||
public static TabBoxMgr new_() {return new TabBoxMgr();} TabBoxMgr() {}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs;
|
||||
import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class TabBox_ {
|
||||
public static TabBox as_(Object obj) {return obj instanceof TabBox ? (TabBox)obj : null;}
|
||||
public static TabBox cast(Object obj) {try {return (TabBox)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, TabBox.class, obj);}}
|
||||
public static TabBox cast(Object obj) {try {return (TabBox)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, TabBox.class, obj);}}
|
||||
public static TabBox new_() {
|
||||
TabBox rv = new TabBox();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_false_());
|
||||
|
||||
@@ -13,8 +13,15 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
import org.junit.*; import gplx.gfui.controls.tabs.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
package gplx.gfui.controls.tabs;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import org.junit.*;
|
||||
import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
public class TabBox_tst {
|
||||
// @Before public void setup() {
|
||||
// fx = TabBoxFxt.new_();
|
||||
@@ -55,7 +62,7 @@ public class TabBox_tst {
|
||||
}
|
||||
class GfuiElemFxt {
|
||||
public GfuiElem UnderElem() {return underElem;} GfuiElem underElem;
|
||||
@gplx.Internal protected GfuiElemFxt tst_X(int expd) {Tfds.Eq(expd, underElem.X()); return this;}
|
||||
public GfuiElemFxt tst_X(int expd) {GfoTstr.EqObj(expd, underElem.X()); return this;}
|
||||
public static GfuiElemFxt new_(GfuiElem elem) {
|
||||
GfuiElemFxt rv = new GfuiElemFxt();
|
||||
rv.underElem = elem;
|
||||
@@ -63,42 +70,42 @@ class GfuiElemFxt {
|
||||
} GfuiElemFxt() {}
|
||||
}
|
||||
class TabBoxFxt implements Gfo_invk {
|
||||
@gplx.Internal protected TabBox TabBox() {return tabBox;}
|
||||
@gplx.Internal protected TabBoxFxt Make(int count) {
|
||||
public TabBox TabBox() {return tabBox;}
|
||||
public TabBoxFxt Make(int count) {
|
||||
for (int i = 0; i < tabBox.Tabs_Count(); i++)
|
||||
tabBox.Tabs_DelAt(0);
|
||||
for (int i = 0; i < count; i++)
|
||||
tabBox.Tabs_Add(Int_.To_str(i), Int_.To_str(i));
|
||||
tabBox.Tabs_Add(IntUtl.ToStr(i), IntUtl.ToStr(i));
|
||||
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) {
|
||||
public TabBoxFxt Del_at(int index) {tabBox.Tabs_DelAt(index); return this;}
|
||||
// public TabBoxFxt Select(int index) {tabBox.Tabs_Select(index); return this;}
|
||||
public GfuiElemFxt FetchBtnAt(int 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) {
|
||||
// public TabBoxFxt tst_BtnX(int idx, int expdX) {
|
||||
// Tfds.Eq(expdX, tabBox.SubBtnArea().Get_at(idx).X());
|
||||
// return this;
|
||||
// }
|
||||
@gplx.Internal protected TabBoxFxt tst_Selected(String expd) {
|
||||
public TabBoxFxt tst_Selected(String expd) {
|
||||
TabPnlItm curTab = tabBox.Tabs_SelectedItm();
|
||||
GfuiBtn btn = (GfuiBtn)tabBox.BtnBox().SubElems().Get_at(curTab.Idx());
|
||||
Tfds.Eq(expd, btn.Text());
|
||||
GfoTstr.EqObj(expd, btn.Text());
|
||||
return this;
|
||||
}
|
||||
@gplx.Internal protected TabBoxFxt tst_Btns(String... expd) {
|
||||
public 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().Get_at(i);
|
||||
actl[i] = button.TextMgr().Val();
|
||||
}
|
||||
Tfds.Eq_ary(expd, actl);
|
||||
GfoTstr.EqLines(expd, actl);
|
||||
return this;
|
||||
}
|
||||
// @gplx.Internal protected TabBoxFxt tst_Raised(boolean expd) {Tfds.Eq(expd, received != null); return this;}
|
||||
// @gplx.Internal protected TabBoxFxt Reorder(int i, int delta) {
|
||||
// public TabBoxFxt tst_Raised(boolean expd) {Tfds.Eq(expd, received != null); return this;}
|
||||
// public TabBoxFxt Reorder(int i, int delta) {
|
||||
// tabBox.Width_(240); // needed for lytMgr
|
||||
// TabBnd_reorderTab reorderBnd = TabBnd_reorderTab.Instance;
|
||||
// received = null;
|
||||
@@ -106,7 +113,7 @@ class TabBoxFxt implements Gfo_invk {
|
||||
// reorderBnd.MoveTab(pnl.SubTabBtn(), delta);
|
||||
// return this;
|
||||
// }
|
||||
// @gplx.Internal protected TabBoxFxt tst_FocusOrder() {
|
||||
// public TabBoxFxt tst_FocusOrder() {
|
||||
// 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());
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.tabs; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
public class TabPnlItm {
|
||||
public String Key() {return key;} private String key;
|
||||
@@ -23,7 +23,7 @@ public class TabPnlItm {
|
||||
return this;
|
||||
} String name;
|
||||
public int Idx() {return idx;}
|
||||
@gplx.Internal protected TabPnlItm Idx_(int val) {
|
||||
public TabPnlItm Idx_(int val) {
|
||||
idx = val;
|
||||
return this;
|
||||
} int idx;
|
||||
|
||||
@@ -13,23 +13,24 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.Err_;
|
||||
import gplx.GfoMsg;
|
||||
import gplx.GfoMsg_;
|
||||
import gplx.Gfo_invk;
|
||||
import gplx.Gfo_invk_;
|
||||
import gplx.Gfo_invk_cmd;
|
||||
import gplx.GfsCtx;
|
||||
import gplx.Io_mgr;
|
||||
import gplx.Io_url;
|
||||
import gplx.Io_url_;
|
||||
import gplx.Object_;
|
||||
import gplx.String_;
|
||||
import gplx.UsrDlg_;
|
||||
import gplx.UsrMsg;
|
||||
import gplx.UsrMsgWkr;
|
||||
import gplx.UsrMsgWkr_;
|
||||
import gplx.core.envs.System_;
|
||||
package gplx.gfui.controls.windows;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfoMsg_;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.libs.files.Io_mgr;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.libs.files.Io_url;
|
||||
import gplx.libs.files.Io_url_;
|
||||
import gplx.types.basics.utls.ObjectUtl;
|
||||
import gplx.libs.dlgs.UsrDlg_;
|
||||
import gplx.libs.dlgs.UsrMsg;
|
||||
import gplx.libs.dlgs.UsrMsgWkr;
|
||||
import gplx.libs.dlgs.UsrMsgWkr_;
|
||||
import gplx.core.envs.SystemUtl;
|
||||
import gplx.gfml.GfmlDataNde;
|
||||
import gplx.gfui.PointAdp;
|
||||
import gplx.gfui.PointAdp_;
|
||||
@@ -103,7 +104,7 @@ public class GfoConsoleWin implements Gfo_invk, UsrMsgWkr {
|
||||
}
|
||||
else {
|
||||
statusBox.Text_(statusBox.Text() + s);
|
||||
statusBox.SelBgn_set(String_.Len(statusBox.Text()) - 1);
|
||||
statusBox.SelBgn_set(StringUtl.Len(statusBox.Text()) - 1);
|
||||
}
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
@@ -126,20 +127,20 @@ class GfoConsoleWinCmds implements Gfo_invk {
|
||||
GfsCore.Instance.ExecRegy("gplx.gfui.GfoConsoleWin.ini");
|
||||
}
|
||||
public void Results_add(String s) {
|
||||
if (!String_.Has_at_end(s, GfuiTextBox_.NewLine))
|
||||
if (!StringUtl.HasAtEnd(s, GfuiTextBox_.NewLine))
|
||||
s += GfuiTextBox_.NewLine;
|
||||
statusBox.Text_(statusBox.Text() + s);
|
||||
statusBox.SelBgn_set(String_.Len(statusBox.Text()) - 1);
|
||||
statusBox.SelBgn_set(StringUtl.Len(statusBox.Text()) - 1);
|
||||
}
|
||||
void Hide() {win.Hide();}
|
||||
void Exec(GfoMsg msg) {
|
||||
String cmdText = consoleBox.SelLen() == 0 ? consoleBox.Text() : consoleBox.SelText();
|
||||
String cmd = FixNewLines(cmdText);
|
||||
GfoMsg runMsg = GfoMsg_.Null;
|
||||
try {runMsg = GfsCore.Instance.MsgParser().ParseToMsg(cmd);} catch (Exception e) {statusBox.Text_("invalid gfml " + Err_.Message_gplx_full(e)); return;}
|
||||
try {runMsg = GfsCore.Instance.MsgParser().ParseToMsg(cmd);} catch (Exception e) {statusBox.Text_("invalid gfml " + ErrUtl.ToStrFull(e)); return;}
|
||||
GfsCtx ctx = GfsCtx.new_();
|
||||
Object rv = GfsCore.Instance.ExecMany(ctx, runMsg);
|
||||
resultBox.Text_(Object_.Xto_str_strict_or_empty(rv));
|
||||
resultBox.Text_(ObjectUtl.ToStrOrEmpty(rv));
|
||||
}
|
||||
void Help() {
|
||||
statusBox.Text_("");
|
||||
@@ -147,20 +148,20 @@ class GfoConsoleWinCmds implements Gfo_invk {
|
||||
String cmdText = "help:'" + consoleBox.SelText() + "';";
|
||||
String cmd = FixNewLines(cmdText);
|
||||
GfoMsg runMsg = GfoMsg_.Null;
|
||||
try {runMsg = GfmlDataNde.XtoMsgNoRoot(cmd);} catch (Exception e) {statusBox.Text_("invalid gfml " + Err_.Message_gplx_full(e)); return;}
|
||||
try {runMsg = GfmlDataNde.XtoMsgNoRoot(cmd);} catch (Exception e) {statusBox.Text_("invalid gfml " + ErrUtl.ToStrFull(e)); return;}
|
||||
GfsCtx ctx = GfsCtx.new_();
|
||||
try {
|
||||
Object rv = GfsCore.Instance.ExecOne(ctx, runMsg);
|
||||
if (rv != Gfo_invk_.Rv_handled && rv != Gfo_invk_.Rv_unhandled) {
|
||||
UsrDlg_.Instance.Note(Object_.Xto_str_strict_or_empty(rv));
|
||||
UsrDlg_.Instance.Note(ObjectUtl.ToStrOrEmpty(rv));
|
||||
}
|
||||
// Results_add(FixNewLines(ctx.Results_XtoStr()));
|
||||
} catch (Exception e) {statusBox.Text_("help failed " + Err_.Message_gplx_full(e)); return;}
|
||||
} catch (Exception e) {statusBox.Text_("help failed " + ErrUtl.ToStrFull(e)); return;}
|
||||
}
|
||||
void Save() {
|
||||
String consoleFilStr = consoleFilBox.Text();
|
||||
Io_url url = Io_url_.Empty;
|
||||
if (String_.Len_eq_0(consoleFilStr)) {
|
||||
if (StringUtl.IsNullOrEmpty(consoleFilStr)) {
|
||||
url = GfuiIoDialogUtl.SelectFile();
|
||||
consoleFilBox.Text_(url.Raw());
|
||||
return;
|
||||
@@ -172,7 +173,7 @@ class GfoConsoleWinCmds implements Gfo_invk {
|
||||
void Load() {
|
||||
String consoleFilStr = consoleFilBox.Text();
|
||||
Io_url dir = Io_url_.Empty;
|
||||
if (String_.Len_eq_0(consoleFilStr))
|
||||
if (StringUtl.IsNullOrEmpty(consoleFilStr))
|
||||
dir = Io_url_.Empty;
|
||||
else {
|
||||
dir = Io_url_.new_any_(consoleFilStr);
|
||||
@@ -182,8 +183,8 @@ class GfoConsoleWinCmds implements Gfo_invk {
|
||||
consoleBox.Text_(Io_mgr.Instance.LoadFilStr(url));
|
||||
}
|
||||
String FixNewLines(String cmd) {
|
||||
cmd = String_.Replace(cmd, "\n", "\r\n");
|
||||
cmd = String_.Replace(cmd, "\r\r", "\r");
|
||||
cmd = StringUtl.Replace(cmd, "\n", "\r\n");
|
||||
cmd = StringUtl.Replace(cmd, "\r\r", "\r");
|
||||
return cmd;
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
@@ -243,8 +244,8 @@ class GfuiTextBoxLogger implements Gfo_invk {
|
||||
public void Write(String s) {
|
||||
if (!owner.Enabled()) return;
|
||||
if (!win.Visible()) win.Visible_set(true);
|
||||
textToShow += tbox.Text() + String_.as_(s)+ String_.CrLf;
|
||||
long curTick = System_.Ticks();
|
||||
textToShow += tbox.Text() + StringUtl.CastOrNull(s)+ StringUtl.CrLf;
|
||||
long curTick = SystemUtl.Ticks();
|
||||
// if (curTick - lastTick > 500) {
|
||||
WriteText(textToShow);
|
||||
textToShow = "";
|
||||
@@ -261,7 +262,7 @@ class GfuiTextBoxLogger implements Gfo_invk {
|
||||
}
|
||||
void Invk_WriteText(String text) {
|
||||
tbox.Text_(text);
|
||||
tbox.SelBgn_set(String_.Len(text) - 1);
|
||||
tbox.SelBgn_set(StringUtl.Len(text) - 1);
|
||||
if (!tbox.Focus_has()) tbox.Focus();
|
||||
}
|
||||
void WhenTick() {
|
||||
|
||||
@@ -13,10 +13,10 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.GfoMsg;
|
||||
import gplx.Gfo_invk;
|
||||
import gplx.Gfo_invk_;
|
||||
import gplx.GfsCtx;
|
||||
package gplx.gfui.controls.windows; import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.core.interfaces.InjectAble;
|
||||
import gplx.gfui.controls.elems.GfuiElem;
|
||||
import gplx.gfui.ipts.IptBnd_;
|
||||
|
||||
@@ -13,8 +13,11 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.windows;
|
||||
import gplx.gfui.controls.elems.*;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_owner;
|
||||
public class GfuiFocusMgr implements Gfo_evt_mgr_owner {
|
||||
public static final String FocusChanged_evt = "focusChanged_evt";
|
||||
public Gfo_evt_mgr Evt_mgr() {if (evt_mgr == null) evt_mgr = new Gfo_evt_mgr(this); return evt_mgr;} Gfo_evt_mgr evt_mgr;
|
||||
|
||||
@@ -13,10 +13,13 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*;
|
||||
package gplx.gfui.controls.windows;
|
||||
import gplx.gfui.controls.elems.*;
|
||||
import gplx.objects.lists.CompareAbleUtl;
|
||||
import gplx.objects.lists.ComparerAble;
|
||||
import gplx.types.commons.lists.CompareAbleUtl;
|
||||
import gplx.types.commons.lists.ComparerAble;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
public class GfuiFocusOrderer {
|
||||
public static void OrderByX(GfuiElem owner) {Order(owner, xcomparer, 0);}
|
||||
public static void OrderByY(GfuiElem owner) {Order(owner, ycomparer, 0);}
|
||||
@@ -45,7 +48,7 @@ class GfuiFocusOrderer_cls_x implements ComparerAble {
|
||||
GfuiElem lhs = (GfuiElem)lhsObj, rhs = (GfuiElem)rhsObj;
|
||||
if (lhs.Y() < rhs.Y()) return CompareAbleUtl.Less;
|
||||
else if (lhs.Y() > rhs.Y()) return CompareAbleUtl.More;
|
||||
else return Int_.Compare(lhs.X(), rhs.X());
|
||||
else return IntUtl.Compare(lhs.X(), rhs.X());
|
||||
}
|
||||
}
|
||||
class GfuiFocusOrderer_cls_y implements ComparerAble {
|
||||
@@ -53,6 +56,6 @@ class GfuiFocusOrderer_cls_y implements ComparerAble {
|
||||
GfuiElem lhs = (GfuiElem)lhsObj, rhs = (GfuiElem)rhsObj;
|
||||
if (lhs.X() < rhs.X()) return CompareAbleUtl.Less;
|
||||
else if (lhs.X() > rhs.X()) return CompareAbleUtl.More;
|
||||
else return Int_.Compare(lhs.Y(), rhs.Y());
|
||||
else return IntUtl.Compare(lhs.Y(), rhs.Y());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,11 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*;
|
||||
package gplx.gfui.controls.windows; import gplx.gfui.*;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import org.junit.*; import gplx.gfui.controls.elems.*;
|
||||
public class GfuiFocusOrderer_tst {
|
||||
@Before public void setup() {
|
||||
@@ -67,7 +71,7 @@ public class GfuiFocusOrderer_tst {
|
||||
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_.To_str(i), owner);
|
||||
GfuiElem sub = GfuiElem_.sub_(IntUtl.ToStr(i), owner);
|
||||
sub.Pos_(points[i]);
|
||||
sub.UnderElem().Core().Focus_index_set(i);
|
||||
list.Add(sub);
|
||||
@@ -76,10 +80,10 @@ public class GfuiFocusOrderer_tst {
|
||||
void tst_FocusIndxs(GfuiElem owner, List_adp list, int... expd) {
|
||||
int[] actl = new int[list.Len()];
|
||||
for (int i = 0; i < actl.length; i++) {
|
||||
GfuiElem sub = (GfuiElem)list.Get_at(i);
|
||||
GfuiElem sub = (GfuiElem)list.GetAt(i);
|
||||
actl[i] = sub.UnderElem().Core().Focus_index();
|
||||
}
|
||||
Tfds.Eq_ary(expd, actl);
|
||||
GfoTstr.EqAry(expd, actl);
|
||||
}
|
||||
GfuiElem owner; List_adp list;
|
||||
}
|
||||
|
||||
@@ -13,22 +13,28 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*;
|
||||
package gplx.gfui.controls.windows;
|
||||
import gplx.core.interfaces.*;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.tabs.*;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
public class GfuiFocusXferBnd implements InjectAble, Gfo_invk {
|
||||
public void Inject(Object owner) {
|
||||
GfuiElem elem = GfuiElem_.cast(owner);
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, elem, this, Invk_FocusNext, IptKey_.Down);
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, elem, this, Invk_FocusPrev, IptKey_.Up);
|
||||
}
|
||||
@gplx.Internal protected void Focus(GfuiElem cur, boolean fwd) {
|
||||
public void Focus(GfuiElem cur, boolean fwd) {
|
||||
List_adp allElemsInOwnerWin = List_adp_.New(); AddSubs(cur.OwnerWin(), allElemsInOwnerWin);
|
||||
int curIdx = allElemsInOwnerWin.IdxOf(cur);
|
||||
GfuiElem target = cur;
|
||||
while (true) { // find next visible elem
|
||||
int cycle = TabBox_.Cycle(fwd, curIdx, allElemsInOwnerWin.Len());
|
||||
target = GfuiElem_.cast(allElemsInOwnerWin.Get_at(cycle));
|
||||
target = GfuiElem_.cast(allElemsInOwnerWin.GetAt(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;
|
||||
|
||||
@@ -13,10 +13,10 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.GfoMsg;
|
||||
import gplx.Gfo_invk;
|
||||
import gplx.Gfo_invk_;
|
||||
import gplx.GfsCtx;
|
||||
package gplx.gfui.controls.windows; import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.PointAdp;
|
||||
import gplx.gfui.RectAdp;
|
||||
import gplx.gfui.RectAdp_;
|
||||
|
||||
@@ -13,17 +13,18 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.Char_;
|
||||
import gplx.Err_;
|
||||
import gplx.GfoMsg;
|
||||
import gplx.GfoMsgUtl;
|
||||
import gplx.Gfo_invk;
|
||||
import gplx.Gfo_invk_;
|
||||
import gplx.GfsCtx;
|
||||
import gplx.Hash_adp;
|
||||
import gplx.Hash_adp_;
|
||||
import gplx.Int_;
|
||||
import gplx.String_;
|
||||
package gplx.gfui.controls.windows;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
import gplx.types.basics.utls.CharUtl;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfoMsgUtl;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.types.basics.lists.Hash_adp;
|
||||
import gplx.types.basics.lists.Hash_adp_;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.gfui.controls.gxws.GxwWin;
|
||||
import gplx.gfui.draws.ColorAdp;
|
||||
import gplx.gfui.draws.ColorAdpCache;
|
||||
@@ -60,7 +61,7 @@ public class GfuiMenuBar implements Gfo_invk {
|
||||
GfsCore.Instance.AddObj(this, "GfuiMenuBar_");
|
||||
GfsCore.Instance.ExecRegy("gplx.gfui.GfuiMenuBar.ini");
|
||||
}
|
||||
catch (Exception e) {GfuiEnv_.ShowMsg(Err_.Message_gplx_full(e));}
|
||||
catch (Exception e) {GfuiEnv_.ShowMsg(ErrUtl.ToStrFull(e));}
|
||||
}
|
||||
String separatorText, mnemonicPrefix; int separatorIdx = 0;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
@@ -89,7 +90,7 @@ public class GfuiMenuBar implements Gfo_invk {
|
||||
GfuiMenuBarItm itm = GfuiMenuBarItm.sub_(curOwnerItm);
|
||||
itm.Type_(GfuiMenuBarItmType.Spr);
|
||||
itm.Text_(text);
|
||||
itm.Key_(curOwnerItm.Key() + "." + text + Int_.To_str(separatorIdx++));
|
||||
itm.Key_(curOwnerItm.Key() + "." + text + IntUtl.ToStr(separatorIdx++));
|
||||
itm.ExecProps();
|
||||
}
|
||||
else if (ctx.Match(k, Invk_RegCmd)) {
|
||||
@@ -116,13 +117,13 @@ public class GfuiMenuBar implements Gfo_invk {
|
||||
IptKey Read_prop_ipt(IptKey ipt, GfuiMenuBarItm itm) {
|
||||
if (mnemonicPrefix == null) return ipt;
|
||||
String text = itm.Text();
|
||||
int pos = String_.FindFwd(text, mnemonicPrefix);
|
||||
if (pos == String_.Find_none || pos == String_.Len(text) - 1) return ipt; // mnemonic not found
|
||||
String keyChar = String_.MidByLen(text, pos + 1, 1);
|
||||
if (!Char_.IsLetterEnglish(String_.CharAt(keyChar, 0))) return ipt; // keyChar is not a character; EX: 'A & B' (keyChar = space)
|
||||
String keyCharRaw = "key." + String_.Lower(keyChar);
|
||||
int pos = StringUtl.FindFwd(text, mnemonicPrefix);
|
||||
if (pos == StringUtl.FindNone || pos == StringUtl.Len(text) - 1) return ipt; // mnemonic not found
|
||||
String keyChar = StringUtl.MidByLen(text, pos + 1, 1);
|
||||
if (!CharUtl.IsLetterEnglish(StringUtl.CharAt(keyChar, 0))) return ipt; // keyChar is not a character; EX: 'A & B' (keyChar = space)
|
||||
String keyCharRaw = "key." + StringUtl.Lower(keyChar);
|
||||
ipt = IptKey_.parse(keyCharRaw);
|
||||
text = String_.MidByLen(text, 0, pos) + String_.Mid(text, pos + 1); // remove mnemPrefix; ex: &File -> File && key.f
|
||||
text = StringUtl.MidByLen(text, 0, pos) + StringUtl.Mid(text, pos + 1); // remove mnemPrefix; ex: &File -> File && key.f
|
||||
itm.Text_(text);
|
||||
return ipt;
|
||||
}
|
||||
@@ -210,7 +211,7 @@ class GfuiMenuBarItm {
|
||||
if (backColor != null) itm.setBackground(ColorAdpCache.Instance.GetNativeColor(backColor));
|
||||
if (foreColor != null) itm.setForeground(ColorAdpCache.Instance.GetNativeColor(foreColor));
|
||||
itm.setFont(MakeFont(itm.getFont()));
|
||||
if (String_.Len(tipText) > 0) itm.setToolTipText(tipText);
|
||||
if (StringUtl.Len(tipText) > 0) itm.setToolTipText(tipText);
|
||||
}
|
||||
Font MakeFont(Font cur) {
|
||||
if (fontFamily == null && fontStyle == null && fontSize == -1) return cur;
|
||||
@@ -222,13 +223,13 @@ class GfuiMenuBarItm {
|
||||
GfuiMenuBarItm Under_(Object o) {under = o; return this;}
|
||||
char GetMnemonic(String text, IptKey ipt) {
|
||||
if (ipt.Val() == IptKey_.None.Val()) return '\0';
|
||||
String iptStr = ipt.XtoUiStr(); if (String_.Len(iptStr) > 1) return '\0';
|
||||
return String_.CharAt(iptStr, 0);
|
||||
String iptStr = ipt.XtoUiStr(); if (StringUtl.Len(iptStr) > 1) return '\0';
|
||||
return StringUtl.CharAt(iptStr, 0);
|
||||
}
|
||||
GfuiMenuBarItmCmd itmCmd;
|
||||
Object under;
|
||||
public static GfoMsg CmdMsg(GfuiMenuBarItm itm) {
|
||||
if (itm.cmd == null) throw Err_.new_null().Args_add("key", itm.key, "text", itm.text);
|
||||
if (itm.cmd == null) throw ErrUtl.NewNull().ArgsAdd("key", itm.key).ArgsAdd("text", itm.text);
|
||||
return gplx.gfml.GfmlDataNde.XtoMsgNoRoot(itm.cmd);
|
||||
}
|
||||
public static GfuiMenuBarItm new_() {return new GfuiMenuBarItm();}
|
||||
@@ -253,7 +254,7 @@ class GfuiMenuBarItmType {
|
||||
GfuiMenuBarItmType(int v, String n) {val = v; name = n; regy.Add(n, this);}
|
||||
public static GfuiMenuBarItmType parse(String raw) {
|
||||
try {return (GfuiMenuBarItmType)regy.GetByOrNull(raw);}
|
||||
catch (Exception e) {Err_.Noop(e); throw Err_.new_parse("GfuiMenuBarItmType", raw);}
|
||||
catch (Exception e) {throw ErrUtl.NewParse("GfuiMenuBarItmType", raw);}
|
||||
}
|
||||
static Hash_adp regy = Hash_adp_.New();
|
||||
public static final GfuiMenuBarItmType Root = new GfuiMenuBarItmType(1, "root");
|
||||
|
||||
@@ -13,7 +13,9 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.windows;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.gfui.kits.core.*;
|
||||
public class GfuiQuitMode {
|
||||
public int Val() {return val;} int val;
|
||||
|
||||
@@ -13,14 +13,15 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.windows;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.ToolTipManager;
|
||||
import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
class GfuiTipTextMgr implements GfuiWinOpenAble {
|
||||
public void Open_exec(GfuiWin form, GfuiElemBase owner, GfuiElemBase sub) {
|
||||
if (!(sub.UnderElem() instanceof JComponent)) return;
|
||||
if (String_.Eq(sub.TipText(), "")) return; // don't register components without tooltips; will leave blue dots (blue tool tip windows with 1x1 size)
|
||||
if (StringUtl.Eq(sub.TipText(), "")) return; // don't register components without tooltips; will leave blue dots (blue tool tip windows with 1x1 size)
|
||||
JComponent jcomp = (JComponent)sub.UnderElem();
|
||||
ToolTipManager.sharedInstance().registerComponent(jcomp);
|
||||
ToolTipManager.sharedInstance().setInitialDelay(0);
|
||||
|
||||
@@ -13,18 +13,19 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.Datetime_now;
|
||||
import gplx.GfoMsg;
|
||||
import gplx.Gfo_evt_mgr_;
|
||||
import gplx.Gfo_invk_cmd;
|
||||
import gplx.Gfo_invk_cmd_mgr;
|
||||
import gplx.GfsCtx;
|
||||
import gplx.Keyval_hash;
|
||||
import gplx.List_adp;
|
||||
import gplx.List_adp_;
|
||||
import gplx.String_;
|
||||
import gplx.UsrDlg_;
|
||||
import gplx.UsrMsg;
|
||||
package gplx.gfui.controls.windows; import gplx.frameworks.objects.New;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
import gplx.types.commons.GfoDateNow;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr_;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd;
|
||||
import gplx.frameworks.invks.Gfo_invk_cmd_mgr;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
import gplx.libs.dlgs.UsrDlg_;
|
||||
import gplx.libs.dlgs.UsrMsg;
|
||||
import gplx.core.envs.Env_;
|
||||
import gplx.gfui.SizeAdp;
|
||||
import gplx.gfui.SizeAdp_;
|
||||
@@ -59,15 +60,15 @@ public class GfuiWin extends GfuiElemBase {
|
||||
public GfuiQuitMode QuitMode() {return quitMode;} public GfuiWin QuitMode_(GfuiQuitMode val) {quitMode = val; return this;} private GfuiQuitMode quitMode = GfuiQuitMode.ExitApp; // easier to debug
|
||||
@Override public boolean Opened_done() {return opened;} private boolean opened;
|
||||
@Override public GfuiWin OwnerWin() {return this;} // TODO_OLD: null
|
||||
@gplx.Internal protected GfuiWinKeyCmdMgr KeyCmdMgr() {return keyCmdMgr;} private GfuiWinKeyCmdMgr keyCmdMgr = GfuiWinKeyCmdMgr.new_();
|
||||
public GfuiWinKeyCmdMgr KeyCmdMgr() {return keyCmdMgr;} private GfuiWinKeyCmdMgr keyCmdMgr = GfuiWinKeyCmdMgr.new_();
|
||||
public GfuiWinFocusMgr FocusMgr() {return focusMgr;} private GfuiWinFocusMgr focusMgr;
|
||||
@gplx.New public GfuiWin Size_(SizeAdp size) {
|
||||
@New public GfuiWin Size_(SizeAdp size) {
|
||||
super.Size_(size);
|
||||
if (!opened && (size.Width() < 112 || size.Height() < 27)) // WORKAROUND/WINFORMS: Form.Size must be > 112,27 if Form is not Visible
|
||||
smallOpenSize = size;
|
||||
return this;
|
||||
} private SizeAdp smallOpenSize = SizeAdp_.Null;
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_kit_GfuiElemBase(Gfui_kit kit, String key, GxwElem underElem, KeyValHash ctorArgs) {
|
||||
super.ctor_kit_GfuiElemBase(kit, key, underElem, ctorArgs);
|
||||
win = (GxwWin)underElem;
|
||||
win.OpenedCmd_set(Gfo_invk_cmd.New_by_key(this, Evt_Opened));
|
||||
@@ -78,7 +79,7 @@ public class GfuiWin extends GfuiElemBase {
|
||||
loadList.Add(keyCmdMgr); loadList.Add(GfuiTipTextMgr.Instance);
|
||||
focusMgr = GfuiWinFocusMgr.new_(this);
|
||||
}
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
win = (GxwWin)this.UnderElem();
|
||||
win.OpenedCmd_set(Gfo_invk_cmd.New_by_key(this, Evt_Opened));
|
||||
@@ -89,10 +90,10 @@ public class GfuiWin extends GfuiElemBase {
|
||||
loadList.Add(keyCmdMgr); loadList.Add(GfuiTipTextMgr.Instance);
|
||||
focusMgr = GfuiWinFocusMgr.new_(this);
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {
|
||||
String type = (String)ctorArgs.Get_val_or(GfuiWin_.InitKey_winType, GfuiWin_.InitKey_winType_app);
|
||||
if (String_.Eq(type, GfuiWin_.InitKey_winType_tool)) return GxwElemFactory_.Instance.win_tool_(ctorArgs);
|
||||
else if (String_.Eq(type, GfuiWin_.InitKey_winType_toaster)) return GxwElemFactory_.Instance.win_toaster_(ctorArgs);
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {
|
||||
String type = (String)ctorArgs.GetByValOr(GfuiWin_.InitKey_winType, GfuiWin_.InitKey_winType_app);
|
||||
if (StringUtl.Eq(type, GfuiWin_.InitKey_winType_tool)) return GxwElemFactory_.Instance.win_tool_(ctorArgs);
|
||||
else if (StringUtl.Eq(type, GfuiWin_.InitKey_winType_toaster)) return GxwElemFactory_.Instance.win_toaster_(ctorArgs);
|
||||
else return GxwElemFactory_.Instance.win_app_();
|
||||
}
|
||||
@Override public void Opened_cbk() {
|
||||
@@ -136,7 +137,7 @@ public class GfuiWin extends GfuiElemBase {
|
||||
else if (ctx.Match(k, Evt_Opened)) Opened_cbk();
|
||||
else if (ctx.Match(k, StopAppByAltF4_evt)) StopAppByAltF4(IptEventData.ctx_(ctx, m));
|
||||
else if (ctx.Match(k, Invk_ShowFocusOwner)) GfuiEnv_.ShowMsg(GfuiFocusMgr.Instance.FocusedElem().Key_of_GfuiElem());
|
||||
else if (ctx.Match(k, GfuiStatusBoxBnd.Invk_ShowTime)) {UsrDlg_.Instance.Note(UsrMsg.new_(Datetime_now.Get().toString())); return this;}
|
||||
else if (ctx.Match(k, GfuiStatusBoxBnd.Invk_ShowTime)) {UsrDlg_.Instance.Note(UsrMsg.new_(GfoDateNow.Get().toString())); return this;}
|
||||
else if (ctx.MatchIn(k, Invk_Close, GfuiQuitMode.Destroy_cmd)) Close();
|
||||
else if (ctx.MatchIn(k, Invk_Hide, GfuiQuitMode.Suspend_cmd)) Hide();
|
||||
else {
|
||||
|
||||
@@ -13,12 +13,11 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.Err_;
|
||||
import gplx.List_adp;
|
||||
import gplx.List_adp_;
|
||||
import gplx.gfui.controls.elems.GfuiElem;
|
||||
package gplx.gfui.controls.windows; import gplx.gfui.controls.elems.GfuiElem;
|
||||
import gplx.gfui.controls.gxws.GxwElem;
|
||||
import gplx.gfui.controls.gxws.GxwTextMemo_lang;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.lists.List_adp_;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.FocusTraversalPolicy;
|
||||
@@ -44,7 +43,7 @@ public class GfuiWinFocusMgr {
|
||||
int nxt = fwd
|
||||
? cur == subElems.IdxLast() ? 0 : ++cur
|
||||
: cur == 0 ? subElems.IdxLast() : --cur;
|
||||
GfuiElem elm = (GfuiElem)subElems.Get_at(nxt);
|
||||
GfuiElem elm = (GfuiElem)subElems.GetAt(nxt);
|
||||
elm.Focus();
|
||||
return elm;
|
||||
}
|
||||
@@ -73,10 +72,9 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
|
||||
if (idx == elems.Len())
|
||||
idx = 0;
|
||||
GfuiElem elem = null;
|
||||
try {elem = (GfuiElem)elems.Get_at(idx);}
|
||||
try {elem = (GfuiElem)elems.GetAt(idx);}
|
||||
catch (Exception e) {
|
||||
System.out.println("getComponentAfter:" + e.getMessage() + ":" + idx);
|
||||
Err_.Noop(e);
|
||||
}
|
||||
if (elem == null) return c; // FIXME: why is elem null?; REP: add new tab through history and then close out
|
||||
if (elem.Focus_able() && elem.Visible()) {
|
||||
@@ -103,7 +101,7 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
|
||||
idx = elems.Len() - List_adp_.Base1;
|
||||
GfuiElem elem = null;
|
||||
try {
|
||||
elem = (GfuiElem)elems.Get_at(idx);
|
||||
elem = (GfuiElem)elems.GetAt(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());
|
||||
@@ -112,7 +110,6 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println("getComponentBefore:" + e.getMessage() + ":" + idx);
|
||||
Err_.Noop(e);
|
||||
}
|
||||
if (elem == null) return c; // FIXME: why is elem null?; REP: add new tab through history and then close out
|
||||
if (elem.Focus_able() && elem.Visible()) {
|
||||
@@ -130,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.Len() - 1).UnderElem();}
|
||||
GfuiElem FetchAt(int idx) {return (GfuiElem)elems.Get_at(idx);}
|
||||
GfuiElem FetchAt(int idx) {return (GfuiElem)elems.GetAt(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
|
||||
|
||||
@@ -13,9 +13,17 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*;
|
||||
package gplx.gfui.controls.windows;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.ipts.*; import gplx.gfui.controls.elems.*; import gplx.gfui.controls.standards.*;
|
||||
import gplx.core.lists.*; import gplx.core.bits.*;
|
||||
import gplx.frameworks.evts.Gfo_evt_itm;
|
||||
import gplx.frameworks.evts.Gfo_evt_mgr;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.basics.utls.CharUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
public class GfuiWinKeyCmdMgr implements GfuiWinOpenAble, Gfo_invk, Gfo_evt_itm {
|
||||
private Hash_adp_list listHash = Hash_adp_list.new_();
|
||||
public Gfo_evt_mgr Evt_mgr() {if (evt_mgr == null) evt_mgr = new Gfo_evt_mgr(this); return evt_mgr;} private Gfo_evt_mgr evt_mgr;
|
||||
@@ -33,7 +41,7 @@ public class GfuiWinKeyCmdMgr implements GfuiWinOpenAble, Gfo_invk, Gfo_evt_itm
|
||||
) return false; // ignore keys from textbox if they do not have alt
|
||||
List_adp elemList = (List_adp)listHash.GetByOrNull(keyVal); if (elemList == null) return false;
|
||||
for (int i = 0; i < elemList.Len(); i++) {
|
||||
GfuiElem elem = (GfuiElem)elemList.Get_at(i);
|
||||
GfuiElem elem = (GfuiElem)elemList.GetAt(i);
|
||||
if (elem.Visible())
|
||||
elem.Click();
|
||||
}
|
||||
@@ -44,17 +52,17 @@ public class GfuiWinKeyCmdMgr implements GfuiWinOpenAble, Gfo_invk, Gfo_evt_itm
|
||||
CheckForHotKey(IptEventData.ctx_(ctx, m));
|
||||
//boolean handled = CheckForHotKey(IptEventData.cast(msg.Val())); msg.Fwd_set(!handled); // TOMBSTONE: somehow cause alt-F4 to continue processing and dispose form
|
||||
return this;
|
||||
} @gplx.Internal protected static final String CheckForHotKey_cmd = "CheckForHotKey_cmd";
|
||||
} public static final String CheckForHotKey_cmd = "CheckForHotKey_cmd";
|
||||
|
||||
public static GfuiWinKeyCmdMgr new_() {return new GfuiWinKeyCmdMgr();} GfuiWinKeyCmdMgr() {}
|
||||
public static int ExtractPosFromText(String raw) {
|
||||
int pos = String_.FindFwd(raw, "&");
|
||||
if (pos == String_.Find_none || pos == String_.Len(raw) - 1) return String_.Find_none; // & notFound or last char; return;
|
||||
char nextChar = String_.CharAt(raw, pos + 1);
|
||||
return Char_.IsLetterEnglish(nextChar) ? pos : String_.Find_none; // NOTE: .IsLetter checks against space; EX: "me & you" shouldn't bring back space
|
||||
int pos = StringUtl.FindFwd(raw, "&");
|
||||
if (pos == StringUtl.FindNone || pos == StringUtl.Len(raw) - 1) return StringUtl.FindNone; // & notFound or last char; return;
|
||||
char nextChar = StringUtl.CharAt(raw, pos + 1);
|
||||
return CharUtl.IsLetterEnglish(nextChar) ? pos : StringUtl.FindNone; // NOTE: .IsLetter checks against space; EX: "me & you" shouldn't bring back space
|
||||
}
|
||||
public static IptKey ExtractKeyFromText(String raw) {
|
||||
int pos = ExtractPosFromText(raw); if (pos == String_.Find_none) return IptKey_.None;
|
||||
return IptKey_.parse("key." + String_.Lower(Char_.To_str(String_.CharAt(raw, pos + 1)))); // pos=& pos; + 1 to get next letter
|
||||
int pos = ExtractPosFromText(raw); if (pos == StringUtl.FindNone) return IptKey_.None;
|
||||
return IptKey_.parse("key." + StringUtl.Lower(CharUtl.ToStr(StringUtl.CharAt(raw, pos + 1)))); // pos=& pos; + 1 to get next letter
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,11 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
package gplx.gfui.controls.windows;
|
||||
import gplx.gfui.kits.core.*; import gplx.gfui.controls.gxws.*; import gplx.gfui.controls.elems.*;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.basics.lists.List_adp;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GfuiWin_ {
|
||||
public static final String
|
||||
InitKey_winType = "winType"
|
||||
@@ -23,16 +26,16 @@ public class GfuiWin_ {
|
||||
, InitKey_winType_tool = "tool"
|
||||
;
|
||||
public static GfuiWin as_(Object obj) {return obj instanceof GfuiWin ? (GfuiWin)obj : null;}
|
||||
public static GfuiWin cast(Object obj) {try {return (GfuiWin)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiWin.class, obj);}}
|
||||
public static GfuiWin app_(String key) {return bld_(key, InitKey_winType_app, new Keyval_hash());}
|
||||
public static GfuiWin tool_(String key) {return bld_(key, InitKey_winType_tool, new Keyval_hash()).TaskbarVisible_(false);}
|
||||
public static GfuiWin cast(Object obj) {try {return (GfuiWin)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, GfuiWin.class, obj);}}
|
||||
public static GfuiWin app_(String key) {return bld_(key, InitKey_winType_app, new KeyValHash());}
|
||||
public static GfuiWin tool_(String key) {return bld_(key, InitKey_winType_tool, new KeyValHash()).TaskbarVisible_(false);}
|
||||
public static GfuiWin sub_(String key, GfuiWin ownerWin) {
|
||||
Keyval_hash ctorArgs = new Keyval_hash();
|
||||
KeyValHash ctorArgs = new KeyValHash();
|
||||
if (ownerWin != null) ctorArgs.Add(GfuiElem_.InitKey_ownerWin, ownerWin); // WORKAROUND/JAVA: null ownerWin will fail when adding to hash
|
||||
return bld_(key, InitKey_winType_tool, ctorArgs);
|
||||
}
|
||||
public static GfuiWin toaster_(String key, GfuiWin ownerWin) {return bld_(key, InitKey_winType_toaster, new Keyval_hash().Add(GfuiElem_.InitKey_ownerWin, ownerWin));}
|
||||
static GfuiWin bld_(String key, String winType, Keyval_hash ctorArgs) {
|
||||
public static GfuiWin toaster_(String key, GfuiWin ownerWin) {return bld_(key, InitKey_winType_toaster, new KeyValHash().Add(GfuiElem_.InitKey_ownerWin, ownerWin));}
|
||||
static GfuiWin bld_(String key, String winType, KeyValHash ctorArgs) {
|
||||
GfuiWin rv = new GfuiWin();
|
||||
rv.Key_of_GfuiElem_(key);
|
||||
ctorArgs.Add(InitKey_winType, winType)
|
||||
@@ -40,14 +43,14 @@ public class GfuiWin_ {
|
||||
rv.ctor_GfuiBox_base(ctorArgs);
|
||||
return rv;
|
||||
}
|
||||
public static GfuiWin kit_(Gfui_kit kit, String key, GxwWin under, Keyval_hash ctorArgs) {
|
||||
public static GfuiWin kit_(Gfui_kit kit, String key, GxwWin under, KeyValHash ctorArgs) {
|
||||
GfuiWin rv = new GfuiWin();
|
||||
rv.ctor_kit_GfuiElemBase(kit, key, under, ctorArgs);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
class GfuiWinUtl {
|
||||
@gplx.Internal protected static void Open_exec(GfuiWin win, List_adp loadList, GfuiElemBase owner) {
|
||||
public 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().Get_at(i);
|
||||
sub.OwnerWin_(win);
|
||||
@@ -58,7 +61,7 @@ class GfuiWinUtl {
|
||||
Open_exec(win, loadList, sub);
|
||||
}
|
||||
}
|
||||
@gplx.Internal protected static void SubElems_dispose(GfuiElem owner) {
|
||||
public static void SubElems_dispose(GfuiElem owner) {
|
||||
for (int i = 0; i < owner.SubElems().Count(); i++) {
|
||||
GfuiElem sub = (GfuiElem)owner.SubElems().Get_at(i);
|
||||
sub.Dispose();
|
||||
|
||||
@@ -14,10 +14,10 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows;
|
||||
import gplx.GfoMsg;
|
||||
import gplx.GfsCtx;
|
||||
import gplx.Keyval_hash;
|
||||
import gplx.Math_;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.types.commons.KeyValHash;
|
||||
import gplx.types.basics.utls.MathUtl;
|
||||
import gplx.core.envs.Env_;
|
||||
import gplx.gfui.RectAdp;
|
||||
import gplx.gfui.SizeAdp;
|
||||
@@ -50,7 +50,7 @@ public class GfuiWin_toaster extends GfuiWin {
|
||||
fullyGrownTimerInterval = fullyGrownArg;
|
||||
int timerEvents = 0;
|
||||
if (growingArg > 10) {
|
||||
timerEvents = Math_.Min((growingArg / 10), fullyGrown.Height());
|
||||
timerEvents = MathUtl.Min((growingArg / 10), fullyGrown.Height());
|
||||
growingTimerInterval = growingArg / timerEvents;
|
||||
growingIncrement = fullyGrown.Height() / timerEvents;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class GfuiWin_toaster extends GfuiWin {
|
||||
}
|
||||
|
||||
if( timeForHidingArg > 10) {
|
||||
timerEvents = Math_.Min((timeForHidingArg / 10), fullyGrown.Height());
|
||||
timerEvents = MathUtl.Min((timeForHidingArg / 10), fullyGrown.Height());
|
||||
shrinkingTimerInterval = timeForHidingArg / timerEvents;
|
||||
shrinkingIncrement = fullyGrown.Height() / timerEvents;
|
||||
}
|
||||
@@ -142,9 +142,9 @@ public class GfuiWin_toaster extends GfuiWin {
|
||||
this.Pos_(this.X(), PopupAnchorTop); //this.Top - increment
|
||||
this.Size_(SizeAdp_.new_(this.Width(), this.Height() + increment));
|
||||
}
|
||||
@Override public GxwElem UnderElem_make(Keyval_hash ctorArgs) {return GxwElemFactory_.Instance.win_toaster_(ctorArgs);}
|
||||
@Override public GxwElem UnderElem_make(KeyValHash ctorArgs) {return GxwElemFactory_.Instance.win_toaster_(ctorArgs);}
|
||||
|
||||
@Override public void ctor_GfuiBox_base(Keyval_hash ctorArgs) {
|
||||
@Override public void ctor_GfuiBox_base(KeyValHash ctorArgs) {
|
||||
super.ctor_GfuiBox_base(ctorArgs);
|
||||
this.fullyGrown = SizeAdp_.new_(600, 96);
|
||||
this.Pos_(-100, -100); this.Size_(fullyGrown); super.Show(); super.Hide();// was 20,20; set to fullyGrown b/c of java
|
||||
@@ -167,7 +167,7 @@ public class GfuiWin_toaster extends GfuiWin {
|
||||
if (ctx.Match(k, Tmr_cmd)) WhenTick();
|
||||
else super.Invk(ctx, ikey, k, m);
|
||||
return this;
|
||||
} public static final String Tmr_cmd = "Tmr";
|
||||
} public static final String Tmr_cmd = "Tmr";
|
||||
GfuiTextMemo messageLabel;
|
||||
TimerAdp timer;
|
||||
SizeAdp fullyGrown = SizeAdp_.Zero;
|
||||
@@ -178,7 +178,7 @@ public class GfuiWin_toaster extends GfuiWin {
|
||||
GfuiWin_toaster rv = new GfuiWin_toaster();
|
||||
// rv.Icon_(IconAdp.cfg_("popup"));
|
||||
rv.ctor_GfuiBox_base
|
||||
(new Keyval_hash()
|
||||
(new KeyValHash()
|
||||
.Add(GfuiElem_.InitKey_focusAble, false)
|
||||
.Add(GfuiElem_.InitKey_ownerWin, owner)
|
||||
.Add(GfuiWin_.InitKey_winType, GfuiWin_.InitKey_winType_toaster)
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows; import gplx.*; import gplx.gfui.*; import gplx.gfui.controls.*;
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.controls.windows;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import gplx.*; import gplx.gfui.*;
|
||||
import gplx.gfui.kits.core.GfuiEnv_;
|
||||
import gplx.langs.gfs.GfsCore;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class GxwBorderFactory {
|
||||
public static final javax.swing.border.Border Empty = new EmptyBorder(0, 0, 1, 0);
|
||||
}
|
||||
@@ -29,7 +30,7 @@ class GfuiMenuBarItmCmd implements ActionListener {
|
||||
GfsCore.Instance.ExecOne(GfsCtx.Instance, GfuiMenuBarItm.CmdMsg(itm));
|
||||
}
|
||||
catch (Exception e) {
|
||||
GfuiEnv_.ShowMsg(Err_.Message_gplx_full(e));
|
||||
GfuiEnv_.ShowMsg(ErrUtl.ToStrFull(e));
|
||||
}
|
||||
}
|
||||
public static GfuiMenuBarItmCmd new_(GfuiMenuBarItm itm) {
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.draws; import gplx.*; import gplx.gfui.*;
|
||||
import gplx.core.strings.*; import gplx.core.encoders.*;
|
||||
public class ColorAdp {
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.draws;
|
||||
import gplx.types.basics.encoders.HexUtl;
|
||||
import gplx.types.basics.utls.ObjectUtl;
|
||||
import gplx.types.commons.String_bldr;
|
||||
import gplx.types.commons.String_bldr_;
|
||||
public class ColorAdp {
|
||||
public int Value() {return val;} int val;
|
||||
public int Alpha() {return (255 & val >> 24);}
|
||||
public int Red () {return (255 & val >> 16);}
|
||||
@@ -24,15 +27,15 @@ public class ColorAdp {
|
||||
public String XtoHexStr() {
|
||||
String_bldr sb = String_bldr_.new_();
|
||||
sb.Add("#");
|
||||
sb.Add(Hex_utl_.To_str(Alpha(), 2));
|
||||
sb.Add(Hex_utl_.To_str(Red(), 2));
|
||||
sb.Add(Hex_utl_.To_str(Green(), 2));
|
||||
sb.Add(Hex_utl_.To_str(Blue(), 2));
|
||||
return sb.To_str();
|
||||
sb.Add(HexUtl.ToStr(Alpha(), 2));
|
||||
sb.Add(HexUtl.ToStr(Red(), 2));
|
||||
sb.Add(HexUtl.ToStr(Green(), 2));
|
||||
sb.Add(HexUtl.ToStr(Blue(), 2));
|
||||
return sb.ToStr();
|
||||
}
|
||||
public boolean Eq(Object obj) {
|
||||
ColorAdp comp = ColorAdp_.as_(obj); if (comp == null) return false;
|
||||
return Object_.Eq(val, comp.val);
|
||||
return ObjectUtl.Eq(val, comp.val);
|
||||
}
|
||||
@Override public String toString() {return XtoHexStr();}
|
||||
public Object CloneNew() {return this;} // NOTE: 'return this' works b/c ColorAdp is read-only class; needed for comparisons; ex: ColorAdp_.Null == ColorAdp_.Null.CloneNew(); alternative would fail: return ColorAdp.new_(this.Alpha(), this.Red(), this.Green(), this.Blue());}
|
||||
|
||||
@@ -13,7 +13,9 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.draws; import gplx.*;
|
||||
package gplx.gfui.draws;
|
||||
import gplx.types.basics.lists.Hash_adp;
|
||||
import gplx.types.basics.lists.Hash_adp_;
|
||||
public class ColorAdpCache {
|
||||
public java.awt.Color GetNativeColor(ColorAdp color) {
|
||||
Object rv = hash.GetByOrNull(color.Value()); if (rv != null) return (java.awt.Color)rv;
|
||||
|
||||
@@ -13,11 +13,16 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.draws; import gplx.*; import gplx.gfui.*;
|
||||
import gplx.core.encoders.*; import gplx.core.interfaces.*;
|
||||
package gplx.gfui.draws;
|
||||
import gplx.types.basics.encoders.HexUtl;
|
||||
import gplx.core.interfaces.ParseAble;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
import gplx.types.basics.utls.CharUtl;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import gplx.types.basics.utls.StringUtl;
|
||||
public class ColorAdp_ implements ParseAble {
|
||||
public static ColorAdp as_(Object obj) {return obj instanceof ColorAdp ? (ColorAdp)obj : null;}
|
||||
public static ColorAdp cast(Object obj) {try {return (ColorAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, ColorAdp.class, obj);}}
|
||||
public static ColorAdp cast(Object obj) {try {return (ColorAdp)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, ColorAdp.class, obj);}}
|
||||
public static ColorAdp new_(int a, int r, int g, int b) {return ColorAdp.new_((int)a, (int)r, (int)g, (int)b);}
|
||||
public static final ColorAdp_ Parser = new ColorAdp_();
|
||||
public Object ParseAsObj(String raw) {return ColorAdp_.parse(raw);}
|
||||
@@ -26,31 +31,31 @@ public class ColorAdp_ implements ParseAble {
|
||||
return rv;
|
||||
}
|
||||
public static ColorAdp parse(String raw) {
|
||||
ColorAdp rv = parse_internal_(raw); if (rv == null) throw Err_.new_parse_type(ColorAdp.class, raw);
|
||||
ColorAdp rv = parse_internal_(raw); if (rv == null) throw ErrUtl.NewParse(ColorAdp.class, raw);
|
||||
return rv;
|
||||
}
|
||||
static ColorAdp parse_internal_(String raw) {
|
||||
if (raw == null) return null;
|
||||
char firstChar = String_.CharAt(raw, 0);
|
||||
char firstChar = StringUtl.CharAt(raw, 0);
|
||||
if (firstChar == '#') return parse_hex_(raw);
|
||||
else if (Char_.IsNumber(firstChar)) return parse_int_(raw);
|
||||
String rawLower = String_.Lower(raw);
|
||||
if (String_.Eq(rawLower, "black")) return Black;
|
||||
else if (String_.Eq(rawLower, "white")) return White;
|
||||
else if (String_.Eq(rawLower, "gray")) return Gray;
|
||||
else if (String_.Eq(rawLower, "red")) return Red;
|
||||
else if (String_.Eq(rawLower, "lime")) return Lime;
|
||||
else if (String_.Eq(rawLower, "blue")) return Blue;
|
||||
else if (String_.Eq(rawLower, "yellow")) return Yellow;
|
||||
else if (String_.Eq(rawLower, "fuchsia")) return Fuchsia;
|
||||
else if (String_.Eq(rawLower, "maroon")) return Maroon;
|
||||
else if (String_.Eq(rawLower, "green")) return Green;
|
||||
else if (String_.Eq(rawLower, "navy")) return Navy;
|
||||
else if (String_.Eq(rawLower, "olive")) return Olive;
|
||||
else if (String_.Eq(rawLower, "purple")) return Purple;
|
||||
else if (String_.Eq(rawLower, "teal")) return Teal;
|
||||
else if (String_.Eq(rawLower, "brown")) return Brown;
|
||||
else if (String_.Eq(rawLower, "lightgray")) return LightGray;
|
||||
else if (CharUtl.IsNumber(firstChar)) return parse_int_(raw);
|
||||
String rawLower = StringUtl.Lower(raw);
|
||||
if (StringUtl.Eq(rawLower, "black")) return Black;
|
||||
else if (StringUtl.Eq(rawLower, "white")) return White;
|
||||
else if (StringUtl.Eq(rawLower, "gray")) return Gray;
|
||||
else if (StringUtl.Eq(rawLower, "red")) return Red;
|
||||
else if (StringUtl.Eq(rawLower, "lime")) return Lime;
|
||||
else if (StringUtl.Eq(rawLower, "blue")) return Blue;
|
||||
else if (StringUtl.Eq(rawLower, "yellow")) return Yellow;
|
||||
else if (StringUtl.Eq(rawLower, "fuchsia")) return Fuchsia;
|
||||
else if (StringUtl.Eq(rawLower, "maroon")) return Maroon;
|
||||
else if (StringUtl.Eq(rawLower, "green")) return Green;
|
||||
else if (StringUtl.Eq(rawLower, "navy")) return Navy;
|
||||
else if (StringUtl.Eq(rawLower, "olive")) return Olive;
|
||||
else if (StringUtl.Eq(rawLower, "purple")) return Purple;
|
||||
else if (StringUtl.Eq(rawLower, "teal")) return Teal;
|
||||
else if (StringUtl.Eq(rawLower, "brown")) return Brown;
|
||||
else if (StringUtl.Eq(rawLower, "lightgray")) return LightGray;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@@ -58,31 +63,31 @@ public class ColorAdp_ implements ParseAble {
|
||||
try {
|
||||
int[] ary = new int[4]; // make ARGB ary
|
||||
int idx = 0;
|
||||
int rawLen = String_.Len(raw);
|
||||
int rawLen = StringUtl.Len(raw);
|
||||
for (int i = 1; i < rawLen; i += 2) { // fill ARGB ary by parsing raw 2 at a time; EX: #FFFFFFFF -> 255,255,255,255; NOTE: start at 1 to ignore leading #
|
||||
String hexStr = String_.MidByLen(raw, i, 2);
|
||||
ary[idx++] = Hex_utl_.Parse(hexStr);
|
||||
String hexStr = StringUtl.MidByLen(raw, i, 2);
|
||||
ary[idx++] = HexUtl.Parse(hexStr);
|
||||
}
|
||||
return ColorAdp.new_(ary[0], ary[1], ary[2], ary[3]);
|
||||
} catch (Exception exc) {throw Err_.new_parse_exc(exc, ColorAdp.class, raw);}
|
||||
} catch (Exception exc) {throw ErrUtl.NewParse(exc, ColorAdp.class, raw);}
|
||||
}
|
||||
@gplx.Internal protected static ColorAdp parse_int_(String v) {
|
||||
String[] ary = String_.Split(v, ",");
|
||||
public static ColorAdp parse_int_(String v) {
|
||||
String[] ary = StringUtl.Split(v, ",");
|
||||
switch (ary.length) {
|
||||
case 1: return new_int_(Int_.Parse(ary[0]));
|
||||
case 1: return new_int_(IntUtl.Parse(ary[0]));
|
||||
case 3:
|
||||
case 4: return parse_int_ary_(ary);
|
||||
default: throw Err_.new_wo_type("invalid array", "len", ary.length);
|
||||
default: throw ErrUtl.NewArgs("invalid array", "len", ary.length);
|
||||
}
|
||||
}
|
||||
static ColorAdp parse_int_ary_(String[] ary) {
|
||||
int a;
|
||||
int idx = 0;
|
||||
if (ary.length == 3) {idx = 0; a = 255;}
|
||||
else {idx = 1; a = Int_.Parse(ary[0]);}
|
||||
int r = Int_.Parse(ary[idx++]);
|
||||
int g = Int_.Parse(ary[idx++]);
|
||||
int b = Int_.Parse(ary[idx++]);
|
||||
else {idx = 1; a = IntUtl.Parse(ary[0]);}
|
||||
int r = IntUtl.Parse(ary[idx++]);
|
||||
int g = IntUtl.Parse(ary[idx++]);
|
||||
int b = IntUtl.Parse(ary[idx++]);
|
||||
return ColorAdp_.new_(a, r, g, b);
|
||||
}
|
||||
public static ColorAdp new_int_(int val) {
|
||||
@@ -92,7 +97,7 @@ public class ColorAdp_ implements ParseAble {
|
||||
int b = ((val) & 255);
|
||||
return ColorAdp.new_(a, r, g, b);
|
||||
}
|
||||
public static ColorAdp read_(Object o) {String s = String_.as_(o); return s != null ? ColorAdp_.parse(s) : ColorAdp_.cast(o);}
|
||||
public static ColorAdp read_(Object o) {String s = StringUtl.CastOrNull(o); return s != null ? ColorAdp_.parse(s) : ColorAdp_.cast(o);}
|
||||
public static final ColorAdp
|
||||
Null = new_( 0, 0, 0, 0)
|
||||
, Black = new_(255, 0, 0, 0)
|
||||
|
||||
@@ -13,7 +13,10 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.draws; import gplx.*; import gplx.gfui.*;
|
||||
package gplx.gfui.draws;
|
||||
import gplx.frameworks.tests.TfdsTstr_fxt;
|
||||
import gplx.frameworks.tests.GfoTstr;
|
||||
import gplx.types.basics.utls.IntUtl;
|
||||
import org.junit.*;
|
||||
public class ColorAdp__tst {
|
||||
@Test public void parse_hex_() {
|
||||
@@ -26,7 +29,7 @@ public class ColorAdp__tst {
|
||||
tst_parse_int_(255, 0, 0, 0, 255);
|
||||
tst_parse_int_(65535, 0, 0, 255, 255);
|
||||
tst_parse_int_(16777215, 0, 255, 255, 255);
|
||||
tst_parse_int_(Int_.Max_value, 127, 255, 255, 255);
|
||||
tst_parse_int_(IntUtl.MaxValue, 127, 255, 255, 255);
|
||||
tst_parse_int_(-1, 255, 255, 255, 255);
|
||||
}
|
||||
@Test public void parse() {
|
||||
@@ -37,12 +40,12 @@ public class ColorAdp__tst {
|
||||
void tst_parse_hex_(String raw, int a, int r, int g, int b) {
|
||||
ColorAdp color = ColorAdp_.parse_hex_(raw);
|
||||
tst_ColorAdp(color, a, r, g, b);
|
||||
Tfds.Eq(color.XtoHexStr(), raw);
|
||||
GfoTstr.EqObj(color.XtoHexStr(), raw);
|
||||
}
|
||||
void tst_parse_int_(int val, int a, int r, int g, int b) {
|
||||
ColorAdp color = ColorAdp_.new_int_(val);
|
||||
tst_ColorAdp(color, a, r, g, b);
|
||||
Tfds.Eq(color.Value(), val);
|
||||
GfoTstr.EqObj(color.Value(), val);
|
||||
}
|
||||
void tst_parse_(String s, int alpha, int red, int green, int blue) {tst_ColorAdp(ColorAdp_.parse(s), alpha, red, green, blue);}
|
||||
void tst_ColorAdp(ColorAdp color, int alpha, int red, int green, int blue) {
|
||||
|
||||
@@ -13,10 +13,16 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.draws; import gplx.*; import gplx.gfui.*;
|
||||
package gplx.gfui.draws;
|
||||
import java.awt.Font;
|
||||
import java.awt.Toolkit;
|
||||
import gplx.core.strings.*; import gplx.core.envs.*; import gplx.gfui.controls.gxws.*;
|
||||
import gplx.core.envs.*;
|
||||
import gplx.frameworks.invks.GfoMsg;
|
||||
import gplx.frameworks.invks.Gfo_invk;
|
||||
import gplx.frameworks.invks.Gfo_invk_;
|
||||
import gplx.frameworks.invks.GfsCtx;
|
||||
import gplx.gfui.controls.gxws.*;
|
||||
import gplx.types.commons.String_bldr_;
|
||||
import gplx.types.errs.ErrUtl;
|
||||
public class FontAdp implements Gfo_invk {
|
||||
public String Name() {return name;} public FontAdp Name_(String val) {name = val; InitUnder(); return this;} private String name;
|
||||
public float Size() {return size;} public FontAdp Size_(float val) {size = val; InitUnder(); return this;} float size;
|
||||
@@ -50,11 +56,11 @@ public class FontAdp implements Gfo_invk {
|
||||
}
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
} static final String Invk_name_ = "name_", Invk_size_ = "size_", Invk_style_ = "style_";
|
||||
@Override public String toString() {return String_bldr_.new_().Add_kv("name", name).Add_kv_obj("size", size).Add_kv_obj("style", style).To_str();}
|
||||
@Override public String toString() {return String_bldr_.new_().AddKv("name", name).AddKvObj("size", size).AddKvObj("style", style).ToStr();}
|
||||
|
||||
public static final FontAdp NullPtr = null;
|
||||
public static FontAdp as_(Object obj) {return obj instanceof FontAdp ? (FontAdp)obj : null;}
|
||||
public static FontAdp cast(Object obj) {try {return (FontAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, FontAdp.class, obj);}}
|
||||
public static FontAdp cast(Object obj) {try {return (FontAdp)obj;} catch(Exception exc) {throw ErrUtl.NewCast(exc, FontAdp.class, obj);}}
|
||||
public static FontAdp new_(String name, float size, FontStyleAdp style) {
|
||||
FontAdp rv = new FontAdp();
|
||||
rv.name = name; rv.size = size; rv.style = style;
|
||||
|
||||
@@ -13,7 +13,9 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.gfui.draws; import gplx.*;
|
||||
package gplx.gfui.draws;
|
||||
import gplx.types.basics.lists.Hash_adp;
|
||||
import gplx.types.basics.lists.Hash_adp_;
|
||||
import java.awt.Font;
|
||||
import java.awt.Toolkit;
|
||||
public class FontAdpCache {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user