/* */ package NET.worlds.console; /* */ /* */ import java.awt.Button; /* */ import java.awt.Color; /* */ import java.awt.Dimension; /* */ import java.awt.Event; /* */ import java.awt.Frame; /* */ import java.awt.GridBagConstraints; /* */ import java.awt.GridBagLayout; /* */ import java.awt.Label; /* */ import java.awt.Point; /* */ import java.awt.TextField; /* */ import java.awt.Window; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class AttributeSortPanel /* */ extends Frame /* */ implements MainCallback, MainTerminalCallback /* */ { /* */ private static final long serialVersionUID = -7230661745931320369L; /* */ private AttributeList list; /* 35 */ private Button addButton = new Button("Add"); /* 36 */ private Button deleteButton = new Button("Delete"); /* 37 */ private Button moveUpButton = new Button("MoveUp"); /* 38 */ private Button moveDownButton = new Button("MoveDown"); /* 39 */ private Button okButton = new Button("Ok"); /* 40 */ private Button cancelButton = new Button("Cancel"); /* 41 */ private Button clearButton = new Button("Clear"); /* 42 */ private TextField attNameField = new TextField(32); /* 43 */ private Label attNameLabel = new Label("Attribute Name: "); /* */ /* */ public AttributeSortPanel(Window parent) { /* 46 */ super("Attribute Sorting"); /* */ /* 48 */ this.list = new AttributeList(10); /* 49 */ GridBagLayout gbag = new GridBagLayout(); /* 50 */ GridBagConstraints c = new GridBagConstraints(); /* 51 */ setLayout(gbag); /* 52 */ setBackground(Color.gray); /* */ /* 54 */ c.gridx = 1; /* 55 */ c.gridy = 1; /* 56 */ c.gridheight = 7; /* 57 */ c.gridwidth = 3; /* 58 */ c.anchor = 18; /* 59 */ gbag.setConstraints(this.list, c); /* 60 */ add(this.list); /* */ /* 62 */ c.gridx = 4; /* 63 */ c.gridy = 1; /* 64 */ c.gridwidth = 1; /* 65 */ c.gridheight = 1; /* 66 */ gbag.setConstraints(this.moveUpButton, c); /* 67 */ add(this.moveUpButton); /* */ /* 69 */ c.gridx = 4; /* 70 */ c.gridy = 2; /* 71 */ c.gridwidth = 1; /* 72 */ c.gridheight = 1; /* 73 */ gbag.setConstraints(this.moveDownButton, c); /* 74 */ add(this.moveDownButton); /* */ /* 76 */ c.gridx = 4; /* 77 */ c.gridy = 5; /* 78 */ c.gridheight = 1; /* 79 */ c.gridwidth = 3; /* 80 */ gbag.setConstraints(this.attNameLabel, c); /* 81 */ add(this.attNameLabel); /* */ /* 83 */ c.gridy = 6; /* 84 */ c.gridheight = 1; /* 85 */ c.gridwidth = 3; /* 86 */ gbag.setConstraints(this.attNameField, c); /* 87 */ add(this.attNameField); /* */ /* 89 */ c.gridx = 7; /* 90 */ c.gridy = 6; /* 91 */ c.gridheight = 1; /* 92 */ c.gridwidth = 1; /* 93 */ gbag.setConstraints(this.addButton, c); /* 94 */ add(this.addButton); /* */ /* 96 */ c.gridx = 7; /* 97 */ c.gridy = 1; /* 98 */ c.gridwidth = 1; /* 99 */ c.gridheight = 1; /* 100 */ gbag.setConstraints(this.deleteButton, c); /* 101 */ add(this.deleteButton); /* */ /* 103 */ c.gridx = 7; /* 104 */ c.gridy = 2; /* 105 */ gbag.setConstraints(this.clearButton, c); /* 106 */ add(this.clearButton); /* */ /* 108 */ c.gridx = 5; /* 109 */ c.gridy = 8; /* 110 */ gbag.setConstraints(this.okButton, c); /* 111 */ add(this.okButton); /* */ /* 113 */ c.gridx = 7; /* 114 */ gbag.setConstraints(this.cancelButton, c); /* 115 */ add(this.cancelButton); /* */ /* */ /* 118 */ pack(); /* 119 */ Point loc = parent.getLocation(); /* 120 */ Dimension size = parent.getSize(); /* 121 */ setBounds(loc.x + (size.width - 512) / 2, /* 122 */ loc.y + (size.height - 240) / 2, 512, 240); /* */ /* 124 */ setVisible(true); /* */ /* 126 */ Main.register(this); /* */ } /* */ /* */ @Deprecated /* */ public boolean handleEvent(Event ev) /* */ { /* 132 */ switch (ev.id) { /* */ case 201: /* 134 */ dispose(); /* 135 */ return true; /* */ } /* 137 */ return super.handleEvent(ev); /* */ } /* */ /* */ /* */ @Deprecated /* */ public boolean action(Event e, Object o) /* */ { /* 144 */ if (e.target == this.addButton) { /* 145 */ String attToAdd = this.attNameField.getText(); /* 146 */ if (attToAdd != "") /* 147 */ this.list.add(attToAdd); /* 148 */ this.attNameField.setText(""); /* 149 */ return true; } /* 150 */ if (e.target == this.deleteButton) { /* 151 */ this.list.remove(this.list.getSelectedIndex()); /* 152 */ return true; } /* 153 */ if (e.target == this.moveUpButton) { /* 154 */ int index = this.list.getSelectedIndex(); /* 155 */ if (index > 0) { /* 156 */ String toPutBack = this.list.getItem(index - 1); /* 157 */ this.list.remove(index - 1); /* 158 */ this.list.add(toPutBack, index); /* */ } /* 160 */ return true; } /* 161 */ if (e.target == this.moveDownButton) { /* 162 */ int index = this.list.getSelectedIndex(); /* 163 */ if (index < this.list.getItemCount()) { /* 164 */ String toPutBack = this.list.getItem(index + 1); /* 165 */ this.list.remove(index + 1); /* 166 */ this.list.add(toPutBack, index); /* */ } /* 168 */ return true; } /* 169 */ if (e.target == this.cancelButton) { /* 170 */ dispose(); /* 171 */ return true; } /* 172 */ if (e.target == this.clearButton) { /* 173 */ this.list.removeAll(); /* 174 */ return true; } /* 175 */ if (e.target == this.okButton) { /* 176 */ this.list.save(); /* 177 */ dispose(); /* 178 */ return true; /* */ } /* 180 */ return false; /* */ } /* */ /* */ /* */ public void mainCallback() {} /* */ /* */ /* */ public void terminalCallback() /* */ { /* 189 */ Main.unregister(this); /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\AttributeSortPanel.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */