mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.3.4.1'
This commit is contained in:
@@ -17,6 +17,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public interface GxwComboBox extends GxwElem {
|
||||
void DataSource_set(Object... ary);
|
||||
int SelBgn(); void SelBgn_set(int v);
|
||||
int SelLen(); void SelLen_set(int v);
|
||||
void Sel_(int bgn, int end);
|
||||
Object SelectedItm(); void SelectedItm_set(Object v);
|
||||
String[] DataSource_as_str_ary();
|
||||
void DataSource_set(Object... ary);
|
||||
String Text_fallback(); void Text_fallback_(String v);
|
||||
int List_sel_idx(); void List_sel_idx_(int v);
|
||||
boolean List_visible(); void List_visible_(boolean v);
|
||||
void Items__update(String[] ary);
|
||||
void Items__size_to_fit(int count);
|
||||
void Items__visible_rows_(int v);
|
||||
void Items__jump_len_(int v);
|
||||
void Margins_set(int left, int top, int right, int bot);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.awt.event.*;
|
||||
|
||||
import javax.swing.*;
|
||||
public class GxwComboBox_lang extends JComboBox implements GxwComboBox, GxwElem, ActionListener {
|
||||
public String[] DataSource_as_str_ary() {return String_.Ary_empty;}
|
||||
public void DataSource_set(Object... ary) {
|
||||
for (Object o : ary)
|
||||
this.insertItemAt(o, this.getItemCount());
|
||||
@@ -33,9 +34,20 @@ public class GxwComboBox_lang extends JComboBox implements GxwComboBox, GxwElem,
|
||||
obj = cb.getSelectedItem();
|
||||
*/
|
||||
}
|
||||
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 Object SelectedItm() {return this.getEditor().getItem();} public void SelectedItm_set(Object v) {
|
||||
this.getEditor().setItem(v);
|
||||
}
|
||||
@Override public String Text_fallback() {return "";} @Override public void Text_fallback_(String v) {}
|
||||
@Override public int List_sel_idx() {return -1;} @Override public void List_sel_idx_(int v) {}
|
||||
public boolean List_visible() {return false;} public void List_visible_(boolean v) {}
|
||||
public void Items__update(String[] ary) {}
|
||||
public void Items__size_to_fit(int count) {}
|
||||
public void Items__visible_rows_(int v) {}
|
||||
public void Items__jump_len_(int v) {}
|
||||
public void Margins_set(int left, int top, int right, int bot) {}
|
||||
void ctor_() {
|
||||
ctrlMgr = GxwCore_lang.new_(this);
|
||||
this.enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK);
|
||||
|
||||
@@ -19,13 +19,13 @@ package gplx.gfui; import gplx.*;
|
||||
public abstract class GxwElemFactory_base {
|
||||
@gplx.Internal protected abstract GxwElem control_();
|
||||
@gplx.Internal protected abstract GxwWin win_app_();
|
||||
@gplx.Internal protected abstract GxwWin win_tool_(KeyValHash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwWin win_toaster_(KeyValHash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwWin win_tool_(Keyval_hash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwWin win_toaster_(Keyval_hash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwElem lbl_();
|
||||
@gplx.Internal protected abstract GxwTextFld text_fld_();
|
||||
@gplx.Internal protected abstract GxwTextFld text_memo_();
|
||||
@gplx.Internal protected abstract GxwTextHtml text_html_();
|
||||
@gplx.Internal protected abstract GxwCheckListBox checkListBox_(KeyValHash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwCheckListBox checkListBox_(Keyval_hash ctorArgs);
|
||||
@gplx.Internal protected abstract GxwComboBox comboBox_();
|
||||
@gplx.Internal protected abstract GxwListBox listBox_();
|
||||
// @gplx.Internal protected GxwElem spacer_() {return MockControl.new_();}
|
||||
@@ -37,15 +37,15 @@ class GxwElemFactory_ {
|
||||
}
|
||||
class GxwElemFactory_cls_lang extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwElem control_() {return new GxwElem_lang();}
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(KeyValHash ctorArgs) {
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.FetchValOr(GfuiElem_.InitKey_ownerWin, null);
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(Keyval_hash ctorArgs) {
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.Get_val_or(GfuiElem_.InitKey_ownerWin, null);
|
||||
GxwWin ownerElem = ownerForm == null ? null : (GxwWin)ownerForm.UnderElem();
|
||||
return GxwWin_jdialog.new_(ownerElem);
|
||||
// return GxwWin_lang.new_();
|
||||
}
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(KeyValHash ctorArgs) {
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(Keyval_hash ctorArgs) {
|
||||
GfsCtx ctx = GfsCtx.new_(); ctx.Match("", "");
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.FetchValOr(GfuiElem_.InitKey_ownerWin, null);
|
||||
GfuiWin ownerForm = (GfuiWin)ctorArgs.Get_val_or(GfuiElem_.InitKey_ownerWin, null);
|
||||
GxwWin ownerElem = ownerForm == null ? null : (GxwWin)ownerForm.UnderElem();
|
||||
return GxwWin_jwindow.new_(ownerElem);
|
||||
// return GxwWin_lang.new_();
|
||||
@@ -55,20 +55,20 @@ class GxwElemFactory_cls_lang extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwTextFld text_fld_() {return GxwTextBox_lang_.fld_();}
|
||||
@gplx.Internal @Override protected GxwTextFld text_memo_() {return GxwTextBox_lang_.memo_();}
|
||||
@gplx.Internal @Override protected GxwTextHtml text_html_() {return new GxwTextHtml_lang().ctor();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(KeyValHash ctorArgs) {return new GxwCheckListBox_lang();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(Keyval_hash ctorArgs) {return new GxwCheckListBox_lang();}
|
||||
@gplx.Internal @Override protected GxwComboBox comboBox_() {return GxwComboBox_lang.new_();}
|
||||
@gplx.Internal @Override protected GxwListBox listBox_() {return GxwListBox_lang.new_();}
|
||||
}
|
||||
class GxwElemFactory_cls_mock extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwElem control_() {return GxwElem_mock_base.new_();}
|
||||
@gplx.Internal @Override protected GxwWin win_app_() {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(KeyValHash ctorArgs) {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(KeyValHash ctorArgs) {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(Keyval_hash ctorArgs) {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(Keyval_hash ctorArgs) {return MockForm.Instance;}
|
||||
@gplx.Internal @Override protected GxwElem lbl_() {return GxwElem_mock_base.new_();}
|
||||
@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 Err_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(Keyval_hash ctorArgs) {throw Err_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwComboBox comboBox_() {return new MockComboBox();}
|
||||
@gplx.Internal @Override protected GxwListBox listBox_() {return new MockListBox();}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
public class GxwElem_mock_base implements GxwElem {
|
||||
public GxwCore_base Core() {return ctrlMgr;} final GxwCore_mock ctrlMgr = new GxwCore_mock();
|
||||
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;
|
||||
public String TextVal() {return text;} public void TextVal_set(String v) {text = v;} private String text = "";
|
||||
public void SendKeyDown(IptKey key) {}
|
||||
@@ -38,7 +38,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 Keyval_.Ary_empty;}
|
||||
public void Html_enabled(boolean v) {}
|
||||
public String Html_doc_html() {return "";}
|
||||
public void Html_css_set(String s) {}
|
||||
@@ -62,7 +62,19 @@ class MockTextBoxMulti extends MockTextBox implements GxwTextMemo, GxwTextHtml {
|
||||
public void ScrollTillCaretIsVisible() {}
|
||||
}
|
||||
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 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) {}
|
||||
public boolean List_visible() {return false;} public void List_visible_(boolean v) {}
|
||||
public void Items__update(String[] ary) {}
|
||||
public void Items__size_to_fit(int count) {}
|
||||
public void Items__visible_rows_(int v) {}
|
||||
public void Items__jump_len_(int v) {}
|
||||
public void Margins_set(int left, int top, int right, int bot) {}
|
||||
public Object SelectedItm() {return selectedItm;} public void SelectedItm_set(Object v) {this.selectedItm = v;} Object selectedItm;
|
||||
}
|
||||
class MockListBox extends GxwElem_mock_base implements GxwListBox {
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.gfui; import gplx.*;
|
||||
interface GxwTextHtml extends GxwTextMemo {
|
||||
KeyVal[] Html_sel_atrs();
|
||||
Keyval[] Html_sel_atrs();
|
||||
void Html_enabled(boolean v);
|
||||
String Html_doc_html();
|
||||
void Html_css_set(String s);
|
||||
|
||||
@@ -97,7 +97,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) {}
|
||||
@@ -162,9 +162,9 @@ class GxwTextHtml_editor extends JEditorPane implements GxwTextHtml {
|
||||
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();
|
||||
Keyval[] atrs = Html_sel_atrs();
|
||||
for (int i = 0; i < atrs.length; i++) {
|
||||
KeyVal atr = atrs[i];
|
||||
Keyval atr = atrs[i];
|
||||
sb.Add(atr.Key() + "=").Add(atr.Val_to_str_or_null()).Add_char_crlf();
|
||||
}
|
||||
return sb.To_str();
|
||||
@@ -208,15 +208,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_.new_(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 (String_.Eq(this.getContentType(), "text/plain")) return Keyval_.Ary_empty;
|
||||
Element elm = Html_sel_elm(); if (elm == null) return Keyval_.Ary_empty;
|
||||
List_adp sel_atrs_list = List_adp_.new_();
|
||||
Html_sel_atrs(elm.getAttributes(), sel_atrs_list, null, ".");
|
||||
return (KeyVal[])sel_atrs_list.To_ary(KeyVal.class);
|
||||
return (Keyval[])sel_atrs_list.To_ary(Keyval.class);
|
||||
}
|
||||
|
||||
@Override public void processKeyEvent(KeyEvent e) {
|
||||
|
||||
@@ -252,17 +252,17 @@ class GxwElemFactory_swt extends GxwElemFactory_base {
|
||||
@gplx.Internal @Override protected GxwWin win_app_() {
|
||||
return new Swt_win(display);
|
||||
}
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(KeyValHash ctorArgs) {
|
||||
@gplx.Internal @Override protected GxwWin win_tool_(Keyval_hash ctorArgs) {
|
||||
return null;
|
||||
}
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(KeyValHash ctorArgs) {
|
||||
@gplx.Internal @Override protected GxwWin win_toaster_(Keyval_hash ctorArgs) {
|
||||
return null;
|
||||
}
|
||||
@gplx.Internal @Override protected GxwElem lbl_() {return null;}
|
||||
@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 Err_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwCheckListBox checkListBox_(Keyval_hash ctorArgs) {throw Err_.new_unimplemented();}
|
||||
@gplx.Internal @Override protected GxwComboBox comboBox_() {return null;}
|
||||
@gplx.Internal @Override protected GxwListBox listBox_() {return null;}
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ public class Gxw_html_load_tid_ {
|
||||
else if (String_.Eq(s, Key_url)) return Tid_url;
|
||||
else throw Err_.new_unimplemented();
|
||||
}
|
||||
public static KeyVal[] Options__list = KeyVal_.Ary(KeyVal_.new_(Key_mem), KeyVal_.new_(Key_url));
|
||||
public static Keyval[] Options__list = Keyval_.Ary(Keyval_.new_(Key_mem), Keyval_.new_(Key_url));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user