Esempio n. 1
0
 public void runInBackground() {
   ApplicationContext appC = qedit.QEditApp.getInstance().getContext();
   TaskMonitor taskMonitor = appC.getTaskMonitor();
   TaskService taskService = appC.getTaskService();
   taskService.execute(this);
   taskMonitor.setForegroundTask(this);
 }
  public GPM_DemoView(SingleFrameApplication app) {
    super(app);

    initComponents();

    // status bar initialization - message timeout, idle icon and busy animation, etc
    ResourceMap resourceMap = getResourceMap();
    int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
    messageTimer =
        new Timer(
            messageTimeout,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
              }
            });
    messageTimer.setRepeats(false);
    int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
    for (int i = 0; i < busyIcons.length; i++) {
      busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
    }
    busyIconTimer =
        new Timer(
            busyAnimationRate,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
              }
            });
    idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
    statusAnimationLabel.setIcon(idleIcon);

    // connecting action tasks to status bar via TaskMonitor
    TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
    taskMonitor.addPropertyChangeListener(
        new java.beans.PropertyChangeListener() {
          public void propertyChange(java.beans.PropertyChangeEvent evt) {
            String propertyName = evt.getPropertyName();
            if ("started".equals(propertyName)) {
              if (!busyIconTimer.isRunning()) {
                statusAnimationLabel.setIcon(busyIcons[0]);
                busyIconIndex = 0;
                busyIconTimer.start();
              }
            } else if ("done".equals(propertyName)) {
              busyIconTimer.stop();
              statusAnimationLabel.setIcon(idleIcon);
            } else if ("message".equals(propertyName)) {
              String text = (String) (evt.getNewValue());
              statusMessageLabel.setText((text == null) ? "" : text);
              messageTimer.restart();
            } else if ("progress".equals(propertyName)) {
              int value = (Integer) (evt.getNewValue());
            }
          }
        });
  }
  public AmltpvViewClient(SingleFrameApplication app) {
    super(app);

    initComponents();

    // status bar initialization - message timeout, idle icon and busy animation, etc
    ResourceMap resourceMap = getResourceMap();
    int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
    messageTimer =
        new Timer(
            messageTimeout,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
              }
            });
    messageTimer.setRepeats(false);
    int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
    for (int i = 0; i < busyIcons.length; i++) {
      busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
    }
    busyIconTimer =
        new Timer(
            busyAnimationRate,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
              }
            });
    idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
    statusAnimationLabel.setIcon(idleIcon);
    progressBar.setVisible(false);

    // connecting action tasks to status bar via TaskMonitor
    TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
    taskMonitor.addPropertyChangeListener(
        new java.beans.PropertyChangeListener() {
          public void propertyChange(java.beans.PropertyChangeEvent evt) {
            String propertyName = evt.getPropertyName();
            if ("started".equals(propertyName)) {
              if (!busyIconTimer.isRunning()) {
                statusAnimationLabel.setIcon(busyIcons[0]);
                busyIconIndex = 0;
                busyIconTimer.start();
              }
              progressBar.setVisible(true);
              progressBar.setIndeterminate(true);
            } else if ("done".equals(propertyName)) {
              busyIconTimer.stop();
              statusAnimationLabel.setIcon(idleIcon);
              progressBar.setVisible(false);
              progressBar.setValue(0);
            } else if ("message".equals(propertyName)) {
              String text = (String) (evt.getNewValue());
              statusMessageLabel.setText((text == null) ? "" : text);
              messageTimer.restart();
            } else if ("progress".equals(propertyName)) {
              int value = (Integer) (evt.getNewValue());
              progressBar.setVisible(true);
              progressBar.setIndeterminate(false);
              progressBar.setValue(value);
            }
          }
        });

    // SEVERRAL INITIALIZATIONS
    util = new amltpv.Utils(statusMessageLabel);
    util.setMainFrame(AmltpvClientApp.getApplication().getMainFrame());
    db = new DataBase();
    super.getFrame().setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    // Thread t = new Thread(new ThreadTest());
    // t.start();
    cobradasDialog = new CobradasDialog(super.getFrame(), true);
    cobradasDialog.setLocationRelativeTo(super.getComponent());
    self = this;
  }
