summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/gui/MainFrame.java
diff options
context:
space:
mode:
Diffstat (limited to 'source/com/c2kernel/gui/MainFrame.java')
-rw-r--r--source/com/c2kernel/gui/MainFrame.java43
1 files changed, 23 insertions, 20 deletions
diff --git a/source/com/c2kernel/gui/MainFrame.java b/source/com/c2kernel/gui/MainFrame.java
index e561f1f..589e0b4 100644
--- a/source/com/c2kernel/gui/MainFrame.java
+++ b/source/com/c2kernel/gui/MainFrame.java
@@ -14,10 +14,10 @@ import java.net.URL;
import java.util.Properties;
import java.util.StringTokenizer;
-import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
@@ -53,15 +53,17 @@ public class MainFrame extends javax.swing.JFrame {
public static boolean isAdmin;
int splitPanePos;
public static final JFileChooser xmlChooser;
-
+
static {
xmlChooser = new JFileChooser();
xmlChooser.addChoosableFileFilter(
new javax.swing.filechooser.FileFilter() {
- public String getDescription() {
+ @Override
+ public String getDescription() {
return "XML Files";
}
- public boolean accept(File f) {
+ @Override
+ public boolean accept(File f) {
if (f.isDirectory() || (f.isFile() && f.getName().endsWith(".xml"))) {
return true;
}
@@ -72,7 +74,7 @@ public class MainFrame extends javax.swing.JFrame {
/** Creates new gui client for Cristal2 */
public MainFrame() {
-
+
// Load gui preferences
try {
FileInputStream prefsfile =
@@ -82,7 +84,7 @@ public class MainFrame extends javax.swing.JFrame {
} catch (IOException e) {
Logger.msg(2, "Creating new preference file");
}
-
+
// set look & feel from pref
try {
String lf = getPref("Style", null);
@@ -92,9 +94,9 @@ public class MainFrame extends javax.swing.JFrame {
SwingUtilities.updateComponentTreeUI(this);
} catch (Exception e) {
e.printStackTrace();
- }
+ }
}
-
+
public void showLogin() {
// Log in
logoURL = Gateway.getProperty("Logo");
@@ -108,7 +110,7 @@ public class MainFrame extends javax.swing.JFrame {
} catch (java.net.MalformedURLException m) {
imageHolder = Resource.getImageResource(logoURL);
}
-
+
LoginBox login =
new LoginBox(
5,
@@ -116,19 +118,19 @@ public class MainFrame extends javax.swing.JFrame {
getPref("lastUser."+Gateway.getCentreId(), null),
bottomMessage,
imageHolder, this);
-
+
login.setVisible(true);
}
-
+
public void mainFrameShow() {
prefs.setProperty("lastUser."+Gateway.getCentreId(), userAgent.getName());
isAdmin = userAgent.getPath().hasRole("Admin");
GridBagLayout gridbag = new GridBagLayout();
getContentPane().setLayout(gridbag);
-
+
this.setTitle(
userAgent.getName()+"@"+Gateway.getProperty("Name") + " - " + Language.translate("Cristal 2"));
-
+
String iconFile = Gateway.getProperty("AppIcon");
if (iconFile != null)
this.setIconImage(Resource.getImageResource(iconFile).getImage());
@@ -137,7 +139,8 @@ public class MainFrame extends javax.swing.JFrame {
Resource.getImageResource("loading.gif");
// close listener
addWindowListener(new java.awt.event.WindowAdapter() {
- public void windowClosing(java.awt.event.WindowEvent evt) {
+ @Override
+ public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm();
}
});
@@ -167,7 +170,7 @@ public class MainFrame extends javax.swing.JFrame {
getContentPane().add(itemFinder);
// register the browser as the key consumer
itemFinder.setDefaultConsumer(treeBrowser);
-
+
c.gridy++;
c.weightx = 1.0;
c.weighty = 1.0;
@@ -266,13 +269,13 @@ public class MainFrame extends javax.swing.JFrame {
getSplitPanel().validate();
}
- public static JComboBox getExecutionPlugins() {
+ public static JComboBox<Executor> getExecutionPlugins() {
JComboBox<Executor> plugins = new JComboBox<Executor>();
// create execution selector
Executor defaultExecutor = new DefaultExecutor();
plugins.addItem(defaultExecutor);
plugins.setSelectedIndex(0);
-
+
// load execution plugins
String pluginList = Gateway.getProperty("Executors");
if (pluginList != null) {
@@ -280,9 +283,9 @@ public class MainFrame extends javax.swing.JFrame {
while (tok.hasMoreTokens()) {
String pluginName = tok.nextToken();
try {
- Class pluginClass = Class.forName(pluginName);
- Executor domainExecutor = (Executor)pluginClass.newInstance();
- plugins.addItem(domainExecutor);
+ Class<?> pluginClass = Class.forName(pluginName);
+ Executor domainExecutor = (Executor)pluginClass.newInstance();
+ plugins.addItem(domainExecutor);
} catch (Exception ex) {
Logger.error("Could not load the executor plugin "+pluginName);
}