diff options
| author | abranson <andrew.branson@cern.ch> | 2011-11-23 10:35:53 +0100 |
|---|---|---|
| committer | abranson <andrew.branson@cern.ch> | 2011-11-23 10:35:53 +0100 |
| commit | 63219230f343598b449c817890b730a2f02edc49 (patch) | |
| tree | ccc56f742e9e468b0e3551ca2c40c4a4be8e6772 /source/com/c2kernel/gui | |
| parent | e7b92e1640be005db77804f018e3cdbc2aff90cf (diff) | |
| parent | 349144cc196e85a8ee0383be4646f5932fe63146 (diff) | |
Merge branch 'modules'2.3
Diffstat (limited to 'source/com/c2kernel/gui')
| -rw-r--r-- | source/com/c2kernel/gui/Console.java | 4 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/DynamicTreeBuilder.java | 8 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/EntityDetails.java | 2 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/EntityFinder.java | 8 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/LoginBox.java | 6 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/Main.java | 5 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/MainFrame.java | 6 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/MenuBuilder.java | 22 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/data/Node.java | 6 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/tabs/EntityTabPane.java | 8 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/tabs/WorkflowPane.java | 8 | ||||
| -rw-r--r-- | source/com/c2kernel/gui/tabs/collection/AggregationView.java | 4 |
12 files changed, 50 insertions, 37 deletions
diff --git a/source/com/c2kernel/gui/Console.java b/source/com/c2kernel/gui/Console.java index a16e6f6..3427f82 100644 --- a/source/com/c2kernel/gui/Console.java +++ b/source/com/c2kernel/gui/Console.java @@ -130,7 +130,9 @@ public class Console extends JFrame { getContentPane().add(inputBox);
try {
- Properties utilProps = FileStringUtility.loadConfigFile( Resource.getDomainResourceURL("ScriptUtils.conf").toString());
+ // TODO: merge module script utilities together and prepend with namespace
+ Properties utilProps = FileStringUtility.loadConfigFile( Resource.findTextResource("ScriptUtils.conf") );
+
Box utilBox = Box.createHorizontalBox();
for (Object name2 : utilProps.keySet()) {
String name = (String) name2;
diff --git a/source/com/c2kernel/gui/DynamicTreeBuilder.java b/source/com/c2kernel/gui/DynamicTreeBuilder.java index a72c156..050a76a 100644 --- a/source/com/c2kernel/gui/DynamicTreeBuilder.java +++ b/source/com/c2kernel/gui/DynamicTreeBuilder.java @@ -25,15 +25,15 @@ import com.c2kernel.utils.Resource; public class DynamicTreeBuilder implements NodeSubscriber {
private DefaultTreeModel treeModel;
- private DefaultMutableTreeNode parent;
+ private final DefaultMutableTreeNode parent;
public short state = IDLE;
public static final short IDLE = 0;
public static final short LOADING = 1;
public static final short PARTIAL = 2;
public static final short FINISHED = 3;
- private DefaultMutableTreeNode loading;
- private static ImageIcon loadIcon = Resource.getImageResource("loading.gif");
- private static ImageIcon pauseIcon = Resource.getImageResource("reload.gif");
+ private final DefaultMutableTreeNode loading;
+ private static ImageIcon loadIcon = Resource.findImage("loading.gif");
+ private static ImageIcon pauseIcon = Resource.findImage("reload.gif");
/**
* The newly created DynamicTreeBuilder records its parent node - the one for which it will build child nodes for.
diff --git a/source/com/c2kernel/gui/EntityDetails.java b/source/com/c2kernel/gui/EntityDetails.java index 7cb4f66..0a04536 100644 --- a/source/com/c2kernel/gui/EntityDetails.java +++ b/source/com/c2kernel/gui/EntityDetails.java @@ -134,7 +134,7 @@ public class EntityDetails extends JPanel implements ChangeListener, Runnable { c.anchor = GridBagConstraints.NORTH;
c.ipadx = 5;
c.ipady = 5;
- current = new JLabel(Resource.getImageResource("typeicons/"+myEntity.getIconName()+"_32.png"));
+ current = new JLabel(Resource.findImage("typeicons/"+myEntity.getIconName()+"_32.png"));
gridbag.setConstraints(current, c);
titlePanel.add(current);
// Place Name/ID Label
diff --git a/source/com/c2kernel/gui/EntityFinder.java b/source/com/c2kernel/gui/EntityFinder.java index 18038c9..0d53545 100644 --- a/source/com/c2kernel/gui/EntityFinder.java +++ b/source/com/c2kernel/gui/EntityFinder.java @@ -43,8 +43,8 @@ public class EntityFinder extends Box implements Runnable { static {
try
{
- mNextIcon =Resource.getImageResource("next.png");
- mFindIcon =Resource.getImageResource("find.png");
+ mNextIcon =Resource.findImage("next.png");
+ mFindIcon =Resource.findImage("find.png");
}
catch (Exception e)
{
@@ -187,8 +187,8 @@ public class EntityFinder extends Box implements Runnable { }
private class ListenerButtonListener implements ItemListener {
- private DomainKeyListener listener;
- private JToggleButton listenerButton;
+ private final DomainKeyListener listener;
+ private final JToggleButton listenerButton;
public ListenerButtonListener(DomainKeyListener newListener, JToggleButton listenerButton) {
this.listener = newListener;
diff --git a/source/com/c2kernel/gui/LoginBox.java b/source/com/c2kernel/gui/LoginBox.java index 415469b..aee469f 100644 --- a/source/com/c2kernel/gui/LoginBox.java +++ b/source/com/c2kernel/gui/LoginBox.java @@ -47,8 +47,8 @@ import com.c2kernel.utils.Resource; */
public class LoginBox extends JFrame {
- private int xMov;
- private int yMov;
+ private final int xMov;
+ private final int yMov;
public String errorMessage=new String("");
private int maxNumberLogon;
public boolean action = false;
@@ -72,7 +72,7 @@ public class LoginBox extends JFrame { javax.swing.ImageIcon imageHolder,MainFrame mainFrame) {
String iconFile = Gateway.getProperty("AppIcon");
if (iconFile != null)
- this.setIconImage(Resource.getImageResource(iconFile).getImage());
+ this.setIconImage(Resource.findImage(iconFile).getImage());
this.errorLabel.setText(bottomMessage);
if (errorMessage.compareTo("")!=0) this.errorLabel.setText(errorMessage);
mainFrameFather=mainFrame;
diff --git a/source/com/c2kernel/gui/Main.java b/source/com/c2kernel/gui/Main.java index 5a9209e..7cf54cb 100644 --- a/source/com/c2kernel/gui/Main.java +++ b/source/com/c2kernel/gui/Main.java @@ -1,6 +1,7 @@ package com.c2kernel.gui;
+import com.c2kernel.process.Gateway;
import com.c2kernel.process.StandardClient;
import com.c2kernel.utils.Logger;
@@ -16,7 +17,7 @@ public class Main extends StandardClient {
try
{
- standardSetUp(args);
+ Gateway.init(readC2KArgs(args), false);
Logger.initConsole("GUI");
MainFrame client = new MainFrame();
client.showLogin();
@@ -28,7 +29,7 @@ public class Main extends StandardClient try
{
- standardTearDown();
+ Gateway.close();
}
catch(Exception ex1)
{
diff --git a/source/com/c2kernel/gui/MainFrame.java b/source/com/c2kernel/gui/MainFrame.java index 2e39d0d..d09bc4c 100644 --- a/source/com/c2kernel/gui/MainFrame.java +++ b/source/com/c2kernel/gui/MainFrame.java @@ -108,7 +108,7 @@ public class MainFrame extends javax.swing.JFrame { pictureUrl = new URL(logoURL);
imageHolder = new ImageIcon(pictureUrl);
} catch (java.net.MalformedURLException m) {
- imageHolder = Resource.getImageResource(logoURL);
+ imageHolder = Resource.findImage(logoURL);
}
LoginBox login =
@@ -133,10 +133,10 @@ public class MainFrame extends javax.swing.JFrame { String iconFile = Gateway.getProperty("AppIcon");
if (iconFile != null)
- this.setIconImage(Resource.getImageResource(iconFile).getImage());
+ this.setIconImage(Resource.findImage(iconFile).getImage());
//preload loading image
- Resource.getImageResource("loading.gif");
+ Resource.findImage("loading.gif");
// close listener
addWindowListener(new java.awt.event.WindowAdapter() {
@Override
diff --git a/source/com/c2kernel/gui/MenuBuilder.java b/source/com/c2kernel/gui/MenuBuilder.java index 6d1bfbc..8acfca7 100644 --- a/source/com/c2kernel/gui/MenuBuilder.java +++ b/source/com/c2kernel/gui/MenuBuilder.java @@ -25,6 +25,7 @@ import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener;
import javax.swing.text.html.HTMLEditorKit;
+import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.lookup.DomainPath;
import com.c2kernel.lookup.Path;
import com.c2kernel.persistency.ClusterStorage;
@@ -218,14 +219,23 @@ public class MenuBuilder extends JMenuBar implements ActionListener, ItemListene JLabel title = new JLabel(aboutInfo);
about.add(title);
- about.add(new JLabel("Domain version: "+Resource.getDomainVersion()));
about.add(new JLabel("Kernel version: "+Resource.getKernelVersion()));
+ about.add(new JLabel("Modules loaded: "+Gateway.getModuleManager().getModuleVersions()));
// get license info
+
StringBuffer lictxt = new StringBuffer();
- String domlictxt = Resource.getTextResource("license.html");
- if (domlictxt != null)
- lictxt.append(domlictxt);
- lictxt.append(Resource.getTextResource("textFiles/license.html"));
+ try {
+ lictxt.append(Resource.getTextResource(null, "textFiles/license.html"));
+ } catch (ObjectNotFoundException e) { } // no kernel license found
+ for (String ns : Resource.getModuleBaseURLs().keySet()) {
+ String domlictxt;
+ try {
+ domlictxt = Resource.getTextResource(ns, "license.html");
+ lictxt.append(domlictxt).append("\n");
+ } catch (ObjectNotFoundException e) { }
+
+ }
+
JEditorPane license = new JEditorPane();
license.setEditable(false);
@@ -242,7 +252,7 @@ public class MenuBuilder extends JMenuBar implements ActionListener, ItemListene myPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
JDialog dialog = myPane.createDialog(null, Language.translate("About"));
dialog.setResizable(false);
- Icon icon = Resource.getImageResource(Gateway.getProperty("banner"));
+ Icon icon = Resource.findImage(Gateway.getProperty("banner"));
myPane.setIcon(icon);
dialog.pack();
dialog.setVisible(true);
diff --git a/source/com/c2kernel/gui/data/Node.java b/source/com/c2kernel/gui/data/Node.java index 6556b3a..2f12d6b 100644 --- a/source/com/c2kernel/gui/data/Node.java +++ b/source/com/c2kernel/gui/data/Node.java @@ -37,8 +37,8 @@ public abstract class Node implements Runnable { private boolean loaded = false;
private String iconName;
protected EntityTabManager desktop;
- static ImageIcon folder = Resource.getImageResource("folder.png");
- static ImageIcon emptyLeaf = Resource.getImageResource("leaf.png");
+ static ImageIcon folder = Resource.findImage("folder.png");
+ static ImageIcon emptyLeaf = Resource.findImage("leaf.png");
public Node() {
}
@@ -214,7 +214,7 @@ public abstract class Node implements Runnable { public void setIcon(String icon) {
iconName = icon;
- this.icon = Resource.getImageResource("typeicons/"+icon+"_16.png");
+ this.icon = Resource.findImage("typeicons/"+icon+"_16.png");
}
public JPopupMenu getPopupMenu() {
diff --git a/source/com/c2kernel/gui/tabs/EntityTabPane.java b/source/com/c2kernel/gui/tabs/EntityTabPane.java index 5a374dd..0a8a0cd 100644 --- a/source/com/c2kernel/gui/tabs/EntityTabPane.java +++ b/source/com/c2kernel/gui/tabs/EntityTabPane.java @@ -43,7 +43,7 @@ public class EntityTabPane extends JPanel implements Runnable { protected NodeEntity sourceEntity;
protected String titleText = null;
protected ImageIcon titleIcon = null;
- private String tabName;
+ private final String tabName;
protected GridBagLayout gridbag = new GridBagLayout();
protected GridBagConstraints c = null;
public static Font titleFont = null;
@@ -53,7 +53,7 @@ public class EntityTabPane extends JPanel implements Runnable { protected Box titleBox;
static {
try {
- mReloadIcon = Resource.getImageResource("reload.gif");
+ mReloadIcon = Resource.findImage("reload.gif");
} catch (Exception e) {
Logger.warning("Couldn't load images: " + e);
}
@@ -96,7 +96,7 @@ public class EntityTabPane extends JPanel implements Runnable { if (titleText == null)
titleText = tabName;
if (titleIcon == null)
- titleIcon = Resource.getImageResource("info.png");
+ titleIcon = Resource.findImage("info.png");
JLabel title = new JLabel(titleText, titleIcon, SwingConstants.LEFT);
title.setFont(titleFont);
title.setForeground(headingColor);
@@ -113,7 +113,7 @@ public class EntityTabPane extends JPanel implements Runnable { });
String defaultStartTab = MainFrame.getPref("DefaultStartTab", "Properties");
JToggleButton defaultStart =
- new JToggleButton(Resource.getImageResource("graph/start.png"));
+ new JToggleButton(Resource.findImage("graph/start.png"));
defaultStart.setMargin(new Insets(0, 0, 0, 0));
defaultStart.setToolTipText(
Language.translate("Select this tab to be the default one opened when you double click an item"));
diff --git a/source/com/c2kernel/gui/tabs/WorkflowPane.java b/source/com/c2kernel/gui/tabs/WorkflowPane.java index 6bccd08..e4acd8d 100644 --- a/source/com/c2kernel/gui/tabs/WorkflowPane.java +++ b/source/com/c2kernel/gui/tabs/WorkflowPane.java @@ -41,10 +41,10 @@ public class WorkflowPane extends EntityTabPane implements EntityProxyObserver<W protected Workflow mWorkflow = null;
boolean init = false;
TransitionPanel transPanel;
- protected JButton mLoadButton = new JButton(Resource.getImageResource("graph/load.png"));
- protected JButton mSaveButton = new JButton(Resource.getImageResource("graph/save.png"));
- protected JButton mLayoutButton = new JButton(Resource.getImageResource("graph/autolayout.png"));
- protected JButton mZoomOutButton = new JButton(Resource.getImageResource("graph/zoomout.png"));
+ protected JButton mLoadButton = new JButton(Resource.findImage("graph/load.png"));
+ protected JButton mSaveButton = new JButton(Resource.findImage("graph/save.png"));
+ protected JButton mLayoutButton = new JButton(Resource.findImage("graph/autolayout.png"));
+ protected JButton mZoomOutButton = new JButton(Resource.findImage("graph/zoomout.png"));
protected JButton[] mOtherToolBarButtons;
// Workflow factories
protected EdgeFactory mWfEdgeFactory;
diff --git a/source/com/c2kernel/gui/tabs/collection/AggregationView.java b/source/com/c2kernel/gui/tabs/collection/AggregationView.java index 35cdb11..b6578bb 100644 --- a/source/com/c2kernel/gui/tabs/collection/AggregationView.java +++ b/source/com/c2kernel/gui/tabs/collection/AggregationView.java @@ -25,8 +25,8 @@ import com.c2kernel.utils.Resource; */
public class AggregationView extends CollectionView<AggregationMember>
{
- protected JButton mSaveButton = new JButton(Resource.getImageResource("graph/save.png"));
- protected JButton mHistoryButton = new JButton(Resource.getImageResource("graph/history.png"));
+ protected JButton mSaveButton = new JButton(Resource.findImage("graph/save.png"));
+ protected JButton mHistoryButton = new JButton(Resource.findImage("graph/history.png"));
protected JButton[] mOtherToolBarButtons = { mSaveButton, mHistoryButton };
// Graph editor panel
protected EditorPanel mEditorPanel;
|
