MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / showDialog

Method showDialog

ij/src/main/java/ij/gui/PlotDialog.java:70–121  ·  view source on GitHub ↗

Asks the user for axis scaling; then replot with new scale on the same ImageProcessor. The 'parent' frame may be null

(Frame parent)

Source from the content-addressed store, hash-verified

68 /** Asks the user for axis scaling; then replot with new scale on the same ImageProcessor.
69 * The 'parent' frame may be null */
70 public void showDialog(Frame parent) {
71 if (dialogType == HI_RESOLUTION) { //'make high-resolution plot' dialog has no preview, handled separately
72 doHighResolutionDialog(parent);
73 return;
74 }
75 plot.savePlotPlotProperties();
76 if (dialogType == TEMPLATE)
77 plot.savePlotObjects();
78
79 String dialogTitle = dialogType >= X_LEFT && dialogType <= Y_TOP ?
80 "Set Axis Limit..." : (HEADINGS[dialogType] + "...");
81 GenericDialog gd = parent == null ? new GenericDialog(dialogTitle) :
82 new GenericDialog(dialogTitle, parent);
83 if (!setupDialog(gd)) return;
84 gd.addDialogListener(this);
85 dialogItemChanged(gd, null); //preview immediately
86 dialogShowing = true;
87 gd.showDialog();
88 if (gd.wasCanceled()) {
89 plot.restorePlotProperties();
90 if (dialogType == TEMPLATE)
91 plot.restorePlotObjects();
92 plot.update();
93 } else {
94 if (IJ.recording())
95 record();
96 String xAxisLabel = plot.getLabel('x');
97 if ((dialogType == AXIS_OPTIONS || dialogType == X_AXIS) && xAxisLabel != null && xAxisLabel.length() > 0)
98 lastXLabel = xAxisLabel; //remember for next time, in case we have none
99 String yAxisLabel = plot.getLabel('y');
100 if ((dialogType == AXIS_OPTIONS || dialogType == Y_AXIS) && yAxisLabel != null && yAxisLabel.length() > 0)
101 lastYLabel = yAxisLabel;
102 if (dialogType == SET_RANGE || dialogType == X_AXIS || dialogType == Y_AXIS)
103 plot.makeLimitsDefault();
104 if (dialogType == TEMPLATE)
105 lastTemplateFlags = plot.templateFlags;
106
107 }
108 plot.killPlotPropertiesSnapshot();
109 if (dialogType == TEMPLATE)
110 plot.killPlotObjectsSnapshot();
111
112 ImagePlus imp = plot.getImagePlus();
113 ImageWindow win = imp == null ? null : imp.getWindow();
114 if (win instanceof PlotWindow)
115 ((PlotWindow)win).hideRangeArrows(); // arrows etc might be still visible, but the mouse maybe elsewhere
116
117 if (!gd.wasCanceled() && !gd.wasOKed()) { // user has pressed "Set all limits" or "Set Axis Options" button
118 int newDialogType = (dialogType == SET_RANGE) ? AXIS_OPTIONS : SET_RANGE;
119 new PlotDialog(plot, newDialogType).showDialog(parent);
120 }
121 }
122
123 /** Setting up the dialog fields and initial parameters. The input is read in the dialogItemChanged method, which must
124 * have exactly the same structure of 'if' blocks and matching 'get' methods for each input field.

Callers

nothing calls this directly

Calls 15

setupDialogMethod · 0.95
addDialogListenerMethod · 0.95
dialogItemChangedMethod · 0.95
showDialogMethod · 0.95
wasCanceledMethod · 0.95
recordingMethod · 0.95
recordMethod · 0.95
getWindowMethod · 0.95
wasOKedMethod · 0.95
savePlotObjectsMethod · 0.80

Tested by

no test coverage detected