Adds missing comments, simplifies proxy distinction, moves updating to own class and fixes formatting
This commit is contained in:
@ -2,8 +2,8 @@ package net.knarcraft.minecraftserverlauncher.userinterface;
|
||||
|
||||
import net.knarcraft.minecraftserverlauncher.profile.Profile;
|
||||
import net.knarcraft.minecraftserverlauncher.server.Server;
|
||||
import net.knarcraft.minecraftserverlauncher.server.servertypes.ServerType;
|
||||
import net.knarcraft.minecraftserverlauncher.server.ServerTypeHandler;
|
||||
import net.knarcraft.minecraftserverlauncher.server.servertypes.ServerType;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
import javax.swing.*;
|
||||
@ -14,9 +14,9 @@ import java.awt.event.ActionListener;
|
||||
* Contains all buttons for configuring a server.
|
||||
* Does some visual stuff by itself, but otherwise reads user inputs.
|
||||
*
|
||||
* @author Kristian Knarvik <kristian.knarvik@knett.no>
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
* @author Kristian Knarvik <kristian.knarvik@knett.no>
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class ServerTab implements ActionListener {
|
||||
private final JComboBox<String> serverTypes, serverVersions, maxRam;
|
||||
@ -26,24 +26,6 @@ public class ServerTab implements ActionListener {
|
||||
private final JPanel panel;
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Updates the server tab components according to the received parameters.
|
||||
*
|
||||
* @param path The new path
|
||||
* @param enabled The enabled status of the server
|
||||
* @param typeName The name of the selected server type
|
||||
* @param serverVersion The version of the server
|
||||
* @param maxRam The max usable ram for the server
|
||||
*/
|
||||
public void setData(String path, boolean enabled, String typeName, String serverVersion, String maxRam) throws ConfigurationException {
|
||||
this.directory.setText(path);
|
||||
this.chckbxEnabled.setSelected(enabled);
|
||||
this.serverTypes.setSelectedItem(typeName);
|
||||
this.serverTypes();
|
||||
this.serverVersions.setSelectedItem(serverVersion);
|
||||
this.maxRam.setSelectedItem(maxRam);
|
||||
}
|
||||
|
||||
public ServerTab(String name) throws ConfigurationException {
|
||||
this.name = name;
|
||||
panel = new JPanel();
|
||||
@ -129,6 +111,24 @@ public class ServerTab implements ActionListener {
|
||||
btnBrowse.addActionListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the server tab components according to the received parameters.
|
||||
*
|
||||
* @param path The new path
|
||||
* @param enabled The enabled status of the server
|
||||
* @param typeName The name of the selected server type
|
||||
* @param serverVersion The version of the server
|
||||
* @param maxRam The max usable ram for the server
|
||||
*/
|
||||
public void setData(String path, boolean enabled, String typeName, String serverVersion, String maxRam) throws ConfigurationException {
|
||||
this.directory.setText(path);
|
||||
this.chckbxEnabled.setSelected(enabled);
|
||||
this.serverTypes.setSelectedItem(typeName);
|
||||
this.serverTypes();
|
||||
this.serverVersions.setSelectedItem(serverVersion);
|
||||
this.maxRam.setSelectedItem(maxRam);
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return this.panel;
|
||||
}
|
||||
@ -158,7 +158,7 @@ public class ServerTab implements ActionListener {
|
||||
/**
|
||||
* Gets the selected version from the serverVersion combo
|
||||
*
|
||||
* @return The combo value, or defaults to "Latest" on null
|
||||
* @return The combo value, or defaults to "Latest" on null
|
||||
*/
|
||||
public String getVersion() {
|
||||
Object selected = this.serverVersions.getSelectedItem();
|
||||
@ -172,7 +172,7 @@ public class ServerTab implements ActionListener {
|
||||
/**
|
||||
* Checks if the server is enabled
|
||||
*
|
||||
* @return True if the checkbox is checked. False otherwise.
|
||||
* @return True if the checkbox is checked. False otherwise.
|
||||
*/
|
||||
public boolean enabled() {
|
||||
return this.chckbxEnabled.isSelected();
|
||||
|
Reference in New Issue
Block a user