Exemple #1
0
  @Override
  protected Boolean doInBackground() throws Exception {

    JFrame waitFrame = null;
    if (timeIntensive) {
      //		gui.getStatusPanel().setStatus("Initialising reasoner ... ");
      gui.disableTabbedPane();
      gui.setEnabled(false);
      waitFrame = new JFrame();
      waitFrame.setUndecorated(true);
      waitFrame.setSize(160, 100);
      waitFrame.getContentPane().setBackground(Color.WHITE);
      URL imgURL = Config.class.getResource("ajaxloader.gif");
      //    	ImageIcon waitIcon = new ImageIcon(imgURL, "wait");
      //    	waitFrame.add(new JLabel("Wait!"), waitIcon, SwingConstants.RIGHT);
      //    	waitFrame.add(new JLabel("Wait"));
      //    	JLabel iconLabel = new JLabel(waitIcon);
      //    	iconLabel.setOpaque(true);
      //    	iconLabel.setBackground(Color.RED);
      //    	iconLabel.setForeground(Color.RED);
      //    	waitFrame.add(iconLabel, BorderLayout.NORTH);
      waitFrame.add(
          new JLabel(
              "<html><br /><p align=\"center\"><img src=\""
                  + imgURL
                  + "\" /><br /> &nbsp;&nbsp;Initialising component.<br />Please wait.</p></html>"));
      waitFrame.setLocationRelativeTo(gui);
      waitFrame.setVisible(true);
    }

    try {
      for (AbstractComponent component : components) {
        component.init();

        // when the reasoner has been initialised, we need to update
        // the option panel (such that the user can see the existing
        // examples, classes etc.)
        if (component instanceof AbstractReasonerComponent) {
          gui.panels[2].updateOptionPanel();
          gui.panels[3].updateOptionPanel();
        }
      }
    } catch (ComponentInitException e) {
      gui.getStatusPanel().setExceptionMessage(e.getMessage());
      e.printStackTrace();
    }

    if (timeIntensive) {
      gui.enableTabbedPane();
      gui.setEnabled(true);
      //		gui.getStatusPanel().extendMessage("done.");
      waitFrame.dispose();
    }

    return true;
  }
Exemple #2
0
  public InitWorker(List<AbstractComponent> components, StartGUI gui) {
    this.components = components;
    this.gui = gui;

    // create a list of components, which do need virtually
    // no time to initialise (and where displaying a please
    // wait message is an unnecessary overhead)
    List<Class<? extends AbstractComponent>> nonTimeIntensiveComponents =
        new LinkedList<Class<? extends AbstractComponent>>();
    nonTimeIntensiveComponents.add(OWLFile.class);
    nonTimeIntensiveComponents.add(KBFile.class);

    // we check if any of the components is time-intensive
    timeIntensive = false;
    for (AbstractComponent component : components) {
      if (!nonTimeIntensiveComponents.contains(component.getClass())) {
        timeIntensive = true;
      }
    }
  }