private boolean dropDicomFiles(List<File> files) { if (files != null) { DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); if (dicomView == null) { return false; } DicomModel model = (DicomModel) dicomView.getDataExplorerModel(); LoadLocalDicom dicom = new LoadLocalDicom(files.stream().toArray(File[]::new), true, model); DicomModel.LOADING_EXECUTOR.execute(dicom); return true; } return false; } }
void registerDataExplorer(DataExplorerView explorer) { if (explorer != null && !UIManager.EXPLORER_PLUGINS.contains(explorer)) { UIManager.EXPLORER_PLUGINS.add(explorer); Optional.ofNullable(explorer.getDataExplorerModel()).ifPresent(e -> e.addPropertyChangeListener(this)); if (explorer instanceof DockableTool) { final DockableTool dockable = (DockableTool) explorer; dockable.showDockable(); } LOGGER.info("Register data explorer Plug-in: {}", explorer.getUIName()); //$NON-NLS-1$ } }
@Override public List<Action> getOpenActions() { DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); if (dicomView == null) { return Arrays.asList(preferencesAction); } // In case DICOM explorer has been loaded get the first import action return dicomView.getOpenImportDialogAction().subList(0, 1); }
private void importInExplorer(List<DataExplorerView> exps, final List<File> vals, DropLocation dropLocation) { if (exps.size() == 1) { exps.get(0).importFiles(vals.toArray(new File[vals.size()]), true); } else { Point p; if (dropLocation == null) { Rectangle b = WeasisWin.this.getFrame().getBounds(); p = new Point((int) b.getCenterX(), (int) b.getCenterY()); } else { p = dropLocation.getDropPoint(); } JPopupMenu popup = new JPopupMenu(); for (final DataExplorerView dataExplorerView : exps) { JMenuItem item = new JMenuItem(dataExplorerView.getUIName(), dataExplorerView.getIcon()); item.addActionListener( e -> dataExplorerView.importFiles(vals.toArray(new File[vals.size()]), true)); popup.add(item); } popup.show(WeasisWin.this.getFrame(), p.x, p.y); } } }
void removeDataExplorer(DataExplorerViewFactory factory) { GuiExecutor.instance().execute(() -> { final DataExplorerView explorer = factory.createDataExplorerView(null); if (UIManager.EXPLORER_PLUGINS.contains(explorer)) { Optional.ofNullable(explorer.getDataExplorerModel()) .ifPresent(e -> e.removePropertyChangeListener(this)); UIManager.EXPLORER_PLUGINS.remove(explorer); // Update toolbar List<Toolbar> tb = mainWindow.getToolbarContainer().getRegisteredToolBars(); tb.removeIf(b -> b.getComponent().getAttachedInsertable() == explorer); mainWindow.getToolbarContainer().registerToolBar(tb); UIManager.VIEWER_PLUGINS .forEach(v -> v.getToolBar().removeIf(b -> b.getComponent().getAttachedInsertable() == explorer)); explorer.dispose(); LOGGER.info("Unregister data explorer Plug-in: {}", explorer.getUIName()); //$NON-NLS-1$ } }); }
List<DataExplorerView> explorers = new ArrayList<>(UIManager.EXPLORER_PLUGINS); for (int i = explorers.size() - 1; i >= 0; i--) { if (!explorers.get(i).canImportFiles()) { explorers.remove(i); DataExplorerModel model = dataExplorerView.getDataExplorerModel(); if (model != null) { List<Codec> cList = model.getCodecPlugins();
if (dataExplorerView != DefaultExplorer.this) { importAction = true; JMenuItem item = new JMenuItem(new DefaultAction(dataExplorerView.getUIName(), event -> { final Path selectedDir = ((TreeNode) DefaultExplorer.this.tree.getSelectionPath().getLastPathComponent()) .getNodePath(); if (selectedDir != null) { dataExplorerView.importFiles(selectedDir.toFile().listFiles(), false); item = new JMenuItem(new DefaultAction(dataExplorerView.getUIName(), event -> { final Path selectedDir = ((TreeNode) DefaultExplorer.this.tree.getSelectionPath().getLastPathComponent()) .getNodePath(); if (selectedDir != null) { dataExplorerView.importFiles(selectedDir.toFile().listFiles(), true);
public static DataExplorerView getExplorerplugin(String name) { if (name != null) { synchronized (EXPLORER_PLUGINS) { for (DataExplorerView view : EXPLORER_PLUGINS) { if (name.equals(view.getUIName())) { return view; } } } } return null; }
public static void closeSeriesViewer(View2dContainer view2dContainer) { // Unregister the PropertyChangeListener DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); if (dicomView != null) { dicomView.getDataExplorerModel().removePropertyChangeListener(view2dContainer); } }
private static void buildImportSubMenu(final JMenu importMenu) { UIManager.EXPLORER_PLUGINS.forEach(d -> fillMenu(importMenu, d.getOpenImportDialogAction())); }
public static void closeSeriesViewer(AuContainer container) { // Unregister the PropertyChangeListener DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); if (dicomView != null) { dicomView.getDataExplorerModel().removePropertyChangeListener(container); } }
public static void closeSeriesViewer(SRContainer mprContainer) { // Unregister the PropertyChangeListener DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); if (dicomView != null) { dicomView.getDataExplorerModel().removePropertyChangeListener(mprContainer); } }
public static void closeSeriesViewer(MPRContainer mprContainer) { // Unregister the PropertyChangeListener DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); if (dicomView != null) { dicomView.getDataExplorerModel().removePropertyChangeListener(mprContainer); } }
public static void closeSeriesViewer(WaveContainer container) { // Unregister the PropertyChangeListener DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); if (dicomView != null) { dicomView.getDataExplorerModel().removePropertyChangeListener(container); } }
@Override public void setSelected(boolean selected) { if (selected) { eventManager.setSelectedView2dContainer(this); // Send event to select the related patient in Dicom Explorer. DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); if (dicomView != null && dicomView.getDataExplorerModel() instanceof DicomModel) { dicomView.getDataExplorerModel().firePropertyChange( new ObservableEvent(ObservableEvent.BasicAction.SELECT, this, null, getGroupID())); } } else { eventManager.setSelectedView2dContainer(null); } }
@Override public void setSelected(boolean selected) { if (selected) { eventManager.setSelectedView2dContainer(this); // Send event to select the related patient in Dicom Explorer. DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); if (dicomView != null && dicomView.getDataExplorerModel() instanceof DicomModel) { dicomView.getDataExplorerModel().firePropertyChange( new ObservableEvent(ObservableEvent.BasicAction.SELECT, this, null, getGroupID())); } } else { eventManager.setSelectedView2dContainer(null); } }
@Override public void setSelected(boolean selected) { if (selected) { eventManager.setSelectedView2dContainer(this); // Send event to select the related patient in Dicom Explorer. DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); if (dicomView != null && dicomView.getDataExplorerModel() instanceof DicomModel) { dicomView.getDataExplorerModel().firePropertyChange( new ObservableEvent(ObservableEvent.BasicAction.SELECT, this, null, getGroupID())); } } else { eventManager.setSelectedView2dContainer(null); } }
@Override public void setSelected(boolean selected) { if (selected) { eventManager.setSelectedView2dContainer(this); // Send event to select the related patient in Dicom Explorer. DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); if (dicomView != null && dicomView.getDataExplorerModel() instanceof DicomModel) { dicomView.getDataExplorerModel().firePropertyChange( new ObservableEvent(ObservableEvent.BasicAction.SELECT, this, null, getGroupID())); } if (ecgview != null && !TOOLS.isEmpty() && TOOLS.get(0) instanceof MeasureAnnotationTool) { MeasureAnnotationTool tool = (MeasureAnnotationTool) TOOLS.get(0); ecgview.setAnnotationTool(tool); tool.setSeries(ecgview.getSeries()); ecgview.updateMarkersTable(); } } else { eventManager.setSelectedView2dContainer(null); } }
private static void updateViewerUI(BasicAction action) { ImageViewerPlugin<DicomImageElement> view = EventManager.getInstance().getSelectedView2dContainer(); if (view instanceof View2dContainer) { DataExplorerView dicomView = UIManager.getExplorerplugin(DicomExplorer.NAME); DataExplorerModel model = dicomView.getDataExplorerModel(); if (model != null) { model.firePropertyChange(new ObservableEvent(action, view, null, view)); } } } }
DicomModel model = null; if (dicomView != null) { model = (DicomModel) dicomView.getDataExplorerModel();