ProgressPanelpublic class ProgressPanel extends JPanel
Fields Summary |
---|
private FlowLabel | flowProgressLabel | private JTextArea | resultTextArea | private ProgressBar | progressBar | private JScrollPane | jscrollpane | private com.sun.enterprise.util.i18n.StringManager | stringManager | private Logger | logger |
Constructors Summary |
---|
public ProgressPanel()Creates a new instance of ProgressPanel
initialize();
|
Methods Summary |
---|
private javax.swing.JPanel | getWizardPanel()
JPanel panel = new JPanel(new GridBagLayout());
FlowLabel flowTopLabel = new FlowLabel();
FlowLabel flowTextAreaLabel = new FlowLabel();
flowProgressLabel = new FlowLabel();
progressBar = new ProgressBar();
resultTextArea = new JTextArea(){
public boolean isFocusTraversable()
{
return false;
}
};
resultTextArea.setEditable(false);
resultTextArea.setLineWrap(true);
jscrollpane = new JScrollPane(resultTextArea, 20, 30);
jscrollpane.setAutoscrolls(true);
resultTextArea.setAutoscrolls(true);
flowTopLabel.setText(stringManager.getString("upgrade.gui.progresspanel.flowContentLabel"));
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 0);
gridBagConstraints.weightx = 1.0;
panel.add(flowTopLabel, gridBagConstraints);
flowTextAreaLabel.setText(stringManager.getString("upgrade.gui.progresspanel.textAreaText"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 10);
gridBagConstraints.weightx = 1.0;
panel.add(flowTextAreaLabel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 10);
gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0;
panel.add(jscrollpane, gridBagConstraints);
flowProgressLabel.setText(stringManager.getString("upgrade.gui.progresspanel.progressLabel"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 3;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 10);
gridBagConstraints.weightx = 1.0;
panel.add(flowProgressLabel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 4;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 10);
gridBagConstraints.weightx = 1.0;
panel.add(progressBar, gridBagConstraints);
return panel;
| private void | initialize()
this.setLayout(new BorderLayout());
HeaderPanel headerPanel = new HeaderPanel(stringManager.getString("upgrade.gui.progresspanel.headerPanel"));
headerPanel.setInsets(new java.awt.Insets(12, 10, 12, 10));
add(headerPanel, "North");
add(getWizardPanel(), "Center");
| public void | updateLog(LogMessageEvent evt)
java.util.logging.LogRecord logRecord = evt.getLogRecord();
if(logRecord != null){
if((logRecord.getLevel().equals(Level.SEVERE)) || (logRecord.getLevel().equals(Level.WARNING))){
//java.awt.Font origFont = this.resultTextArea.getFont();
//java.awt.Font spFont = new java.awt.Font(this.resultTextArea.getFont().getName(), java.awt.Font.BOLD, this.resultTextArea.getFont().getSize());
//this.resultTextArea.setFont(spFont);
this.resultTextArea.append(logRecord.getMessage());
this.resultTextArea.revalidate();
//jscrollpane.getVerticalScrollBar().setValue(jscrollpane.getVerticalScrollBar().getMaximum());
//jscrollpane.getVerticalScrollBar().setVisibleAmount(jscrollpane.getVerticalScrollBar().getMaximum());
//this.resultTextArea.setFont(origFont);
}else{
this.resultTextArea.append(logRecord.getMessage());
}
this.resultTextArea.append("\n");
}else{
this.resultTextArea.append(evt.getMessage());
}
this.resultTextArea.revalidate();
jscrollpane.getVerticalScrollBar().setValue(jscrollpane.getVerticalScrollBar().getMaximum());
jscrollpane.getVerticalScrollBar().setVisibleAmount(jscrollpane.getVerticalScrollBar().getMaximum());
| public void | updateProgress(UpgradeUpdateEvent evt)
int progressState = evt.getProgressState();
String labelText = null;
if(evt.getProgressState() == 100){
labelText = stringManager.getString("upgrade.gui.progresspanel.progressLabel.DONE");
}
if(evt.getProgressState() == -1){
progressState = 0;
labelText = stringManager.getString("upgrade.gui.progresspanel.progressLabel.ERROR");
javax.swing.JOptionPane.showMessageDialog(this, stringManager.getString("upgrade.gui.progresspanel.errorProgressMsg"),
stringManager.getString("upgrade.gui.progresspanel.errorProgressMsgTitle"),
javax.swing.JOptionPane.ERROR_MESSAGE);
}
this.progressBar.setProgress(progressState);
if(labelText != null)
flowProgressLabel.setText(labelText);
|
|