/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.console.Console; /* */ import NET.worlds.console.PolledDialog; /* */ import NET.worlds.core.Sort; /* */ import java.awt.Button; /* */ import java.awt.Choice; /* */ import java.awt.Event; /* */ import java.awt.Font; /* */ import java.awt.GridBagConstraints; /* */ import java.awt.GridBagLayout; /* */ import java.awt.Label; /* */ import java.awt.Panel; /* */ import java.util.Enumeration; /* */ import java.util.Hashtable; /* */ import java.util.Vector; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ class EditRoomDialog /* */ extends PolledDialog /* */ { /* */ private static final long serialVersionUID = 1L; /* 793 */ private Choice roomChoice = new Choice(); /* 794 */ private Choice musicChoice = new Choice(); /* 795 */ private Button okButton = new Button(Console.message("OK")); /* 796 */ private Button cancelButton = new Button(Console.message("Cancel")); /* */ /* */ private MusicManagerDialog parent; /* */ private MusicRoom room; /* */ private String startSelect; /* */ private static String lastMusic; /* 802 */ private static Font font = new Font(Console.message("MenuFont"), /* 803 */ 0, 12); /* 804 */ private static Font bfont = new Font(Console.message("ButtonFont"), /* 805 */ 0, 12); /* */ /* */ public EditRoomDialog(MusicManagerDialog parent, MusicRoom room, String startSelect) /* */ { /* 809 */ super(parent, parent, Console.message("Assign-Music"), true); /* 810 */ this.parent = parent; /* 811 */ this.room = room; /* 812 */ this.startSelect = startSelect; /* 813 */ ready(); /* */ } /* */ /* */ protected void build() { /* 817 */ GridBagLayout gbag = new GridBagLayout(); /* 818 */ setLayout(gbag); /* 819 */ GridBagConstraints c = new GridBagConstraints(); /* 820 */ c.fill = 0; /* 821 */ c.anchor = 13; /* 822 */ Label lName = new Label(Console.message("Room-name"), 2); /* 823 */ lName.setFont(font); /* 824 */ add(gbag, lName, c); /* 825 */ c.gridwidth = 0; /* 826 */ c.anchor = 17; /* 827 */ this.roomChoice.setFont(font); /* 828 */ add(gbag, this.roomChoice, c); /* 829 */ c.gridwidth = 1; /* 830 */ c.anchor = 13; /* 831 */ Label lMusic = new Label(Console.message("Music"), 2); /* 832 */ lMusic.setFont(font); /* 833 */ add(gbag, lMusic, c); /* 834 */ c.gridwidth = 0; /* 835 */ c.anchor = 17; /* 836 */ this.musicChoice.setFont(font); /* 837 */ add(gbag, this.musicChoice, c); /* 838 */ c.anchor = 10; /* 839 */ Panel p = new Panel(); /* 840 */ p.setFont(bfont); /* 841 */ p.add(this.okButton); /* 842 */ p.add(this.cancelButton); /* 843 */ add(gbag, p, c); /* */ /* 845 */ this.roomChoice.setFont(font); /* 846 */ this.musicChoice.setFont(font); /* 847 */ if (this.room != null) { /* 848 */ this.roomChoice.add(this.room.getRoomName()); /* */ } /* 850 */ Enumeration e = this.parent.getAllRooms().elements(); /* 851 */ Hashtable roomsWithMusic = this.parent.getManager().getRooms(); /* 852 */ Vector v = new Vector(); /* 853 */ while (e.hasMoreElements()) { /* 854 */ String name = (String)e.nextElement(); /* 855 */ if (!roomsWithMusic.containsKey(name)) /* 856 */ v.addElement(name); /* */ } /* 858 */ Sort.sortInto(this.roomChoice, v); /* */ /* 860 */ Sort.sortInto(this.musicChoice, this.parent.getManager().getMusic()); /* */ /* 862 */ if (this.room != null) { /* 863 */ this.roomChoice.select(this.room.getRoomName()); /* 864 */ this.musicChoice.select(this.room.getMusicName()); /* */ } else { /* 866 */ this.roomChoice.select(this.startSelect); /* 867 */ if (lastMusic != null) /* 868 */ this.musicChoice.select(lastMusic); /* */ } /* */ } /* */ /* */ @Deprecated /* */ public boolean action(Event event, Object what) { /* 874 */ Object target = event.target; /* 875 */ if (target == this.okButton) /* 876 */ return done(true); /* 877 */ if (target == this.cancelButton) /* 878 */ return done(false); /* 879 */ return false; /* */ } /* */ /* */ public boolean isEditor() { /* 883 */ return this.room != null; /* */ } /* */ /* */ public MusicRoom getMusicRoom() { /* 887 */ String roomName = this.roomChoice.getSelectedItem(); /* 888 */ String musicName = this.musicChoice.getSelectedItem(); /* 889 */ lastMusic = musicName; /* 890 */ if (this.room == null) { /* 891 */ return new MusicRoom(roomName, musicName); /* */ } /* 893 */ this.room.setRoomName(roomName); /* 894 */ this.room.setMusicName(musicName); /* 895 */ return this.room; /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\EditRoomDialog.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */