001: /*
002: * FontLoaderDialog.java
003: *
004: * Created on November 13, 2006, 8:30 AM
005: */
006:
007: package it.businesslogic.ireport.gui.fonts;
008:
009: import it.businesslogic.ireport.FontsLoaderMonitor;
010: import java.lang.reflect.InvocationTargetException;
011: import javax.swing.SwingUtilities;
012: import it.businesslogic.ireport.util.I18n;
013:
014: /**
015: *
016: * @author gtoffoli
017: */
018: public class FontLoaderDialog extends javax.swing.JDialog implements
019: FontsLoaderMonitor {
020:
021: /** Creates new form FontLoaderDialog */
022: public FontLoaderDialog(java.awt.Frame parent, boolean modal) {
023: super (parent, modal);
024: initComponents();
025: applyI18n();
026: this .pack();
027:
028: it.businesslogic.ireport.util.Misc.centerFrame(this );
029: }
030:
031: /** This method is called from within the constructor to
032: * initialize the form.
033: * WARNING: Do NOT modify this code. The content of this method is
034: * always regenerated by the Form Editor.
035: */
036: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
037: private void initComponents() {
038: java.awt.GridBagConstraints gridBagConstraints;
039:
040: jLabelStatus = new javax.swing.JLabel();
041:
042: getContentPane().setLayout(new java.awt.GridBagLayout());
043:
044: setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
045: jLabelStatus.setText("Loading status");
046: jLabelStatus
047: .setVerticalAlignment(javax.swing.SwingConstants.TOP);
048: jLabelStatus.setPreferredSize(new java.awt.Dimension(391, 51));
049: gridBagConstraints = new java.awt.GridBagConstraints();
050: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
051: gridBagConstraints.weightx = 1.0;
052: gridBagConstraints.weighty = 1.0;
053: gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
054: getContentPane().add(jLabelStatus, gridBagConstraints);
055:
056: pack();
057: }// </editor-fold>//GEN-END:initComponents
058:
059: /**
060: * @param args the command line arguments
061: */
062: public static void main(String args[]) {
063: java.awt.EventQueue.invokeLater(new Runnable() {
064: public void run() {
065: new FontLoaderDialog(new javax.swing.JFrame(), true)
066: .setVisible(true);
067: }
068: });
069: }
070:
071: public void setStatus(String s) {
072: jLabelStatus.setText(s);
073: }
074:
075: public void fontsLoadingStatusUpdated(String statusMsg) {
076:
077: final String s = statusMsg;
078: try {
079: SwingUtilities.invokeAndWait(new Runnable() {
080: public void run() {
081: setStatus(s);
082: }
083: });
084: } catch (InterruptedException ex) {
085: ex.printStackTrace();
086: } catch (InvocationTargetException ex) {
087: ex.printStackTrace();
088: }
089:
090: }
091:
092: public void fontsLoadingStarted() {
093:
094: try {
095: SwingUtilities.invokeAndWait(new Runnable() {
096: public void run() {
097: setVisible(true);
098: }
099: });
100: } catch (InterruptedException ex) {
101: ex.printStackTrace();
102: } catch (InvocationTargetException ex) {
103: ex.printStackTrace();
104: }
105: }
106:
107: public void fontsLoadingFinished() {
108: try {
109: SwingUtilities.invokeAndWait(new Runnable() {
110: public void run() {
111: setVisible(false);
112: }
113: });
114: } catch (InterruptedException ex) {
115: ex.printStackTrace();
116: } catch (InvocationTargetException ex) {
117: ex.printStackTrace();
118: }
119: }
120:
121: // Variables declaration - do not modify//GEN-BEGIN:variables
122: private javax.swing.JLabel jLabelStatus;
123:
124: // End of variables declaration//GEN-END:variables
125:
126: public void applyI18n() {
127: // Start autogenerated code ----------------------
128: jLabelStatus.setText(I18n.getString(
129: "fontLoaderDialog.labelStatus", "Loading status"));
130: // End autogenerated code ----------------------
131: }
132: }
|