1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Personal_wiki: Refactor special pages

This commit is contained in:
gnosygnu
2017-02-10 15:19:12 -05:00
parent 0eee0f0207
commit b2781ffc9d
36 changed files with 539 additions and 244 deletions

View File

@@ -0,0 +1,24 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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.kits.core; import gplx.*; import gplx.gfui.*; import gplx.gfui.kits.*;
public interface Gfui_dlg_dir {
Gfui_dlg_dir Init_msg_(String v);
Gfui_dlg_dir Init_text_(String v);
Gfui_dlg_dir Init_dir_(Io_url v);
String Ask();
}

View File

@@ -0,0 +1,27 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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.kits.core; import gplx.*; import gplx.gfui.*; import gplx.gfui.kits.*;
public class Gfui_dlg_dir_ {
public static final Gfui_dlg_dir Noop = new Gfui_dlg_dir__noop();
}
class Gfui_dlg_dir__noop implements Gfui_dlg_dir {
public String Ask() {return "";}
public Gfui_dlg_dir Init_msg_(String v) {return this;}
public Gfui_dlg_dir Init_text_(String v) {return this;}
public Gfui_dlg_dir Init_dir_(Io_url v) {return this;}
}

View File

@@ -220,6 +220,7 @@ public class Swt_kit implements Gfui_kit {
return rv;
}
public Gfui_dlg_file New_dlg_file(byte type, String msg) {return new Swt_dlg_file(type, shell).Init_msg_(msg);}
public Gfui_dlg_dir New_dlg_dir(String msg) {return new Swt_dlg_dir(shell).Init_msg_(msg);}
public Gfui_dlg_msg New_dlg_msg(String msg) {return new Swt_dlg_msg(shell).Init_msg_(msg);}
public ImageAdp New_img_load(Io_url url) {
if (url == Io_url_.Empty) return ImageAdp_.Null;
@@ -264,6 +265,7 @@ public class Swt_kit implements Gfui_kit {
}
}
else if (String_.Eq(k, Invk_ask_file)) return this.New_dlg_file(Gfui_kit_.File_dlg_type_open, m.Args_getAt(0).Val_to_str_or_empty()).Ask();
else if (String_.Eq(k, "ask_dir")) return this.New_dlg_dir(m.Args_getAt(0).Val_to_str_or_empty()).Ask();
else if (String_.Eq(k, Invk_shell_close)) shell.close();
return this;
}

View File

@@ -0,0 +1,31 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
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.kits.swts; import gplx.*; import gplx.gfui.*; import gplx.gfui.kits.*;
import gplx.gfui.kits.core.*;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Shell;
public class Swt_dlg_dir implements Gfui_dlg_dir {
private final DirectoryDialog under;
public Swt_dlg_dir(Shell shell) {
this.under = new DirectoryDialog(shell);
}
public Gfui_dlg_dir Init_text_(String v) {under.setText(v); return this;}
public Gfui_dlg_dir Init_msg_(String v) {under.setMessage(v); return this;}
public Gfui_dlg_dir Init_dir_(Io_url v) {under.setFilterPath(v.Xto_api()); return this;}
public String Ask() {return under.open();}
}