Ejemplo n.º 1
0
 /** Browses the node or the data object. */
 private void browse() {
   EventBus bus = ImporterAgent.getRegistry().getEventBus();
   Object d = dataset;
   if (dataset == null || data instanceof ScreenData) d = data;
   if (d == null) return;
   bus.post(new BrowseContainer(d, null));
 }
Ejemplo n.º 2
0
 /**
  * Imports the data for the specified import view.
  *
  * @param element The import view.
  */
 private void importData(ImporterUIElement element) {
   if (element == null) return;
   view.setSelectedPane(element, true);
   model.fireImportData(element.getData(), element.getID());
   if (!model.isMaster()) {
     EventBus bus = ImporterAgent.getRegistry().getEventBus();
     bus.post(new ImportStatusEvent(true, element.getExistingContainers()));
     fireStateChange();
   }
 }
Ejemplo n.º 3
0
 /**
  * Implemented as specified by the {@link Importer} interface.
  *
  * @see Importer#close()
  */
 public void close() {
   if (model.isMaster()) {
     EventBus bus = ImporterAgent.getRegistry().getEventBus();
     bus.post(new ExitApplication());
     return;
   }
   Collection<ImporterUIElement> list = view.getImportElements();
   List<ImporterUIElement> toImport = new ArrayList<ImporterUIElement>();
   if (list == null || list.size() == 0) {
     view.setVisible(false);
     return;
   }
   Iterator<ImporterUIElement> i = list.iterator();
   ImporterUIElement element;
   ImporterUIElement started = null;
   while (i.hasNext()) {
     element = i.next();
     if (element.hasStarted()) started = element;
     if (!element.isDone()) toImport.add(element);
   }
   if (toImport.size() > 0) {
     MessageBox box =
         new MessageBox(
             view,
             CANCEL_TITLE,
             CANCEL_TEXT
                 + "\n"
                 + "If Yes, the window will close when the on-going "
                 + "import is completed.");
     if (box.centerMsgBox() == MessageBox.NO_OPTION) return;
     markToclose = true;
     i = toImport.iterator();
     while (i.hasNext()) {
       element = i.next();
       element.cancelLoading();
       // if (!element.hasStarted())
       model.cancel(element.getID());
     }
     if (started != null && started.isDone()) {
       markToclose = false;
     }
   } else markToclose = false;
   if (!markToclose) view.setVisible(false);
 }
Ejemplo n.º 4
0
 /**
  * Posts an event to view the protocol.
  *
  * @param protocolID The id of the protocol to view.
  */
 private void viewProtocol(long protocolID) {
   EventBus bus = MetadataViewerAgent.getRegistry().getEventBus();
   bus.post(new EditFileEvent(model.getSecurityContext(), protocolID));
 }
Ejemplo n.º 5
0
 /**
  * Posts an event to view the image.
  *
  * @param imageID The id of the image to view.
  */
 private void viewImage(long imageID) {
   EventBus bus = MetadataViewerAgent.getRegistry().getEventBus();
   bus.post(new ViewImage(model.getSecurityContext(), new ViewImageObject(imageID), null));
 }
Ejemplo n.º 6
0
 /**
  * Posts an event to view the image.
  *
  * @param imageID The id of the image to view.
  */
 private void viewImage(long imageID) {
   EventBus bus = MetadataViewerAgent.getRegistry().getEventBus();
   ViewImage evt = new ViewImage(model.getSecurityContext(), new ViewImageObject(imageID), null);
   evt.setPlugin(MetadataViewerAgent.runAsPlugin());
   bus.post(evt);
 }