package applet;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Color;
import java.awt.FlowLayout;
import javax.swing.Action;
import javax.swing.JApplet;
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.InsetsUIResource;
import de.FeatureModellingTool.AboutAction;
import de.FeatureModellingTool.FeatureModellingJPanel;
import de.FeatureModellingTool.ProjectManagerContextChangeListener;
import de.FeatureModellingTool.ProjectManager.ProjectManager;
public class MainApplet extends JApplet {
public static FeatureModellingJPanel jpanel = null;
private static String WINDOWS = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
// �˵�
private JMenuBar menuBar = null;
private Action newProjectAction = null;
private Action openProjectAction = null;
private Action openProjectFromDBAction = null;
private Action modifyProjectPropertiesAction = null;
private Action newViewAction = null;
private Action removeViewAction = null;
private Action exportViewAction = null;
private Action changeViewNameAction = null;
private Action saveProjectAction = null;
private Action saveProjectToDBAction = null;
private Action saveAsProjectAction = null;
private Action closeProjectAction = null;
protected final Action aboutAction = new AboutAction("����...");
private ProjectManager projectManager = null;
public void init() {
UIManager.put("JXTitledPanel.titleForeground", new ColorUIResource(
Color.BLACK));
UIManager.put("JXTitledPanel.captionInsets", new InsetsUIResource(3, 3,
3, 0));
jpanel = new FeatureModellingJPanel();
setLayout(new BorderLayout());
getContentPane().add(jpanel, BorderLayout.CENTER);
try {
UIManager.setLookAndFeel(WINDOWS);
} catch (Exception e) {
e.printStackTrace();
}
// ///////
projectManager = de.FeatureModellingTool.ProjectManager.Manager
.createProjectManager();
projectManager.getContext().addContextChangeListener(new ProjectManagerContextChangeListener());
projectManager.getContext().putValue(de.FeatureModellingTool.ProjectManager.ConstantDefinition.UI_JPANEL, getContentPane());
newProjectAction = projectManager
.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.NEW_PROJECT_ACTION);
openProjectAction = projectManager
.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.OPEN_PROJECT_ACTION);
openProjectFromDBAction = projectManager.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.OPEN_PROJECT_ACTION_FROM_DB);
saveProjectAction = projectManager
.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.SAVE_PROJECT_ACTION);
saveProjectToDBAction = projectManager
.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.SAVE_PROJECT_TODB_ACTION);
saveAsProjectAction = projectManager
.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.SAVE_AS_PROJECT_ACTION);
closeProjectAction = projectManager
.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.CLOSE_PROJECT_ACTION);
modifyProjectPropertiesAction = projectManager
.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.MODIFY_PROJECT_PROPERTIES_ACTION);
newViewAction = projectManager
.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.NEW_VIEW_ACTION);
removeViewAction = projectManager
.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.REMOVE_VIEW_ACTION);
exportViewAction = projectManager
.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.EXPORT_VIEW_ACTION);
changeViewNameAction = projectManager
.getAction(de.FeatureModellingTool.ProjectManager.ConstantDefinition.CHANGE_VIEW_NAME_ACTION);
menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("��Ŀ����");
fileMenu.add(newProjectAction);
fileMenu.add(openProjectAction);
fileMenu.add(openProjectFromDBAction);
fileMenu.add(modifyProjectPropertiesAction);
fileMenu.addSeparator();
fileMenu.add(newViewAction);
fileMenu.add(removeViewAction);
fileMenu.add(exportViewAction);
fileMenu.add(changeViewNameAction);
fileMenu.addSeparator();
fileMenu.add(saveProjectAction);
fileMenu.add(saveProjectToDBAction);
fileMenu.add(saveAsProjectAction);
fileMenu.add(closeProjectAction);
((AboutAction)aboutAction).setParentComponent(this);
JMenu helpMenu = new JMenu("����");
helpMenu.add(aboutAction);
menuBar.add(fileMenu);
menuBar.add(helpMenu);
setJMenuBar(menuBar);
}
public static JPanel getAppletContentPane() {
return jpanel;
}
public void start() {
}
public void stop() {
}
public void destroy() {
}
}