summaryrefslogtreecommitdiff
path: root/NET/worlds/console/ActionDialog.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/console/ActionDialog.java
downloadworlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz
worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/console/ActionDialog.java')
-rw-r--r--NET/worlds/console/ActionDialog.java327
1 files changed, 327 insertions, 0 deletions
diff --git a/NET/worlds/console/ActionDialog.java b/NET/worlds/console/ActionDialog.java
new file mode 100644
index 0000000..c5f418e
--- /dev/null
+++ b/NET/worlds/console/ActionDialog.java
@@ -0,0 +1,327 @@
+/* */ package NET.worlds.console;
+/* */
+/* */ import NET.worlds.core.IniFile;
+/* */ import NET.worlds.core.ServerTableManager;
+/* */ import java.awt.BorderLayout;
+/* */ import java.awt.Color;
+/* */ import java.awt.Component;
+/* */ import java.awt.Event;
+/* */ import java.awt.GridLayout;
+/* */ import java.awt.Panel;
+/* */ import java.awt.Point;
+/* */ import java.util.Vector;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ class ActionDialog
+/* */ extends PolledDialog
+/* */ implements ImageButtonsCallback
+/* */ {
+/* */ private static final long serialVersionUID = -1190930869038557992L;
+/* 157 */ BorderLayout overall = new BorderLayout();
+/* */
+/* */ ActionDialog(Vector<String> inNames) {
+/* 160 */ super(Console.getFrame(), null, Console.message("Actions"), false);
+/* */
+/* 162 */ String[] hiddenActions = ServerTableManager.instance().getTable(
+/* 163 */ "hiddenActions");
+/* */
+/* 165 */ String[] actionAliases = ServerTableManager.instance().getTable(
+/* 166 */ "actionAliases");
+/* */
+/* 168 */ if (IniFile.gamma().getIniInt("HideActions", 1) == 0) {
+/* 169 */ hiddenActions = null;
+/* */ }
+/* 171 */ this.names = new Vector();
+/* 172 */ for (int i = 0; i < inNames.size(); i++) {
+/* 173 */ boolean hide = false;
+/* */
+/* 175 */ if (hiddenActions != null) {
+/* 176 */ String inStr = (String)inNames.elementAt(i);
+/* 177 */ inStr = inStr.toLowerCase();
+/* 178 */ for (int j = 0; j < hiddenActions.length; j++) {
+/* 179 */ if (inStr.equals(hiddenActions[j])) {
+/* 180 */ hide = true;
+/* */ }
+/* */ }
+/* */ }
+/* 184 */ if (!hide) {
+/* 185 */ String prettyName = (String)inNames.elementAt(i);
+/* */
+/* 187 */ if (actionAliases != null) {
+/* 188 */ String inStr = prettyName;
+/* 189 */ inStr = inStr.toLowerCase();
+/* 190 */ for (int j = 0; j < actionAliases.length; j += 2) {
+/* 191 */ if (inStr.equals(actionAliases[j])) {
+/* 192 */ prettyName = actionAliases[(j + 1)];
+/* */ }
+/* */ }
+/* */ }
+/* 196 */ this.names.addElement(upperFirst(prettyName));
+/* */ }
+/* */ }
+/* */
+/* 200 */ setResizable(false);
+/* 201 */ setAlignment(2);
+/* 202 */ setLayout(this.overall);
+/* */
+/* 204 */ ready();
+/* */ }
+/* */
+/* */
+/* 208 */ static Point lastWindowLocation = null;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ protected boolean done(boolean confirmed)
+/* */ {
+/* 216 */ ActionsPart.showDialog = false;
+/* 217 */ lastWindowLocation = getLocation();
+/* 218 */ return super.done(confirmed);
+/* */ }
+/* */
+/* */
+/* */ private static String upperFirst(String text)
+/* */ {
+/* 224 */ String ret = text.substring(0, 1).toUpperCase();
+/* 225 */ if (text.length() > 1) {
+/* 226 */ ret = ret + text.substring(1);
+/* */ }
+/* */
+/* 229 */ ret = ret.replace('_', ' ');
+/* */
+/* 231 */ return ret;
+/* */ }
+/* */
+/* */
+/* 235 */ private Vector<TextImageButtons> hunks = new Vector();
+/* */
+/* 237 */ private Vector<String> names = new Vector();
+/* */
+/* */ private static final int buttonsPerHunk = 1;
+/* */
+/* */ private static final int buttonWidth = 72;
+/* */
+/* 243 */ private static final int[] buttonHeights = { 16 };
+/* */
+/* 245 */ private static final int[] xText = { 22 };
+/* */
+/* 247 */ private static final String topImageName = IniFile.override().getIniString(
+/* 248 */ "actionsTopGif", Console.message("actt.gif"));
+/* 249 */ private static final String buttonImageName = IniFile.override()
+/* 250 */ .getIniString("actionsButtonGif", "actm.gif");
+/* 251 */ private static final String bottomImageName = IniFile.override()
+/* 252 */ .getIniString("actionsBottomGif", "actb.gif");
+/* */
+/* */ public synchronized Object imageButtonsCallback(Component who, int which) {
+/* 255 */ int whichHunk = this.hunks.indexOf(who);
+/* 256 */ if (whichHunk == -1) {
+/* 257 */ return null;
+/* */ }
+/* 259 */ Console.wake();
+/* 260 */ ActionsPart.actionToPerform = whichHunk * 1 + which;
+/* 261 */ return null;
+/* */ }
+/* */
+/* */ protected void build()
+/* */ {
+/* 266 */ int numHunks = (this.names.size() + 1 - 1) / 1;
+/* 267 */ int numRows = (numHunks + 1) / 2;
+/* 268 */ numHunks = numRows * 2;
+/* */
+/* 270 */ Panel hunky = new Panel(new GridLayout(numRows, 2));
+/* 271 */ hunky.setBackground(Color.black);
+/* */
+/* 273 */ int nextNameIndex = 0;
+/* 274 */ for (int i = 0; i < numHunks; i++)
+/* */ {
+/* 276 */ String[] strings = new String[1];
+/* 277 */ for (int s = 0; s < 1; nextNameIndex++) {
+/* 278 */ if (nextNameIndex < this.names.size()) {
+/* 279 */ strings[s] = ((String)this.names.elementAt(nextNameIndex));
+/* */ }
+/* 277 */ s++;
+/* */ }
+/* */
+/* */
+/* 281 */ TextImageButtons hunk = new TextImageButtons(buttonImageName,
+/* 282 */ 72, buttonHeights, xText, strings, this);
+/* */
+/* 284 */ this.hunks.addElement(hunk);
+/* 285 */ hunky.add(hunk);
+/* */ }
+/* */
+/* 288 */ add("North", new ImageCanvas(topImageName));
+/* 289 */ add("Center", hunky);
+/* 290 */ add("South", new ImageCanvas(bottomImageName));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ protected void initialSize(int width, int height)
+/* */ {
+/* 299 */ if (lastWindowLocation == null) {
+/* 300 */ super.initialSize(width, height);
+/* */ } else {
+/* 302 */ setLocation(lastWindowLocation);
+/* 303 */ setSize(width, height);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ @Deprecated
+/* */ public boolean handleEvent(Event event)
+/* */ {
+/* 311 */ if (event.id == 1004) {
+/* 312 */ Console.getFrame().requestFocus();
+/* 313 */ return true;
+/* */ }
+/* 315 */ return super.handleEvent(event);
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\ActionDialog.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file