/** Creates the main window and configures it according to persisted configuration. */ public void createMainFrame() { GUI gUI = configuration.getgUI(); Rectangle sizeAndLocation = gUI.getImageConflictViewer().getSizeAndLocation(); this.setSize(sizeAndLocation.getSize()); Point xyFromConfig = new Point(sizeAndLocation.getLocation()); if (Screen.isVisibleOnScreen(sizeAndLocation)) { this.setLocation(xyFromConfig); this.setSize(sizeAndLocation.getSize()); } else { JOptionPane.showMessageDialog( null, lang.get("errormessage.maingui.locationError"), lang.get("errormessage.maingui.errorMessageLabel"), JOptionPane.ERROR_MESSAGE); logger.logERROR( "Could not set location of Image Conflict Viewer GUI to: x = " + xyFromConfig.x + " and y = " + xyFromConfig.y + " since that is outside of available screen size."); this.setLocation(0, 0); this.setSize( GUIDefaults.IMAGE_CONFLICT_VIEWER_WIDTH, GUIDefaults.IMAGE_CONFLICT_VIEWER_HEIGHT); } try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { logger.logERROR("Could not set desired Look And Feel for Image Conflict Viewer GUI"); logger.logERROR(e); } this.setTitle(lang.get("imagemerge.gui.conflict.viewer.title")); this.setModalityType(ModalityType.APPLICATION_MODAL); this.getContentPane().add(this.createThumbNailsBackgroundPanel(), BorderLayout.CENTER); }
/** * Constructor, creates an initiates this GUI component. * * @param md5ToFileListMap is the container that contains JPEG images grouped by their MD5 sum. * All keys in the {@link Map} that has more than one entry in the value {@link List}:s will * be displayed by this GUI. */ public ImageMergeConflictViewer(Map<String, List<File>> md5ToFileListMap) { configuration = Config.getInstance().get(); logger = Logger.getInstance(); lang = Language.getInstance(); maxNrOfConflicts = getMaxNrOfConflicts(md5ToFileListMap); this.createMainFrame(); this.addListeners(); this.initiateGUI(md5ToFileListMap); }
public void setColumns() { this.setColumnCount(0); this.addColumn(lang.get("information.panel.columnNameFileName")); this.addColumn(lang.get("variable.pictureDate")); this.addColumn(lang.get("variable.pictureTime")); this.addColumn(lang.get("variable.cameraModel")); this.addColumn(lang.get("variable.shutterSpeed")); this.addColumn(lang.get("variable.isoValue")); this.addColumn(lang.get("variable.pictureWidth")); this.addColumn(lang.get("variable.pictureHeight")); this.addColumn(lang.get("variable.apertureValue")); }
public static void createAndWriteToFile(DefaultListModel<File> images, File file, Language lang) { boolean success = true; StringBuilder sb = new StringBuilder(512); if (FileUtil.createFile(file)) { for (int i = 0; i < images.size(); i++) { sb.append(images.get(i).getAbsolutePath() + C.LS); } try { FileUtil.writeToFile(file, sb.toString(), true); } catch (IOException e) { success = false; logger.logERROR("Could not write to file: " + file.getAbsolutePath()); logger.logERROR(e); } } else { success = false; logger.logERROR("Could not create file: " + file.getAbsolutePath()); } if (success) { JOptionPane.showMessageDialog( null, lang.get("maingui.tabbedpane.imagelist.imagelistformat.javaPEG.successfullySaved"), "", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog( null, lang.get("maingui.tabbedpane.imagelist.imagelistformat.javaPEG.notSuccessfullySaved"), "", JOptionPane.ERROR_MESSAGE); } }
public void addTableRow(MetaData metaData) { String noValue = lang.get("common.missing.value"); Object[] meta = new Object[9]; meta[0] = MetaDataUtil.hasValue(metaData.getFileName()) ? metaData.getFileName() : noValue; meta[1] = MetaDataUtil.hasValue(metaData.getExifDateAsString()) ? metaData.getExifDateAsString() : noValue; meta[2] = MetaDataUtil.hasValue(metaData.getExifTimeAsString()) ? metaData.getExifTimeAsString() : noValue; meta[3] = MetaDataUtil.hasValue(metaData.getExifCameraModel()) ? metaData.getExifCameraModel() : noValue; meta[4] = MetaDataUtil.hasValue(metaData.getExifExposureTime()) ? metaData.getExifExposureTime() : noValue; meta[5] = MetaDataUtil.hasValue(metaData.getExifISOValue()) ? metaData.getExifISOValue() : noValue; meta[6] = MetaDataUtil.hasValue(metaData.getExifPictureWidth()) ? metaData.getExifPictureWidth() : noValue; meta[7] = MetaDataUtil.hasValue(metaData.getExifPictureHeight()) ? metaData.getExifPictureHeight() : noValue; meta[8] = MetaDataUtil.hasValue(metaData.getExifFNumber()) ? metaData.getExifFNumber() : noValue; this.addRow(meta); }
public class MetaDataTableModel extends DefaultTableModel { private static final long serialVersionUID = 1L; private final Language lang = Language.getInstance(); public void setColumns() { this.setColumnCount(0); this.addColumn(lang.get("information.panel.columnNameFileName")); this.addColumn(lang.get("variable.pictureDate")); this.addColumn(lang.get("variable.pictureTime")); this.addColumn(lang.get("variable.cameraModel")); this.addColumn(lang.get("variable.shutterSpeed")); this.addColumn(lang.get("variable.isoValue")); this.addColumn(lang.get("variable.pictureWidth")); this.addColumn(lang.get("variable.pictureHeight")); this.addColumn(lang.get("variable.apertureValue")); } public void setTableContent(Vector<Vector<String>> dataVector) { this.setRowCount(0); for (Vector<String> rowData : dataVector) { this.addRow(rowData); } } public void addTableRow(MetaData metaData) { String noValue = lang.get("common.missing.value"); Object[] meta = new Object[9]; meta[0] = MetaDataUtil.hasValue(metaData.getFileName()) ? metaData.getFileName() : noValue; meta[1] = MetaDataUtil.hasValue(metaData.getExifDateAsString()) ? metaData.getExifDateAsString() : noValue; meta[2] = MetaDataUtil.hasValue(metaData.getExifTimeAsString()) ? metaData.getExifTimeAsString() : noValue; meta[3] = MetaDataUtil.hasValue(metaData.getExifCameraModel()) ? metaData.getExifCameraModel() : noValue; meta[4] = MetaDataUtil.hasValue(metaData.getExifExposureTime()) ? metaData.getExifExposureTime() : noValue; meta[5] = MetaDataUtil.hasValue(metaData.getExifISOValue()) ? metaData.getExifISOValue() : noValue; meta[6] = MetaDataUtil.hasValue(metaData.getExifPictureWidth()) ? metaData.getExifPictureWidth() : noValue; meta[7] = MetaDataUtil.hasValue(metaData.getExifPictureHeight()) ? metaData.getExifPictureHeight() : noValue; meta[8] = MetaDataUtil.hasValue(metaData.getExifFNumber()) ? metaData.getExifFNumber() : noValue; this.addRow(meta); } }