3 import java.awt.BorderLayout;
4 import java.awt.Component;
5 import java.awt.Dimension;
6 import java.awt.FlowLayout;
8 import java.awt.Insets;
9 import java.awt.event.ActionEvent;
10 import java.awt.event.ActionListener;
11 import java.text.NumberFormat;
13 import javax.swing.BorderFactory;
14 import javax.swing.Box;
15 import javax.swing.BoxLayout;
16 import javax.swing.JButton;
17 import javax.swing.JComboBox;
18 import javax.swing.JLabel;
19 import javax.swing.JPanel;
20 import javax.swing.JProgressBar;
21 import javax.swing.border.EtchedBorder;
23 import tim.prune.DataSubscriber;
24 import tim.prune.FunctionLibrary;
25 import tim.prune.GenericFunction;
26 import tim.prune.I18nManager;
27 import tim.prune.UpdateMessageBroker;
28 import tim.prune.config.Config;
29 import tim.prune.data.Altitude;
30 import tim.prune.data.AudioClip;
31 import tim.prune.data.Coordinate;
32 import tim.prune.data.DataPoint;
33 import tim.prune.data.Distance;
34 import tim.prune.data.Field;
35 import tim.prune.data.IntegerRange;
36 import tim.prune.data.Photo;
37 import tim.prune.data.Selection;
38 import tim.prune.data.TrackInfo;
41 * Class to hold point details and selection details
42 * as a visual component
44 public class DetailsDisplay extends GenericDisplay
47 private JLabel _indexLabel = null;
48 private JLabel _latLabel = null, _longLabel = null;
49 private JLabel _altLabel = null;
50 private JLabel _timeLabel = null, _speedLabel = null;
51 private JLabel _nameLabel = null, _typeLabel = null;
54 private JLabel _rangeLabel = null;
55 private JLabel _distanceLabel = null;
56 private JLabel _durationLabel = null;
57 private JLabel _altRangeLabel = null, _updownLabel = null;
58 private JLabel _aveSpeedLabel = null;
61 private JPanel _photoDetailsPanel = null;
62 private JLabel _photoLabel = null;
63 private PhotoThumbnail _photoThumbnail = null;
64 private JLabel _photoTimestampLabel = null;
65 private JLabel _photoConnectedLabel = null;
66 private JLabel _photoBearingLabel = null;
67 private JPanel _rotationButtons = null;
70 private JPanel _audioDetailsPanel = null;
71 private JLabel _audioLabel = null;
72 private JLabel _audioConnectedLabel = null;
73 private JLabel _audioTimestampLabel = null;
74 private JLabel _audioLengthLabel = null;
75 private JProgressBar _audioProgress = null;
76 private JPanel _playAudioPanel = null;
79 private JComboBox _coordFormatDropdown = null;
80 private JComboBox _distUnitsDropdown = null;
82 private NumberFormat _distanceFormatter = NumberFormat.getInstance();
85 private static final String LABEL_POINT_SELECTED = I18nManager.getText("details.index.selected") + ": ";
86 private static final String LABEL_POINT_LATITUDE = I18nManager.getText("fieldname.latitude") + ": ";
87 private static final String LABEL_POINT_LONGITUDE = I18nManager.getText("fieldname.longitude") + ": ";
88 private static final String LABEL_POINT_ALTITUDE = I18nManager.getText("fieldname.altitude") + ": ";
89 private static final String LABEL_POINT_TIMESTAMP = I18nManager.getText("fieldname.timestamp") + ": ";
90 private static final String LABEL_POINT_WAYPOINTNAME = I18nManager.getText("fieldname.waypointname") + ": ";
91 private static final String LABEL_POINT_WAYPOINTTYPE = I18nManager.getText("fieldname.waypointtype") + ": ";
92 private static final String LABEL_RANGE_SELECTED = I18nManager.getText("details.range.selected") + ": ";
93 private static final String LABEL_RANGE_DURATION = I18nManager.getText("fieldname.duration") + ": ";
94 private static final String LABEL_RANGE_DISTANCE = I18nManager.getText("fieldname.distance") + ": ";
95 private static final String LABEL_RANGE_ALTITUDE = I18nManager.getText("fieldname.altitude") + ": ";
96 private static final String LABEL_RANGE_CLIMB = I18nManager.getText("details.range.climb") + ": ";
97 private static final String LABEL_RANGE_DESCENT = ", " + I18nManager.getText("details.range.descent") + ": ";
98 private static final String LABEL_AUDIO_FILE = I18nManager.getText("details.audio.file") + ": ";
99 private static String LABEL_POINT_ALTITUDE_UNITS = null;
100 private static Altitude.Format LABEL_POINT_ALTITUDE_FORMAT = Altitude.Format.NO_FORMAT;
105 * @param inTrackInfo Track info object
107 public DetailsDisplay(TrackInfo inTrackInfo)
110 setLayout(new BorderLayout());
112 JPanel mainPanel = new JPanel();
113 mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
114 mainPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
115 Font biggerFont = new JLabel().getFont();
116 biggerFont = biggerFont.deriveFont(Font.BOLD, biggerFont.getSize2D() + 2.0f);
118 // Point details panel
119 JPanel pointDetailsPanel = makeDetailsPanel("details.pointdetails", biggerFont);
120 _indexLabel = new JLabel(I18nManager.getText("details.nopointselection"));
121 pointDetailsPanel.add(_indexLabel);
122 _latLabel = new JLabel("");
123 pointDetailsPanel.add(_latLabel);
124 _longLabel = new JLabel("");
125 pointDetailsPanel.add(_longLabel);
126 _altLabel = new JLabel("");
127 pointDetailsPanel.add(_altLabel);
128 _timeLabel = new JLabel("");
129 _timeLabel.setMinimumSize(new Dimension(120, 10));
130 pointDetailsPanel.add(_timeLabel);
131 _speedLabel = new JLabel("");
132 pointDetailsPanel.add(_speedLabel);
133 _nameLabel = new JLabel("");
134 pointDetailsPanel.add(_nameLabel);
135 _typeLabel = new JLabel("");
136 pointDetailsPanel.add(_typeLabel);
137 pointDetailsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
139 // range details panel
140 JPanel rangeDetailsPanel = makeDetailsPanel("details.rangedetails", biggerFont);
141 _rangeLabel = new JLabel(I18nManager.getText("details.norangeselection"));
142 rangeDetailsPanel.add(_rangeLabel);
143 _distanceLabel = new JLabel("");
144 rangeDetailsPanel.add(_distanceLabel);
145 _durationLabel = new JLabel("");
146 rangeDetailsPanel.add(_durationLabel);
147 _aveSpeedLabel = new JLabel("");
148 rangeDetailsPanel.add(_aveSpeedLabel);
149 _altRangeLabel = new JLabel("");
150 rangeDetailsPanel.add(_altRangeLabel);
151 _updownLabel = new JLabel("");
152 rangeDetailsPanel.add(_updownLabel);
153 rangeDetailsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
155 // photo details panel
156 _photoDetailsPanel = makeDetailsPanel("details.photodetails", biggerFont);
157 _photoLabel = new JLabel(I18nManager.getText("details.nophoto"));
158 _photoDetailsPanel.add(_photoLabel);
159 _photoTimestampLabel = new JLabel("");
160 _photoTimestampLabel.setMinimumSize(new Dimension(120, 10));
161 _photoDetailsPanel.add(_photoTimestampLabel);
162 _photoConnectedLabel = new JLabel("");
163 _photoDetailsPanel.add(_photoConnectedLabel);
164 _photoBearingLabel = new JLabel("");
165 _photoDetailsPanel.add(_photoBearingLabel);
166 _photoThumbnail = new PhotoThumbnail();
167 _photoThumbnail.setVisible(false);
168 _photoThumbnail.setPreferredSize(new Dimension(100, 100));
169 _photoDetailsPanel.add(_photoThumbnail);
171 JButton rotLeft = makeRotateButton(IconManager.ROTATE_LEFT, FunctionLibrary.FUNCTION_ROTATE_PHOTO_LEFT);
172 JButton rotRight = makeRotateButton(IconManager.ROTATE_RIGHT, FunctionLibrary.FUNCTION_ROTATE_PHOTO_RIGHT);
173 JButton popup = makeRotateButton(IconManager.SHOW_DETAILS, FunctionLibrary.FUNCTION_PHOTO_POPUP);
174 _rotationButtons = new JPanel();
175 _rotationButtons.add(rotLeft);
176 _rotationButtons.add(rotRight);
177 _rotationButtons.add(Box.createHorizontalStrut(10));
178 _rotationButtons.add(popup);
179 _rotationButtons.setAlignmentX(Component.LEFT_ALIGNMENT);
180 _rotationButtons.setVisible(false);
181 _photoDetailsPanel.add(_rotationButtons);
182 _photoDetailsPanel.setVisible(false);
184 // audio details panel
185 _audioDetailsPanel = makeDetailsPanel("details.audiodetails", biggerFont);
186 _audioLabel = new JLabel(I18nManager.getText("details.noaudio"));
187 _audioDetailsPanel.add(_audioLabel);
188 _audioTimestampLabel = new JLabel("");
189 _audioTimestampLabel.setMinimumSize(new Dimension(120, 10));
190 _audioDetailsPanel.add(_audioTimestampLabel);
191 _audioLengthLabel = new JLabel("");
192 _audioDetailsPanel.add(_audioLengthLabel);
193 _audioConnectedLabel = new JLabel("");
194 _audioDetailsPanel.add(_audioConnectedLabel);
195 _audioProgress = new JProgressBar(0, 100);
196 _audioProgress.setString(I18nManager.getText("details.audio.playing"));
197 _audioProgress.setStringPainted(true);
198 _audioProgress.setVisible(false);
199 _audioDetailsPanel.add(_audioProgress);
200 _playAudioPanel = new JPanel();
201 _playAudioPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
202 JButton playAudio = makeRotateButton(IconManager.PLAY_AUDIO, FunctionLibrary.FUNCTION_PLAY_AUDIO);
203 playAudio.addActionListener(new AudioListener(_audioProgress));
204 _playAudioPanel.add(playAudio);
205 JButton stopAudio = makeRotateButton(IconManager.STOP_AUDIO, FunctionLibrary.FUNCTION_STOP_AUDIO);
206 _playAudioPanel.add(stopAudio);
207 _playAudioPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
208 _playAudioPanel.setVisible(false);
209 _audioDetailsPanel.add(_playAudioPanel);
210 _audioDetailsPanel.setVisible(false);
212 // add the details panels to the main panel
213 mainPanel.add(pointDetailsPanel);
214 mainPanel.add(Box.createVerticalStrut(5));
215 mainPanel.add(rangeDetailsPanel);
216 mainPanel.add(Box.createVerticalStrut(5));
217 mainPanel.add(_photoDetailsPanel);
218 mainPanel.add(Box.createVerticalStrut(5));
219 mainPanel.add(_audioDetailsPanel);
220 mainPanel.add(Box.createVerticalStrut(5));
221 // add the main panel at the top
222 add(mainPanel, BorderLayout.NORTH);
224 // Add format, units selection
225 JPanel lowerPanel = new JPanel();
226 lowerPanel.setLayout(new BoxLayout(lowerPanel, BoxLayout.Y_AXIS));
227 JLabel coordFormatLabel = new JLabel(I18nManager.getText("details.coordformat") + ": ");
228 coordFormatLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
229 lowerPanel.add(coordFormatLabel);
230 String[] coordFormats = {I18nManager.getText("units.original"), I18nManager.getText("units.degminsec"),
231 I18nManager.getText("units.degmin"), I18nManager.getText("units.deg")};
232 _coordFormatDropdown = new JComboBox(coordFormats);
233 _coordFormatDropdown.addActionListener(new ActionListener() {
234 public void actionPerformed(ActionEvent e)
236 dataUpdated(DataSubscriber.UNITS_CHANGED);
239 lowerPanel.add(_coordFormatDropdown);
240 _coordFormatDropdown.setAlignmentX(Component.LEFT_ALIGNMENT);
241 JLabel unitsLabel = new JLabel(I18nManager.getText("details.distanceunits") + ": ");
242 unitsLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
243 lowerPanel.add(unitsLabel);
244 String[] distUnits = {I18nManager.getText("units.kilometres"), I18nManager.getText("units.miles")};
245 _distUnitsDropdown = new JComboBox(distUnits);
246 if (!Config.getConfigBoolean(Config.KEY_METRIC_UNITS)) {_distUnitsDropdown.setSelectedIndex(1);}
247 _distUnitsDropdown.addActionListener(new ActionListener() {
248 public void actionPerformed(ActionEvent e)
250 Config.setConfigBoolean(Config.KEY_METRIC_UNITS, _distUnitsDropdown.getSelectedIndex() == 0);
251 UpdateMessageBroker.informSubscribers(DataSubscriber.UNITS_CHANGED);
254 lowerPanel.add(_distUnitsDropdown);
255 _distUnitsDropdown.setAlignmentX(Component.LEFT_ALIGNMENT);
256 add(lowerPanel, BorderLayout.SOUTH);
261 * Notification that Track has been updated
262 * @param inUpdateType byte to specify what has been updated
264 public void dataUpdated(byte inUpdateType)
266 // Update current point data, if any
267 DataPoint currentPoint = _trackInfo.getCurrentPoint();
268 Selection selection = _trackInfo.getSelection();
269 if ((inUpdateType | DATA_ADDED_OR_REMOVED) > 0) selection.markInvalid();
270 int currentPointIndex = selection.getCurrentPointIndex();
271 _speedLabel.setText("");
272 Distance.Units distUnits = _distUnitsDropdown.getSelectedIndex()==0?Distance.Units.KILOMETRES:Distance.Units.MILES;
273 String distUnitsStr = I18nManager.getText(_distUnitsDropdown.getSelectedIndex()==0?"units.kilometres.short":"units.miles.short");
274 String speedUnitsStr = I18nManager.getText(_distUnitsDropdown.getSelectedIndex()==0?"units.kmh":"units.mph");
275 if (_track == null || currentPoint == null)
277 _indexLabel.setText(I18nManager.getText("details.nopointselection"));
278 _latLabel.setText("");
279 _longLabel.setText("");
280 _altLabel.setText("");
281 _timeLabel.setText("");
282 _nameLabel.setText("");
283 _typeLabel.setText("");
287 _indexLabel.setText(LABEL_POINT_SELECTED
288 + (currentPointIndex+1) + " " + I18nManager.getText("details.index.of")
289 + " " + _track.getNumPoints());
290 _latLabel.setText(makeCoordinateLabel(LABEL_POINT_LATITUDE, currentPoint.getLatitude(), _coordFormatDropdown.getSelectedIndex()));
291 _longLabel.setText(makeCoordinateLabel(LABEL_POINT_LONGITUDE, currentPoint.getLongitude(), _coordFormatDropdown.getSelectedIndex()));
292 _altLabel.setText(currentPoint.hasAltitude()?
293 (LABEL_POINT_ALTITUDE + currentPoint.getAltitude().getValue() + getAltitudeUnitsLabel(currentPoint.getAltitude().getFormat()))
295 if (currentPoint.getTimestamp().isValid())
297 if (currentPointIndex > 0 && currentPointIndex < (_trackInfo.getTrack().getNumPoints()-1))
299 DataPoint prevPoint = _trackInfo.getTrack().getPoint(currentPointIndex - 1);
300 DataPoint nextPoint = _trackInfo.getTrack().getPoint(currentPointIndex + 1);
301 if (prevPoint.getTimestamp().isValid() && nextPoint.getTimestamp().isValid())
303 // use total distance and total time between neighbouring points
304 long diff = nextPoint.getTimestamp().getSecondsSince(prevPoint.getTimestamp());
305 if (diff < 1000 && diff > 0)
307 double rads = DataPoint.calculateRadiansBetween(prevPoint, currentPoint) +
308 DataPoint.calculateRadiansBetween(currentPoint, nextPoint);
309 double dist = Distance.convertRadiansToDistance(rads, distUnits);
310 String speed = roundedNumber(3600 * dist / diff) + " " + speedUnitsStr;
311 _speedLabel.setText(I18nManager.getText("fieldname.speed") + ": " + speed);
315 _timeLabel.setText(LABEL_POINT_TIMESTAMP + currentPoint.getTimestamp().getText());
318 _timeLabel.setText("");
321 final String name = currentPoint.getWaypointName();
322 if (name != null && !name.equals(""))
324 _nameLabel.setText(LABEL_POINT_WAYPOINTNAME + name);
326 else _nameLabel.setText("");
328 final String type = currentPoint.getFieldValue(Field.WAYPT_TYPE);
329 if (type != null && !type.equals("")) {
330 _typeLabel.setText(LABEL_POINT_WAYPOINTTYPE + type);
332 else _typeLabel.setText("");
335 // Update range details
336 if (_track == null || !selection.hasRangeSelected())
338 _rangeLabel.setText(I18nManager.getText("details.norangeselection"));
339 _distanceLabel.setText("");
340 _durationLabel.setText("");
341 _altRangeLabel.setText("");
342 _updownLabel.setText("");
343 _aveSpeedLabel.setText("");
347 _rangeLabel.setText(LABEL_RANGE_SELECTED
348 + (selection.getStart()+1) + " " + I18nManager.getText("details.range.to")
349 + " " + (selection.getEnd()+1));
350 _distanceLabel.setText(LABEL_RANGE_DISTANCE + roundedNumber(selection.getDistance(distUnits)) + " " + distUnitsStr);
351 if (selection.getNumSeconds() > 0)
353 _durationLabel.setText(LABEL_RANGE_DURATION + DisplayUtils.buildDurationString(selection.getNumSeconds()));
354 _aveSpeedLabel.setText(I18nManager.getText("details.range.avespeed") + ": "
355 + roundedNumber(selection.getDistance(distUnits)/selection.getNumSeconds()*3600.0) + " " + speedUnitsStr);
358 _durationLabel.setText("");
359 _aveSpeedLabel.setText("");
361 String altUnitsLabel = getAltitudeUnitsLabel(selection.getAltitudeFormat());
362 IntegerRange altRange = selection.getAltitudeRange();
363 if (altRange.getMinimum() >= 0 && altRange.getMaximum() >= 0)
365 _altRangeLabel.setText(LABEL_RANGE_ALTITUDE
366 + altRange.getMinimum() + altUnitsLabel + " "
367 + I18nManager.getText("details.altitude.to") + " "
368 + altRange.getMaximum() + altUnitsLabel);
369 _updownLabel.setText(LABEL_RANGE_CLIMB + selection.getClimb() + altUnitsLabel
370 + LABEL_RANGE_DESCENT + selection.getDescent() + altUnitsLabel);
374 _altRangeLabel.setText("");
375 _updownLabel.setText("");
378 // show photo details and thumbnail
379 _photoDetailsPanel.setVisible(_trackInfo.getPhotoList().getNumPhotos() > 0);
380 Photo currentPhoto = _trackInfo.getPhotoList().getPhoto(_trackInfo.getSelection().getCurrentPhotoIndex());
381 if ((currentPoint == null || currentPoint.getPhoto() == null) && currentPhoto == null)
383 // no photo, hide details
384 _photoLabel.setText(I18nManager.getText("details.nophoto"));
385 _photoTimestampLabel.setText("");
386 _photoConnectedLabel.setText("");
387 _photoBearingLabel.setText("");
388 _photoThumbnail.setVisible(false);
389 _rotationButtons.setVisible(false);
393 if (currentPhoto == null) {currentPhoto = currentPoint.getPhoto();}
394 _photoLabel.setText(I18nManager.getText("details.photofile") + ": " + currentPhoto.getName());
395 _photoTimestampLabel.setText(currentPhoto.hasTimestamp()?(LABEL_POINT_TIMESTAMP + currentPhoto.getTimestamp().getText()):"");
396 _photoConnectedLabel.setText(I18nManager.getText("details.media.connected") + ": "
397 + (currentPhoto.getCurrentStatus() == Photo.Status.NOT_CONNECTED ?
398 I18nManager.getText("dialog.about.no"):I18nManager.getText("dialog.about.yes")));
399 if (currentPhoto.getBearing() >= 0.0 && currentPhoto.getBearing() <= 360.0)
401 _photoBearingLabel.setText(I18nManager.getText("details.photo.bearing") + ": "
402 + (int) currentPhoto.getBearing() + " \u00B0");
404 else _photoBearingLabel.setText("");
405 _photoThumbnail.setVisible(true);
406 _photoThumbnail.setPhoto(currentPhoto);
407 _rotationButtons.setVisible(true);
408 if ((inUpdateType & DataSubscriber.PHOTOS_MODIFIED) > 0) {_photoThumbnail.refresh();}
410 _photoThumbnail.repaint();
413 _audioDetailsPanel.setVisible(_trackInfo.getAudioList().getNumAudios() > 0);
414 AudioClip currentAudio = _trackInfo.getAudioList().getAudio(_trackInfo.getSelection().getCurrentAudioIndex());
415 if (currentAudio == null) {
416 _audioLabel.setText(I18nManager.getText("details.noaudio"));
417 _audioTimestampLabel.setText("");
418 _audioLengthLabel.setText("");
419 _audioConnectedLabel.setText("");
423 _audioLabel.setText(LABEL_AUDIO_FILE + currentAudio.getName());
424 _audioTimestampLabel.setText(currentAudio.hasTimestamp()?(LABEL_POINT_TIMESTAMP + currentAudio.getTimestamp().getText()):"");
425 int audioLength = currentAudio.getLengthInSeconds();
426 _audioLengthLabel.setText(audioLength < 0?"":LABEL_RANGE_DURATION + DisplayUtils.buildDurationString(audioLength));
427 _audioConnectedLabel.setText(I18nManager.getText("details.media.connected") + ": "
428 + (currentAudio.getCurrentStatus() == Photo.Status.NOT_CONNECTED ?
429 I18nManager.getText("dialog.about.no"):I18nManager.getText("dialog.about.yes")));
431 _playAudioPanel.setVisible(currentAudio != null);
436 * Choose the appropriate altitude units label for the specified format
437 * @param inFormat altitude format
438 * @return language-sensitive string
440 private static String getAltitudeUnitsLabel(Altitude.Format inFormat)
442 if (inFormat == LABEL_POINT_ALTITUDE_FORMAT && LABEL_POINT_ALTITUDE_UNITS != null)
443 return LABEL_POINT_ALTITUDE_UNITS;
444 LABEL_POINT_ALTITUDE_FORMAT = inFormat;
445 if (inFormat == Altitude.Format.METRES)
446 return " " + I18nManager.getText("units.metres.short");
447 return " " + I18nManager.getText("units.feet.short");
452 * Construct an appropriate coordinate label using the selected format
453 * @param inPrefix prefix of label
454 * @param inCoordinate coordinate
455 * @param inFormat index of format selection dropdown
456 * @return language-sensitive string
458 private static String makeCoordinateLabel(String inPrefix, Coordinate inCoordinate, int inFormat)
463 coord = inCoordinate.output(Coordinate.FORMAT_DEG_MIN_SEC); break;
465 coord = inCoordinate.output(Coordinate.FORMAT_DEG_MIN); break;
467 coord = inCoordinate.output(Coordinate.FORMAT_DEG); break;
468 default: // just as it was
469 coord = inCoordinate.output(Coordinate.FORMAT_NONE);
471 // Fix broken degree signs (due to unicode mangling)
472 final char brokenDeg = 65533;
473 if (coord.indexOf(brokenDeg) >= 0) {
474 coord = coord.replaceAll(String.valueOf(brokenDeg), "\u00B0");
476 return inPrefix + restrictDP(coord);
481 * Format a number to a sensible precision
482 * @param inDist distance
483 * @return formatted String
485 private String roundedNumber(double inDist)
487 // Set precision of formatter
491 else if (inDist < 10.0)
493 else if (inDist < 100.0)
496 _distanceFormatter.setMaximumFractionDigits(numDigits);
497 _distanceFormatter.setMinimumFractionDigits(numDigits);
498 return _distanceFormatter.format(inDist);
502 * Restrict the given coordinate to a limited number of decimal places for display
503 * @param inCoord coordinate string
504 * @return chopped string
506 private static String restrictDP(String inCoord)
508 final int DECIMAL_PLACES = 7;
509 if (inCoord == null) return "";
510 final int dotPos = Math.max(inCoord.lastIndexOf('.'), inCoord.lastIndexOf(','));
512 final int chopPos = dotPos + DECIMAL_PLACES;
513 if (chopPos < (inCoord.length()-1)) {
514 return inCoord.substring(0, chopPos);
521 * Make a details subpanel
522 * @param inNameKey key to use for top label
523 * @param inFont font for top label
524 * @return panel with correct layout, label
526 private static JPanel makeDetailsPanel(String inNameKey, Font inFont)
528 JPanel detailsPanel = new JPanel();
529 detailsPanel.setLayout(new BoxLayout(detailsPanel, BoxLayout.Y_AXIS));
530 detailsPanel.setBorder(BorderFactory.createCompoundBorder(
531 BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(3, 3, 3, 3))
533 JLabel detailsLabel = new JLabel(I18nManager.getText(inNameKey));
534 detailsLabel.setFont(inFont);
535 detailsPanel.add(detailsLabel);
540 * Create a little button for rotating the current photo
541 * @param inIcon icon to use (from IconManager)
542 * @param inFunction function to call (from FunctionLibrary)
543 * @return button object
545 private static JButton makeRotateButton(String inIcon, GenericFunction inFunction)
547 JButton button = new JButton(IconManager.getImageIcon(inIcon));
548 button.setToolTipText(I18nManager.getText(inFunction.getNameKey()));
549 button.setMargin(new Insets(0, 2, 0, 2));
550 button.addActionListener(new FunctionLauncher(inFunction));