diff options
Diffstat (limited to 'NET/worlds/console/BookmarkListDialog.java')
| -rw-r--r-- | NET/worlds/console/BookmarkListDialog.java | 989 |
1 files changed, 989 insertions, 0 deletions
diff --git a/NET/worlds/console/BookmarkListDialog.java b/NET/worlds/console/BookmarkListDialog.java new file mode 100644 index 0000000..ee26a15 --- /dev/null +++ b/NET/worlds/console/BookmarkListDialog.java @@ -0,0 +1,989 @@ +/* */ package NET.worlds.console; +/* */ +/* */ import java.awt.Button; +/* */ import java.awt.Event; +/* */ import java.awt.Font; +/* */ import java.awt.GridBagConstraints; +/* */ import java.awt.GridBagLayout; +/* */ import java.awt.List; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ class BookmarkListDialog +/* */ extends PolledDialog +/* */ implements DialogReceiver +/* */ { +/* */ private static final long serialVersionUID = 2134767291802432777L; +/* 804 */ private List listbox = new List(10); +/* 805 */ private Button editButton = new Button(Console.message("Edit")); +/* 806 */ private Button addButton = new Button(Console.message("Add")); +/* 807 */ private Button copyButton = new Button(Console.message("Copy")); +/* 808 */ private Button delButton = new Button(Console.message("Delete")); +/* 809 */ private Button okButton = new Button(Console.message("Go-To")); +/* 810 */ private Button cancelButton = new Button(Console.message("Done")); +/* */ private WorldsMarkPart bookmarks; +/* 812 */ private static Font font = new Font(Console.message("MenuFont"), +/* 813 */ 0, 12); +/* 814 */ private static Font bfont = new Font(Console.message("ButtonFont"), +/* 815 */ 0, 12); +/* */ +/* */ BookmarkListDialog(WorldsMarkPart bookmarks) +/* */ { +/* 819 */ super(Console.getFrame(), null, Console.message("Edit-WorldsMarkL"), true); +/* 820 */ this.bookmarks = bookmarks; +/* 821 */ ready(); +/* */ } +/* */ +/* */ protected void build() +/* */ { +/* 826 */ int count = WorldsMarkPart.getBookmarkCount(); +/* 827 */ for (int i = 0; i < count; i++) { +/* 828 */ this.listbox.add(WorldsMarkPart.getBookmarkName(i)); +/* */ } +/* 830 */ GridBagLayout gbag = new GridBagLayout(); +/* 831 */ setLayout(gbag); +/* 832 */ GridBagConstraints c = new GridBagConstraints(); +/* 833 */ c.fill = 1; +/* 834 */ c.weightx = 1.0D; +/* 835 */ c.weighty = 1.0D; +/* 836 */ c.gridwidth = 2; +/* 837 */ c.gridheight = 6; +/* 838 */ this.listbox.setFont(font); +/* 839 */ add(gbag, this.listbox, c); +/* 840 */ c.weightx = 0.0D; +/* 841 */ c.weighty = 0.0D; +/* 842 */ c.gridwidth = 0; +/* 843 */ c.gridheight = 1; +/* 844 */ c.fill = 2; +/* 845 */ this.editButton.setFont(bfont); +/* 846 */ this.addButton.setFont(bfont); +/* 847 */ this.delButton.setFont(bfont); +/* 848 */ this.okButton.setFont(bfont); +/* 849 */ this.cancelButton.setFont(bfont); +/* 850 */ add(gbag, this.editButton, c); +/* 851 */ add(gbag, this.addButton, c); +/* */ +/* 853 */ add(gbag, this.copyButton, c); +/* 854 */ add(gbag, this.delButton, c); +/* 855 */ c.weighty = 1.0D; +/* 856 */ c.anchor = 15; +/* 857 */ add(gbag, this.okButton, c); +/* 858 */ c.weighty = 0.0D; +/* 859 */ add(gbag, this.cancelButton, c); +/* */ } +/* */ +/* */ private void select(boolean state) { +/* 863 */ this.editButton.setEnabled(state); +/* 864 */ this.delButton.setEnabled(state); +/* 865 */ this.copyButton.setEnabled(state); +/* 866 */ this.okButton.setEnabled(state); +/* */ } +/* */ +/* */ +/* */ +/* */ public void setVisible(boolean visible) +/* */ { +/* 873 */ super.setVisible(visible); +/* 874 */ if (visible) { +/* 875 */ if (this.listbox.getItemCount() != 0) { +/* 876 */ this.listbox.select(0); +/* 877 */ select(true); +/* */ } else { +/* 879 */ select(false); } +/* 880 */ this.listbox.requestFocus(); +/* */ } +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean handleEvent(Event event) +/* */ { +/* 887 */ if (event.id == 701) { +/* 888 */ select(true); +/* 889 */ } else if (event.id == 702) +/* 890 */ select(false); +/* 891 */ return super.handleEvent(event); +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean action(Event event, Object what) +/* */ { +/* 897 */ Object target = event.target; +/* 898 */ if ((target == this.okButton) || (target == this.listbox)) { +/* 899 */ WorldsMarkPart.gotoBookmark(this.listbox.getSelectedIndex()); +/* 900 */ return done(true); +/* */ } +/* 902 */ if (target == this.cancelButton) +/* 903 */ return done(false); +/* 904 */ if (target == this.delButton) { +/* 905 */ int index = this.listbox.getSelectedIndex(); +/* 906 */ if (index != -1) { +/* 907 */ this.listbox.remove(index); +/* 908 */ this.bookmarks.removeBookmark(index); +/* */ +/* */ +/* 911 */ int count = this.listbox.getItemCount(); +/* 912 */ if (index < count - 1) { +/* 913 */ this.listbox.select(index); +/* 914 */ } else if (count > 0) { +/* 915 */ this.listbox.select(count - 1); +/* */ } else { +/* 917 */ select(false); +/* 918 */ this.listbox.requestFocus(); +/* */ } +/* */ } +/* 921 */ return true; +/* */ } +/* 923 */ if (target == this.copyButton) { +/* 924 */ int index = this.listbox.getSelectedIndex(); +/* 925 */ if (index != -1) +/* 926 */ add(WorldsMarkPart.getBookmarkName(index), +/* 927 */ WorldsMarkPart.getBookmarkTarget(index)); +/* 928 */ return true; +/* */ } +/* 930 */ if (target == this.addButton) { +/* 931 */ new BookmarkAddDialog(this, this); +/* 932 */ return true; +/* */ } +/* 934 */ if (target == this.editButton) { +/* 935 */ int index = this.listbox.getSelectedIndex(); +/* 936 */ new BookmarkEditDialog(this, this, +/* 937 */ WorldsMarkPart.getBookmarkName(index), +/* 938 */ WorldsMarkPart.getBookmarkTarget(index), index); +/* 939 */ return true; +/* */ } +/* 941 */ return false; +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean keyDown(Event event, int key) +/* */ { +/* 947 */ if (key == 27) +/* 948 */ return done(false); +/* 949 */ if (key == 10) { +/* 950 */ WorldsMarkPart.gotoBookmark(this.listbox.getSelectedIndex()); +/* 951 */ return done(true); +/* */ } +/* 953 */ return super.keyDown(event, key); +/* */ } +/* */ +/* */ private void add(String name, String target) { +/* 957 */ this.bookmarks.addBookmark(name, target); +/* 958 */ this.listbox.add(name); +/* 959 */ this.listbox.makeVisible(this.listbox.getItemCount() - 1); +/* 960 */ this.listbox.select(this.listbox.getItemCount() - 1); +/* 961 */ select(true); +/* */ } +/* */ +/* */ public void dialogDone(Object who, boolean confirmed) +/* */ { +/* 966 */ if (confirmed) { +/* 967 */ if ((who instanceof BookmarkAddDialog)) { +/* 968 */ BookmarkAddDialog adder = (BookmarkAddDialog)who; +/* 969 */ BookmarkEditDialog editor = adder.getEditor(); +/* 970 */ add(editor.getName(), editor.getTarget()); +/* 971 */ } else if ((who instanceof BookmarkEditDialog)) { +/* 972 */ BookmarkEditDialog edit = (BookmarkEditDialog)who; +/* 973 */ int index = edit.getIndex(); +/* 974 */ String name = edit.getName(); +/* 975 */ String target = edit.getTarget(); +/* 976 */ this.bookmarks.changeBookmark(index, name, target); +/* 977 */ this.listbox.replaceItem(name, index); +/* 978 */ this.listbox.makeVisible(index); +/* 979 */ this.listbox.select(index); +/* */ } +/* */ } +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\BookmarkListDialog.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |