| | |
| | | import java.awt.GridBagLayout; |
| | | import java.awt.event.ActionEvent; |
| | | import java.awt.event.ActionListener; |
| | | import java.awt.event.FocusEvent; |
| | | import java.awt.event.FocusListener; |
| | | |
| | | import javax.swing.*; |
| | | import javax.swing.event.HyperlinkEvent; |
| | |
| | | |
| | | private String lastText; |
| | | |
| | | private Component lastFocusComponent; |
| | | |
| | | /** |
| | | * ProgressPanel constructor. |
| | | * @param application Application this panel represents |
| | |
| | | getMsg("progressbar-initial-label"), UIFactory.PROGRESS_FONT); |
| | | progressBarLabel.setOpaque(false); |
| | | progressBarLabel.setEditable(false); |
| | | progressBarLabel.setFocusable(false); |
| | | progressBarLabel.setFocusCycleRoot(false); |
| | | CustomHTMLEditorKit htmlEditor = new CustomHTMLEditorKit(); |
| | | htmlEditor.addActionListener(new ActionListener() |
| | | { |
| | |
| | | gbc.weighty = 1.0; |
| | | panel.add(scroll, gbc); |
| | | |
| | | addFocusListeners(); |
| | | |
| | | return panel; |
| | | } |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void endDisplay() |
| | | { |
| | | if (lastFocusComponent != null) |
| | | { |
| | | lastFocusComponent.requestFocusInWindow(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void displayProgress(ProgressDescriptor descriptor) |
| | | { |
| | | ProgressStep status = descriptor.getProgressStep(); |
| | |
| | | |
| | | if (status.isLast()) { |
| | | progressBar.setVisible(false); |
| | | progressBarLabel.setFocusable(true); |
| | | btnCancel.setVisible(false); |
| | | if (!status.isError()) { |
| | | summaryText = "<form>"+summaryText+"</form>"; |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /** |
| | | * Adds the required focus listeners to the fields. |
| | | */ |
| | | private void addFocusListeners() |
| | | { |
| | | final FocusListener l = new FocusListener() |
| | | { |
| | | public void focusGained(FocusEvent e) |
| | | { |
| | | lastFocusComponent = e.getComponent(); |
| | | } |
| | | |
| | | public void focusLost(FocusEvent e) |
| | | { |
| | | } |
| | | }; |
| | | |
| | | JComponent[] comps = |
| | | { |
| | | progressBarLabel, |
| | | progressBar, |
| | | btnCancel, |
| | | detailsTextArea |
| | | }; |
| | | for (int i = 0; i < comps.length; i++) |
| | | { |
| | | comps[i].addFocusListener(l); |
| | | } |
| | | |
| | | lastFocusComponent = detailsTextArea; |
| | | } |
| | | |
| | | // public static void main(String[] args) { |
| | | // final UserData ud = new UpgradeUserData(); |
| | | // ud.setServerLocation("XXX/XXXXX/XX/XXXXXXXXXXXX/XXXX"); |