Esempio n. 4
0
  public FingerprintView(SingleFrameApplication app, String p) {
    super(app);

    initComponents();

    S = p;
    // status bar initialization - message timeout, idle icon and busy animation, etc
    ResourceMap resourceMap = getResourceMap();
    int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
    messageTimer =
        new Timer(
            messageTimeout,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
              }
            });
    messageTimer.setRepeats(false);
    int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
    for (int i = 0; i < busyIcons.length; i++) {
      busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
    }
    busyIconTimer =
        new Timer(
            busyAnimationRate,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
              }
            });
    idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
    statusAnimationLabel.setIcon(idleIcon);
    progressBar.setVisible(false);

    // connecting action tasks to status bar via TaskMonitor
    TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
    taskMonitor.addPropertyChangeListener(
        new java.beans.PropertyChangeListener() {
          public void propertyChange(java.beans.PropertyChangeEvent evt) {
            String propertyName = evt.getPropertyName();
            if ("started".equals(propertyName)) {
              if (!busyIconTimer.isRunning()) {
                statusAnimationLabel.setIcon(busyIcons[0]);
                busyIconIndex = 0;
                busyIconTimer.start();
              }
              progressBar.setVisible(true);
              progressBar.setIndeterminate(true);
            } else if ("done".equals(propertyName)) {
              busyIconTimer.stop();
              statusAnimationLabel.setIcon(idleIcon);
              progressBar.setVisible(false);
              progressBar.setValue(0);
            } else if ("message".equals(propertyName)) {
              String text = (String) (evt.getNewValue());
              statusMessageLabel.setText((text == null) ? "" : text);
              messageTimer.restart();
            } else if ("progress".equals(propertyName)) {
              int value = (Integer) (evt.getNewValue());
              progressBar.setVisible(true);
              progressBar.setIndeterminate(false);
              progressBar.setValue(value);
            }
          }
        });

    // tracking table selection
    masterTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent e) {
                firePropertyChange("recordSelected", !isRecordSelected(), isRecordSelected());
              }
            });

    // tracking changes to save
    bindingGroup.addBindingListener(
        new AbstractBindingListener() {
          @Override
          public void targetChanged(Binding binding, PropertyStateEvent event) {
            // save action observes saveNeeded property
            setSaveNeeded(true);
          }
        });

    // have a transaction started
    entityManager.getTransaction().begin();
  }
  /*ClickPanel clickPanel1;
  DragPanel dragPanel1;
  ScrollPanel scrollPanel1;
  MovePanel movePanel1;*/
  public AutomaticClickUtilityView(SingleFrameApplication app) {
    super(app);
    mouseActions = new Vector<ClickAction>();
    /*clickPanel1 = new ClickPanel();
    dragPanel1 = new DragPanel();
    scrollPanel1 = new ScrollPanel();
    movePanel1 = new MovePanel();*/
    initComponents();
    /*jLayeredPane1.add(clickPanel1);
    jLayeredPane1.add(dragPanel1);
    jLayeredPane1.add(scrollPanel1);
    jLayeredPane1.add(movePanel1);*/
    clickPanel1.setVisible(false);
    dragPanel1.setVisible(false);
    scrollPanel1.setVisible(false);
    movePanel1.setVisible(false);
    getFrame().validate();
    getFrame().repaint();

    // status bar initialization - message timeout, idle icon and busy animation, etc
    ResourceMap resourceMap = getResourceMap();
    int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
    messageTimer =
        new Timer(
            messageTimeout,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
              }
            });
    messageTimer.setRepeats(false);
    int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
    for (int i = 0; i < busyIcons.length; i++) {
      busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
    }
    busyIconTimer =
        new Timer(
            busyAnimationRate,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
              }
            });
    idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
    statusAnimationLabel.setIcon(idleIcon);
    progressBar.setVisible(false);

    // connecting action tasks to status bar via TaskMonitor
    TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
    taskMonitor.addPropertyChangeListener(
        new java.beans.PropertyChangeListener() {
          public void propertyChange(java.beans.PropertyChangeEvent evt) {
            String propertyName = evt.getPropertyName();
            if ("started".equals(propertyName)) {
              if (!busyIconTimer.isRunning()) {
                statusAnimationLabel.setIcon(busyIcons[0]);
                busyIconIndex = 0;
                busyIconTimer.start();
              }
              progressBar.setVisible(true);
              progressBar.setIndeterminate(true);
            } else if ("done".equals(propertyName)) {
              busyIconTimer.stop();
              statusAnimationLabel.setIcon(idleIcon);
              progressBar.setVisible(false);
              progressBar.setValue(0);
            } else if ("message".equals(propertyName)) {
              String text = (String) (evt.getNewValue());
              statusMessageLabel.setText((text == null) ? "" : text);
              messageTimer.restart();
            } else if ("progress".equals(propertyName)) {
              int value = (Integer) (evt.getNewValue());
              progressBar.setVisible(true);
              progressBar.setIndeterminate(false);
              progressBar.setValue(value);
            }
          }
        });
  }
