mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.7.3.1
This commit is contained in:
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
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 Exc_.new_type_mismatch_w_exc(exc, GfuiAlign.class, obj);}}
|
||||
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 final GfuiAlign
|
||||
Null = new_(0, "nil")
|
||||
, Lo = new_(1, "lo")
|
||||
@@ -55,7 +55,7 @@ public class GfuiAlign_ implements ParseAble {
|
||||
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 Exc_.new_unhandled(posEnm);
|
||||
else throw Err_.new_unhandled(posEnm);
|
||||
if (rv < 0) rv = 0;
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ 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 Exc_.new_unhandled(edge);
|
||||
else throw Err_.new_unhandled(edge);
|
||||
}
|
||||
public static GfuiBorderEdge parse_(String raw) {
|
||||
if (String_.Eq(raw, Left_raw)) return GfuiBorderEdge.Left;
|
||||
@@ -45,7 +45,7 @@ class GfuiBorderEdge_ {
|
||||
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 Exc_.new_unhandled(raw);
|
||||
else throw Err_.new_unhandled(raw);
|
||||
}
|
||||
public static final String
|
||||
All_raw = "all"
|
||||
|
||||
@@ -20,13 +20,13 @@ public class PointAdp_ {
|
||||
public static final PointAdp Null = new PointAdp(Int_.MinValue, Int_.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 Exc_.new_type_mismatch_w_exc(exc, PointAdp.class, obj);}}
|
||||
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 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 Exc_.new_parse_exc(exc, PointAdp.class, raw);}
|
||||
} catch (Exception exc) {throw Err_.new_parse_exc(exc, PointAdp.class, raw);}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class RectAdp_ {
|
||||
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 Exc_.new_parse_exc(exc, RectAdp.class, raw);}
|
||||
} catch(Exception exc) {throw Err_.new_parse_exc(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());}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,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 Exc_.new_("SizeAdf should only have 2 numbers separated by 1 comma");
|
||||
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]);
|
||||
return new_(val1, val2);
|
||||
} catch (Exception e) {throw Exc_.new_parse_exc(e, SizeAdpF.class, s);}
|
||||
} catch (Exception e) {throw Err_.new_parse_exc(e, SizeAdpF.class, s);}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class SizeAdp_ {
|
||||
public static final SizeAdp Null = new SizeAdp(Int_.MinValue, Int_.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 Exc_.new_type_mismatch_w_exc(exc, SizeAdp.class, obj);}}
|
||||
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 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) {
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.gfui; import gplx.*;
|
||||
import gplx.texts.*;
|
||||
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 Exc_.new_type_mismatch_w_exc(exc, ColorAdp.class, obj);}}
|
||||
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 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);}
|
||||
@@ -28,7 +28,7 @@ public class ColorAdp_ implements ParseAble {
|
||||
return rv;
|
||||
}
|
||||
public static ColorAdp parse_(String raw) {
|
||||
ColorAdp rv = parse_internal_(raw); if (rv == null) throw Exc_.new_parse_type(ColorAdp.class, raw);
|
||||
ColorAdp rv = parse_internal_(raw); if (rv == null) throw Err_.new_parse_type(ColorAdp.class, raw);
|
||||
return rv;
|
||||
}
|
||||
static ColorAdp parse_internal_(String raw) {
|
||||
@@ -66,7 +66,7 @@ public class ColorAdp_ implements ParseAble {
|
||||
ary[idx++] = HexDecUtl.parse_(hexStr);
|
||||
}
|
||||
return ColorAdp.new_(ary[0], ary[1], ary[2], ary[3]);
|
||||
} catch (Exception exc) {throw Exc_.new_parse_exc(exc, ColorAdp.class, raw);}
|
||||
} catch (Exception exc) {throw Err_.new_parse_exc(exc, ColorAdp.class, raw);}
|
||||
}
|
||||
@gplx.Internal protected static ColorAdp parse_int_(String v) {
|
||||
String[] ary = String_.Split(v, ",");
|
||||
@@ -74,7 +74,7 @@ public class ColorAdp_ implements ParseAble {
|
||||
case 1: return new_int_(Int_.parse_(ary[0]));
|
||||
case 3:
|
||||
case 4: return parse_int_ary_(ary);
|
||||
default: throw Exc_.new_("invalid array", "len", ary.length);
|
||||
default: throw Err_.new_wo_type("invalid array", "len", ary.length);
|
||||
}
|
||||
}
|
||||
static ColorAdp parse_int_ary_(String[] ary) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class FontAdp implements GfoInvkAble {
|
||||
|
||||
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 Exc_.new_type_mismatch_w_exc(exc, FontAdp.class, obj);}}
|
||||
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 new_(String name, float size, FontStyleAdp style) {
|
||||
FontAdp rv = new FontAdp();
|
||||
rv.name = name; rv.size = size; rv.style = style;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class FontStyleAdp_ implements ParseAble {
|
||||
public static final FontStyleAdp_ Parser = new FontStyleAdp_();
|
||||
public Object ParseAsObj(String raw) {return FontStyleAdp_.parse_(raw);}
|
||||
|
||||
public static FontStyleAdp cast_(Object obj) {try {return (FontStyleAdp)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, FontStyleAdp.class, obj);}}
|
||||
public static FontStyleAdp cast_(Object obj) {try {return (FontStyleAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, FontStyleAdp.class, obj);}}
|
||||
public static FontStyleAdp parseOr_(String raw, FontStyleAdp or) {
|
||||
FontStyleAdp rv = parse_internal_(raw); if (rv == null) return or;
|
||||
return rv;
|
||||
@@ -38,7 +38,7 @@ public class FontStyleAdp_ implements ParseAble {
|
||||
return lang_(v);
|
||||
}
|
||||
public static FontStyleAdp parse_(String raw) {
|
||||
FontStyleAdp rv = parse_internal_(raw); if (rv == null) throw Exc_.new_unhandled(raw);
|
||||
FontStyleAdp rv = parse_internal_(raw); if (rv == null) throw Err_.new_unhandled(raw);
|
||||
return rv;
|
||||
}
|
||||
public static FontStyleAdp read_(Object o) {String s = String_.as_(o); return s != null ? FontStyleAdp_.parse_(s) : FontStyleAdp_.cast_(o);}
|
||||
@@ -55,7 +55,7 @@ public class FontStyleAdp_ implements ParseAble {
|
||||
else if (v == Bold.Val()) return Bold;
|
||||
else if (v == Italic.Val()) return Italic;
|
||||
else if (v == BoldItalic.Val()) return BoldItalic;
|
||||
else throw Err_arg.notFound_key_("v", v);
|
||||
else throw Err_.new_unhandled(v);
|
||||
}
|
||||
public static String XtoStr_(FontStyleAdp fontStyle) {
|
||||
int val = fontStyle.Val();
|
||||
@@ -63,6 +63,6 @@ public class FontStyleAdp_ implements ParseAble {
|
||||
else if (val == FontStyleAdp_.Bold.Val()) return "bold";
|
||||
else if (val == FontStyleAdp_.Italic.Val()) return "italic";
|
||||
else if (val == FontStyleAdp_.BoldItalic.Val()) return "bold+italic";
|
||||
else throw Exc_.new_unhandled(val);
|
||||
else throw Err_.new_unhandled(val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class PenAdp_ {
|
||||
public static PenAdp as_(Object obj) {return obj instanceof PenAdp ? (PenAdp)obj : null;}
|
||||
public static PenAdp cast_(Object obj) {try {return (PenAdp)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, PenAdp.class, obj);}}
|
||||
public static PenAdp cast_(Object obj) {try {return (PenAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, PenAdp.class, obj);}}
|
||||
public static PenAdp black_() {return new_(ColorAdp_.Black, 1);}
|
||||
public static PenAdp new_(ColorAdp color) {return new_(color, 1);}
|
||||
public static PenAdp new_(ColorAdp color, float width) {return new PenAdp(color, width);}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class SolidBrushAdp_ {
|
||||
public static SolidBrushAdp as_(Object obj) {return obj instanceof SolidBrushAdp ? (SolidBrushAdp)obj : null;}
|
||||
public static SolidBrushAdp cast_(Object obj) {try {return (SolidBrushAdp)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, SolidBrushAdp.class, obj);}}
|
||||
public static SolidBrushAdp cast_(Object obj) {try {return (SolidBrushAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, SolidBrushAdp.class, obj);}}
|
||||
public static final SolidBrushAdp Black = new_(ColorAdp_.Black);
|
||||
public static final SolidBrushAdp White = new_(ColorAdp_.White);
|
||||
public static final SolidBrushAdp Null = new_(ColorAdp_.Null);
|
||||
|
||||
@@ -50,7 +50,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 Exc_.new_unhandled(edge);
|
||||
else throw Err_.new_unhandled(edge);
|
||||
}
|
||||
void SyncPens(boolean isAll) {
|
||||
if (isAll) {
|
||||
|
||||
@@ -20,7 +20,7 @@ public class PaintArgs {
|
||||
public GfxAdp Graphics() {return graphics;} GfxAdp graphics;
|
||||
public RectAdp ClipRect() {return clipRect;} RectAdp clipRect;
|
||||
|
||||
public static PaintArgs cast_(Object obj) {try {return (PaintArgs)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, PaintArgs.class, obj);}}
|
||||
public static PaintArgs cast_(Object obj) {try {return (PaintArgs)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, PaintArgs.class, obj);}}
|
||||
public static PaintArgs new_(GfxAdp graphics, RectAdp clipRect) {
|
||||
PaintArgs rv = new PaintArgs();
|
||||
rv.graphics = graphics; rv.clipRect = clipRect;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class IptArg_ {
|
||||
: parse_(raw);
|
||||
}
|
||||
catch (Exception exc) { // as an "or" proc, handle errors; note that it may accept raw values from cfg files, so invalid input is possible; DATE:2014-06-04
|
||||
Exc_.Noop(exc);
|
||||
Err_.Noop(exc);
|
||||
return IptKey_.None;
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class IptArg_ {
|
||||
else if (type == IptMouseBtn.class) return IptEventType_.MouseUp; // changed from MouseDown; confirmed against Firefox, Eclipse; DATE:2014-05-16
|
||||
else if (type == IptMouseWheel.class) return IptEventType_.MouseWheel;
|
||||
else if (type == IptMouseMove.class) return IptEventType_.MouseMove;
|
||||
else throw Exc_.new_unhandled(type);
|
||||
else throw Err_.new_unhandled(type);
|
||||
}
|
||||
@gplx.Internal protected static boolean EventType_match(IptArg arg, IptEventType match) {
|
||||
Class<?> type = arg.getClass();
|
||||
@@ -75,7 +75,7 @@ public class IptArg_ {
|
||||
else if (type == IptMouseBtn.class) return match == IptEventType_.MouseDown || match == IptEventType_.MouseUp || match == IptEventType_.MousePress;
|
||||
else if (type == IptMouseWheel.class) return match == IptEventType_.MouseWheel;
|
||||
else if (type == IptMouseMove.class) return match == IptEventType_.MouseMove;
|
||||
else throw Exc_.new_unhandled(type);
|
||||
else throw Err_.new_unhandled(type);
|
||||
}
|
||||
}
|
||||
class IptMacro {
|
||||
@@ -113,6 +113,6 @@ class IptMacro {
|
||||
return rv;
|
||||
}
|
||||
Ordered_hash regy;
|
||||
static Exc parse_err(String raw, String loc) {return Exc_.new_w_type("gfui", "could not parse IptArg", "raw", raw, "loc", loc).Stack_erase_1_();}
|
||||
static Err parse_err(String raw, String loc) {return Err_.new_("gfui", "could not parse IptArg", "raw", raw, "loc", loc).Trace_ignore_add_1_();}
|
||||
public static final IptMacro _ = new IptMacro(); IptMacro() {}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class IptBndMgr implements SrlAble {
|
||||
else if (v == IptEventType_.MouseMove.Val()) return 5;
|
||||
else if (v == IptEventType_.MouseWheel.Val()) return 6;
|
||||
else if (v == IptEventType_.MousePress.Val()) return 7;
|
||||
else throw Exc_.new_unhandled(v);
|
||||
else throw Err_.new_unhandled(v);
|
||||
}
|
||||
}
|
||||
class IptBndHash implements SrlAble {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class IptBnd_upDownRange implements InjectAble, GfoInvkAble, GfoEvObj {
|
||||
if (ctx.Match(k, Invk_TxtBox_dec)) ExecCmd(cmd, curVal - 1);
|
||||
else if (ctx.Match(k, Invk_TxtBox_inc)) ExecCmd(cmd, curVal + 1);
|
||||
else if (ctx.Match(k, Invk_TxtBox_exec)) {
|
||||
Object valObj = IntClassXtn._.ParseOrNull(txtBox.Text()); if (valObj == null) throw Exc_.new_("invalid int", "text", txtBox.Text());
|
||||
Object valObj = IntClassXtn._.ParseOrNull(txtBox.Text()); if (valObj == null) throw Err_.new_wo_type("invalid int", "text", txtBox.Text());
|
||||
ExecCmd(doIt, Int_.cast_(valObj));
|
||||
}
|
||||
else if (ctx.Match(k, evt)) WhenEvt(ctx, m);
|
||||
|
||||
@@ -36,7 +36,7 @@ public class IptEventData {
|
||||
}
|
||||
|
||||
public static IptEventData as_(Object obj) {return obj instanceof IptEventData ? (IptEventData)obj : null;}
|
||||
public static IptEventData cast_(Object obj) {try {return (IptEventData)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, IptEventData.class, obj);}}
|
||||
public static IptEventData cast_(Object obj) {try {return (IptEventData)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, IptEventData.class, obj);}}
|
||||
@gplx.Internal protected static IptEventData new_(GfuiElem sender, IptEventType eventType, IptArg eventArg, IptEvtDataKey keyData, IptEvtDataMouse mouseData) {return new_(sender, eventType, eventArg, keyData, IptEvtDataKeyHeld.Null, mouseData);}
|
||||
@gplx.Internal protected static IptEventData new_(GfuiElem sender, IptEventType eventType, IptArg eventArg, IptEvtDataKey keyData, IptEvtDataKeyHeld keyPressData, IptEvtDataMouse mouseData) {
|
||||
IptEventData rv = new IptEventData();
|
||||
|
||||
@@ -21,7 +21,7 @@ public class IptEvtDataKey {
|
||||
public boolean Handled() {return handled;} public void Handled_set(boolean v) {handled = v;} private boolean handled;
|
||||
|
||||
public static IptEvtDataKey as_(Object obj) {return obj instanceof IptEvtDataKey ? (IptEvtDataKey)obj : null;}
|
||||
public static IptEvtDataKey cast_(Object obj) {try {return (IptEvtDataKey)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, IptEvtDataKey.class, obj);}}
|
||||
public static IptEvtDataKey cast_(Object obj) {try {return (IptEvtDataKey)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, IptEvtDataKey.class, obj);}}
|
||||
@gplx.Internal protected static final IptEvtDataKey Null = new_(IptKey_.None);
|
||||
@gplx.Internal protected static IptEvtDataKey test_(IptKey keyArg) {return new_(keyArg);}
|
||||
@gplx.Internal protected static IptEvtDataKey int_(int val) {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class IptEvtDataKeyHeld {
|
||||
public boolean Handled() {return handled;} public void Handled_set(boolean v) {handled = v;} private boolean handled;
|
||||
|
||||
public static IptEvtDataKeyHeld as_(Object obj) {return obj instanceof IptEvtDataKeyHeld ? (IptEvtDataKeyHeld)obj : null;}
|
||||
public static IptEvtDataKeyHeld cast_(Object obj) {try {return (IptEvtDataKeyHeld)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, IptEvtDataKeyHeld.class, obj);}}
|
||||
public static IptEvtDataKeyHeld cast_(Object obj) {try {return (IptEvtDataKeyHeld)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, IptEvtDataKeyHeld.class, obj);}}
|
||||
@gplx.Internal protected static final IptEvtDataKeyHeld Null = char_((char)0);
|
||||
@gplx.Internal protected static IptEvtDataKeyHeld char_(char c) {
|
||||
IptEvtDataKeyHeld rv = new IptEvtDataKeyHeld();
|
||||
|
||||
@@ -22,7 +22,7 @@ public class IptEvtDataMouse {
|
||||
public PointAdp Pos() {return location;} PointAdp location;
|
||||
|
||||
public static IptEvtDataMouse as_(Object obj) {return obj instanceof IptEvtDataMouse ? (IptEvtDataMouse)obj : null;}
|
||||
public static IptEvtDataMouse cast_(Object obj) {try {return (IptEvtDataMouse)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, IptEvtDataMouse.class, obj);}}
|
||||
public static IptEvtDataMouse cast_(Object obj) {try {return (IptEvtDataMouse)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, IptEvtDataMouse.class, obj);}}
|
||||
@gplx.Internal protected static final IptEvtDataMouse Null = IptEvtDataMouse.new_(IptMouseBtn_.None, IptMouseWheel_.None, 0, 0);
|
||||
public static IptEvtDataMouse new_(IptMouseBtn button, IptMouseWheel wheel, int x, int y) {
|
||||
IptEvtDataMouse rv = new IptEvtDataMouse();
|
||||
|
||||
@@ -23,7 +23,7 @@ public class IptKey_ {
|
||||
public static IptKey[] Ary(IptKey... ary) {return ary;}
|
||||
public static final IptKey[] Ary_empty = new IptKey[0];
|
||||
public static IptKey as_(Object obj) {return obj instanceof IptKey ? (IptKey)obj : null;}
|
||||
public static IptKey cast_(Object obj) {try {return (IptKey)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, IptKey.class, obj);}}
|
||||
public static IptKey cast_(Object obj) {try {return (IptKey)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, IptKey.class, obj);}}
|
||||
public static IptKey add_(IptKey... ary) {
|
||||
if (ary.length == 0) return IptKey_.None;
|
||||
int newVal = ary[0].Val();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class IptMouseBtn_ {
|
||||
else if (String_.Eq(raw, Middle.Key())) return Middle;
|
||||
else if (String_.Eq(raw, X1.Key())) return X1;
|
||||
else if (String_.Eq(raw, X2.Key())) return X2;
|
||||
else throw Exc_.new_parse_type(IptMouseBtn.class, raw);
|
||||
else throw Err_.new_parse_type(IptMouseBtn.class, raw);
|
||||
}
|
||||
@gplx.Internal protected static IptMouseBtn api_(int val) {
|
||||
if (val == None.Val()) return None;
|
||||
@@ -49,6 +49,6 @@ public class IptMouseBtn_ {
|
||||
else if (val == Middle.Val()) return Middle;
|
||||
else if (val == X1.Val()) return X1;
|
||||
else if (val == X2.Val()) return X2;
|
||||
else throw Exc_.new_unhandled(val);
|
||||
else throw Err_.new_unhandled(val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class IptMouseWheel_ {
|
||||
if (String_.Eq(raw, None.Key())) return None;
|
||||
else if (String_.Eq(raw, Up.Key())) return Up;
|
||||
else if (String_.Eq(raw, Down.Key())) return Down;
|
||||
else throw Exc_.new_parse_type(IptMouseWheel.class, raw);
|
||||
else throw Err_.new_parse_type(IptMouseWheel.class, raw);
|
||||
}
|
||||
@gplx.Internal protected static IptMouseWheel api_(Object obj) {
|
||||
int delta = Int_.cast_(obj);
|
||||
|
||||
@@ -111,7 +111,7 @@ public class GftGrid {
|
||||
int h = band.Len1().Calc(this, band, owner, itm, availY);
|
||||
band.Calc(owner, y, h);
|
||||
y += h * bandDir.Val();
|
||||
if (bandIdx + 1 >= bands.Count()) throw Exc_.new_("error retrieving band", "owner", owner.Key_of_GfuiElem(), "item", itm.Key_of_GfuiElem(), "bandIdx", bandIdx + 1, "count", bands.Count());
|
||||
if (bandIdx + 1 >= bands.Count()) throw Err_.new_wo_type("error retrieving band", "owner", owner.Key_of_GfuiElem(), "item", itm.Key_of_GfuiElem(), "bandIdx", bandIdx + 1, "count", bands.Count());
|
||||
band = (GftBand)bands.Get_at(++bandIdx);
|
||||
band.Items().Clear();
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class GftGrid_fx {
|
||||
else if (String_.Eq(name, "y")) return item.Gft_y();
|
||||
else if (String_.Eq(name, "w")) return item.Gft_w();
|
||||
else if (String_.Eq(name, "h")) return item.Gft_h();
|
||||
else throw Exc_.new_unhandled(name);
|
||||
else throw Err_.new_unhandled(name);
|
||||
}
|
||||
static int[] rng_(int expdVal, int len) {
|
||||
int[] rv = new int[len];
|
||||
|
||||
@@ -68,7 +68,7 @@ class GxwElemFactory_cls_mock extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwTextFld text_fld_() {return new MockTextBox();}
|
||||
@gplx.Internal @Override protected GxwTextFld text_memo_() {return new MockTextBoxMulti();}
|
||||
@gplx.Internal @Override protected GxwTextHtml text_html_() {return new MockTextBoxMulti();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(KeyValHash ctorArgs) {throw Exc_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(KeyValHash ctorArgs) {throw Err_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwComboBox comboBox_() {return new MockComboBox();}
|
||||
@gplx.Internal @Override protected GxwListBox listBox_() {return new MockListBox();}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class GxwTextFld_cls_lang extends JTextField implements GxwTextFld {
|
||||
try {
|
||||
this.setSelectionStart(v);
|
||||
} catch (Exception e) {
|
||||
Exc_.Noop(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);}
|
||||
|
||||
@@ -87,7 +87,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 Exc_.new_unimplemented();}
|
||||
public void ScrollTillCaretIsVisible() {throw Err_.new_unimplemented();}
|
||||
public GxwTextHtml_lang ctor() {
|
||||
editor = new GxwTextHtml_editor().ctor();
|
||||
core = new GxwCore_host(GxwCore_lang.new_(this), editor.core);
|
||||
@@ -152,7 +152,7 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
|
||||
// this.setEditorKit(v ? new StyledEditorKit() : new DefaultEditorKit());
|
||||
this.setEditorKit(v ? htmlKit : styledKit);
|
||||
}
|
||||
public void ScrollTillCaretIsVisible() {throw Exc_.new_unimplemented();}
|
||||
public void ScrollTillCaretIsVisible() {throw Err_.new_unimplemented();}
|
||||
public void Html_css_set(String s) {
|
||||
StyleSheet styleSheet = htmlKit.getStyleSheet();
|
||||
styleSheet.addRule(s);
|
||||
@@ -187,14 +187,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 Exc_.new_exc(e, "ui", "Html_doc_html");}
|
||||
catch (Exception e) {throw Err_.new_exc(e, "ui", "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 Exc_.new_exc(e, "ui", "Html_sel_text");}
|
||||
catch (Exception e) {throw Err_.new_exc(e, "ui", "Html_sel_text");}
|
||||
}
|
||||
static void Html_sel_atrs(AttributeSet atrs, List_adp list, String ownerKey, String dlm) {
|
||||
if (atrs == null) return;
|
||||
|
||||
@@ -47,7 +47,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 Exc_.new_unimplemented();}
|
||||
public void ScrollTillCaretIsVisible() {throw Err_.new_unimplemented();}
|
||||
public void Margins_set(int left, int top, int right, int bot) {
|
||||
if (left == 0 && right == 0) {
|
||||
txt_box.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
|
||||
@@ -262,7 +262,7 @@ class GxwElemFactory_swt extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwTextFld text_fld_() {return null;}
|
||||
@gplx.Internal @Override protected GxwTextFld text_memo_() {return null;}
|
||||
@gplx.Internal @Override protected GxwTextHtml text_html_() {return null;}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(KeyValHash ctorArgs) {throw Exc_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(KeyValHash ctorArgs) {throw Err_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwComboBox comboBox_() {return null;}
|
||||
@gplx.Internal @Override protected GxwListBox listBox_() {return null;}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ public class Gxw_html_load_tid_ {
|
||||
switch (v) {
|
||||
case Tid_mem: return Key_mem;
|
||||
case Tid_url: return Key_url;
|
||||
default: throw Exc_.new_unimplemented();
|
||||
default: throw Err_.new_unimplemented();
|
||||
}
|
||||
}
|
||||
public static byte Xto_tid(String s) {
|
||||
if (String_.Eq(s, Key_mem)) return Tid_mem;
|
||||
else if (String_.Eq(s, Key_url)) return Tid_url;
|
||||
else throw Exc_.new_unimplemented();
|
||||
else throw Err_.new_unimplemented();
|
||||
}
|
||||
public static KeyVal[] Options__list = KeyVal_.Ary(KeyVal_.new_(Key_mem), KeyVal_.new_(Key_url));
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class GfoConsoleWinCmds implements GfoInvkAble {
|
||||
String cmdText = consoleBox.SelLen() == 0 ? consoleBox.Text() : consoleBox.SelText();
|
||||
String cmd = FixNewLines(cmdText);
|
||||
GfoMsg runMsg = GfoMsg_.Null;
|
||||
try {runMsg = GfsCore._.MsgParser().ParseToMsg(cmd);} catch (Exception e) {statusBox.Text_("invalid gfml " + Err_.Message_gplx(e)); return;}
|
||||
try {runMsg = GfsCore._.MsgParser().ParseToMsg(cmd);} catch (Exception e) {statusBox.Text_("invalid gfml " + Err_.Message_gplx_full(e)); return;}
|
||||
GfsCtx ctx = GfsCtx.new_();
|
||||
Object rv = GfsCore._.ExecMany(ctx, runMsg);
|
||||
resultBox.Text_(Object_.Xto_str_strict_or_empty(rv));
|
||||
@@ -117,7 +117,7 @@ class GfoConsoleWinCmds implements GfoInvkAble {
|
||||
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(e)); return;}
|
||||
try {runMsg = GfmlDataNde.XtoMsgNoRoot(cmd);} catch (Exception e) {statusBox.Text_("invalid gfml " + Err_.Message_gplx_full(e)); return;}
|
||||
GfsCtx ctx = GfsCtx.new_();
|
||||
try {
|
||||
Object rv = GfsCore._.ExecOne(ctx, runMsg);
|
||||
@@ -125,7 +125,7 @@ class GfoConsoleWinCmds implements GfoInvkAble {
|
||||
UsrDlg_._.Note(Object_.Xto_str_strict_or_empty(rv));
|
||||
}
|
||||
// Results_add(FixNewLines(ctx.Results_XtoStr()));
|
||||
} catch (Exception e) {statusBox.Text_("help failed " + Err_.Message_gplx(e)); return;}
|
||||
} catch (Exception e) {statusBox.Text_("help failed " + Err_.Message_gplx_full(e)); return;}
|
||||
}
|
||||
void Save() {
|
||||
String consoleFilStr = consoleFilBox.Text();
|
||||
|
||||
@@ -50,7 +50,7 @@ public class GfuiMenuBar implements GfoInvkAble {
|
||||
GfsCore._.AddObj(this, "GfuiMenuBar_");
|
||||
GfsCore._.ExecRegy("gplx.gfui.GfuiMenuBar.ini");
|
||||
}
|
||||
catch (Exception e) {GfuiEnv_.ShowMsg(Err_.Message_gplx(e));}
|
||||
catch (Exception e) {GfuiEnv_.ShowMsg(Err_.Message_gplx_full(e));}
|
||||
}
|
||||
String separatorText, mnemonicPrefix; int separatorIdx = 0;
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
@@ -218,7 +218,7 @@ class GfuiMenuBarItm {
|
||||
GfuiMenuBarItmCmd itmCmd;
|
||||
Object under;
|
||||
public static GfoMsg CmdMsg(GfuiMenuBarItm itm) {
|
||||
if (itm.cmd == null) throw Exc_.new_null("cmd was null for menu").Args_add("key", itm.key, "text", itm.text);
|
||||
if (itm.cmd == null) throw Err_.new_null().Args_add("key", itm.key, "text", itm.text);
|
||||
return gplx.gfml.GfmlDataNde.XtoMsgNoRoot(itm.cmd);
|
||||
}
|
||||
public static GfuiMenuBarItm new_() {return new GfuiMenuBarItm();}
|
||||
@@ -243,7 +243,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.Get_by(raw);}
|
||||
catch (Exception e) {Exc_.Noop(e); throw Exc_.new_parse("GfuiMenuBarItmType", raw);}
|
||||
catch (Exception e) {Err_.Noop(e); throw Err_.new_parse("GfuiMenuBarItmType", raw);}
|
||||
}
|
||||
static Hash_adp regy = Hash_adp_.new_();
|
||||
public static final GfuiMenuBarItmType Root = new GfuiMenuBarItmType(1, "root");
|
||||
@@ -261,7 +261,7 @@ class GfuiMenuBarItmCmd implements ActionListener {
|
||||
GfsCore._.ExecOne(GfsCtx._, GfuiMenuBarItm.CmdMsg(itm));
|
||||
}
|
||||
catch (Exception e) {
|
||||
GfuiEnv_.ShowMsg(Err_.Message_gplx(e));
|
||||
GfuiEnv_.ShowMsg(Err_.Message_gplx_full(e));
|
||||
}
|
||||
}
|
||||
public static GfuiMenuBarItmCmd new_(GfuiMenuBarItm itm) {
|
||||
|
||||
@@ -73,7 +73,7 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
|
||||
try {elem = (GfuiElem)elems.Get_at(idx);}
|
||||
catch (Exception e) {
|
||||
System.out.println(idx);
|
||||
Exc_.Noop(e);
|
||||
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()) {
|
||||
@@ -109,7 +109,7 @@ class FocusTraversalPolicy_cls_base extends FocusTraversalPolicy {
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println(idx);
|
||||
Exc_.Noop(e);
|
||||
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()) {
|
||||
|
||||
@@ -24,7 +24,7 @@ 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 Exc_.new_type_mismatch_w_exc(exc, GfuiWin.class, obj);}}
|
||||
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, KeyValHash.new_());}
|
||||
public static GfuiWin tool_(String key) {return bld_(key, InitKey_winType_tool, KeyValHash.new_()).TaskbarVisible_(false);}
|
||||
public static GfuiWin sub_(String key, GfuiWin ownerWin) {
|
||||
|
||||
@@ -99,7 +99,7 @@ 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 Exc_.new_("could not find defaultTarget for focus", "ownerKey", this.Key_of_GfuiElem(), "defaultTarget", defaultFocusKey);
|
||||
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);
|
||||
focusTarget.Focus();
|
||||
}
|
||||
else { // else, activate first visible elem; NOTE: some elems are visible, but not Focus_able (ex: ImgGalleryBox)
|
||||
|
||||
@@ -18,5 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
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 Exc_.new_type_mismatch_w_exc(exc, GfuiElemBase.class, obj);}}
|
||||
public static GfuiElemBase cast_(Object obj) {try {return (GfuiElemBase)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfuiElemBase.class, obj);}}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,14 @@ public class GfuiElemList {
|
||||
hash.Clear();
|
||||
}
|
||||
void Add_exec(GfuiElem box) {
|
||||
String key = box.Key_of_GfuiElem(); if (String_.Eq(key, String_.Empty)) throw Exc_.new_("box does not have key", "type", box.getClass(), "owner", owner.Key_of_GfuiElem(), "ownerSubs", owner.SubElems().Count());
|
||||
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());
|
||||
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
|
||||
GfoEvMgr_.SubSame(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 Exc_.new_missing_key(key);
|
||||
String key = box.Key_of_GfuiElem(); if (!hash.Has(key)) throw Err_.new_missing_key(key);
|
||||
hash.Del(key);
|
||||
owner.UnderElem().Core().Controls_del(box.UnderElem());
|
||||
owner.IptBnds().Cfgs_delAll();
|
||||
|
||||
@@ -21,7 +21,7 @@ public class GfuiElem_ {
|
||||
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 Exc_.new_type_mismatch_w_exc(exc, GfuiElem.class, obj);}}
|
||||
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 GfuiElemBase sub_(String key, GfuiElem owner) {
|
||||
GfuiElemBase rv = new_();
|
||||
rv.Owner_(owner, key);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class GfuiBtn extends GfuiElemBase {
|
||||
else
|
||||
GfsCore._.ExecOne(ctx, clickMsg);
|
||||
}
|
||||
} catch (Exception e) {GfuiEnv_.ShowMsg(Err_.Message_gplx(e));}
|
||||
} catch (Exception e) {GfuiEnv_.ShowMsg(Err_.Message_gplx_full(e));}
|
||||
}
|
||||
public static final String Invk_btn_img = "btn_img", Invk_btn_img_ = "btn_img_";
|
||||
public static final String CFG_border_on_ = "border_on_";
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
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 Exc_.new_type_mismatch_w_exc(exc, GfuiBtn.class, obj);}}
|
||||
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 msg_(String key, GfuiElem owner, GfoMsg msg) {
|
||||
GfuiBtn rv = new_(key); rv.Owner_(owner);
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
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 Exc_.new_type_mismatch_w_exc(exc, GfuiChkBox.class, obj);}}
|
||||
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_() {
|
||||
GfuiChkBox rv = new GfuiChkBox();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_true_());
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
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 Exc_.new_type_mismatch_w_exc(exc, GfuiTextBox.class, obj);}}
|
||||
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 final String NewLine = "\n";
|
||||
public static final String Ctor_Memo = "TextBox_Memo";
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package gplx.gfui; import gplx.*;
|
||||
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 Exc_.new_type_mismatch(GfuiWin.class, owner);
|
||||
GfuiWin form = GfuiWin_.as_(owner); if (form == null) throw Err_.new_type_mismatch(GfuiWin.class, owner);
|
||||
statusBar.Owner_(form, "statusBar");
|
||||
IptBnd_.cmd_to_(IptCfg_.Null, form, statusBar, GfuiStatusBar.StatusBarFocus_cmd, IptKey_.add_(IptKey_.Ctrl, IptKey_.Alt, IptKey_.T));
|
||||
statusBar.MoveButton().TargetElem_set(form);
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui; import gplx.*;
|
||||
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 Exc_.new_type_mismatch_w_exc(exc, TabBox.class, obj);}}
|
||||
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 new_() {
|
||||
TabBox rv = new TabBox();
|
||||
rv.ctor_GfuiBox_base(GfuiElem_.init_focusAble_false_());
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ClipboardAdp_ {
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
String rv = "";
|
||||
try {rv = clipboard.getData(DataFlavor.stringFlavor).toString();}
|
||||
catch (Exception e) {throw Exc_.new_exc(e, "ui", "clipboard get_data failed");}
|
||||
catch (Exception e) {throw Err_.new_exc(e, "ui", "clipboard get_data failed");}
|
||||
if (Op_sys.Cur().Tid_is_wnt()) { // WORKAROUND:JAVA: On Windows, Clipboard will have \r\n, but Java automatically converts to \n
|
||||
String_bldr remake = String_bldr_.new_();
|
||||
for (int i = 0; i < String_.Len(rv); i++) {
|
||||
|
||||
@@ -27,7 +27,7 @@ public class CursorAdp {
|
||||
else {
|
||||
java.awt.Robot robot = null;
|
||||
try {robot = new java.awt.Robot();}
|
||||
catch (java.awt.AWTException e) {throw Exc_.new_exc(e, "ui", "cursor pos set failed");}
|
||||
catch (java.awt.AWTException e) {throw Err_.new_exc(e, "ui", "cursor pos set failed");}
|
||||
robot.mouseMove(p.X(), p.Y());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class IconAdp {
|
||||
public static IconAdp regy_(String key) {
|
||||
GfoRegyItm itm = GfoRegy._.FetchOrNull(key);
|
||||
if (itm == null) {UsrDlg_._.Warn("missing icon; key={0}", key); return null;}
|
||||
if (itm.ValType() != GfoRegyItm.ValType_Url) throw Exc_.new_("regyItm should be of type url", "key", key);
|
||||
if (itm.ValType() != GfoRegyItm.ValType_Url) throw Err_.new_wo_type("regyItm should be of type url", "key", key);
|
||||
return IconAdp.file_(itm.Url());
|
||||
}
|
||||
public static IconAdp as_(Object obj) {return obj instanceof IconAdp ? (IconAdp)obj : null;}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.awt.image.BufferedImage;
|
||||
import javax.imageio.ImageIO;
|
||||
public class ImageAdp_ {
|
||||
public static ImageAdp as_(Object obj) {return obj instanceof ImageAdp ? (ImageAdp)obj : null;}
|
||||
public static ImageAdp cast_(Object obj) {try {return (ImageAdp)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, ImageAdp.class, obj);}}
|
||||
public static ImageAdp cast_(Object obj) {try {return (ImageAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, ImageAdp.class, obj);}}
|
||||
public static final ImageAdp Null = new_(10, 10);
|
||||
public static ImageAdp new_(int width, int height) {
|
||||
// BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // JAVA: must be TYPE_INT_RGB or else ImageIO.write("bmp") will fail
|
||||
@@ -49,7 +49,7 @@ public class ImageAdp_ {
|
||||
}
|
||||
public static SizeAdp SizeOf_svg(Io_url url) {return Gfui_svg_util.QuerySize(url);}
|
||||
public static ImageAdp file_(Io_url url) {
|
||||
if (url.EqNull()) throw Exc_.new_("cannot load image from null url");
|
||||
if (url.EqNull()) throw Err_.new_wo_type("cannot load image from null url");
|
||||
if (String_.Eq(url.Info().Key(), IoUrlInfo_.Mem.Key())) return txt_fil_(url);
|
||||
if (!Io_mgr.I.ExistsFil(url)) return Null;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ImageAdp_ {
|
||||
File f = new File(url.Xto_api());
|
||||
img = ImageIO.read(f);
|
||||
}
|
||||
catch (IOException e) {throw Exc_.new_exc(e, "ui", "image load failed", "url", url.Xto_api());}
|
||||
catch (IOException e) {throw Err_.new_exc(e, "ui", "image load failed", "url", url.Xto_api());}
|
||||
// FileInputStream istream = new FileInputStream(new File(url.Xto_api()));
|
||||
// JPEGImageDecoder dec = JPEGCodec.createJPEGDecoder(istream);
|
||||
// BufferedImage im = dec.decodeAsBufferedImage();
|
||||
@@ -110,7 +110,7 @@ class Gfui_svg_util {
|
||||
double w = ParseAtr(xml, pos_ref, "width");
|
||||
double h = ParseAtr(xml, pos_ref, "height");
|
||||
return SizeAdp_.new_((int)w, (int)h);
|
||||
} catch (Exception e) {Exc_.Noop(e); return SizeAdp_.Null;}
|
||||
} catch (Exception e) {Err_.Noop(e); return SizeAdp_.Null;}
|
||||
}
|
||||
static double ParseAtr(String xml, Int_obj_ref pos_ref, String atr) {
|
||||
int pos = String_.FindFwd(xml, atr, pos_ref.Val()); if (pos == -1) return -1;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ImageAdp_base implements ImageAdp, RlsAble {
|
||||
boolean success = false;
|
||||
try {success = ImageIO.write((BufferedImage)under, fmtStr, fil);}
|
||||
catch (IOException e) {}
|
||||
if (!success) throw Exc_.new_w_type("gplx.gfui.imgs.SaveImageFailed", "save image failed", "srcUrl", url.Xto_api(), "trgFil", fil, "fmt", fmtStr);
|
||||
if (!success) throw Err_.new_("gplx.gfui.imgs.SaveImageFailed", "save image failed", "srcUrl", url.Xto_api(), "trgFil", fil, "fmt", fmtStr);
|
||||
//#@endif
|
||||
}
|
||||
public ImageAdp Extract_image(RectAdp src_rect, SizeAdp trg_size) {return Extract_image(src_rect.X(), src_rect.Y(), src_rect.Width(), src_rect.Height(), trg_size.Width(), trg_size.Height());}
|
||||
|
||||
@@ -23,13 +23,13 @@ import java.awt.Toolkit;
|
||||
public class ScreenAdp_ {
|
||||
public static final ScreenAdp Primary = screen_(0);
|
||||
public static ScreenAdp as_(Object obj) {return obj instanceof ScreenAdp ? (ScreenAdp)obj : null;}
|
||||
public static ScreenAdp cast_(Object obj) {try {return (ScreenAdp)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, ScreenAdp.class, obj);}}
|
||||
public static ScreenAdp cast_(Object obj) {try {return (ScreenAdp)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, ScreenAdp.class, obj);}}
|
||||
public static ScreenAdp parse_(String raw) { // ex: {screen{1}
|
||||
try {
|
||||
raw = String_.Replace(raw, "{screen{", "");
|
||||
raw = String_.Replace(raw, "}", "");
|
||||
return ScreenAdp_.screen_(Int_.parse_(raw));
|
||||
} catch(Exception exc) {throw Exc_.new_parse_exc(exc, ScreenAdp.class, raw);}
|
||||
} catch(Exception exc) {throw Err_.new_parse_exc(exc, ScreenAdp.class, raw);}
|
||||
}
|
||||
public static ScreenAdp from_point_(PointAdp pos) {// NOTE: not using FromPoint b/c of plat_wce
|
||||
if (ScreenAdp_.Count() == 1) return Primary;
|
||||
@@ -46,7 +46,7 @@ public class ScreenAdp_ {
|
||||
// return 1;//Screen.AllScreens.Length;
|
||||
}
|
||||
public static ScreenAdp screen_(int index) {
|
||||
if (index >= ScreenAdp_.Count()) throw Exc_.new_missing_idx(index, ScreenAdp_.Count());
|
||||
if (index >= ScreenAdp_.Count()) throw Err_.new_missing_idx(index, ScreenAdp_.Count());
|
||||
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
GraphicsDevice[] devs = env.getScreenDevices();
|
||||
GraphicsConfiguration conf = devs[index].getDefaultConfiguration();
|
||||
|
||||
@@ -25,7 +25,7 @@ public class Gfui_kit_ {
|
||||
if (String_.Eq(key, Mem().Key())) return Mem();
|
||||
else if (String_.Eq(key, Swt().Key())) return Swt();
|
||||
else if (String_.Eq(key, Swing().Key())) return Swing();
|
||||
else throw Exc_.new_unhandled(key);
|
||||
else throw Err_.new_unhandled(key);
|
||||
}
|
||||
public static final String Cfg_HtmlBox = "HtmlBox";
|
||||
public static final byte File_dlg_type_open = 0, File_dlg_type_save = 1;
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.omg.PortableServer.THREAD_POLICY_ID;
|
||||
|
||||
import gplx.core.threads.Thread_adp_;
|
||||
import gplx.core.threads.*;
|
||||
public class Swt_kit implements Gfui_kit {
|
||||
private final KeyValHash ctor_args = KeyValHash.new_(); private final KeyValHash ctor_args_null = KeyValHash.new_();
|
||||
@@ -208,7 +207,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
return rv;
|
||||
}
|
||||
catch (Exception e) {
|
||||
Gfo_usr_dlg_.I.Warn_many("", "", "error while calculating font height; err=~{0}", Err_.Message_gplx_brief(e));
|
||||
Gfo_usr_dlg_.I.Warn_many("", "", "error while calculating font height; err=~{0}", Err_.Message_gplx_full(e));
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
@@ -323,7 +322,7 @@ class Swt_gui_cmd implements GfuiInvkCmd, Runnable {
|
||||
try {target.Invk(invk_ctx, invk_ikey, invk_key, invk_msg);}
|
||||
catch (Exception e) {
|
||||
if (kit.Kit_mode__term()) return; // NOTE: if shutting down, don't warn; warn will try to write to status.bar, which will fail b/c SWT is shutting down; failures will try to write to status.bar again, causing StackOverflow exception; DATE:2014-05-04
|
||||
usr_dlg.Warn_many("", "", "fatal error while running; key=~{0} err=~{1}", invk_key, Err_.Message_gplx_brief(e));
|
||||
usr_dlg.Warn_many("", "", "fatal error while running; key=~{0} err=~{1}", invk_key, Err_.Message_gplx_full(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,5 +30,5 @@ public abstract class GfxItm_base implements GfxItm {
|
||||
pos = posVal; size = sizeVal;
|
||||
}
|
||||
public static GfxItm_base as_(Object obj) {return obj instanceof GfxItm_base ? (GfxItm_base)obj : null;}
|
||||
public static GfxItm_base cast_(Object obj) {try {return (GfxItm_base)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, GfxItm_base.class, obj);}}
|
||||
public static GfxItm_base cast_(Object obj) {try {return (GfxItm_base)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfxItm_base.class, obj);}}
|
||||
}
|
||||
|
||||
@@ -36,5 +36,5 @@ public class GfxLineItm implements GfxItm {
|
||||
return rv;
|
||||
} GfxLineItm() {}
|
||||
public static GfxLineItm as_(Object obj) {return obj instanceof GfxLineItm ? (GfxLineItm)obj : null;}
|
||||
public static GfxLineItm cast_(Object obj) {try {return (GfxLineItm)obj;} catch(Exception exc) {throw Exc_.new_type_mismatch_w_exc(exc, GfxLineItm.class, obj);}}
|
||||
public static GfxLineItm cast_(Object obj) {try {return (GfxLineItm)obj;} catch(Exception exc) {throw Err_.new_type_mismatch_w_exc(exc, GfxLineItm.class, obj);}}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
import org.junit.*;
|
||||
import gplx.core.consoles.*;
|
||||
import gplx.ios.*;
|
||||
import gplx.security.*;
|
||||
public class ImageAdp_tst {
|
||||
@@ -38,8 +39,8 @@ public class ImageAdp_tst {
|
||||
DateAdp afterModifiedTime = Io_mgr.I.QueryFil(save).ModifiedTime();
|
||||
Tfds.Eq_true(CompareAble_.Is_more(afterModifiedTime, beforeModifiedTime));
|
||||
|
||||
String loadHash = HashAlgo_.Md5.CalcHash(ConsoleDlg_.Null, Io_mgr.I.OpenStreamRead(load));
|
||||
String saveHash = HashAlgo_.Md5.CalcHash(ConsoleDlg_.Null, Io_mgr.I.OpenStreamRead(save));
|
||||
String loadHash = HashAlgo_.Md5.CalcHash(Console_adp_.Noop, Io_mgr.I.OpenStreamRead(load));
|
||||
String saveHash = HashAlgo_.Md5.CalcHash(Console_adp_.Noop, Io_mgr.I.OpenStreamRead(save));
|
||||
Tfds.Eq(loadHash, saveHash);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,34 +20,46 @@ import gplx.*;
|
||||
import org.eclipse.swt.*;
|
||||
import org.eclipse.swt.browser.*; import org.eclipse.swt.custom.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*;
|
||||
public class Swt_app_browser {
|
||||
public static void main(String[] args) {
|
||||
Display display = new Display();
|
||||
Shell shell = new Shell(display);
|
||||
try {
|
||||
System.setProperty("org.eclipse.swt.browser.XULRunnerPath", "E:\\موسوعات\\Xowa\\bin\\windows\\xulrunner");
|
||||
Swt_app_browser_mgr mgr = new Swt_app_browser_mgr(shell);
|
||||
New_btn(shell, 0, "loa&d", new Swt_app_browser_cmd_load(mgr));
|
||||
New_btn(shell, 1, "&free", new Swt_app_browser_cmd_free(mgr));
|
||||
shell.open();
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch()) {
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
mgr.Free();
|
||||
display.dispose();
|
||||
} catch (SWTError e) {
|
||||
Tfds.Write("a");
|
||||
}
|
||||
}
|
||||
private static Button New_btn(Shell shell, int idx, String text, SelectionListener lnr) {
|
||||
Button rv = new Button(shell, SWT.BORDER);
|
||||
rv.setText(text);
|
||||
rv.setBounds(idx * 80, 0, 80, 40);
|
||||
rv.addSelectionListener(lnr);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
new Swt_app_browser().start();
|
||||
}
|
||||
|
||||
public void start()
|
||||
{
|
||||
Display display = new Display();
|
||||
Shell shell = new Shell(display);
|
||||
shell.setLayout(new GridLayout(1, false));
|
||||
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
gridData.widthHint = SWT.DEFAULT;
|
||||
gridData.heightHint = SWT.DEFAULT;
|
||||
shell.setLayoutData(gridData);
|
||||
shell.setText("Firebug Lite for SWT ;)");
|
||||
|
||||
final Browser browser = new Browser(shell, SWT.NONE);
|
||||
GridData gridData2 = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
gridData2.widthHint = SWT.DEFAULT;
|
||||
gridData2.heightHint = SWT.DEFAULT;
|
||||
browser.setLayoutData(gridData2);
|
||||
|
||||
Button button = new Button(shell, SWT.PUSH);
|
||||
button.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
|
||||
button.setText("Install");
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
browser.setUrl("javascript:(function(F,i,r,e,b,u,g,L,I,T,E){if(F.getElementById(b))return;E=F[i+'NS']&&F.documentElement.namespaceURI;E=E?F[i+'NS'](E,'script'):F[i]('script');E[r]('id',b);E[r]('src',I+g+T);E[r](b,u);(F[e]('head')[0]||F[e]('body')[0]).appendChild(E);E=new%20Image;E[r]('src',I+L);})(document,'createElement','setAttribute','getElementsByTagName','FirebugLite','4','firebug-lite.js','releases/lite/latest/skin/xp/sprite.png','https://getfirebug.com/','#startOpened');");
|
||||
}
|
||||
});
|
||||
|
||||
browser.setUrl("http://stackoverflow.com/questions/12003602/eclipse-swt-browser-and-firebug-lite");
|
||||
|
||||
shell.open();
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch())
|
||||
display.sleep();
|
||||
}
|
||||
display.dispose();
|
||||
}
|
||||
}
|
||||
class Swt_app_browser_mgr {
|
||||
private Shell shell; private Browser browser;
|
||||
public Swt_app_browser_mgr(Shell shell) {this.shell = shell;}
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
@@ -61,14 +62,14 @@ class Swt_core_cmds extends GxwCore_base {
|
||||
}
|
||||
@Override public String TipText() {return control.getToolTipText();} @Override public void TipText_set(String v) {control.setToolTipText(v);}
|
||||
@Override public void Controls_add(GxwElem sub) {
|
||||
if (!compositeAble) throw Exc_.new_("cannot add sub to control");
|
||||
if (!compositeAble) throw Err_.new_wo_type("cannot add sub to control");
|
||||
Composite owner_as_composite = (Composite)control;
|
||||
Swt_control sub_as_WxSwt = (Swt_control)sub;
|
||||
Control sub_as_swt = sub_as_WxSwt.Under_control();
|
||||
sub_as_swt.setParent(owner_as_composite);
|
||||
}
|
||||
@Override public void Controls_del(GxwElem sub) {
|
||||
if (!compositeAble) throw Exc_.new_("cannot add sub to control");
|
||||
if (!compositeAble) throw Err_.new_wo_type("cannot add sub to control");
|
||||
Swt_control sub_as_WxSwt = (Swt_control)sub;
|
||||
Control sub_as_swt = sub_as_WxSwt.Under_control();
|
||||
sub_as_swt.dispose(); // SWT_NOTE: no way to officially remove sub from control; can only dispose
|
||||
@@ -123,14 +124,14 @@ class Swt_core_cmds_dual extends GxwCore_base {
|
||||
}
|
||||
@Override public String TipText() {return inner.getToolTipText();} @Override public void TipText_set(String v) {inner.setToolTipText(v);}
|
||||
@Override public void Controls_add(GxwElem sub) {
|
||||
if (!outer_is_composite) throw Exc_.new_("cannot add sub to outer");
|
||||
if (!outer_is_composite) throw Err_.new_wo_type("cannot add sub to outer");
|
||||
Composite owner_as_composite = (Composite)outer;
|
||||
Swt_control sub_as_WxSwt = (Swt_control)sub;
|
||||
Control sub_as_swt = sub_as_WxSwt.Under_control();
|
||||
sub_as_swt.setParent(owner_as_composite);
|
||||
}
|
||||
@Override public void Controls_del(GxwElem sub) {
|
||||
if (!outer_is_composite) throw Exc_.new_("cannot add sub to outer");
|
||||
if (!outer_is_composite) throw Err_.new_wo_type("cannot add sub to outer");
|
||||
Swt_control sub_as_WxSwt = (Swt_control)sub;
|
||||
Control sub_as_swt = sub_as_WxSwt.Under_control();
|
||||
sub_as_swt.dispose(); // SWT_NOTE: no way to officially remove sub from outer; can only dispose
|
||||
@@ -220,7 +221,7 @@ class Swt_core_cmds_frames extends GxwCore_base {
|
||||
prv_font = v;
|
||||
}
|
||||
@Override public String TipText() {return inner.getToolTipText();} @Override public void TipText_set(String v) {inner.setToolTipText(v);}
|
||||
@Override public void Controls_add(GxwElem sub) {throw Exc_.new_unimplemented();}
|
||||
@Override public void Controls_add(GxwElem sub) {throw Err_.new_unimplemented();}
|
||||
@Override public void Controls_del(GxwElem sub) {}
|
||||
@Override public boolean Focus_has() {return inner.isFocusControl();}
|
||||
@Override public boolean Focus_able() {return focus_able;} boolean focus_able;
|
||||
|
||||
@@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.gfui;
|
||||
import gplx.Byte_ascii;
|
||||
import gplx.Enm_;
|
||||
import gplx.Err_;
|
||||
import gplx.GfoEvMgr_;
|
||||
import gplx.GfoInvkAble_;
|
||||
import gplx.GfoMsg_;
|
||||
|
||||
@@ -68,7 +68,7 @@ class Swt_dlg_msg implements Gfui_dlg_msg, Runnable {
|
||||
case Gfui_dlg_msg_.Ico_question: return SWT.ICON_QUESTION;
|
||||
case Gfui_dlg_msg_.Ico_warning: return SWT.ICON_WARNING;
|
||||
case Gfui_dlg_msg_.Ico_working: return SWT.ICON_WORKING;
|
||||
default: throw Exc_.new_unhandled(v);
|
||||
default: throw Err_.new_unhandled(v);
|
||||
}
|
||||
}
|
||||
int Xto_swt_btn(int v) {
|
||||
@@ -79,7 +79,7 @@ class Swt_dlg_msg implements Gfui_dlg_msg, Runnable {
|
||||
case Gfui_dlg_msg_.Btn_ignore: return SWT.IGNORE;
|
||||
case Gfui_dlg_msg_.Btn_abort: return SWT.ABORT;
|
||||
case Gfui_dlg_msg_.Btn_cancel: return SWT.CANCEL;
|
||||
default: throw Exc_.new_unhandled(v);
|
||||
default: throw Err_.new_unhandled(v);
|
||||
}
|
||||
}
|
||||
int Xto_gfui_btn(int v) {
|
||||
@@ -90,7 +90,7 @@ class Swt_dlg_msg implements Gfui_dlg_msg, Runnable {
|
||||
case SWT.IGNORE: return Gfui_dlg_msg_.Btn_ignore;
|
||||
case SWT.ABORT: return Gfui_dlg_msg_.Btn_abort;
|
||||
case SWT.CANCEL: return Gfui_dlg_msg_.Btn_cancel;
|
||||
default: throw Exc_.new_unhandled(v);
|
||||
default: throw Err_.new_unhandled(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import gplx.core.threads.Thread_adp_;
|
||||
|
||||
import java.security.acl.Owner;
|
||||
import gplx.*;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.browser.*;
|
||||
import org.eclipse.swt.events.*;
|
||||
@@ -160,7 +161,7 @@ class Swt_html_lnr_title implements TitleListener {
|
||||
public Swt_html_lnr_title(Swt_html html_box) {this.html_box = html_box;}
|
||||
@Override public void changed(TitleEvent ev) {
|
||||
try {UsrDlg_._.Note(ev.title);}
|
||||
catch (Exception e) {html_box.Kit().Ask_ok("xowa.swt.html_box", "title.fail", Err_.Message_gplx_brief(e));} // NOTE: must catch error or will cause app to lock; currently called inside displaySync
|
||||
catch (Exception e) {html_box.Kit().Ask_ok("xowa.swt.html_box", "title.fail", Err_.Message_gplx_full(e));} // NOTE: must catch error or will cause app to lock; currently called inside displaySync
|
||||
}
|
||||
}
|
||||
class Swt_html_func extends BrowserFunction {
|
||||
@@ -174,7 +175,7 @@ class Swt_html_func extends BrowserFunction {
|
||||
return gplx.gfui.Gfui_html.Js_args_exec(invk, args);
|
||||
}
|
||||
catch (Exception e) {
|
||||
return Err_.Message_gplx_brief(e);
|
||||
return Err_.Message_gplx_full(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,7 +188,7 @@ class Swt_html_lnr_status implements StatusTextListener {
|
||||
String ev_text = ev.text;
|
||||
// if (String_.Has(ev_text, "Loading [MathJax]")) return; // suppress MathJax messages; // NOTE: disabled for 2.1 (which no longer outputs messages to status); DATE:2013-05-03
|
||||
try {if (host != null) GfoEvMgr_.PubObj(host, Gfui_html.Evt_link_hover, "v", ev_text);}
|
||||
catch (Exception e) {html_box.Kit().Ask_ok("xowa.gui.html_box", "status.fail", Err_.Message_gplx_brief(e));} // NOTE: must catch error or will cause app to lock; currently called inside displaySync
|
||||
catch (Exception e) {html_box.Kit().Ask_ok("xowa.gui.html_box", "status.fail", Err_.Message_gplx_full(e));} // NOTE: must catch error or will cause app to lock; currently called inside displaySync
|
||||
}
|
||||
}
|
||||
class Swt_html_lnr_progress implements ProgressListener {
|
||||
@@ -218,7 +219,7 @@ class Swt_html_lnr_location implements LocationListener {
|
||||
GfoEvMgr_.PubObj(host, evt, "v", location);
|
||||
arg.doit = false; // cancel navigation event, else there will be an error when trying to go to invalid location
|
||||
}
|
||||
catch (Exception e) {html_box.Kit().Ask_ok("xowa.gui.html_box", evt, Err_.Message_gplx_brief(e));} // NOTE: must catch error or will cause app to lock; currently called inside displaySync
|
||||
catch (Exception e) {html_box.Kit().Ask_ok("xowa.gui.html_box", evt, Err_.Message_gplx_full(e));} // NOTE: must catch error or will cause app to lock; currently called inside displaySync
|
||||
}
|
||||
}
|
||||
class Swt_html_lnr_mouse implements MouseListener {
|
||||
|
||||
@@ -31,8 +31,8 @@ class Swt_img implements ImageAdp {
|
||||
public Object Under() {return under;} Image under;
|
||||
public boolean Disposed() {return under.isDisposed();}
|
||||
public void Rls() {under.dispose();}
|
||||
public void SaveAsBmp(Io_url url) {throw Exc_.new_unimplemented();}
|
||||
public void SaveAsPng(Io_url url) {throw Exc_.new_unimplemented();}
|
||||
public void SaveAsBmp(Io_url url) {throw Err_.new_unimplemented();}
|
||||
public void SaveAsPng(Io_url url) {throw Err_.new_unimplemented();}
|
||||
public ImageAdp Resize(int trg_w, int trg_h) {return Extract_image(0, 0, width, height, trg_w, trg_h);}
|
||||
public ImageAdp Extract_image(RectAdp src_rect, SizeAdp trg_size) {return Extract_image(src_rect.X(), src_rect.Y(), src_rect.Width(), src_rect.Height(), trg_size.Width(), trg_size.Height());}
|
||||
public ImageAdp Extract_image(int src_x, int src_y, int src_w, int src_h, int trg_w, int trg_h) {
|
||||
|
||||
@@ -141,7 +141,7 @@ class Swt_lnr__menu_detect implements MenuDetectListener {
|
||||
@Override public void menuDetected(MenuDetectEvent arg0) {
|
||||
try {GfoEvMgr_.Pub(elem, GfuiElemKeys.Evt_menu_detected);}
|
||||
catch (Exception e) {
|
||||
kit.Ask_ok("", "", "error during right-click; err=~{0}", Err_.Message_gplx(e));
|
||||
kit.Ask_ok("", "", "error during right-click; err=~{0}", Err_.Message_gplx_full(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ class Swt_popup_itm implements Gfui_mnu_itm {
|
||||
case SWT.CASCADE: this.tid = Gfui_mnu_itm_.Tid_grp; break;
|
||||
case SWT.CHECK: this.tid = Gfui_mnu_itm_.Tid_chk; break;
|
||||
case SWT.RADIO: this.tid = Gfui_mnu_itm_.Tid_rdo; break;
|
||||
default: throw Exc_.new_unhandled(swt_type);
|
||||
default: throw Err_.new_unhandled(swt_type);
|
||||
}
|
||||
}
|
||||
@Override public int Tid() {return tid;} private int tid;
|
||||
@@ -192,7 +192,7 @@ class Swt_lnr__menu_btn_cmd implements Listener {
|
||||
public Swt_lnr__menu_btn_cmd(GfoInvkAble invk, String cmd) {this.invk = invk; this.cmd = cmd;} GfoInvkAble invk; String cmd;
|
||||
public void handleEvent(Event ev) {
|
||||
try {GfoInvkAble_.InvkCmd(invk, cmd);}
|
||||
catch (Exception e) {Swt_kit._.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", cmd, Err_.Message_gplx_brief(e));}
|
||||
catch (Exception e) {Swt_kit._.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", cmd, Err_.Message_gplx_full(e));}
|
||||
}
|
||||
}
|
||||
class Swt_lnr__menu_btn_msg implements Listener {
|
||||
@@ -203,7 +203,7 @@ class Swt_lnr__menu_btn_msg implements Listener {
|
||||
msg.Args_reset();
|
||||
root_wkr.Run_str_for(invk, msg);
|
||||
}
|
||||
catch (Exception e) {Swt_kit._.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", msg.Key(), Err_.Message_gplx_brief(e));}
|
||||
catch (Exception e) {Swt_kit._.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", msg.Key(), Err_.Message_gplx_full(e));}
|
||||
}
|
||||
}
|
||||
class Swt_lnr__menu_chk_msg implements Listener {
|
||||
@@ -219,6 +219,6 @@ class Swt_lnr__menu_chk_msg implements Listener {
|
||||
msg.Args_reset();
|
||||
root_wkr.Run_str_for(invk, msg);
|
||||
}
|
||||
catch (Exception e) {Swt_kit._.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", msg.Key(), Err_.Message_gplx_brief(e));}
|
||||
catch (Exception e) {Swt_kit._.Ask_ok("", "", "error while invoking command: cmd=~{0} err=~{1}", msg.Key(), Err_.Message_gplx_full(e));}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Swt_tab_itm implements Gxw_tab_itm, Swt_control, FocusListener {
|
||||
public Swt_kit Kit() {return kit;} private Swt_kit kit;
|
||||
@Override public Control Under_control() {return null;}
|
||||
@Override public Composite Under_composite() {return null;}
|
||||
@Override public Control Under_menu_control() {throw Exc_.new_unimplemented();}
|
||||
@Override public Control Under_menu_control() {throw Err_.new_unimplemented();}
|
||||
@Override public String Tab_name() {return tab_itm.getText();} @Override public void Tab_name_(String v) {tab_itm.setText(v);}
|
||||
@Override public String Tab_tip_text() {return tab_itm.getToolTipText();} @Override public void Tab_tip_text_(String v) {tab_itm.setToolTipText(v);}
|
||||
public void Subs_add(GfuiElem sub) {
|
||||
|
||||
Reference in New Issue
Block a user