001: package Schmortopf.Main.ProjectDefinition.Panels;
002:
003: import java.awt.*;
004: import java.awt.event.*;
005: import javax.swing.*;
006:
007: import Schmortopf.Main.ProjectDefinition.*;
008: import Schmortopf.Main.IDE_MainFrameProvider;
009: import Schmortopf.Utility.gui.*;
010: import Language.Language;
011:
012: /**
013: * The subdialog for the specific maindefinitions, which
014: * is displayed, when the user clicks the "JVM Application Pathnames" button.
015: */
016: public class SpecificMainDefinitionsDialog extends JDialog {
017:
018: private ProjectDefinition projectDefinition;
019: private ProjectDefinitionDialog projectDefinitionDialog;
020: private IDE_MainFrameProvider mainFrameProvider;
021:
022: public SpecificMainDefinitionsDialog(
023: final ProjectDefinitionDialog _projectDefinitionDialog,
024: final ProjectDefinition projectDefinition,
025: final IDE_MainFrameProvider _mainFrameProvider) {
026: super (_projectDefinitionDialog, true);
027: this .projectDefinition = projectDefinition;
028: this .projectDefinitionDialog = _projectDefinitionDialog;
029: this .mainFrameProvider = _mainFrameProvider;
030:
031: // Put all into a mainPanel with some border space :
032: final JPanel mainPanel = new JPanel(new BorderLayout());
033: int bsp = UIManager.getFont("TextField.font").getSize() / 2;
034: mainPanel.setBorder(BorderFactory.createEmptyBorder(bsp, bsp,
035: bsp, bsp));
036: this .getContentPane().add(mainPanel, BorderLayout.CENTER);
037:
038: this .setTitle(Language.Translate("JVM Specific Definion ")
039: + projectDefinition.getFilePathName());
040:
041: // Add the specific mainDefinitions view :
042: final JPanel specificMainDefinitionPanel = new JPanel();
043: BoxLayout boxLayout = new BoxLayout(
044: specificMainDefinitionPanel, BoxLayout.Y_AXIS);
045: specificMainDefinitionPanel.setLayout(boxLayout);
046: JPanel decoupler1 = new JPanel(new BorderLayout());
047: decoupler1.add(specificMainDefinitionPanel, BorderLayout.NORTH);
048: decoupler1.setBorder(BorderFactory.createEmptyBorder(2, 2, bsp,
049: bsp));
050: mainPanel.add(decoupler1, BorderLayout.CENTER);
051:
052: ProjectDefinitionEntry[] detailedJDKDefinitions = this .projectDefinition
053: .getDetailedJDKDefinitions();
054: for (int i = 0; i < detailedJDKDefinitions.length; i++) {
055: // Use the method of the toplevel class :
056: this .projectDefinitionDialog.addEditableEntryPanel(
057: detailedJDKDefinitions[i],
058: specificMainDefinitionPanel, true);
059: } // for
060:
061: final ImageIcon okIcon = mainFrameProvider
062: .loadImageIcon("pics/menupics/ok.gif");
063: JSenseButton okButton = new JSenseButton(" "
064: + Language.Translate("Save and Close") + " ", okIcon,
065: true, mainFrameProvider);
066: final SpecificMainDefinitionsDialog this Dialog = this ;
067: okButton.addActionListener(new ActionListener() {
068: public void actionPerformed(ActionEvent e) {
069: // Save the projectDefinition first :
070: projectDefinition.saveToIniFile(this Dialog);
071: // Then close it :
072: this Dialog.setVisible(false);
073: // inform the changeListener, cause data of the projectdefinition
074: // could have been changed ... if there is one :
075: if (projectDefinitionDialog.getDataChangeListener() != null) {
076: projectDefinitionDialog.getDataChangeListener()
077: .dataChanged();
078: }
079: }
080: });
081: JPanel buttonPanel = new EFCNSmoothBackgroundPanel(
082: new FlowLayout(),
083: EFCNSmoothBackgroundPanel.PanelBackGroundColorIdentifier,
084: EFCNSmoothBackgroundPanel.SmoothCenterMode);
085: buttonPanel.add(okButton);
086: mainPanel.add(buttonPanel, BorderLayout.SOUTH);
087: this .pack();
088: } // Constructor
089:
090: public void showCentered() {
091: final Dimension size = this .getSize();
092: final Dimension screen = Toolkit.getDefaultToolkit()
093: .getScreenSize();
094: int xp = (screen.width - size.width) / 2;
095: int yp = (screen.height - size.height) / 2;
096: this .setLocation(xp, yp);
097: this .setVisible(true);
098: }
099:
100: } // SpecificMainDefinitionsDialog
|