Esempio n. 6
0
  public ComeCocosView(SingleFrameApplication app) throws Exception {
    super(app);
    initComponents();
    t = null;
    soltarCoco = null;
    intro = new Player("src/comecocos/resources/pacman_intro.wav");
    cocoNormal = new Player("src/comecocos/resources/siren.wav");
    cocoWeak = new Player("src/comecocos/resources/weak.wav");
    cocoComido = new Player("src/comecocos/resources/ojos.wav");
    waka = new Player("src/comecocos/resources/waka.wav");
    die = new Player("src/comecocos/resources/die.mp3");

    // status bar initialization - message timeout, idle icon and busy animation, etc
    ResourceMap resourceMap = getResourceMap();
    int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
    messageTimer =
        new Timer(
            messageTimeout,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
              }
            });
    messageTimer.setRepeats(false);
    int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
    for (int i = 0; i < busyIcons.length; i++) {
      busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
    }
    busyIconTimer =
        new Timer(
            busyAnimationRate,
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
              }
            });
    idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
    statusAnimationLabel.setIcon(idleIcon);
    progressBar.setVisible(false);

    // connecting action tasks to status bar via TaskMonitor
    TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
    taskMonitor.addPropertyChangeListener(
        new java.beans.PropertyChangeListener() {
          public void propertyChange(java.beans.PropertyChangeEvent evt) {
            String propertyName = evt.getPropertyName();
            if ("started".equals(propertyName)) {
              if (!busyIconTimer.isRunning()) {
                statusAnimationLabel.setIcon(busyIcons[0]);
                busyIconIndex = 0;
                busyIconTimer.start();
              }
              progressBar.setVisible(true);
              progressBar.setIndeterminate(true);
            } else if ("done".equals(propertyName)) {
              busyIconTimer.stop();
              statusAnimationLabel.setIcon(idleIcon);
              progressBar.setVisible(false);
              progressBar.setValue(0);
            } else if ("message".equals(propertyName)) {
              String text = (String) (evt.getNewValue());
              statusMessageLabel.setText((text == null) ? "" : text);
              messageTimer.restart();
            } else if ("progress".equals(propertyName)) {
              int value = (Integer) (evt.getNewValue());
              progressBar.setVisible(true);
              progressBar.setIndeterminate(false);
              progressBar.setValue(value);
            }
          }
        });
    thread.start();
  }