001: /*
002: * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved.
003: *
004: * http://izpack.org/
005: * http://izpack.codehaus.org/
006: *
007: * Copyright 2007 Dennis Reil
008: *
009: * Licensed under the Apache License, Version 2.0 (the "License");
010: * you may not use this file except in compliance with the License.
011: * You may obtain a copy of the License at
012: *
013: * http://www.apache.org/licenses/LICENSE-2.0
014: *
015: * Unless required by applicable law or agreed to in writing, software
016: * distributed under the License is distributed on an "AS IS" BASIS,
017: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018: * See the License for the specific language governing permissions and
019: * limitations under the License.
020: */
021: package com.izforge.izpack.panels;
022:
023: import java.awt.event.ActionEvent;
024: import java.awt.event.ActionListener;
025:
026: import javax.swing.ButtonGroup;
027: import javax.swing.JRadioButton;
028:
029: import com.izforge.izpack.gui.IzPanelLayout;
030: import com.izforge.izpack.gui.LabelFactory;
031: import com.izforge.izpack.installer.InstallData;
032: import com.izforge.izpack.installer.InstallerFrame;
033: import com.izforge.izpack.installer.IzPanel;
034: import com.izforge.izpack.util.Debug;
035:
036: /**
037: * @author Dennis Reil, <Dennis.Reil@reddot.de>
038: * @version $Id: $
039: */
040: public class InstallationTypePanel extends IzPanel implements
041: ActionListener {
042: private JRadioButton normalinstall;
043: private JRadioButton modifyinstall;
044:
045: public InstallationTypePanel(InstallerFrame parent,
046: InstallData idata) {
047: super (parent, idata, new IzPanelLayout());
048: buildGUI();
049: }
050:
051: private void buildGUI() {
052: // We put our components
053:
054: add(LabelFactory.create(parent.langpack
055: .getString("InstallationTypePanel.info"), parent.icons
056: .getImageIcon("history"), LEADING), NEXT_LINE);
057:
058: ButtonGroup group = new ButtonGroup();
059:
060: boolean modifyinstallation = Boolean.valueOf(idata
061: .getVariable(InstallData.MODIFY_INSTALLATION));
062:
063: normalinstall = new JRadioButton(parent.langpack
064: .getString("InstallationTypePanel.normal"),
065: !modifyinstallation);
066: normalinstall.addActionListener(this );
067: group.add(normalinstall);
068: add(normalinstall, NEXT_LINE);
069:
070: modifyinstall = new JRadioButton(parent.langpack
071: .getString("InstallationTypePanel.modify"),
072: modifyinstallation);
073: modifyinstall.addActionListener(this );
074: group.add(modifyinstall);
075: add(modifyinstall, NEXT_LINE);
076:
077: setInitialFocus(normalinstall);
078: getLayoutHelper().completeLayout();
079: }
080:
081: /**
082: *
083: */
084: private static final long serialVersionUID = -8178770882900584122L;
085:
086: /* (non-Javadoc)
087: * @see com.izforge.izpack.installer.IzPanel#panelActivate()
088: */
089: public void panelActivate() {
090: boolean modifyinstallation = Boolean.valueOf(idata
091: .getVariable(InstallData.MODIFY_INSTALLATION));
092: if (modifyinstallation) {
093: modifyinstall.setSelected(true);
094: } else {
095: normalinstall.setSelected(true);
096: }
097: }
098:
099: public void actionPerformed(ActionEvent e) {
100: Debug.trace("installation type changed");
101: if (e.getSource() == normalinstall) {
102: Debug.trace("normal installation");
103: idata.setVariable(InstallData.MODIFY_INSTALLATION, "false");
104: } else {
105: Debug.trace("modification installation");
106: idata.setVariable(InstallData.MODIFY_INSTALLATION, "true");
107: }
108: /*
109: if (normalinstall.isSelected()) {
110:
111: }
112: else {
113: } */
114:
115: }
116: }
|