Gridarta Editor
ControlClientAction.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2015 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.action;
21 
22 import java.awt.Frame;
23 import javax.swing.Action;
27 import net.sf.japi.swing.action.ActionMethod;
28 import org.jetbrains.annotations.NotNull;
29 import org.jetbrains.annotations.Nullable;
30 
34 public class ControlClientAction implements EditorAction {
35 
36  @NotNull
38 
39  @NotNull
40  private final Frame parent;
41 
46  @Nullable
48 
52  public ControlClientAction(@NotNull final AppPreferencesModel appPreferencesModel, @NotNull final Frame parent) {
53  this.appPreferencesModel = appPreferencesModel;
54  this.parent = parent;
55  }
56 
61  @ActionMethod
62  public void controlClient() {
63  final ProcessRunner tmpControlClient;
64  if (controlClient == null) {
65  tmpControlClient = new ProcessRunner("controlClient", new String[] { appPreferencesModel.getClient(), });
66  controlClient = tmpControlClient;
67  } else {
68  tmpControlClient = controlClient;
69  tmpControlClient.setCommand(new String[] { appPreferencesModel.getClient(), });
70  }
71  tmpControlClient.showDialog(parent);
72  }
73 
74  @Override
75  public void setAction(@NotNull final Action action, @NotNull final String name) {
76  }
77 
78 }
Graphical User Interface of Gridarta.
void controlClient()
The action method for "controlClient".
Maintains the application preferences state.
void showDialog(@NotNull final Frame parent)
Show a dialog if not already visible.
Base package of all Gridarta classes.
ControlClientAction(@NotNull final AppPreferencesModel appPreferencesModel, @NotNull final Frame parent)
Creates a new instance.
A global editor action.
This package contains the preferences ui modules.
void setCommand(@NotNull final String[] command)
Set the command to be executed by this ProcessRunner.
void setAction(@NotNull final Action action, @NotNull final String name)
Sets the Action instance for this editor action.
ProcessRunner controlClient
The ProcessRunner instance that controls the client.
Class to run an external process.