diff --git a/weasis-acquire/weasis-acquire-explorer/src/main/java/org/weasis/acquire/explorer/gui/control/AcquirePublishPanel.java b/weasis-acquire/weasis-acquire-explorer/src/main/java/org/weasis/acquire/explorer/gui/control/AcquirePublishPanel.java index 8b6192e15..be55ac28b 100755 --- a/weasis-acquire/weasis-acquire-explorer/src/main/java/org/weasis/acquire/explorer/gui/control/AcquirePublishPanel.java +++ b/weasis-acquire/weasis-acquire-explorer/src/main/java/org/weasis/acquire/explorer/gui/control/AcquirePublishPanel.java @@ -80,10 +80,14 @@ public AcquirePublishPanel() { } public void publishDirDicom( - File exportDirDicom, AbstractDicomNode destinationNode, List toPublish) { + File exportDirDicom, + AbstractDicomNode destinationNode, + String callingAet, + List toPublish) { SwingWorker publishDicomTask = null; if (destinationNode instanceof DefaultDicomNode defaultDicomNode) { - publishDicomTask = publishDicomDimse(exportDirDicom, defaultDicomNode.getDicomNode()); + publishDicomTask = + publishDicomDimse(exportDirDicom, defaultDicomNode.getDicomNode(), callingAet); } else if (destinationNode instanceof final DicomWebNode node) { publishDicomTask = publishStow(exportDirDicom, node, toPublish); } @@ -94,7 +98,8 @@ public void publishDirDicom( } } - public PublishDicomTask publishDicomDimse(File exportDirDicom, DicomNode destNdde) { + public PublishDicomTask publishDicomDimse( + File exportDirDicom, DicomNode destNode, String callingAet) { DicomProgress dicomProgress = new DicomProgress(); Supplier publish = () -> { @@ -105,14 +110,10 @@ public PublishDicomTask publishDicomDimse(File exportDirDicom, DicomNode destNdd connectOptions.setConnectTimeout(3000); connectOptions.setAcceptTimeout(5000); params.setConnectOptions(connectOptions); - DicomNode callingNode = - new DicomNode( - GuiUtils.getUICore() - .getSystemPreferences() - .getProperty("weasis.aet", "WEASIS_AE")); // NON-NLS + DicomNode callingNode = new DicomNode(callingAet); // NON-NLS try { return CStore.process( - params, callingNode, destNdde, exportFilesDicomPath, dicomProgress); + params, callingNode, destNode, exportFilesDicomPath, dicomProgress); } finally { FileUtil.recursiveDelete(exportDirDicom); } diff --git a/weasis-acquire/weasis-acquire-explorer/src/main/java/org/weasis/acquire/explorer/gui/dialog/AcquirePublishDialog.java b/weasis-acquire/weasis-acquire-explorer/src/main/java/org/weasis/acquire/explorer/gui/dialog/AcquirePublishDialog.java index 23cdd4dd9..c014e5f70 100755 --- a/weasis-acquire/weasis-acquire-explorer/src/main/java/org/weasis/acquire/explorer/gui/dialog/AcquirePublishDialog.java +++ b/weasis-acquire/weasis-acquire-explorer/src/main/java/org/weasis/acquire/explorer/gui/dialog/AcquirePublishDialog.java @@ -9,6 +9,9 @@ */ package org.weasis.acquire.explorer.gui.dialog; +import static org.weasis.core.api.gui.Insertable.ITEM_SEPARATOR_LARGE; +import static org.weasis.core.api.gui.Insertable.ITEM_SEPARATOR_SMALL; + import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; @@ -65,6 +68,8 @@ public class AcquirePublishDialog extends JDialog { private static final String LAST_SEL_NODE = "lastSelectedNode"; public static final String P_LAST_RESOLUTION = "last.resolution"; public static final String PREFERENCE_NODE = "publish"; // NON-NLS + private static final String LAST_CALLING_NODE = "lastCallingNode"; + private final JComboBox comboCallingNode = new JComboBox<>(); public enum Resolution { ORIGINAL(Messages.getString("AcquirePublishDialog.original"), Integer.MAX_VALUE), @@ -174,10 +179,21 @@ private JPanel initContent() { JLabel lblDestination = new JLabel( Messages.getString("AcquirePublishDialog.lblDestination.text") + StringUtil.COLON); + GuiUtils.setPreferredWidth(comboNode, 210, 185); AbstractDicomNode.addTooltipToComboList(comboNode); loadDicomNodes(); - contentPane.add(lblDestination, "split 2, span"); // NON-NLS - contentPane.add(comboNode, " wrap"); // NON-NLS + + JPanel panel = GuiUtils.getFlowLayoutPanel(ITEM_SEPARATOR_SMALL, 0, lblDestination, comboNode); + if (comboCallingNode.getItemCount() > 0) { + AbstractDicomNode.addTooltipToComboList(comboCallingNode); + JLabel lblCalling = new JLabel("Calling Node" + StringUtil.COLON); + GuiUtils.setPreferredWidth(comboCallingNode, 160, 120); + + panel.add(GuiUtils.boxHorizontalStrut(ITEM_SEPARATOR_LARGE)); + panel.add(lblCalling); + panel.add(comboCallingNode); + } + contentPane.add(panel, "split 5, span, wrap"); // NON-NLS publishButton = new JButton(Messages.getString("AcquirePublishDialog.publish")); publishButton.addActionListener(e -> publishAction()); @@ -201,7 +217,7 @@ private void loadDicomNodes() { AbstractDicomNode.loadDicomNodes(comboNode, AbstractDicomNode.Type.DICOM, UsageType.STORAGE); AbstractDicomNode.loadDicomNodes(comboNode, AbstractDicomNode.Type.WEB, UsageType.STORAGE); String desc = MediaImporterFactory.EXPORT_PERSISTENCE.getProperty(LAST_SEL_NODE); - AbstractDicomNode.selectDicomNode(comboNode, desc); + AbstractDicomNode.selectDicomNode(comboNode.getModel(), desc); if (comboNode.getItemCount() == 0) { comboNode.addItem(getDestinationConfiguration()); @@ -209,6 +225,15 @@ private void loadDicomNodes() { } else { comboNode.addItem(getDestinationConfiguration()); } + + String weasisAet = + GuiUtils.getUICore().getSystemPreferences().getProperty("weasis.aet"); // NON-NLS + if (!StringUtil.hasText(weasisAet)) { + AbstractDicomNode.loadDicomNodes( + comboCallingNode, AbstractDicomNode.Type.DICOM_CALLING, UsageType.STORAGE); + String calling = MediaImporterFactory.EXPORT_PERSISTENCE.getProperty(LAST_CALLING_NODE); + AbstractDicomNode.selectDicomNode(comboCallingNode.getModel(), calling); + } } private static AbstractDicomNode getDestinationConfiguration() { @@ -313,7 +338,17 @@ private SwingWorker getFileAcquireImageInfoSwingWorker( if (exportDirDicom != null) { AbstractDicomNode node = (AbstractDicomNode) comboNode.getSelectedItem(); - publishPanel.publishDirDicom(exportDirDicom, node, toPublish); + String weasisAet = + GuiUtils.getUICore() + .getSystemPreferences() + .getProperty("weasis.aet"); // NON-NLS + if (!StringUtil.hasText(weasisAet)) { + weasisAet = + comboCallingNode.getSelectedItem() == null + ? "WEASIS_AE" + : ((DefaultDicomNode) comboCallingNode.getSelectedItem()).getAeTitle(); + } + publishPanel.publishDirDicom(exportDirDicom, node, weasisAet, toPublish); clearAndHide(); } else { JOptionPane.showMessageDialog( @@ -373,6 +408,11 @@ public void clearAndHide() { if (node != null) { MediaImporterFactory.EXPORT_PERSISTENCE.setProperty(LAST_SEL_NODE, node.getDescription()); } + final AbstractDicomNode callingNode = (AbstractDicomNode) comboCallingNode.getSelectedItem(); + if (callingNode != null) { + MediaImporterFactory.EXPORT_PERSISTENCE.setProperty( + LAST_CALLING_NODE, callingNode.getDescription()); + } Preferences prefs = BundlePreferences.getDefaultPreferences(AppProperties.getBundleContext(this.getClass())); if (prefs != null) { diff --git a/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/DicomSorter.java b/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/DicomSorter.java index cbdab6480..4bbc98500 100755 --- a/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/DicomSorter.java +++ b/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/DicomSorter.java @@ -272,7 +272,9 @@ private DicomSorter() {} private static boolean isEncapsulatedOrSR(MediaSeriesGroup series) { String s1 = TagD.getTagValue(series, Tag.SOPClassUID, String.class); - return s1 != null && (s1.startsWith("1.2.840.10008.5.1.4.1.1.88") || s1.startsWith("1.2.840.10008.5.1.4.1.1.104")); + return s1 != null + && (s1.startsWith("1.2.840.10008.5.1.4.1.1.88") + || s1.startsWith("1.2.840.10008.5.1.4.1.1.104")); } public static SortingTime getStudyDateSorting() { diff --git a/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/pref/node/AbstractDicomNode.java b/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/pref/node/AbstractDicomNode.java index 8a15f1d36..8aed5ab03 100755 --- a/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/pref/node/AbstractDicomNode.java +++ b/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/pref/node/AbstractDicomNode.java @@ -34,6 +34,7 @@ import org.weasis.core.api.gui.util.AppProperties; import org.weasis.core.api.gui.util.GuiUtils; import org.weasis.core.api.service.BundlePreferences; +import org.weasis.core.api.service.WProperties; import org.weasis.core.api.util.ResourceUtil; import org.weasis.core.util.FileUtil; import org.weasis.core.util.StringUtil; @@ -457,9 +458,8 @@ public static void addTooltipToComboList(final JComboBox comboNode, String desc) { - if (comboNode != null && StringUtil.hasText(desc)) { - ComboBoxModel model = comboNode.getModel(); + public static void selectDicomNode(ComboBoxModel model, String desc) { + if (model != null && StringUtil.hasText(desc)) { for (int i = 0; i < model.getSize(); i++) { if (desc.equals(model.getElementAt(i).getDescription())) { model.setSelectedItem(model.getElementAt(i)); @@ -468,4 +468,19 @@ public static void selectDicomNode(JComboBox comboNode, Strin } } } + + public static void nodeSelectionPersistence( + WProperties prefs, AbstractDicomNode node, String key) { + if (node != null && prefs != null) { + prefs.setProperty(key, node.getDescription()); + } + } + + public static void restoreNodeSelection( + WProperties prefs, ComboBoxModel model, String key) { + if (prefs != null) { + String desc = prefs.getProperty(key); + selectDicomNode(model, desc); + } + } } diff --git a/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/print/DicomPrint.java b/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/print/DicomPrint.java index 6b1089605..2270b5786 100755 --- a/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/print/DicomPrint.java +++ b/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/print/DicomPrint.java @@ -47,7 +47,6 @@ import org.dcm4che3.util.UIDUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.weasis.core.api.gui.util.GuiUtils; import org.weasis.core.api.image.AffineTransformOp; import org.weasis.core.api.image.LayoutConstraints; import org.weasis.core.api.image.ZoomOp.Interpolation; @@ -57,6 +56,7 @@ import org.weasis.core.ui.util.ImagePrint; import org.weasis.core.ui.util.PrintOptions; import org.weasis.core.util.MathUtil; +import org.weasis.dicom.explorer.pref.node.DefaultDicomNode; import org.weasis.dicom.explorer.pref.node.DicomPrintNode; import org.weasis.dicom.explorer.print.DicomPrintDialog.FilmSize; import org.weasis.opencv.data.PlanarImage; @@ -267,7 +267,7 @@ public static BufferedImage createGrayBufferedImage(int destWidth, int destHeigh return new BufferedImage(cm, r, false, null); } - public void printImage(BufferedImage image) throws Exception { + public void printImage(BufferedImage image, DefaultDicomNode selectedItem) throws Exception { Attributes filmSessionAttrs = new Attributes(); Attributes filmBoxAttrs = new Attributes(); Attributes imageBoxAttrs = new Attributes(); @@ -283,11 +283,7 @@ public void printImage(BufferedImage image) throws Exception { // writeDICOM(new File("/tmp/print.dcm"), dicomImage); - String weasisAet = - GuiUtils.getUICore() - .getSystemPreferences() - .getProperty("weasis.aet", "WEASIS_AE"); // NON-NLS - + String weasisAet = selectedItem == null ? "WEASIS_AE" : selectedItem.getAeTitle(); // NON-NLS Device device = new Device(weasisAet); ApplicationEntity ae = new ApplicationEntity(weasisAet); Connection conn = new Connection(); diff --git a/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/print/DicomPrintDialog.java b/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/print/DicomPrintDialog.java index 27b24d106..f61933906 100755 --- a/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/print/DicomPrintDialog.java +++ b/weasis-dicom/weasis-dicom-explorer/src/main/java/org/weasis/dicom/explorer/print/DicomPrintDialog.java @@ -28,6 +28,7 @@ import org.weasis.core.api.gui.util.GuiUtils; import org.weasis.core.api.gui.util.WinUtil; import org.weasis.core.api.media.data.ImageElement; +import org.weasis.core.api.service.WProperties; import org.weasis.core.ui.editor.image.ImageViewerEventManager; import org.weasis.core.ui.editor.image.ImageViewerPlugin; import org.weasis.core.ui.editor.image.ViewCanvas; @@ -36,6 +37,9 @@ import org.weasis.core.util.StringUtil; import org.weasis.dicom.explorer.Messages; import org.weasis.dicom.explorer.pref.node.AbstractDicomNode; +import org.weasis.dicom.explorer.pref.node.AbstractDicomNode.UsageType; +import org.weasis.dicom.explorer.pref.node.DefaultDicomNode; +import org.weasis.dicom.explorer.pref.node.DicomNodeDialog; import org.weasis.dicom.explorer.pref.node.DicomPrintNode; /** @@ -45,6 +49,9 @@ public class DicomPrintDialog extends JDialog { private static final Logger LOGGER = LoggerFactory.getLogger(DicomPrintDialog.class); + private static final String LAST_SEL_NODE = "lastSelNode"; + private static final String LAST_CALLING_NODE = "lastCallingNode"; + public enum FilmSize { IN8X10("8INX10IN", 8, 10), // NON-NLS IN8_5X11("8_5INX11IN", 8.5, 11), // NON-NLS @@ -115,6 +122,7 @@ public static FilmSize getInstance(String val, FilmSize defaultValue) { private DicomPrintOptionPane optionPane; private JComboBox printersComboBox; + private final JComboBox comboCallingNode = new JComboBox<>(); private final ImageViewerEventManager eventManager; /** Creates new form DicomPrintDialog */ @@ -148,6 +156,8 @@ private void initComponents() { AbstractDicomNode.loadDicomNodes(printersComboBox, AbstractDicomNode.Type.PRINTER); GuiUtils.setPreferredWidth(printersComboBox, 200, 185); AbstractDicomNode.addTooltipToComboList(printersComboBox); + AbstractDicomNode.restoreNodeSelection( + getPersistence(), printersComboBox.getModel(), LAST_SEL_NODE); Component horizontalStrut = Box.createHorizontalStrut(20); printersCfg.add(horizontalStrut); @@ -183,13 +193,24 @@ private void initComponents() { optionPane = new DicomPrintOptionPane(); panel.add(optionPane, "newline, gaptop 10, spanx"); // NON-NLS + JLabel lblCalling = new JLabel("Calling Node" + StringUtil.COLON); + AbstractDicomNode.loadDicomNodes( + comboCallingNode, AbstractDicomNode.Type.DICOM_CALLING, UsageType.STORAGE); + GuiUtils.setPreferredWidth(comboCallingNode, 185, 150); + AbstractDicomNode.addTooltipToComboList(comboCallingNode); + AbstractDicomNode.restoreNodeSelection( + getPersistence(), comboCallingNode.getModel(), LAST_CALLING_NODE); + + panel.add(lblCalling, "newline, growx 0, alignx trailing"); // NON-NLS + panel.add(comboCallingNode, "growx, alignx trailing, gapright 25"); + JButton printButton = new JButton(Messages.getString("DicomPrintDialog.print")); printButton.addActionListener(this::printButtonActionPerformed); getRootPane().setDefaultButton(printButton); JButton cancelButton = new JButton(Messages.getString("DicomPrintDialog.cancel")); cancelButton.addActionListener(evt -> doClose()); - panel.add(printButton, "newline, skip, growx 0, alignx trailing"); // NON-NLS + panel.add(printButton, "skip, growx 0, alignx trailing"); // NON-NLS panel.add(cancelButton, "gap 15lp 0lp 10lp 10lp"); // NON-NLS setContentPane(panel); } @@ -228,7 +249,8 @@ private void printButtonActionPerformed(java.awt.event.ActionEvent evt) { } try { - dicomPrint.printImage(dicomPrint.printImage(layout)); + dicomPrint.printImage( + dicomPrint.printImage(layout), (DefaultDicomNode) comboCallingNode.getSelectedItem()); } catch (Exception e) { LOGGER.error("DICOM Print Service", e); JOptionPane.showMessageDialog( @@ -242,6 +264,12 @@ private void printButtonActionPerformed(java.awt.event.ActionEvent evt) { } private void doClose() { + AbstractDicomNode.nodeSelectionPersistence( + getPersistence(), (AbstractDicomNode) printersComboBox.getSelectedItem(), LAST_SEL_NODE); + AbstractDicomNode.nodeSelectionPersistence( + getPersistence(), + (AbstractDicomNode) comboCallingNode.getSelectedItem(), + LAST_CALLING_NODE); dispose(); } @@ -251,4 +279,8 @@ private void applyOptionsFromSelected() { optionPane.applyOptions(printNode.getPrintOptions()); } } + + public static WProperties getPersistence() { + return GuiUtils.getUICore().getPluginPersistence(DicomNodeDialog.class.getPackageName()); + } } diff --git a/weasis-dicom/weasis-dicom-qr/src/main/java/org/weasis/dicom/qr/DicomQrView.java b/weasis-dicom/weasis-dicom-qr/src/main/java/org/weasis/dicom/qr/DicomQrView.java index 761f8ebfc..23974dd7b 100755 --- a/weasis-dicom/weasis-dicom-qr/src/main/java/org/weasis/dicom/qr/DicomQrView.java +++ b/weasis-dicom/weasis-dicom-qr/src/main/java/org/weasis/dicom/qr/DicomQrView.java @@ -299,7 +299,7 @@ protected JPopupMenu getPopupMenu() { private QueryProcess process; private AuthMethod authMethod; private final CircularProgressBar progressBar = new CircularProgressBar(); - final JLabel lblDest = + final JLabel lblCalling = new JLabel(Messages.getString("DicomQrView.calling_node") + StringUtil.COLON); private final JLabel lblRetrieve = new JLabel(Messages.getString("DicomQrView.retrieve") + StringUtil.COLON); @@ -401,7 +401,7 @@ public JPanel getCallingNodePanel() { return GuiUtils.getFlowLayoutPanel( ITEM_SEPARATOR_SMALL, ITEM_SEPARATOR, - lblDest, + lblCalling, comboCallingNode, GuiUtils.boxHorizontalStrut(BLOCK_SEPARATOR), btnGeneralOptions); @@ -855,7 +855,8 @@ private void initNodeList() { comboCallingNode, AbstractDicomNode.Type.DICOM_CALLING, AbstractDicomNode.UsageType.RETRIEVE); - restoreNodeSelection(comboCallingNode.getModel(), LAST_CALLING_NODE); + AbstractDicomNode.restoreNodeSelection( + getPersistence(), comboCallingNode.getModel(), LAST_CALLING_NODE); comboDestinationNode.removeActionListener(destNodeListener); comboDestinationNode.removeAllItems(); @@ -863,7 +864,8 @@ private void initNodeList() { comboDestinationNode, AbstractDicomNode.Type.DICOM, UsageType.RETRIEVE); AbstractDicomNode.loadDicomNodes( comboDestinationNode, AbstractDicomNode.Type.WEB, UsageType.RETRIEVE, WebType.QIDORS); - restoreNodeSelection(comboDestinationNode.getModel(), LAST_SEL_NODE); + AbstractDicomNode.restoreNodeSelection( + getPersistence(), comboDestinationNode.getModel(), LAST_SEL_NODE); String lastType = getPersistence().getProperty(LAST_RETRIEVE_TYPE); if (lastType != null) { try { @@ -879,7 +881,7 @@ private void initNodeList() { private void applySelectedArchive() { Object selectedItem = comboDestinationNode.getSelectedItem(); boolean dcmOption = selectedItem instanceof DefaultDicomNode; - lblDest.setEnabled(dcmOption); + lblCalling.setEnabled(dcmOption); lblRetrieve.setEnabled(dcmOption); comboDicomRetrieveType.setEnabled(dcmOption); comboCallingNode.setEnabled(dcmOption); @@ -926,10 +928,14 @@ private SearchParameters buildCurrentSearchParameters(String title) { } public void applyChange() { - nodeSelectionPersistence( - (AbstractDicomNode) comboDestinationNode.getSelectedItem(), LAST_SEL_NODE); - nodeSelectionPersistence( - (AbstractDicomNode) comboCallingNode.getSelectedItem(), LAST_CALLING_NODE); + AbstractDicomNode.nodeSelectionPersistence( + getPersistence(), + (AbstractDicomNode) comboDestinationNode.getSelectedItem(), + LAST_SEL_NODE); + AbstractDicomNode.nodeSelectionPersistence( + getPersistence(), + (AbstractDicomNode) comboCallingNode.getSelectedItem(), + LAST_CALLING_NODE); RetrieveType type = (RetrieveType) comboDicomRetrieveType.getSelectedItem(); WProperties persistence = getPersistence(); if (type != null) { @@ -972,26 +978,6 @@ public void saveTemplates(JComboBox comboBox) { } } - private void nodeSelectionPersistence(AbstractDicomNode node, String key) { - if (node != null) { - getPersistence().setProperty(key, node.getDescription()); - } - } - - private void restoreNodeSelection(ComboBoxModel model, String key) { - if (model != null) { - String desc = getPersistence().getProperty(key); - if (StringUtil.hasText(desc)) { - for (int i = 0; i < model.getSize(); i++) { - if (desc.equals(model.getElementAt(i).getDescription())) { - model.setSelectedItem(model.getElementAt(i)); - break; - } - } - } - } - } - protected void updateChanges() {} protected void stopCurrentProcess() { diff --git a/weasis-dicom/weasis-dicom-send/src/main/java/org/weasis/dicom/send/SendDicomView.java b/weasis-dicom/weasis-dicom-send/src/main/java/org/weasis/dicom/send/SendDicomView.java index 4cc63e1b2..93be63bb4 100755 --- a/weasis-dicom/weasis-dicom-send/src/main/java/org/weasis/dicom/send/SendDicomView.java +++ b/weasis-dicom/weasis-dicom-send/src/main/java/org/weasis/dicom/send/SendDicomView.java @@ -14,6 +14,7 @@ import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JOptionPane; +import javax.swing.JPanel; import org.dcm4che3.net.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,8 +47,10 @@ public class SendDicomView extends ExportDicomView { private static final Logger LOGGER = LoggerFactory.getLogger(SendDicomView.class); private static final String LAST_SEL_NODE = "lastSelNode"; + private static final String LAST_CALLING_NODE = "lastCallingNode"; private final JComboBox comboNode = new JComboBox<>(); + private final JComboBox comboCallingNode = new JComboBox<>(); private AuthMethod authMethod; public SendDicomView(DicomModel dicomModel, CheckTreeModel treeModel) { @@ -59,9 +62,21 @@ public SendDicomView(DicomModel dicomModel, CheckTreeModel treeModel) { public SendDicomView initGUI() { final JLabel lblDest = new JLabel(Messages.getString("SendDicomView.destination") + StringUtil.COLON); + GuiUtils.setPreferredWidth(comboNode, 210, 185); AbstractDicomNode.addTooltipToComboList(comboNode); - add(GuiUtils.getFlowLayoutPanel(ITEM_SEPARATOR_SMALL, 0, lblDest, comboNode)); + JPanel panel = GuiUtils.getFlowLayoutPanel(ITEM_SEPARATOR_SMALL, 0, lblDest, comboNode); + if (comboCallingNode.getItemCount() > 0) { + AbstractDicomNode.addTooltipToComboList(comboCallingNode); + JLabel lblCalling = new JLabel("Calling Node" + StringUtil.COLON); + GuiUtils.setPreferredWidth(comboCallingNode, 160, 120); + + panel.add(GuiUtils.boxHorizontalStrut(ITEM_SEPARATOR_LARGE)); + panel.add(lblCalling); + panel.add(comboCallingNode); + } + + add(panel); add(GuiUtils.boxVerticalStrut(ITEM_SEPARATOR)); super.initGUI(); @@ -72,7 +87,16 @@ protected void initialize() { AbstractDicomNode.loadDicomNodes(comboNode, AbstractDicomNode.Type.DICOM, UsageType.STORAGE); AbstractDicomNode.loadDicomNodes(comboNode, AbstractDicomNode.Type.WEB, UsageType.STORAGE); String desc = SendDicomFactory.EXPORT_PERSISTENCE.getProperty(LAST_SEL_NODE); - AbstractDicomNode.selectDicomNode(comboNode, desc); + AbstractDicomNode.selectDicomNode(comboNode.getModel(), desc); + + String weasisAet = + GuiUtils.getUICore().getSystemPreferences().getProperty("weasis.aet"); // NON-NLS + if (!StringUtil.hasText(weasisAet)) { + AbstractDicomNode.loadDicomNodes( + comboCallingNode, AbstractDicomNode.Type.DICOM_CALLING, UsageType.STORAGE); + String calling = SendDicomFactory.EXPORT_PERSISTENCE.getProperty(LAST_CALLING_NODE); + AbstractDicomNode.selectDicomNode(comboCallingNode.getModel(), calling); + } } public void applyChange() { @@ -80,6 +104,11 @@ public void applyChange() { if (node != null) { SendDicomFactory.EXPORT_PERSISTENCE.setProperty(LAST_SEL_NODE, node.getDescription()); } + final AbstractDicomNode callingNode = (AbstractDicomNode) comboCallingNode.getSelectedItem(); + if (callingNode != null) { + SendDicomFactory.EXPORT_PERSISTENCE.setProperty( + LAST_CALLING_NODE, callingNode.getDescription()); + } } @Override @@ -92,9 +121,13 @@ protected boolean exportAction(List files, DicomProgress dicomProgress) Object selectedItem = comboNode.getSelectedItem(); if (selectedItem instanceof final DefaultDicomNode node) { String weasisAet = - GuiUtils.getUICore() - .getSystemPreferences() - .getProperty("weasis.aet", "WEASIS_AE"); // NON-NLS + GuiUtils.getUICore().getSystemPreferences().getProperty("weasis.aet"); // NON-NLS + if (!StringUtil.hasText(weasisAet)) { + weasisAet = + comboCallingNode.getSelectedItem() == null + ? "WEASIS_AE" + : ((DefaultDicomNode) comboCallingNode.getSelectedItem()).getAeTitle(); + } AdvancedParams params = new AdvancedParams(); ConnectOptions connectOptions = new ConnectOptions(); connectOptions.setConnectTimeout(3000); diff --git a/weasis-distributions/etc/config/base.json b/weasis-distributions/etc/config/base.json index c31d876d0..9d2865f0a 100644 --- a/weasis-distributions/etc/config/base.json +++ b/weasis-distributions/etc/config/base.json @@ -420,8 +420,8 @@ }, { "code": "weasis.aet", - "value": "WEASIS_AE", - "description": "Calling AETitle for DICOM send and DICOM print", + "value": null, + "description": "Calling AETitle for DICOM send and Dicomizer publish. ? null means displaying the DICOM calling node combobox otherwise the combo is not displayed and the value is directly used", "type": "A", "category": "DICOM" }, diff --git a/weasis-distributions/resources/dicomCallingNodes.xml b/weasis-distributions/resources/dicomCallingNodes.xml index 399ac8b8c..794e3fd8a 100755 --- a/weasis-distributions/resources/dicomCallingNodes.xml +++ b/weasis-distributions/resources/dicomCallingNodes.xml @@ -1,5 +1,8 @@ + - + \ No newline at end of file diff --git a/weasis-distributions/script/package-weasis.sh b/weasis-distributions/script/package-weasis.sh index b1c838512..491fcde31 100755 --- a/weasis-distributions/script/package-weasis.sh +++ b/weasis-distributions/script/package-weasis.sh @@ -248,7 +248,7 @@ $JPKGCMD --type app-image --input "$INPUT_DIR" --dest "$OUTPUT_PATH" --name "$NA if [ "$PACKAGE" = "YES" ] ; then VENDOR="Weasis Team" - COPYRIGHT="© 2009-2023 Weasis Team" + COPYRIGHT="© 2009-2024 Weasis Team" if [ "$machine" = "windows" ] ; then [ "$arc" = "x86" ] && UPGRADE_UID="3aedc24e-48a8-4623-ab39-0c3c01c7383b" || UPGRADE_UID="3aedc24e-48a8-4623-ab39-0c3c01c7383a" $JPKGCMD --type "msi" --app-image "$IMAGE_PATH" --dest "$OUTPUT_PATH" --name "$NAME" --resource-dir "$RES/msi/${arc}" \ diff --git a/weasis-launcher/conf/base.json b/weasis-launcher/conf/base.json index 3cfa092dd..831ae8765 100644 --- a/weasis-launcher/conf/base.json +++ b/weasis-launcher/conf/base.json @@ -427,8 +427,8 @@ }, { "code": "weasis.aet", - "value": "WEASIS_AE", - "description": "Calling AETitle for DICOM send and DICOM print", + "value": null, + "description": "Calling AETitle for DICOM send and Dicomizer publish. ? null means displaying the DICOM calling node combobox otherwise the combo is not displayed and the value is directly used", "type": "A", "category": "DICOM" },