BCI Interface - CustomWizard
Description
In BBj 13.0 and higher, the interface com.basis.install.CustomWizard provides the ability to add a BCI custom wizard.
Syntax
Return Value |
Method |
void |
create(CustomWizardData p_customWizardData) |
void |
run() |
Example
custominstall.xml
<?xml version="1.0" encoding="UTF-8"?> <Suites> <Suite name="ChileCo"> <CustomAction name="com.chileco.install.ChileCoStartInstallCustomAction" occurs="startinstall"/> </Suite> </Suites> |
ChileCoStartInstallCustomAction.java
/* * ChileCoInstallerStartCustomAction.java * * Created on October 28, 2011, 11:24 AM */ package com.chileco.install; import com.basis.install.StartInstallCustomAction; import com.basis.install.StartInstallCustomActionData; import com.basis.install.CustomWizard; public class ChileCoStartInstallCustomAction implements StartInstallCustomAction { /* Creates a new instance of ChileCoStartInstallCustomAction */ public ChileCoStartInstallCustomAction() { }
/* Method called when action is to be run */ public void execute(StartInstallCustomActionData p_startInstallCustomActionData) { ChileCoWizard chilecoWizard = new ChileCoWizard(); p_startInstallCustomActionData.addCustomWizard(0,chilecoWizard); }
} |
ChileCoWizard.java
/* * ChileCoWizard.java * * Created on October 28, 2011, 11:24 AM */ package com.chileco.install; import com.basis.install.CustomWizard; import com.basis.install.CustomWizardData; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ChileCoWizard implements CustomWizard, ActionListener { private CustomWizardData m_customWizardData; private JFrame m_licenseWindow; private JButton m_nextButton; private JButton m_exitButton;
/* Creates a new instance of ChileCoWizard */ public ChileCoWizard() { } /* Method called when wizard is to be created */ public void create(CustomWizardData p_customWizardData) { m_customWizardData = p_customWizardData; if (p_customWizardData.isGUI()) { // create the license window m_licenseWindow = new JFrame("Chile Co");
// set the font m_licenseWindow.setFont(p_customWizardData.getFont());
/* get the content pane */ Container contentPane = m_licenseWindow.getContentPane(); contentPane.setLayout(new BorderLayout()); /* get the backgound panel */ JPanel backgroundPanel = p_customWizardData.getWizardBackgroundPanel(); backgroundPanel.setLayout(new BorderLayout()); /* create the control panel */ JPanel controlPanel = new JPanel(); controlPanel.setLayout(null); controlPanel.setOpaque(false);
// create the necessary controls */ JLabel licAgreement = new JLabel("This is ChileCo License Agreeement..."); licAgreement.setBounds(10,100,300,25); controlPanel.add(licAgreement);
/* add the control panel */ backgroundPanel.add(controlPanel, BorderLayout.CENTER); /* create the button control panel */ JPanel buttonControlPanel = new JPanel(); buttonControlPanel.setOpaque(false); buttonControlPanel.setLayout(new BorderLayout()); /* create the button panel */ JPanel buttonPanel = new JPanel(); buttonPanel.setOpaque(false); /* create necessary buttons */ m_exitButton = new JButton("Exit"); m_exitButton.addActionListener(this); buttonPanel.add(m_exitButton); m_nextButton = new JButton("Next >"); m_nextButton.addActionListener(this); buttonPanel.add(m_nextButton); /* add the button panel to the button control panel */ buttonControlPanel.add(buttonPanel,BorderLayout.EAST); /* add the control button panel to the background panel */ backgroundPanel.add(buttonControlPanel, BorderLayout.SOUTH); /* add the background panel to the main content pane */ contentPane.add(backgroundPanel, BorderLayout.CENTER); } }
/* Method called when wizard is to be run */ public void run() { if (m_licenseWindow != null) { // Set window placement and dimensions m_licenseWindow.setBounds(m_customWizardData.getX(), m_customWizardData.getY(), m_customWizardData.getWidth(), m_customWizardData.getHeight()); // Show the dialog m_licenseWindow.setVisible(true); } }
private WindowListener closeWindow = new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().dispose(); m_customWizardData.exit(); } };
public void actionPerformed(java.awt.event.ActionEvent e) { if (e.getSource() == m_nextButton) { m_licenseWindow.setVisible(false); m_customWizardData.next(); } else if (e.getSource() == m_exitButton) { m_licenseWindow.dispose(); m_customWizardData.exit(); }
} } |