file_name
stringlengths
6
86
file_path
stringlengths
45
249
content
stringlengths
47
6.26M
file_size
int64
47
6.26M
language
stringclasses
1 value
extension
stringclasses
1 value
repo_name
stringclasses
767 values
repo_stars
int64
8
14.4k
repo_forks
int64
0
1.17k
repo_open_issues
int64
0
788
repo_created_at
stringclasses
767 values
repo_pushed_at
stringclasses
767 values
UpdaterTest.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/test/java/com/github/cypher/model/UpdaterTest.java
package com.github.cypher.model; import org.junit.Test; import static org.junit.Assert.assertTrue; public class UpdaterTest { public class Counter implements Updater.Updatable{ private int counter = 0; public void update(){ counter++; } public int getCount(){ return counter; } public void reset(){ counter = 0; } } @Test public void updaterTest(){ // Create a set of counter Counter c1 = new Counter(); Counter c2 = new Counter(); Counter c3 = new Counter(); // Loop until test can be performed without interrupts boolean interrupted = true; while (interrupted) { interrupted = false; Updater u = new Updater(1); // Reset counters and make them listen for updates c1.reset(); c2.reset(); c3.reset(); u.add(1, c1); u.add(2, c2); u.add(3, c3); // Start the updater u.start(); // Remove one counter mid running try { Thread.sleep(10); u.remove(c3); Thread.sleep(10); } catch (InterruptedException err) { interrupted = true; } u.interrupt(); } // Make sure all counters were set to expected values assertTrue("Individual speed not working", c2.getCount()*2 <= c1.getCount()+2); assertTrue("Individual speed not working", c2.getCount()*2 >= c1.getCount()-2); assertTrue("Object was not removed from loop", c3.getCount() < c1.getCount()); } }
1,372
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Main.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/Main.java
package com.github.cypher; import com.airhacks.afterburner.injection.Injector; import com.github.cypher.gui.Executor; import com.github.cypher.gui.root.RootView; import com.github.cypher.model.Client; import com.github.cypher.model.ModelFactory; import com.github.cypher.settings.Settings; import com.github.cypher.settings.TOMLSettings; import com.google.common.eventbus.EventBus; import dorkbox.systemTray.MenuItem; import dorkbox.systemTray.SystemTray; import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.stage.Stage; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.ResourceBundle; import static com.github.cypher.Util.getUserDataDirectoryPath; public class Main extends Application { private static final String APPLICATION_NAME = "Cypher"; private static final String USER_DATA_DIRECTORY = getUserDataDirectoryPath(APPLICATION_NAME); //The path to the folder where settings, credentials etc are saved. private static final String SETTINGS_NAMESPACE = "com.github.cypher.settings"; private static final int MIN_WINDOW_WIDTH = 650; private static final int MIN_WINDOW_HEIGHT = 438; private final Settings settings = new TOMLSettings(USER_DATA_DIRECTORY); private final Executor executor = new Executor(); private final EventBus eventBus = new EventBus(); private final Client client = ModelFactory.createClient(settings, eventBus, USER_DATA_DIRECTORY, SETTINGS_NAMESPACE); private boolean systemTrayInUse; @Override public void start(Stage primaryStage) { Locale.setDefault(settings.getLanguage()); systemTrayInUse = settings.getUseSystemTray(); // Starts the Executors thread executor.start(); // Dependency injection with afterburner.fx // // key is name of injected variable & value is injected object Map<String, Object> customProperties = new HashMap<>(); customProperties.put("client", client); // This corresponds to the line @Inject Client client; in the Presenters customProperties.put("settings", settings); customProperties.put("executor", executor); customProperties.put("eventBus", eventBus); Injector.setConfigurationSource(customProperties::get); RootView rootView = new RootView(); Scene scene = new Scene(rootView.getView()); final String cssMain = getClass().getResource("main.css").toExternalForm(); final String cssScroll = getClass().getResource("scrollbars.css").toExternalForm(); scene.getStylesheets().add(cssMain); scene.getStylesheets().add(cssScroll); scene.getStylesheets().add("bootstrapfx.css"); primaryStage.setTitle("Cypher"); primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/icon.png"))); primaryStage.setScene(scene); if (settings.getMaximized()) { primaryStage.setMaximized(true); } else { if (settings.getLastWindowPosX() != -1 && settings.getLastWindowPosY() != -1) { primaryStage.setX(settings.getLastWindowPosX()); primaryStage.setY(settings.getLastWindowPosY()); } if (settings.getLastWindowWidth() != -1 && settings.getLastWindowHeight() != -1) { primaryStage.setWidth(settings.getLastWindowWidth()); primaryStage.setHeight(settings.getLastWindowHeight()); } } primaryStage.setMinWidth(MIN_WINDOW_WIDTH); primaryStage.setMinHeight(MIN_WINDOW_HEIGHT); // addSystemTray sets its own "onCloseRequest" on the primaryStage if (useSystemTray()) { addSystemTray(primaryStage); } else { primaryStage.setOnCloseRequest(event -> { exit(primaryStage); }); } primaryStage.show(); } private boolean useSystemTray() { return systemTrayInUse && SystemTray.get() != null; } private void addSystemTray(Stage primaryStage) { // Load systemtray SystemTray systemTray = SystemTray.get(); if (systemTray == null) { throw new RuntimeException("Unable to load SystemTray!"); } // Load labels from bundle ResourceBundle labels = ResourceBundle.getBundle("com.github.cypher.labels", Locale.getDefault()); // Make sure application doesn't exit when main window is closed Platform.setImplicitExit(false); // Set image and status systemTray.setImage(getClass().getResourceAsStream("/icon.png")); systemTray.setStatus("Cypher"); /* The "SHOW" menu item */ MenuItem showMenuItem = new MenuItem(labels.getString("show")); showMenuItem.setCallback(e -> { Platform.runLater(() -> { primaryStage.show(); primaryStage.requestFocus(); showMenuItem.setEnabled(false); }); }); showMenuItem.setShortcut('o'); showMenuItem.setEnabled(false); systemTray.getMenu().add(showMenuItem); /* The "EXIT" menu item */ MenuItem exitMenuItem = new MenuItem(labels.getString("exit"), e -> { exit(primaryStage); }); exitMenuItem.setShortcut('q'); systemTray.getMenu().add(exitMenuItem); // Only hide close the main window if system tray is enabled and supported. primaryStage.setOnCloseRequest(event -> { if (systemTrayInUse) { primaryStage.close(); showMenuItem.setEnabled(true); } else { exit(primaryStage); } }); } public static void main(String[] args) { launch(args); } private void exit(Stage primaryStage) { if (primaryStage.isMaximized()) { settings.setMaximized(true); } else { settings.setLastWindowPosX((int) primaryStage.getX()); settings.setLastWindowPosY((int) primaryStage.getY()); settings.setLastWindowWidth((int) primaryStage.getWidth()); settings.setLastWindowHeight((int) primaryStage.getHeight()); } client.exit(); Platform.exit(); System.exit(0); } }
5,612
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Util.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/Util.java
package com.github.cypher; import java.io.*; public final class Util { // Util class shouldn't be creatable private Util(){} static String capitalize(String name) { return name.substring(0, 1).toUpperCase() + name.substring(1); } static String decapitalize(String name) { return name.substring(0, 1).toLowerCase() + name.substring(1); } // Creates the user data folder path static String getUserDataDirectoryPath(String applicationName) { if (System.getenv("XDG_CONFIG_HOME") != null){ // XDG Base Directory Specification return System.getProperty("XDG_CONFIG_HOME") + File.separator + "." + decapitalize(applicationName); } else if (System.getenv("APPDATA") != null) { // Windows default return System.getenv("APPDATA") + File.separator + capitalize(applicationName); } else { // Unix default return System.getProperty("user.home") + File.separator + ".config" + File.separator + decapitalize(applicationName); } } }
997
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
PropertyChangeEvent.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/PropertyChangeEvent.java
package com.github.cypher.sdk; import com.github.cypher.sdk.api.ApiLayer; public class PropertyChangeEvent<T> extends Event { private final String property; private final T value; PropertyChangeEvent(ApiLayer api, int originServerTs, User sender, String eventId, String type, int age, String property, T value) { super(api, originServerTs, sender, eventId, type, age); this.property = property; this.value = value; } public String getProperty() { return property; } public T getValue() { return value; } }
529
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
PermissionTable.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/PermissionTable.java
package com.github.cypher.sdk; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import java.io.IOException; import java.util.HashMap; import java.util.Map; public class PermissionTable { private final int sendEvents; private final int invite; private final int setState; private final int redact; private final int ban; private final int defaultPower; private final int kick; private final Map<String, Integer> specialEvents; public PermissionTable(int sendEvents, int invite, int setState, int redact, int ban, int defaultPower, int kick, Map<String, Integer> specialEvents) { this.sendEvents = sendEvents; this.invite = invite; this.setState = setState; this.redact = redact; this.ban = ban; this.defaultPower = defaultPower; this.kick = kick; this.specialEvents = new HashMap<String, Integer>(specialEvents); } public PermissionTable(JsonObject data) throws IOException { if(data.has("events_default") && data.has("invite" ) && data.has("state_default" ) && data.has("redact" ) && data.has("ban" ) && data.has("users_default" ) && data.has("kick" )) { sendEvents = data.get("events_default").getAsInt(); invite = data.get("invite" ).getAsInt(); setState = data.get("state_default" ).getAsInt(); redact = data.get("redact" ).getAsInt(); ban = data.get("ban" ).getAsInt(); defaultPower = data.get("users_default" ).getAsInt(); kick = data.get("kick" ).getAsInt(); } else { throw new IOException("Invalid PermissionTable json data: " + data.toString()); } specialEvents = new HashMap<>(0); if(data.has("events") && data.get("events").isJsonObject()) { for(Map.Entry<String, JsonElement> entry : data.get("events").getAsJsonObject().entrySet()) { specialEvents.put( entry.getKey(), entry.getValue().getAsInt() ); } } } public int getSendEvents() { return sendEvents; } public int getInvite() { return invite; } public int getSetState() { return setState; } public int getRedact() { return redact; } public int getBan() { return ban; } public int getDefaultPower() { return defaultPower; } public int getKick() { return kick; } public Map<String, Integer> getSpecialEvents() { return new HashMap<String, Integer>(specialEvents); } }
2,438
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Member.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/Member.java
package com.github.cypher.sdk; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.value.ChangeListener; /** * Represents the membership of a User in a Room */ public class Member { private final User user; private final IntegerProperty privilege; Member(User user) { this.user = user; this.privilege = new SimpleIntegerProperty(0); } Member(User user, int privilege) { this.user = user; this.privilege = new SimpleIntegerProperty(privilege); } public User getUser() { return user; } public void addPrivilegeListener(ChangeListener<? super Number> listener) { privilege.addListener(listener); } public void removePrivilegeListener(ChangeListener<? super Number> listener) { privilege.removeListener(listener); } public int getPrivilege() { return privilege.get(); } IntegerProperty privilegeProperty() { return privilege; } @Override public boolean equals(Object o) { return o instanceof Member && user.equals(((Member)o).user); } @Override public int hashCode() { return user.hashCode(); } }
1,116
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Event.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/Event.java
package com.github.cypher.sdk; import com.github.cypher.sdk.api.ApiLayer; public class Event { protected final ApiLayer api; private final long originServerTs; private final User sender; private final String eventId; private final String type; private final int age; Event(ApiLayer api, long originServerTs, User sender, String eventId, String type, int age) { this.api = api; this.originServerTs = originServerTs; this.sender = sender; this.eventId = eventId; this.type = type; this.age = age; } public long getOriginServerTs(){ return originServerTs; } public User getSender() { return sender; } public String getEventId() { return eventId; } public String getType() { return type; } public int getAge() { return age; } }
844
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
SdkFactory.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/SdkFactory.java
package com.github.cypher.sdk; import com.github.cypher.sdk.api.MatrixApiLayer; import com.github.cypher.sdk.api.Util; import java.net.URL; public final class SdkFactory { private SdkFactory(){} public static Client createClient(String settingsNamespace){ setupApiLayer(); return new Client(new MatrixApiLayer(), settingsNamespace); } private static void setupApiLayer() { try { URL.setURLStreamHandlerFactory(new Util.MatrixMediaURLStreamHandlerFactory()); } catch (Error e) { return; // Operation only permitted once; catching for harness. } } }
573
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Client.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/Client.java
package com.github.cypher.sdk; import com.github.cypher.sdk.api.ApiLayer; import com.github.cypher.sdk.api.RestfulHTTPException; import com.github.cypher.sdk.api.Session; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.sun.javafx.collections.ObservableMapWrapper; import javafx.collections.FXCollections; import javafx.collections.MapChangeListener; import javafx.collections.ObservableMap; import java.io.IOException; import java.util.HashMap; import java.util.Map; /** * This class takes an ApiLayer object and parses * the data it returns into usable objects */ public class Client { private final ApiLayer api; private String lastSyncMarker = null; private final String settingsNamespace; private final Repository<User> users; private final ObservableMap<String, String> accountData = FXCollections.synchronizedObservableMap(new ObservableMapWrapper<>(new HashMap<>())); private final ObservableMap<String, Room> joinRooms = FXCollections.synchronizedObservableMap(new ObservableMapWrapper<>(new HashMap<>())); private final ObservableMap<String, Room> inviteRooms = FXCollections.synchronizedObservableMap(new ObservableMapWrapper<>(new HashMap<>())); private final ObservableMap<String, Room> leaveRooms = FXCollections.synchronizedObservableMap(new ObservableMapWrapper<>(new HashMap<>())); public void addJoinRoomsListener (MapChangeListener<String, Room> listener) { joinRooms.addListener(listener); } public void removeJoinRoomsListener (MapChangeListener<String, Room> listener) { joinRooms.removeListener(listener); } public void addInviteRoomsListener (MapChangeListener<String, Room> listener) { inviteRooms.addListener(listener); } public void removeInviteRoomsListener(MapChangeListener<String, Room> listener) { inviteRooms.removeListener(listener); } public void addLeaveRoomsListener (MapChangeListener<String, Room> listener) { leaveRooms.addListener(listener); } public void removeLeaveRoomsListener (MapChangeListener<String, Room> listener) { leaveRooms.removeListener(listener); } public void addAccountDataListener (MapChangeListener<String, String> listener) { accountData.addListener(listener); } public void removeAccountDataListener(MapChangeListener<String, String> listener) { accountData.removeListener(listener); } /** * @see com.github.cypher.sdk.api.ApiLayer * @throws IOException */ Client(ApiLayer api, String settingsNamespace) { this.api = api; this.settingsNamespace = settingsNamespace; users = new Repository<>((String id) -> { return new User(api, id); }); } public Session getSession() { return api.getSession(); } public User getUser(String id){ return this.users.get(id); } public void setSession(Session session) { api.setSession(session); } /** * Call ApiLayer.login(...) * @see com.github.cypher.sdk.api.ApiLayer#login(String, String, String) * @throws RestfulHTTPException * @throws IOException */ public void login(String username, String password, String homeserver) throws RestfulHTTPException, IOException { api.login(username, password, homeserver); } /** * Call ApiLayer.logout(...) * @see com.github.cypher.sdk.api.ApiLayer#logout() * @throws RestfulHTTPException * @throws IOException */ public void logout() throws RestfulHTTPException, IOException { api.logout(); } /** * Call ApiLayer.register(...) * @see com.github.cypher.sdk.api.ApiLayer#register(String, String, String) * @throws RestfulHTTPException * @throws IOException */ public void register(String username, String password, String homeserver) throws RestfulHTTPException, IOException { api.register(username, password, homeserver); } /** * Call ApiLayer.sync(...) and parse the returned data. * <p>Presence-data is used to update the map of users: {@link #getUser(String)}</p> * <p>Join-data is used to update the map of rooms the user has joined: {@link #getJoinRooms()}.</p> * <p>All room maps are observable using the various add*RoomsListener(...) methods</p> * @see com.github.cypher.sdk.api.ApiLayer#sync(String, String, boolean, ApiLayer.Presence, int) * @throws RestfulHTTPException * @throws IOException */ public void update(int timeout) throws RestfulHTTPException, IOException { JsonObject syncData = api.sync(null, lastSyncMarker, lastSyncMarker == null, ApiLayer.Presence.ONLINE, timeout); if(syncData.has("next_batch")) { lastSyncMarker = syncData.get("next_batch").getAsString(); } parsePresenceEvents(syncData); parseRoomEvents(syncData); parseAccountDataEvents(syncData); } public void joinRoom(String roomIdorAlias) throws RestfulHTTPException, IOException{ api.postJoinRoomIdorAlias(roomIdorAlias, null); } /** * Get the rooms which the user has joined * @return A map of Room objects */ public Map<String, Room> getJoinRooms() { return new HashMap<>(joinRooms); } /** * Get the rooms which the user has been invited to * @return A map of Room objects */ public Map<String, Room> getInviteRooms() { return new HashMap<>(inviteRooms); } /** * Get the rooms which the user has left * @return A map of Room objects */ public Map<String, Room> getLeaveRooms() { return new HashMap<>(leaveRooms); } /** * Get a map of the public rooms listed in a servers room directory * @param server The matrix home server from which to read the room directory (e.g. "matrix.org", "example.org:8448") * @return A map of Room objects * @see com.github.cypher.sdk.api.ApiLayer#getPublicRooms(String) * @throws RestfulHTTPException * @throws IOException */ public Map<String, Room> getPublicRooms(String server) throws RestfulHTTPException, IOException { JsonObject data = api.getPublicRooms(server); Map<String, Room> listedRooms = new HashMap<>(); // Get data chunk if(data.has("chunk") && data.get("chunk").isJsonArray()) { JsonArray directoryArray = data.get("chunk").getAsJsonArray(); // Iterate over datachunks for(JsonElement roomElement : directoryArray) { // Collect room data if(roomElement.isJsonObject()) { JsonObject roomData = roomElement.getAsJsonObject(); // Construct room object if(roomData.has("room_id")) { String roomId = roomData.get("room_id").getAsString(); Room room = new Room(api, users, roomId); room.update(roomData); listedRooms.put(roomId, room); } } } } return listedRooms; } public String getSetting(String key) { return accountData.get(key); } public void setSetting(String key, String value) { // TODO } public User getActiveUser(){ return getUser(getSession().getUserId()); } private void parsePresenceEvents(JsonObject syncData) { if(syncData.has("presence")) { JsonObject presenceData = syncData.get("presence").getAsJsonObject(); if(presenceData.has("events")) { JsonArray presenceEvents = presenceData.get("events").getAsJsonArray(); for(JsonElement eventElement : presenceEvents) { JsonObject eventObject = eventElement.getAsJsonObject(); if(eventObject.has("sender")) { User user = users.get(eventObject.get("sender").getAsString()); user.update(eventObject); } } } } } private void parseRoomEvents(JsonObject syncData) throws RestfulHTTPException, IOException { if(syncData.has("rooms") && syncData.get("rooms").isJsonObject()) { JsonObject roomsData = syncData.get("rooms").getAsJsonObject(); if(roomsData.has("join") && roomsData.get("join").isJsonObject()) { JsonObject joinEvents = roomsData.get("join").getAsJsonObject(); for(Map.Entry<String, JsonElement> joinEventEntry : joinEvents.entrySet()) { if(joinEventEntry.getValue().isJsonObject()) { String roomId = joinEventEntry.getKey(); JsonObject joinEvent = joinEventEntry.getValue().getAsJsonObject(); Room room; if(joinRooms.containsKey(roomId)) { room = joinRooms.get(roomId); }else{ room = new Room(api, users, roomId); } room.update(joinEvent); joinRooms.put(roomId, room); } } } // TODO: "leave"-rooms // TODO: "invite"-rooms } } private void parseAccountDataEvents(JsonObject syncData) { if(syncData.has("account_data") && syncData.get("account_data").isJsonObject()) { JsonObject accountDataObject = syncData.get("account_data").getAsJsonObject(); if(accountDataObject.has("events") && accountDataObject.get("events").isJsonArray()) { JsonArray accountDataEvents = accountDataObject.get("events").getAsJsonArray(); for(JsonElement eventElement : accountDataEvents) { if(eventElement.isJsonObject()) { JsonObject event = eventElement.getAsJsonObject(); parseAccountDataEvent(event); } } } } } private void parseAccountDataEvent(JsonObject event) { if(event.has("type") && event.has("content") && event.get("type").isJsonPrimitive() && event.get("content").isJsonObject()) { String type = event.get("type").getAsString(); JsonObject eventContent = event.get("content").getAsJsonObject(); if(type.equals(settingsNamespace)) { for(Map.Entry<String, JsonElement> setting : eventContent.entrySet()) { String settingKey = setting.getKey(); String settingValue = setting.getValue().getAsString(); accountData.put(settingKey, settingValue); } } } } }
9,490
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Repository.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/Repository.java
package com.github.cypher.sdk; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class Repository<T> { private final Map<String, T> storage = new ConcurrentHashMap<>(); private final Factory<? extends T> factory; interface Factory<K>{ K get(String id); } Repository(Factory<? extends T> factory){ this.factory = factory; } /** * This method returns an existing object if possible, * otherwise it creates and stores a new one. * @param id The unique ID of the object * @return A object */ public T get(String id) { if(storage.containsKey(id)) { return storage.get(id); } T object = factory.get(id); storage.put(id, object); return object; } }
709
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
User.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/User.java
package com.github.cypher.sdk; import com.github.cypher.sdk.api.ApiLayer; import com.github.cypher.sdk.api.RestfulHTTPException; import com.google.gson.JsonObject; import javafx.beans.property.*; import javafx.beans.value.ChangeListener; import javax.imageio.ImageIO; import java.awt.*; import java.io.IOException; import java.net.URL; import java.util.*; /** * Represents a Matrix user * <p>User objects are returned by the methods of a Client or a Member object</p> */ public class User { public enum Presence{ONLINE, OFFLINE, UNAVAILABLE}; protected final ApiLayer api; protected final String id; protected final StringProperty name = new SimpleStringProperty(null); protected final ObjectProperty<URL> avatarUrl = new SimpleObjectProperty<>(null); protected final ObjectProperty<Image> avatar = new SimpleObjectProperty<>(null); private boolean avatarWanted = false; private final Object avatarLock = new Object(); protected final ObjectProperty<Presence> presence = new SimpleObjectProperty<>(null); protected final BooleanProperty isActive = new SimpleBooleanProperty(false); protected final LongProperty lastActiveAgo = new SimpleLongProperty(0); private int avatarSize=24; private URL loadedAvatarUrl = null; private int loadedAvatarSize = 0; private final java.util.List<ChangeListener<? super Image>> avatarListeners = new ArrayList<>(); User(ApiLayer api, String id) { this.api = api; this.id = id; } User(ApiLayer api, String id, String name, URL avatarUrl, Boolean isActive, Long lastActiveAgo) { this.api = api; this.id = id; this.name.set(name); this.avatarUrl.set(avatarUrl); this.isActive.set(isActive); this.lastActiveAgo.set(lastActiveAgo); } /** * Get the user display name and avatar from the ApiLayer * @see com.github.cypher.sdk.api.ApiLayer#getUserProfile(String) * @throws RestfulHTTPException * @throws IOException */ public void update() throws RestfulHTTPException, IOException { JsonObject profile = api.getUserProfile(id); if(profile.has("displayname") && profile.get("displayname").isJsonPrimitive()) { name.set(profile.get("displayname").getAsString()); } //setAvatar(profile); } void update(JsonObject data) { if(data.has("type") && data.has("content")) { String type = data.get("type").getAsString(); JsonObject contentObject = data.get("content").getAsJsonObject(); // Parse presence data if("m.presence".equals(type) && contentObject.has("presence")) { String presenceString = contentObject.get("presence").getAsString(); presence.set(Presence.ONLINE); if("offline".equals(presenceString)) { presence.set(Presence.OFFLINE); } else if("unavailable".equals(presenceString)) { presence.set(Presence.UNAVAILABLE); } } // Parse member data if ("m.room.member".equals(type)){ if (contentObject.has("displayname") && contentObject.get("displayname").isJsonPrimitive()) { name.set(contentObject.get("displayname").getAsString()); } if(avatar.getValue() == null) { setAvatar(contentObject); } } } } private void setAvatar(JsonObject contentObject) { if(contentObject.has("avatar_url") && contentObject.get("avatar_url").isJsonPrimitive()) { try { URL newAvatarUrl = new URL(contentObject.get("avatar_url").getAsString()); if(!newAvatarUrl.equals(avatarUrl)) { avatarUrl.set(newAvatarUrl); updateAvatar(); } } catch (RestfulHTTPException | IOException e) { avatar.set(null); avatarUrl.set(null); } } else { avatar.set(null); avatarUrl.set(null); } } private void updateAvatar() throws RestfulHTTPException, IOException{ synchronized (avatarLock) { if (avatarWanted && avatarUrl.get() != null ) { if (!avatarUrl.get().equals(loadedAvatarUrl) || avatarSize > loadedAvatarSize){ Image ava = ImageIO.read(api.getMediaContentThumbnail(avatarUrl.getValue(),avatarSize)); loadedAvatarUrl = avatarUrl.get(); loadedAvatarSize = avatarSize; avatar.set(ava); } } else { avatar.set(null); } } } public void addNameListener(ChangeListener<? super String> listener) { name.addListener(listener); } public void removeNameListener(ChangeListener<? super String> listener) { name.removeListener(listener); } public void addAvatarUrlListener(ChangeListener<? super URL> listener) { avatarUrl.addListener(listener); } public void removeAvatarUrlListener(ChangeListener<? super URL> listener) { avatarUrl.removeListener(listener); } public void addAvatarListener(ChangeListener<? super Image> listener,int size ) { synchronized (avatarLock) { avatarListeners.add(listener); avatarWanted = true; if (size > avatarSize) { avatarSize = size; } try { updateAvatar(); } catch (RestfulHTTPException | IOException e) { System.out.printf("Failed to load image %s%n", e.getMessage()); } avatar.addListener(listener); } } public void removeAvatarListener(ChangeListener<? super Image> listener) { synchronized (avatarLock) { avatarListeners.remove(listener); if (avatarListeners.isEmpty()) { avatarWanted = false; } avatar.removeListener(listener); } } public void addPresenceListener(ChangeListener<? super Presence> listener) { presence.addListener(listener); } public void removePresenceListener(ChangeListener<? super Presence> listener) { presence.removeListener(listener); } public void addIsActiveListener(ChangeListener<? super Boolean> listener) { isActive.addListener(listener); } public void removeIsActiveListener(ChangeListener<? super Boolean> listener) { isActive.removeListener(listener); } public void addLastActiveAgoListener(ChangeListener<? super Number> listener) { lastActiveAgo.addListener(listener); } public void removeLastActiveAgoListener(ChangeListener<? super Number> listener) { lastActiveAgo.removeListener(listener); } @Override public boolean equals(Object o) { return o instanceof User && id.equals(((User)o).id); } @Override public int hashCode() { return id.hashCode(); } public String getId() { return id; } public String getName() { return name.get(); } public URL getAvatarUrl() { return avatarUrl.get(); } public Image getAvatar(int size) { synchronized (avatarLock) { boolean old = avatarWanted; avatarWanted = true; if (size > avatarSize) { avatarSize = size; } try { updateAvatar(); } catch (RestfulHTTPException | IOException e) { System.out.printf("Failed to load image %s%n", e.getMessage()); } avatarWanted = old; return avatar.get(); } } public Presence getPresence() { return presence.get(); } public boolean getIsActive() { return isActive.get(); } public long getLastActiveAgo() { return lastActiveAgo.get(); } }
6,876
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Room.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/Room.java
package com.github.cypher.sdk; import com.github.cypher.sdk.api.ApiLayer; import com.github.cypher.sdk.api.RestfulHTTPException; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.sun.javafx.collections.ObservableListWrapper; import com.sun.javafx.collections.ObservableMapWrapper; import javafx.beans.InvalidationListener; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.beans.value.ChangeListener; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.collections.ListChangeListener; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.collections.MapChangeListener; import javafx.collections.ObservableMap; import javax.imageio.ImageIO; import java.awt.*; import java.io.IOException; import java.net.URL; import java.util.*; import java.util.List; /** * This class contains the metadata of a Matrix chat room, * as well as its messages and information about its members. * <p> * Room objects are returned by the methods of a Client object * * @see com.github.cypher.sdk.Client */ public class Room { private final ApiLayer api; private final Repository<User> userRepository; private final String id; private final StringProperty name = new SimpleStringProperty(null); private final StringProperty topic = new SimpleStringProperty(null); private final ObjectProperty<URL> avatarUrl = new SimpleObjectProperty<>(null); private final ObjectProperty<Image> avatar = new SimpleObjectProperty<>(null); private boolean avatarWanted = false; private final Object avatarLock = new Object(); private final ObjectProperty<PermissionTable> permissions = new SimpleObjectProperty<>(null); private int avatarSize=24; private URL loadedAvatarUrl = null; private int loadedAvatarSize = 0; private String earliestBatch = null; private final ObservableMap<String, Event> events = FXCollections.synchronizedObservableMap(new ObservableMapWrapper<>(new HashMap<>())); // The latest state event for every event type private final ObservableMap<String, Event> latestStateEvents = FXCollections.synchronizedObservableMap(new ObservableMapWrapper<>(new HashMap<>())); private final ObservableList<Member> members = FXCollections.synchronizedObservableList(new ObservableListWrapper<Member>(new ArrayList<>())); private final ObservableList<String> aliases = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); private final ObservableMap<String, ObservableList<String>> aliasLists = FXCollections.synchronizedObservableMap(new ObservableMapWrapper<>(new HashMap<>())); private final StringProperty canonicalAlias = new SimpleStringProperty(); private final List<ChangeListener<? super Image>> avatarListeners = new ArrayList<>(); Room(ApiLayer api, Repository<User> userRepository, String id) { this.api = api; this.userRepository = userRepository; this.id = id; // update the alias list aliasLists.addListener((InvalidationListener) (invalidated) -> { // get all aliases java.util.List<String> list = new ArrayList<>(); for (ObservableList<String> a:aliasLists.values()){ list.addAll(a); } // set aliases aliases.setAll(list); }); } public void addEventListener(MapChangeListener<String, Event> listener) { events.addListener(listener); } public void removeEventListener(MapChangeListener<String, Event> listener) { events.removeListener(listener); } public void addMemberListener(ListChangeListener<Member> listener) { members.addListener(listener); } public void removeMemberListener(ListChangeListener<Member> listener) { members.removeListener(listener); } public void addAliasesListener(ListChangeListener<String> listener) { aliases.addListener(listener); } public void removeAliasesListener(ListChangeListener<String> listener) { aliases.removeListener(listener); } public void addCanonicalAliasListener(ChangeListener<String> listener) { canonicalAlias.addListener(listener); } public void removeCanonicalAliasListener(ChangeListener<String> listener) { canonicalAlias.removeListener(listener); } void update(JsonObject data) { parseBasicPropertiesData(data); parseEventData(data); parseTimelineEvents(data); parseStateEvents(data); } /** * Try to download older events from the room event log * @param limit The maximum amount of events to get * @return false if all history is loaded, otherwise true * @throws RestfulHTTPException * @throws IOException */ public boolean getEventHistory(Integer limit) throws RestfulHTTPException, IOException { if(earliestBatch == null) { throw new IOException("sdk.Room.getHistory(...) called before first sdk.Client.sync(...)"); } JsonObject data = api.getRoomMessages(id, earliestBatch, null, true, limit); if(data.has("end") && data.get("end").isJsonPrimitive()) { earliestBatch = data.get("end").getAsString(); } else { throw new IOException("No pagination token was given by the server"); } if(data.has("chunk") && data.get("chunk").isJsonArray()) { JsonArray chunk = data.get("chunk").getAsJsonArray(); if (chunk.size() == 0) { return false; } for(JsonElement eventElement : chunk) { if(eventElement.isJsonObject()) { parseEventData(eventElement.getAsJsonObject()); } } } return true; } private void parseBasicPropertiesData(JsonObject data) { if (data.has("name")) { name.setValue(data.get("name").getAsString()); } if (data.has("topic")) { topic.setValue(data.get("topic").getAsString()); } if (data.has("avatar_url")) { try { URL newAvatarUrl = new URL(data.get("avatar_url").getAsString()); avatar.set(ImageIO.read(api.getMediaContent(newAvatarUrl))); this.avatarUrl.set(newAvatarUrl); } catch(RestfulHTTPException | IOException e) { avatar.set(null); avatarUrl.set(null); } } } private void parseTimelineEvents(JsonObject data) { if (data.has("timeline") && data.get("timeline").isJsonObject()) { JsonObject timeline = data.get("timeline").getAsJsonObject(); if(earliestBatch == null && timeline.has("prev_batch") && timeline.get("prev_batch").isJsonPrimitive()) { earliestBatch = timeline.get("prev_batch").getAsString(); } parseEvents(timeline); } } private void parseStateEvents(JsonObject data) { if (data.has("state") && data.get("state").isJsonObject()) { JsonObject timeline = data.get("state").getAsJsonObject(); parseEvents(timeline); } } private void parseEvents(JsonObject timeline) { if (timeline.has("events") && timeline.get("events").isJsonArray()) { JsonArray events = timeline.get("events").getAsJsonArray(); for (JsonElement eventElement : events) { if (eventElement.isJsonObject()) { parseEventData(eventElement.getAsJsonObject()); } } } } private void parseEventData(JsonObject event) { if (event.has("type") && event.has("origin_server_ts") && event.has("sender") && event.has("event_id") && event.has("content")) { int originServerTs = event.get("origin_server_ts").getAsInt(); String sender = event.get("sender").getAsString(); String eventId = event.get("event_id").getAsString(); String eventType = event.get("type").getAsString(); int age = 0; if(event.has("unsigned") && event.get("unsigned").isJsonObject()) { JsonObject unsigned = event.get("unsigned").getAsJsonObject(); if(unsigned.has("age")) { age = unsigned.get("age").getAsInt(); } } JsonObject content = event.get("content").getAsJsonObject(); if ("m.room.message".equals(eventType)) { parseMessageEvent(originServerTs, sender, eventId, age, content); } else if ("m.room.member".equals(eventType)) { parseMemberEvent(event, originServerTs, sender, eventId, age, content); } else if ("m.room.name".equals(eventType)) { parseNameData(content, originServerTs, sender, eventId, age); } else if ("m.room.topic".equals(eventType)) { parseTopicData(content, originServerTs, sender, eventId, age); } else if ("m.room.avatar".equals(eventType)) { parseAvatarUrlData(content, originServerTs, sender, eventId, age); } else if ("m.room.aliases".equals(eventType)) { if (event.has("state_key") && event.get("state_key").isJsonPrimitive()){ parseAliasesEvent(content, event.get("state_key").getAsString(), originServerTs, sender, eventId, age); } } else if ("m.room.canonical_alias".equals(eventType)) { parseCanonicalAlias(content, originServerTs, sender, eventId, age); } else if ("m.room.power_levels".equals(eventType)) { parsePowerLevelsEvent(content, originServerTs, sender, eventId, age); } } } private void parseCanonicalAlias(JsonObject content, int originServerTs, String sender, String eventId, int age) { if (content.has("alias") && content.get("alias").isJsonPrimitive() && !content.get("alias").getAsString().isEmpty()) { String newAlias = ""; Event event = addPropertyChangeEvent(originServerTs, sender, eventId, "m.room.canonical_alias", age, "canonical_alias", newAlias); if(isLatestStateEvent(event)) { canonicalAlias.setValue(content.get("alias").getAsString()); } } } private void parseAliasesEvent(JsonObject content, String stateKey, int originServerTs, String sender, String eventId, int age) { if (content.has("aliases") && content.get("aliases").isJsonArray()) { JsonArray aliases = content.getAsJsonArray("aliases"); ObservableList<String> list = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); for (JsonElement alias : aliases) { list.add(alias.getAsString()); } Event event = addPropertyChangeEvent(originServerTs, sender, eventId, stateKey, age, "aliases", list); if (isLatestStateEvent(event)) { if (list.size() == 0){ this.aliasLists.remove(stateKey); } else{ this.aliasLists.put(stateKey, list); } } } } private void parseNameData(JsonObject data, int originServerTs, String sender, String eventId, int age) { if (data.has("name")) { String newName = data.get("name").getAsString(); Event event = addPropertyChangeEvent(originServerTs, sender, eventId, "m.room.name", age, "name", newName); if(isLatestStateEvent(event)) { name.set(newName); } } } private void parseTopicData(JsonObject data, int originServerTs, String sender, String eventId, int age) { if (data.has("topic")) { String newTopic = data.get("topic").getAsString(); Event event = addPropertyChangeEvent(originServerTs, sender, eventId, "m.room.topic", age, "topic", newTopic); if (isLatestStateEvent(event)) { topic.set(newTopic); } } } private void parseAvatarUrlData(JsonObject data, int originServerTs, String sender, String eventId, int age) { for(String key : new String[] {"avatar_url", "url"}) { if (data.has(key)) { try { URL newAvatarUrl = new URL(data.get(key).getAsString()); Event event = addPropertyChangeEvent(originServerTs, sender, eventId, "m.room.avatar", age, "avatar", newAvatarUrl); if (isLatestStateEvent(event) && !newAvatarUrl.equals(avatarUrl.getValue())) { this.avatarUrl.set(newAvatarUrl); updateAvatar(); } } catch(RestfulHTTPException | IOException e) { avatar.set(null); avatarUrl.set(null); } break; } } } private void updateAvatar() throws RestfulHTTPException, IOException{ synchronized (avatarLock) { if (avatarWanted && avatarUrl.get() != null ) { if (!avatarUrl.get().equals(loadedAvatarUrl) || avatarSize > loadedAvatarSize){ Image ava = ImageIO.read(api.getMediaContentThumbnail(avatarUrl.getValue(),avatarSize)); loadedAvatarUrl = avatarUrl.get(); loadedAvatarSize = avatarSize; avatar.set(ava); } } else { avatar.set(null); } } } private void parseMessageEvent(int originServerTs, String sender, String eventId, int age, JsonObject content) { if (!events.containsKey(eventId)){ User author = userRepository.get(sender); this.events.put( eventId, new Message(api, originServerTs, author, eventId, age, content) ); } } private void parseMemberEvent(JsonObject event, int originServerTs, String senderId, String eventId, int age, JsonObject content) { if (content.has("membership") && event.has("state_key")) { String memberId = event.get("state_key").getAsString(); String membership = content.get("membership").getAsString(); User sender = userRepository.get(senderId); MemberEvent memberEvent = new MemberEvent(api, originServerTs, sender, eventId, age, memberId, membership); if(isLatestStateEvent(memberEvent)) { User user = userRepository.get(memberId); user.update(event); Member member = new Member(user); if ("join".equals(membership)) { if (!members.contains(member)) { members.add(member); } } else if ("leave".equals(membership) || "ban".equals(membership)) { members.remove(member); } else if ("invite".equals(membership)) { // TODO: Handle invited room members in some way } else { System.err.printf("Unknown room membership type: \"%s\"%n", membership); } // Add membership event to the log if(!events.containsKey(eventId)) { events.put(eventId, memberEvent); } latestStateEvents.put(memberId, memberEvent); } } } private void parsePowerLevelsEvent(JsonObject data, int originServerTs, String senderId, String eventId, int age) { try { PermissionTable newTable = new PermissionTable(data); Event event = addPropertyChangeEvent( originServerTs, senderId, eventId, "m.room.power_levels", age, "power_levels", newTable ); if (!isLatestStateEvent(event)) { return; } this.permissions.set(newTable); } catch(IOException e) { return; } if(data.has("users") && data.get("users").isJsonObject()) { for(Map.Entry<String, JsonElement> userPowerEntry : data.get("users").getAsJsonObject().entrySet()) { String memberId = userPowerEntry.getKey(); Optional<Member> optionalMember = members.stream().filter(m -> m.getUser().getId().equals(memberId)).findAny(); optionalMember.ifPresent(member -> member.privilegeProperty().setValue(userPowerEntry.getValue().getAsInt())); } } } private boolean isLatestStateEvent(Event event) { String key; if(event instanceof MemberEvent) { key = ((MemberEvent)event).getUserId(); } else { key = event.getType(); } return !latestStateEvents.containsKey(key) || latestStateEvents.get(key).getOriginServerTs() <= event.getOriginServerTs(); } private <T> Event addPropertyChangeEvent(int originServerTs, String senderId, String eventId, String eventType, int age, String property, T value) { if(!events.containsKey(eventId)) { User sender = userRepository.get(senderId); PropertyChangeEvent<T> event = new PropertyChangeEvent<>(api, originServerTs, sender, eventId, eventType, age, property, value); events.put(eventId, event); if(isLatestStateEvent(event)) { latestStateEvents.put(eventType, event); } return event; } return events.get(eventId); } /** * Send a message event of the type "m.text" to this Matrix chat room * * @param message The message body * @throws RestfulHTTPException * @throws IOException * @see com.github.cypher.sdk.api.ApiLayer#roomSendEvent(String, String, JsonObject) */ public void sendTextMessage(String message) throws RestfulHTTPException, IOException { JsonObject content = new JsonObject(); content.addProperty("msgtype", "m.text"); content.addProperty("body", message); sendMessage(content); } /** * Send a custom message event to this Matrix chat room * * @param content The json object containing the message * @throws RestfulHTTPException * @throws IOException * @see com.github.cypher.sdk.api.ApiLayer#roomSendEvent(String, String, JsonObject) */ public void sendMessage(JsonObject content) throws RestfulHTTPException, IOException { api.roomSendEvent(this.id, "m.room.message", content); } public void addNameListener(ChangeListener<? super String> listener) { name.addListener(listener); } public void removeNameListener(ChangeListener<? super String> listener) { name.removeListener(listener); } public void addTopicListener(ChangeListener<? super String> listener) { topic.addListener(listener); } public void removeTopicListener(ChangeListener<? super String> listener) { topic.removeListener(listener); } public void addAvatarUrlListener(ChangeListener<? super URL> listener) { avatarUrl.addListener(listener); } public void removeAvatarUrlListener(ChangeListener<? super URL> listener) { avatarUrl.removeListener(listener); } public void addAvatarListener(ChangeListener<? super Image> listener, int size) { //synchronized (avatarLock) { avatarListeners.add(listener); avatarWanted = true; if (size > avatarSize) { avatarSize = size; } try { updateAvatar(); } catch (RestfulHTTPException | IOException e) { System.out.printf("Failed to load image %s%n", e.getMessage()); } avatar.addListener(listener); //} } public void removeAvatarListener(ChangeListener<? super Image> listener) { //synchronized (avatarLock) { avatarListeners.remove(listener); if (avatarListeners.isEmpty()) { avatarWanted = false; } avatar.removeListener(listener); //} } /** * @return A valid room ID (e.g. "!cURbafjkfsMDVwdRDQ:matrix.org") */ public String getId() { return this.id; } public String getName() { return name.get(); } public String getTopic() { return topic.get(); } public URL getAvatarUrl() { return avatarUrl.get(); } public Image getAvatar(int size) { synchronized (avatarLock) { boolean old = avatarWanted; avatarWanted = true; if (size > avatarSize) { avatarSize = size; } try { updateAvatar(); } catch (RestfulHTTPException | IOException e) { System.out.printf("Failed to load image %s%n", e.getMessage()); } avatarWanted = old; return avatar.get(); } } public Map<String, Event> getEvents() { return new HashMap<>(events); } public int getEventCount() { return events.size(); } public List<Member> getMembers() { return new ArrayList<>(members); } public int getMemberCount() { return members.size(); } public String[] getAliases() { return aliases.toArray(new String[aliases.size()]); } public String getCanonicalAlias() { return canonicalAlias.get(); } }
18,845
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
MemberEvent.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/MemberEvent.java
package com.github.cypher.sdk; import com.github.cypher.sdk.api.ApiLayer; public class MemberEvent extends Event { private final String userId; private final String membership; MemberEvent(ApiLayer api, int originServerTs, User sender, String eventId, int age, String userId, String membership) { super(api, originServerTs, sender, eventId, "m.room.member", age); this.userId = userId; this.membership = membership; } public String getUserId() { return userId; } public String getMembership() { return membership; } }
541
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Message.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/Message.java
package com.github.cypher.sdk; import com.github.cypher.sdk.api.ApiLayer; import com.google.gson.JsonObject; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.beans.value.ChangeListener; import java.net.MalformedURLException; import java.net.URL; public class Message extends Event { private final StringProperty body = new SimpleStringProperty(""); private final StringProperty type = new SimpleStringProperty(""); private final ObjectProperty<URL> url = new SimpleObjectProperty<>(null); private final StringProperty formattedBody = new SimpleStringProperty(null); private final StringProperty formatType = new SimpleStringProperty(null); Message(ApiLayer api, int originServerTs, User sender, String eventId, int age, JsonObject content) { super(api, originServerTs, sender, eventId, "m.room.message", age); if(content.has("body")) { this.body.set(content.get("body").getAsString()); } if(content.has("msgtype")) { this.type.set(content.get("msgtype").getAsString()); } if(content.has("url")) { try { this.url.set(new URL(content.get("url").getAsString())); } catch(MalformedURLException e) { e.printStackTrace(); } } if(content.has("format") && content.has("formatted_body")) { formatType.set(content.get("format").getAsString()); formattedBody.set(content.get("formatted_body").getAsString()); } } public void addBodyListener(ChangeListener<? super String> listener) { body.addListener(listener); } public void removeBodyListener(ChangeListener<? super String> listener) { body.removeListener(listener); } public void addTypeListener(ChangeListener<? super String> listener) { type.addListener(listener); } public void removeTypeListener(ChangeListener<? super String> listener) { type.removeListener(listener); } public void addUrlListener(ChangeListener<? super URL> listener) { url.addListener(listener); } public void removeUrlListener(ChangeListener<? super URL> listener) { url.removeListener(listener); } public void addFormattedBodyListener(ChangeListener<? super String> listener) { formattedBody.addListener(listener); } public void removeFormattedBodyListener(ChangeListener<? super String> listener) { formattedBody.removeListener(listener); } public void addFormatTypeListener(ChangeListener<? super String> listener) { formatType.addListener(listener); } public void removeFormatTypeListener(ChangeListener<? super String> listener) { formatType.removeListener(listener); } public String getBody() { return body.get(); } public String getType() { return type.get(); } public URL getUrl() { return url.get(); } public String getFormattedBody() { return formattedBody.get(); } public String getFormatType() { return formatType.get(); } }
2,945
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RestfulHTTPException.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/api/RestfulHTTPException.java
package com.github.cypher.sdk.api; import com.google.gson.JsonObject; import javax.xml.ws.http.HTTPException; /** * This class proves information rich errors usually returned from restful http API's */ public class RestfulHTTPException extends HTTPException { private final JsonObject errorResponse; /** * Create error from a jsonObject * * @param statusCode HTTP status code * @param errorResponse JsonObject containing error information */ public RestfulHTTPException(int statusCode, JsonObject errorResponse) { super(statusCode); this.errorResponse = errorResponse; } /** * Crate and collect the restful error message. */ @Override public String getMessage() { String errorCode = getErrorCode(); String errorMessage = errorResponse.has("error") ? errorResponse.get("error").getAsString() : ""; if (!errorMessage.isEmpty()) { return Integer.toString(super.getStatusCode()).concat(": ").concat(errorMessage); } else if (!errorCode.isEmpty()) { return Integer.toString(super.getStatusCode()).concat(": ").concat(errorCode); } else { return Integer.toString(super.getStatusCode()); } } /** * Returns the errorcode */ public String getErrorCode(){ if(errorResponse.has("errcode")) { return errorResponse.get("errcode").getAsString(); } return ""; } /** * Returns the server request response */ public JsonObject getErrorResponse() { return errorResponse; } }
1,444
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Endpoint.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/api/Endpoint.java
package com.github.cypher.sdk.api; /* Describes the various Client-Server API Endpoints */ enum Endpoint { // All endpoints THIRD_PERSON_ID ("client/r0/account/3pid"), ROOM_CREATE ("client/r0/createRoom"), ROOM_DIRECTORY ("client/r0/directory/room/{0}"), // {0} = roomAlias LOGIN ("client/r0/login"), TOKEN_REFRESH ("client/r0/tokenrefresh"), LOGOUT ("client/r0/logout"), REGISTER ("client/r0/register"), SYNC ("client/r0/sync"), USER_PROFILE ("client/r0/profile/{0}"), // {0} = userId USER_AVATAR_URL ("client/r0/profile/{0}/avatar_url"), // {0} = userId USER_DISPLAY_NAME ("client/r0/profile/{0}/displayname"), // {0} = userId PUBLIC_ROOMS ("client/r0/publicRooms"), ROOM_MESSAGES ("client/r0/rooms/{0}/messages"), // {0} = roomId ROOM_MEMBERS ("client/r0/rooms/{0}/members"), // {0} = roomId ROOM_SEND_EVENT ("client/r0/rooms/{0}/send/{1}/{2}"), // {0} = roomId, {1} = ToggleEvent, {2} = txnId ROOM_JOIN ("client/r0/rooms/{0}/join"), // {0} = roomId ROOM_JOIN_ID_OR_A ("client/r0/join/{0}"), // {0} = roomIdorAlias ROOM_LEAVE ("client/r0/rooms/{0}/leave"), // {0} = roomId ROOM_KICK ("client/r0/rooms/{0}/kick"), // {0} = roomId ROOM_INVITE ("client/r0/rooms/{0}/invite"), // {0} = roomId PRESENCE_LIST ("client/r0/presence/list/{0}"), // {0} = userId MEDIA_DOWNLOAD ("media/r0/download/{0}/{1}"), // {0} = serverName, {1} = mediaId MEDIA_THUMBNAIL ("media/r0/thumbnail/{0}/{1}"); // {0} = serverName, {1} = mediaId /* The code bellow allows for custom return of .toString() for each endpoint. */ private final String name; Endpoint(String s) { name = "/_matrix/".concat(s); } public boolean equalsName(String otherName) { return name.equals(otherName); } @Override public String toString() { return this.name; } }
1,988
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
MatrixApiLayer.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/api/MatrixApiLayer.java
package com.github.cypher.sdk.api; import com.google.gson.*; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * This class provides access to matrix endpoints trough * ordinary java methods returning Json Objects. * * <p>Most endpoints require a session to * have been successfully initiated as the data provided by the * endpoint itself isn't publicly available. * * <p>A session can be initiated with {@link #login(String username, String password, String homeserver)} * or via the constructor {@link #MatrixApiLayer(String username, String password, String homeserver)} * * @see <a href="http://matrix.org/docs/api/client-server/">matrix.org</a> */ public class MatrixApiLayer implements ApiLayer { private Session session; @Override public Session getSession() { return session; } @Override public void setSession(Session session) { this.session = session; } /** * Creates a MatrixApiLayer with a session. * * <p> Session is created with {@link #login(String username, String password, String homeserver)} * * @param username Username * @param password Password * @param homeserver A homeserver to connect trough (e.g. example.org:8448 or matrix.org) */ public MatrixApiLayer(String username, String password, String homeserver) throws RestfulHTTPException, IOException { login(username, password, homeserver); } /** * Creates a new MatrixApiLayer without a session. * * <p> Use {@link #login(String username, String password, String homeserver)} to create a session. */ public MatrixApiLayer() { /*Used for javadoc*/} @Override public void login(String username, String password, String homeserver) throws RestfulHTTPException, IOException { // Only run if session isn't already set if (session != null){ return; } // Build URL URL url = Util.UrlBuilder(homeserver, Endpoint.LOGIN, null, null); // Build request body JsonObject request = new JsonObject(); request.addProperty("type", "m.login.password"); request.addProperty("user", username); request.addProperty("password", password); // Send Request JsonObject response = Util.makeJsonPostRequest(url, request).getAsJsonObject(); // Set Session this.session = new Session(response); } @Override public void refreshToken() throws RestfulHTTPException, IOException { // Only run if session is set if (session == null) { return; } // Only run if refreshToken is available if (session.getRefreshToken() == null) { throw new IOException("Refresh token not available"); } // Build URL URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.TOKEN_REFRESH, null, null); // Build request body JsonObject request = new JsonObject(); request.addProperty("refresh_token", session.getRefreshToken()); // Send Request JsonObject response = Util.makeJsonPostRequest(url, request).getAsJsonObject(); // Check if response is valid if (response.has("access_token")) { // If refresh token is available, use it String refreshToken = null; if (response.has("refresh_token")) { refreshToken = response.get("refresh_token").getAsString(); } // Create new session object session = new Session( session.getUserId(), response.get("access_token").getAsString(), refreshToken, session.getHomeServer(), session.getDeviceId(), 0 ); } else { // Something went wrong, force re-login session = null; } } public void logout() throws RestfulHTTPException, IOException { // Only run if the session is set if (session == null) { return; } // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); // Build URL URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.LOGOUT, null, parameters); // Send request JsonObject response = Util.makeJsonPostRequest(url, null).getAsJsonObject(); // Null session this.session = null; } @Override public void register(String username, String password, String homeserver) throws IOException { // Only run if session isn't already set if (session != null){ return; } // Build URL URL url = Util.UrlBuilder(homeserver, Endpoint.REGISTER, null, null); // Build request body JsonObject request = new JsonObject(); request.addProperty("password", password); if(username != null) { request.addProperty("username", username); } // Send Request for session JsonObject finalResponse; try { finalResponse = Util.makeJsonPostRequest(url, request).getAsJsonObject(); } catch (RestfulHTTPException e) { if(e.getStatusCode() != 401) { throw e; } JsonObject firstResponse = e.getErrorResponse(); // Create auth object JsonObject auth = new JsonObject(); auth.addProperty("session", String.valueOf(firstResponse.get("session"))); auth.addProperty("type","m.login.dummy"); request.add("auth", auth.getAsJsonObject()); // Send Request for registering finalResponse = Util.makeJsonPostRequest(url, request).getAsJsonObject(); } // Set Session this.session = new Session(finalResponse); } @Override public JsonObject sync(String filter, String since, boolean fullState, Presence setPresence, int timeout) throws RestfulHTTPException, IOException{ // Build parameter Map Map<String, String> parameters = new HashMap<>(); if(filter != null && !filter.equals("")) { parameters.put("filter", filter); } if(since != null && !since.equals("")) { parameters.put("since", since); } if(setPresence != null) { parameters.put("set_presence", setPresence == Presence.ONLINE ? "online" : "offline"); } if(fullState) { parameters.put("full_state", "true"); } if(timeout > 0) { parameters.put("timeout", Integer.toString(timeout)); } parameters.put("access_token", session.getAccessToken()); // Build URL URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.SYNC, null, parameters); // Send request return Util.makeJsonGetRequest(url).getAsJsonObject(); } @Override public JsonObject getPublicRooms(String server) throws RestfulHTTPException, IOException { // Build URL URL url = Util.UrlBuilder(server, Endpoint.PUBLIC_ROOMS, null, null); // Send request return Util.makeJsonGetRequest(url).getAsJsonObject(); } @Override public JsonObject getRoomMessages(String roomId, String from, String to, boolean backward, Integer limit) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); if(from != null) { parameters.put("from", from); } if(to != null) { parameters.put("to", to); } if(limit != null) { parameters.put("limit", limit.toString()); } parameters.put("dir", backward ? "b" : "f"); // Build URL URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.ROOM_MESSAGES, new Object[] {roomId}, parameters); // Send Request return Util.makeJsonGetRequest(url).getAsJsonObject(); } @Override public JsonObject getRoomMembers(String roomId) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); // Build URL URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.ROOM_MEMBERS, new Object[] {roomId}, parameters); // Send Request return Util.makeJsonGetRequest(url).getAsJsonObject(); } @Override public JsonObject getUserProfile(String userId) throws RestfulHTTPException, IOException { // Build URL URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.USER_PROFILE, new Object[] {userId}, null); // Send Request return Util.makeJsonGetRequest(url).getAsJsonObject(); } @Override public JsonObject getUserAvatarUrl(String userId) throws RestfulHTTPException, IOException { // Build URL URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.USER_AVATAR_URL, new Object[] {userId}, null); // Send Request return Util.makeJsonGetRequest(url).getAsJsonObject(); } @Override public void setUserAvatarUrl(URL avatarUrl) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); // Build URL URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.USER_AVATAR_URL, new Object[] {session.getUserId()}, parameters); // Build Json Object containing data JsonObject json = new JsonObject(); json.addProperty("avatar_url", avatarUrl.toString()); // Send Request Util.makeJsonPutRequest(url, json); } @Override public JsonObject getUserDisplayName(String userId) throws RestfulHTTPException, IOException { // Build URL URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.USER_DISPLAY_NAME, new Object[] {userId}, null); // Send Request return Util.makeJsonGetRequest(url).getAsJsonObject(); } @Override public void setUserDisplayName(String displayName) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); // Build URL URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.USER_DISPLAY_NAME, new Object[] {session.getUserId()}, parameters); // Build Json Object containing data JsonObject json = new JsonObject(); json.addProperty("displayname", displayName); // Send Request Util.makeJsonPutRequest(url, json); } //Bugged in current version of matrix, use with caution. @Override public JsonArray getUserPresence(String userId)throws RestfulHTTPException, IOException{ // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); // Build URL URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.PRESENCE_LIST, new Object[] {userId}, parameters); // Send Request return Util.makeJsonGetRequest(url).getAsJsonArray(); } @Override public JsonObject roomSendEvent(String roomId, String eventType, JsonObject content) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); // Build URL, increment transactionId URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.ROOM_SEND_EVENT, new Object[] {roomId, eventType, session.transactionId++}, parameters); // Send Request return Util.makeJsonPutRequest(url, content).getAsJsonObject(); } @Override public JsonObject getRoomIDFromAlias(String roomAlias) throws RestfulHTTPException, IOException { //Build request URL. URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.ROOM_DIRECTORY,new Object[] {roomAlias}, null); //Send request URL. return Util.makeJsonGetRequest(url).getAsJsonObject(); } @Override public JsonObject deleteRoomAlias(String roomAlias) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); //Build request URL. URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.ROOM_DIRECTORY,new Object[] {roomAlias}, parameters); //Send request URL. return Util.makeJsonDeleteRequest(url, null).getAsJsonObject(); } @Override public JsonObject putRoomAlias(String roomAlias, String roomId) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); //Build request URL. URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.ROOM_DIRECTORY,new Object[] {roomAlias}, parameters); //Build JsonObject JsonObject roomIdJsonObject = new JsonObject(); roomIdJsonObject.addProperty("room_id", roomId); //Send request URL. return Util.makeJsonPutRequest(url, roomIdJsonObject).getAsJsonObject(); } @Override public JsonObject postCreateRoom(JsonObject roomCreation) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); //Build request URL. URL url = Util.UrlBuilder(session.getHomeServer(),Endpoint.ROOM_CREATE,null, parameters); //Send request URL. return Util.makeJsonPostRequest(url, roomCreation).getAsJsonObject(); } @Override public JsonObject postJoinRoomIdorAlias(String roomIdorAlias, JsonObject thirdPartySigned) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); //Build request URL. URL url = Util.UrlBuilder(session.getHomeServer(),Endpoint.ROOM_JOIN_ID_OR_A,new Object[] {roomIdorAlias}, parameters); //Send request URL. return Util.makeJsonPostRequest(url, thirdPartySigned).getAsJsonObject(); } @Override public void postLeaveRoom(String roomId) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); //Build request URL. URL url = Util.UrlBuilder(session.getHomeServer(),Endpoint.ROOM_LEAVE, new Object[] {roomId}, parameters); //Send request URL. Util.makeJsonPostRequest(url, null); } @Override public void postKickFromRoom(String roomId, String reason, String userId) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); //Build request URL. URL url = Util.UrlBuilder(session.getHomeServer(),Endpoint.ROOM_KICK, new Object[] {roomId}, parameters); //Build JsonObject JsonObject kick = new JsonObject(); kick.addProperty("reason", reason); kick.addProperty("user_id",userId); //Send request URL. Util.makeJsonPostRequest(url, kick); } @Override public void postInviteToRoom(String roomId, String address, String idServer, String medium) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); //Build request URL. URL url = Util.UrlBuilder(session.getHomeServer(),Endpoint.ROOM_INVITE, new Object[] {roomId}, parameters); //Build Json object JsonObject invite = new JsonObject(); invite.addProperty("address", address); invite.addProperty("id_server", idServer); invite.addProperty("medium", medium); //Send request URL. Util.makeJsonPostRequest(url, invite); } @Override public void postInviteToRoom(String roomId, String userId/*contains "id_server","medium" and "address", or simply "user_id"*/) throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); //Build request URL. URL url = Util.UrlBuilder(session.getHomeServer(),Endpoint.ROOM_INVITE, new Object[] {roomId}, parameters); //Build JsonObject JsonObject invite = new JsonObject(); invite.addProperty("user_id", userId); //Send request URL. Util.makeJsonPostRequest(url, invite); } @Override public JsonObject get3Pid() throws RestfulHTTPException, IOException { // Build parameter Map Map<String, String> parameters = new HashMap<>(); parameters.put("access_token", session.getAccessToken()); //Build request URL. URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.THIRD_PERSON_ID,null, parameters); //Send request URL. return Util.makeJsonGetRequest(url).getAsJsonObject(); } @Override public InputStream getMediaContent(URL mediaUrl) throws RestfulHTTPException, IOException { //Build request URL. URL url = Util.UrlBuilder(session.getHomeServer(), Endpoint.MEDIA_DOWNLOAD, new Object[] {mediaUrl.getHost(),mediaUrl.getPath().replaceFirst("/", "")}, null); HttpURLConnection conn = null; try { // Setup the connection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod("GET"); return conn.getInputStream(); } catch (IOException e) { Util.handleRestfulHTTPException(conn); return null; } } @Override public InputStream getMediaContentThumbnail(URL mediaUrl, int size) throws RestfulHTTPException, IOException { //Make parameter map Map<String, String> parameters = new HashMap<>(); parameters.put("height", String.valueOf(size)); parameters.put("width", String.valueOf(size)); parameters.put("method", "crop"); URL url; //Build request URL. if (mediaUrl.getPort()==-1) { url = Util.UrlBuilder(session.getHomeServer(), Endpoint.MEDIA_THUMBNAIL, new Object[]{mediaUrl.getHost(), mediaUrl.getPath().replaceFirst("/", "")}, parameters); } else { url = Util.UrlBuilder(session.getHomeServer(), Endpoint.MEDIA_THUMBNAIL, new Object[]{mediaUrl.getHost()+":"+mediaUrl.getPort(), mediaUrl.getPath().replaceFirst("/", "")}, parameters); } HttpURLConnection conn = null; try { // Setup the connection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod("GET"); return conn.getInputStream(); } catch (IOException e) { Util.handleRestfulHTTPException(conn); return null; } } }
17,603
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Util.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/api/Util.java
package com.github.cypher.sdk.api; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.stream.JsonReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.*; import java.text.MessageFormat; import java.util.Map; /* Provides utils for the ApiLayer */ public final class Util { private Util() { /*Not constructable*/} /* Build a URL with a specified set of parameters */ static URL UrlBuilder(String homeServer, Endpoint endPoint, Object[] endPointParameters, Map<String, String> getParameters) throws MalformedURLException { StringBuilder builder = new StringBuilder("https://"); try { // Add homeserver and specified endpoint to the URL builder.append(homeServer); // Inject end point parameters into the URL if(endPointParameters == null) { builder.append(endPoint); } else { Object[] formattedEndPointParameters = new Object[endPointParameters.length]; for (int i = 0; i < endPointParameters.length; i++) { formattedEndPointParameters[i] = URLEncoder.encode(endPointParameters[i].toString(), "UTF-8"); } MessageFormat finalEndPoint = new MessageFormat(endPoint.toString()); builder.append(finalEndPoint.format(formattedEndPointParameters)); } // Append GET-parameters if(getParameters != null) { boolean first = true; for (Map.Entry<String, String> parameter : getParameters.entrySet()) { builder.append(first ? "?" : "&"); first = false; builder.append(URLEncoder.encode(parameter.getKey(), "UTF-8")).append("="); builder.append(URLEncoder.encode(parameter.getValue(), "UTF-8")); } } // Format as URL and return return new URL(builder.toString()); } catch(UnsupportedEncodingException e) { System.out.println(builder.toString()); System.out.println(e); return null; } } private static JsonElement makeRequest(URL url, String method, JsonObject data) throws RestfulHTTPException, IOException { // Setup the connection HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod(method); conn.setRequestProperty("Accept", "application/json"); if(data != null) { conn.setDoOutput(true); conn.setRequestProperty("Content-Type", "application/json"); // Push Data DataOutputStream writer = new DataOutputStream(conn.getOutputStream()); writer.write(data.toString().getBytes("UTF-8")); writer.flush(); writer.close(); } JsonElement json = null; try { try { // Retrieve Data JsonReader reader = new JsonReader(new InputStreamReader(conn.getInputStream())); json = new JsonParser().parse(reader); } catch(IOException e) { handleRestfulHTTPException(conn); } } catch(IllegalStateException e) { throw new IOException(e.getMessage(), e.getCause()); } // Return response return json; } static void handleRestfulHTTPException(HttpURLConnection conn) throws RestfulHTTPException, IOException { // Try to throw additional json error data if (conn.getErrorStream() == null){ throw new IOException("Connection failed"); } JsonReader errorReader = new JsonReader(new InputStreamReader(conn.getErrorStream())); JsonElement json = new JsonParser().parse(errorReader); throw new RestfulHTTPException(conn.getResponseCode(), json.getAsJsonObject()); } static JsonElement makeJsonPostRequest(URL url, JsonObject data) throws RestfulHTTPException, IOException { return makeRequest(url, "POST", data); } static JsonElement makeJsonGetRequest(URL url) throws RestfulHTTPException, IOException { return makeRequest(url, "GET", null); } static JsonElement makeJsonPutRequest(URL url, JsonObject data) throws RestfulHTTPException, IOException { return makeRequest(url, "PUT", data); } static JsonElement makeJsonDeleteRequest(URL url, JsonObject data) throws RestfulHTTPException, IOException{ return makeRequest(url,"DELETE", data); } /* These classes allows for use of the mxc:// custom url schema used by the Matrix protocol */ public static class MatrixMediaURLStreamHandlerFactory implements URLStreamHandlerFactory { @Override public URLStreamHandler createURLStreamHandler(String protocol) { if ("mxc".equals(protocol)) { return new MatrixMediaURLStreamHandler(); } return null; } } public static class MatrixMediaURLStreamHandler extends URLStreamHandler { @Override protected URLConnection openConnection(URL url) throws IOException { return new MatrixMediaURLConnection(url); } } public static class MatrixMediaURLConnection extends URLConnection { protected MatrixMediaURLConnection(URL url) { super(url); } @Override public void connect() throws IOException {} // Matrix Media URLs can't be used to establish a connection. } }
4,926
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Session.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/api/Session.java
package com.github.cypher.sdk.api; import com.google.gson.JsonObject; import java.io.IOException; import java.io.Serializable; /* Represents a User session */ public class Session implements Serializable { private final String userId; private final String accessToken; private final String refreshToken; private final String homeServer; private final String deviceId; long transactionId = 0; /* Parses the data from a login response to create a session */ public Session(JsonObject loginResponse) throws IOException{ // Make sure response is valid if (loginResponse.has("user_id") && loginResponse.has("access_token") && loginResponse.has("home_server")){ // Parse Data this.userId = loginResponse.get("user_id").getAsString(); this.accessToken = loginResponse.get("access_token").getAsString(); this.homeServer = loginResponse.get("home_server").getAsString(); } else { throw new IOException("loginResponse wasn't parsable"); } if(loginResponse.has("device_id")) { this.deviceId = loginResponse.get("device_id").getAsString(); } else { this.deviceId = null; } if(loginResponse.has("refresh_token")) { this.refreshToken = loginResponse.get("refresh_token").getAsString(); } else { this.refreshToken = null; } } public Session( String userId, String accessToken, String refreshToken, String homeServer, String deviceId, long transactionId ) { this.userId = userId; this.accessToken = accessToken; this.refreshToken = refreshToken; this.homeServer = homeServer; this.deviceId = deviceId; this.transactionId = transactionId; } public String getUserId() { return userId; } public String getAccessToken() { return accessToken; } public String getRefreshToken() { return refreshToken; } public String getHomeServer() { return homeServer; } public String getDeviceId() { return deviceId; } }
1,921
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
ApiLayer.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/sdk/api/ApiLayer.java
package com.github.cypher.sdk.api; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; /** * This class provides access to matrix like endpoints trough * ordinary java methods returning Json Objects. * * <p>Most endpoints require a session to * have been successfully initiated as the data provided by the * endpoint itself isn't publicly available. * * <p>A session can be initiated with {@link #login(String, String, String)} * * @see <a href="https://matrix.org/docs/api/client-server/">matrix.org</a> */ public interface ApiLayer { /** * Represents presence states of a user */ enum Presence{ONLINE, OFFLINE, UNAVAILABLE}; /** * Gets the session * @return Session */ Session getSession(); /** * Sets the session * @param session Session */ void setSession(Session session); /** * Synchronise the client's state and receive new messages. * @see <a href="https://matrix.org/docs/api/client-server/#!/Room_participation/get_matrix_client_r0_sync">matrix.org</a> * @param filter Id of filter to be used on the sync data * @param since Point in time of last sync request * @param fullState Shall all events be collected * @param setPresence User status * @param timeout The maximum time to poll in milliseconds before returning this request * @return Valid Json response */ JsonObject sync(String filter, String since, boolean fullState, Presence setPresence, int timeout) throws RestfulHTTPException, IOException; /** * Lists the public rooms on the server. * @see <a href="https://matrix.org/docs/api/client-server/#!/Room_discovery/get_matrix_client_r0_publicRooms">matrix.org</a> * @param server A homeserver to fetch public rooms from (e.g. example.org:8448 or matrix.org) * @return Valid Json response */ JsonObject getPublicRooms(String server) throws RestfulHTTPException, IOException; /** * Authenticates the user and creates a new session. * @see <a href="https://matrix.org/docs/api/client-server/#!/Session_management/post_matrix_client_r0_login">matrix.org</a> * @param username Username * @param password Password * @param homeserver A homeserver to connect trough (e.g. example.org:8448 or matrix.org) */ void login(String username, String password, String homeserver) throws RestfulHTTPException, IOException; /** * Invalidates the current session. * @see <a href="http://matrix.org/docs/api/client-server/#!/Session32management/post_matrix_client_r0_logout">matrix.org</a> */ void logout() throws RestfulHTTPException, IOException; /** * Create a new account and a new session * @see <a href="http://matrix.org/docs/api/client-server/#!/Session32management/post_matrix_client_r0_logout">matrix.org</a> */ // TODO: support binding an email void register(String username, String password, String homeserver) throws RestfulHTTPException, IOException; /** * Use a refresh token to create a new Session * @see <a href="https://matrix.org/docs/api/client-server/#!/Session32management/post_matrix_client_r0_tokenrefresh">matrix.org</a> */ void refreshToken() throws RestfulHTTPException, IOException; /** * This API returns a list of message and state events for a room. * <p> * It uses pagination query parameters to paginate history in the room. * @see <a href="https://matrix.org/docs/api/client-server/#!/Room32participation/get_matrix_client_r0_rooms_roomId_messages">matrix.org</a> * @param roomId ID of the room from which to get events * @param from The token to start returning events from. This token can be obtained from a prev_batch token returned for each room by the sync API, or from a start or end token returned by a previous request to this endpoint. * @param to The token to stop returning events at. This token can be obtained from a prev_batch token returned for each room by the sync endpoint, or from a start or end token returned by a previous request to this endpoint. * @param backward The direction to return events from. false = forward * @param limit The maximum number of events to return. May be null. * @return Valid Json response */ JsonObject getRoomMessages(String roomId, String from, String to, boolean backward, Integer limit) throws RestfulHTTPException, IOException; /** * Get the list of members for this room. * @see <a href="https://matrix.org/docs/api/client-server/#!/Room_participation/get_matrix_client_r0_rooms_roomId_members">matrix.org</a> * @param roomId The unique ID of a room (e.g. "!cURbafjkfsMDVwdRDQ:matrix.org") * @return Valid Json response */ JsonObject getRoomMembers(String roomId) throws RestfulHTTPException, IOException; /** * Get the combined profile information for this user. * @see <a href="https://matrix.org/docs/api/client-server/#!/User_data/get_matrix_client_r0_profile_userId">matrix.org</a> * @param userId The unique ID of the user (e.g. "@bob:matrix.org") * @return Valid Json response containing the combined profile information for the user */ JsonObject getUserProfile(String userId) throws RestfulHTTPException, IOException; /** * Get the user's avatar URL. * @see <a href="https://matrix.org/docs/api/client-server/#!/User_data/get_matrix_client_r0_profile_userId_avatar_url">matrix.org</a> * @param userId The unique ID of the user (e.g. "@bob:matrix.org") * @return Valid Json response containing the user avatar url */ JsonObject getUserAvatarUrl(String userId) throws RestfulHTTPException, IOException; /** * Set the user's avatar. * @see <a href="https://matrix.org/docs/api/client-server/#!/User_data/get_matrix_client_r0_profile_userId_avatar_url">matrix.org</a> * @param avatarUrl The matrix media URL of the image (e.g. "avatar_url": "mxc://matrix.org/wefh34uihSDRGhw34") */ void setUserAvatarUrl(URL avatarUrl) throws RestfulHTTPException, IOException; /** * Get the user's display name. * @see <a href="https://matrix.org/docs/api/client-server/#!/User_data/get_matrix_client_r0_profile_userId_displayname">matrix.org</a> * @param userId The unique ID of the user (e.g. "@bob:matrix.org") * @return Valid Json response containing the user display name */ JsonObject getUserDisplayName(String userId) throws RestfulHTTPException, IOException; /** * Set the user's display name. * @see <a href="https://matrix.org/docs/api/client-server/#!/User_data/get_matrix_client_r0_profile_userId_displayname">matrix.org</a> * @param displayName The new display name to be set */ void setUserDisplayName(String displayName) throws RestfulHTTPException, IOException; /** * @see <a href="http://matrix.org/docs/api/client-server/#!/Presence/get_matrix_client_r0_presence_list_userId">matrix.org</a> * @param userId The unique ID of the user (e.g. "@bob:matrix.org") * @return Valid Json response containing the user presence list */ JsonArray getUserPresence(String userId) throws IOException; /** * This endpoint is used to send a message event to a room. * @see <a href="https://matrix.org/docs/api/client-server/#!/Room_participation/put_matrix_client_r0_rooms_roomId_send_eventType_txnId">matrix.org</a> * @param roomId The unique ID of the room (e.g. "!cURbafjkfsMDVwdRDQ:matrix.org") * @param eventType The type of event to send (e.g. "m.room.message") * @param content Event content (e.g. '{"msgtype": "m.text", "body": "I know kung fu" }') * @return Valid Json response containing the event id generated by the server */ JsonObject roomSendEvent(String roomId, String eventType, JsonObject content) throws RestfulHTTPException, IOException; /** * This endpoint is used to get RoomID from the Room Alias. * @see <a href="http://matrix.org/docs/api/client-server/#!/Room_directory/get_matrix_client_r0_directory_room_roomAlias">matrix.org</a> * @param roomAlias The alias of a given room. * @return Valid Json response containing roomID. */ JsonObject getRoomIDFromAlias(String roomAlias) throws MalformedURLException, IOException; /** * This endpoint is used to delete the Room Alias from the current room. * @see <a href="http://matrix.org/docs/api/client-server/#!/Room_directory/delete_matrix_client_r0_directory_room_roomAlias">matrix.org</a> * @param roomAlias The alias of a given room. * @return Valid Json response containing the room ID. */ JsonObject deleteRoomAlias(String roomAlias) throws RestfulHTTPException, IOException; /** * This endpoint is used to set the current rooms Room Alias. * @param roomAlias The rquested roomAlias. * @param roomId The rooms ID. * @return Valid Json response containing the Room ID. */ JsonObject putRoomAlias(String roomAlias, String roomId) throws RestfulHTTPException, IOException; /** * Used to create a room. * @see <a href="http://matrix.org/docs/api/client-server/#!/Room_creation/post_matrix_client_r0_createRoom">matrix.org</a> * @param roomCreation JsonObject containing all required and optional parameters for room creation. * @return Valid Json response containing the Room ID. */ JsonObject postCreateRoom(JsonObject roomCreation) throws RestfulHTTPException, IOException; /** * Used to join a given room. * @see <a href="http://matrix.org/docs/api/client-server/#!/Room_membership/post_matrix_client_r0_rooms_roomId_join">matrix.org</a> * @param roomId The rooms ID. * @param thirdPartySigned Proof of invite from third party entity. * @return Valid Json response containing the Room ID. CURRENTLY RETURNING NOTHING, BUT THE HTTP REQUEST IS GOING THROUGH */ JsonObject postJoinRoomIdorAlias(String roomId, JsonObject thirdPartySigned) throws RestfulHTTPException, IOException; /** * Used to leave a given room. * @see <a href="http://matrix.org/docs/api/client-server/#!/Room_membership/post_matrix_client_r0_rooms_roomId_leave">matrix.org</a> * @param roomId The rooms ID. */ void postLeaveRoom(String roomId) throws RestfulHTTPException, IOException; /** * Used to kick someone from a given room. * @see <a href="http://matrix.org/docs/api/client-server/#!/Room_membership/post_matrix_client_r0_rooms_roomId_kick">matrix.org</a> * @param roomId The rooms ID. * @param reason The given reason for posting the kick. * @param userId The userId of the one being kicked. */ void postKickFromRoom(String roomId, String reason, String userId) throws RestfulHTTPException, IOException; /** * Sends an invite. * @see <a href="http://matrix.org/docs/api/client-server/#!/Room_membership/post_matrix_client_r0_rooms_roomId_invite_0">matrix.org</a> * @param roomId The rooms ID * @param idServer The hostname+port of the identity server which should be used for third party identifier lookups. * @param address The invitee's third party identifier. * @param medium The kind of address being passed in the address field, for example email. */ void postInviteToRoom(String roomId, String address, String idServer, String medium/*contains "id_server","medium" and "address", or simply "user_id"*/) throws RestfulHTTPException, IOException; /** * Sends invite to specific matrix user. * @param roomId The rooms ID * @param userId The invitees user ID */ void postInviteToRoom(String roomId, String userId) throws RestfulHTTPException, IOException; /** * @see <a href="http://matrix.org/docs/api/client-server/#!/User_data/get_matrix_client_r0_account_3pid">matrix.org</a> * @return Valid Json response containing the Room ID. */ JsonObject get3Pid() throws RestfulHTTPException, IOException; /** * Download a file * @param mediaUrl The URL for the media content (e.g. "mxc://matrix.org/wefh34uihSDRGhw34") * @see <a href="https://matrix.org/docs/api/client-server/#!/Media/get_matrix_media_r0_download_serverName_mediaId">matrix.org</a> * @return An InputStream from which the media content can be read * @throws RestfulHTTPException * @throws IOException */ InputStream getMediaContent(URL mediaUrl) throws RestfulHTTPException, IOException; InputStream getMediaContentThumbnail(URL mediaUrl, int size)throws RestfulHTTPException, IOException; }
12,219
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
CustomListCell.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/CustomListCell.java
package com.github.cypher.gui; import javafx.scene.Node; import javafx.scene.control.ListCell; /* List view cellFactory example: listView.setCellFactory((o) -> { ExampleListItemView view = new ExampleListItemView(); view.getView(); return (ExampleListItemPresenter) view.getPresenter(); }); */ /** * Abstract class to be extended by Custom ListCells. * * Simply extend this class, implement the methods and add a cellFactory to your listView * @param <T> */ abstract public class CustomListCell<T> extends ListCell<T> { // The data to be represented by this list cell private T modelComponent = null; protected T getModelComponent(){ return modelComponent; } @Override public void updateItem(T newModelComponent, boolean empty){ super.updateItem(newModelComponent, empty); if (empty || newModelComponent == null) { // Clear and hide cell setModelComponent(null); setText(null); setGraphic(null); } else { // Populate and show cell setModelComponent(newModelComponent); setGraphic(getRoot()); } } // Populate, update or clear the cell private void setModelComponent(T s) { if (s == null && modelComponent != null || s != null &&!s.equals(modelComponent)) { this.modelComponent = s; clearBindings(); if (s != null){ updateBindings(); } } } /** * Returns the root node for the presenter * @return */ protected abstract Node getRoot(); /** * Binds all properties to the modelComponent */ protected abstract void updateBindings(); /** * Removes all bindings to the previous modelComponent */ protected abstract void clearBindings(); }
1,640
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
FXThreadedObservableValueWrapper.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/FXThreadedObservableValueWrapper.java
package com.github.cypher.gui; import javafx.application.Platform; import javafx.beans.InvalidationListener; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import java.util.LinkedList; import java.util.List; // Wraps an ObservableValue to support binding directly to JavaFX GUI elements // while editing the underlying list from another thread. public class FXThreadedObservableValueWrapper<T> implements ObservableValue<T>{ private final ObservableValue<? extends T> inner; private final List<ChangeListener<? super T>> listeners = new LinkedList<>(); private final List<InvalidationListener> invalidationListeners = new LinkedList<>(); // Storing the listeners applied to the inner object. private ChangeListener<T> changeListenerObject; private InvalidationListener invalidationListenerObject; public FXThreadedObservableValueWrapper(ObservableValue<? extends T> observableValue) { this.inner = observableValue; } @Override public void addListener(ChangeListener<? super T> changeListener) { synchronized (this) { // If first listener start listening to inner value if (listeners.isEmpty()) { changeListenerObject = (observable, oldValue, newValue) -> { Platform.runLater(() -> { synchronized (this) { for (ChangeListener<? super T> l : listeners) { l.changed(observable, oldValue, newValue); } } }); }; inner.addListener(changeListenerObject); } listeners.add(changeListener); } } @Override public void removeListener(ChangeListener changeListener) { synchronized (this) { listeners.remove(changeListener); // Remove listener on inner object if listeners list is empty if (listeners.isEmpty()) { inner.removeListener(changeListenerObject); changeListenerObject = null; } } } @Override public T getValue() { synchronized (this) { return inner.getValue(); } } @Override public void addListener(InvalidationListener invalidationListener) { synchronized (this) { // If first listener start listening to inner value if (invalidationListeners.isEmpty()) { invalidationListenerObject = (observable) -> { Platform.runLater(() -> { synchronized (this) { for (InvalidationListener listener : invalidationListeners) { listener.invalidated(this); } } }); }; inner.addListener(invalidationListenerObject); } invalidationListeners.add(invalidationListener); } } @Override public void removeListener(InvalidationListener invalidationListener) { synchronized (this) { invalidationListeners.remove(invalidationListener); // Remove listener on inner object if listeners list is empty if (invalidationListeners.isEmpty()) { inner.removeListener(invalidationListenerObject); invalidationListenerObject = null; } } } }
2,880
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
FXThreadedObservableListWrapper.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/FXThreadedObservableListWrapper.java
package com.github.cypher.gui; import javafx.application.Platform; import javafx.beans.InvalidationListener; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; // Wraps an ObservableList to support binding directly to JavaFX GUI elements // while editing the underlying list from another thread. public class FXThreadedObservableListWrapper<T> { private final ObservableList<T> sourceList; private final ObservableList<T> delegatedList; private final InvalidationListener sourceListListener; @SuppressWarnings("unchecked") public FXThreadedObservableListWrapper(ObservableList<T> sourceList) { this.sourceList = sourceList; this.delegatedList = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); Platform.runLater(() -> delegatedList.addAll(sourceList.toArray((T[])new Object[sourceList.size()]))); sourceListListener = i -> Platform.runLater(() -> delegatedList.setAll(sourceList.toArray((T[])new Object[sourceList.size()]))); sourceList.addListener(sourceListListener); } // Returns the delegatedList which is supposed to be used in eg. ListView::setItems public ObservableList<T> getList(){ return delegatedList; } public void dispose() { sourceList.removeListener(sourceListListener); } }
1,332
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Executor.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/Executor.java
package com.github.cypher.gui; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; public class Executor extends Thread { // Queue of actions private final Queue<Runnable> queue = new ConcurrentLinkedQueue<>(); // Flag for handling interruptions that shouldn't kill the thread private volatile boolean wakeUp = false; @Override public void run() { Runnable current; boolean isRunning = true; while (isRunning) { // Get action. current = queue.poll(); if (current == null) { try { // Sleep for a long time Thread.sleep(100000); } catch (InterruptedException e) { if (wakeUp) { // Resume if interrupt was a wakeUpCall. wakeUp = false; } else { isRunning = false; // Otherwise, kill thread. } } } else { // execute action current.run(); } } } // Receives code to be handled by this thread. public void handle(Runnable e) { queue.add(e); wakeUp(); } // Make the thread wake up from sleep private void wakeUp() { synchronized (this) { if (!wakeUp) { this.wakeUp = true; this.interrupt(); } } } }
1,151
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RootView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/RootView.java
package com.github.cypher.gui.root; import com.airhacks.afterburner.views.FXMLView; public class RootView extends FXMLView { }
129
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RootPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/RootPresenter.java
package com.github.cypher.gui.root; import com.github.cypher.eventbus.ToggleEvent; import com.github.cypher.gui.Executor; import com.github.cypher.gui.FXThreadedObservableListWrapper; import com.github.cypher.gui.root.adddialog.AddDialogView; import com.github.cypher.gui.root.loading.LoadingView; import com.github.cypher.gui.root.login.LoginPresenter; import com.github.cypher.gui.root.login.LoginView; import com.github.cypher.gui.root.roomcollection.RoomCollectionView; import com.github.cypher.gui.root.roomcollectionlistitem.RoomCollectionListItemPresenter; import com.github.cypher.gui.root.roomcollectionlistitem.RoomCollectionListItemView; import com.github.cypher.gui.root.settings.SettingsView; import com.github.cypher.model.Client; import com.github.cypher.model.RoomCollection; import com.github.cypher.model.SdkException; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import javafx.application.Platform; import javafx.collections.ListChangeListener; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.control.Button; import javafx.scene.control.ListView; import javafx.scene.layout.StackPane; import javax.inject.Inject; import java.util.Iterator; // Presenter for the root/main pane of the application public class RootPresenter { @Inject private Client client; @Inject private Executor executor; @Inject private EventBus eventBus; @FXML private StackPane mainStackPane; @FXML private StackPane rightSideStackPane; @FXML private ListView<RoomCollection> roomCollectionListView; private Parent settingsPane; private boolean showSettings; private Parent roomCollectionPane; private Parent addDialogPane; private boolean showAddDialog; private Parent loadingPane; @FXML private void initialize() { eventBus.register(this); loadingPane = new LoadingView().getView(); mainStackPane.getChildren().add(loadingPane); // Only load login pane if user is not already logged in // User might already be logged in if a valid session is available when the application is launched if (client.isLoggedIn()) { eventBus.post(ToggleEvent.SHOW_LOADING); } else { LoginView loginPane = new LoginView(); loginPane.getView().setUserData(loginPane.getPresenter()); mainStackPane.getChildren().add(loginPane.getView()); } settingsPane = new SettingsView().getView(); rightSideStackPane.getChildren().add(settingsPane); showSettings = false; roomCollectionPane = new RoomCollectionView().getView(); rightSideStackPane.getChildren().add(roomCollectionPane); addDialogPane = new AddDialogView().getView(); mainStackPane.getChildren().add(addDialogPane); showAddDialog = false; addDialogPane.toBack(); roomCollectionListView.setCellFactory(listView -> { RoomCollectionListItemView roomCollectionListItemView = new RoomCollectionListItemView(); roomCollectionListItemView.getView(); return (RoomCollectionListItemPresenter) roomCollectionListItemView.getPresenter(); }); roomCollectionListView.setItems(new FXThreadedObservableListWrapper<>(client.getRoomCollections()).getList()); roomCollectionListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { if (newValue != null) { eventBus.post(ToggleEvent.HIDE_SETTINGS); eventBus.post(ToggleEvent.HIDE_ROOM_SETTINGS); eventBus.post(newValue); } }); } @Subscribe private void toggleLoadingScreen(ToggleEvent e) { Platform.runLater(() -> { if (e == ToggleEvent.SHOW_LOADING) { loadingPane.toFront(); } else if (e == ToggleEvent.HIDE_LOADING) { loadingPane.toBack(); } }); } @Subscribe private void toggleSettingsPane(ToggleEvent e){ Platform.runLater(()-> { if (e == ToggleEvent.SHOW_SETTINGS && !showSettings){ settingsPane.toFront(); showSettings = true; }else if (e == ToggleEvent.HIDE_SETTINGS && showSettings){ settingsPane.toBack(); showSettings = false; }else if (e == ToggleEvent.TOGGLE_SETTINGS){ if (showSettings){ settingsPane.toBack(); }else{ settingsPane.toFront(); } showSettings = !showSettings; } }); } @Subscribe private void toggleAddDialogPane(ToggleEvent e) { Platform.runLater(() -> { if (e == ToggleEvent.SHOW_ADD_DIALOG && !showAddDialog) { addDialogPane.toFront(); showAddDialog = true; } else if (e == ToggleEvent.HIDE_ADD_DIALOG && showAddDialog) { addDialogPane.toBack(); showAddDialog = false; } else if (e == ToggleEvent.TOGGLE_ADD_DIALOG) { if (showSettings) { addDialogPane.toBack(); } else { addDialogPane.toFront(); } showAddDialog = !showAddDialog; } }); } @Subscribe private void handleLoginStateChanged(ToggleEvent e) { Platform.runLater(() -> { if (e == ToggleEvent.LOGIN) { // Iterators are used instead of for-each loop as the node is removed from inside the loop for (Iterator<Node> iter = mainStackPane.getChildren().iterator(); iter.hasNext(); ) { Node child = iter.next(); if (child.getUserData() != null && child.getUserData() instanceof LoginPresenter) { ((LoginPresenter) child.getUserData()).deinitialize(); iter.remove(); } } } else if (e == ToggleEvent.LOGOUT) { LoginView loginPane = new LoginView(); loginPane.getView().setUserData(loginPane.getPresenter()); mainStackPane.getChildren().add(loginPane.getView()); // Reset presenter to default values settingsPane.toBack(); showSettings = false; addDialogPane.toBack(); showAddDialog = false; } }); } @FXML private void toggleSettings() { eventBus.post(ToggleEvent.TOGGLE_SETTINGS); } @FXML public void openAddDialog() { eventBus.post(ToggleEvent.SHOW_ADD_DIALOG); } }
5,844
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RoomCollectionListItemView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollectionlistitem/RoomCollectionListItemView.java
package com.github.cypher.gui.root.roomcollectionlistitem; import com.airhacks.afterburner.views.FXMLView; public class RoomCollectionListItemView extends FXMLView { }
170
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RoomCollectionListItemPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollectionlistitem/RoomCollectionListItemPresenter.java
package com.github.cypher.gui.root.roomcollectionlistitem; import com.github.cypher.model.Server; import com.github.cypher.settings.Settings; import com.github.cypher.gui.CustomListCell; import com.github.cypher.gui.FXThreadedObservableValueWrapper; import com.github.cypher.model.Client; import com.github.cypher.model.RoomCollection; import javafx.fxml.FXML; import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.image.ImageView; import javafx.scene.layout.StackPane; import javax.inject.Inject; public class RoomCollectionListItemPresenter extends CustomListCell<RoomCollection> { @Inject private Client client; @Inject private Settings settings; @FXML private StackPane root; @FXML private ImageView imageView; @FXML private Label letterIdentifier; @Override protected Node getRoot() { return root; } @Override protected void updateBindings() { if (getModelComponent() instanceof Server){ imageView.setImage(null); letterIdentifier.textProperty().setValue(String.valueOf(((Server) getModelComponent()).getAddress().toUpperCase().charAt(0))); letterIdentifier.toFront(); }else{ letterIdentifier.textProperty().setValue(""); imageView.imageProperty().bind(new FXThreadedObservableValueWrapper<>(getModelComponent().getImageProperty())); imageView.toFront(); } } @Override protected void clearBindings() { imageView.imageProperty().unbind(); } }
1,432
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
LoginPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/login/LoginPresenter.java
package com.github.cypher.gui.root.login; import com.github.cypher.settings.Settings; import com.github.cypher.gui.Executor; import com.github.cypher.model.Client; import com.github.cypher.model.SdkException; import javafx.application.Platform; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; import javafx.scene.layout.AnchorPane; import javafx.scene.web.WebView; import javax.inject.Inject; import java.net.URL; public class LoginPresenter { @Inject private Client client; @Inject private Settings settings; @Inject private Executor executor; @FXML private TextField loginUsernameField; @FXML private PasswordField loginPasswordField; @FXML private TextField loginHomeserverField; @FXML private CheckBox rememberMeCheckBox; @FXML private TextField registrationUsernameField; @FXML private PasswordField registrationPasswordField; @FXML private TextField registrationHomeserverField; @FXML private CheckBox registrationRememberMeCheckBox; @FXML private WebView webView; @FXML private AnchorPane loginPane; @FXML private Button loginButton; @FXML private AnchorPane registerPane; @FXML private Button registrationButton; @FXML public void initialize() { URL url = getClass().getResource("/particles/index.html"); System.out.println(); webView.getEngine().load(url.toString()); webView.contextMenuEnabledProperty().set(false); } // Deinitializing has to be done when you are done with the class. Otherwise the interactive login background keeps running. public void deinitialize() { webView.getEngine().loadContent(""); } @FXML private void switchPanes() { if(loginPane.isVisible()) { registerPane.setVisible(true); registerPane.toFront(); loginPane.setVisible(false); } else { loginPane.setVisible(true); loginPane.toFront(); registerPane.setVisible(false); } } @FXML private void login() { if (!loginUsernameField.getText().isEmpty() && !loginPasswordField.getText().isEmpty() && !loginHomeserverField.getText().isEmpty()) { executor.handle(() -> { try { Platform.runLater(() -> loginButton.setDisable(true)); client.login(loginUsernameField.getText(), loginPasswordField.getText(), loginHomeserverField.getText()); settings.setSaveSession(rememberMeCheckBox.isSelected()); } catch (SdkException e) { System.out.printf("SdkException when trying to login - %s\n", e.getMessage()); } Platform.runLater(() -> loginButton.setDisable(false)); }); } } @FXML private void register() { if (!registrationUsernameField.getText().isEmpty() && !registrationPasswordField.getText().isEmpty() && !registrationHomeserverField.getText().isEmpty()) { executor.handle(() -> { try { Platform.runLater(() -> registrationButton.setDisable(true)); client.register(registrationUsernameField.getText(), registrationPasswordField.getText(), registrationHomeserverField.getText()); settings.setSaveSession(registrationRememberMeCheckBox.isSelected()); } catch (SdkException e) { System.out.printf("SdkException when trying to login - %s\n", e.getMessage()); } Platform.runLater(() -> registrationButton.setDisable(false)); }); } } }
3,337
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
LoginView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/login/LoginView.java
package com.github.cypher.gui.root.login; import com.airhacks.afterburner.views.FXMLView; public class LoginView extends FXMLView { }
136
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
SettingsPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/settings/SettingsPresenter.java
package com.github.cypher.gui.root.settings; import com.github.cypher.gui.Executor; import com.github.cypher.model.Client; import com.github.cypher.model.SdkException; import com.github.cypher.settings.Settings; import javafx.application.Platform; import javafx.fxml.FXML; import javafx.scene.control.*; import javax.inject.Inject; import java.util.Locale; public class SettingsPresenter { @Inject private Client client; @Inject private Settings settings; @Inject private Executor executor; @FXML private ChoiceBox<String> languageChoiceBox; @FXML private CheckBox systemTrayCheckBox; @FXML private RadioButton enterRadioButton; @FXML private RadioButton ctrlEnterRadioButton; @FXML private Button logoutButton; @FXML private Label changesRequireRestartLabel; @FXML private void initialize() { String language = settings.getLanguage().getLanguage(); if ("en".equals(language)) { languageChoiceBox.setValue("English"); }else if ("sv".equals(language)) { languageChoiceBox.setValue("Svenska"); } languageChoiceBox.getSelectionModel().selectedItemProperty().addListener((observable, oldLanguage, newLanguage) -> { if ("English".equals(newLanguage)) { settings.setLanguage(Locale.ENGLISH); } else if ("Svenska".equals(newLanguage)) { settings.setLanguage(new Locale("sv","SE")); } changesRequireRestartLabel.setVisible(true); }); if (settings.getUseSystemTray()) { systemTrayCheckBox.setSelected(true); } else { systemTrayCheckBox.setSelected(false); } systemTrayCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> { if (newValue) { settings.setUseSystemTray(true); } else { settings.setUseSystemTray(false); } changesRequireRestartLabel.setVisible(true); }); ToggleGroup sendMessageToggleGroup = new ToggleGroup(); enterRadioButton.setToggleGroup(sendMessageToggleGroup); ctrlEnterRadioButton.setToggleGroup(sendMessageToggleGroup); if (settings.getControlEnterToSendMessage()) { ctrlEnterRadioButton.setSelected(true); } else { enterRadioButton.setSelected(true); } sendMessageToggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> { if (newValue == enterRadioButton) { settings.setControlEnterToSendMessage(false); } else { settings.setControlEnterToSendMessage(true); } }); } @FXML private void logout() { logoutButton.setDisable(true); executor.handle(() -> { try { client.logout(); } catch (SdkException e) { System.out.printf("SdkException when trying to logout - %s\n", e.getMessage()); } Platform.runLater(() -> logoutButton.setDisable(false)); }); } }
2,698
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
SettingsView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/settings/SettingsView.java
package com.github.cypher.gui.root.settings; import com.airhacks.afterburner.views.FXMLView; public class SettingsView extends FXMLView { }
142
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RoomCollectionPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/RoomCollectionPresenter.java
package com.github.cypher.gui.root.roomcollection; import com.github.cypher.eventbus.ToggleEvent; import com.github.cypher.gui.FXThreadedObservableListWrapper; import com.github.cypher.gui.FXThreadedObservableValueWrapper; import com.github.cypher.gui.root.roomcollection.directory.DirectoryView; import com.github.cypher.gui.root.roomcollection.room.RoomView; import com.github.cypher.gui.root.roomcollection.roomlistitem.RoomListItemPresenter; import com.github.cypher.gui.root.roomcollection.roomlistitem.RoomListItemView; import com.github.cypher.model.Room; import com.github.cypher.model.Client; import com.github.cypher.model.RoomCollection; import com.github.cypher.model.PMCollection; import com.github.cypher.model.GeneralCollection; import com.github.cypher.model.Server; import com.github.cypher.settings.Settings; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import javafx.application.Platform; import javafx.fxml.FXML; import javafx.scene.Parent; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.layout.StackPane; import javax.inject.Inject; import java.util.Locale; import java.util.ResourceBundle; public class RoomCollectionPresenter { private final ResourceBundle bundle = ResourceBundle.getBundle( "com.github.cypher.gui.root.roomcollection.roomcollection", Locale.getDefault() ); @Inject private Client client; @Inject private Settings settings; @Inject private EventBus eventBus; @FXML private StackPane rightSideStackPane; @FXML private ListView<Room> roomListView; @FXML private Label serverName; private Parent directoryPane; private boolean showDirectory; private FXThreadedObservableListWrapper<Room> backendListForView; @FXML private void initialize() { eventBus.register(this); directoryPane = new DirectoryView().getView(); rightSideStackPane.getChildren().add(directoryPane); Parent roomPane = new RoomView().getView(); rightSideStackPane.getChildren().add(roomPane); roomCollectionChanged(client.getSelectedRoomCollection()); roomListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { if (newValue != null) { eventBus.post(newValue); eventBus.post(ToggleEvent.HIDE_ROOM_SETTINGS); } }); showDirectory = false; } // In the future if separate fxml/views/presenters exists for Server/PMCollection/GeneralCollection // we change which pane is in the front of the StackPane. // // Currently while only RoomCollection exists buttons are just enabled and disabled depending on which kind of // RoomCollection is currently shown. @Subscribe private void roomCollectionChanged(RoomCollection roomCollection) { Platform.runLater(()->{ if (backendListForView != null) { backendListForView.dispose(); } backendListForView = new FXThreadedObservableListWrapper<>(roomCollection.getRoomsProperty()); roomListView.setCellFactory(listView -> { RoomListItemView roomListItemView = new RoomListItemView(); roomListItemView.getView(); return (RoomListItemPresenter) roomListItemView.getPresenter(); }); roomListView.setItems(backendListForView.getList()); serverName.textProperty().unbind(); if (roomCollection instanceof Server) { serverName.textProperty().bind( new FXThreadedObservableValueWrapper<>( ((Server) roomCollection).nameProperty() ) ); } else if (roomCollection instanceof PMCollection) { serverName.textProperty().setValue(bundle.getString("pm")); } else if (roomCollection instanceof GeneralCollection) { serverName.textProperty().setValue(bundle.getString("general")); } // Handle room selection (selects the first room in the RoomCollection if the RoomCollection // isn't empty and if the previously selected room isn't in the current RoomCollection) if (roomCollection.getRoomsProperty().contains(client.getSelectedRoom())) { roomListView.getSelectionModel().select(client.getSelectedRoom()); } else if (roomCollection.getRoomsProperty().size() > 0) { eventBus.post(roomCollection.getRoomsProperty().get(0)); roomListView.getSelectionModel().select(0); } }); } @Subscribe private void handleLoginStateChange(ToggleEvent e) { if (e == ToggleEvent.LOGOUT) { showDirectory = false; directoryPane.toBack(); } } @Subscribe private void toggleDirectory(ToggleEvent e) { Platform.runLater(()-> { if (e == ToggleEvent.SHOW_DIRECTORY && !showDirectory){ directoryPane.toFront(); showDirectory = true; }else if (e == ToggleEvent.HIDE_DIRECTORY && showDirectory){ directoryPane.toBack(); showDirectory = false; }else if (e == ToggleEvent.TOGGLE_DIRECTORY){ if (showDirectory){ directoryPane.toBack(); }else{ directoryPane.toFront(); } showDirectory = !showDirectory; } }); } @FXML private void onShowDirectoryClick() { eventBus.post(ToggleEvent.TOGGLE_DIRECTORY); } }
5,001
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RoomCollectionView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/RoomCollectionView.java
package com.github.cypher.gui.root.roomcollection; import com.airhacks.afterburner.views.FXMLView; public class RoomCollectionView extends FXMLView { }
154
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
DirectoryView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/directory/DirectoryView.java
package com.github.cypher.gui.root.roomcollection.directory; import com.airhacks.afterburner.views.FXMLView; public class DirectoryView extends FXMLView { }
159
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
DirectoryPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/directory/DirectoryPresenter.java
package com.github.cypher.gui.root.roomcollection.directory; import com.github.cypher.eventbus.ToggleEvent; import com.github.cypher.settings.Settings; import com.github.cypher.model.Client; import com.google.common.eventbus.EventBus; import javafx.fxml.FXML; import javax.inject.Inject; public class DirectoryPresenter { @Inject private Client client; @Inject private Settings settings; @Inject private EventBus eventBus; @FXML private void hideDirectory() { eventBus.post(ToggleEvent.HIDE_DIRECTORY); } }
526
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RoomListItemView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/roomlistitem/RoomListItemView.java
package com.github.cypher.gui.root.roomcollection.roomlistitem; import com.airhacks.afterburner.views.FXMLView; public class RoomListItemView extends FXMLView { }
165
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RoomListItemPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/roomlistitem/RoomListItemPresenter.java
package com.github.cypher.gui.root.roomcollection.roomlistitem; import com.github.cypher.gui.CustomListCell; import com.github.cypher.gui.Executor; import com.github.cypher.gui.FXThreadedObservableValueWrapper; import com.github.cypher.model.Room; import javafx.application.Platform; import javafx.beans.property.ObjectProperty; import javafx.fxml.FXML; import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.control.TextArea; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javax.inject.Inject; import java.util.Locale; import java.util.ResourceBundle; public class RoomListItemPresenter extends CustomListCell<Room> { @Inject private Executor executor; @FXML private AnchorPane root; @FXML private Label name; @FXML private ImageView avatar; @FXML private Label topic; private final ResourceBundle bundle = ResourceBundle.getBundle( "com.github.cypher.gui.root.roomcollection.roomlistitem.roomlistitem", Locale.getDefault()); @Override protected Node getRoot() { return root; } @Override protected void updateBindings() { Room room = getModelComponent(); Platform.runLater(() ->{ (new FXThreadedObservableValueWrapper<>(room.nameProperty())).addListener((invalidated) -> { updateRoomName(room); } ); (new FXThreadedObservableValueWrapper<>(room.topicProperty())).addListener((invalidated) -> { updateTopicName(room); } ); updateRoomName(room); updateTopicName(room); }); executor.handle(() -> { ObjectProperty<Image> image = room.avatarProperty(); Platform.runLater(() -> { if (room.equals(getModelComponent())) { avatar.imageProperty().bind(new FXThreadedObservableValueWrapper<>(image)); } }); }); } @Override protected void clearBindings() { name.textProperty().unbind(); avatar.imageProperty().unbind(); avatar.imageProperty().set(null); topic.textProperty().unbind(); } private void updateRoomName(Room room){ if (room.getName() == null || room.getName().isEmpty()) { name.textProperty().setValue(bundle.getString("name.default")); }else{ name.textProperty().setValue(room.getName()); } } private void updateTopicName(Room room){ if (room.getTopic() == null || room.getTopic().isEmpty()) { topic.textProperty().setValue(bundle.getString("topic.default")); }else{ topic.textProperty().setValue(room.getTopic()); } } }
2,459
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RoomPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/room/RoomPresenter.java
package com.github.cypher.gui.root.roomcollection.room; import com.github.cypher.eventbus.ToggleEvent; import com.github.cypher.gui.FXThreadedObservableListWrapper; import com.github.cypher.gui.root.roomcollection.room.chat.ChatView; import com.github.cypher.gui.root.roomcollection.room.memberlistitem.MemberListItemPresenter; import com.github.cypher.gui.root.roomcollection.room.memberlistitem.MemberListItemView; import com.github.cypher.gui.root.roomcollection.room.settings.SettingsView; import com.github.cypher.model.Client; import com.github.cypher.model.Member; import com.github.cypher.model.Room; import com.github.cypher.settings.Settings; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import javafx.application.Platform; import javafx.fxml.FXML; import javafx.scene.Parent; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.StackPane; import javax.inject.Inject; import java.util.Locale; import java.util.ResourceBundle; public class RoomPresenter { @Inject private Client client; @Inject private Settings settings; @Inject private EventBus eventBus; @FXML private StackPane mainStackPane; @FXML private AnchorPane chat; @FXML private Label membersLabel; @FXML private ListView<Member> memberListView; private FXThreadedObservableListWrapper<Member> backendListForMemberView; private Parent settingsPane; private boolean showRoomSettings; private final ResourceBundle bundle = ResourceBundle.getBundle("com.github.cypher.gui.root.roomcollection.room.room", Locale.getDefault()); @FXML private void initialize() { eventBus.register(this); ChatView chatView = new ChatView(); chat.getChildren().add(chatView.getView()); settingsPane = new SettingsView().getView(); mainStackPane.getChildren().add(settingsPane); settingsPane.toBack(); showRoomSettings = false; } @Subscribe private void toggleRoomSettings(ToggleEvent e) { if (e == ToggleEvent.SHOW_ROOM_SETTINGS && !showRoomSettings) { settingsPane.toFront(); showRoomSettings = true; } else if (e == ToggleEvent.HIDE_ROOM_SETTINGS && showRoomSettings) { settingsPane.toBack(); showRoomSettings = false; } else if (e == ToggleEvent.TOGGLE_ROOM_SETTINGS) { if (showRoomSettings) { settingsPane.toBack(); } else { settingsPane.toFront(); } showRoomSettings = !showRoomSettings; } } @Subscribe private void handleLoginStateChange(ToggleEvent e) { if (e == ToggleEvent.LOGOUT) { showRoomSettings = false; settingsPane.toBack(); } } @Subscribe private void selectedRoomChanged(Room room) { Platform.runLater(() -> { if (backendListForMemberView != null) { backendListForMemberView.dispose(); } backendListForMemberView = new FXThreadedObservableListWrapper<>(room.getMembersProperty()); memberListView.setCellFactory(listView -> { MemberListItemView memberListItemView = new MemberListItemView(); memberListItemView.getView(); return (MemberListItemPresenter) memberListItemView.getPresenter(); }); memberListView.setItems(backendListForMemberView.getList()); //Fix that is needed for css to work properly. memberListView.getSelectionModel().clearSelection(); //TODO: Fix this so that the label is updated when room.getMembersProperty change! membersLabel.setText(bundle.getString("members") + " - " + room.getMemberCount()); }); } }
3,489
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RoomView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/room/RoomView.java
package com.github.cypher.gui.root.roomcollection.room; import com.airhacks.afterburner.views.FXMLView; public class RoomView extends FXMLView { }
149
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
ChatView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/room/chat/ChatView.java
package com.github.cypher.gui.root.roomcollection.room.chat; import com.airhacks.afterburner.views.FXMLView; public class ChatView extends FXMLView { }
154
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
ChatPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/room/chat/ChatPresenter.java
package com.github.cypher.gui.root.roomcollection.room.chat; import com.github.cypher.gui.Executor; import com.github.cypher.gui.FXThreadedObservableListWrapper; import com.github.cypher.gui.FXThreadedObservableValueWrapper; import com.github.cypher.gui.root.roomcollection.room.chat.eventlistitem.EventListItemPresenter; import com.github.cypher.gui.root.roomcollection.room.chat.eventlistitem.EventListItemView; import com.github.cypher.eventbus.ToggleEvent; import com.github.cypher.model.Client; import com.github.cypher.model.Event; import com.github.cypher.model.Room; import com.github.cypher.model.SdkException; import com.github.cypher.settings.Settings; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import javafx.animation.FadeTransition; import javafx.animation.RotateTransition; import javafx.animation.Timeline; import javafx.application.Platform; import javafx.beans.InvalidationListener; import javafx.beans.value.ChangeListener; import javafx.fxml.FXML; import javafx.geometry.Orientation; import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.control.ScrollBar; import javafx.scene.control.TextArea; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.scene.shape.SVGPath; import javafx.util.Duration; import javax.inject.Inject; import java.util.Locale; import java.util.ResourceBundle; public class ChatPresenter { private static final int HISTORY_CHUNK_SIZE = 16; @Inject private Client client; @Inject private Settings settings; @Inject private EventBus eventBus; @Inject private Executor executor; @FXML private ListView<Event> eventListView; private ScrollBar eventListScrollBar; private Integer scrollTo = null; private FXThreadedObservableListWrapper<Event> backendListForEventView; private final ChangeListener<? super Number> scrollListener = (observable, oldValue, newValue) -> checkMessageHistoryDemand(); private volatile boolean isLoadingHistory = false; @FXML private TextArea messageBox; @FXML private Label roomName; @FXML private Label roomTopic; @FXML private SVGPath bufferingIcon; private RotateTransition bufferIconAnimation; private FadeTransition bufferFadeIn; private FadeTransition bufferFadeOut; private final ResourceBundle bundle = ResourceBundle.getBundle( "com.github.cypher.gui.root.roomcollection.room.chat.chat", Locale.getDefault()); @FXML private void initialize() { eventBus.register(this); messageBox.setDisable(client.getSelectedRoom() == null); eventListView.setCellFactory(listView -> { EventListItemView memberListItemView = new EventListItemView(); memberListItemView.getView(); return (EventListItemPresenter)memberListItemView.getPresenter(); }); eventListView.itemsProperty().addListener((observable, oldValue, newValue) -> { if(eventListScrollBar != null) { eventListScrollBar.valueProperty().removeListener(scrollListener); } this.eventListScrollBar = getListViewScrollBar(eventListView, Orientation.VERTICAL); if(eventListScrollBar != null) { eventListScrollBar.valueProperty().addListener(scrollListener); } }); // Buffering icon animations bufferIconAnimation = new RotateTransition(Duration.millis(1000), bufferingIcon); bufferIconAnimation.setCycleCount(Timeline.INDEFINITE); bufferIconAnimation.setByAngle(360); bufferFadeIn = new FadeTransition(Duration.millis(200), bufferingIcon); bufferFadeIn.setFromValue(0.0); bufferFadeIn.setToValue(1.0); bufferFadeOut = new FadeTransition(Duration.millis(200), bufferingIcon); bufferFadeOut.setFromValue(1.0); bufferFadeOut.setToValue(0.0); } private void checkMessageHistoryDemand() { if(isLoadingHistory) { return; } Room room = client.getSelectedRoom(); ScrollBar scrollBar = eventListScrollBar; if(room != null && scrollBar != null && // Is the scroll bar at the top? scrollBar.getValue() == scrollBar.getMin()) { // Save current scroll bar position scrollTo = backendListForEventView.getList().size() - 1; isLoadingHistory = true; bufferFadeOut.stop(); bufferFadeIn.setFromValue(bufferingIcon.getOpacity()); bufferFadeIn.play(); bufferIconAnimation.play(); executor.handle(() -> { try { // Try to load more history boolean more = room.loadEventHistory(HISTORY_CHUNK_SIZE); bufferFadeIn.stop(); bufferFadeOut.setFromValue(bufferingIcon.getOpacity()); bufferFadeOut.play(); bufferIconAnimation.stop(); isLoadingHistory = false; if(more) { // If not all history is loaded, run method again checkMessageHistoryDemand(); } } catch (SdkException e) { isLoadingHistory = false; System.out.printf("SdkException when trying to get room history: %s\n", e); } }); } } private ScrollBar getListViewScrollBar(ListView listView, Orientation orientation) { for(Node node : listView.lookupAll(".scroll-bar")) { if(node instanceof ScrollBar && ((ScrollBar)node).getOrientation() == orientation) { return (ScrollBar)node; } } return null; } @Subscribe private void selectedRoomChanged(Room room){ Platform.runLater(() -> { messageBox.setDisable(false); (new FXThreadedObservableValueWrapper<>(room.nameProperty())).addListener((invalidated) -> { updateRoomName(room); } ); (new FXThreadedObservableValueWrapper<>(room.topicProperty())).addListener((invalidated) -> { updateTopicName(room); } ); updateRoomName(room); updateTopicName(room); if (backendListForEventView != null) { backendListForEventView.dispose(); } backendListForEventView = new FXThreadedObservableListWrapper<>(room.getEvents()); eventListView.setItems(backendListForEventView.getList()); InvalidationListener l = o -> { if(scrollTo != null) { eventListView.scrollTo(eventListView.getItems().size() - scrollTo); } }; backendListForEventView.getList().addListener(l); checkMessageHistoryDemand(); }); } private void updateRoomName(Room room){ if (room.getName() == null || room.getName().isEmpty()) { roomName.textProperty().setValue(bundle.getString("name.default")); }else{ roomName.textProperty().setValue(room.getName()); } } private void updateTopicName(Room room){ if (room.getTopic() == null || room.getTopic().isEmpty()) { roomTopic.textProperty().setValue(bundle.getString("topic.default")); }else{ roomTopic.textProperty().setValue(room.getTopic()); } } @Subscribe private void handleLoginStateChange(ToggleEvent e) { if (e == ToggleEvent.LOGOUT) { messageBox.setDisable(true); } } @FXML private void showRoomSettings() { eventBus.post(ToggleEvent.SHOW_ROOM_SETTINGS); } @FXML private void onMessageBoxKeyPressed(KeyEvent event) { if(KeyCode.ENTER.equals(event.getCode())) { if (((settings.getControlEnterToSendMessage() && event.isControlDown()) || (!settings.getControlEnterToSendMessage() && !event.isShiftDown())) && !messageBox.getText().isEmpty()) { Room room = client.getSelectedRoom(); if(room != null) { try { room.sendMessage(messageBox.getText()); } catch(SdkException e) { System.out.printf("SdkException when trying to send a message: %s\n", e); } } messageBox.clear(); event.consume(); } else if(event.isShiftDown()) { messageBox.insertText( messageBox.getCaretPosition(), "\n" ); } } } }
7,539
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
EventListItemPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/room/chat/eventlistitem/EventListItemPresenter.java
package com.github.cypher.gui.root.roomcollection.room.chat.eventlistitem; import com.github.cypher.gui.CustomListCell; import com.github.cypher.gui.Executor; import com.github.cypher.gui.FXThreadedObservableValueWrapper; import com.github.cypher.model.Client; import com.github.cypher.model.Event; import com.github.cypher.model.Message; import javafx.application.Platform; import javafx.beans.property.ObjectProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.fxml.FXML; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.scene.text.Text; import javafx.scene.text.TextFlow; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.nodes.TextNode; import javax.inject.Inject; import java.util.LinkedList; import java.util.List; public class EventListItemPresenter extends CustomListCell<Event> { private static final int LIST_CELL_PADDING = 14; @Inject private Client client; @Inject private Executor executor; @FXML private AnchorPane root; @FXML private Label author; @FXML private TextFlow bodyContainer; @FXML private ImageView avatar; private boolean formatted = false; private final ChangeListener<String> bodyChangeListener = (ObservableValue<? extends String> observable, String oldValue, String newValue) -> { if(formatted) { generateFormattedTextObjects(newValue); } else { generateTextObjects(newValue); } }; private Message oldMessage = null; public EventListItemPresenter() { super.parentProperty().addListener((observable, oldParent, newParent) -> { if(newParent == null) { root.maxWidthProperty().unbind(); } else { Parent recursiveParent = newParent; while(recursiveParent != null && !(recursiveParent instanceof ListView)) { recursiveParent = recursiveParent.getParent(); } if(recursiveParent != null) { root.maxWidthProperty().bind(((ListView)recursiveParent).widthProperty().subtract(LIST_CELL_PADDING)); } } }); } @Override protected Node getRoot() { return root; } @Override protected void updateBindings() { Event event = getModelComponent(); if(event instanceof Message) { Message message = (Message)event; oldMessage = message; author.textProperty().bind(new FXThreadedObservableValueWrapper<>(message.getSender().nameProperty())); if(message.getFormattedBody() == null || message.getFormattedBody().equals("")) { new FXThreadedObservableValueWrapper<>(message.bodyProperty()).addListener(bodyChangeListener); } else { formatted = true; new FXThreadedObservableValueWrapper<>(message.formattedBodyProperty()).addListener(bodyChangeListener); } if(formatted) { try { generateFormattedTextObjects(message.getFormattedBody()); } catch(IllegalArgumentException e) { generateTextObjects(message.getBody()); } } else { generateTextObjects(message.getBody()); } executor.handle(() -> { ObjectProperty<Image> image = message.getSender().avatarProperty(); Platform.runLater(() -> { if(message.equals(getModelComponent())){ avatar.imageProperty().bind(new FXThreadedObservableValueWrapper<>(image)); } }); }); } } @Override protected void clearBindings() { bodyContainer.getChildren().clear(); author.textProperty().unbind(); avatar.imageProperty().unbind(); avatar.imageProperty().set(null); if(oldMessage != null) { oldMessage.bodyProperty().removeListener(bodyChangeListener); oldMessage.formattedBodyProperty().removeListener(bodyChangeListener); oldMessage = null; } } private void generateTextObjects(String text) { bodyContainer.getChildren().clear(); Text textObject = new Text(text); bodyContainer.getChildren().add(textObject); } private void generateFormattedTextObjects(String text) throws IllegalArgumentException { Document document = Jsoup.parseBodyFragment(text); document.outputSettings(new Document.OutputSettings().prettyPrint(false)); parseFormattedMessageNode(document.body(), new LinkedList<>()); } private void parseFormattedMessageNode(org.jsoup.nodes.Node node, List<Element> p) { List textFlowList = bodyContainer.getChildren(); List<Element> parents = p; if(node instanceof TextNode) { // Ignore TextNodes containing only whitespace if(!node.outerHtml().replace(" ", "").equals("")) { String text = ((TextNode) node).getWholeText(); Text textObject = new Text(text); boolean pre = false; // Go through all parent tags and apply styling for(Element element : parents) { String tagName = element.tagName(); if ("ul".equals(tagName)) { // Begin bullet list } else if("ol".equals(tagName)) { // TODO: Begin numbered list } else if("li".equals(tagName)) { // List item textFlowList.add(new Text(" • ")); } else if("blockquote".equals(tagName)) { textObject.getStyleClass().add("block-quote"); } else if("pre".equals(tagName)) { // Preceeds a <code> tag to specify a multiline block pre = true; } else if("code".equals(tagName)) { // Monospace and TODO: code highlighting if(pre) { textObject.getStyleClass().add("block-monospace"); } else { textObject.getStyleClass().add("inline-monospace"); } break; // We don't care about anything appearing within a <code> tag } else { // Other tags are applied ass CSS classes textObject.getStyleClass().add(tagName); } } textFlowList.add(textObject); textObject.applyCss(); } } else if(node instanceof Element) { parents = new LinkedList<>(parents); parents.add((Element)node); } // Recursively parse child tags for(org.jsoup.nodes.Node child: node.childNodes()) { parseFormattedMessageNode(child, parents); } } }
6,063
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
EventListItemView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/room/chat/eventlistitem/EventListItemView.java
package com.github.cypher.gui.root.roomcollection.room.chat.eventlistitem; import com.airhacks.afterburner.views.FXMLView; public class EventListItemView extends FXMLView { }
177
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
SettingsPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/room/settings/SettingsPresenter.java
package com.github.cypher.gui.root.roomcollection.room.settings; import com.github.cypher.eventbus.ToggleEvent; import com.github.cypher.settings.Settings; import com.github.cypher.model.Client; import com.google.common.eventbus.EventBus; import javafx.fxml.FXML; import javax.inject.Inject; public class SettingsPresenter { @Inject private Client client; @Inject private Settings settings; @Inject private EventBus eventBus; @FXML private void hideRoomSettings() { eventBus.post(ToggleEvent.HIDE_ROOM_SETTINGS); } }
535
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
SettingsView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/room/settings/SettingsView.java
package com.github.cypher.gui.root.roomcollection.room.settings; import com.airhacks.afterburner.views.FXMLView; public class SettingsView extends FXMLView { }
162
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
MemberListItemView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/room/memberlistitem/MemberListItemView.java
package com.github.cypher.gui.root.roomcollection.room.memberlistitem; import com.airhacks.afterburner.views.FXMLView; public class MemberListItemView extends FXMLView { }
174
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
MemberListItemPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/roomcollection/room/memberlistitem/MemberListItemPresenter.java
package com.github.cypher.gui.root.roomcollection.room.memberlistitem; import com.github.cypher.eventbus.ToggleEvent; import com.github.cypher.gui.Executor; import com.github.cypher.gui.FXThreadedObservableValueWrapper; import com.github.cypher.settings.Settings; import com.github.cypher.model.Client; import com.github.cypher.model.Member; import com.github.cypher.gui.CustomListCell; import com.google.common.eventbus.EventBus; import javafx.application.Platform; import javafx.beans.property.ObjectProperty; import javafx.fxml.FXML; import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javax.inject.Inject; public class MemberListItemPresenter extends CustomListCell<Member> { @Inject private Client client; @Inject private Settings settings; @Inject private EventBus eventBus; @Inject private Executor executor; @FXML public AnchorPane root; @FXML private ImageView imageView; @FXML private Label label; @FXML private void hideRoomSettings() { eventBus.post(ToggleEvent.HIDE_ROOM_SETTINGS); } @Override protected Node getRoot() { return root; } @Override protected void updateBindings() { Member m = getModelComponent(); executor.handle(() -> { ObjectProperty<Image> avatar = m.getUser().avatarProperty(); Platform.runLater(() -> { if (m.equals(getModelComponent())) { imageView.imageProperty().bind(new FXThreadedObservableValueWrapper<>(avatar)); } }); }); label.textProperty().bind(new FXThreadedObservableValueWrapper<>(m.getName())); } @Override protected void clearBindings() { imageView.imageProperty().unbind(); imageView.imageProperty().set(null); label.textProperty().unbind(); } }
1,803
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
AddDialogPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/adddialog/AddDialogPresenter.java
package com.github.cypher.gui.root.adddialog; import com.github.cypher.eventbus.ToggleEvent; import com.github.cypher.model.Client; import com.github.cypher.settings.Settings; import com.google.common.eventbus.EventBus; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.TextField; import javafx.scene.text.Text; import javax.inject.Inject; import java.io.IOException; public class AddDialogPresenter { @Inject private Client client; @Inject private Settings settings; @Inject private EventBus eventBus; @FXML public TextField serverUrlField; @FXML public Text inputValidationFeedback; @FXML public void submit(ActionEvent actionEvent) { try { client.add(serverUrlField.getText()); exitPane(); } catch (IOException e) { inputValidationFeedback.setText(e.getMessage()); inputValidationFeedback.setWrappingWidth(150); } } @FXML private void exitPane() { eventBus.post(ToggleEvent.HIDE_ADD_DIALOG); serverUrlField.clear(); inputValidationFeedback.setText(""); } }
1,048
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
AddDialogView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/adddialog/AddDialogView.java
package com.github.cypher.gui.root.adddialog; import com.airhacks.afterburner.views.FXMLView; public class AddDialogView extends FXMLView { }
144
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
LoadingView.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/loading/LoadingView.java
package com.github.cypher.gui.root.loading; import com.airhacks.afterburner.views.FXMLView; public class LoadingView extends FXMLView { }
139
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
LoadingPresenter.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/gui/root/loading/LoadingPresenter.java
package com.github.cypher.gui.root.loading; import com.github.cypher.eventbus.ToggleEvent; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import javafx.application.Platform; import javafx.fxml.FXML; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javax.inject.Inject; public class LoadingPresenter { @Inject private EventBus eventBus; @FXML private ImageView imageView; @FXML private void initialize() { eventBus.register(this); } @Subscribe private void toggleLoadingScreen(ToggleEvent e) { Platform.runLater(() -> { if (e == ToggleEvent.SHOW_LOADING) { imageView.setImage(new Image(LoadingPresenter.class.getResourceAsStream("/images/loading.gif"))); } else if (e == ToggleEvent.HIDE_LOADING) { imageView.setImage(null); } }); } }
843
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
TOMLSettings.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/settings/TOMLSettings.java
package com.github.cypher.settings; import com.moandjiezana.toml.Toml; import com.moandjiezana.toml.TomlWriter; import java.io.File; import java.io.IOException; import java.util.Locale; public class TOMLSettings implements Settings { // Application specific constants private static final String FILE_NAME = "config.toml"; // Instance variables private final File settingsFile; private final SettingsData settingsData; private final String userDataDirectory; // Class representing all settings private static class SettingsData{ // All variables are initiated to default values String languageTag = Locale.getDefault().toLanguageTag(); boolean saveSession = false; boolean useSystemTray = true; boolean controlEnterToSendMessage = true; int SDKTimeout = 30000; // In ms int modelTickInterval = 500; // In ms boolean maximized = false; int lastWindowPosX = -1; int lastWindowPosY = -1; int lastWindowWidth = -1; int lastWindowHeight = -1; } public TOMLSettings(String userDataDirectory) { this.userDataDirectory = userDataDirectory; settingsFile = createOrLoadFile(); settingsData = load(settingsFile); save(); } private File createOrLoadFile() { try { // Create folder if it doesn't exist new File(userDataDirectory).mkdir(); // Load File File file = new File(userDataDirectory + File.separator + FILE_NAME); // Create file if it doesn't exist file.createNewFile(); return file; } catch (IOException e) { System.out.printf("Could not create settings file\n"); return null; } } private SettingsData load(File settingsFile) { // Make sure settingsFile is set before loading settings if (settingsFile == null) { System.out.printf("Could not access settings file, defaults will be loaded.\n"); return new SettingsData(); } else { System.out.printf("Reading settings from: %s\n", settingsFile); return new Toml().read(settingsFile).to(SettingsData.class); } } private void save() { synchronized (this){ // Make sure settingsFile is set before saving settings if (settingsFile == null) { System.out.printf("Could not access settings file, settings won't be saved.\n"); } else { try { new TomlWriter().write(settingsData, settingsFile); System.out.printf("Settings saved to: %s\n", settingsFile); } catch (IOException e) { System.out.printf("Could not access settings file, settings won't be saved.\n"); } } } } // Language setting @Override public Locale getLanguage() { synchronized (this) { return Locale.forLanguageTag(settingsData.languageTag); } } @Override public void setLanguage(Locale language) { synchronized (this){ settingsData.languageTag = language.toLanguageTag(); save(); } } // Save session ("keep me logged in") settings @Override public boolean getSaveSession() { synchronized (this){ return settingsData.saveSession; } } @Override public void setSaveSession(boolean saveSession) { synchronized (this) { settingsData.saveSession = saveSession; save(); } } @Override public boolean getUseSystemTray() { synchronized (this) { return settingsData.useSystemTray; } } @Override public void setUseSystemTray(boolean useSystemTray) { synchronized (this) { settingsData.useSystemTray = useSystemTray; save(); } } // If control + enter should be used for sending messages (if false only enter is needed) @Override public boolean getControlEnterToSendMessage() { synchronized (this) { return settingsData.controlEnterToSendMessage; } } @Override public void setControlEnterToSendMessage(boolean controlEnterToSendMessage) { synchronized (this) { settingsData.controlEnterToSendMessage = controlEnterToSendMessage; save(); } } // Timeout is maximum time to poll in milliseconds before returning a request @Override public int getSDKTimeout() { synchronized (this) { return settingsData.SDKTimeout; } } @Override public void setSDKTimeout(int timeout) { synchronized (this) { settingsData.SDKTimeout = timeout; save(); } } @Override public boolean getMaximized() { return settingsData.maximized; } @Override public void setMaximized(boolean maximized) { synchronized (this) { settingsData.maximized = maximized; save(); } } // The time between each tick in the model in ms @Override public int getModelTickInterval() { synchronized (this) { return settingsData.modelTickInterval; } } @Override public void setModelTickInterval(int interval) { synchronized (this) { settingsData.modelTickInterval = interval; save(); } } @Override public int getLastWindowPosX() { synchronized (this) { return settingsData.lastWindowPosX; } } @Override public void setLastWindowPosX(int posX) { synchronized (this) { settingsData.lastWindowPosX = posX; save(); } } @Override public int getLastWindowPosY() { synchronized (this) { return settingsData.lastWindowPosY; } } @Override public void setLastWindowPosY(int posY) { synchronized (this) { settingsData.lastWindowPosY = posY; save(); } } @Override public int getLastWindowWidth() { synchronized (this) { return settingsData.lastWindowWidth; } } @Override public void setLastWindowWidth(int width) { synchronized (this) { settingsData.lastWindowWidth = width; save(); } } @Override public int getLastWindowHeight() { synchronized (this) { return settingsData.lastWindowHeight; } } @Override public void setLastWindowHeight(int height) { synchronized (this) { settingsData.lastWindowHeight = height; save(); } } }
5,689
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Settings.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/settings/Settings.java
package com.github.cypher.settings; import java.util.Locale; public interface Settings { // Language setting Locale getLanguage(); void setLanguage(Locale language); // Save session ("keep me logged in") settings boolean getSaveSession(); void setSaveSession(boolean saveSession); boolean getUseSystemTray(); void setUseSystemTray(boolean exitToSystemTray); // If control + enter should be used for sending messages (if false only enter is needed) boolean getControlEnterToSendMessage(); void setControlEnterToSendMessage(boolean controlEnterToSendMessage); // Timeout is maximum time to poll in milliseconds before returning a request int getSDKTimeout(); void setSDKTimeout(int timeout); boolean getMaximized(); void setMaximized(boolean maximized); // The time between each tick in the model in ms int getModelTickInterval(); void setModelTickInterval(int interval); // Used to remember the windows X position int getLastWindowPosX(); void setLastWindowPosX(int posX); // Used to remember the windows Y position int getLastWindowPosY(); void setLastWindowPosY(int posY); // Used to remember the windows width int getLastWindowWidth(); void setLastWindowWidth(int width); // Used to remember the windows height int getLastWindowHeight(); void setLastWindowHeight(int height); }
1,323
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
ToggleEvent.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/eventbus/ToggleEvent.java
package com.github.cypher.eventbus; public enum ToggleEvent { HIDE_SETTINGS, SHOW_SETTINGS, TOGGLE_SETTINGS, HIDE_ROOM_SETTINGS, SHOW_ROOM_SETTINGS, TOGGLE_ROOM_SETTINGS, HIDE_DIRECTORY, SHOW_DIRECTORY, TOGGLE_DIRECTORY, HIDE_ADD_DIALOG, SHOW_ADD_DIALOG, TOGGLE_ADD_DIALOG, LOGIN, LOGOUT, SHOW_LOADING, HIDE_LOADING }
340
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Member.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/Member.java
package com.github.cypher.model; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.scene.image.Image; public class Member { private final User user; private final ObjectProperty<Image> imageProperty = new SimpleObjectProperty(); private final StringProperty name = new SimpleStringProperty(); Member(com.github.cypher.sdk.Member sdkMember, Repository<User> repo) { this.name.set(sdkMember.getUser().getName()); this.user = repo.get(sdkMember.getUser().getId()); } public Image getImageProperty() { return imageProperty.get(); } public ObjectProperty<Image> imagePropertyProperty() { return imageProperty; } public User getUser() { return user; } public StringProperty getName() { return name; } }
888
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Event.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/Event.java
package com.github.cypher.model; public class Event { private final String eventId; private final long originServerTimeStamp; private final User sender; Event(Repository<User> repo,com.github.cypher.sdk.Event sdkEvent){ eventId = sdkEvent.getEventId(); originServerTimeStamp = sdkEvent.getOriginServerTs(); sender = repo.get(sdkEvent.getSender().getId()); } public String getEventId() { return eventId; } public long getOriginServerTimeStamp() { return originServerTimeStamp; } public User getSender() { return sender; } }
551
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
GeneralCollection.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/GeneralCollection.java
package com.github.cypher.model; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.image.Image; public class GeneralCollection implements RoomCollection { private static final Image GENERAL_COLLECTION_IMAGE = new Image(GeneralCollection.class.getResourceAsStream("/images/fa-users-white-40.png")); private final ObjectProperty<Image> imageProperty = new SimpleObjectProperty<>(GENERAL_COLLECTION_IMAGE); // Should this maybe be generated on first request instead? private final ObservableList<Room> rooms = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); // Package private empty constructor GeneralCollection(){ /*Empty*/} @Override public ObservableList<Room> getRoomsProperty() { return rooms; } @Override public void addRoom(Room room) { if (!rooms.contains(room)){ rooms.add(room); } } public void removeRoom(Room room){ rooms.remove(room); } @Override public Image getImage() { return GENERAL_COLLECTION_IMAGE; } @Override public ObjectProperty<Image> getImageProperty() { return imageProperty; } }
1,227
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Client.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/Client.java
package com.github.cypher.model; import com.github.cypher.eventbus.ToggleEvent; import com.github.cypher.sdk.api.RestfulHTTPException; import com.github.cypher.sdk.api.Session; import com.github.cypher.settings.Settings; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import javafx.application.Platform; import javafx.beans.InvalidationListener; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import java.io.IOException; import java.util.function.Supplier; import static com.github.cypher.model.Util.extractServer; public class Client { private final Supplier<com.github.cypher.sdk.Client> sdkClientFactory; private com.github.cypher.sdk.Client sdkClient; private Updater updater; private final Settings settings; private final EventBus eventBus; private final SessionManager sessionManager; //RoomCollections private final ObservableList<RoomCollection> roomCollections = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); // Servers private final ObservableList<Server> servers = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); private Repository<User> userRepository; // Personal messages private PMCollection pmCollection; // General chatrooms private GeneralCollection genCollection; private boolean loggedIn; private boolean initalSyncDone; private RoomCollection selectedRoomCollection; private Room selectedRoom; Client(Supplier<com.github.cypher.sdk.Client> sdkClientFactory, Settings settings, EventBus eventBus, String userDataDirectory) { this.sdkClientFactory = sdkClientFactory; this.settings = settings; this.eventBus = eventBus; eventBus.register(this); initialize(); sessionManager = new SessionManager(userDataDirectory); // Loads the session file from the disk if it exists. if (sessionManager.savedSessionExists()) { Session session = sessionManager.loadSessionFromDisk(); // If session doesn't exists SessionManager::loadSession returns null if (session != null) { // No guarantee that the session is valid. setSession doesn't throw an exception if the session is invalid. sdkClient.setSession(session); loggedIn = true; startNewUpdater(); } } addListeners(); } private void initialize() { pmCollection = new PMCollection(); genCollection = new GeneralCollection(); roomCollections.clear(); roomCollections.add(pmCollection); roomCollections.add(genCollection); selectedRoomCollection = pmCollection; servers.clear(); userRepository = new Repository<>((String id) -> { return new User(sdkClient.getUser(id)); }); sdkClient = sdkClientFactory.get(); sdkClient.addJoinRoomsListener((change) -> { if (change.wasAdded()) { Room room = new Room(userRepository, change.getValueAdded(), getActiveUser()); room.aliasesList().addListener((InvalidationListener) (r) -> distributeRoom(room)); distributeRoom(room); } }); loggedIn = false; initalSyncDone = false; selectedRoom = null; } public final User getActiveUser(){ return getUser(sdkClient.getActiveUser().getId()); } private void addListeners() { servers.addListener((ListChangeListener.Change<? extends Server> change) -> { while(change.next()) { if (change.wasAdded()) { roomCollections.addAll(change.getAddedSubList()); } if (change.wasRemoved()) { roomCollections.removeAll(change.getRemoved()); } } }); } private void startNewUpdater() { updater = new Updater(settings.getModelTickInterval()); updater.add(1, () -> { try { sdkClient.update(settings.getSDKTimeout()); if (!initalSyncDone) { initalSyncDone = true; // Default selected roomCollection is PMCollection. Placed here instead of in initialize // to make the first room in PMCollection be selected when logging in. eventBus.post(selectedRoomCollection); eventBus.post(ToggleEvent.HIDE_LOADING); } } catch (RestfulHTTPException | IOException e) { e.printStackTrace(); } }); updater.start(); } public void login(String username, String password, String homeserver) throws SdkException{ try { sdkClient.login(username, password, homeserver); loggedIn = true; eventBus.post(ToggleEvent.LOGIN); eventBus.post(ToggleEvent.SHOW_LOADING); startNewUpdater(); }catch(RestfulHTTPException | IOException ex){ throw new SdkException(ex); } } public void logout() throws SdkException{ updater.endGracefully(); updater = null; try { sdkClient.logout(); } catch (RestfulHTTPException | IOException ex) { // Restart updater if logout failed startNewUpdater(); throw new SdkException(ex); } sessionManager.deleteSessionFromDisk(); eventBus.post(ToggleEvent.LOGOUT); initialize(); } public void register(String username, String password, String homeserver) throws SdkException { try { sdkClient.register(username, password, homeserver); loggedIn = true; eventBus.post(ToggleEvent.LOGIN); eventBus.post(ToggleEvent.SHOW_LOADING); startNewUpdater(); }catch(RestfulHTTPException | IOException ex){ throw new SdkException(ex); } } // Add roomcollection, room or private chat public void add(String input) throws IOException { if (Util.isHomeserver(input)) { addServer(input); } else if (Util.isRoomLabel(input)) { try { addRoom(input); } catch (SdkException e) { System.out.printf("Adding room failed! - %s\n", e.getMessage()); throw new IOException("Adding room failed! - " + e.getMessage()); // e.getMessage() is only a temporary solution. } } else if (Util.isUser(input)) { addUser(input); } else { throw new IOException("String is neither a server, room or user id/alias."); } } public User getUser(String id) { return userRepository.get(id); } private void addServer(String serverAddress) { for (Server server:servers){ if (server.getAddress().equals(serverAddress)){ return; } } Server server = new Server(serverAddress); servers.add(server); // Redistrubute all rooms for (RoomCollection roomCollection : roomCollections.toArray(new RoomCollection[roomCollections.size()])){ for (Room room: roomCollection.getRoomsProperty().toArray(new Room[roomCollection.getRoomsProperty().size()])) { distributeRoom(room); } } } private void addRoom(String room) throws SdkException{ try { sdkClient.joinRoom(room); } catch (RestfulHTTPException | IOException e) { throw new SdkException(e); } } private void addUser(String user) { //Todo } public void exit() { if (settings.getSaveSession()) { sessionManager.saveSessionToDisk(sdkClient.getSession()); } if (updater != null) { updater.interrupt(); } } public ObservableList<RoomCollection> getRoomCollections(){ return roomCollections; } public ObservableList<Server> getServers() { return servers; } private void distributeRoom(Room room) { //System.out.printf("Placing %40s %40s %25s\n", room, room.getName(), room.getCanonicalAlias()); // Place in PM if (room.isPmChat()) { // Do not list the VOIP bot room if (room.getMembersProperty().stream().noneMatch((member) -> member.getUser().getId().equals( "@fs_IUNsRXZndVVCRmFTcExJRk5FRTpyaWdlbC5ndXJneS5tZTo4NDQ4:matrix.org" ) )){ pmCollection.addRoom(room); } } else { // Place in servers if (room.getCanonicalAlias() != null){ String mainServer = extractServer(room.getCanonicalAlias()); addServer(mainServer); } boolean placed = false; for (Server server : servers) { boolean placedHere = false; for (String alias:room.aliasesList()) { if (server.getAddress().equals(extractServer(alias))){ pmCollection.removeRoom(room); genCollection.removeRoom(room); server.addRoom(room); placed = true; placedHere = true; } } if (!placedHere){ server.removeRoom(room); } } // Place in General if not placed in any server if (!placed) { genCollection.addRoom(room); } } } public boolean isLoggedIn() { return loggedIn; } public RoomCollection getSelectedRoomCollection(){ return selectedRoomCollection; } public Room getSelectedRoom(){ return selectedRoom; } @Subscribe public void RoomCollectionChanged(RoomCollection e){ Platform.runLater(() -> { this.selectedRoomCollection = e; }); } @Subscribe public void selectedRoomChanged(Room e){ Platform.runLater(() -> { this.selectedRoom = e; }); } }
8,650
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Server.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/Server.java
package com.github.cypher.model; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.image.Image; public class Server implements RoomCollection { private final ObjectProperty<Image> imageProperty = new SimpleObjectProperty<>(); private final StringProperty nameProperty = new SimpleStringProperty(); private final ObservableList<Room> rooms = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); private final String address; Server(String address) { this.address = address; this.nameProperty.setValue(address); } public String getAddress() { return address; } public String getName(){ return nameProperty.getValue(); } public StringProperty nameProperty(){ return nameProperty; } @Override public ObservableList<Room> getRoomsProperty() { return rooms; } @Override public void addRoom(Room room) { if (!rooms.contains(room)){ rooms.add(room); } } public void removeRoom(Room room){ rooms.remove(room); } @Override public Image getImage() { return imageProperty.get(); } @Override public ObjectProperty<Image> getImageProperty(){ return imageProperty; } }
1,389
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Repository.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/Repository.java
package com.github.cypher.model; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class Repository<T> { private final Map<String, T> storage = new ConcurrentHashMap<>(); private final Factory<? extends T> factory; interface Factory<K>{ K get(String id); } Repository(Factory<? extends T> factory){ this.factory = factory; } /** * This method returns an existing object if possible, * otherwise it creates and stores a new one. * @param id The unique ID of the object * @return A object */ public T get(String id) { if(storage.containsKey(id)) { return storage.get(id); } T object = factory.get(id); storage.put(id, object); return object; } }
711
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Updater.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/Updater.java
package com.github.cypher.model; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; class Updater extends Thread { // Holds all updatable classes // Initiated to size 10 but will resize if necessary // The value (Integer) represents the "tick interval". I.e. the Updatable will be notified every {i}'th tic (where i is the value of the Integer) private final Map<Updatable, Integer> watching = new ConcurrentHashMap<>(10); private volatile boolean stopping = false; // The time between each tic in ms private final int interval; interface Updatable { // To be called continuously at a defined interval void update(); } Updater(int interval) { this.interval = interval; } // Tic loop @Override public void run() { for (int i = 1; !Thread.interrupted() && !stopping ; i++) { // Notify all Updatable classes for (Map.Entry<Updatable, Integer> entry : watching.entrySet()) { if (i % entry.getValue() == 0) { entry.getKey().update(); } } // Sleep try { Thread.sleep(interval); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } // Register a listener. The listener will be notified every {i}'th tic public void add(Integer i, Updatable u) { watching.put(u, i); } // Remove a listener public void remove(Updatable u) { watching.remove(u); } public void endGracefully() { stopping = true; } }
1,424
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
SessionManager.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/SessionManager.java
package com.github.cypher.model; import com.github.cypher.sdk.api.Session; import java.io.*; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; // Handles the loading and saving of the "last session" to enable auto-login / "keep me logged in" class SessionManager { private static final String SESSION_FILE_NAME = "lastSession"; private final String userDataDirectory; SessionManager(String userDataDirectory){ this.userDataDirectory = userDataDirectory; } public boolean savedSessionExists() { Path lastSessionFilePath = Paths.get(userDataDirectory + File.separator + SESSION_FILE_NAME); return Files.exists(lastSessionFilePath) && Files.isRegularFile(lastSessionFilePath); } // Returns null if loading failed // Session is loaded from USER_DATA_DIRECTORY + File.separator + SESSION_FILE_NAME public Session loadSessionFromDisk() { Session lastSession = null; FileInputStream fin = null; ObjectInputStream ois = null; try { fin = new FileInputStream(userDataDirectory + File.separator + SESSION_FILE_NAME); ois = new ObjectInputStream(fin); lastSession = (Session) ois.readObject(); System.out.printf("last session file deserialized!\n"); } catch (IOException ex) { ex.printStackTrace(); System.out.printf("last session file deserialization failed!\n"); } catch (ClassNotFoundException e) { e.printStackTrace(); } finally { if (fin != null) { try { fin.close(); } catch (IOException e) { e.printStackTrace(); } } if (ois != null) { try { ois.close(); } catch (IOException e) { e.printStackTrace(); } } } return lastSession; } // Session is saved to USER_DATA_DIRECTORY + File.separator + SESSION_FILE_NAME public void saveSessionToDisk(Session session) { if (session == null) { System.out.printf("Session not saved! Session parameter was null.\n"); return; } FileOutputStream fout = null; ObjectOutputStream oos = null; try { fout = new FileOutputStream(userDataDirectory + File.separator + SESSION_FILE_NAME); oos = new ObjectOutputStream(fout); oos.writeObject(session); System.out.printf("Session file serialized & saved!\n"); } catch (IOException ex) { ex.printStackTrace(); System.out.printf("Session file serialization/saving failed!\n"); } finally { if (fout != null) { try { fout.close(); } catch (IOException e) { e.printStackTrace(); } } if (oos != null) { try { oos.close(); } catch (IOException e) { e.printStackTrace(); } } } } // Deletes the saved session (if it exists) from the disk. The path USER_DATA_DIRECTORY + File.separator + SESSION_FILE_NAME is used public void deleteSessionFromDisk() { try { Files.deleteIfExists(Paths.get(userDataDirectory + File.separator + SESSION_FILE_NAME)); } catch (IOException e) { System.out.printf("Session file exists but deleting it failed! %s \n", e.getMessage()); } } }
3,001
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
User.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/User.java
package com.github.cypher.model; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.beans.value.ChangeListener; import javafx.scene.image.Image; import java.io.IOException; import java.net.URL; public class User { private final StringProperty id; private final StringProperty name; private final ObjectProperty<URL> avatarUrl; private final ObjectProperty<Image> avatar; private boolean avatarWanted = false; private final com.github.cypher.sdk.User sdkUser; private final static int AVATAR_SIZE = 48; private final ChangeListener avatarListener = (observable, oldValue, newValue) -> { updateAvatar(); }; User(com.github.cypher.sdk.User sdkUser) { this.sdkUser = sdkUser; this.id = new SimpleStringProperty(sdkUser.getId()); this.name = new SimpleStringProperty(sdkUser.getName()); this.avatarUrl = new SimpleObjectProperty<>(sdkUser.getAvatarUrl()); this.avatar = new SimpleObjectProperty<>(null); sdkUser.addNameListener((observable, oldValue, newValue) -> { name.set(newValue); }); sdkUser.addAvatarUrlListener((observable, oldValue, newValue) -> { avatarUrl.set(newValue); }); } private void updateAvatar() { if (avatarWanted) { java.awt.Image image = sdkUser.getAvatar(AVATAR_SIZE); try { //56x56 is from Room avatar size. Shouldn't be hardcoded here! this.avatar.set( image == null ? Util.generateIdenticon(name.getValue() + id.getValue(), AVATAR_SIZE, AVATAR_SIZE) : Util.createImage(image) ); } catch (IOException e) { System.out.printf("IOException when converting user avatar image: %s\n", e); } } } private void initiateAvatar(){ if (!avatarWanted) { avatarWanted = true; updateAvatar(); sdkUser.addAvatarListener(avatarListener, AVATAR_SIZE); } } public String getId() { return id.get(); } public StringProperty idProperty() { return id; } public String getName() { return name.get(); } public StringProperty nameProperty() { return name; } public URL getAvatarUrl() { return avatarUrl.get(); } public ObjectProperty<URL> avatarUrlProperty() { return avatarUrl; } public Image getAvatar() { initiateAvatar(); return avatar.get(); } public ObjectProperty<Image> avatarProperty() { initiateAvatar(); return avatar; } }
2,442
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Room.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/Room.java
package com.github.cypher.model; import com.github.cypher.sdk.api.RestfulHTTPException; import javafx.beans.property.*; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.image.Image; import java.io.IOException; import java.net.URL; import java.util.Optional; public class Room { private final StringProperty id; private final StringProperty name; private final StringProperty topic; private final ObjectProperty<URL> avatarUrl; private final ObjectProperty<Image> avatar; private final StringProperty canonicalAlias; private final ObservableList<Member> members; private final IntegerProperty memberCount; private final ObservableList<String> aliases; private final ObservableList<Event> events; private final com.github.cypher.sdk.Room sdkRoom; private final User activeUser; private boolean avatarWanted = false; private final static int AVATAR_SIZE = 48; private URL lastAvatarURL = null; Room(Repository<User> repo, com.github.cypher.sdk.Room sdkRoom, User activeUser) { this.sdkRoom = sdkRoom; this.activeUser = activeUser; id = new SimpleStringProperty(sdkRoom.getId()); name = new SimpleStringProperty(); topic = new SimpleStringProperty(sdkRoom.getTopic()); avatarUrl = new SimpleObjectProperty<>(sdkRoom.getAvatarUrl()); avatar = new SimpleObjectProperty<>(); canonicalAlias = new SimpleStringProperty(sdkRoom.getCanonicalAlias()); members = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); for (com.github.cypher.sdk.Member sdkMember : sdkRoom.getMembers()) { members.add(new Member(sdkMember, repo)); } memberCount = new SimpleIntegerProperty(sdkRoom.getMemberCount()); aliases = FXCollections.synchronizedObservableList(FXCollections.observableArrayList(sdkRoom.getAliases())); events = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); updateName(); sdkRoom.addNameListener((observable, oldValue, newValue) -> { updateName(); updateAvatar(); }); sdkRoom.addTopicListener((observable, oldValue, newValue) -> { topic.set(newValue); }); sdkRoom.addAvatarUrlListener((observable, oldValue, newValue) -> { avatarUrl.set(newValue); }); sdkRoom.addCanonicalAliasListener((observable, oldValue, newValue) -> { canonicalAlias.set(newValue); }); sdkRoom.addMemberListener(change -> { while (change.next()) { if (change.wasAdded()) { for (com.github.cypher.sdk.Member sdkMember : change.getAddedSubList()) { members.add(new Member(sdkMember, repo)); } } if (change.wasRemoved()) { for (com.github.cypher.sdk.Member sdkMember : change.getRemoved()) { Optional<Member> optionalMember = members.stream().filter(m -> sdkMember.getUser().getId().equals(m.getUser().getId())).findAny(); members.remove(optionalMember.get()); } } } memberCount.set(change.getList().size()); updateName(); updateAvatar(); }); sdkRoom.addAliasesListener(change -> { aliases.setAll(change.getList()); }); for (com.github.cypher.sdk.Event event :sdkRoom.getEvents().values()){ if(event instanceof com.github.cypher.sdk.Message) { events.add(new Message(repo, (com.github.cypher.sdk.Message)event)); } } events.sort((a, b) -> (int)(a.getOriginServerTimeStamp() - b.getOriginServerTimeStamp())); sdkRoom.addEventListener(change -> { if (change.wasAdded()) { com.github.cypher.sdk.Event sdkEvent = change.getValueAdded(); Event event; if(sdkEvent instanceof com.github.cypher.sdk.Message) { event = new Message(repo, (com.github.cypher.sdk.Message)sdkEvent); } else { return; } long timestamp = sdkEvent.getOriginServerTs(); for(int i = 0; i < events.size(); i++) { if(timestamp < events.get(i).getOriginServerTimeStamp()) { events.add(i, event); return; } } events.add(event); } }); } private void initiateAvatar(){ if (!avatarWanted) { avatarWanted = true; updateAvatar(); sdkRoom.addAvatarListener((observable, oldValue, newValue) -> { updateAvatar(); }, AVATAR_SIZE); } } public void sendMessage(String body) throws SdkException { try { sdkRoom.sendTextMessage(body); }catch(RestfulHTTPException | IOException ex){ throw new SdkException(ex); } } private void updateAvatar() { java.awt.Image newImage = sdkRoom.getAvatar(AVATAR_SIZE); if(newImage == null && privateIsPmChat()){ for (Member member: members) { if (member.getUser() != activeUser && (lastAvatarURL == null || lastAvatarURL.equals(member.getUser().getAvatarUrl()))){ avatar.setValue(member.getUser().getAvatar()); lastAvatarURL = member.getUser().getAvatarUrl(); } } }else{ try { if (lastAvatarURL == null || lastAvatarURL.equals(sdkRoom.getAvatarUrl())){ this.avatar.set( newImage == null ? null : Util.createImage(newImage) ); lastAvatarURL = sdkRoom.getAvatarUrl(); } } catch (IOException e) { System.out.printf("IOException when converting user avatar image: %s\n", e); } } } public boolean loadEventHistory(Integer limit) throws SdkException { try { return sdkRoom.getEventHistory(limit); } catch(RestfulHTTPException | IOException e) { throw new SdkException(e); } } private boolean privateIsPmChat(){ boolean hasName = sdkRoom.getName() != null && !sdkRoom.getName().isEmpty(); return this.getMemberCount() == 2 && !hasName; } public boolean isPmChat() { return privateIsPmChat(); } public String getId() { return id.get(); } public StringProperty idProperty() { return id; } public String getName() { return name.getValue(); } public StringProperty nameProperty() { return name; } public String getTopic() { return topic.get(); } public StringProperty topicProperty() { return topic; } public URL getAvatarUrl() { return avatarUrl.get(); } public ObjectProperty<URL> avatarUrlProperty() { return avatarUrl; } public Image getAvatar() { initiateAvatar(); return avatar.get(); } public ObjectProperty<Image> avatarProperty() { initiateAvatar(); return avatar; } public String getCanonicalAlias() { return canonicalAlias.get(); } public StringProperty canonicalAliasProperty() { return canonicalAlias; } public ObservableList<Member> getMembersProperty() { return members; } public int getMemberCount() { return memberCount.get(); } public IntegerProperty memberCountProperty() { return memberCount; } public String[] getAliases() { return aliases.toArray(new String[aliases.size()]); } public ObservableList<String> aliasesList() { return aliases; } public ObservableList<Event> getEvents() { return events; } private void updateName(){ String newName = sdkRoom.getName(); if (privateIsPmChat()){ for (Member member: members) { if (member.getUser() != activeUser){ name.setValue(member.getName().getValue()); } } }else{ name.setValue(newName); } } }
7,063
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Util.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/Util.java
package com.github.cypher.model; import javax.imageio.ImageIO; import java.awt.*; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.awt.image.WritableRaster; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; public final class Util { // Check if sting could be a roomcollection static boolean isHomeserver(String s) { return s.matches("^(https:\\/\\/|[a-zA-Z0-9-])([a-zA-Z0-9-]+\\.[a-zA-Z0-9]+)+(:[0-9]+)?$"); } // Check if sting could be a room label static boolean isRoomLabel(String s) { return s.matches("^(!|#)[a-zA-Z0-9_\\.-]+:([a-zA-Z0-9]+\\.[a-zA-Z0-9]+)+(:[0-9]+)?$"); } // Check if sting could be a user static boolean isUser(String s) { return s.matches("^(@|[a-zA-Z0-9_\\.-])[a-zA-Z0-9_\\.-]+:([a-zA-Z0-9]+\\.[a-zA-Z0-9]+)+(:[0-9]+)?$"); } static String extractServer(String input) { String[] splitString = input.split(":", 2); return splitString[splitString.length - 1]; } /** * Code taken from: <a href="https://community.oracle.com/thread/2238566">oracle community.</a> * Comments and slight modifications added. */ public static javafx.scene.image.Image createImage(java.awt.Image image) throws IOException { java.awt.Image imageReady; // Make sure the image is rendered if (image instanceof RenderedImage) { imageReady = image; }else { BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); // Render the image Graphics g = bufferedImage.createGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); imageReady = bufferedImage; } // Convert image to byte array ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write((RenderedImage) imageReady, "png", out); out.flush(); // Construct FX-image from byte array ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); return new javafx.scene.image.Image(in); } /** * Code taken from: <a href="https://stackoverflow.com/a/40699460">Stackoverflow answer from Kevin G. based on code from davidhampgonsalves.com/Identicons</a> * Comments and slight modifications added. */ public static javafx.scene.image.Image generateIdenticon(String text, int image_width, int image_height) throws IOException { // If the input name/text is null or empty no image can be created. if (text == null || text.length() < 3) { return null; } int width = 5, height = 5; byte[] hash = text.getBytes(); BufferedImage identicon = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); WritableRaster raster = identicon.getRaster(); int [] background = new int [] {255,255,255, 0}; int [] foreground = new int [] {hash[0] & 255, hash[1] & 255, hash[2] & 255, 255}; for(int x=0 ; x < width ; x++) { //Enforce horizontal symmetry int i = x < 3 ? x : 4 - x; for(int y=0 ; y < height; y++) { int [] pixelColor; //toggle pixels based on bit being on/off if((hash[i] >> y & 1) == 1) pixelColor = foreground; else pixelColor = background; raster.setPixel(x, y, pixelColor); } } BufferedImage finalImage = new BufferedImage(image_width, image_height, BufferedImage.TYPE_INT_ARGB); //Scale image to the size you want AffineTransform at = new AffineTransform(); at.scale(image_width / width, image_height / height); AffineTransformOp op = new AffineTransformOp(at, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); finalImage = op.filter(identicon, finalImage); // Convert BufferedImage to javafx image return createImage(finalImage); } private Util(){} }
3,843
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
SdkException.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/SdkException.java
package com.github.cypher.model; import com.github.cypher.sdk.api.RestfulHTTPException; public class SdkException extends Exception{ private final Type type; private final Exception inner; enum Type { RATE_LIMIT, BAD_REQUEST, CONNECTION_TIMEOUT, AUTH, OTHER } SdkException(Exception ex){ inner = ex; if (ex instanceof RestfulHTTPException){ if (((RestfulHTTPException) ex).getErrorCode() != null && ((RestfulHTTPException) ex).getErrorCode().equals("M_UNKNOWN_TOKEN")){ this.type = Type.AUTH; }else{ this.type = Type.OTHER; } }else{ this.type = Type.OTHER; } } public Type getType(){ return this.type; } @Override public String getMessage(){ return inner.getMessage(); } }
740
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
PMCollection.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/PMCollection.java
package com.github.cypher.model; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.image.Image; public class PMCollection implements RoomCollection { private static final Image PM_COLLECTION_IMAGE = new Image(GeneralCollection.class.getResourceAsStream("/images/fa-wechat-white-40.png")); private final ObjectProperty<Image> imageProperty = new SimpleObjectProperty<>(PM_COLLECTION_IMAGE); // Should this maybe be generated on first request instead? private final ObservableList<Room> rooms = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); // Package private empty constructor PMCollection(){/*Empty*/} @Override public ObservableList<Room> getRoomsProperty() { return rooms; } @Override public void addRoom(Room room) { if (!rooms.contains(room)){ rooms.add(room); } } public void removeRoom(Room room){ rooms.remove(room); } @Override public Image getImage() { return PM_COLLECTION_IMAGE; } @Override public ObjectProperty<Image> getImageProperty() { return imageProperty; } }
1,202
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
RoomCollection.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/RoomCollection.java
package com.github.cypher.model; import javafx.beans.property.ObjectProperty; import javafx.collections.ObservableList; import javafx.scene.image.Image; public interface RoomCollection { ObservableList<Room> getRoomsProperty(); void addRoom(Room room); Image getImage(); ObjectProperty<Image> getImageProperty(); }
321
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
Message.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/Message.java
package com.github.cypher.model; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; public class Message extends Event { private final StringProperty body; private final StringProperty formattedBody; Message(Repository<User> repo, com.github.cypher.sdk.Message sdkMessage) { super(repo, sdkMessage); this.body = new SimpleStringProperty(sdkMessage.getBody()); this.formattedBody = new SimpleStringProperty(sdkMessage.getFormattedBody()); sdkMessage.addBodyListener((observable, oldValue, newValue) -> { body.set(newValue); }); sdkMessage.addFormattedBodyListener((observable, oldValue, newValue) -> { formattedBody.set(newValue); }); } public String getBody() { return body.get(); } public StringProperty bodyProperty() { return body; } public String getFormattedBody() { return formattedBody.get(); } public StringProperty formattedBodyProperty() { return formattedBody; } }
970
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
ModelFactory.java
/FileExtraction/Java_unseen/williamleven_Cypher/src/main/java/com/github/cypher/model/ModelFactory.java
package com.github.cypher.model; import com.github.cypher.sdk.SdkFactory; import com.github.cypher.settings.Settings; import com.google.common.eventbus.EventBus; public final class ModelFactory { public static Client createClient(Settings settings, EventBus eventBus, String userDataDirectory, String settingsNamespace){ return new Client(() -> SdkFactory.createClient(settingsNamespace), settings, eventBus, userDataDirectory ); } private ModelFactory(){} }
529
Java
.java
williamleven/Cypher
8
1
0
2017-03-20T10:42:03Z
2017-10-22T22:59:11Z
UtilsTest.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/test/java/org/hvdw/jexiftoolgui/UtilsTest.java
package org.hvdw.jexiftoolgui; import org.junit.Rule; import org.junit.Test; import org.junit.contrib.java.lang.system.RestoreSystemProperties; import static org.junit.Assert.*; public class UtilsTest { @Rule public final RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties(); @Test public void testReturnOfSystemBasedOnSystemProperty() { System.setProperty("os.name", "mac"); assertEquals("lower case mac should be APPLE", Application.OS_NAMES.APPLE, Utils.getCurrentOsName()); System.setProperty("os.name", "MAC"); assertEquals("Upper case mac should be APPLE", Application.OS_NAMES.APPLE, Utils.getCurrentOsName()); System.setProperty("os.name", "mAc"); assertEquals("mixed case mac should be APPLE", Application.OS_NAMES.APPLE, Utils.getCurrentOsName()); System.setProperty("os.name", "windows"); assertEquals("lower case windows should be MICROSOFT", Application.OS_NAMES.MICROSOFT, Utils.getCurrentOsName()); System.setProperty("os.name", "WINDOWS"); assertEquals("Upper case windows should be MICROSOFT", Application.OS_NAMES.MICROSOFT, Utils.getCurrentOsName()); System.setProperty("os.name", "wInDoWs"); assertEquals("mixed case windows should be MICROSOFT", Application.OS_NAMES.MICROSOFT, Utils.getCurrentOsName()); System.setProperty("os.name", ""); assertEquals("Empty os should be LINUX", Application.OS_NAMES.LINUX, Utils.getCurrentOsName()); System.setProperty("os.name", "asdfq 342"); assertEquals("Random value should be LINUX", Application.OS_NAMES.LINUX, Utils.getCurrentOsName()); System.setProperty("os.name", "Linux"); assertEquals("Linux should be Linux", Application.OS_NAMES.LINUX, Utils.getCurrentOsName()); } }
1,841
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
ExportToPDF.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/ExportToPDF.java
package org.hvdw.jexiftoolgui; import com.itextpdf.io.image.ImageData; import com.itextpdf.io.image.ImageDataFactory; import com.itextpdf.kernel.pdf.PdfDocument; import com.itextpdf.kernel.pdf.PdfWriter; import com.itextpdf.layout.Document; import com.itextpdf.layout.element.*; import org.hvdw.jexiftoolgui.controllers.ImageFunctions; import org.hvdw.jexiftoolgui.facades.SystemPropertyFacade; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.imageio.ImageIO; import javax.swing.*; import java.io.File; import java.io.FileFilter; import java.io.FileNotFoundException; import java.io.IOException; import java.net.MalformedURLException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.ResourceBundle; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.stream.Stream; import static org.hvdw.jexiftoolgui.Application.OS_NAMES.APPLE; import static org.hvdw.jexiftoolgui.Utils.getCurrentOsName; import static org.hvdw.jexiftoolgui.Utils.getFileExtension; import static org.hvdw.jexiftoolgui.facades.SystemPropertyFacade.SystemPropertyKey.LINE_SEPARATOR; public class ExportToPDF { private final static Logger logger = (Logger) LoggerFactory.getLogger(ExportToPDF.class); // radiobuttons {A4radioButton, LetterradioButton, ImgSizeLargeradioButton, ImgSizeSmallradioButton, // pdfPerImgradioButton, pdfCombinedradioButton, pdfradioButtonExpAll, pdfradioButtonExpCommonTags, pdfradioButtonExpByTagName} // comboboxes {pdfcomboBoxExpCommonTags, pdfcomboBoxExpByTagName} //new page document.add(new AreaBreak()); private static String[] GetDesiredParams(JRadioButton[] PDFradiobuttons, JComboBox[] PDFcomboboxes) { String[] params = MyConstants.ALL_PARAMS; if (PDFradiobuttons[6].isSelected()) { return MyConstants.ALL_PARAMS; } else if (PDFradiobuttons[7].isSelected()) { params = Utils.getWhichCommonTagSelected(PDFcomboboxes[0]); } else if (PDFradiobuttons[8].isSelected()) { params = Utils.getWhichCommonTagSelected(PDFcomboboxes[1]); } return params; } private static String GetConvertImage(File tmpfile) { boolean basicextension = false; boolean RAWextension = false; String imageFile = ""; String tmpfilename = ""; String[] raw_extensions = MyConstants.RAW_IMAGES; String[] basic_extensions = MyConstants.BASIC_EXTENSIONS; String filenameExt = getFileExtension(tmpfile); String filename = tmpfile.getName(); for (String ext : basic_extensions) { if (filenameExt.toLowerCase().equals(ext)) { // it is either bmp, gif, jp(e)g, png or tif(f) basicextension = true; break; } } if (basicextension) { imageFile = tmpfile.getPath(); } else { // loop through RAW extensions for (String ext : raw_extensions) { if (filenameExt.toLowerCase().equals(ext)) { // it is either bmp, gif, jp(e)g, png or tif(f) RAWextension = true; break; } } logger.debug("getconvertimage RAW RAWextion {}", RAWextension); //Use the ImageFunctions.ExtractPreviews(File file) for Raws and check on jpgfromraw and previewimage if (RAWextension) { String exportResult = ImageFunctions.ExtractPreviews(tmpfile); if ("Success".equals(exportResult)) { //hoping we have a JPGfromRAW tmpfilename = filename.substring(0, filename.lastIndexOf('.')) + "_JpgFromRaw.jpg"; tmpfile = new File (MyVariables.gettmpWorkFolder() + File.separator + tmpfilename); logger.debug("getconvertimage RAW jpgfromraw {}", tmpfile.toString()); if (tmpfile.exists()) { imageFile = tmpfile.getPath(); } else { tmpfilename = filename.substring(0, filename.lastIndexOf('.')) + "_PreviewImage.jpg"; tmpfile = new File (MyVariables.gettmpWorkFolder() + File.separator + tmpfilename); logger.debug("getconvertimage RAW jPreviewImage {}", tmpfile.toString()); if (tmpfile.exists()) { imageFile = tmpfile.getPath(); } else { logger.debug("getconvertimage RAW cantconvert"); imageFile = "/cantconvert.png"; } } } else { imageFile = "/cantconvert.png"; } } else if ( (filenameExt.toLowerCase().equals("heic")) || (filenameExt.toLowerCase().equals("heif")) ) { Application.OS_NAMES currentOsName = getCurrentOsName(); if ( currentOsName == APPLE) { String exportResult = ImageFunctions.sipsConvertToJPG(tmpfile, "pdfexport"); if ("Success".equals(exportResult)) { tmpfilename = filename.substring(0, filename.lastIndexOf('.')) + ".jpg"; tmpfile = new File(MyVariables.gettmpWorkFolder() + File.separator + tmpfilename); imageFile = tmpfile.getPath(); logger.debug("getconvertimage HEIC convert {}", tmpfile.toString()); } else { // we have some error logger.debug("getconvertimage HEIC cantconvert"); imageFile = "/cantconvert.png"; } } else { //we are not on Apple imageFile = "/cantconvert.png"; } } else if ( (filenameExt.toLowerCase().equals("mp4")) || (filenameExt.toLowerCase().equals("m4v")) ) { String exportResult = ImageFunctions.ExportPreviewsThumbnailsForIconDisplay(tmpfile, false, filenameExt); if ("Success".equals(exportResult)) { logger.debug("getconvertimage MP4 export thumbnails successful"); tmpfilename = filename.substring(0, filename.lastIndexOf('.')) + "_PreviewImage.jpg"; tmpfile = new File (MyVariables.gettmpWorkFolder() + File.separator + tmpfilename); if (tmpfile.exists()) { imageFile = tmpfile.getPath(); logger.debug("getconvertimage MP4 convert {}", tmpfile.toString()); } else { tmpfilename = filename.substring(0, filename.lastIndexOf('.')) + "_ThumbnailImage.jpg"; tmpfile = new File (MyVariables.gettmpWorkFolder() + File.separator + tmpfilename); if (tmpfile.exists()) { imageFile = tmpfile.getPath(); logger.debug("getconvertimage MP4 convert {}", tmpfile.toString()); } else { logger.debug("getconvertimage MP4 cant convert"); imageFile = "/cantconvert.png"; } } } else { imageFile = "/cantconvert.png"; } } else { // if all fails ..... logger.debug("getconvertimage ..if all fails .. cant convert"); imageFile = "/cantconvert.png"; } } return imageFile; } /** * Method toptable writes the table with the filename, path and the image itself * @param tmpfile * @return */ private static Table topTable(File tmpfile) { float[] pointColumnWidths = {150f, 150f}; Table table = new Table(pointColumnWidths); table.addCell(new Cell().add(new Paragraph(ResourceBundle.getBundle("translations/program_strings").getString("exppdf.name")))); table.addCell(new Cell().add(new Paragraph(tmpfile.getName()))); table.addCell(new Cell().add(new Paragraph(ResourceBundle.getBundle("translations/program_strings").getString("exppdf.path")))); table.addCell(new Cell().add(new Paragraph(tmpfile.getParent()))); table.addCell(new Cell().add(new Paragraph(ResourceBundle.getBundle("translations/program_strings").getString("exppdf.image")))); String imageFile = GetConvertImage(tmpfile); if ("/cantconvert.png".equals(imageFile)) { ImageIcon icon = null; try { java.awt.Image img = ImageIO.read(mainScreen.class.getResource("/cantdisplay.png")); ImageData data = ImageDataFactory.create(img, null); Image newImg = new Image(data); //icon = new ImageIcon(img); table.addCell(new Cell().add(newImg.setAutoScale(true))); } catch (IOException e){ logger.error("Error loading image", e); icon = null; } } else { try { ImageData data = ImageDataFactory.create(imageFile); Image img = new Image(data); table.addCell(new Cell().add(img.setAutoScale(true))); } catch (MalformedURLException e) { logger.error("Can't create image object for PDF {}", e); e.printStackTrace(); } } return table; } /** * This fillMetadataTable creates the table with the requested metadata based on the info returned from exiftool and returns the table to the document * @param exiftoolInfo * @return */ private static Table fillMetadataTable(String exiftoolInfo) { float[] mdpointColumnWidths = {100f, 260f, 450f}; Table table = new Table(mdpointColumnWidths); table.setFontSize(10); if (exiftoolInfo.length() > 0) { if (exiftoolInfo.trim().startsWith("Warning")) { table.addCell(new Cell().add(new Paragraph("ExifTool"))); table.addCell(new Cell().add(new Paragraph("Warning"))); table.addCell(new Cell().add(new Paragraph("Invalid Metadata data"))); } else if (exiftoolInfo.trim().startsWith("Error")) { table.addCell(new Cell().add(new Paragraph("ExifTool"))); table.addCell(new Cell().add(new Paragraph("Error"))); table.addCell(new Cell().add(new Paragraph("Invalid Metadata data"))); } else { String[] lines = exiftoolInfo.split(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR)); for (String line : lines) { //String[] cells = lines[i].split(":", 2); // Only split on first : as some tags also contain (multiple) : String[] cells = line.split("\\t", 3); table.addCell(new Cell().add(new Paragraph(cells[0]))); table.addCell(new Cell().add(new Paragraph(cells[1]))); table.addCell(new Cell().add(new Paragraph(cells[2]))); } } } return table; } /** * This fillMetadataTable creates the table with the requested metadata based on the allMetadata ListArray coming * from the CompareImagesWindow and returns the table to the document * @param imageMetadata * @return */ private static Table fillMetadataTable(List<String[]> imageMetadata) { float[] mdpointColumnWidths = {100f, 260f, 450f}; Table table = new Table(mdpointColumnWidths); table.setFontSize(10); if (imageMetadata.size() > 0) { for (String[] row : imageMetadata) { table.addCell(new Cell().add(new Paragraph(row[2]))); table.addCell(new Cell().add(new Paragraph(row[3]))); table.addCell(new Cell().add(new Paragraph(row[4]))); } } return table; } /** * This method is called from the mainScreen and starts a background task "WriteToPDF" while an infinite progressbar is keeping the user informed * @param rootPanel * @param PDFradiobuttons * @param PDFcomboboxes * @param progressBar * @return */ public static void CreatePDFs(JPanel rootPanel, JRadioButton[] PDFradiobuttons, JComboBox[] PDFcomboboxes, JProgressBar progressBar, JLabel outputLabel, String ExpImgFoldertextField, boolean includeSubFolders) { String pdfdocs = ""; Executor executor = Executors.newSingleThreadExecutor(); executor.execute(new Runnable() { @Override public void run() { try { try { WriteToPDF(PDFradiobuttons, PDFcomboboxes, progressBar, ExpImgFoldertextField, includeSubFolders); progressBar.setVisible(false); outputLabel.setText(""); JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 400, (ResourceBundle.getBundle("translations/program_strings").getString("exppdf.pdfscreated") + ":<br><br>" + MyVariables.getpdfDocs()), ResourceBundle.getBundle("translations/program_strings").getString("exppdf.pdfscreated"), JOptionPane.INFORMATION_MESSAGE)); // Somehow something keeps the focus off of the main window rootPanel.setFocusable(true); rootPanel.requestFocus(); //rootPanel.requestFocusInWindow(); } catch (Exception e) { e.printStackTrace(); } } catch (Exception ex) { logger.debug("Error executing command"); } } }); SwingUtilities.invokeLater(new Runnable() { public void run() { progressBar.setVisible(true); outputLabel.setText(ResourceBundle.getBundle("translations/program_strings").getString("pt.exppdf")); } }); } /** * This method really writes the PDF. either a pdf per image, or one big pdf for all images. * It is called from the Export/Import tab * @param PDFradiobuttons * @param PDFcomboboxes * @param progressBar * @return */ public static void WriteToPDF(JRadioButton[] PDFradiobuttons, JComboBox[] PDFcomboboxes, JProgressBar progressBar, String ExpImgFoldertextField, boolean includeSubFolders) { List<String> cmdparams = new ArrayList<String>(); File[] files = null; int[] selectedIndices = null; if (!("".equals(ExpImgFoldertextField))) { // folder takes precedence over preview files //the pdf export is not an exiftool function. We can't simply specify a folder // We need to read the files in the folder File directoryPath = new File(ExpImgFoldertextField); //List of all files and directories if (includeSubFolders) { // recurse into subfolders List<String> tmpfiles = null; try { /*Files.walk(Paths.get(ExpImgFoldertextField)) .filter(Files::isRegularFile) .forEach(System.out::println);*/ Stream<Path> pathStream = Files.walk(Paths.get(ExpImgFoldertextField)).filter(Files::isRegularFile); Path[] pathArray= pathStream.toArray(Path[]::new); int Length = pathArray.length; files = new File[Length]; selectedIndices = new int[Length]; for (int i = 0; i < Length; ++i) { files[i] = pathArray[i].toFile(); selectedIndices[i] = i; } MyVariables.setLoadedFiles(files); } catch (IOException e) { e.printStackTrace(); } } else { FileFilter filterOnFiles = new FileFilter() { public boolean accept(File file) { boolean isFile = file.isFile(); if (isFile) { return true; } else { return false; } } }; files = directoryPath.listFiles(filterOnFiles); MyVariables.setLoadedFiles(files); int Length = files.length; selectedIndices = new int[Length]; for (int i = 0; i < Length; i++) { selectedIndices[i] = i; } } } else { // Normal selection via previews files = MyVariables.getLoadedFiles(); selectedIndices = MyVariables.getSelectedFilenamesIndices(); } File tmpfile; String filename; String pdfnamepath = ""; Document doc = null; String producedDocs = ""; boolean isWindows = Utils.isOsFromMicrosoft(); String[] params = GetDesiredParams(PDFradiobuttons, PDFcomboboxes); cmdparams.add(Utils.platformExiftool()); if (PDFradiobuttons[5].isSelected()) { // one combined document try { tmpfile = files[0]; pdfnamepath = tmpfile.getParent() + File.separator + "Combined.pdf"; PdfWriter bigWriter = new PdfWriter(pdfnamepath); PdfDocument pdfCombiDoc = new PdfDocument(bigWriter); doc = new Document(pdfCombiDoc); } catch (FileNotFoundException e) { logger.error("pdf file not found error {}", e); e.printStackTrace(); doc.close(); } } for (int index : selectedIndices) { String res = Utils.getImageInfoFromSelectedFile(params, index); filename = files[index].getName(); tmpfile = files[index]; if (!(PDFradiobuttons[5].isSelected())) { //User wants a document per image pdfnamepath = tmpfile.getParent() + File.separator + Utils.getFileNameWithoutExtension(filename) + ".pdf"; logger.debug("pdfnamepath {}", pdfnamepath); try { PdfWriter writer = new PdfWriter(pdfnamepath); PdfDocument pdfDoc = new PdfDocument(writer); doc = new Document(pdfDoc); // Creating the top table doc.add(topTable(tmpfile)); Paragraph paragraph1 = new Paragraph("\n\n" + ResourceBundle.getBundle("translations/program_strings").getString("exppdf.metadata") + " " + filename); doc.add(paragraph1); // Now writing the metadata table doc.add(fillMetadataTable(res)); doc.close(); producedDocs += pdfnamepath + "<br>"; } catch (FileNotFoundException e) { logger.error("pdf file not found error {}", e); e.printStackTrace(); doc.close(); } } else { // So the user wants one big document doc.add(topTable(tmpfile)); Paragraph paragraph1 = new Paragraph("\n\n" + ResourceBundle.getBundle("translations/program_strings").getString("exppdf.metadata") + " " + filename); doc.add(paragraph1); // Now writing the metadata table doc.add(fillMetadataTable(res)); doc.add(new AreaBreak()); } } if (PDFradiobuttons[5].isSelected()) { // one combined document producedDocs = pdfnamepath; doc.close(); } MyVariables.setpdfDocs(producedDocs); logger.debug("producedDocs {}", producedDocs); } /** * This method writes the pdf and is called from the CompareImagesWindow for the there displayed info * @param allMetadata */ public static void WriteToPDF(List<String[]> allMetadata) { List<String[]> imageMetadata = new ArrayList<String[]>(); File[] files = MyVariables.getLoadedFiles(); int[] selectedIndices = MyVariables.getSelectedFilenamesIndices(); File tmpfile; String filename; String pdfnamepath = ""; Document doc = null; String producedDocs = ""; boolean isWindows = Utils.isOsFromMicrosoft(); for (int index : selectedIndices) { // First get the data belonging to this file (index) for (String[] row : allMetadata) { if (Integer.valueOf(row[1]) == index) { imageMetadata.add(row); logger.trace("index {} rowdata {}", index, Arrays.toString(row)); } } filename = files[index].getName(); tmpfile = files[index]; pdfnamepath = tmpfile.getParent() + File.separator + Utils.getFileNameWithoutExtension(filename) + ".pdf"; logger.debug("pdfnamepath {}", pdfnamepath); try { PdfWriter writer = new PdfWriter(pdfnamepath); PdfDocument pdfDoc = new PdfDocument(writer); doc = new Document(pdfDoc); // Creating the top table doc.add(topTable(tmpfile)); Paragraph paragraph1 = new Paragraph("\n\n" + ResourceBundle.getBundle("translations/program_strings").getString("exppdf.metadata") + " " + filename); doc.add(paragraph1); // Now writing the metadata table doc.add(fillMetadataTable(imageMetadata)); doc.close(); producedDocs += pdfnamepath + "<br>"; } catch (FileNotFoundException e) { logger.error("pdf file not found error {}", e); e.printStackTrace(); doc.close(); } MyVariables.setpdfDocs(producedDocs); logger.debug("producedDocs {}", producedDocs); } } }
22,445
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
MyVariables.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/MyVariables.java
package org.hvdw.jexiftoolgui; import javax.swing.*; import java.io.File; import java.util.*; /** * This is the big setter/getter class for the entire program */ public class MyVariables { private final static MyVariables staticInstance = new MyVariables(); private MyVariables() { } private int SelectedRowOrIndex = 2147483645; // Max value integer - 2; //private int SelectedRow; private int SelectedColumn; private String SelectedImagePath; private File[] loadedFiles; private int[] selectedFilenamesIndices; private String jexiftoolguiDBPath; private String jexiftoolguiCacheFolder; private String lensFolder; private String custommetadatasetFolder; private String cantdisplaypng; private String cantconvertpng; private String selectedLensConfig; private String tmpWorkFolder; private File CurrentWorkFile; private File CurrentFileInViewer; private File SinglePreview; private String SinglePreviewFileName; private String ExiftoolVersion; private List<List> tableRowsCells; private List<String> userCombiTableValues; private List<String[]> listCustomSetsNamesPaths; private List<Integer> selectedIndicesList; private String[] CustomCombis; private String delayedOutput; private HashMap<String, String> imgBasicData; private String pdfDocs; private String[] commandLineArgs; private boolean commandLineArgsgiven = false; private int ScreenWidth; private int ScreenHeight; private String[] mainScreenParams; private String[] whichRadioButtonsSelected; private JLabel[] mainScreenLabels; private ArrayList<String> category_tag; private String Latitude; private String Longitude; private HashMap <String, HashMap<String, String> > imagesData; private String SearchPhrase; private boolean reloadImagesFromSearchResult = false; private boolean createPreviewsCheckBox = true; private String ExifToolPath; private JList iconView; private Locale CurrentLocale; // The actual getters and setters public static int getSelectedRowOrIndex() { return staticInstance.SelectedRowOrIndex;} public static void setSelectedRowOrIndex(int index) {staticInstance.SelectedRowOrIndex = index; } public static int getSelectedColumn() { return staticInstance.SelectedColumn; } public static void setSelectedColumn(int num) { staticInstance.SelectedColumn = num; } public static String getSelectedImagePath() { return staticInstance.SelectedImagePath; } public static void setSelectedImagePath(String selImgPath) { staticInstance.SelectedImagePath = selImgPath; } public static String getjexiftoolguiDBPath() { return staticInstance.jexiftoolguiDBPath; } public static void setjexiftoolguiDBPath(String selDBPath) { staticInstance.jexiftoolguiDBPath = selDBPath; } public static String getjexiftoolguiCacheFolder() { return staticInstance.jexiftoolguiCacheFolder; } public static void setjexiftoolguiCacheFolder(String jtgCchFldr) { staticInstance.jexiftoolguiCacheFolder = jtgCchFldr;} public static String getlensFolder() { return staticInstance.lensFolder; } public static void setlensFolder( String lnsfldr) { staticInstance.lensFolder = lnsfldr; } public static String getcustommetadatasetFolder() { return staticInstance.custommetadatasetFolder; } public static void setcustommetadatasetFolder( String cstmmtdtstFldr) { staticInstance.custommetadatasetFolder = cstmmtdtstFldr; } public static String getcantdisplaypng() { return staticInstance.cantdisplaypng; } public static void setcantdisplaypng(String pngPath) { staticInstance.cantdisplaypng = pngPath; } public static String getcantconvertpng() { return staticInstance.cantconvertpng; } public static void setcantconvertpng(String cpngPath) { staticInstance.cantconvertpng = cpngPath; } public static String getselectedLensConfig() { return staticInstance.selectedLensConfig; } public static void setselectedLensConfig(String sLC) { staticInstance.selectedLensConfig = sLC; } public static void setLoadedFiles(File[] loadedFiles) { staticInstance.loadedFiles = Arrays.copyOf(loadedFiles, loadedFiles.length); } public static File[] getLoadedFiles() { return Arrays.copyOf(staticInstance.loadedFiles, staticInstance.loadedFiles.length); } public static String gettmpWorkFolder() { return staticInstance.tmpWorkFolder; } public static void settmpWorkFolder( String tmpworkfldr) { staticInstance.tmpWorkFolder = tmpworkfldr; } public static File getCurrentWorkFile() { return staticInstance.CurrentWorkFile; } public static void setCurrentWorkFile(File file) { staticInstance.CurrentWorkFile = file; } public static File getCurrentFileInViewer() { return staticInstance.CurrentFileInViewer; } public static void setCurrentFileInViewer(File file) { staticInstance.CurrentFileInViewer = file; } public static File getSinglePreview() { return staticInstance.SinglePreview; } public static void setSinglePreview(File file) { staticInstance.SinglePreview = file; } public static String getSinglePreviewFileName() { return staticInstance.SinglePreviewFileName; } public static void setSinglePreviewFileName( String spfn) { staticInstance.SinglePreviewFileName = spfn; } public static int[] getSelectedFilenamesIndices() { return Arrays.copyOf(staticInstance.selectedFilenamesIndices, staticInstance.selectedFilenamesIndices.length); } public static void setSelectedFilenamesIndices(int[] selectedTableIndices) { staticInstance.selectedFilenamesIndices = Arrays.copyOf(selectedTableIndices,selectedTableIndices.length); } public static List<Integer> getselectedIndicesList() { return staticInstance.selectedIndicesList; } public static void setselectedIndicesList(List<Integer> selIndList) { staticInstance.selectedIndicesList = selIndList; } public static String getExiftoolVersion() { return staticInstance.ExiftoolVersion; } public static void setExiftoolVersion(String exv) { staticInstance.ExiftoolVersion = exv; } public static String getExifToolPath() { return staticInstance.ExifToolPath; } public static void setExifToolPath(String exp) { staticInstance.ExifToolPath = exp; } public static List<List> gettableRowsCells() { return staticInstance.tableRowsCells; } public static void settableRowsCells (List<List> tblRwsClls) {staticInstance.tableRowsCells = tblRwsClls; } public static List<String> getuserCombiTableValues() { return staticInstance.userCombiTableValues; } public static void setuserCombiTableValues (List<String> userCTV) { staticInstance.userCombiTableValues = userCTV; } public static List<String[]> getlistCustomSetsNamesPaths() { return staticInstance.listCustomSetsNamesPaths; } public static void setlistCustomSetsNamesPaths (List<String[]> stlstcstmstsnmspths) {staticInstance.listCustomSetsNamesPaths = stlstcstmstsnmspths; } public static String[] getCustomCombis() { return Arrays.copyOf(staticInstance.CustomCombis, staticInstance.CustomCombis.length); } public static void setCustomCombis(String[] CustomCombisfromDB) { staticInstance.CustomCombis = Arrays.copyOf(CustomCombisfromDB, CustomCombisfromDB.length); } public static String getdelayedOutput() { return staticInstance.delayedOutput; } public static void setdelayedOutput(String deloutput) { staticInstance.delayedOutput = deloutput; } public static HashMap<String, String> getimgBasicData () { return staticInstance.imgBasicData; }; public static void setimgBasicData( HashMap<String, String> imgBasData) {staticInstance.imgBasicData = imgBasData; } public static String getpdfDocs() { return staticInstance.pdfDocs; } public static void setpdfDocs(String pdfDcs) { staticInstance.pdfDocs = pdfDcs; } public static String[] getcommandLineArgs() { return Arrays.copyOf(staticInstance.commandLineArgs, staticInstance.commandLineArgs.length); } public static void setcommandLineArgs(String[] setcmdlnargs) { staticInstance.commandLineArgs = Arrays.copyOf(setcmdlnargs, setcmdlnargs.length); } public static boolean getcommandLineArgsgiven() { return staticInstance.commandLineArgsgiven;} public static void setcommandLineArgsgiven(boolean cmdlnrgsgvn) {staticInstance.commandLineArgsgiven = cmdlnrgsgvn; } public static int getScreenWidth() { return staticInstance.ScreenWidth;} public static void setScreenWidth(int width) {staticInstance.ScreenWidth = width; } public static int getScreenHeight() { return staticInstance.ScreenHeight;} public static void setScreenHeight(int height) {staticInstance.ScreenHeight = height; } public static String[] getmainScreenParams() { return Arrays.copyOf(staticInstance.mainScreenParams, staticInstance.mainScreenParams.length); } public static void setmainScreenParams(String[] setmnscrnprms) { staticInstance.mainScreenParams = Arrays.copyOf(setmnscrnprms, setmnscrnprms.length); } public static ArrayList<String> getcategory_tag() { return staticInstance.category_tag; } public static void setcategory_tag (ArrayList<String> ctgr_tg) { staticInstance.category_tag = ctgr_tg; } public static String getLatitude() { return staticInstance.Latitude; } public static void setLatitude(String lat) { staticInstance.Latitude = lat; } public static String getLongitude() { return staticInstance.Longitude; } public static void setLongitude(String lng) { staticInstance.Longitude = lng; } public static HashMap<String, HashMap<String, String>> getimagesData() { return staticInstance.imagesData; } public static void setimagesData(HashMap<String, HashMap<String, String>> imgsData) {staticInstance.imagesData = imgsData; } public static String getSearchPhrase() { return staticInstance.SearchPhrase; } public static void setSearchPhrase(String srchphrs) { staticInstance.SearchPhrase = srchphrs; } public static boolean getreloadImagesFromSearchResult() { return staticInstance.reloadImagesFromSearchResult;} public static void setreloadImagesFromSearchResult(boolean rifsr) {staticInstance.reloadImagesFromSearchResult = rifsr; } public static boolean getcreatePreviewsCheckBox() { return staticInstance.createPreviewsCheckBox;} public static void setcreatePreviewsCheckBox(boolean crprevchkbox) {staticInstance.createPreviewsCheckBox = crprevchkbox; } public static JList geticonView() { return staticInstance.iconView;} public static void seticonView(JList cnVw) {staticInstance.iconView = cnVw; } public static Locale getCurrentLocale() { return staticInstance.CurrentLocale; } public static void setCurrentLocale(Locale curLoc) { staticInstance.CurrentLocale = curLoc; } }
11,065
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
mainScreen.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/mainScreen.java
package org.hvdw.jexiftoolgui; import ch.qos.logback.classic.Logger; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import org.hvdw.jexiftoolgui.controllers.*; import org.hvdw.jexiftoolgui.datetime.DateTime; import org.hvdw.jexiftoolgui.editpane.*; import org.hvdw.jexiftoolgui.facades.IPreferencesFacade; import org.hvdw.jexiftoolgui.metadata.ExportMetadata; import org.hvdw.jexiftoolgui.metadata.MetaData; import org.hvdw.jexiftoolgui.metadata.SearchMetaData; import org.hvdw.jexiftoolgui.model.CompareImages; import org.hvdw.jexiftoolgui.model.GuiConfig; import org.hvdw.jexiftoolgui.view.*; import org.slf4j.LoggerFactory; import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.border.TitledBorder; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.ImageIcon; import javax.swing.plaf.FontUIResource; import javax.swing.text.StyleContext; import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.dnd.DnDConstants; import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetDropEvent; import java.awt.event.*; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Method; import java.text.ParseException; import java.util.*; import java.util.List; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import static org.hvdw.jexiftoolgui.controllers.StandardFileIO.checkforjexiftoolguiFolder; public class mainScreen { private static final Logger logger = (Logger) LoggerFactory.getLogger(mainScreen.class); private IPreferencesFacade prefs = IPreferencesFacade.defaultInstance; //private JFrame rootFrame; private JMenuBar menuBar; private JMenu myMenu; private JMenuItem menuItem; private JPanel rootPanel; private JTabbedPane tabbedPaneRight; private JButton buttonLoadImages; private JButton buttonShowImage; public JPanel LeftPanel; private JPanel LeftbuttonBar; private JRadioButton radioButtonViewAll; private JPanel ViewRadiobuttonpanel; private JPanel ViewDatapanel; private JScrollPane ViewDatascrollpanel; private JTree FileTree; private JScrollPane LeftTableScrollPanel; private JTable tableListfiles; private JTable ListexiftoolInfotable; private JLabel iconLabel; private JLabel MyCommandsText; private JTextField CommandsParameterstextField; private JButton CommandsclearParameterSFieldButton; private JButton CommandsclearOutputFieldButton; private JButton CommandsgoButton; private JButton CommandshelpButton; private JEditorPane YourCommandsOutputText; private JTabbedPane tabbedPaneEditfunctions; private JTextField ExifMaketextField; private JCheckBox ExifMakecheckBox; private JTextField ExifModeltextField; private JCheckBox ExifModelcheckBox; private JTextField ExifModifyDatetextField; private JCheckBox ExifModifyDatecheckBox; private JTextField ExifDateTimeOriginaltextField; private JCheckBox ExifDateTimeOriginalcheckBox; private JTextField ExifCreateDatetextField; private JCheckBox ExifCreateDatecheckBox; private JTextField ExifArtistCreatortextField; private JCheckBox ExifArtistCreatorcheckBox; private JTextField ExifCopyrighttextField; private JCheckBox ExifCopyrightcheckBox; private JTextField ExifUsercommenttextField; private JCheckBox ExifUsercommentcheckBox; private JTextArea ExifDescriptiontextArea; private JCheckBox ExifDescriptioncheckBox; private JButton ExifcopyFromButton; private JButton ExifsaveToButton; private JCheckBox ExifBackupOriginalscheckBox; private JButton ExifcopyDefaultsButton; private JButton resetFieldsButton; private JButton ExifhelpButton; private JTextField xmpCreatortextField; private JCheckBox xmpCreatorcheckBox; private JTextField xmpRightstextField; private JCheckBox xmpRightscheckBox; private JTextArea xmpDescriptiontextArea; private JCheckBox xmpDescriptioncheckBox; private JTextField xmpLabeltextField; private JCheckBox xmpLabelcheckBox; private JTextField xmpSubjecttextField; private JCheckBox xmpSubjectcheckBox; private JTextField xmpTitletextField; private JCheckBox xmpTitlecheckBox; private JTextField xmpPersontextField; private JCheckBox xmpPersoncheckBox; private JButton xmpCopyFrombutton; private JButton xmpSaveTobutton; private JCheckBox xmpBackupOriginalscheckBox; private JButton xmpCopyDefaultsbutton; private JButton xmpResetFieldsbutton; private JButton xmpHelpbutton; private JTextField geotaggingImgFoldertextField; private JButton geotaggingImgFolderbutton; private JTextField geotaggingGPSLogtextField; private JButton geotaggingGPSLogbutton; private JTextField geotaggingGeosynctextField; private JButton geotaggingWriteInfobutton; private JButton geotaggingHelpbutton; private JLabel GeotaggingLeaveFolderEmptyLabel; private JCheckBox geotaggingOverwriteOriginalscheckBox; private JPanel ExifEditpanel; private JPanel GeotaggingEditpanel; private JTextField xmpRegionNametextField; private JCheckBox xmpRegionNamecheckBox; private JTextField xmpRegionTypetextField; private JCheckBox xmpRegionTypecheckBox; private JProgressBar progressBar; private JLabel OutputLabel; private JPanel gpsButtonPanel; private JPanel getGpsButtonPanel2; private JPanel gpsLocationPanel; private JPanel gpsCalculationPanel; private JButton gpsCopyFrombutton; private JButton gpsSaveTobutton; private JCheckBox gpsBackupOriginalscheckBox; private JButton gpsResetFieldsbutton; private JButton gpsMapcoordinatesbutton; private JButton gpsHelpbutton; private JLabel gpsCalculatorLabelText; private JTextField gpsLocationtextField; private JCheckBox gpsLocationcheckBox; private JCheckBox SaveLatLonAltcheckBox; private JFormattedTextField gpsLatDecimaltextField; private JFormattedTextField gpsLonDecimaltextField; private JCheckBox gpsAboveSealevelcheckBox; private JPanel gpsLatLonAltPanel; private JTextField gpsCountrytextField; private JCheckBox gpsCountrycheckBox; private JTextField gpsStateProvincetextField; private JCheckBox gpsStateProvincecheckBox; private JTextField gpsCitytextField; private JCheckBox gpsCitycheckBox; private JButton copyToInputFieldsButton; private JLabel CalcLatDecimaltextLabel; private JFormattedTextField CalcLatDegtextField; private JFormattedTextField CalcLatMintextField; private JFormattedTextField CalcLatSectextField; private JLabel CalcLonDecimaltextLabel; private JFormattedTextField CalcLonDegtextField; private JFormattedTextField CalcLonMintextField; private JFormattedTextField CalcLonSectextField; private JRadioButton CalcNorthRadioButton; private JRadioButton CalcSouthRadioButton; private JRadioButton CalcEastradioButton; private JRadioButton CalcWestRadioButton; private JButton decimalToMinutesSecondsButton; private JButton minutesSecondsToDecimalButton; private JLabel CopyMetaDataUiText; private JRadioButton copyAllMetadataRadiobutton; private JRadioButton copyAllMetadataSameGroupsRadiobutton; private JRadioButton copySelectiveMetadataradioButton; private JCheckBox CopyExifcheckBox; private JCheckBox CopyXmpcheckBox; private JCheckBox CopyIptccheckBox; private JCheckBox CopyIcc_profileDataCheckBox; private JCheckBox BackupOriginalscheckBox; private JCheckBox CopyGpsCheckBox; private JCheckBox CopyJfifcheckBox; private JButton UseDataFrombutton; private JButton CopyDataCopyTobutton; private JButton CopyHelpbutton; private JRadioButton UseNonPropFontradioButton; private JRadioButton UsePropFontradioButton; private JRadioButton radioButtonByTagName; private JComboBox comboBoxViewByTagName; private JRadioButton radioButtoncommonTags; private JComboBox comboBoxViewCommonTags; private JRadioButton radioButtonCameraMakes; private JComboBox comboBoxViewCameraMake; private JTextField geotaggingLocationtextfield; private JTextField geotaggingCountrytextfield; private JCheckBox geotaggingLocationcheckbox; private JCheckBox geotaggingCountrycheckbox; private JTextField geotaggingStatetextfield; private JCheckBox geotaggingStatecheckbox; private JTextField geotaggingCitytextfield; private JCheckBox geotaggingCitycheckbox; private JLabel GeotaggingLocationLabel; private JButton resetGeotaggingbutton; private JLabel GeotaggingGeosyncExplainLabel; private JFormattedTextField gpsAltDecimaltextField; private JLabel gPanoTopText; private JFormattedTextField gpanoCAIHPtextField; private JFormattedTextField gpanoCAIWPtextField; private JFormattedTextField gpanoCALPtextField; private JFormattedTextField gpanoCATPtextField; private JTextField gpanoStitchingSoftwaretextField; private JFormattedTextField gpanoFPHPtextField; private JFormattedTextField gpanoFPWPtextField; private JComboBox gpanoPTcomboBox; private JCheckBox checkBox1; private JFormattedTextField gpanoPHDtextField; private JFormattedTextField gpanoIVHDtextField; private JCheckBox gpanoIVHDCheckBox; private JFormattedTextField gpanoIVPDtextField; private JCheckBox gpanoIVPDCheckBox; private JFormattedTextField gpanoIVRDtextField; private JCheckBox gpanoIVRDCheckBox; private JFormattedTextField gpanoIHFOVDtextField; private JCheckBox gpanoIHFOVDtextFieldCheckBox; private JButton gpanoResetFieldsbutton; private JButton gpanoHelpbutton; private JCheckBox gpanoOverwriteOriginalscheckBox; private JButton gpanoCopyFrombutton; private JButton gpanoCopyTobutton; private JLabel gpanoMinVersionText; private JCheckBox gpanoStitchingSoftwarecheckBox; private JCheckBox gpanoPHDcheckBox; private JTextField xmpCredittextField; private JCheckBox xmpCreditcheckBox; private JLabel xmpTopText; private JCheckBox CopyMakernotescheckBox; private JTextField lensmaketextField; private JCheckBox lensmakecheckBox; private JTextField lensmodeltextField; private JCheckBox lensmodelcheckBox; private JTextField lensserialnumbertextField; private JTextField focallengthtextField; private JCheckBox lensserialnumbercheckBox; private JCheckBox focallengthcheckBox; private JTextField focallengthIn35mmformattextField; private JCheckBox focallengthIn35mmformatcheckBox; private JTextField fnumbertextField; private JCheckBox fnumbercheckBox; private JTextField maxaperturevaluetextField; private JCheckBox maxaperturevaluecheckBox; private JComboBox meteringmodecomboBox; private JCheckBox meteringmodecheckBox; private JTextField focusdistancetextField; private JCheckBox focusdistancecheckBox; private JTextField lensidtextField; private JCheckBox lensidcheckBox; private JTextField conversionlenstextField; private JCheckBox conversionlenscheckBox; private JTextField lenstypetextField; private JCheckBox lenstypecheckBox; private JTextField lensfirmwareversiontextField; private JCheckBox lensfirmwareversioncheckBox; private JCheckBox lensOverwriteOriginalscheckBox; private JButton lensCopyFrombutton; private JButton lensSaveTobutton; private JButton lensResetFieldsbutton; private JButton lensHelpbutton; private JPanel saveloadlensconfigpanel; private JButton saveLensConfigurationbutton; private JButton loadLensConfigurationButton; private JLabel lensSaveLoadConfigLabel; private JPanel gpsButtonPanel2; private JButton buttonLoadDirectory; private JLabel StringsTopText; private JTextField StringsKeywordstextField; private JLabel StringsKeywordsIPTCcheckBox; private JRadioButton StringsKeywOverwriteradioButton; private JRadioButton StringsKeywAppendradioButton; private JRadioButton StringsKeywRemoveradioButton; private JRadioButton StringsKeywDontSaveradioButton; private JTextField StringsSubjecttextField; private JRadioButton StringsSubjectOverwriteradioButton; private JRadioButton StringsSubjectAppendradioButton; private JRadioButton StringsSubjectRemoveradioButton; private JRadioButton StringsSubjectDontSaveradioButton; private JTextField StringsPIItextField; private JLabel StringsIIPXmpcheckBox; private JCheckBox StringsIIPIPTCcheckBox; private JRadioButton StringsIIPOverwriteradioButton; private JRadioButton StringsIIPAppendradioButton; private JRadioButton StringsIIPRemoveradioButton; private JRadioButton StringsIIPDontSaveradioButton; private JCheckBox stringPlusOverwriteOriginalscheckBox; private JButton stringPlusCopyFrombutton; private JButton stringPlusSaveTobutton; private JButton stringPlusResetFieldsbutton; private JButton stringPlusHelpbutton; private JTextField xmpKeywordstextField; private JCheckBox xmpKeywordscheckBox; private JButton AddCommandFavoritebutton; private JButton LoadCommandFavoritebutton; private JButton SaveQuerybutton; private JButton loadQuerybutton; private JLabel JLabelDropReady; private JTable UserCombiTable; private JComboBox UserCombiscomboBox; private JButton udcCreateNewButton; private JLabel UserCombiTopText; private JCheckBox udcOverwriteOriginalscheckBox; private JButton udcCopyFrombutton; private JButton udcSaveTobutton; private JButton udcResetFieldsbutton; private JButton udcHelpbutton; private JScrollPane UserCombiScrollPane; private JLabel CustomConfiglabel; private JLabel lblLoadedFiles; private JRadioButton copyAllMetdataToXMPRadioButton; private JTabbedPane CopyDatatabbedPane; private JRadioButton CopyArgsRadioButton; private JRadioButton tagsToExifradioButton; private JRadioButton tagsToXmpradioButton; private JRadioButton tagsToIptcradioButton; private JRadioButton tagsToGpsradioButton; private JRadioButton tagsToPdfradioButton; private JCheckBox exif2xmpCheckBox; private JCheckBox gps2xmpCheckBox; private JCheckBox iptc2xmpCheckBox; private JCheckBox pdf2xmpCheckBox; private JCheckBox iptc2exifCheckBox; private JCheckBox xmp2exifCheckBox; private JCheckBox exif2iptcCheckBox; private JCheckBox xmp2iptcCheckBox; private JCheckBox xmp2gpsCheckBox; private JCheckBox xmp2pdfCheckBox; private JCheckBox CopyInsideImageMakeCopyOfOriginalscheckBox; private JButton copyInsideSaveDataTo; private JButton buttonCompare; private JButton buttonSlideshow; private JTabbedPane tabbedPaneExportImport; private JLabel exportMetaDataUiText; private JRadioButton catmetadataradioButton; private JRadioButton exportFromUserCombisradioButton; private JCheckBox exportAllMetadataCheckBox; private JCheckBox exportExifDataCheckBox; private JCheckBox exportXmpDataCheckBox; private JCheckBox exportGpsDataCheckBox; private JCheckBox exportIptcDataCheckBox; private JCheckBox exportICCDataCheckBox; private JComboBox exportUserCombicomboBox; private JRadioButton txtRadioButton; private JRadioButton tabRadioButton; private JRadioButton xmlRadioButton; private JRadioButton htmlRadioButton; private JRadioButton XMPRadioButton; private JRadioButton csvRadioButton; private JCheckBox GenExpuseMetadataTagLanguageCheckBoxport; private JButton GenExportbuttonOK; private JButton GenExportbuttonCancel; private JPanel bottomPanel; private JLabel expPdftextLabel; private JRadioButton A4radioButton; private JRadioButton LetterradioButton; private JRadioButton pdfPerImgradioButton; private JRadioButton pdfCombinedradioButton; private JButton ExpPDFOKbutton; private JSplitPane splitPanel; private JLabel exppdfDataText; private JRadioButton pdfradioButtonExpAll; private JComboBox pdfcomboBoxExpCommonTags; private JComboBox pdfcomboBoxExpByTagName; private JRadioButton pdfradioButtonExpCommonTags; private JRadioButton pdfradioButtonExpByTagName; private JLabel pdfLabelSupported; private JRadioButton exifSCradioButton; private JRadioButton xmpSCradioButton; private JRadioButton mieSCradioButton; private JRadioButton exvSCradioButton; private JButton SidecarExportButton; private JButton SideCarHelpbutton; private JTabbedPane geoformattabbedPane; private JButton gpssearchLocationButton; private JLabel lblMapcoordinates; private JLabel lblNominatimSearch; private JCheckBox gpsMinErrorcheckBox; private JButton buttonSearchMetadata; private JTextField ExpImgFoldertextField; private JButton ExpBrowseButton; private JTextField expToPdfFolderTextfield; private JLabel ExpLeaveFolderEmptyLabel; private JLabel ExpSidecarLeaveFolderEmptyLabel; private JButton expSidecarBrowseButton; private JTextField ExpSidecarFolderTextField; private JLabel GeoTfolderBrowseLabel; private JLabel genExpfolderBrowseLabel; private JCheckBox includeSubFoldersCheckBox; private JTextField ETCommandsFoldertextField; private JButton ETCBrowseButton; private JLabel etcFolderBrowseLabel; private JLabel etcLeaveFolderEmptyLabel; private JCheckBox etcIncludeSubFoldersCheckBox; private JLabel lblImgSourceFolder; private JPanel LeftCheckboxBar; private JCheckBox createPreviewsCheckBox; private JCheckBox loadMetadataCheckBox; private JButton leftCheckBoxBarHelpButton; private JLabel lblFileNamePath; private JLabel SeparatorText; private JRadioButton ImgSizeLargeradioButton; private JRadioButton ImgSizeSmallradioButton; private JRadioButton radioButtonComma; private JRadioButton radioButtonColon; private JRadioButton radioButtonSemiColon; private JRadioButton radioButtonHash; private JTextField textFieldOtherSeparator; private JRadioButton radioButtonOther; private JCheckBox gpsmakernotescheckBox; private JTable previewTable; private JPanel gpsButtonPanel3; private JButton gpssearchLocationButtonCoordinates; private JScrollPane LeftGridScrollPanel; private JList iconViewList; private ImageIcon icon; public File[] files; public int[] selectedIndices; public List<Integer> selectedIndicesList = new ArrayList<Integer>(); private int SelectedRowOrIndex; private int SelectedCopyFromImageIndex; // Used for the copy metadata from .. public List<HashMap> imagesData = new ArrayList<HashMap>(); public String exiftool_path = ""; private ListSelectionModel listSelectionModel; private ListSelectionModel icongridListSelectionModel; private JPopupMenu myPopupMenu; // Initialize all the helper classes PreferencesDialog prefsDialog = new PreferencesDialog(); private MetaData metaData = new MetaData(); private DateTime dateTime = new DateTime(); private EditExifdata EEd = new EditExifdata(); private EditXmpdata EXd = new EditXmpdata(); private EditGeotaggingdata EGd = new EditGeotaggingdata(); private EditGPSdata EGPSd = new EditGPSdata(); private ExifToolCommands YourCmnds = new ExifToolCommands(); private EditGpanodata EGpanod = new EditGpanodata(); private EditLensdata ELd = new EditLensdata(); //private DatabasePanel DBP = new DatabasePanel(); private CreateUpdatemyLens CUL = new CreateUpdatemyLens(); private EditStringdata ESd = new EditStringdata(); private MetadataUserCombinations MD = new MetadataUserCombinations(); private SimpleWebView WV = new SimpleWebView(); private EditUserDefinedCombis EUDC = new EditUserDefinedCombis(); ////////////////////////////////////////////////////////////////////////////////// // Define the several arrays for the several Edit panes on the right side. An interface or getter/setter methods would be more "correct java", but also // creates way more code which doesn't make it clearer either. public JPanel getRootPanel() { return rootPanel; } public JSplitPane getsplitPanel() { return splitPanel; } private JButton[] commandButtons() { return new JButton[] {buttonLoadDirectory, buttonLoadImages, buttonShowImage, buttonCompare, buttonSearchMetadata, buttonSlideshow}; } private JCheckBox[] getLoadOptions() { return new JCheckBox[] {createPreviewsCheckBox, loadMetadataCheckBox}; } private JLabel[] mainScreenLabels() { return new JLabel[] {OutputLabel, lblLoadedFiles, lblImgSourceFolder, lblFileNamePath}; } private JTextField[] getExifFields() { return new JTextField[]{ExifMaketextField, ExifModeltextField, ExifModifyDatetextField, ExifDateTimeOriginaltextField, ExifCreateDatetextField, ExifArtistCreatortextField, ExifCopyrighttextField, ExifUsercommenttextField}; } private JTextArea[] getExifAreas() { return new JTextArea[]{ExifDescriptiontextArea}; } private JCheckBox[] getExifBoxes() { return new JCheckBox[]{ExifMakecheckBox, ExifModelcheckBox, ExifModifyDatecheckBox, ExifDateTimeOriginalcheckBox, ExifCreateDatecheckBox, ExifArtistCreatorcheckBox, ExifCopyrightcheckBox, ExifUsercommentcheckBox, ExifDescriptioncheckBox, ExifBackupOriginalscheckBox}; } private JTextField[] getXmpFields() { return new JTextField[] {xmpCreatortextField, xmpCredittextField, xmpRightstextField, xmpLabeltextField, xmpTitletextField, xmpKeywordstextField, xmpSubjecttextField, xmpPersontextField}; } private JTextArea[] getXmpAreas() { return new JTextArea[] {xmpDescriptiontextArea}; } private JCheckBox[] getXmpBoxes() { return new JCheckBox[]{xmpCreatorcheckBox, xmpCreditcheckBox, xmpRightscheckBox, xmpLabelcheckBox, xmpTitlecheckBox , xmpKeywordscheckBox,xmpSubjectcheckBox, xmpPersoncheckBox, xmpDescriptioncheckBox, xmpBackupOriginalscheckBox}; } private JTextField[] getGeotaggingFields() { return new JTextField[] {geotaggingImgFoldertextField, geotaggingGPSLogtextField, geotaggingGeosynctextField, geotaggingLocationtextfield, geotaggingCountrytextfield, geotaggingStatetextfield, geotaggingCitytextfield}; } private JCheckBox[] getGeotaggingBoxes() {return new JCheckBox[] {geotaggingLocationcheckbox, geotaggingCountrycheckbox, geotaggingStatecheckbox, geotaggingCitycheckbox};} private JRadioButton[] getCopyMetaDataRadiobuttons() {return new JRadioButton[] {copyAllMetadataRadiobutton, copyAllMetadataSameGroupsRadiobutton, copySelectiveMetadataradioButton}; } private JCheckBox[] getCopyMetaDataCheckBoxes() {return new JCheckBox[] {CopyExifcheckBox, CopyXmpcheckBox, CopyIptccheckBox, CopyIcc_profileDataCheckBox, CopyGpsCheckBox, CopyJfifcheckBox, CopyMakernotescheckBox, BackupOriginalscheckBox}; } private JRadioButton[] getInsideImageCopyRadiobuttons() {return new JRadioButton[] {copyAllMetdataToXMPRadioButton, CopyArgsRadioButton}; } private JRadioButton[] getInsideImageSubCopyRadiobuttons() {return new JRadioButton[] {tagsToXmpradioButton, tagsToExifradioButton, tagsToIptcradioButton, tagsToGpsradioButton, tagsToPdfradioButton}; } private JCheckBox[] getInsideImageCopyCheckboxes() {return new JCheckBox[] {exif2xmpCheckBox, gps2xmpCheckBox, iptc2xmpCheckBox, pdf2xmpCheckBox, iptc2exifCheckBox, xmp2exifCheckBox, exif2iptcCheckBox, xmp2iptcCheckBox, xmp2gpsCheckBox, xmp2pdfCheckBox, CopyInsideImageMakeCopyOfOriginalscheckBox}; } private JFormattedTextField[] getNumGPSdecFields() { return new JFormattedTextField[] {gpsLatDecimaltextField, gpsLonDecimaltextField, gpsAltDecimaltextField}; } private JTextField[] getGPSLocationFields() { return new JTextField[] {gpsLocationtextField, gpsCountrytextField, gpsStateProvincetextField, gpsCitytextField}; } private JCheckBox[] getGpsBoxes() { return new JCheckBox[] {SaveLatLonAltcheckBox, gpsAboveSealevelcheckBox, gpsLocationcheckBox, gpsCountrycheckBox, gpsStateProvincecheckBox, gpsCitycheckBox, gpsBackupOriginalscheckBox, gpsMinErrorcheckBox, gpsmakernotescheckBox}; } private JFormattedTextField[] getGPSdmsFields() { return new JFormattedTextField[] {CalcLatDegtextField, CalcLatMintextField, CalcLatSectextField, CalcLonDegtextField, CalcLonMintextField, CalcLonSectextField}; } private JRadioButton[] getGPSdmsradiobuttons() { return new JRadioButton[] {CalcNorthRadioButton, CalcSouthRadioButton, CalcEastradioButton, CalcWestRadioButton}; } private JFormattedTextField[] getGpanoFields() { return new JFormattedTextField[] {gpanoCAIHPtextField, gpanoCAIWPtextField, gpanoCALPtextField, gpanoCATPtextField, gpanoFPHPtextField, gpanoFPWPtextField, gpanoPHDtextField, gpanoIVHDtextField, gpanoIVPDtextField, gpanoIVRDtextField, gpanoIHFOVDtextField}; } private JCheckBox[] getGpanoCheckBoxes() { return new JCheckBox[] {gpanoPHDcheckBox, gpanoStitchingSoftwarecheckBox, gpanoIVHDCheckBox, gpanoIVPDCheckBox, gpanoIVRDCheckBox, gpanoIHFOVDtextFieldCheckBox, gpanoOverwriteOriginalscheckBox}; } private JTextField[] getLensFields() { return new JTextField[] {lensmaketextField, lensmodeltextField, lensserialnumbertextField, focallengthtextField, focallengthIn35mmformattextField, fnumbertextField, maxaperturevaluetextField, focusdistancetextField, lensidtextField, conversionlenstextField, lenstypetextField, lensfirmwareversiontextField}; } private JCheckBox[] getLensCheckBoxes() { return new JCheckBox[] {lensmakecheckBox, lensmodelcheckBox, lensserialnumbercheckBox, focallengthcheckBox, focallengthIn35mmformatcheckBox, fnumbercheckBox, maxaperturevaluecheckBox, focusdistancecheckBox, lensidcheckBox, conversionlenscheckBox, lenstypecheckBox, lensfirmwareversioncheckBox, meteringmodecheckBox, lensOverwriteOriginalscheckBox}; } private JTextField[] getstringPlusFields() { return new JTextField[] {StringsKeywordstextField, StringsSubjecttextField, StringsPIItextField}; } /*private JCheckBox[] getstringPlusBoxes() { return new JCheckBox[] {StringsKeywordsXmpcheckBox, StringsKeywordsIPTCcheckBox, stringPlusOverwriteOriginalscheckBox}; }*/ private String getStringPlusRadioButtons(JRadioButton Overwrite, JRadioButton Append, JRadioButton Remove, JRadioButton DontSave) { if (Overwrite.isSelected()) { return "="; } if (Append.isSelected()) { return "+="; } if (Remove.isSelected()) { return "-="; } if (DontSave.isSelected()) { return ""; // } else { // Just to finish this method correctly // return ""; } // Will not be reached, but we need a correct method return ""; } // private String getSeparatorString(JRadioButton radioButtonComma, JRadioButton radioButtonColon, JRadioButton radioButtonSemiColon, JRadioButton radioButtonHash, JRadioButton radioButtonOther, JTextField textFieldOtherSeparator) { private String getSeparatorString() { if (radioButtonComma.isSelected()) { return ","; } if (radioButtonColon.isSelected()) { return ":"; } if (radioButtonSemiColon.isSelected()) { return ";"; } if (radioButtonHash.isSelected()) { return "#"; } if (radioButtonOther.isSelected()) { if ( (textFieldOtherSeparator.getText() == null) || ("".equals(textFieldOtherSeparator.getText())) ) { return ","; } else { return (textFieldOtherSeparator.getText()).trim(); } } //Should never be reached but we need a default return ","; } private String[] getSelectedRadioButtons() { return new String[]{ getStringPlusRadioButtons(StringsKeywOverwriteradioButton, StringsKeywAppendradioButton, StringsKeywRemoveradioButton, StringsKeywDontSaveradioButton), getStringPlusRadioButtons(StringsSubjectOverwriteradioButton, StringsSubjectAppendradioButton, StringsSubjectRemoveradioButton, StringsSubjectDontSaveradioButton), getStringPlusRadioButtons(StringsIIPOverwriteradioButton, StringsIIPAppendradioButton, StringsIIPRemoveradioButton, StringsIIPDontSaveradioButton) }; } private JCheckBox[] getCopyMetaDatacheckboxes() { return new JCheckBox[] {CopyExifcheckBox, CopyXmpcheckBox, CopyIptccheckBox, CopyIcc_profileDataCheckBox, CopyGpsCheckBox, CopyJfifcheckBox, CopyMakernotescheckBox}; } private JRadioButton[] getGeneralExportRadiobuttons() { return new JRadioButton[] {catmetadataradioButton, exportFromUserCombisradioButton, txtRadioButton, tabRadioButton, xmlRadioButton, htmlRadioButton, csvRadioButton}; } private JCheckBox[] getGeneralExportCheckButtons() { return new JCheckBox[] {exportAllMetadataCheckBox, exportExifDataCheckBox, exportXmpDataCheckBox, exportGpsDataCheckBox, exportIptcDataCheckBox, exportICCDataCheckBox, GenExpuseMetadataTagLanguageCheckBoxport}; } private JRadioButton[] getPDFradiobuttons() { return new JRadioButton[] {A4radioButton, LetterradioButton, ImgSizeLargeradioButton, ImgSizeSmallradioButton, pdfPerImgradioButton, pdfCombinedradioButton, pdfradioButtonExpAll, pdfradioButtonExpCommonTags, pdfradioButtonExpByTagName}; } private JComboBox[] getPDFcomboboxes() { return new JComboBox[] {pdfcomboBoxExpCommonTags, pdfcomboBoxExpByTagName}; } private JRadioButton[] getSCradiobuttons() { return new JRadioButton[] {exifSCradioButton, xmpSCradioButton, mieSCradioButton, exvSCradioButton}; } private void fillAllComboboxes() { //Combobox on User combi edit tab; do as first as we need it again MetadataUserCombinations MUC = new MetadataUserCombinations(); String[] views = MUC.loadCustomSets("fill_combo"); // use setter to be later use it for common tags in Utils.getWhichCommonTagSelected MyVariables.setCustomCombis(views); UserCombiscomboBox.setModel(new DefaultComboBoxModel(views)); exportUserCombicomboBox.setModel(new DefaultComboBoxModel(views)); exportUserCombicomboBox.setEnabled(false); // Fill all combo boxes in the View panel String TagNames = StandardFileIO.readTextFileAsStringFromResource("texts/CommonTags.txt"); String[] Tags = TagNames.split("\\r?\\n"); // split on new lines // Now combine Tags[] and above views[] into one array int length1 = Tags.length; int length2 = views.length; String[] allTags = new String[length1 + length2]; //Using arraycopy method to merge two arrays System.arraycopy(Tags, 0, allTags, 0, length1); System.arraycopy(views, 0, allTags, length1, length2); Arrays.sort(allTags); comboBoxViewCommonTags.setModel(new DefaultComboBoxModel(allTags)); pdfcomboBoxExpCommonTags.setModel(new DefaultComboBoxModel(allTags)); String TagGroups = StandardFileIO.readTextFileAsStringFromResource("texts/g1.txt"); Tags = TagGroups.split("\\r?\\n"); // split on new lines comboBoxViewByTagName.setModel(new DefaultComboBoxModel(Tags)); //comboBoxQueryByTagName.setModel(new DefaultComboBoxModel(Tags)); pdfcomboBoxExpByTagName.setModel(new DefaultComboBoxModel(Tags)); TagNames = StandardFileIO.readTextFileAsStringFromResource("texts/CameraTagNames.txt"); Tags = TagNames.split("\\r?\\n"); // split on new lines comboBoxViewCameraMake.setModel(new DefaultComboBoxModel(Tags)); // fill combobox in Lens panel TagNames = StandardFileIO.readTextFileAsStringFromResource("texts/lensmeteringmodes.txt"); Tags = TagNames.split("\\r?\\n"); // split on new lines meteringmodecomboBox.setModel(new DefaultComboBoxModel(Tags)); //Combobox on Gpano edit tab for (String item : MyConstants.GPANO_PROJECTIONS) { gpanoPTcomboBox.addItem(item); } } // region IntelliJ GUI Code Generated /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { rootPanel = new JPanel(); rootPanel.setLayout(new GridLayoutManager(2, 3, new Insets(10, 10, 10, 10), -1, -1)); rootPanel.setMinimumSize(new Dimension(1100, 720)); rootPanel.setPreferredSize(new Dimension(1350, 880)); rootPanel.setRequestFocusEnabled(true); bottomPanel = new JPanel(); bottomPanel.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, 0)); rootPanel.add(bottomPanel, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, new Dimension(-1, 32), new Dimension(-1, 32), null, 1, false)); final JPanel panel1 = new JPanel(); panel1.setLayout(new FlowLayout(FlowLayout.LEFT, 15, 5)); bottomPanel.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 2, false)); final JLabel label1 = new JLabel(); this.$$$loadLabelText$$$(label1, this.$$$getMessageFromBundle$$$("translations/program_strings", "pt.filesloaded")); panel1.add(label1); lblLoadedFiles = new JLabel(); lblLoadedFiles.setText(""); panel1.add(lblLoadedFiles); final Spacer spacer1 = new Spacer(); panel1.add(spacer1); final JLabel label2 = new JLabel(); this.$$$loadLabelText$$$(label2, this.$$$getMessageFromBundle$$$("translations/program_strings", "pt.folder")); panel1.add(label2); lblImgSourceFolder = new JLabel(); lblImgSourceFolder.setText(""); panel1.add(lblImgSourceFolder); final JPanel panel2 = new JPanel(); panel2.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); bottomPanel.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, new Dimension(-1, 32), new Dimension(-1, 32), null, 1, false)); JLabelDropReady = new JLabel(); JLabelDropReady.setText(""); JLabelDropReady.setVisible(false); panel2.add(JLabelDropReady); OutputLabel = new JLabel(); OutputLabel.setText(""); panel2.add(OutputLabel); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setPreferredSize(new Dimension(100, 15)); progressBar.setStringPainted(false); panel2.add(progressBar); splitPanel = new JSplitPane(); splitPanel.setDividerLocation(360); rootPanel.add(splitPanel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); LeftPanel = new JPanel(); LeftPanel.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1)); LeftPanel.setPreferredSize(new Dimension(500, -1)); splitPanel.setLeftComponent(LeftPanel); LeftbuttonBar = new JPanel(); LeftbuttonBar.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); LeftPanel.add(LeftbuttonBar, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonLoadDirectory = new JButton(); buttonLoadDirectory.setIcon(new ImageIcon(getClass().getResource("/icons/outline_folder_black_36dp.png"))); buttonLoadDirectory.setIconTextGap(2); buttonLoadDirectory.setMaximumSize(new Dimension(38, 38)); buttonLoadDirectory.setMinimumSize(new Dimension(38, 38)); buttonLoadDirectory.setPreferredSize(new Dimension(38, 38)); buttonLoadDirectory.setText(""); buttonLoadDirectory.setToolTipText(this.$$$getMessageFromBundle$$$("translations/program_strings", "btn.loaddirectory")); LeftbuttonBar.add(buttonLoadDirectory); buttonLoadImages = new JButton(); buttonLoadImages.setIcon(new ImageIcon(getClass().getResource("/icons/outline_collections_black_36dp.png"))); buttonLoadImages.setIconTextGap(2); buttonLoadImages.setMaximumSize(new Dimension(38, 38)); buttonLoadImages.setMinimumSize(new Dimension(38, 38)); buttonLoadImages.setPreferredSize(new Dimension(38, 38)); buttonLoadImages.setText(""); buttonLoadImages.setToolTipText(this.$$$getMessageFromBundle$$$("translations/program_strings", "btn.loadimages")); LeftbuttonBar.add(buttonLoadImages); buttonShowImage = new JButton(); buttonShowImage.setEnabled(false); buttonShowImage.setIcon(new ImageIcon(getClass().getResource("/icons/outline_image_black_36dp.png"))); buttonShowImage.setIconTextGap(2); buttonShowImage.setMaximumSize(new Dimension(38, 38)); buttonShowImage.setMinimumSize(new Dimension(38, 38)); buttonShowImage.setPreferredSize(new Dimension(38, 38)); buttonShowImage.setText(""); buttonShowImage.setToolTipText(this.$$$getMessageFromBundle$$$("translations/program_strings", "btn.displayimages")); buttonShowImage.putClientProperty("hideActionText", Boolean.FALSE); LeftbuttonBar.add(buttonShowImage); buttonCompare = new JButton(); buttonCompare.setEnabled(false); buttonCompare.setFocusTraversalPolicyProvider(true); buttonCompare.setIcon(new ImageIcon(getClass().getResource("/icons/outline_compare_arrows_black_36dp.png"))); buttonCompare.setIconTextGap(2); buttonCompare.setMaximumSize(new Dimension(38, 38)); buttonCompare.setMinimumSize(new Dimension(38, 38)); buttonCompare.setPreferredSize(new Dimension(38, 38)); buttonCompare.setText(""); buttonCompare.setToolTipText(this.$$$getMessageFromBundle$$$("translations/program_strings", "btn.compareimgs")); buttonCompare.setVisible(true); LeftbuttonBar.add(buttonCompare); buttonSlideshow = new JButton(); buttonSlideshow.setEnabled(false); buttonSlideshow.setIcon(new ImageIcon(getClass().getResource("/icons/outline_slideshow_black_36dp.png"))); buttonSlideshow.setIconTextGap(2); buttonSlideshow.setMaximumSize(new Dimension(38, 38)); buttonSlideshow.setMinimumSize(new Dimension(38, 38)); buttonSlideshow.setPreferredSize(new Dimension(38, 38)); buttonSlideshow.setText(""); buttonSlideshow.setToolTipText(this.$$$getMessageFromBundle$$$("translations/program_strings", "btn.slideshow")); buttonSlideshow.setVisible(false); LeftbuttonBar.add(buttonSlideshow); buttonSearchMetadata = new JButton(); buttonSearchMetadata.setEnabled(false); buttonSearchMetadata.setIcon(new ImageIcon(getClass().getResource("/icons/outline_search_black_36dp.png"))); buttonSearchMetadata.setMaximumSize(new Dimension(38, 38)); buttonSearchMetadata.setMinimumSize(new Dimension(38, 38)); buttonSearchMetadata.setPreferredSize(new Dimension(38, 38)); buttonSearchMetadata.setText(""); LeftbuttonBar.add(buttonSearchMetadata); LeftTableScrollPanel = new JScrollPane(); LeftTableScrollPanel.setVisible(false); LeftPanel.add(LeftTableScrollPanel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); tableListfiles = new JTable(); tableListfiles.setAutoResizeMode(4); tableListfiles.setPreferredScrollableViewportSize(new Dimension(-1, -1)); tableListfiles.setShowHorizontalLines(true); tableListfiles.setShowVerticalLines(false); tableListfiles.setToolTipText(this.$$$getMessageFromBundle$$$("translations/program_strings", "lp.tooltip")); LeftTableScrollPanel.setViewportView(tableListfiles); LeftCheckboxBar = new JPanel(); LeftCheckboxBar.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); LeftPanel.add(LeftCheckboxBar, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); createPreviewsCheckBox = new JCheckBox(); createPreviewsCheckBox.setSelected(true); this.$$$loadButtonText$$$(createPreviewsCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "lp.crpreview")); LeftCheckboxBar.add(createPreviewsCheckBox); loadMetadataCheckBox = new JCheckBox(); loadMetadataCheckBox.setEnabled(true); loadMetadataCheckBox.setSelected(false); this.$$$loadButtonText$$$(loadMetadataCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "lp.loadmetadata")); loadMetadataCheckBox.setVisible(false); LeftCheckboxBar.add(loadMetadataCheckBox); leftCheckBoxBarHelpButton = new JButton(); leftCheckBoxBarHelpButton.setIcon(new ImageIcon(getClass().getResource("/icons/outline_info_black_24dp.png"))); leftCheckBoxBarHelpButton.setLabel(""); leftCheckBoxBarHelpButton.setMaximumSize(new Dimension(26, 26)); leftCheckBoxBarHelpButton.setMinimumSize(new Dimension(26, 26)); leftCheckBoxBarHelpButton.setPreferredSize(new Dimension(26, 26)); leftCheckBoxBarHelpButton.setText(""); leftCheckBoxBarHelpButton.setVisible(false); LeftCheckboxBar.add(leftCheckBoxBarHelpButton); previewTable = new JTable(); previewTable.setShowHorizontalLines(false); previewTable.setShowVerticalLines(false); previewTable.setUpdateSelectionOnSort(false); previewTable.setVisible(false); LeftPanel.add(previewTable, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_SOUTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(-1, 160), null, 0, false)); LeftGridScrollPanel = new JScrollPane(); LeftGridScrollPanel.setVerticalScrollBarPolicy(22); LeftPanel.add(LeftGridScrollPanel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); iconViewList = new JList(); LeftGridScrollPanel.setViewportView(iconViewList); tabbedPaneRight = new JTabbedPane(); splitPanel.setRightComponent(tabbedPaneRight); ViewDatapanel = new JPanel(); ViewDatapanel.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1)); ViewDatapanel.setMinimumSize(new Dimension(-1, -1)); ViewDatapanel.setPreferredSize(new Dimension(-1, -1)); tabbedPaneRight.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "maintab.viewdata"), ViewDatapanel); ViewRadiobuttonpanel = new JPanel(); ViewRadiobuttonpanel.setLayout(new FlowLayout(FlowLayout.CENTER, 3, 5)); ViewDatapanel.add(ViewRadiobuttonpanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); radioButtonViewAll = new JRadioButton(); radioButtonViewAll.setSelected(true); this.$$$loadButtonText$$$(radioButtonViewAll, this.$$$getMessageFromBundle$$$("translations/program_strings", "vdtab.allradiobutton")); ViewRadiobuttonpanel.add(radioButtonViewAll); radioButtoncommonTags = new JRadioButton(); this.$$$loadButtonText$$$(radioButtoncommonTags, this.$$$getMessageFromBundle$$$("translations/program_strings", "vdtab.commontags")); ViewRadiobuttonpanel.add(radioButtoncommonTags); comboBoxViewCommonTags = new JComboBox(); ViewRadiobuttonpanel.add(comboBoxViewCommonTags); radioButtonByTagName = new JRadioButton(); this.$$$loadButtonText$$$(radioButtonByTagName, this.$$$getMessageFromBundle$$$("translations/program_strings", "vdtab.bygroup")); ViewRadiobuttonpanel.add(radioButtonByTagName); comboBoxViewByTagName = new JComboBox(); ViewRadiobuttonpanel.add(comboBoxViewByTagName); radioButtonCameraMakes = new JRadioButton(); radioButtonCameraMakes.setLabel("By Camera"); this.$$$loadButtonText$$$(radioButtonCameraMakes, this.$$$getMessageFromBundle$$$("translations/program_strings", "vdtab.bycamera")); ViewRadiobuttonpanel.add(radioButtonCameraMakes); comboBoxViewCameraMake = new JComboBox(); ViewRadiobuttonpanel.add(comboBoxViewCameraMake); ViewDatascrollpanel = new JScrollPane(); ViewDatapanel.add(ViewDatascrollpanel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); ListexiftoolInfotable = new JTable(); ListexiftoolInfotable.setAutoResizeMode(0); ViewDatascrollpanel.setViewportView(ListexiftoolInfotable); lblFileNamePath = new JLabel(); Font lblFileNamePathFont = this.$$$getFont$$$(null, Font.BOLD | Font.ITALIC, -1, lblFileNamePath.getFont()); if (lblFileNamePathFont != null) lblFileNamePath.setFont(lblFileNamePathFont); lblFileNamePath.setText(""); ViewDatapanel.add(lblFileNamePath, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); tabbedPaneRight.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "maintab.editdata"), panel3); tabbedPaneEditfunctions = new JTabbedPane(); panel3.add(tabbedPaneEditfunctions, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, 200), null, 0, false)); ExifEditpanel = new JPanel(); ExifEditpanel.setLayout(new GridLayoutManager(14, 4, new Insets(0, 20, 0, 20), -1, -1)); ExifEditpanel.setMinimumSize(new Dimension(750, 511)); ExifEditpanel.setPreferredSize(new Dimension(800, 575)); tabbedPaneEditfunctions.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "ed.exiftab"), ExifEditpanel); final JPanel panel4 = new JPanel(); panel4.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); ExifEditpanel.add(panel4, new GridConstraints(12, 0, 1, 4, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifcopyFromButton = new JButton(); this.$$$loadButtonText$$$(ExifcopyFromButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.copyfrom")); panel4.add(ExifcopyFromButton); ExifsaveToButton = new JButton(); this.$$$loadButtonText$$$(ExifsaveToButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.saveto")); panel4.add(ExifsaveToButton); ExifBackupOriginalscheckBox = new JCheckBox(); this.$$$loadButtonText$$$(ExifBackupOriginalscheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "chkbox.makebackup")); panel4.add(ExifBackupOriginalscheckBox); final JPanel panel5 = new JPanel(); panel5.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); ExifEditpanel.add(panel5, new GridConstraints(13, 0, 1, 4, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifcopyDefaultsButton = new JButton(); this.$$$loadButtonText$$$(ExifcopyDefaultsButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.copydefaults")); panel5.add(ExifcopyDefaultsButton); resetFieldsButton = new JButton(); this.$$$loadButtonText$$$(resetFieldsButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.resetfields")); panel5.add(resetFieldsButton); ExifhelpButton = new JButton(); this.$$$loadButtonText$$$(ExifhelpButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); panel5.add(ExifhelpButton); final JLabel label3 = new JLabel(); Font label3Font = this.$$$getFont$$$(null, Font.BOLD, -1, label3.getFont()); if (label3Font != null) label3.setFont(label3Font); label3.setPreferredSize(new Dimension(650, 18)); this.$$$loadLabelText$$$(label3, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.cameraequip")); ExifEditpanel.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label4 = new JLabel(); label4.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label4, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.make")); ExifEditpanel.add(label4, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifMaketextField = new JTextField(); ExifMaketextField.setPreferredSize(new Dimension(500, 25)); ExifEditpanel.add(ExifMaketextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifMakecheckBox = new JCheckBox(); ExifMakecheckBox.setSelected(true); ExifMakecheckBox.setText(""); ExifEditpanel.add(ExifMakecheckBox, new GridConstraints(1, 2, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label5 = new JLabel(); label5.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label5, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.model")); ExifEditpanel.add(label5, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifModeltextField = new JTextField(); ExifModeltextField.setPreferredSize(new Dimension(500, 25)); ExifEditpanel.add(ExifModeltextField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifModelcheckBox = new JCheckBox(); ExifModelcheckBox.setSelected(true); ExifModelcheckBox.setText(""); ExifEditpanel.add(ExifModelcheckBox, new GridConstraints(2, 2, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label6 = new JLabel(); Font label6Font = this.$$$getFont$$$(null, Font.BOLD, -1, label6.getFont()); if (label6Font != null) label6.setFont(label6Font); this.$$$loadLabelText$$$(label6, this.$$$getMessageFromBundle$$$("translations/program_strings", "label.save")); ExifEditpanel.add(label6, new GridConstraints(0, 2, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label7 = new JLabel(); Font label7Font = this.$$$getFont$$$(null, Font.BOLD, -1, label7.getFont()); if (label7Font != null) label7.setFont(label7Font); label7.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label7, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.datetime")); ExifEditpanel.add(label7, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label8 = new JLabel(); label8.setPreferredSize(new Dimension(500, 18)); this.$$$loadLabelText$$$(label8, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.dtformat")); ExifEditpanel.add(label8, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label9 = new JLabel(); label9.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label9, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.modifydate")); ExifEditpanel.add(label9, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifModifyDatetextField = new JTextField(); ExifModifyDatetextField.setPreferredSize(new Dimension(500, 25)); ExifEditpanel.add(ExifModifyDatetextField, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifModifyDatecheckBox = new JCheckBox(); ExifModifyDatecheckBox.setSelected(true); ExifModifyDatecheckBox.setText(""); ExifEditpanel.add(ExifModifyDatecheckBox, new GridConstraints(4, 2, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label10 = new JLabel(); label10.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label10, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.datetimeoriginal")); ExifEditpanel.add(label10, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifDateTimeOriginaltextField = new JTextField(); ExifDateTimeOriginaltextField.setPreferredSize(new Dimension(500, 25)); ExifEditpanel.add(ExifDateTimeOriginaltextField, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifDateTimeOriginalcheckBox = new JCheckBox(); ExifDateTimeOriginalcheckBox.setSelected(true); ExifDateTimeOriginalcheckBox.setText(""); ExifEditpanel.add(ExifDateTimeOriginalcheckBox, new GridConstraints(5, 2, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label11 = new JLabel(); label11.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label11, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.createdate")); ExifEditpanel.add(label11, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifCreateDatetextField = new JTextField(); ExifCreateDatetextField.setPreferredSize(new Dimension(500, 25)); ExifEditpanel.add(ExifCreateDatetextField, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifCreateDatecheckBox = new JCheckBox(); ExifCreateDatecheckBox.setSelected(true); ExifCreateDatecheckBox.setText(""); ExifEditpanel.add(ExifCreateDatecheckBox, new GridConstraints(6, 2, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label12 = new JLabel(); Font label12Font = this.$$$getFont$$$(null, Font.BOLD, -1, label12.getFont()); if (label12Font != null) label12.setFont(label12Font); this.$$$loadLabelText$$$(label12, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.creatags")); ExifEditpanel.add(label12, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label13 = new JLabel(); label13.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label13, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.artist")); ExifEditpanel.add(label13, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifArtistCreatortextField = new JTextField(); ExifArtistCreatortextField.setPreferredSize(new Dimension(500, 25)); ExifEditpanel.add(ExifArtistCreatortextField, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifArtistCreatorcheckBox = new JCheckBox(); ExifArtistCreatorcheckBox.setSelected(true); ExifArtistCreatorcheckBox.setText(""); ExifEditpanel.add(ExifArtistCreatorcheckBox, new GridConstraints(8, 2, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label14 = new JLabel(); label14.setMaximumSize(new Dimension(250, 18)); label14.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label14, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.copyright")); ExifEditpanel.add(label14, new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifCopyrighttextField = new JTextField(); ExifCopyrighttextField.setPreferredSize(new Dimension(500, 25)); ExifEditpanel.add(ExifCopyrighttextField, new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifCopyrightcheckBox = new JCheckBox(); ExifCopyrightcheckBox.setSelected(true); ExifCopyrightcheckBox.setText(""); ExifEditpanel.add(ExifCopyrightcheckBox, new GridConstraints(9, 2, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label15 = new JLabel(); label15.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label15, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.usercomm")); ExifEditpanel.add(label15, new GridConstraints(10, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifUsercommenttextField = new JTextField(); ExifUsercommenttextField.setPreferredSize(new Dimension(500, 25)); ExifEditpanel.add(ExifUsercommenttextField, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifUsercommentcheckBox = new JCheckBox(); ExifUsercommentcheckBox.setSelected(true); ExifUsercommentcheckBox.setText(""); ExifEditpanel.add(ExifUsercommentcheckBox, new GridConstraints(10, 2, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label16 = new JLabel(); label16.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label16, this.$$$getMessageFromBundle$$$("translations/program_strings", "exif.description")); ExifEditpanel.add(label16, new GridConstraints(11, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifDescriptiontextArea = new JTextArea(); ExifDescriptiontextArea.setPreferredSize(new Dimension(500, 80)); ExifDescriptiontextArea.setWrapStyleWord(true); ExifEditpanel.add(ExifDescriptiontextArea, new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExifDescriptioncheckBox = new JCheckBox(); ExifDescriptioncheckBox.setSelected(true); ExifDescriptioncheckBox.setText(""); ExifEditpanel.add(ExifDescriptioncheckBox, new GridConstraints(11, 2, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel6 = new JPanel(); panel6.setLayout(new GridLayoutManager(13, 3, new Insets(10, 20, 10, 20), -1, -1)); panel6.setMinimumSize(new Dimension(750, 464)); panel6.setPreferredSize(new Dimension(800, 575)); tabbedPaneEditfunctions.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "ed.xmptab"), panel6); final JLabel label17 = new JLabel(); label17.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label17, this.$$$getMessageFromBundle$$$("translations/program_strings", "xmp.creator")); panel6.add(label17, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpCreatortextField = new JTextField(); xmpCreatortextField.setPreferredSize(new Dimension(500, 25)); xmpCreatortextField.setText(""); panel6.add(xmpCreatortextField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpCreatorcheckBox = new JCheckBox(); xmpCreatorcheckBox.setSelected(true); xmpCreatorcheckBox.setText(""); panel6.add(xmpCreatorcheckBox, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label18 = new JLabel(); label18.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label18, this.$$$getMessageFromBundle$$$("translations/program_strings", "xmp.rights")); panel6.add(label18, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpRightstextField = new JTextField(); xmpRightstextField.setPreferredSize(new Dimension(500, 25)); panel6.add(xmpRightstextField, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpRightscheckBox = new JCheckBox(); xmpRightscheckBox.setSelected(true); xmpRightscheckBox.setText(""); panel6.add(xmpRightscheckBox, new GridConstraints(4, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label19 = new JLabel(); label19.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label19, this.$$$getMessageFromBundle$$$("translations/program_strings", "xmp.description")); panel6.add(label19, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpDescriptiontextArea = new JTextArea(); xmpDescriptiontextArea.setPreferredSize(new Dimension(500, 80)); xmpDescriptiontextArea.setWrapStyleWord(true); panel6.add(xmpDescriptiontextArea, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpDescriptioncheckBox = new JCheckBox(); xmpDescriptioncheckBox.setSelected(true); xmpDescriptioncheckBox.setText(""); panel6.add(xmpDescriptioncheckBox, new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label20 = new JLabel(); Font label20Font = this.$$$getFont$$$(null, Font.BOLD, -1, label20.getFont()); if (label20Font != null) label20.setFont(label20Font); this.$$$loadLabelText$$$(label20, this.$$$getMessageFromBundle$$$("translations/program_strings", "label.save")); panel6.add(label20, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label21 = new JLabel(); label21.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label21, this.$$$getMessageFromBundle$$$("translations/program_strings", "xmp.label")); panel6.add(label21, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpLabeltextField = new JTextField(); xmpLabeltextField.setPreferredSize(new Dimension(500, 25)); panel6.add(xmpLabeltextField, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpLabelcheckBox = new JCheckBox(); xmpLabelcheckBox.setSelected(true); xmpLabelcheckBox.setText(""); panel6.add(xmpLabelcheckBox, new GridConstraints(6, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label22 = new JLabel(); label22.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label22, this.$$$getMessageFromBundle$$$("translations/program_strings", "xmp.subject")); panel6.add(label22, new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpSubjecttextField = new JTextField(); xmpSubjecttextField.setPreferredSize(new Dimension(500, 25)); panel6.add(xmpSubjecttextField, new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpSubjectcheckBox = new JCheckBox(); xmpSubjectcheckBox.setSelected(true); xmpSubjectcheckBox.setText(""); panel6.add(xmpSubjectcheckBox, new GridConstraints(9, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label23 = new JLabel(); label23.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label23, this.$$$getMessageFromBundle$$$("translations/program_strings", "xmp.pim")); panel6.add(label23, new GridConstraints(10, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpPersontextField = new JTextField(); xmpPersontextField.setPreferredSize(new Dimension(500, 25)); panel6.add(xmpPersontextField, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpPersoncheckBox = new JCheckBox(); xmpPersoncheckBox.setSelected(true); xmpPersoncheckBox.setText(""); panel6.add(xmpPersoncheckBox, new GridConstraints(10, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel7 = new JPanel(); panel7.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel6.add(panel7, new GridConstraints(11, 0, 1, 3, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpCopyFrombutton = new JButton(); this.$$$loadButtonText$$$(xmpCopyFrombutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.copyfrom")); panel7.add(xmpCopyFrombutton); xmpSaveTobutton = new JButton(); this.$$$loadButtonText$$$(xmpSaveTobutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.saveto")); panel7.add(xmpSaveTobutton); xmpBackupOriginalscheckBox = new JCheckBox(); this.$$$loadButtonText$$$(xmpBackupOriginalscheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "chkbox.makebackup")); panel7.add(xmpBackupOriginalscheckBox); final JPanel panel8 = new JPanel(); panel8.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel6.add(panel8, new GridConstraints(12, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpCopyDefaultsbutton = new JButton(); this.$$$loadButtonText$$$(xmpCopyDefaultsbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.copydefaults")); panel8.add(xmpCopyDefaultsbutton); xmpResetFieldsbutton = new JButton(); this.$$$loadButtonText$$$(xmpResetFieldsbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.resetfields")); panel8.add(xmpResetFieldsbutton); xmpHelpbutton = new JButton(); this.$$$loadButtonText$$$(xmpHelpbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); panel8.add(xmpHelpbutton); final JLabel label24 = new JLabel(); this.$$$loadLabelText$$$(label24, this.$$$getMessageFromBundle$$$("translations/program_strings", "xmp.credline")); panel6.add(label24, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(150, 18), null, 0, false)); xmpCredittextField = new JTextField(); panel6.add(xmpCredittextField, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(500, 25), null, 0, false)); xmpCreditcheckBox = new JCheckBox(); xmpCreditcheckBox.setSelected(true); xmpCreditcheckBox.setText(""); panel6.add(xmpCreditcheckBox, new GridConstraints(3, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpTopText = new JLabel(); xmpTopText.setText("xmpTopText"); panel6.add(xmpTopText, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(500, 18), null, 0, false)); final JLabel label25 = new JLabel(); label25.setPreferredSize(new Dimension(150, 18)); this.$$$loadLabelText$$$(label25, this.$$$getMessageFromBundle$$$("translations/program_strings", "xmp.title")); panel6.add(label25, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpTitletextField = new JTextField(); xmpTitletextField.setPreferredSize(new Dimension(500, 25)); panel6.add(xmpTitletextField, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpTitlecheckBox = new JCheckBox(); xmpTitlecheckBox.setSelected(true); xmpTitlecheckBox.setText(""); panel6.add(xmpTitlecheckBox, new GridConstraints(7, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label26 = new JLabel(); this.$$$loadLabelText$$$(label26, this.$$$getMessageFromBundle$$$("translations/program_strings", "xmp.keywords")); panel6.add(label26, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpKeywordstextField = new JTextField(); xmpKeywordstextField.setPreferredSize(new Dimension(500, 25)); panel6.add(xmpKeywordstextField, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); xmpKeywordscheckBox = new JCheckBox(); xmpKeywordscheckBox.setSelected(true); xmpKeywordscheckBox.setText(""); panel6.add(xmpKeywordscheckBox, new GridConstraints(8, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel9 = new JPanel(); panel9.setLayout(new GridLayoutManager(7, 1, new Insets(5, 5, 5, 10), -1, -1)); panel9.setMinimumSize(new Dimension(750, 500)); panel9.setPreferredSize(new Dimension(800, 550)); tabbedPaneEditfunctions.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "ed.gpstab"), panel9); gpsLocationPanel = new JPanel(); gpsLocationPanel.setLayout(new GridLayoutManager(7, 3, new Insets(5, 5, 5, 5), -1, -1)); panel9.add(gpsLocationPanel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); gpsLocationPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label27 = new JLabel(); Font label27Font = this.$$$getFont$$$(null, Font.BOLD, -1, label27.getFont()); if (label27Font != null) label27.setFont(label27Font); this.$$$loadLabelText$$$(label27, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.xmpiptcloc")); gpsLocationPanel.add(label27, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label28 = new JLabel(); this.$$$loadLabelText$$$(label28, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.whereis")); gpsLocationPanel.add(label28, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label29 = new JLabel(); Font label29Font = this.$$$getFont$$$(null, Font.BOLD, -1, label29.getFont()); if (label29Font != null) label29.setFont(label29Font); this.$$$loadLabelText$$$(label29, this.$$$getMessageFromBundle$$$("translations/program_strings", "label.save")); gpsLocationPanel.add(label29, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label30 = new JLabel(); label30.setPreferredSize(new Dimension(75, 18)); this.$$$loadLabelText$$$(label30, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.location")); gpsLocationPanel.add(label30, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); gpsLocationtextField = new JTextField(); gpsLocationtextField.setPreferredSize(new Dimension(300, 30)); gpsLocationPanel.add(gpsLocationtextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(450, 25), null, 0, false)); gpsLocationcheckBox = new JCheckBox(); gpsLocationcheckBox.setSelected(true); gpsLocationcheckBox.setText(""); gpsLocationPanel.add(gpsLocationcheckBox, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label31 = new JLabel(); this.$$$loadLabelText$$$(label31, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.country")); gpsLocationPanel.add(label31, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); gpsCountrytextField = new JTextField(); gpsLocationPanel.add(gpsCountrytextField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(450, 25), null, 0, false)); gpsCountrycheckBox = new JCheckBox(); gpsCountrycheckBox.setSelected(true); gpsCountrycheckBox.setText(""); gpsLocationPanel.add(gpsCountrycheckBox, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label32 = new JLabel(); this.$$$loadLabelText$$$(label32, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.statprov")); gpsLocationPanel.add(label32, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); gpsStateProvincetextField = new JTextField(); gpsStateProvincetextField.setText(""); gpsLocationPanel.add(gpsStateProvincetextField, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(450, 25), null, 0, false)); gpsStateProvincecheckBox = new JCheckBox(); gpsStateProvincecheckBox.setSelected(true); gpsStateProvincecheckBox.setText(""); gpsLocationPanel.add(gpsStateProvincecheckBox, new GridConstraints(3, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label33 = new JLabel(); this.$$$loadLabelText$$$(label33, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.city")); gpsLocationPanel.add(label33, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); gpsCitytextField = new JTextField(); gpsLocationPanel.add(gpsCitytextField, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(450, 25), null, 0, false)); gpsCitycheckBox = new JCheckBox(); gpsCitycheckBox.setSelected(true); gpsCitycheckBox.setText(""); gpsLocationPanel.add(gpsCitycheckBox, new GridConstraints(4, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); gpsMinErrorcheckBox = new JCheckBox(); gpsMinErrorcheckBox.setSelected(true); this.$$$loadButtonText$$$(gpsMinErrorcheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.minorerror")); gpsLocationPanel.add(gpsMinErrorcheckBox, new GridConstraints(5, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); gpsmakernotescheckBox = new JCheckBox(); this.$$$loadButtonText$$$(gpsmakernotescheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.addtomakernotes")); gpsLocationPanel.add(gpsmakernotescheckBox, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); panel9.add(spacer2, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JPanel panel10 = new JPanel(); panel10.setLayout(new GridLayoutManager(3, 1, new Insets(5, 5, 5, 5), -1, -1)); panel9.add(panel10, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); gpsButtonPanel = new JPanel(); gpsButtonPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel10.add(gpsButtonPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); gpsCopyFrombutton = new JButton(); this.$$$loadButtonText$$$(gpsCopyFrombutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.copyfrom")); gpsButtonPanel.add(gpsCopyFrombutton); gpsSaveTobutton = new JButton(); this.$$$loadButtonText$$$(gpsSaveTobutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.saveto")); gpsButtonPanel.add(gpsSaveTobutton); gpsBackupOriginalscheckBox = new JCheckBox(); this.$$$loadButtonText$$$(gpsBackupOriginalscheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "chkbox.makebackup")); gpsButtonPanel.add(gpsBackupOriginalscheckBox); gpsButtonPanel2 = new JPanel(); gpsButtonPanel2.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel10.add(gpsButtonPanel2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); gpsResetFieldsbutton = new JButton(); this.$$$loadButtonText$$$(gpsResetFieldsbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.resetfields")); gpsButtonPanel2.add(gpsResetFieldsbutton); gpsMapcoordinatesbutton = new JButton(); this.$$$loadButtonText$$$(gpsMapcoordinatesbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.btnopenmapcoords")); gpsButtonPanel2.add(gpsMapcoordinatesbutton); gpsHelpbutton = new JButton(); this.$$$loadButtonText$$$(gpsHelpbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); gpsButtonPanel2.add(gpsHelpbutton); gpsButtonPanel3 = new JPanel(); gpsButtonPanel3.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel10.add(gpsButtonPanel3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); gpssearchLocationButton = new JButton(); this.$$$loadButtonText$$$(gpssearchLocationButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.searchbtn")); gpsButtonPanel3.add(gpssearchLocationButton); gpssearchLocationButtonCoordinates = new JButton(); this.$$$loadButtonText$$$(gpssearchLocationButtonCoordinates, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.searchbycoordsbtn")); gpsButtonPanel3.add(gpssearchLocationButtonCoordinates); geoformattabbedPane = new JTabbedPane(); panel9.add(geoformattabbedPane, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(600, 200), new Dimension(600, -1), 0, false)); final JPanel panel11 = new JPanel(); panel11.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); geoformattabbedPane.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.decdegrees"), panel11); gpsLatLonAltPanel = new JPanel(); gpsLatLonAltPanel.setLayout(new GridLayoutManager(5, 4, new Insets(5, 5, 5, 5), -1, -1)); panel11.add(gpsLatLonAltPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(550, -1), new Dimension(550, -1), 1, false)); final JLabel label34 = new JLabel(); this.$$$loadLabelText$$$(label34, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.gps")); gpsLatLonAltPanel.add(label34, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label35 = new JLabel(); this.$$$loadLabelText$$$(label35, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.decimal")); gpsLatLonAltPanel.add(label35, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label36 = new JLabel(); this.$$$loadLabelText$$$(label36, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.latitude")); gpsLatLonAltPanel.add(label36, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); gpsLatDecimaltextField = new JFormattedTextField(); gpsLatLonAltPanel.add(gpsLatDecimaltextField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, 25), null, 0, false)); final JLabel label37 = new JLabel(); this.$$$loadLabelText$$$(label37, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.altitude")); gpsLatLonAltPanel.add(label37, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label38 = new JLabel(); this.$$$loadLabelText$$$(label38, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.longitude")); gpsLatLonAltPanel.add(label38, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); gpsLonDecimaltextField = new JFormattedTextField(); gpsLatLonAltPanel.add(gpsLonDecimaltextField, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, 25), null, 0, false)); gpsAltDecimaltextField = new JFormattedTextField(); gpsLatLonAltPanel.add(gpsAltDecimaltextField, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, 25), null, 0, false)); gpsAboveSealevelcheckBox = new JCheckBox(); gpsAboveSealevelcheckBox.setSelected(true); this.$$$loadButtonText$$$(gpsAboveSealevelcheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.above")); gpsLatLonAltPanel.add(gpsAboveSealevelcheckBox, new GridConstraints(4, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), new Dimension(200, -1), 0, false)); final JLabel label39 = new JLabel(); label39.setText("dd.ddddddd"); gpsLatLonAltPanel.add(label39, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label40 = new JLabel(); label40.setText("ddd.ddddddd"); gpsLatLonAltPanel.add(label40, new GridConstraints(3, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label41 = new JLabel(); label41.setText("ddddd.dd"); gpsLatLonAltPanel.add(label41, new GridConstraints(4, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel12 = new JPanel(); panel12.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); geoformattabbedPane.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.dmsformat"), panel12); gpsCalculationPanel = new JPanel(); gpsCalculationPanel.setLayout(new GridLayoutManager(4, 8, new Insets(5, 5, 5, 5), -1, -1)); panel12.add(gpsCalculationPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); final JLabel label42 = new JLabel(); this.$$$loadLabelText$$$(label42, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.degrees")); gpsCalculationPanel.add(label42, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label43 = new JLabel(); this.$$$loadLabelText$$$(label43, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.minutes")); gpsCalculationPanel.add(label43, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label44 = new JLabel(); this.$$$loadLabelText$$$(label44, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.seconds")); gpsCalculationPanel.add(label44, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label45 = new JLabel(); this.$$$loadLabelText$$$(label45, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.latitude")); gpsCalculationPanel.add(label45, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CalcLatDegtextField = new JFormattedTextField(); gpsCalculationPanel.add(CalcLatDegtextField, new GridConstraints(1, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(40, 25), new Dimension(50, -1), 0, false)); CalcLatMintextField = new JFormattedTextField(); gpsCalculationPanel.add(CalcLatMintextField, new GridConstraints(1, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(40, 25), new Dimension(50, -1), 0, false)); CalcLatSectextField = new JFormattedTextField(); gpsCalculationPanel.add(CalcLatSectextField, new GridConstraints(1, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(40, 25), new Dimension(50, -1), 0, false)); final JLabel label46 = new JLabel(); this.$$$loadLabelText$$$(label46, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.longitude")); gpsCalculationPanel.add(label46, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CalcLonDegtextField = new JFormattedTextField(); gpsCalculationPanel.add(CalcLonDegtextField, new GridConstraints(2, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(40, 25), new Dimension(50, -1), 0, false)); CalcLonMintextField = new JFormattedTextField(); gpsCalculationPanel.add(CalcLonMintextField, new GridConstraints(2, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(40, 25), new Dimension(50, -1), 0, false)); CalcLonSectextField = new JFormattedTextField(); gpsCalculationPanel.add(CalcLonSectextField, new GridConstraints(2, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(30, 25), new Dimension(40, -1), 0, false)); CalcNorthRadioButton = new JRadioButton(); CalcNorthRadioButton.setSelected(true); this.$$$loadButtonText$$$(CalcNorthRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.n")); gpsCalculationPanel.add(CalcNorthRadioButton, new GridConstraints(1, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CalcSouthRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(CalcSouthRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.s")); gpsCalculationPanel.add(CalcSouthRadioButton, new GridConstraints(1, 7, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CalcEastradioButton = new JRadioButton(); CalcEastradioButton.setSelected(true); this.$$$loadButtonText$$$(CalcEastradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.e")); gpsCalculationPanel.add(CalcEastradioButton, new GridConstraints(2, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CalcWestRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(CalcWestRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.w")); gpsCalculationPanel.add(CalcWestRadioButton, new GridConstraints(2, 7, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); decimalToMinutesSecondsButton = new JButton(); decimalToMinutesSecondsButton.setEnabled(false); decimalToMinutesSecondsButton.setText("Decimal to minutes-seconds =>"); decimalToMinutesSecondsButton.setVisible(false); gpsCalculationPanel.add(decimalToMinutesSecondsButton, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); minutesSecondsToDecimalButton = new JButton(); minutesSecondsToDecimalButton.setEnabled(false); minutesSecondsToDecimalButton.setLabel("Convert to decimal degrees"); this.$$$loadButtonText$$$(minutesSecondsToDecimalButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.btnconvert")); minutesSecondsToDecimalButton.setVisible(false); gpsCalculationPanel.add(minutesSecondsToDecimalButton, new GridConstraints(3, 2, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); copyToInputFieldsButton = new JButton(); copyToInputFieldsButton.setEnabled(false); this.$$$loadButtonText$$$(copyToInputFieldsButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.btncopytoinp")); copyToInputFieldsButton.setVisible(false); gpsCalculationPanel.add(copyToInputFieldsButton, new GridConstraints(3, 5, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); SaveLatLonAltcheckBox = new JCheckBox(); SaveLatLonAltcheckBox.setSelected(true); this.$$$loadButtonText$$$(SaveLatLonAltcheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.savella")); panel9.add(SaveLatLonAltcheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lblNominatimSearch = new JLabel(); lblNominatimSearch.setText("gps.searchtxt text string"); panel9.add(lblNominatimSearch, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lblMapcoordinates = new JLabel(); lblMapcoordinates.setText("gps.extsearch translated strings"); panel9.add(lblMapcoordinates, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); GeotaggingEditpanel = new JPanel(); GeotaggingEditpanel.setLayout(new GridLayoutManager(8, 1, new Insets(10, 20, 10, 20), -1, -1)); GeotaggingEditpanel.setMinimumSize(new Dimension(750, 500)); GeotaggingEditpanel.setPreferredSize(new Dimension(800, 550)); tabbedPaneEditfunctions.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "ed.geotaggingtab"), GeotaggingEditpanel); final JPanel panel13 = new JPanel(); panel13.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 20, 0), -1, -1)); GeotaggingEditpanel.add(panel13, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label47 = new JLabel(); Font label47Font = this.$$$getFont$$$(null, Font.BOLD, -1, label47.getFont()); if (label47Font != null) label47.setFont(label47Font); this.$$$loadLabelText$$$(label47, this.$$$getMessageFromBundle$$$("translations/program_strings", "fld.imagefolder")); panel13.add(label47, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel14 = new JPanel(); panel14.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel13.add(panel14, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); geotaggingImgFoldertextField = new JTextField(); geotaggingImgFoldertextField.setPreferredSize(new Dimension(500, 25)); panel14.add(geotaggingImgFoldertextField); geotaggingImgFolderbutton = new JButton(); this.$$$loadButtonText$$$(geotaggingImgFolderbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.browse")); panel14.add(geotaggingImgFolderbutton); GeotaggingLeaveFolderEmptyLabel = new JLabel(); GeotaggingLeaveFolderEmptyLabel.setText(""); panel13.add(GeotaggingLeaveFolderEmptyLabel, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(650, -1), null, 0, false)); GeoTfolderBrowseLabel = new JLabel(); GeoTfolderBrowseLabel.setText("GeoTfolderBrowseLabel"); panel13.add(GeoTfolderBrowseLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel15 = new JPanel(); panel15.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); GeotaggingEditpanel.add(panel15, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label48 = new JLabel(); Font label48Font = this.$$$getFont$$$(null, Font.BOLD, -1, label48.getFont()); if (label48Font != null) label48.setFont(label48Font); this.$$$loadLabelText$$$(label48, this.$$$getMessageFromBundle$$$("translations/program_strings", "geo.gpslogfile")); panel15.add(label48, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel16 = new JPanel(); panel16.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel15.add(panel16, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); geotaggingGPSLogtextField = new JTextField(); geotaggingGPSLogtextField.setPreferredSize(new Dimension(500, 25)); panel16.add(geotaggingGPSLogtextField); geotaggingGPSLogbutton = new JButton(); this.$$$loadButtonText$$$(geotaggingGPSLogbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.browse")); panel16.add(geotaggingGPSLogbutton); final JPanel panel17 = new JPanel(); panel17.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); GeotaggingEditpanel.add(panel17, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label49 = new JLabel(); Font label49Font = this.$$$getFont$$$(null, Font.BOLD, -1, label49.getFont()); if (label49Font != null) label49.setFont(label49Font); this.$$$loadLabelText$$$(label49, this.$$$getMessageFromBundle$$$("translations/program_strings", "geo.geosynctime")); panel17.add(label49, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel18 = new JPanel(); panel18.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel17.add(panel18, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); geotaggingGeosynctextField = new JTextField(); geotaggingGeosynctextField.setPreferredSize(new Dimension(500, 25)); geotaggingGeosynctextField.setText("0000:00:00 00:00:00"); panel18.add(geotaggingGeosynctextField); final JLabel label50 = new JLabel(); this.$$$loadLabelText$$$(label50, this.$$$getMessageFromBundle$$$("translations/program_strings", "geo.dtformat")); panel18.add(label50); GeotaggingGeosyncExplainLabel = new JLabel(); this.$$$loadLabelText$$$(GeotaggingGeosyncExplainLabel, this.$$$getMessageFromBundle$$$("translations/program_strings", "geo.geosyncexpl")); panel17.add(GeotaggingGeosyncExplainLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel19 = new JPanel(); panel19.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5)); GeotaggingEditpanel.add(panel19, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); geotaggingWriteInfobutton = new JButton(); this.$$$loadButtonText$$$(geotaggingWriteInfobutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "geo.btnwritegeoinfo")); panel19.add(geotaggingWriteInfobutton); resetGeotaggingbutton = new JButton(); this.$$$loadButtonText$$$(resetGeotaggingbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.resetfields")); panel19.add(resetGeotaggingbutton); geotaggingHelpbutton = new JButton(); this.$$$loadButtonText$$$(geotaggingHelpbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); panel19.add(geotaggingHelpbutton); geotaggingOverwriteOriginalscheckBox = new JCheckBox(); geotaggingOverwriteOriginalscheckBox.setSelected(false); this.$$$loadButtonText$$$(geotaggingOverwriteOriginalscheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "chkbox.makebackup")); GeotaggingEditpanel.add(geotaggingOverwriteOriginalscheckBox, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel20 = new JPanel(); panel20.setLayout(new GridLayoutManager(6, 3, new Insets(5, 5, 5, 5), -1, -1)); GeotaggingEditpanel.add(panel20, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel20.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label51 = new JLabel(); Font label51Font = this.$$$getFont$$$(null, Font.BOLD, -1, label51.getFont()); if (label51Font != null) label51.setFont(label51Font); this.$$$loadLabelText$$$(label51, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.xmpiptcloc")); panel20.add(label51, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label52 = new JLabel(); this.$$$loadLabelText$$$(label52, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.whereis")); panel20.add(label52, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label53 = new JLabel(); Font label53Font = this.$$$getFont$$$(null, Font.BOLD, -1, label53.getFont()); if (label53Font != null) label53.setFont(label53Font); this.$$$loadLabelText$$$(label53, this.$$$getMessageFromBundle$$$("translations/program_strings", "label.save")); panel20.add(label53, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label54 = new JLabel(); label54.setPreferredSize(new Dimension(75, 18)); this.$$$loadLabelText$$$(label54, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.location")); panel20.add(label54, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); geotaggingLocationtextfield = new JTextField(); geotaggingLocationtextfield.setPreferredSize(new Dimension(300, 30)); panel20.add(geotaggingLocationtextfield, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, 25), null, 0, false)); geotaggingLocationcheckbox = new JCheckBox(); geotaggingLocationcheckbox.setSelected(false); geotaggingLocationcheckbox.setText(""); panel20.add(geotaggingLocationcheckbox, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label55 = new JLabel(); this.$$$loadLabelText$$$(label55, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.country")); panel20.add(label55, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); geotaggingCountrytextfield = new JTextField(); panel20.add(geotaggingCountrytextfield, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, 25), null, 0, false)); geotaggingCountrycheckbox = new JCheckBox(); geotaggingCountrycheckbox.setSelected(false); geotaggingCountrycheckbox.setText(""); panel20.add(geotaggingCountrycheckbox, new GridConstraints(3, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label56 = new JLabel(); this.$$$loadLabelText$$$(label56, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.statprov")); panel20.add(label56, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); geotaggingStatetextfield = new JTextField(); panel20.add(geotaggingStatetextfield, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, 25), null, 0, false)); geotaggingStatecheckbox = new JCheckBox(); geotaggingStatecheckbox.setSelected(false); geotaggingStatecheckbox.setText(""); panel20.add(geotaggingStatecheckbox, new GridConstraints(4, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label57 = new JLabel(); this.$$$loadLabelText$$$(label57, this.$$$getMessageFromBundle$$$("translations/program_strings", "gps.city")); panel20.add(label57, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); geotaggingCitytextfield = new JTextField(); geotaggingCitytextfield.setText(""); panel20.add(geotaggingCitytextfield, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, 25), null, 0, false)); geotaggingCitycheckbox = new JCheckBox(); geotaggingCitycheckbox.setSelected(false); geotaggingCitycheckbox.setText(""); panel20.add(geotaggingCitycheckbox, new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); GeotaggingLocationLabel = new JLabel(); this.$$$loadLabelText$$$(GeotaggingLocationLabel, this.$$$getMessageFromBundle$$$("translations/program_strings", "geo.geotagexpl")); panel20.add(GeotaggingLocationLabel, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel21 = new JPanel(); panel21.setLayout(new GridLayoutManager(6, 1, new Insets(10, 0, 0, 0), -1, -1)); panel21.setMinimumSize(new Dimension(750, 500)); panel21.setPreferredSize(new Dimension(800, 550)); tabbedPaneEditfunctions.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "ed.gpanotab"), panel21); gPanoTopText = new JLabel(); this.$$$loadLabelText$$$(gPanoTopText, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.toptext")); panel21.add(gPanoTopText, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); final JPanel panel22 = new JPanel(); panel22.setLayout(new GridLayoutManager(5, 5, new Insets(5, 5, 5, 5), -1, -1)); panel21.add(panel22, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); panel22.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label58 = new JLabel(); this.$$$loadLabelText$$$(label58, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.croppedareaimageheightpixels")); panel22.add(label58, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, -1), null, 0, false)); gpanoCAIHPtextField = new JFormattedTextField(); gpanoCAIHPtextField.setColumns(0); gpanoCAIHPtextField.setPreferredSize(new Dimension(75, 30)); panel22.add(gpanoCAIHPtextField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(75, 25), null, 0, false)); final JLabel label59 = new JLabel(); label59.setPreferredSize(new Dimension(200, 18)); this.$$$loadLabelText$$$(label59, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.croppedareaimagewidthpixels")); panel22.add(label59, new GridConstraints(0, 2, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); gpanoCAIWPtextField = new JFormattedTextField(); gpanoCAIWPtextField.setPreferredSize(new Dimension(75, 30)); panel22.add(gpanoCAIWPtextField, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(75, 25), null, 0, false)); final JLabel label60 = new JLabel(); label60.setPreferredSize(new Dimension(200, 18)); this.$$$loadLabelText$$$(label60, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.fullpanoheightpixels")); panel22.add(label60, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); gpanoFPHPtextField = new JFormattedTextField(); gpanoFPHPtextField.setPreferredSize(new Dimension(75, 30)); panel22.add(gpanoFPHPtextField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(75, 25), null, 0, false)); final JLabel label61 = new JLabel(); label61.setPreferredSize(new Dimension(200, 18)); this.$$$loadLabelText$$$(label61, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.fullpanowidthpixels")); panel22.add(label61, new GridConstraints(2, 2, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); gpanoFPWPtextField = new JFormattedTextField(); gpanoFPWPtextField.setPreferredSize(new Dimension(75, 30)); panel22.add(gpanoFPWPtextField, new GridConstraints(2, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(75, 25), null, 0, false)); final JLabel label62 = new JLabel(); this.$$$loadLabelText$$$(label62, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.projectiontype")); panel22.add(label62, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); gpanoPTcomboBox = new JComboBox(); panel22.add(gpanoPTcomboBox, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label63 = new JLabel(); this.$$$loadLabelText$$$(label63, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.usepanoramaviewer")); panel22.add(label63, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); checkBox1 = new JCheckBox(); checkBox1.setEnabled(false); checkBox1.setSelected(true); checkBox1.setText(""); panel22.add(checkBox1, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label64 = new JLabel(); label64.setPreferredSize(new Dimension(200, 18)); this.$$$loadLabelText$$$(label64, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.croppedarealeftpixels")); panel22.add(label64, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label65 = new JLabel(); label65.setPreferredSize(new Dimension(200, 18)); this.$$$loadLabelText$$$(label65, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.croppedareatoppixels")); panel22.add(label65, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); gpanoCATPtextField = new JFormattedTextField(); gpanoCATPtextField.setPreferredSize(new Dimension(75, 30)); panel22.add(gpanoCATPtextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(75, 25), null, 0, false)); gpanoCALPtextField = new JFormattedTextField(); gpanoCALPtextField.setPreferredSize(new Dimension(75, 30)); panel22.add(gpanoCALPtextField, new GridConstraints(1, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(75, 25), null, 0, false)); final JPanel panel23 = new JPanel(); panel23.setLayout(new GridLayoutManager(7, 3, new Insets(5, 5, 5, 5), -1, -1)); panel21.add(panel23, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); panel23.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label66 = new JLabel(); this.$$$loadLabelText$$$(label66, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.initialviewheadingdegrees")); panel23.add(label66, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false)); gpanoIVHDtextField = new JFormattedTextField(); panel23.add(gpanoIVHDtextField, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(75, 25), null, 0, false)); gpanoIVHDCheckBox = new JCheckBox(); gpanoIVHDCheckBox.setText(""); panel23.add(gpanoIVHDCheckBox, new GridConstraints(3, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label67 = new JLabel(); this.$$$loadLabelText$$$(label67, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.initialviewpitchdegrees")); panel23.add(label67, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); gpanoIVPDtextField = new JFormattedTextField(); panel23.add(gpanoIVPDtextField, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(75, 25), null, 0, false)); gpanoIVPDCheckBox = new JCheckBox(); gpanoIVPDCheckBox.setText(""); panel23.add(gpanoIVPDCheckBox, new GridConstraints(4, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label68 = new JLabel(); this.$$$loadLabelText$$$(label68, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.initialviewrolldegrees")); panel23.add(label68, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); gpanoIVRDtextField = new JFormattedTextField(); panel23.add(gpanoIVRDtextField, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(75, 25), null, 0, false)); gpanoIVRDCheckBox = new JCheckBox(); gpanoIVRDCheckBox.setText(""); panel23.add(gpanoIVRDCheckBox, new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label69 = new JLabel(); this.$$$loadLabelText$$$(label69, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.initialhorizontalfovdegrees")); panel23.add(label69, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); gpanoIHFOVDtextField = new JFormattedTextField(); panel23.add(gpanoIHFOVDtextField, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(75, 25), null, 0, false)); gpanoIHFOVDtextFieldCheckBox = new JCheckBox(); gpanoIHFOVDtextFieldCheckBox.setText(""); panel23.add(gpanoIHFOVDtextFieldCheckBox, new GridConstraints(6, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label70 = new JLabel(); label70.setPreferredSize(new Dimension(200, 18)); this.$$$loadLabelText$$$(label70, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.stitchingsoftware")); panel23.add(label70, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, -1), null, 0, false)); gpanoStitchingSoftwaretextField = new JTextField(); gpanoStitchingSoftwaretextField.setPreferredSize(new Dimension(450, 25)); panel23.add(gpanoStitchingSoftwaretextField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(400, 25), null, 0, false)); gpanoStitchingSoftwarecheckBox = new JCheckBox(); gpanoStitchingSoftwarecheckBox.setText(""); panel23.add(gpanoStitchingSoftwarecheckBox, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label71 = new JLabel(); this.$$$loadLabelText$$$(label71, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.poseheadingdegrees")); panel23.add(label71, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); gpanoPHDtextField = new JFormattedTextField(); panel23.add(gpanoPHDtextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(75, 25), null, 0, false)); gpanoPHDcheckBox = new JCheckBox(); gpanoPHDcheckBox.setText(""); panel23.add(gpanoPHDcheckBox, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label72 = new JLabel(); Font label72Font = this.$$$getFont$$$(null, Font.BOLD, -1, label72.getFont()); if (label72Font != null) label72.setFont(label72Font); label72.setRequestFocusEnabled(false); this.$$$loadLabelText$$$(label72, this.$$$getMessageFromBundle$$$("translations/program_strings", "label.save")); panel23.add(label72, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel24 = new JPanel(); panel24.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel21.add(panel24, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); gpanoCopyFrombutton = new JButton(); this.$$$loadButtonText$$$(gpanoCopyFrombutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.copyfrom")); panel24.add(gpanoCopyFrombutton); gpanoCopyTobutton = new JButton(); this.$$$loadButtonText$$$(gpanoCopyTobutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.saveto")); panel24.add(gpanoCopyTobutton); gpanoResetFieldsbutton = new JButton(); this.$$$loadButtonText$$$(gpanoResetFieldsbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.resetfields")); panel24.add(gpanoResetFieldsbutton); gpanoHelpbutton = new JButton(); gpanoHelpbutton.setLabel("Help"); this.$$$loadButtonText$$$(gpanoHelpbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); panel24.add(gpanoHelpbutton); gpanoOverwriteOriginalscheckBox = new JCheckBox(); this.$$$loadButtonText$$$(gpanoOverwriteOriginalscheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "chkbox.makebackup")); panel21.add(gpanoOverwriteOriginalscheckBox, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); gpanoMinVersionText = new JLabel(); this.$$$loadLabelText$$$(gpanoMinVersionText, this.$$$getMessageFromBundle$$$("translations/program_strings", "gpano.googlemapsfields")); gpanoMinVersionText.setVisible(true); panel21.add(gpanoMinVersionText, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); final JPanel panel25 = new JPanel(); panel25.setLayout(new GridLayoutManager(20, 3, new Insets(10, 20, 10, 20), -1, -1)); panel25.setMinimumSize(new Dimension(750, 500)); panel25.setPreferredSize(new Dimension(800, 550)); tabbedPaneEditfunctions.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "ed.lenstab"), panel25); final JLabel label73 = new JLabel(); this.$$$loadLabelText$$$(label73, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.lensmake")); panel25.add(label73, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lensmaketextField = new JTextField(); panel25.add(lensmaketextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JPanel panel26 = new JPanel(); panel26.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel25.add(panel26, new GridConstraints(16, 0, 1, 2, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); lensCopyFrombutton = new JButton(); this.$$$loadButtonText$$$(lensCopyFrombutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.copyfrom")); panel26.add(lensCopyFrombutton); lensSaveTobutton = new JButton(); this.$$$loadButtonText$$$(lensSaveTobutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.saveto")); panel26.add(lensSaveTobutton); lensResetFieldsbutton = new JButton(); this.$$$loadButtonText$$$(lensResetFieldsbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.resetfields")); panel26.add(lensResetFieldsbutton); lensHelpbutton = new JButton(); lensHelpbutton.setLabel("Help"); this.$$$loadButtonText$$$(lensHelpbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); panel26.add(lensHelpbutton); final JLabel label74 = new JLabel(); this.$$$loadLabelText$$$(label74, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.lensmodel")); panel25.add(label74, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lensmodeltextField = new JTextField(); panel25.add(lensmodeltextField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); lensmodelcheckBox = new JCheckBox(); lensmodelcheckBox.setSelected(true); lensmodelcheckBox.setText(""); panel25.add(lensmodelcheckBox, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label75 = new JLabel(); Font label75Font = this.$$$getFont$$$(null, Font.BOLD, -1, label75.getFont()); if (label75Font != null) label75.setFont(label75Font); this.$$$loadLabelText$$$(label75, this.$$$getMessageFromBundle$$$("translations/program_strings", "label.save")); panel25.add(label75, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lensmakecheckBox = new JCheckBox(); lensmakecheckBox.setSelected(true); lensmakecheckBox.setText(""); panel25.add(lensmakecheckBox, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label76 = new JLabel(); this.$$$loadLabelText$$$(label76, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.serialnumber")); panel25.add(label76, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lensserialnumbertextField = new JTextField(); panel25.add(lensserialnumbertextField, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JLabel label77 = new JLabel(); this.$$$loadLabelText$$$(label77, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.focallength")); panel25.add(label77, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); focallengthtextField = new JTextField(); panel25.add(focallengthtextField, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); lensserialnumbercheckBox = new JCheckBox(); lensserialnumbercheckBox.setSelected(true); lensserialnumbercheckBox.setText(""); panel25.add(lensserialnumbercheckBox, new GridConstraints(3, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); focallengthcheckBox = new JCheckBox(); focallengthcheckBox.setSelected(true); focallengthcheckBox.setText(""); panel25.add(focallengthcheckBox, new GridConstraints(4, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label78 = new JLabel(); this.$$$loadLabelText$$$(label78, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.focallength35mm")); panel25.add(label78, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); focallengthIn35mmformattextField = new JTextField(); panel25.add(focallengthIn35mmformattextField, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); focallengthIn35mmformatcheckBox = new JCheckBox(); focallengthIn35mmformatcheckBox.setSelected(true); focallengthIn35mmformatcheckBox.setText(""); panel25.add(focallengthIn35mmformatcheckBox, new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label79 = new JLabel(); this.$$$loadLabelText$$$(label79, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.fnumber")); panel25.add(label79, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); fnumbertextField = new JTextField(); panel25.add(fnumbertextField, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); fnumbercheckBox = new JCheckBox(); fnumbercheckBox.setSelected(true); fnumbercheckBox.setText(""); panel25.add(fnumbercheckBox, new GridConstraints(6, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label80 = new JLabel(); this.$$$loadLabelText$$$(label80, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.maxaperturevalue")); panel25.add(label80, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); maxaperturevaluetextField = new JTextField(); panel25.add(maxaperturevaluetextField, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); maxaperturevaluecheckBox = new JCheckBox(); maxaperturevaluecheckBox.setSelected(true); maxaperturevaluecheckBox.setText(""); panel25.add(maxaperturevaluecheckBox, new GridConstraints(7, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label81 = new JLabel(); this.$$$loadLabelText$$$(label81, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.meteringmode")); panel25.add(label81, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); meteringmodecomboBox = new JComboBox(); panel25.add(meteringmodecomboBox, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); meteringmodecheckBox = new JCheckBox(); meteringmodecheckBox.setSelected(true); meteringmodecheckBox.setText(""); panel25.add(meteringmodecheckBox, new GridConstraints(8, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label82 = new JLabel(); this.$$$loadLabelText$$$(label82, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.focusdistance")); panel25.add(label82, new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); focusdistancetextField = new JTextField(); panel25.add(focusdistancetextField, new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); focusdistancecheckBox = new JCheckBox(); focusdistancecheckBox.setSelected(true); focusdistancecheckBox.setText(""); panel25.add(focusdistancecheckBox, new GridConstraints(9, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label83 = new JLabel(); this.$$$loadLabelText$$$(label83, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.lensid")); panel25.add(label83, new GridConstraints(10, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lensidtextField = new JTextField(); panel25.add(lensidtextField, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); lensidcheckBox = new JCheckBox(); lensidcheckBox.setSelected(true); lensidcheckBox.setText(""); panel25.add(lensidcheckBox, new GridConstraints(10, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label84 = new JLabel(); this.$$$loadLabelText$$$(label84, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.conversionlens")); panel25.add(label84, new GridConstraints(11, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); conversionlenstextField = new JTextField(); panel25.add(conversionlenstextField, new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); conversionlenscheckBox = new JCheckBox(); conversionlenscheckBox.setSelected(true); conversionlenscheckBox.setText(""); panel25.add(conversionlenscheckBox, new GridConstraints(11, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label85 = new JLabel(); this.$$$loadLabelText$$$(label85, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.lenstype")); panel25.add(label85, new GridConstraints(12, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lenstypetextField = new JTextField(); panel25.add(lenstypetextField, new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); lenstypecheckBox = new JCheckBox(); lenstypecheckBox.setSelected(true); lenstypecheckBox.setText(""); panel25.add(lenstypecheckBox, new GridConstraints(12, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label86 = new JLabel(); this.$$$loadLabelText$$$(label86, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.firmwarevers")); panel25.add(label86, new GridConstraints(13, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lensfirmwareversiontextField = new JTextField(); panel25.add(lensfirmwareversiontextField, new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); lensfirmwareversioncheckBox = new JCheckBox(); lensfirmwareversioncheckBox.setSelected(true); lensfirmwareversioncheckBox.setText(""); panel25.add(lensfirmwareversioncheckBox, new GridConstraints(13, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lensOverwriteOriginalscheckBox = new JCheckBox(); this.$$$loadButtonText$$$(lensOverwriteOriginalscheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "chkbox.makebackup")); panel25.add(lensOverwriteOriginalscheckBox, new GridConstraints(15, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); final Spacer spacer3 = new Spacer(); panel25.add(spacer3, new GridConstraints(14, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_CAN_GROW, new Dimension(-1, 25), new Dimension(-1, 25), null, 0, false)); saveloadlensconfigpanel = new JPanel(); saveloadlensconfigpanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel25.add(saveloadlensconfigpanel, new GridConstraints(19, 0, 1, 2, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); saveloadlensconfigpanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); saveLensConfigurationbutton = new JButton(); this.$$$loadButtonText$$$(saveLensConfigurationbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.btnconfigsave")); saveLensConfigurationbutton.setToolTipText("This allows you to save lens configurations for future use"); saveloadlensconfigpanel.add(saveLensConfigurationbutton); loadLensConfigurationButton = new JButton(); this.$$$loadButtonText$$$(loadLensConfigurationButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.btnconfigload")); saveloadlensconfigpanel.add(loadLensConfigurationButton); final Spacer spacer4 = new Spacer(); panel25.add(spacer4, new GridConstraints(17, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); lensSaveLoadConfigLabel = new JLabel(); this.$$$loadLabelText$$$(lensSaveLoadConfigLabel, this.$$$getMessageFromBundle$$$("translations/program_strings", "lens.saveloadconfig")); panel25.add(lensSaveLoadConfigLabel, new GridConstraints(18, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel27 = new JPanel(); panel27.setLayout(new GridLayoutManager(9, 1, new Insets(10, 20, 10, 20), -1, -1)); panel27.setMinimumSize(new Dimension(750, 397)); panel27.setPreferredSize(new Dimension(800, 397)); tabbedPaneEditfunctions.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "ed.xmpiptcstringtab"), panel27); StringsTopText = new JLabel(); StringsTopText.setText("StringstopText"); panel27.add(StringsTopText, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel28 = new JPanel(); panel28.setLayout(new GridLayoutManager(2, 4, new Insets(5, 5, 5, 5), -1, -1)); panel27.add(panel28, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel28.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label87 = new JLabel(); this.$$$loadLabelText$$$(label87, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.keywords")); panel28.add(label87, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(140, -1), null, 0, false)); StringsKeywordstextField = new JTextField(); panel28.add(StringsKeywordstextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); StringsKeywordsIPTCcheckBox = new JLabel(); StringsKeywordsIPTCcheckBox.setText("IPTC"); panel28.add(StringsKeywordsIPTCcheckBox, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel29 = new JPanel(); panel29.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel28.add(panel29, new GridConstraints(1, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label88 = new JLabel(); this.$$$loadLabelText$$$(label88, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.action")); panel29.add(label88); StringsKeywOverwriteradioButton = new JRadioButton(); this.$$$loadButtonText$$$(StringsKeywOverwriteradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.overwrite")); panel29.add(StringsKeywOverwriteradioButton); StringsKeywAppendradioButton = new JRadioButton(); this.$$$loadButtonText$$$(StringsKeywAppendradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.append")); panel29.add(StringsKeywAppendradioButton); StringsKeywRemoveradioButton = new JRadioButton(); this.$$$loadButtonText$$$(StringsKeywRemoveradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.remove")); panel29.add(StringsKeywRemoveradioButton); StringsKeywDontSaveradioButton = new JRadioButton(); StringsKeywDontSaveradioButton.setSelected(true); this.$$$loadButtonText$$$(StringsKeywDontSaveradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.dontsave")); panel29.add(StringsKeywDontSaveradioButton); final JPanel panel30 = new JPanel(); panel30.setLayout(new GridLayoutManager(2, 4, new Insets(5, 5, 5, 5), -1, -1)); panel27.add(panel30, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel30.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label89 = new JLabel(); this.$$$loadLabelText$$$(label89, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.subject")); panel30.add(label89, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(140, -1), null, 0, false)); StringsSubjecttextField = new JTextField(); panel30.add(StringsSubjecttextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JLabel label90 = new JLabel(); label90.setText("XMP"); panel30.add(label90, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel31 = new JPanel(); panel31.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel30.add(panel31, new GridConstraints(1, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label91 = new JLabel(); this.$$$loadLabelText$$$(label91, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.action")); panel31.add(label91); StringsSubjectOverwriteradioButton = new JRadioButton(); this.$$$loadButtonText$$$(StringsSubjectOverwriteradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.overwrite")); panel31.add(StringsSubjectOverwriteradioButton); StringsSubjectAppendradioButton = new JRadioButton(); this.$$$loadButtonText$$$(StringsSubjectAppendradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.append")); panel31.add(StringsSubjectAppendradioButton); StringsSubjectRemoveradioButton = new JRadioButton(); this.$$$loadButtonText$$$(StringsSubjectRemoveradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.remove")); panel31.add(StringsSubjectRemoveradioButton); StringsSubjectDontSaveradioButton = new JRadioButton(); StringsSubjectDontSaveradioButton.setSelected(true); this.$$$loadButtonText$$$(StringsSubjectDontSaveradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.dontsave")); panel31.add(StringsSubjectDontSaveradioButton); final JPanel panel32 = new JPanel(); panel32.setLayout(new GridLayoutManager(2, 4, new Insets(5, 5, 5, 5), -1, -1)); panel27.add(panel32, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel32.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label92 = new JLabel(); this.$$$loadLabelText$$$(label92, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.pim")); panel32.add(label92, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(140, -1), null, 0, false)); StringsPIItextField = new JTextField(); panel32.add(StringsPIItextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); StringsIIPXmpcheckBox = new JLabel(); StringsIIPXmpcheckBox.setText("XMP"); panel32.add(StringsIIPXmpcheckBox, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel33 = new JPanel(); panel33.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel32.add(panel33, new GridConstraints(1, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label93 = new JLabel(); this.$$$loadLabelText$$$(label93, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.action")); panel33.add(label93); StringsIIPOverwriteradioButton = new JRadioButton(); this.$$$loadButtonText$$$(StringsIIPOverwriteradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.overwrite")); panel33.add(StringsIIPOverwriteradioButton); StringsIIPAppendradioButton = new JRadioButton(); this.$$$loadButtonText$$$(StringsIIPAppendradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.append")); panel33.add(StringsIIPAppendradioButton); StringsIIPRemoveradioButton = new JRadioButton(); this.$$$loadButtonText$$$(StringsIIPRemoveradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.remove")); panel33.add(StringsIIPRemoveradioButton); StringsIIPDontSaveradioButton = new JRadioButton(); StringsIIPDontSaveradioButton.setSelected(true); this.$$$loadButtonText$$$(StringsIIPDontSaveradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.dontsave")); panel33.add(StringsIIPDontSaveradioButton); stringPlusOverwriteOriginalscheckBox = new JCheckBox(); this.$$$loadButtonText$$$(stringPlusOverwriteOriginalscheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "chkbox.makebackup")); panel27.add(stringPlusOverwriteOriginalscheckBox, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); final JPanel panel34 = new JPanel(); panel34.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel27.add(panel34, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); stringPlusCopyFrombutton = new JButton(); this.$$$loadButtonText$$$(stringPlusCopyFrombutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.copyfrom")); panel34.add(stringPlusCopyFrombutton); stringPlusSaveTobutton = new JButton(); this.$$$loadButtonText$$$(stringPlusSaveTobutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.saveto")); panel34.add(stringPlusSaveTobutton); stringPlusResetFieldsbutton = new JButton(); this.$$$loadButtonText$$$(stringPlusResetFieldsbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.resetfields")); panel34.add(stringPlusResetFieldsbutton); stringPlusHelpbutton = new JButton(); stringPlusHelpbutton.setLabel("Help"); stringPlusHelpbutton.setText("Help"); stringPlusHelpbutton.setVisible(false); panel34.add(stringPlusHelpbutton); final Spacer spacer5 = new Spacer(); panel27.add(spacer5, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); SeparatorText = new JLabel(); SeparatorText.setText("Separator"); panel27.add(SeparatorText, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel35 = new JPanel(); panel35.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel27.add(panel35, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label94 = new JLabel(); this.$$$loadLabelText$$$(label94, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.separator")); panel35.add(label94); radioButtonComma = new JRadioButton(); radioButtonComma.setSelected(true); this.$$$loadButtonText$$$(radioButtonComma, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.sepcomma")); panel35.add(radioButtonComma); radioButtonColon = new JRadioButton(); this.$$$loadButtonText$$$(radioButtonColon, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.sepcolon")); panel35.add(radioButtonColon); radioButtonSemiColon = new JRadioButton(); this.$$$loadButtonText$$$(radioButtonSemiColon, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.sepsemicolon")); panel35.add(radioButtonSemiColon); radioButtonHash = new JRadioButton(); this.$$$loadButtonText$$$(radioButtonHash, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.sephash")); panel35.add(radioButtonHash); radioButtonOther = new JRadioButton(); this.$$$loadButtonText$$$(radioButtonOther, this.$$$getMessageFromBundle$$$("translations/program_strings", "xis.sepother")); panel35.add(radioButtonOther); textFieldOtherSeparator = new JTextField(); textFieldOtherSeparator.setPreferredSize(new Dimension(25, 38)); panel35.add(textFieldOtherSeparator); final JPanel panel36 = new JPanel(); panel36.setLayout(new GridLayoutManager(1, 1, new Insets(10, 20, 10, 20), -1, -1)); panel36.setMinimumSize(new Dimension(750, 204)); panel36.setPreferredSize(new Dimension(800, 550)); tabbedPaneEditfunctions.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "ed.usercombis"), panel36); final JPanel panel37 = new JPanel(); panel37.setLayout(new GridLayoutManager(5, 1, new Insets(0, 5, 0, 5), -1, -1)); panel36.add(panel37, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel38 = new JPanel(); panel38.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel37.add(panel38, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label95 = new JLabel(); this.$$$loadLabelText$$$(label95, this.$$$getMessageFromBundle$$$("translations/program_strings", "udc.sets")); panel38.add(label95); UserCombiscomboBox = new JComboBox(); panel38.add(UserCombiscomboBox); udcCreateNewButton = new JButton(); this.$$$loadButtonText$$$(udcCreateNewButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "udc.crbutton")); panel38.add(udcCreateNewButton); CustomConfiglabel = new JLabel(); CustomConfiglabel.setText(""); CustomConfiglabel.setVisible(false); panel38.add(CustomConfiglabel); UserCombiScrollPane = new JScrollPane(); panel37.add(UserCombiScrollPane, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, new Dimension(700, -1), new Dimension(800, -1), null, 0, false)); UserCombiTable = new JTable(); UserCombiScrollPane.setViewportView(UserCombiTable); final JPanel panel39 = new JPanel(); panel39.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel37.add(panel39, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); udcCopyFrombutton = new JButton(); this.$$$loadButtonText$$$(udcCopyFrombutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.copyfrom")); panel39.add(udcCopyFrombutton); udcSaveTobutton = new JButton(); this.$$$loadButtonText$$$(udcSaveTobutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.saveto")); panel39.add(udcSaveTobutton); udcResetFieldsbutton = new JButton(); this.$$$loadButtonText$$$(udcResetFieldsbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.resetfields")); udcResetFieldsbutton.setVisible(false); panel39.add(udcResetFieldsbutton); udcHelpbutton = new JButton(); udcHelpbutton.setLabel("Help"); this.$$$loadButtonText$$$(udcHelpbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); panel39.add(udcHelpbutton); UserCombiTopText = new JLabel(); this.$$$loadLabelText$$$(UserCombiTopText, this.$$$getMessageFromBundle$$$("translations/program_strings", "udc.toptext")); panel37.add(UserCombiTopText, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel40 = new JPanel(); panel40.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); panel37.add(panel40, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); udcOverwriteOriginalscheckBox = new JCheckBox(); this.$$$loadButtonText$$$(udcOverwriteOriginalscheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "chkbox.makebackup")); panel40.add(udcOverwriteOriginalscheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final Spacer spacer6 = new Spacer(); panel40.add(spacer6, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel41 = new JPanel(); panel41.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); tabbedPaneRight.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "maintab.copydata"), panel41); CopyDatatabbedPane = new JTabbedPane(); panel41.add(CopyDatatabbedPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, 200), null, 0, false)); final JPanel panel42 = new JPanel(); panel42.setLayout(new GridLayoutManager(1, 1, new Insets(10, 0, 0, 0), -1, -1)); CopyDatatabbedPane.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "cd.copyfromto"), panel42); final JPanel panel43 = new JPanel(); panel43.setLayout(new GridLayoutManager(6, 1, new Insets(10, 10, 5, 5), -1, -1)); panel43.setPreferredSize(new Dimension(800, 500)); panel42.add(panel43, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); copyAllMetadataRadiobutton = new JRadioButton(); this.$$$loadButtonText$$$(copyAllMetadataRadiobutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.copyallmetadatasame")); panel43.add(copyAllMetadataRadiobutton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); copyAllMetadataSameGroupsRadiobutton = new JRadioButton(); copyAllMetadataSameGroupsRadiobutton.setText("<html>Copy the values of all writable tags from the source image to the target image(s), preserving the original tag groups</html>"); panel43.add(copyAllMetadataSameGroupsRadiobutton, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); copySelectiveMetadataradioButton = new JRadioButton(); copySelectiveMetadataradioButton.setSelected(true); copySelectiveMetadataradioButton.setText("Copy metadata using below mentioned selective group options"); panel43.add(copySelectiveMetadataradioButton, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel44 = new JPanel(); panel44.setLayout(new GridLayoutManager(7, 1, new Insets(10, 0, 15, 0), -1, -1)); panel43.add(panel44, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); panel44.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); CopyExifcheckBox = new JCheckBox(); this.$$$loadButtonText$$$(CopyExifcheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.copyexifcheckbox")); panel44.add(CopyExifcheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CopyXmpcheckBox = new JCheckBox(); this.$$$loadButtonText$$$(CopyXmpcheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.copyxmpcheckbox")); panel44.add(CopyXmpcheckBox, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CopyIptccheckBox = new JCheckBox(); this.$$$loadButtonText$$$(CopyIptccheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.copyiptccheckbox")); panel44.add(CopyIptccheckBox, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CopyIcc_profileDataCheckBox = new JCheckBox(); CopyIcc_profileDataCheckBox.setActionCommand(""); this.$$$loadButtonText$$$(CopyIcc_profileDataCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.copyicc_profilecheckbox")); panel44.add(CopyIcc_profileDataCheckBox, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CopyGpsCheckBox = new JCheckBox(); this.$$$loadButtonText$$$(CopyGpsCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.copygpscheckbox")); panel44.add(CopyGpsCheckBox, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CopyJfifcheckBox = new JCheckBox(); this.$$$loadButtonText$$$(CopyJfifcheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.copyjfifcheckbox")); panel44.add(CopyJfifcheckBox, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CopyMakernotescheckBox = new JCheckBox(); this.$$$loadButtonText$$$(CopyMakernotescheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.copymakernotescheckbox")); panel44.add(CopyMakernotescheckBox, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); BackupOriginalscheckBox = new JCheckBox(); this.$$$loadButtonText$$$(BackupOriginalscheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "chkbox.makebackup")); panel43.add(BackupOriginalscheckBox, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel45 = new JPanel(); panel45.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel43.add(panel45, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); UseDataFrombutton = new JButton(); this.$$$loadButtonText$$$(UseDataFrombutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.copyfrom")); panel45.add(UseDataFrombutton); CopyDataCopyTobutton = new JButton(); this.$$$loadButtonText$$$(CopyDataCopyTobutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.saveto")); panel45.add(CopyDataCopyTobutton); CopyHelpbutton = new JButton(); this.$$$loadButtonText$$$(CopyHelpbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); panel45.add(CopyHelpbutton); final JPanel panel46 = new JPanel(); panel46.setLayout(new GridLayoutManager(4, 1, new Insets(10, 10, 10, 10), -1, -1)); CopyDatatabbedPane.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "cd.copyinimage"), panel46); copyAllMetdataToXMPRadioButton = new JRadioButton(); copyAllMetdataToXMPRadioButton.setSelected(false); this.$$$loadButtonText$$$(copyAllMetdataToXMPRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.copyallmetadatatoxmpformat")); panel46.add(copyAllMetdataToXMPRadioButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); final JPanel panel47 = new JPanel(); panel47.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); panel46.add(panel47, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); panel47.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); CopyArgsRadioButton = new JRadioButton(); CopyArgsRadioButton.setSelected(true); this.$$$loadButtonText$$$(CopyArgsRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.fromgrouptogroup")); panel47.add(CopyArgsRadioButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel48 = new JPanel(); panel48.setLayout(new GridLayoutManager(6, 3, new Insets(0, 0, 0, 0), -1, -1)); panel47.add(panel48, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 2, false)); final JPanel panel49 = new JPanel(); panel49.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel48.add(panel49, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel49.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); tagsToXmpradioButton = new JRadioButton(); tagsToXmpradioButton.setSelected(true); this.$$$loadButtonText$$$(tagsToXmpradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.tagstoxmp")); panel49.add(tagsToXmpradioButton); final Spacer spacer7 = new Spacer(); panel49.add(spacer7); final Spacer spacer8 = new Spacer(); panel49.add(spacer8); exif2xmpCheckBox = new JCheckBox(); exif2xmpCheckBox.setText("exif2xmp"); panel49.add(exif2xmpCheckBox); gps2xmpCheckBox = new JCheckBox(); gps2xmpCheckBox.setText("gps2xmp"); panel49.add(gps2xmpCheckBox); iptc2xmpCheckBox = new JCheckBox(); iptc2xmpCheckBox.setText("iptc2xmp"); panel49.add(iptc2xmpCheckBox); pdf2xmpCheckBox = new JCheckBox(); pdf2xmpCheckBox.setText("pdf2xmp"); panel49.add(pdf2xmpCheckBox); final Spacer spacer9 = new Spacer(); panel48.add(spacer9, new GridConstraints(5, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JPanel panel50 = new JPanel(); panel50.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel48.add(panel50, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel50.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); tagsToExifradioButton = new JRadioButton(); this.$$$loadButtonText$$$(tagsToExifradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.tagstoexif")); panel50.add(tagsToExifradioButton); final Spacer spacer10 = new Spacer(); panel50.add(spacer10); final Spacer spacer11 = new Spacer(); panel50.add(spacer11); iptc2exifCheckBox = new JCheckBox(); iptc2exifCheckBox.setText("iptc2exif"); panel50.add(iptc2exifCheckBox); xmp2exifCheckBox = new JCheckBox(); xmp2exifCheckBox.setText("xmp2exif"); panel50.add(xmp2exifCheckBox); final JPanel panel51 = new JPanel(); panel51.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel48.add(panel51, new GridConstraints(2, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel51.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); tagsToIptcradioButton = new JRadioButton(); this.$$$loadButtonText$$$(tagsToIptcradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.tagstoiptc")); panel51.add(tagsToIptcradioButton); final Spacer spacer12 = new Spacer(); panel51.add(spacer12); final Spacer spacer13 = new Spacer(); panel51.add(spacer13); exif2iptcCheckBox = new JCheckBox(); exif2iptcCheckBox.setText("exif2iptc"); panel51.add(exif2iptcCheckBox); xmp2iptcCheckBox = new JCheckBox(); xmp2iptcCheckBox.setText("xmp2iptc"); panel51.add(xmp2iptcCheckBox); final JPanel panel52 = new JPanel(); panel52.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel48.add(panel52, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel52.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); tagsToGpsradioButton = new JRadioButton(); this.$$$loadButtonText$$$(tagsToGpsradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.tagstogps")); panel52.add(tagsToGpsradioButton); final Spacer spacer14 = new Spacer(); panel52.add(spacer14); final Spacer spacer15 = new Spacer(); panel52.add(spacer15); xmp2gpsCheckBox = new JCheckBox(); xmp2gpsCheckBox.setText("xmp2gps"); panel52.add(xmp2gpsCheckBox); final JPanel panel53 = new JPanel(); panel53.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel48.add(panel53, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel53.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); tagsToPdfradioButton = new JRadioButton(); this.$$$loadButtonText$$$(tagsToPdfradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "copyd.tagstopdf")); panel53.add(tagsToPdfradioButton); final Spacer spacer16 = new Spacer(); panel53.add(spacer16); final Spacer spacer17 = new Spacer(); panel53.add(spacer17); xmp2pdfCheckBox = new JCheckBox(); xmp2pdfCheckBox.setText("xmp2pdf"); panel53.add(xmp2pdfCheckBox); CopyInsideImageMakeCopyOfOriginalscheckBox = new JCheckBox(); this.$$$loadButtonText$$$(CopyInsideImageMakeCopyOfOriginalscheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "chkbox.makebackup")); panel46.add(CopyInsideImageMakeCopyOfOriginalscheckBox, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel54 = new JPanel(); panel54.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel46.add(panel54, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); copyInsideSaveDataTo = new JButton(); this.$$$loadButtonText$$$(copyInsideSaveDataTo, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.saveto")); panel54.add(copyInsideSaveDataTo); final JButton button1 = new JButton(); this.$$$loadButtonText$$$(button1, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); panel54.add(button1); final JPanel panel55 = new JPanel(); panel55.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); tabbedPaneRight.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "maintab.exportimport"), panel55); tabbedPaneExportImport = new JTabbedPane(); panel55.add(tabbedPaneExportImport, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, 200), null, 0, false)); final JPanel panel56 = new JPanel(); panel56.setLayout(new GridLayoutManager(5, 1, new Insets(10, 10, 10, 10), -1, -1)); tabbedPaneExportImport.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "expimp.generalexp"), panel56); final JPanel panel57 = new JPanel(); panel57.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); panel56.add(panel57, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel58 = new JPanel(); panel58.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1)); panel57.add(panel58, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label96 = new JLabel(); this.$$$loadLabelText$$$(label96, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.exportoption")); panel58.add(label96, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); catmetadataradioButton = new JRadioButton(); catmetadataradioButton.setSelected(true); this.$$$loadButtonText$$$(catmetadataradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.catmetadata")); panel58.add(catmetadataradioButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); exportFromUserCombisradioButton = new JRadioButton(); this.$$$loadButtonText$$$(exportFromUserCombisradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.usercombi")); panel58.add(exportFromUserCombisradioButton, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel59 = new JPanel(); panel59.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1)); panel58.add(panel59, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel59.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); exportAllMetadataCheckBox = new JCheckBox(); this.$$$loadButtonText$$$(exportAllMetadataCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.exportall")); panel59.add(exportAllMetadataCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel60 = new JPanel(); panel60.setLayout(new GridLayoutManager(5, 1, new Insets(0, 15, 0, 0), -1, -1)); panel59.add(panel60, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); exportExifDataCheckBox = new JCheckBox(); this.$$$loadButtonText$$$(exportExifDataCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.exportexif")); panel60.add(exportExifDataCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); exportXmpDataCheckBox = new JCheckBox(); this.$$$loadButtonText$$$(exportXmpDataCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.extportxmp")); panel60.add(exportXmpDataCheckBox, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); exportGpsDataCheckBox = new JCheckBox(); this.$$$loadButtonText$$$(exportGpsDataCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.exportgps")); panel60.add(exportGpsDataCheckBox, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); exportIptcDataCheckBox = new JCheckBox(); this.$$$loadButtonText$$$(exportIptcDataCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.exportiptc")); panel60.add(exportIptcDataCheckBox, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); exportICCDataCheckBox = new JCheckBox(); this.$$$loadButtonText$$$(exportICCDataCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.exporticc")); panel60.add(exportICCDataCheckBox, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel61 = new JPanel(); panel61.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel58.add(panel61, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel61.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); exportUserCombicomboBox = new JComboBox(); panel61.add(exportUserCombicomboBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel62 = new JPanel(); panel62.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel56.add(panel62, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel63 = new JPanel(); panel63.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); panel62.add(panel63, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label97 = new JLabel(); this.$$$loadLabelText$$$(label97, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.exportto")); panel63.add(label97, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer18 = new Spacer(); panel63.add(spacer18, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel64 = new JPanel(); panel64.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel63.add(panel64, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); txtRadioButton = new JRadioButton(); txtRadioButton.setSelected(true); this.$$$loadButtonText$$$(txtRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.txt")); panel64.add(txtRadioButton); tabRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(tabRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.tab")); panel64.add(tabRadioButton); xmlRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(xmlRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.xml")); panel64.add(xmlRadioButton); htmlRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(htmlRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.html")); panel64.add(htmlRadioButton); XMPRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(XMPRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.xmp")); XMPRadioButton.setVisible(false); panel64.add(XMPRadioButton); csvRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(csvRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.csv")); panel64.add(csvRadioButton); final JPanel panel65 = new JPanel(); panel65.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); panel56.add(panel65, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); GenExportbuttonOK = new JButton(); this.$$$loadButtonText$$$(GenExportbuttonOK, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.export")); panel65.add(GenExportbuttonOK, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); GenExportbuttonCancel = new JButton(); this.$$$loadButtonText$$$(GenExportbuttonCancel, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.cancel")); panel65.add(GenExportbuttonCancel, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer19 = new Spacer(); panel65.add(spacer19, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); GenExpuseMetadataTagLanguageCheckBoxport = new JCheckBox(); GenExpuseMetadataTagLanguageCheckBoxport.setSelected(true); this.$$$loadButtonText$$$(GenExpuseMetadataTagLanguageCheckBoxport, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.uselang")); panel56.add(GenExpuseMetadataTagLanguageCheckBoxport, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); exportMetaDataUiText = new JLabel(); exportMetaDataUiText.setEnabled(true); exportMetaDataUiText.setRequestFocusEnabled(false); exportMetaDataUiText.setText("exportMetaDataUiText"); exportMetaDataUiText.setVerifyInputWhenFocusTarget(false); panel56.add(exportMetaDataUiText, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel66 = new JPanel(); panel66.setLayout(new GridLayoutManager(7, 1, new Insets(5, 5, 5, 5), -1, -1)); tabbedPaneExportImport.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "expimp.exptopdf"), panel66); expPdftextLabel = new JLabel(); expPdftextLabel.setText("expPdftextLabell"); panel66.add(expPdftextLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); final Spacer spacer20 = new Spacer(); panel66.add(spacer20, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JPanel panel67 = new JPanel(); panel67.setLayout(new FlowLayout(FlowLayout.CENTER, 15, 5)); panel66.add(panel67, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExpPDFOKbutton = new JButton(); this.$$$loadButtonText$$$(ExpPDFOKbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.export")); panel67.add(ExpPDFOKbutton); final JPanel panel68 = new JPanel(); panel68.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1)); panel66.add(panel68, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); panel68.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label98 = new JLabel(); this.$$$loadLabelText$$$(label98, this.$$$getMessageFromBundle$$$("translations/program_strings", "exppdf.paper")); label98.setVisible(false); panel68.add(label98, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); LetterradioButton = new JRadioButton(); this.$$$loadButtonText$$$(LetterradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "exppdf.letter")); LetterradioButton.setVisible(false); panel68.add(LetterradioButton, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); A4radioButton = new JRadioButton(); A4radioButton.setSelected(true); this.$$$loadButtonText$$$(A4radioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "exppdf.a4")); A4radioButton.setVisible(false); panel68.add(A4radioButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label99 = new JLabel(); this.$$$loadLabelText$$$(label99, this.$$$getMessageFromBundle$$$("translations/program_strings", "exppdf.output")); panel68.add(label99, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); pdfPerImgradioButton = new JRadioButton(); pdfPerImgradioButton.setSelected(true); this.$$$loadButtonText$$$(pdfPerImgradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "exppdf.single")); panel68.add(pdfPerImgradioButton, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); pdfCombinedradioButton = new JRadioButton(); this.$$$loadButtonText$$$(pdfCombinedradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "exppdf.combined")); panel68.add(pdfCombinedradioButton, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel69 = new JPanel(); panel69.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); panel66.add(panel69, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); panel69.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); exppdfDataText = new JLabel(); this.$$$loadLabelText$$$(exppdfDataText, this.$$$getMessageFromBundle$$$("translations/program_strings", "exppdf.whichdata")); panel69.add(exppdfDataText, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer21 = new Spacer(); panel69.add(spacer21, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel70 = new JPanel(); panel70.setLayout(new FlowLayout(FlowLayout.CENTER, 3, 5)); panel69.add(panel70, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); pdfradioButtonExpAll = new JRadioButton(); pdfradioButtonExpAll.setSelected(true); this.$$$loadButtonText$$$(pdfradioButtonExpAll, this.$$$getMessageFromBundle$$$("translations/program_strings", "vdtab.allradiobutton")); panel70.add(pdfradioButtonExpAll); pdfradioButtonExpCommonTags = new JRadioButton(); this.$$$loadButtonText$$$(pdfradioButtonExpCommonTags, this.$$$getMessageFromBundle$$$("translations/program_strings", "vdtab.commontags")); panel70.add(pdfradioButtonExpCommonTags); pdfcomboBoxExpCommonTags = new JComboBox(); panel70.add(pdfcomboBoxExpCommonTags); pdfradioButtonExpByTagName = new JRadioButton(); this.$$$loadButtonText$$$(pdfradioButtonExpByTagName, this.$$$getMessageFromBundle$$$("translations/program_strings", "vdtab.bygroup")); panel70.add(pdfradioButtonExpByTagName); pdfcomboBoxExpByTagName = new JComboBox(); panel70.add(pdfcomboBoxExpByTagName); pdfLabelSupported = new JLabel(); pdfLabelSupported.setText("Label"); panel66.add(pdfLabelSupported, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); final JPanel panel71 = new JPanel(); panel71.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); tabbedPaneExportImport.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "mmenu.exportsidecar"), panel71); final JPanel panel72 = new JPanel(); panel72.setLayout(new GridLayoutManager(4, 2, new Insets(10, 10, 10, 10), -1, -1)); panel71.add(panel72, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); exifSCradioButton = new JRadioButton(); exifSCradioButton.setSelected(true); this.$$$loadButtonText$$$(exifSCradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "esc.exiftitle")); panel72.add(exifSCradioButton, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer22 = new Spacer(); panel72.add(spacer22, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); xmpSCradioButton = new JRadioButton(); this.$$$loadButtonText$$$(xmpSCradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "esc.xmptitle")); panel72.add(xmpSCradioButton, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); mieSCradioButton = new JRadioButton(); this.$$$loadButtonText$$$(mieSCradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "esc.mietitle")); panel72.add(mieSCradioButton, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); exvSCradioButton = new JRadioButton(); this.$$$loadButtonText$$$(exvSCradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "esc.exvtitle")); panel72.add(exvSCradioButton, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel73 = new JPanel(); panel73.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel71.add(panel73, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); SidecarExportButton = new JButton(); this.$$$loadButtonText$$$(SidecarExportButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.export")); panel73.add(SidecarExportButton); SideCarHelpbutton = new JButton(); this.$$$loadButtonText$$$(SideCarHelpbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); panel73.add(SideCarHelpbutton); final Spacer spacer23 = new Spacer(); panel71.add(spacer23, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JPanel panel74 = new JPanel(); panel74.setLayout(new GridLayoutManager(5, 2, new Insets(10, 0, 10, 0), -1, -1)); panel55.add(panel74, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); final JLabel label100 = new JLabel(); Font label100Font = this.$$$getFont$$$(null, Font.BOLD, -1, label100.getFont()); if (label100Font != null) label100.setFont(label100Font); this.$$$loadLabelText$$$(label100, this.$$$getMessageFromBundle$$$("translations/program_strings", "fld.imagefolder")); panel74.add(label100, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); final JPanel panel75 = new JPanel(); panel75.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); panel74.add(panel75, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); ExpImgFoldertextField = new JTextField(); ExpImgFoldertextField.setPreferredSize(new Dimension(500, 25)); panel75.add(ExpImgFoldertextField); ExpBrowseButton = new JButton(); this.$$$loadButtonText$$$(ExpBrowseButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.browse")); panel75.add(ExpBrowseButton); ExpLeaveFolderEmptyLabel = new JLabel(); ExpLeaveFolderEmptyLabel.setText("ExpLeaveFolderEmptyLabel"); panel74.add(ExpLeaveFolderEmptyLabel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(650, -1), null, 1, false)); genExpfolderBrowseLabel = new JLabel(); genExpfolderBrowseLabel.setText("genExpfolderBrowseLabel"); panel74.add(genExpfolderBrowseLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); includeSubFoldersCheckBox = new JCheckBox(); this.$$$loadButtonText$$$(includeSubFoldersCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "fld.inclsubfolders")); panel74.add(includeSubFoldersCheckBox, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); final JPanel panel76 = new JPanel(); panel76.setLayout(new GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1)); panel76.setPreferredSize(new Dimension(800, -1)); tabbedPaneRight.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "maintab.exiftoolcommands"), panel76); final JPanel panel77 = new JPanel(); panel77.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1)); panel76.add(panel77, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); CommandsParameterstextField = new JTextField(); panel77.add(CommandsParameterstextField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label101 = new JLabel(); Font label101Font = this.$$$getFont$$$(null, Font.BOLD, -1, label101.getFont()); if (label101Font != null) label101.setFont(label101Font); this.$$$loadLabelText$$$(label101, this.$$$getMessageFromBundle$$$("translations/program_strings", "yc.parameters")); panel77.add(label101, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel78 = new JPanel(); panel78.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel77.add(panel78, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); CommandsclearParameterSFieldButton = new JButton(); this.$$$loadButtonText$$$(CommandsclearParameterSFieldButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "yc.btnclrparamfield")); panel78.add(CommandsclearParameterSFieldButton); CommandsclearOutputFieldButton = new JButton(); this.$$$loadButtonText$$$(CommandsclearOutputFieldButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "yc.btnclroutput")); panel78.add(CommandsclearOutputFieldButton); CommandsgoButton = new JButton(); this.$$$loadButtonText$$$(CommandsgoButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "yc.btngo")); panel78.add(CommandsgoButton); CommandshelpButton = new JButton(); this.$$$loadButtonText$$$(CommandshelpButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); panel78.add(CommandshelpButton); final Spacer spacer24 = new Spacer(); panel78.add(spacer24); final JPanel panel79 = new JPanel(); panel79.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5)); panel78.add(panel79); final Spacer spacer25 = new Spacer(); panel79.add(spacer25); AddCommandFavoritebutton = new JButton(); this.$$$loadButtonText$$$(AddCommandFavoritebutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "yc.btnaddfav")); panel79.add(AddCommandFavoritebutton); LoadCommandFavoritebutton = new JButton(); this.$$$loadButtonText$$$(LoadCommandFavoritebutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "yc.btnloadfav")); panel79.add(LoadCommandFavoritebutton); final JPanel panel80 = new JPanel(); panel80.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); panel77.add(panel80, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JLabel label102 = new JLabel(); this.$$$loadLabelText$$$(label102, this.$$$getMessageFromBundle$$$("translations/program_strings", "yc.labeloutput")); label102.setVerticalTextPosition(1); panel80.add(label102, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JScrollPane scrollPane1 = new JScrollPane(); panel80.add(scrollPane1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); YourCommandsOutputText = new JEditorPane(); YourCommandsOutputText.setText(""); scrollPane1.setViewportView(YourCommandsOutputText); final JPanel panel81 = new JPanel(); panel81.setLayout(new FlowLayout(FlowLayout.CENTER, 25, 5)); panel80.add(panel81, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); UseNonPropFontradioButton = new JRadioButton(); UseNonPropFontradioButton.setSelected(true); this.$$$loadButtonText$$$(UseNonPropFontradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "yc.radbtnmonospace")); panel81.add(UseNonPropFontradioButton); UsePropFontradioButton = new JRadioButton(); this.$$$loadButtonText$$$(UsePropFontradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "yc.radbtnproportional")); panel81.add(UsePropFontradioButton); MyCommandsText = new JLabel(); MyCommandsText.setText("MyCommandsText"); panel76.add(MyCommandsText, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(150, -1), null, 0, false)); final JPanel panel82 = new JPanel(); panel82.setLayout(new GridLayoutManager(5, 2, new Insets(10, 0, 10, 0), -1, -1)); panel76.add(panel82, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); panel82.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label103 = new JLabel(); Font label103Font = this.$$$getFont$$$(null, Font.BOLD, -1, label103.getFont()); if (label103Font != null) label103.setFont(label103Font); this.$$$loadLabelText$$$(label103, this.$$$getMessageFromBundle$$$("translations/program_strings", "fld.imagefolder")); panel82.add(label103, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); final JPanel panel83 = new JPanel(); panel83.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); panel82.add(panel83, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); ETCommandsFoldertextField = new JTextField(); ETCommandsFoldertextField.setPreferredSize(new Dimension(500, 25)); panel83.add(ETCommandsFoldertextField); ETCBrowseButton = new JButton(); this.$$$loadButtonText$$$(ETCBrowseButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.browse")); panel83.add(ETCBrowseButton); etcLeaveFolderEmptyLabel = new JLabel(); etcLeaveFolderEmptyLabel.setText("etcLeaveFolderEmptyLabel"); panel82.add(etcLeaveFolderEmptyLabel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(650, -1), null, 1, false)); etcFolderBrowseLabel = new JLabel(); etcFolderBrowseLabel.setText("etcExpfolderBrowseLabel"); panel82.add(etcFolderBrowseLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); etcIncludeSubFoldersCheckBox = new JCheckBox(); this.$$$loadButtonText$$$(etcIncludeSubFoldersCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "fld.inclsubfolders")); panel82.add(etcIncludeSubFoldersCheckBox, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); ButtonGroup buttonGroup; buttonGroup = new ButtonGroup(); buttonGroup.add(CalcNorthRadioButton); buttonGroup.add(CalcSouthRadioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(CalcEastradioButton); buttonGroup.add(CalcWestRadioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(copyAllMetadataSameGroupsRadiobutton); buttonGroup.add(copySelectiveMetadataradioButton); buttonGroup.add(copyAllMetadataRadiobutton); buttonGroup = new ButtonGroup(); buttonGroup.add(UseNonPropFontradioButton); buttonGroup.add(UsePropFontradioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(radioButtonViewAll); buttonGroup.add(radioButtoncommonTags); buttonGroup.add(radioButtonByTagName); buttonGroup.add(radioButtonCameraMakes); buttonGroup = new ButtonGroup(); buttonGroup.add(StringsKeywOverwriteradioButton); buttonGroup.add(StringsKeywAppendradioButton); buttonGroup.add(StringsKeywRemoveradioButton); buttonGroup.add(StringsKeywDontSaveradioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(StringsSubjectOverwriteradioButton); buttonGroup.add(StringsSubjectAppendradioButton); buttonGroup.add(StringsSubjectRemoveradioButton); buttonGroup.add(StringsSubjectDontSaveradioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(StringsIIPOverwriteradioButton); buttonGroup.add(StringsIIPAppendradioButton); buttonGroup.add(StringsIIPRemoveradioButton); buttonGroup.add(StringsIIPDontSaveradioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(copyAllMetdataToXMPRadioButton); buttonGroup.add(CopyArgsRadioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(tagsToExifradioButton); buttonGroup.add(tagsToXmpradioButton); buttonGroup.add(tagsToIptcradioButton); buttonGroup.add(tagsToGpsradioButton); buttonGroup.add(tagsToPdfradioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(exportFromUserCombisradioButton); buttonGroup.add(exportFromUserCombisradioButton); buttonGroup.add(catmetadataradioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(txtRadioButton); buttonGroup.add(tabRadioButton); buttonGroup.add(xmlRadioButton); buttonGroup.add(htmlRadioButton); buttonGroup.add(XMPRadioButton); buttonGroup.add(csvRadioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(A4radioButton); buttonGroup.add(LetterradioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(pdfPerImgradioButton); buttonGroup.add(pdfCombinedradioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(pdfradioButtonExpAll); buttonGroup.add(pdfradioButtonExpCommonTags); buttonGroup.add(pdfradioButtonExpByTagName); buttonGroup = new ButtonGroup(); buttonGroup.add(exifSCradioButton); buttonGroup.add(xmpSCradioButton); buttonGroup.add(mieSCradioButton); buttonGroup.add(exvSCradioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(radioButtonComma); buttonGroup.add(radioButtonColon); buttonGroup.add(radioButtonSemiColon); buttonGroup.add(radioButtonHash); buttonGroup.add(radioButtonOther); } /** * @noinspection ALL */ private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) { if (currentFont == null) return null; String resultName; if (fontName == null) { resultName = currentFont.getName(); } else { Font testFont = new Font(fontName, Font.PLAIN, 10); if (testFont.canDisplay('a') && testFont.canDisplay('1')) { resultName = fontName; } else { resultName = currentFont.getName(); } } Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize()); boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac"); Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize()); return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadLabelText$$$(JLabel component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setDisplayedMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return rootPanel; } private void createUIComponents() { // TODO: place custom component creation code here } // endregion // region Action Listeners and radio button groups /* / The SpecialMenuActionListener is a menu listener for the special function loadImages that is so tightly integrated / with the Gui that we can't take it out. */ public class SpecialMenuActionListener implements ActionListener { public void actionPerformed(ActionEvent ev) { String[] dummy = null; logger.info("Selected: {}", ev.getActionCommand()); switch (ev.getActionCommand()) { case "Load Images": logger.debug("menu File -> Load Images pressed"); // identical to button "Load Images" files = Utils.loadImages("images", rootPanel, LeftPanel, LeftTableScrollPanel, LeftGridScrollPanel, tableListfiles, previewTable, iconViewList, ListexiftoolInfotable, commandButtons(), mainScreenLabels(), progressBar, whichRBselected(), getLoadOptions()); break; case "Load Directory": logger.debug("menu File -> Load Folder pressed"); // identical to button "Load Directory" files = Utils.loadImages("folder", rootPanel, LeftPanel, LeftTableScrollPanel, LeftGridScrollPanel, tableListfiles, previewTable, iconViewList, ListexiftoolInfotable, commandButtons(), mainScreenLabels(), progressBar, whichRBselected(), getLoadOptions()); break; default: break; } } } /** * Add a popup menu to the left tablelistfiles table to handle insertion and * deletion of rows. */ public void createPopupMenu(JPopupMenu myPopupMenu) { //JPopupMenu myPopupMenu = new JPopupMenu(); // Menu items. JMenuItem menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("fmenu.loaddirectory")); // index 0 menuItem.addActionListener(new MyPopupMenuHandler()); myPopupMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("fmenu.loadimages")); // index 1 menuItem.addActionListener(new MyPopupMenuHandler()); myPopupMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("btn.displayimages")); // index 2 menuItem.addActionListener(new MyPopupMenuHandler()); myPopupMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("btn.compareimgs")); // index 3 menuItem.addActionListener(new MyPopupMenuHandler()); myPopupMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("btn.slideshow")); // index 4 menuItem.addActionListener(new MyPopupMenuHandler()); myPopupMenu.add(menuItem); tableListfiles.addMouseListener(new MyPopupListener()); } /** * Listen for popup menu invocation. * Need both mousePressed and mouseReleased for cross platform support. */ public class MyPopupListener extends MouseAdapter { @Override public void mousePressed(MouseEvent e) { showPopup(e); } @Override public void mouseReleased(MouseEvent e) { showPopup(e); } private void showPopup(MouseEvent e) { if (e.isPopupTrigger()) { // Enable or disable the "Display Image" and "Sildeshow" menu item // depending on whether a row is selected. myPopupMenu.getComponent(2).setEnabled( tableListfiles.getSelectedRowCount() > 0); myPopupMenu.getComponent(4).setEnabled( tableListfiles.getSelectedRowCount() > 0); // Enable or disable "Compare images" >= 2 rows selected myPopupMenu.getComponent(3).setEnabled( tableListfiles.getSelectedRowCount() > 1); myPopupMenu.show(e.getComponent(), e.getX(), e.getY()); } } } /** * Handle popup menu commands. */ class MyPopupMenuHandler implements ActionListener { /** * Popup menu actions. * * @param e the menu event. */ @Override public void actionPerformed(ActionEvent e) { JMenuItem item = (JMenuItem) e.getSource(); if (item.getText().equals(ResourceBundle.getBundle("translations/program_strings").getString("fmenu.loaddirectory"))) { } else if (item.getText().equals(ResourceBundle.getBundle("translations/program_strings").getString("fmenu.loadimages"))) { //loadImages(e); } else if (item.getText().equals(ResourceBundle.getBundle("translations/program_strings").getString("btn.displayimages"))) { //loadImages(e); } else if (item.getText().equals(ResourceBundle.getBundle("translations/program_strings").getString("btn.compareimgs"))) { //loadImages(e); } else if (item.getText().equals(ResourceBundle.getBundle("translations/program_strings").getString("btn.slideshow"))) { //loadImages(e); } } } private void leftPanePopupMenuLister() { //JPopupMenu myPopupMenu = new JPopupMenu(); //LeftPanePopupMenuListener lpppml = new LeftPanePopupMenuListener(tableListfiles, myPopupMenu); //addPopupMenu(); } /* / the programButtonListeners functions brings all buttons from the main screen together in one method. / Where possible, the actionlistener will be put externally to the GuiActionListeners class. / Only the buttons that are too "intimately" coupled to the Gui and can't be moved, will be dealt with / directly in this method. Unfortunately that are quite some buttons. */ private void programButtonListeners() { ButtonsActionListener gal = new ButtonsActionListener(rootPanel, OutputLabel, CommandsParameterstextField, geotaggingImgFoldertextField, geotaggingGPSLogtextField, UserCombiscomboBox, ExpImgFoldertextField, ETCommandsFoldertextField); selectedIndicesList = MyVariables.getselectedIndicesList(); // Main screen left panel buttonLoadImages.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { logger.debug("button buttonLoadImages pressed"); //File opener: Load the images; identical to Menu option Load Images. files = Utils.loadImages("images", rootPanel, LeftPanel, LeftTableScrollPanel, LeftGridScrollPanel, tableListfiles, previewTable, iconViewList, ListexiftoolInfotable, commandButtons(), mainScreenLabels(), progressBar, whichRBselected(), getLoadOptions()); } }); buttonLoadDirectory.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { logger.debug("button buttonLoadFolder pressed"); //File opener: Load folder with images; identical to Menu option Load Directory. files = Utils.loadImages("folder", rootPanel, LeftPanel, LeftTableScrollPanel, LeftGridScrollPanel, tableListfiles, previewTable, iconViewList, ListexiftoolInfotable, commandButtons(), mainScreenLabels(), progressBar, whichRBselected(), getLoadOptions()); } }); buttonShowImage.setActionCommand("bSI"); buttonShowImage.addActionListener(gal); //buttonCompare.setActionCommand("bCo"); //buttonCompare.addActionListener(gal); buttonCompare.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); logger.info("buttonCompare pressed"); if (selectedIndicesList.size() > 25) { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.max25imgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.max25imgs"), JOptionPane.WARNING_MESSAGE); } else if ( (selectedIndicesList != null) && (selectedIndicesList.size() > 0) ) { //List<String[]> allMetadata = CompareImages.CompareImages(selectedIndicesList, whichRBselected(), progressBar, OutputLabel); CompareImages.CompareImages(selectedIndicesList, whichRBselected(), progressBar, OutputLabel); //CompareImagesWindow.Initialize(allMetadata); }else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); //buttonSearchMetadata.setActionCommand("SearchMetadata"); //buttonSearchMetadata.addActionListener(gal); buttonSearchMetadata.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { logger.debug("buttonSearchMetadata pressed"); // Works on loaded images, not on selected images SearchMetadataDialog SMD = new SearchMetadataDialog(); String searchPhrase = SMD.displayDialog(rootPanel); if ( (searchPhrase != null) && !(searchPhrase.isEmpty()) ) { MyVariables.setSearchPhrase(searchPhrase); logger.debug("searchPhrase: {}", searchPhrase); List<String> result = SearchMetaData.searchMetaData(rootPanel, searchPhrase); if ( (result != null) && !(result.isEmpty())) { for (String line : result) { logger.debug("found key or value {}",line); } FoundMetaData FMD = new FoundMetaData(); FMD.showDialog(rootPanel, result); // Very dirty way of getting results from another class to see if we need to relaod the images from the search result if (MyVariables.getreloadImagesFromSearchResult()) { Utils.loadImages("reloadfromsearchresult", rootPanel, LeftPanel, LeftTableScrollPanel, LeftGridScrollPanel, tableListfiles, previewTable, iconViewList, ListexiftoolInfotable, commandButtons(), mainScreenLabels(), progressBar, whichRBselected(), getLoadOptions()); } } else { JOptionPane.showMessageDialog(rootPanel, (ResourceBundle.getBundle("translations/program_strings").getString("smd.nothingfoundtxt") + " \"" + searchPhrase) + "\".", ResourceBundle.getBundle("translations/program_strings").getString("smd.nothingfoundtitle"), JOptionPane.WARNING_MESSAGE); } } } }); leftCheckBoxBarHelpButton.setActionCommand("lCBBHB"); leftCheckBoxBarHelpButton.addActionListener(gal); // Your Commands pane buttons CommandsclearParameterSFieldButton.setActionCommand("CommandsclearPSFB"); CommandsclearParameterSFieldButton.addActionListener(gal); CommandsclearOutputFieldButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { YourCommandsOutputText.setText(""); } }); ETCBrowseButton.setActionCommand("etCmdBtn"); ETCBrowseButton.addActionListener(gal); CommandsgoButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) || (!("".equals(ETCommandsFoldertextField.getText()))) ) { if (CommandsParameterstextField.getText().length() > 0) { OutputLabel.setText(ResourceBundle.getBundle("translations/program_strings").getString("pt.yourcommands")); YourCmnds.executeCommands(CommandsParameterstextField.getText(), YourCommandsOutputText, UseNonPropFontradioButton, progressBar, ETCommandsFoldertextField.getText(), etcIncludeSubFoldersCheckBox.isSelected()); OutputLabel.setText(ResourceBundle.getBundle("translations/program_strings").getString("pt.yourcommandsoutput")); } else { JOptionPane.showMessageDialog(rootPanel, ResourceBundle.getBundle("translations/program_strings").getString("msd.nocommandparams"), ResourceBundle.getBundle("translations/program_strings").getString("msd.nocommandparams"), JOptionPane.WARNING_MESSAGE); } } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); CommandshelpButton.setActionCommand("CommandshB"); CommandshelpButton.addActionListener(gal); AddCommandFavoritebutton.setActionCommand("ACommFavorb"); AddCommandFavoritebutton.addActionListener(gal); LoadCommandFavoritebutton.setActionCommand("LCommFavb"); LoadCommandFavoritebutton.addActionListener(gal); // Edit Exif pane buttons ExifcopyFromButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { EEd.copyExifFromSelected(getExifFields(), ExifDescriptiontextArea); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); ExifsaveToButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { EEd.writeExifTags(getExifFields(), ExifDescriptiontextArea, getExifBoxes(), progressBar); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); ExifcopyDefaultsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { setArtistCreditsCopyrightDefaults(); } }); resetFieldsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { EEd.resetFields(getExifFields(), ExifDescriptiontextArea); } }); ExifhelpButton.setActionCommand("ExifhB"); ExifhelpButton.addActionListener(gal); // Edit xmp buttons xmpCopyFrombutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { EXd.copyXmpFromSelected(getXmpFields(), xmpDescriptiontextArea); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); xmpSaveTobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { EXd.writeXmpTags(getXmpFields(), xmpDescriptiontextArea, getXmpBoxes(), progressBar); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); xmpCopyDefaultsbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { setArtistCreditsCopyrightDefaults(); } }); xmpResetFieldsbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { EXd.resetFields(getXmpFields(), xmpDescriptiontextArea); } }); xmpHelpbutton.setActionCommand("xmpHB"); xmpHelpbutton.addActionListener(gal); // Edit geotagging buttons geotaggingImgFolderbutton.setActionCommand("geoIFb"); geotaggingImgFolderbutton.addActionListener(gal); geotaggingGPSLogbutton.setActionCommand("geoGPSLb"); geotaggingGPSLogbutton.addActionListener(gal); geotaggingWriteInfobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { //selectedIndicesList = MyVariables.getselectedIndicesList(); if ( ("".equals(geotaggingImgFoldertextField.getText())) && ( (selectedIndicesList == null) || (selectedIndicesList.size() == 0) ) ) { JOptionPane.showMessageDialog(rootPanel, ResourceBundle.getBundle("translations/program_strings").getString("msd.geonoimgpathlong"), ResourceBundle.getBundle("translations/program_strings").getString("msd.geonoimgpath"), JOptionPane.WARNING_MESSAGE); } else { if ("".equals(geotaggingGPSLogtextField.getText())) { // We do need a logfile JOptionPane.showMessageDialog(rootPanel, ResourceBundle.getBundle("translations/program_strings").getString("msd.geonolog"), ResourceBundle.getBundle("translations/program_strings").getString("msd.geonolog"), JOptionPane.WARNING_MESSAGE); } else { // We have a log file selectedIndicesList = MyVariables.getselectedIndicesList(); if ( (selectedIndicesList == null) || (selectedIndicesList.size() == 0) ) { //we have no images selected but the folder is selected EGd.writeInfo(false, getGeotaggingFields(), getGeotaggingBoxes(), geotaggingOverwriteOriginalscheckBox.isSelected(), progressBar); } else { EGd.writeInfo(true, getGeotaggingFields(), getGeotaggingBoxes(), geotaggingOverwriteOriginalscheckBox.isSelected(), progressBar); } } } OutputLabel.setText(""); } }); resetGeotaggingbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { EGd.ResetFields(getGeotaggingFields(), getGeotaggingBoxes()); } }); geotaggingHelpbutton.setActionCommand("geotHb"); geotaggingHelpbutton.addActionListener(gal); // Edit gps buttons gpsCopyFrombutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { EGPSd.copyGPSFromSelected(getNumGPSdecFields(), getGPSLocationFields(), getGpsBoxes(),getGPSdmsFields(), getGPSdmsradiobuttons()); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); gpsSaveTobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { EGPSd.writeGPSTags(getNumGPSdecFields(), getGPSLocationFields(), getGpsBoxes(), getGPSdmsFields(), getGPSdmsradiobuttons(), progressBar, geoformattabbedPane.getSelectedIndex(), rootPanel); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); gpsResetFieldsbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { EGPSd.resetFields(getNumGPSdecFields(), getGPSLocationFields(), getGPSdmsFields()); } }); gpsMapcoordinatesbutton.setActionCommand("gpsMcb"); gpsMapcoordinatesbutton.addActionListener(gal); gpssearchLocationButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { logger.debug("button gpsSearchLocationbutton pressed"); JxMapViewer JMV = new JxMapViewer(); Map<String, String> place = JMV.showDialog( ""); // Search using empty fields if (!"empty".equals(place.get("empty"))) { if (place.get("saveGpsLocation").equals("true")) { gpsLatDecimaltextField.setText(place.get("geoLatitude")); gpsLonDecimaltextField.setText(place.get("geoLongitude")); } gpsStateProvincetextField.setText(place.get("state")); gpsCountrytextField.setText(place.get("country")); gpsLocationtextField.setText(place.get("display_Name")); if (!(place.get("city") == null)) { gpsCitytextField.setText(place.get("city")); } else if (!(place.get("town") == null)) { gpsCitytextField.setText(place.get("town")); } else if (!(place.get("village") == null)) { gpsCitytextField.setText(place.get("village")); } else if (!(place.get("hamlet") == null)) { gpsCitytextField.setText(place.get("hamlet")); } else if (!(place.get("isolated_dwelling") == null)) { gpsCitytextField.setText(place.get("isolated_dwelling")); } } // Now do the dec-min-sec fields String[] dmsLat = EGPSd.decDegToDegMinSec(place.get("geoLatitude")); CalcLatDegtextField.setText(dmsLat[0]); CalcLatMintextField.setText(dmsLat[1]); CalcLatSectextField.setText(dmsLat[2]); if (place.get("geoLatitude").startsWith("-")) { // Negative means South CalcSouthRadioButton.setSelected(true); } else { CalcNorthRadioButton.setSelected(true); } String[] dmsLon = EGPSd.decDegToDegMinSec(place.get("geoLongitude")); CalcLonDegtextField.setText(dmsLon[0]); CalcLonMintextField.setText(dmsLon[1]); CalcLonSectextField.setText(dmsLon[2]); if (place.get("geoLongitude").startsWith("-")) { CalcWestRadioButton.setSelected(true); } else { CalcEastradioButton.setSelected(true); } } }); gpssearchLocationButtonCoordinates.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { String coordinates = ""; logger.debug("button gpsSearchLocationbutton pressed"); if ( (gpsLatDecimaltextField.getText()==null) || ("".equals(gpsLatDecimaltextField.getText())) || (gpsLonDecimaltextField.getText()==null) || ("".equals(gpsLonDecimaltextField.getText())) ) { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("gps.nocoordinatestxt")), ResourceBundle.getBundle("translations/program_strings").getString("gps.nocoordinates"), JOptionPane.WARNING_MESSAGE); } else { coordinates = gpsLatDecimaltextField.getText() + ", " + gpsLonDecimaltextField.getText(); } JxMapViewer JMV = new JxMapViewer(); Map<String, String> place = JMV.showDialog(coordinates); // Search using empty fields if (!"empty".equals(place.get("empty"))) { if (place.get("saveGpsLocation").equals("true")) { gpsLatDecimaltextField.setText(place.get("geoLatitude")); gpsLonDecimaltextField.setText(place.get("geoLongitude")); } gpsStateProvincetextField.setText(place.get("state")); gpsCountrytextField.setText(place.get("country")); gpsLocationtextField.setText(place.get("display_Name")); if (!(place.get("city") == null)) { gpsCitytextField.setText(place.get("city")); } else if (!(place.get("town") == null)) { gpsCitytextField.setText(place.get("town")); } else if (!(place.get("village") == null)) { gpsCitytextField.setText(place.get("village")); } else if (!(place.get("hamlet") == null)) { gpsCitytextField.setText(place.get("hamlet")); } else if (!(place.get("isolated_dwelling") == null)) { gpsCitytextField.setText(place.get("isolated_dwelling")); } } // Now do the dec-min-sec fields String[] dmsLat = EGPSd.decDegToDegMinSec(place.get("geoLatitude")); CalcLatDegtextField.setText(dmsLat[0]); CalcLatMintextField.setText(dmsLat[1]); CalcLatSectextField.setText(dmsLat[2]); if (place.get("geoLatitude").startsWith("-")) { // Negative means South CalcSouthRadioButton.setSelected(true); } else { CalcNorthRadioButton.setSelected(true); } String[] dmsLon = EGPSd.decDegToDegMinSec(place.get("geoLongitude")); CalcLonDegtextField.setText(dmsLon[0]); CalcLonMintextField.setText(dmsLon[1]); CalcLonSectextField.setText(dmsLon[2]); if (place.get("geoLongitude").startsWith("-")) { CalcWestRadioButton.setSelected(true); } else { CalcEastradioButton.setSelected(true); } } }); gpsHelpbutton.addActionListener(gal); gpsHelpbutton.setActionCommand("gpsHb"); decimalToMinutesSecondsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { // We will not use this one } }); minutesSecondsToDecimalButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { // Here is where we calculate the degrees-minutes-seconds to decimal values String[] calc_lat_lon = new String[2]; String[] input_lat_lon = new String[8]; for (JFormattedTextField calcfield : getGPSdmsFields()) { if (calcfield.getText().isEmpty()) { calcfield.setText("0"); } } input_lat_lon[0] = CalcLatDegtextField.getText(); input_lat_lon[1] = CalcLatMintextField.getText(); input_lat_lon[2] = CalcLatSectextField.getText(); if (CalcNorthRadioButton.isSelected()) { input_lat_lon[3] = "N"; } else { input_lat_lon[3] = "S"; } input_lat_lon[4] = CalcLonDegtextField.getText(); input_lat_lon[5] = CalcLonMintextField.getText(); input_lat_lon[6] = CalcLonSectextField.getText(); if (CalcEastradioButton.isSelected()) { input_lat_lon[7] = "E"; } else { input_lat_lon[7] = "W"; } try { calc_lat_lon = Utils.gpsCalculator(rootPanel, input_lat_lon); } catch (ParseException e) { logger.error("Error converting deg-min-sec to decimal degrees {}", e.toString()); e.printStackTrace(); } //Utils.gpsCalculator(CalcLatDegtextField.getText(), CalcLatMintextField.getText(), CalcLatSectextField.getText(), CalcLonDegtextField.getText(), CalcLonDegtextField.getText(), CalcLonMintextField.getText(), CalcLonSectextField.getText()); if (!"error".equals(calc_lat_lon[0])) { CalcLatDecimaltextLabel.setText(calc_lat_lon[0]); CalcLonDecimaltextLabel.setText(calc_lat_lon[1]); } } }); copyToInputFieldsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { // This will copy the calculated values to the lat/lon input fields gpsLatDecimaltextField.setText( CalcLatDecimaltextLabel.getText() ); gpsLonDecimaltextField.setText( CalcLonDecimaltextLabel.getText() ); } }); // Copy metadata buttons from first copy data tab copyAllMetadataRadiobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { Utils.setCopyMetaDatacheckboxes(false, getCopyMetaDatacheckboxes()); } }); copyAllMetadataSameGroupsRadiobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { Utils.setCopyMetaDatacheckboxes(false, getCopyMetaDatacheckboxes()); } }); copySelectiveMetadataradioButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { Utils.setCopyMetaDatacheckboxes(true, getCopyMetaDatacheckboxes()); } }); UseDataFrombutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { SelectedCopyFromImageIndex = SelectedRowOrIndex; } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); CopyDataCopyTobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { //metaData.copyMetaData(getCopyMetaDataRadiobuttons(), getCopyMetaDataCheckBoxes(), SelectedCopyFromImageIndex, selectedIndices, files, progressBar); metaData.copyMetaData(rootPanel, getCopyMetaDataRadiobuttons(), getCopyMetaDataCheckBoxes(), SelectedCopyFromImageIndex, progressBar); } }); CopyHelpbutton.setActionCommand("CopyHb"); CopyHelpbutton.addActionListener(gal); //Copydata 2nd tab, copy inside image copyAllMetdataToXMPRadioButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { Utils.setInsideCopyCheckboxesRadiobuttons(false, getInsideImageSubCopyRadiobuttons(), getInsideImageCopyCheckboxes()); } }); CopyArgsRadioButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { Utils.setInsideCopyCheckboxesRadiobuttons(true, getInsideImageSubCopyRadiobuttons(), getInsideImageCopyCheckboxes()); } }); copyInsideSaveDataTo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { metaData.copyInsideMetaData(rootPanel, getInsideImageCopyRadiobuttons(), getInsideImageSubCopyRadiobuttons(), getInsideImageCopyCheckboxes(), OutputLabel); OutputLabel.setText(""); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); // The buttons from the Gpano edit tab gpanoCopyFrombutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { EGpanod.copyGpanoFromSelected(getGpanoFields(), gpanoStitchingSoftwaretextField, gpanoPTcomboBox, getGpanoCheckBoxes()); JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 450, ResourceBundle.getBundle("translations/program_strings").getString("gpano.savecheckboxestxt")), ResourceBundle.getBundle("translations/program_strings").getString("gpano.savecheckboxestitle"), JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); gpanoCopyTobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { // Now we need to check on completeness of mandatory fields boolean allFieldsFilled = EGpanod.checkFieldsOnNotBeingEmpty(getGpanoFields(), gpanoPTcomboBox); if (allFieldsFilled) { EGpanod.writeGpanoTags(getGpanoFields(), getGpanoCheckBoxes(), gpanoStitchingSoftwaretextField, gpanoPTcomboBox, progressBar); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 450, ResourceBundle.getBundle("translations/program_strings").getString("gpano.mandatoryfilestxt")), ResourceBundle.getBundle("translations/program_strings").getString("gpano.mandatoryfilestitle"), JOptionPane.WARNING_MESSAGE); } } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); gpanoResetFieldsbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { EGpanod.resetFields(getGpanoFields(), gpanoStitchingSoftwaretextField, getGpanoCheckBoxes()); } }); gpanoHelpbutton.setActionCommand("gpanoHb"); gpanoHelpbutton.addActionListener(gal); // The buttons from the lens tab lensCopyFrombutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { ELd.copyLensDataFromSelected(getLensFields(), meteringmodecomboBox, getLensCheckBoxes()); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); lensSaveTobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { ELd.writeLensTags(getLensFields(), getLensCheckBoxes(), meteringmodecomboBox, progressBar); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); lensResetFieldsbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { ELd.resetFields(getLensFields(), getLensCheckBoxes(), meteringmodecomboBox); } }); lensHelpbutton.setActionCommand("lensHb"); lensHelpbutton.addActionListener(gal); saveLensConfigurationbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { ELd.saveLensconfig(getLensFields(), meteringmodecomboBox, rootPanel); } }); loadLensConfigurationButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { ELd.loadLensconfig(getLensFields(), meteringmodecomboBox, rootPanel); } }); // The buttons from the XMP_IPTC_String+ tab stringPlusCopyFrombutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { ESd.copyStringPlusFromSelected(getstringPlusFields(), stringPlusOverwriteOriginalscheckBox); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); stringPlusSaveTobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { ESd.writeStringPlusTags(getstringPlusFields(), stringPlusOverwriteOriginalscheckBox, getSelectedRadioButtons(), getSeparatorString(), progressBar); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); stringPlusResetFieldsbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { ESd.resetFields(getstringPlusFields(), stringPlusOverwriteOriginalscheckBox ); } }); stringPlusHelpbutton.setActionCommand("sPHb"); stringPlusHelpbutton.addActionListener(gal); // Button listeners for the User defined metadata combinations tab udcCreateNewButton.setActionCommand("udcCNB"); udcCreateNewButton.addActionListener(gal); UserCombiscomboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { EUDC.UpdateTable(rootPanel, UserCombiscomboBox, UserCombiScrollPane); EUDC.UpdateCustomConfigLabel(UserCombiscomboBox, CustomConfiglabel); } }); udcCopyFrombutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { if (MyVariables.getuserCombiTableValues() == null || MyVariables.getuserCombiTableValues().size() == 0) // Only update table only if user has not selected one EUDC.UpdateTable(rootPanel, UserCombiscomboBox, UserCombiScrollPane); EUDC.CopyFromSelectedImage(); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); udcSaveTobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) { EUDC.SaveTableValues(udcOverwriteOriginalscheckBox, progressBar); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); udcResetFieldsbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { // Defined here for program consistency but not used // as the user can simply "reset" from the dropdown. } }); udcHelpbutton.setActionCommand("udcHb"); udcHelpbutton.addActionListener(gal); //Listeners for the Export subtab ExpBrowseButton.setActionCommand("expIFb"); ExpBrowseButton.addActionListener(gal); exportAllMetadataCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (catmetadataradioButton.isSelected()) { exportExifDataCheckBox.setEnabled(true); exportXmpDataCheckBox.setEnabled(true); exportGpsDataCheckBox.setEnabled(true); exportIptcDataCheckBox.setEnabled(true); exportICCDataCheckBox.setEnabled(true); exportAllMetadataCheckBox.setEnabled(true); if (exportAllMetadataCheckBox.isSelected()) { exportExifDataCheckBox.setSelected(true); exportXmpDataCheckBox.setSelected(true); exportGpsDataCheckBox.setSelected(true); exportIptcDataCheckBox.setSelected(true); exportICCDataCheckBox.setSelected(true); } else { exportExifDataCheckBox.setSelected(false); exportXmpDataCheckBox.setSelected(false); exportGpsDataCheckBox.setSelected(false); exportIptcDataCheckBox.setSelected(false); exportICCDataCheckBox.setSelected(false); } exportUserCombicomboBox.setEnabled(false); } } }); exportFromUserCombisradioButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (exportFromUserCombisradioButton.isSelected()) { exportUserCombicomboBox.setEnabled(true); exportExifDataCheckBox.setEnabled(false); exportXmpDataCheckBox.setEnabled(false); exportGpsDataCheckBox.setEnabled(false); exportIptcDataCheckBox.setEnabled(false); exportICCDataCheckBox.setEnabled(false); exportAllMetadataCheckBox.setEnabled(false); } /*else { userCombicomboBox.setEnabled(true); exportExifDataCheckBox.setEnabled(false); exportXmpDataCheckBox.setEnabled(false); exportGpsDataCheckBox.setEnabled(false); exportIptcDataCheckBox.setEnabled(false); exportICCDataCheckBox.setEnabled(false); exportAllMetadataCheckBox.setSelected(false); }*/ } }); catmetadataradioButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (catmetadataradioButton.isSelected()) { exportExifDataCheckBox.setEnabled(true); exportXmpDataCheckBox.setEnabled(true); exportGpsDataCheckBox.setEnabled(true); exportIptcDataCheckBox.setEnabled(true); exportICCDataCheckBox.setEnabled(true); exportAllMetadataCheckBox.setEnabled(true); exportUserCombicomboBox.setEnabled(false); } } }); GenExportbuttonOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectedIndicesList = MyVariables.getselectedIndicesList(); if ( ( !(selectedIndicesList == null) && (selectedIndicesList.size() > 0) ) || (!("".equals(ExpImgFoldertextField.getText()))) ) { ExportMetadata.writeExport(rootPanel, getGeneralExportRadiobuttons(), getGeneralExportCheckButtons(), exportUserCombicomboBox, progressBar, ExpImgFoldertextField.getText(), includeSubFoldersCheckBox.isSelected()); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); ExpPDFOKbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if ( (!(selectedIndicesList == null) && (selectedIndicesList.size() > 0)) || (!("".equals(ExpImgFoldertextField.getText()))) ) { MyVariables.setpdfDocs(""); ExportToPDF.CreatePDFs(rootPanel, getPDFradiobuttons(), getPDFcomboboxes(), progressBar, OutputLabel, ExpImgFoldertextField.getText(), includeSubFoldersCheckBox.isSelected()); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); SidecarExportButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if ( (!(selectedIndicesList == null) && (selectedIndicesList.size() > 0)) || (!("".equals(ExpImgFoldertextField.getText()))) ) { ExportMetadata.SidecarChoices(getSCradiobuttons(), rootPanel, progressBar, OutputLabel, ExpImgFoldertextField.getText(), includeSubFoldersCheckBox.isSelected()); } else { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgslong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.noimgs"), JOptionPane.WARNING_MESSAGE); } } }); SideCarHelpbutton.setActionCommand("sidecarhelp"); SideCarHelpbutton.addActionListener(gal); } // End of private void programButtonListeners() private void ViewRadiobuttonListener() { //Add listeners radioButtonViewAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); //logger.info("MyVariables.getSelectedRowOrIndex {}", MyVariables.getSelectedRowOrIndex()); if ( !(selectedRowOrIndex == MyConstants.IMPOSSIBLE_INDEX) ) { logger.info("radiobutton selected: {}", radioButtonViewAll.getText()); MyVariables.setmainScreenParams(whichRBselected()); String res = Utils.getImageInfoFromSelectedFile(MyConstants.ALL_PARAMS); Utils.displayInfoForSelectedImage(res, ListexiftoolInfotable); //int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); //File[] files = MyVariables.getLoadedFiles(); if (res.startsWith("jExifToolGUI")) { lblFileNamePath.setText(" "); } else { lblFileNamePath.setText(files[selectedRowOrIndex].getPath()); } } else { logger.debug("radiobutton/dropdown action but no files loaded"); } } }); radioButtoncommonTags.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); //logger.info("MyVariables.getSelectedRowOrIndex {}", MyVariables.getSelectedRowOrIndex()); if ( !(selectedRowOrIndex == MyConstants.IMPOSSIBLE_INDEX) ) { logger.info("radiobutton selected: {}", radioButtoncommonTags.getText()); MyVariables.setmainScreenParams(whichRBselected()); String[] params = Utils.getWhichCommonTagSelected(comboBoxViewCommonTags); //Utils.selectImageInfoByTagName(comboBoxViewCommonTags, SelectedRowOrIndex, files, mainScreen.this.ListexiftoolInfotable); String res = Utils.getImageInfoFromSelectedFile(params); Utils.displayInfoForSelectedImage(res, ListexiftoolInfotable); //int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); if (res.startsWith("jExifToolGUI")) { lblFileNamePath.setText(" "); } else { lblFileNamePath.setText(files[selectedRowOrIndex].getPath()); } } else { logger.debug("radiobutton/dropdown action but no files loaded"); } } }); comboBoxViewCommonTags.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); //logger.info("MyVariables.getSelectedRowOrIndex {}", MyVariables.getSelectedRowOrIndex()); if ( !(selectedRowOrIndex == MyConstants.IMPOSSIBLE_INDEX) ) { if (radioButtoncommonTags.isSelected()) { MyVariables.setmainScreenParams(whichRBselected()); String[] params = Utils.getWhichCommonTagSelected(comboBoxViewCommonTags); //Utils.selectImageInfoByTagName(comboBoxViewCommonTags, SelectedRowOrIndex, files, mainScreen.this.ListexiftoolInfotable); String res = Utils.getImageInfoFromSelectedFile(params); Utils.displayInfoForSelectedImage(res, ListexiftoolInfotable); //int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); //File[] files = MyVariables.getLoadedFiles(); if (res.startsWith("jExifToolGUI")) { lblFileNamePath.setText(" "); } else { lblFileNamePath.setText(files[selectedRowOrIndex].getPath()); } } } else { logger.debug("radiobutton/dropdown action but no files loaded"); } } }); radioButtonByTagName.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); if ( !(selectedRowOrIndex == MyConstants.IMPOSSIBLE_INDEX) ) { MyVariables.setmainScreenParams(whichRBselected()); String res = Utils.selectImageInfoByTagName(comboBoxViewByTagName, files); Utils.displayInfoForSelectedImage(res, ListexiftoolInfotable); } else { logger.debug("radiobutton/dropdown action but no files loaded"); } } }); comboBoxViewByTagName.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); if ( !(selectedRowOrIndex == MyConstants.IMPOSSIBLE_INDEX) ) { if (radioButtonByTagName.isSelected()) { MyVariables.setmainScreenParams(whichRBselected()); String res = Utils.selectImageInfoByTagName(comboBoxViewByTagName, files); Utils.displayInfoForSelectedImage(res, ListexiftoolInfotable); } } else { logger.debug("radiobutton/dropdown action but no files loaded"); } } }); radioButtonCameraMakes.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); if ( !(selectedRowOrIndex == MyConstants.IMPOSSIBLE_INDEX) ) { MyVariables.setmainScreenParams(whichRBselected()); String res = Utils.selectImageInfoByTagName(comboBoxViewCameraMake, files); Utils.displayInfoForSelectedImage(res, ListexiftoolInfotable); } else { logger.debug("radiobutton/dropdown action but no files loaded"); } } }); comboBoxViewCameraMake.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); if ( !(selectedRowOrIndex == MyConstants.IMPOSSIBLE_INDEX) ) { if (radioButtonCameraMakes.isSelected()) { MyVariables.setmainScreenParams(whichRBselected()); String res = Utils.selectImageInfoByTagName(comboBoxViewCameraMake, files); Utils.displayInfoForSelectedImage(res, ListexiftoolInfotable); } } else { logger.debug("radiobutton/dropdown action but no files loaded"); } } }); } // radioButtonViewAll, radioButtoncommonTags, public String[] whichRBselected() { // just to make sure anything is returned we defaultly return all String[] params = MyConstants.ALL_PARAMS; // Very simple if list if (mainScreen.this.radioButtonViewAll.isSelected()) { params = MyConstants.ALL_PARAMS; } else if (radioButtoncommonTags.isSelected()) { params = Utils.getWhichCommonTagSelected(comboBoxViewCommonTags); } else if (radioButtonByTagName.isSelected()) { params = Utils.getWhichTagSelected(comboBoxViewByTagName); } else if (radioButtonCameraMakes.isSelected()) { params = Utils.getWhichTagSelected(comboBoxViewCameraMake); } logger.debug("MyVariables.setmainScreenParams(params) {}", String.join(",", params)); MyVariables.setmainScreenParams(params); return params; } // This is the general table listener that also enables multi row selection class SharedListSelectionHandler implements ListSelectionListener { public void valueChanged(ListSelectionEvent e) { // Perfectly working row selection method of first program List<Integer> tmpselectedIndices = new ArrayList<>(); ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { logger.debug("no index selected"); } else { // Find out which indexes are selected. int minIndex = lsm.getMinSelectionIndex(); int maxIndex = lsm.getMaxSelectionIndex(); for (int i = minIndex; i <= maxIndex; i++) { if (lsm.isSelectedIndex(i)) { tmpselectedIndices.add(i); SelectedRowOrIndex = i; MyVariables.setSelectedRowOrIndex(i); } int trow = tableListfiles.getSelectedRow(); int tcolumn = tableListfiles.getSelectedColumn(); logger.info("mainscreenListener: selected cell in row {} and column {}", String.valueOf(trow), String.valueOf(tcolumn)); } String[] params = whichRBselected(); String res = Utils.getImageInfoFromSelectedFile(params); Utils.displayInfoForSelectedImage(res, ListexiftoolInfotable); int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); File[] files = MyVariables.getLoadedFiles(); if (res.startsWith("jExifToolGUI")) { lblFileNamePath.setText(" "); } else { lblFileNamePath.setText(files[selectedRowOrIndex].getPath()); } selectedIndices = tmpselectedIndices.stream().mapToInt(Integer::intValue).toArray(); logger.info("Selected indices: {}", tmpselectedIndices); selectedIndicesList = tmpselectedIndices; MyVariables.setselectedIndicesList(selectedIndicesList); MyVariables.setSelectedFilenamesIndices(selectedIndices); //No previews wanted, so only display preview in bottom-left for selected image // and prevent 2nd event trigger if ( (!(createPreviewsCheckBox.isSelected())) && (!e.getValueIsAdjusting()) ) { Executor executor = Executors.newSingleThreadExecutor(); executor.execute(new Runnable() { @Override public void run() { Utils.selectedRowForSinglePreview(); Utils.displaySinglePreview(previewTable, loadMetadataCheckBox.isSelected()); } }); } } } } /* class iconViewListSelectionHandler implements ListSelectionListener { public void valueChanged(ListSelectionEvent e) { // Perfectly working row selection method of first program List<Integer> tmpselectedIndices = new ArrayList<>(); ListSelectionModel lsm = (ListSelectionModel) e.getSource(); //List<Integer> selectedIndicesList = new ArrayList<>(); //int[] selectedIndices = null; if (lsm.isSelectionEmpty()) { logger.debug("no grid view index selected"); } else { // Find out which indexes are selected. int minIndex = lsm.getMinSelectionIndex(); int maxIndex = lsm.getMaxSelectionIndex(); for (int i = minIndex; i <= maxIndex; i++) { if (lsm.isSelectedIndex(i)) { tmpselectedIndices.add(i); int SelectedRowOrIndex = i; MyVariables.setSelectedRowOrIndex(i); logger.info("MyVariables.getSelectedRowOrIndex() {}", MyVariables.getSelectedRowOrIndex()); } } String[] params = MyVariables.getmainScreenParams(); String res = Utils.getImageInfoFromSelectedFile(params); //Utils.displayInfoForSelectedImage(res, ListexiftoolInfotable); int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); File[] files = MyVariables.getLoadedFiles(); selectedIndices = tmpselectedIndices.stream().mapToInt(Integer::intValue).toArray(); logger.info("Selected grid indices: {}", tmpselectedIndices); logger.info("Save indices {}", Arrays.toString(selectedIndices)); selectedIndicesList = tmpselectedIndices; MyVariables.setselectedIndicesList(selectedIndicesList); MyVariables.setSelectedFilenamesIndices(selectedIndices); } } }*/ ////////////////////////////////////////////////////////////////////////////////////////////// public void rootPanelDropListener() { //Listen to drop events rootPanel.setDropTarget(new DropTarget() { public synchronized void drop(DropTargetDropEvent evt) { try { evt.acceptDrop(DnDConstants.ACTION_COPY); List<File> droppedFiles = (List<File>) evt.getTransferable().getTransferData(DataFlavor.javaFileListFlavor); for (File file : droppedFiles) { logger.debug("File path is: {}", file.getPath()); } File[] droppedFilesArray = (File[]) droppedFiles.toArray(new File[droppedFiles.size()]); MyVariables.setLoadedFiles(droppedFilesArray); files = Utils.loadImages("dropped files", rootPanel, LeftPanel, LeftTableScrollPanel, LeftGridScrollPanel, tableListfiles, previewTable, iconViewList, ListexiftoolInfotable, commandButtons(), mainScreenLabels(), progressBar, whichRBselected(), getLoadOptions()); } catch (Exception ex) { ex.printStackTrace(); logger.error("Drag drop on rootpanel error {}", ex); } } }); } // endregion /* / This creates the menu with the listener in its own external MenuActionListener class */ private void createMenuBar(JFrame frame) { menuBar = new JMenuBar(); // Due to the Load Iamge method with its own ActionListener we do the first menu items here // File menu myMenu = new JMenu(ResourceBundle.getBundle("translations/program_strings").getString("menu.file")); myMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(myMenu); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("fmenu.loadimages")); myMenu.setMnemonic(KeyEvent.VK_L); menuItem.setActionCommand("Load Images"); //menuItem.addActionListener(mal); menuItem.addActionListener(new SpecialMenuActionListener()); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("fmenu.loaddirectory")); menuItem.setActionCommand("Load Directory"); myMenu.setMnemonic(KeyEvent.VK_D); menuItem.addActionListener(new SpecialMenuActionListener()); myMenu.add(menuItem); // Now we continue with the rest of the entire menu outside the mainScreen in the external CreateMenu class CreateMenu crMenu = new CreateMenu(); crMenu.CreateMenuBar(frame, rootPanel, splitPanel, menuBar, myMenu, OutputLabel, progressBar, UserCombiscomboBox); } // prevent null-pointer assignments //If we click a radio button in the top right without files loaded we get an NPE //Can't set null object in setter (File files[]) // So make the selectedroworindex impossibly high private void preventNullPointerAssignments() { MyVariables.setSelectedRowOrIndex(MyConstants.IMPOSSIBLE_INDEX); } // Sets the necessary screen texts. We choose this way as we have now more control over width // without bothering the translators with <html></html> and/or <br> codes or length of total string(s). private void setProgramScreenTexts() { String version = ""; MyCommandsText.setText(String.format(ProgramTexts.HTML, 600, ( ResourceBundle.getBundle("translations/program_strings").getString("yc.toptext") + "<br><br>") )); xmpTopText.setText(String.format(ProgramTexts.HTML, 600,ResourceBundle.getBundle("translations/program_strings").getString("xmp.toptext"))); GeotaggingLeaveFolderEmptyLabel.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("fld.folderexplanation"))); ExpLeaveFolderEmptyLabel.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("fld.folderexplanation"))); etcLeaveFolderEmptyLabel.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("fld.folderexplanation"))); GeoTfolderBrowseLabel.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("fld.explanation"))); genExpfolderBrowseLabel.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("fld.explanation"))); etcFolderBrowseLabel.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("fld.explanation"))); GeotaggingLocationLabel.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("geo.geotagexpl"))); GeotaggingGeosyncExplainLabel.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("geo.geosyncexpl"))); //gpsCalculatorLabelText.setText(String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("gps.calculatortext"))); gPanoTopText.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("gpano.toptext"))); copyAllMetadataRadiobutton.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("copyd.copyallmetadatasame"))); copyAllMetadataSameGroupsRadiobutton.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("copyd.copyallsamegroup"))); copySelectiveMetadataradioButton.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("copyd.copybyselection"))); lensSaveLoadConfigLabel.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("lens.saveloadconfig"))); //exiftoolDBText.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("edb.toptext"))); StringsTopText.setText(String.format(ProgramTexts.HTML, 600, ( ResourceBundle.getBundle("translations/program_strings").getString("xis.toptext") + "<br><br>"))); SeparatorText.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("xis.separatortext"))); UserCombiTopText.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("udc.toptext"))); exportMetaDataUiText.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("emd.toptext"))); expPdftextLabel.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("exppdf.toptext"))); pdfLabelSupported.setText(String.format(ProgramTexts.HTML, 600, "<br>" + ResourceBundle.getBundle("translations/program_strings").getString("exppdf.supp"))); lblNominatimSearch.setText(String.format(ProgramTexts.HTML, 600, ( ResourceBundle.getBundle("translations/program_strings").getString("gps.searchtxt") + "<br><br>"))); lblMapcoordinates.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("gps.extsearch"))); // Special dynamic version string logger.trace("check for exiftool version"); String exiftool = Utils.platformExiftool(); List<String> cmdparams = new ArrayList<>(); Application.OS_NAMES currentOsName = Utils.getCurrentOsName(); logger.info("OS name {}", currentOsName); boolean isWindows = Utils.isOsFromMicrosoft(); if (isWindows) { cmdparams.add("\"" + exiftool.replace("\\", "/") + "\""); } else { cmdparams.add(exiftool.trim()); } cmdparams.add("-ver"); try { logger.trace("Get exiftool version"); version = (CommandRunner.runCommand(cmdparams)); logger.trace("raw exiftool version: {}", version); } catch (IOException | InterruptedException ex) { logger.error("Error executing command"); version = "I cannot determine the exiftool version"; } Float floatversion = Float.parseFloat(version.trim()); Float minversion = new Float("9.09"); int retval = floatversion.compareTo(minversion); logger.trace("returned version for exiftool (>0: OK; <=0: No gpano): {}", retval); if (retval >0) { // cureent exiftool > 9.09 gpanoMinVersionText.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("gpano.googlemapsfields"))); } else { gpanoMinVersionText.setText(String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("gpano.disabledfields"))); gpanoPHDtextField.setEnabled(false); gpanoStitchingSoftwaretextField.setEnabled(false); gpanoIVHDtextField.setEnabled(false); gpanoIVPDtextField.setEnabled(false); gpanoIVRDtextField.setEnabled(false); gpanoIHFOVDtextField.setEnabled(false); } } private void setArtistCreditsCopyrightDefaults() { // Try to set the defaults for artist, credit and copyrights in the edit exif/xmp panes if prefs available String[] ArtCredCopyPrefs = Utils.checkPrefsArtistCreditsCopyRights(); ExifArtistCreatortextField.setText(ArtCredCopyPrefs[0]); ExifCopyrighttextField.setText(ArtCredCopyPrefs[2]); xmpCreatortextField.setText(ArtCredCopyPrefs[0]); xmpCredittextField.setText(ArtCredCopyPrefs[1]); xmpRightstextField.setText(ArtCredCopyPrefs[2]); } // This is where it all starts // initialisation of the Application public mainScreen(JFrame frame) throws IOException, InterruptedException { boolean exiftool_found = false; SwingUtilities.invokeLater(new Runnable() { public void run() { GuiConfig.SetSplitPaneDivider(splitPanel); } }); // Do not simply exit on closing the window. First delete our temp stuff and save gui settings frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { StandardFileIO.deleteDirectory(new File (MyVariables.gettmpWorkFolder()) ); GuiConfig.SaveGuiConfig(frame, rootPanel, splitPanel); CompareImages.CleanUp(); System.exit(0); } }); $$$setupUI$$$(); Utils.progressStatus(progressBar, false); createMenuBar(frame); //createPopupMenu(myPopupMenu); String check_result = checkforjexiftoolguiFolder(); if (check_result.contains("Error creating")) { JOptionPane.showMessageDialog(rootPanel, "Could not create the data folder " + MyConstants.MY_DATA_FOLDER + " or one of its files", "error creating folder/files", JOptionPane.ERROR_MESSAGE); } else { // Set database to variable logger.info("string for DB: " + MyVariables.getjexiftoolguiDBPath()); } // Delete and recreate {tmp dir}/jexiftoolgui check_result = StandardFileIO.RecreateOurTempFolder(); if (!"Success".equals(check_result)) { JOptionPane.showMessageDialog(rootPanel, "Could not (re)create our temporary working folder", "error (re)creating temp folder", JOptionPane.ERROR_MESSAGE); } // Now check the preferences CheckPreferences CP = new CheckPreferences(); /*String ET_preference = CP.checkExifToolPreference(); if ( ET_preference.contains("Preference null_empty_notexisting") || ET_preference.contains("No exiftool preference yet") ) { String res = ExifTool.getExiftoolInPath(); } */ exiftool_found = CP.checkPreferences(rootPanel, OutputLabel); logger.debug("ExifToolPath from CheckPreferences: {}", MyVariables.getExifToolPath()); if (!exiftool_found) { ExifTool.checkExifTool(mainScreen.this.rootPanel); } else { if ( (MyVariables.getExifToolPath() != null) && "c:\\windows\\exiftool.exe".equals( (MyVariables.getExifToolPath()).toLowerCase() ) ) { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("exift.notinwinpathtext")), ResourceBundle.getBundle("translations/program_strings").getString("exift.notinwinpathtitle"), JOptionPane.WARNING_MESSAGE); ExifTool.checkExifTool(mainScreen.this.rootPanel); } else if ( (MyVariables.getExifToolPath() != null) && ( (MyVariables.getExifToolPath()).toLowerCase().contains("exiftool(-k).exe") || (MyVariables.getExifToolPath()).toLowerCase().contains("-k version")) ) { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("exift.exifk")), ResourceBundle.getBundle("translations/program_strings").getString("exift.notinwinpathtitle"), JOptionPane.WARNING_MESSAGE); ExifTool.checkExifTool(mainScreen.this.rootPanel); } // Now check if it is executable String isExecutable = ExifTool.showVersion(OutputLabel); if (isExecutable.contains("Error executing command")) { JOptionPane.showMessageDialog(rootPanel, String.format(ProgramTexts.HTML, 600, ResourceBundle.getBundle("translations/program_strings").getString("exift.wrongetbinaryfromstartup")), ResourceBundle.getBundle("translations/program_strings").getString("exift.wrongexebin"), JOptionPane.WARNING_MESSAGE); ExifTool.checkExifTool(mainScreen.this.rootPanel); } } // Set the text areas correctly ExifDescriptiontextArea.setWrapStyleWord(true); ExifDescriptiontextArea.setLineWrap(true); xmpDescriptiontextArea.setWrapStyleWord(true); xmpDescriptiontextArea.setLineWrap(true); // Do necessary updates when moving from older versions to newer versions // This is done in a swingworker background task //UpdateActions.Updates(); ViewRadiobuttonListener(); fillAllComboboxes(); setArtistCreditsCopyrightDefaults(); // Some texts setProgramScreenTexts(); // prevent null-pointer assignments after statup without any files loaded preventNullPointerAssignments(); //Use the table listener for the selection of multiple cells listSelectionModel = tableListfiles.getSelectionModel(); tableListfiles.setRowSelectionAllowed(true); tableListfiles.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); listSelectionModel.addListSelectionListener(new SharedListSelectionHandler()); // Use the mouselistener for the double-click to display the image // on the filenamestable MouseListeners.FileNamesTableMouseListener(tableListfiles, ListexiftoolInfotable, whichRBselected(), OutputLabel); //Listen to drop events rootPanelDropListener(); // Make left "tableListfiles" and right "ListexiftoolInfotable" tables read-only (un-editable) // This also fixes the double-click bug on the image where it retrieves the object name of the images on double-click tableListfiles.setDefaultEditor(Object.class, null); ListexiftoolInfotable.setDefaultEditor(Object.class, null); // Make all tables read-only unless .... //DBResultsTable.setDefaultEditor(Object.class, null); // icon for my dialogs InputStream stream = StandardFileIO.getResourceAsStream("icons/jexiftoolgui-64.png"); try { icon = new ImageIcon(ImageIO.read(stream)); } catch (IOException ex) { logger.error("Error executing command"); } programButtonListeners(); leftPanePopupMenuLister(); // Set formatting for the JFormatted textFields EGpanod.setFormattedFieldFormats(getGpanoFields()); // Set jFormattedFields EGPSd.setFormattedFieldMasks(getNumGPSdecFields(), getGPSdmsFields()); //Check on command line arguments if ( MyVariables.getcommandLineArgsgiven()) { List<File> filesList = new ArrayList<File>(); files = CommandLineArguments.ProcessArguments(filesList); MyVariables.setLoadedFiles(files); files = Utils.loadImages("commandline", rootPanel, LeftPanel, LeftTableScrollPanel, LeftGridScrollPanel, tableListfiles, previewTable, iconViewList, ListexiftoolInfotable, commandButtons(), mainScreenLabels(), progressBar, whichRBselected(), getLoadOptions()); } Utils.checkForNewVersion("startup"); //JLabelDropReady.addPropertyChangeListener(new PropertyChangeListener() { //}); createPreviewsCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (createPreviewsCheckBox.isSelected()) { MyVariables.setcreatePreviewsCheckBox(true); iconViewList.clearSelection(); DefaultListModel lm = (DefaultListModel) iconViewList.getModel(); lm.removeAllElements(); } else { MyVariables.setcreatePreviewsCheckBox(false); } } }); } static void renderSplashFrame(Graphics2D g, int frame) { //final String[] comps = {"loading jExifToolGUI", "Please be patient"}; final String[] comps = {"foo", "bar", "baz"}; g.setComposite(AlphaComposite.Clear); g.fillRect(120,140,200,40); g.setPaintMode(); g.setColor(Color.BLACK); g.drawString("Loading "+comps[(frame/5)%3]+"...", 120, 150); } final static void showSplash() { final SplashScreen splash = SplashScreen.getSplashScreen(); /*try { //URL splashUrl = mainScreen.class.getResource("/icons/new-jexiftoolgui-splashlogo.png"); //URL splashUrl = mainScreen.class.getResource("/splash.gif"); if (splashUrl == null) { logger.error("Cannot load the splashlogo {}", splashUrl.toString()); } else { logger.info("setting the splash logo {}", splashUrl.toString()); splash.setImageURL(splashUrl); } } catch (IOException e) { logger.error("loading splash image gives error {}", e.toString()); e.printStackTrace(); } */ if (splash == null) { logger.error("SplashScreen.getSplashScreen() returned null"); return; } //Graphics2D g = splashImg.createGraphics(); Graphics2D g = splash.createGraphics(); if (g == null) { logger.error("g is null"); return; } for (int i = 1; i < 100; i++) { renderSplashFrame(g, i); splash.update(); try { Thread.sleep(90); } catch (InterruptedException e) { } } //splash.close(); } static void createAndShowGUI() { // Doesn't work but leave in System.out.println(SingletonEnum.INSTANCE); Application.OS_NAMES os = Utils.getCurrentOsName(); JFrame frame = new JFrame("jExifToolGUI V" + ProgramTexts.Version + " " + ResourceBundle.getBundle("translations/program_strings").getString("application.title")); try { if (os == Application.OS_NAMES.APPLE) { logger.info("running on Apple. set correct menu"); // take the menu bar off the jframe and put it in the MacOS menu System.setProperty("apple.laf.useScreenMenuBar", "true"); // set the name of the application menu item System.setProperty("com.apple.mrj.application.apple.menu.about.name", "jExifToolGUI V" + ProgramTexts.Version + " (for ExifTool by Phil Harvey)"); // And the annoying splash screen on MacOS /* Leave for later investigation try { showSplash(); } catch (Exception e) { logger.error("error displaying splash screen {}", e.toString()); e.printStackTrace(); }*/ } // Significantly improves the look of the output in // terms of the folder/file icons and file names returned by FileSystemView! UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); //UIManager.setLookAndFeel(GTKLookAndFeel); } catch (Exception weTried) { logger.error("Could not start GUI.", weTried); } frame.setIconImage(Utils.getFrameIcon()); try { frame.setContentPane(new mainScreen(frame).rootPanel); } catch (InterruptedException | IOException e) { e.printStackTrace(); logger.error("InterruptedException or IOException: {}", e.toString()); } logger.debug("Gui Width x Height: {} x {}", frame.getWidth(), String.valueOf(frame.getHeight())); GuiConfig.LoadGuiConfig(frame); //frame.setLocationRelativeTo(null); frame.setLocationByPlatform(true); frame.setDefaultLookAndFeelDecorated(true); Locale currentLocale = MyVariables.getCurrentLocale(); logger.info("Set Locale to: {}", currentLocale); frame.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); frame.setVisible(true); } }
339,850
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
ExiftoolReference.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/ExiftoolReference.java
package org.hvdw.jexiftoolgui; import ch.qos.logback.classic.Logger; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import org.hvdw.jexiftoolgui.controllers.CSVUtils; import org.hvdw.jexiftoolgui.controllers.StandardFileIO; import org.hvdw.jexiftoolgui.facades.IPreferencesFacade; import org.hvdw.jexiftoolgui.facades.SystemPropertyFacade; import org.hvdw.jexiftoolgui.view.ExifToolReferencePanel; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.border.TitledBorder; import javax.swing.plaf.FontUIResource; import javax.swing.table.DefaultTableModel; import javax.swing.text.StyleContext; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.lang.reflect.Method; import java.util.List; import java.util.ArrayList; import java.util.Locale; import java.util.ResourceBundle; import static org.hvdw.jexiftoolgui.facades.SystemPropertyFacade.SystemPropertyKey.LINE_SEPARATOR; public class ExiftoolReference { private JScrollPane databaseScrollPanel; private JTable DBResultsTable; private JLabel exiftoolRefText; private JRadioButton radiobuttonQueryByGroup; private JComboBox comboBoxQueryByTagName; private JRadioButton radiobuttonQueryByCameraMake; private JComboBox comboBoxQueryCameraMake; private JTextField queryTagLiketextField; private JButton searchLikebutton; private JButton edbHelpbutton; private JLabel exiftoolRefversion; private JPanel ExiftoolDBPanel; private JPanel rootDBpanel; private static IPreferencesFacade prefs = IPreferencesFacade.defaultInstance; private final static Logger logger = (Logger) LoggerFactory.getLogger(ExifToolReferencePanel.class); List<String[]> csvGroupsTagsList = new ArrayList<>(); public ExiftoolReference(JFrame frame) throws IOException, InterruptedException { /*setContentPane(rootDBpanel); setModal(true); this.setIconImage(Utils.getFrameIcon());*/ String TagGroups = StandardFileIO.readTextFileAsStringFromResource("texts/g1.txt"); String[] Tags = TagGroups.split("\\r?\\n"); // split on new lines comboBoxQueryByTagName.setModel(new DefaultComboBoxModel(Tags)); String TagNames = StandardFileIO.readTextFileAsStringFromResource("texts/CameraTagNames.txt"); Tags = TagNames.split("\\r?\\n"); // split on new lines comboBoxQueryCameraMake.setModel(new DefaultComboBoxModel(Tags)); // Read all the groups and tags //List<String[]> csvGroupsTagsList = new ArrayList<>(); csvGroupsTagsList = CSVUtils.ReadCSVfromResources("texts/g1_groups_tags.csv"); if (csvGroupsTagsList.isEmpty()) { logger.info("We have an empty list"); } else { logger.info("Rows in list " + csvGroupsTagsList.size()); } exiftoolRefText.setText(String.format(ProgramTexts.HTML, 850, ResourceBundle.getBundle("translations/program_strings").getString("edb.toptext"))); exiftoolRefversion.setText(String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("edb.etrefversion") + " " + ProgramTexts.ETrefVersion)); // Make all tables read-only unless .... DBResultsTable.setDefaultEditor(Object.class, null); // buttons and the like on database panel searchLikebutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (!"".equals(queryTagLiketextField.getText())) { List<String[]> resultGroupsTagsList = new ArrayList<>(); resultGroupsTagsList = queryFullList(csvGroupsTagsList, queryTagLiketextField.getText(), "byTag"); displayListQueryResults(resultGroupsTagsList, DBResultsTable); } else { JOptionPane.showMessageDialog(ExiftoolDBPanel, "No search string provided!", "No search string", JOptionPane.WARNING_MESSAGE); } } }); comboBoxQueryByTagName.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (radiobuttonQueryByGroup.isSelected()) { List<String[]> resultGroupsTagsList = new ArrayList<>(); resultGroupsTagsList = queryFullList(csvGroupsTagsList, comboBoxQueryByTagName.getSelectedItem().toString(), "byGroup"); displayListQueryResults(resultGroupsTagsList, DBResultsTable); //displayQueryResults(queryResult, DBResultsTable); } } }); edbHelpbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { logger.debug("button edbHelpbutton pressed"); JOptionPane.showMessageDialog(ExiftoolDBPanel, String.format(ProgramTexts.HTML, 700, ResourceBundle.getBundle("translations/program_help_texts").getString("exiftooldbhelptext")), ResourceBundle.getBundle("translations/program_help_texts").getString("exiftooldbtitle"), JOptionPane.INFORMATION_MESSAGE); } }); } static List<String[]> queryFullList(List<String[]> csvGroupsTagsList, String queryString, String queryBy) { List<String[]> result = new ArrayList<>(); logger.debug("Used queryBy is: " + queryBy + " number of rows in csvGroupsTagsList " + csvGroupsTagsList.size()); if (queryBy.equals("byGroup")) { logger.debug("Inside queryBy => byGroup"); for (String[] row : csvGroupsTagsList) { if (queryString.equals(row[0])) { result.add(row); } } } else { logger.info("Inside queryBy => byTag"); for (String[] row : csvGroupsTagsList) { // Inside csv: TagNameGroup (from g1 group in this case),TagName,TagType,Writable,G0,G1,G2 if ((row[1].toLowerCase()).contains(queryString.toLowerCase())) { result.add(row); } } } logger.info("result list contains " + result.size()); return result; } public static void displayListQueryResults(List<String[]> queryResult, JTable DBResultsTable) { DefaultTableModel model = (DefaultTableModel) DBResultsTable.getModel(); model.setColumnIdentifiers(new String[]{"Group G0", "Group G1", "Group G2", "Tagname", "TagType", "Writable"}); DBResultsTable.getColumnModel().getColumn(0).setPreferredWidth(125); DBResultsTable.getColumnModel().getColumn(1).setPreferredWidth(125); DBResultsTable.getColumnModel().getColumn(2).setPreferredWidth(125); DBResultsTable.getColumnModel().getColumn(3).setPreferredWidth(300); DBResultsTable.getColumnModel().getColumn(4).setPreferredWidth(100); DBResultsTable.getColumnModel().getColumn(5).setPreferredWidth(70); model.setRowCount(0); Object[] row = new Object[1]; if (!queryResult.isEmpty()) { for (String line[] : queryResult) { //String[] cells = lines[i].split(":", 2); // Only split on first : as some tags also contain (multiple) : // Inside csv: TagNameGroup (from g1 group in this case),TagName,TagType,Writable,G0,G1,G2 // In table: Group G0, Group G1, Group G2, Tagname, TagType, Writable model.addRow(new Object[]{line[4], line[5], line[6], line[1], line[2], line[3]}); } } } public static void displayQueryResults(String queryResult, JTable DBResultsTable) { DefaultTableModel model = (DefaultTableModel) DBResultsTable.getModel(); model.setColumnIdentifiers(new String[]{"Group", "Tagname", "TagType", "Writable"}); DBResultsTable.getColumnModel().getColumn(0).setPreferredWidth(100); DBResultsTable.getColumnModel().getColumn(1).setPreferredWidth(260); DBResultsTable.getColumnModel().getColumn(2).setPreferredWidth(100); DBResultsTable.getColumnModel().getColumn(3).setPreferredWidth(70); model.setRowCount(0); Object[] row = new Object[1]; if (queryResult.length() > 0) { String[] lines = queryResult.split(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR)); for (String line : lines) { //String[] cells = lines[i].split(":", 2); // Only split on first : as some tags also contain (multiple) : String[] cells = line.split("\\t", 4); model.addRow(new Object[]{cells[0], cells[1], cells[2], cells[3]}); } } } public static void displayOwnQueryResults(String sql, String queryResult, JTable DBResultsTable) { DefaultTableModel model = (DefaultTableModel) DBResultsTable.getModel(); // get the fields that are being queried on and immediately remove spaces for our table header and number of columns String queryFields = Utils.stringBetween(sql.toLowerCase(), "select", "from").replaceAll("\\s+", ""); // regex "\s" is space, extra \ to escape the first \; String[] headerFields = queryFields.split(","); model.setColumnIdentifiers(headerFields); model.setRowCount(0); Object[] row = new Object[1]; if (queryResult.length() > 0) { String[] lines = queryResult.split(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR)); for (String line : lines) { String[] cells = line.split("\\t"); model.addRow(cells); } } } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { rootDBpanel = new JPanel(); rootDBpanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); rootDBpanel.setMinimumSize(new Dimension(850, 500)); rootDBpanel.setPreferredSize(new Dimension(1150, 700)); ExiftoolDBPanel = new JPanel(); ExiftoolDBPanel.setLayout(new GridLayoutManager(4, 2, new Insets(10, 10, 10, 10), -1, -1)); ExiftoolDBPanel.setPreferredSize(new Dimension(800, 550)); rootDBpanel.add(ExiftoolDBPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); databaseScrollPanel = new JScrollPane(); ExiftoolDBPanel.add(databaseScrollPanel, new GridConstraints(3, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); DBResultsTable = new JTable(); DBResultsTable.setPreferredScrollableViewportSize(new Dimension(1050, 400)); databaseScrollPanel.setViewportView(DBResultsTable); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); ExiftoolDBPanel.add(panel1, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); exiftoolRefText = new JLabel(); this.$$$loadLabelText$$$(exiftoolRefText, this.$$$getMessageFromBundle$$$("translations/program_strings", "edb.toptext")); panel1.add(exiftoolRefText, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); ExiftoolDBPanel.add(panel2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); radiobuttonQueryByGroup = new JRadioButton(); radiobuttonQueryByGroup.setSelected(true); this.$$$loadButtonText$$$(radiobuttonQueryByGroup, this.$$$getMessageFromBundle$$$("translations/program_strings", "vdtab.bygroup")); panel2.add(radiobuttonQueryByGroup); comboBoxQueryByTagName = new JComboBox(); panel2.add(comboBoxQueryByTagName); radiobuttonQueryByCameraMake = new JRadioButton(); this.$$$loadButtonText$$$(radiobuttonQueryByCameraMake, this.$$$getMessageFromBundle$$$("translations/program_strings", "vdtab.bycamera")); radiobuttonQueryByCameraMake.setVisible(false); panel2.add(radiobuttonQueryByCameraMake); comboBoxQueryCameraMake = new JComboBox(); comboBoxQueryCameraMake.setVisible(false); panel2.add(comboBoxQueryCameraMake); final JPanel panel3 = new JPanel(); panel3.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); ExiftoolDBPanel.add(panel3, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); panel3.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label1 = new JLabel(); this.$$$loadLabelText$$$(label1, this.$$$getMessageFromBundle$$$("translations/program_strings", "edb.wheretaglike")); panel3.add(label1); queryTagLiketextField = new JTextField(); queryTagLiketextField.setPreferredSize(new Dimension(300, 30)); panel3.add(queryTagLiketextField); searchLikebutton = new JButton(); this.$$$loadButtonText$$$(searchLikebutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "edb.btnsearchlike")); panel3.add(searchLikebutton); edbHelpbutton = new JButton(); this.$$$loadButtonText$$$(edbHelpbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); ExiftoolDBPanel.add(edbHelpbutton, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); exiftoolRefversion = new JLabel(); Font exiftoolRefversionFont = this.$$$getFont$$$(null, Font.ITALIC, -1, exiftoolRefversion.getFont()); if (exiftoolRefversionFont != null) exiftoolRefversion.setFont(exiftoolRefversionFont); this.$$$loadLabelText$$$(exiftoolRefversion, this.$$$getMessageFromBundle$$$("translations/program_strings", "edb.etrefversion")); exiftoolRefversion.setToolTipText("The exiftool version to build the included data set version is not necessarily the same as your installed exiftool version"); ExiftoolDBPanel.add(exiftoolRefversion, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); } /** * @noinspection ALL */ private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) { if (currentFont == null) return null; String resultName; if (fontName == null) { resultName = currentFont.getName(); } else { Font testFont = new Font(fontName, Font.PLAIN, 10); if (testFont.canDisplay('a') && testFont.canDisplay('1')) { resultName = fontName; } else { resultName = currentFont.getName(); } } Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize()); boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac"); Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize()); return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadLabelText$$$(JLabel component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setDisplayedMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return rootDBpanel; } public static void showDialog() { /* pack(); //setLocationRelativeTo(null); setLocationByPlatform(true); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("exiftooldb.title")); //initDialog(); setVisible(true); */ JFrame frame = new JFrame(ResourceBundle.getBundle("translations/program_strings").getString("exiftooldb.title")); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); frame.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); frame.setIconImage(Utils.getFrameIcon()); try { frame.setContentPane(new ExiftoolReference(frame).rootDBpanel); } catch (InterruptedException | IOException e) { e.printStackTrace(); logger.error("InterruptedException or IOException creating ExiftoolDatabase frame: {}", e); } //frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } }
21,260
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
MyConstants.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/MyConstants.java
package org.hvdw.jexiftoolgui; import java.awt.Font; public class MyConstants { // pre 2.0.2 version public static final String MY_DATA_FOLDER = "jexiftoolgui_data"; // Version >= 2.0.2 public static final String MY_BASE_FOLDER = "jexiftoolgui"; // exiftool image info parameters public static final String[] ALL_PARAMS = {"-a", "-G", "-tab"}; public static final String[] EXIF_PARAMS = {"-a", "-exif:all","-G", "-tab"}; public static final String[] XMP_PARAMS = {"-a", "-xmp:all","-G", "-tab"}; public static final String[] IPTC_PARAMS = {"-a", "-iptc:all","-G", "-tab"}; public static final String[] GPS_PARAMS = {"-a","-G", "-tab","-gps:all"}; public static final String[] LOCATION_PARAMS = {"-a","-G", "-tab","-location:all"}; public static final String[] GPANO_PARAMS = {"-a", "-G", "-tab", "-xmp:StitchingSoftware","-xmp:CroppedAreaImageHeightPixels","-xmp:CroppedAreaImageWidthPixels","-xmp:CroppedAreaLeftPixels","-xmp:CroppedAreaTopPixels","-xmp:FullPanoHeightPixels","-xmp:FullPanoWidthPixels","-xmp:ProjectionType","-xmp:UsePanoramaViewer","-xmp:PoseHeadingDegrees","-xmp:InitialViewHeadingDegrees","-xmp:InitialViewPitchDegrees","-xmp:InitialViewRollDegrees","-xmp:InitialHorizontalFOVDegrees"}; public static final String[] ICC_PARAMS = {"-a", "-icc_profile:all","-G", "-tab"}; public static final String[] MAKERNOTES_PARAMS = {"-a", "-makernotes:all","-G", "-tab"}; public static final String[] COMPOSITE_PARAMS = {"-a", "-composite:all","-G", "-tab"}; public static final String[] LENS_PARAMS = {"-exif:lensmake","-exif:lensmodel","-exif:lensserialnumber","-makernotes:lensserialnumber","-exif:focallength","-exif:focallengthIn35mmformat","-exif:fnumber","-exif:maxaperturevalue","-exif:meteringmode","-composite:lensid","-composite:lens","-makernotes:focusdistance","-makernotes:conversionlens","-makernotes:lenstype","-makernotes:lensfirmwareversion","-G", "-tab"}; public static final String[] REF_IMAGE_DATETIME = {"-exif:ModifyDate","-exif:DateTimeOriginal","-exif:CreateDate"}; public static final String[] GPANO_PROJECTIONS = {"equirectangular", "cylindrical", "rectilinear"}; public static final String[] WIDTH_HEIGHT_ORIENTATION = {"-n", "-S", "-imagewidth", "-imageheight", "-orientation"}; public static final String[] BASIC_IMG_DATA = {"-n", "-S", "-imagewidth", "-imageheight", "-orientation", "-iso", "-fnumber", "-exposuretime", "-focallength", "-focallengthin35mmformat"}; // exiftool image modification parameters public static final String[] SET_FILEDATETIME_TO_DATETIMEORIGINAL = {"-FileModifyDate<DateTimeOriginal"}; public static final String[] ALTER_DATETIME = {"-e","-n","-exif:Make","-exif:Model","-exif:ModifyDate","-exif:DateTimeOriginal","-exif:CreateDate","-exif:Artist","-exif:Copyright","-exif:UserComment","-exif:ImageDescription"}; public static final String[] REPAIR_JPG_METADATA = {"-all=","-tagsfromfile","@","-all:all","-unsafe","-F"}; public static final String[] CREATE_ARGS_FILE_STRINGS = {"-args","--filename","--directory","-w","args"}; // image file filters public static final String[] SUPPORTED_IMAGES = {"3fr","acr","ai","ait","arw","bmp","dib","btf","cos","cr3","cr2","crw","ciff","cs1","dcm","dc3","dic","dicm","dcp","dcr","djvu","djv","dng","eip","erf","exif","exr","fff","fpx","gif","hdp","wdp","heic","hdr","icc","icm","idml","iiq","ind","indd","indt","inx","itc","j2c","jpc","jp2","jpf","j2k","jpm","jpx","jpeg","jpg","k25","kdc","mef","mie","miff","mif","mos","mpo","mrw","mxf","nef","nrw","orf","pcd","pdf","pef","pgf","pict","pct","pmp","png","jng","mng","ppm","pbm","pgm","psp","pspimage","qtif","qti","qif","raf","raw","rw2","rwl","rwz","sr2","srf","srw","svg","thm","tiff","tif","webp","x3f","xcf","xmp"}; public static final String[] RAW_IMAGES = {"3fr","acr","ai","ait","arw","dib","btf","cos","cr3","cr2","crw","ciff","cs1","dcm","dc3","dic","dicm","dcp","dcr","djvu","djv","dng","eip","erf","exif","exr","fff","fpx","hdp","wdp","hdr","icc","icm","idml","iiq","ind","indd","indt","inx","itc","j2c","jpc","jp2","jpf","j2k","jpm","jpx","k25","kdc","mef","mie","miff","mif","mos","mpo","mrw","mxf","nef","nrw","orf","pcd","pdf","pef","pgf","pict","pct","pmp","jng","mng","psp","pspimage","qtif","qti","qif","raf","raw","rw2","rwl","rwz","sr2","srf","srw","svg","thm","webp","x3f","xcf","xmp"}; public static final String[] SUPPORTED_VIDEOS = {"3gp","avi","flv","mkv","mov","mp2","m4v","mp4","mpeg","mpg","ogv","swf","wmv","wtv"}; public static final String[] SUPPORTED_AUDIOS = {"3gpp","aif","ape","au","flac","m3u","m4a","mid","midi","mp3","oga","ogg","ra","ram","wav","wma"}; public static final String[] SUPPORTED_FORMATS = {"3fr","3g2","3gp2","3gp","3gpp","acr","afm","acfm","amfm","ai","ait","aiff","aif","aifc","ape","arw","asf","avi","bmp","dib","btf","chm","cos","cr2","crw","ciff","cs1","dcm","dc3","dic","dicm","dcp","dcr","dfont","divx","djvu","djv","dng","doc","dot","docx","docm","dotx","dotm","dylib","dv","dvb","eip","eps","epsf","ps","erf","exe","dll","exif","exr","f4a","f4b","f4p","f4v","fff","fla","flac","flv","fpx","gif","gz","gzip","hdp","wdp","hdr","html","htm","xhtml","icc","icm","idml","iiq","ind","indd","indt","inx","itc","j2c","jpc","jp2","jpf","j2k","jpm","jpx","jpeg","jpg","k25","kdc","key","kth","la","lnk","m2ts","mts","m2t","ts","m4a","m4b","m4p","m4v","mef","mie","miff","mif","mka","mkv","mks","mos","mov","qt","mp3","mp4","mpc","mpeg","mpg","m2v","mpo","mqv","mrw","mxf","nef","nmbtemplate","nrw","numbers","odb","odc","odf","odg","odi","odp","ods","odt","ofr","ogg","ogv","orf","otf","pac","pages","pcd","pdf","pef","pfa","pfb","pfm","pgf","pict","pct","pmp","png","jng","mng","ppm","pbm","pgm","ppt","pps","pot","potx","potm","ppsx","ppsm","pptx","pptm","psd","psb","psp","pspimage","qtif","qti","qif","ra","raf","ram","rpm","rar","raw","raw","riff","rif","rm","rv","rmvb","rsrc","rtf","rw2","rwl","rwz","so","sr2","srf","srw","svg","swf","thm","thmx","tiff","tif","ttf","ttc","vob","vrd","vsd","wav","webm","webp","wma","wmv","wv","x3f","xcf","xls","xlt","xlsx","xlsm","xlsb","xltx","xltm","xmp"}; // Subsection file extensions public static final String[] BASIC_EXTENSIONS = {"bmp","gif,","jpg", "jpeg", "png", "tif", "tiff"}; public static final String[] JAVA_SUP_EXTENSIONS = {"bmp","gif,","jpg", "jpeg", "png", "tif", "tiff"}; // Date_time and Date strings public static final String[] DATES_TIMES_STRINGS = {"YYYYMMDDHHMMSS", "YYYYMMDD_HHMMSS", "YYYYMMDD-HHMMSS", "YYYY_MM_DD_HH_MM_SS", "YYYY-MM-DD-HH-MM-SS", "YYYYMMDD HHMMSS", "YYYY_MM_DD HH_MM_SS", "YYYY-MM-DD HH-MM-SS"}; public static final String[] DATES_STRINGS = {"YYYYMMDD", "YYYY_MM_DD", "YYYY-MM-DD"}; // Impossible value to prevent NPEs during radio button selection when no images loaded public static final int IMPOSSIBLE_INDEX = 2147483645; // Max value integer - 2 // Default font public static final Font appDefFont = new Font(Font.SANS_SERIF, Font.PLAIN, 12); }
7,019
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
Application.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/Application.java
package org.hvdw.jexiftoolgui; import org.hvdw.jexiftoolgui.controllers.SingletonEnum; import org.hvdw.jexiftoolgui.facades.IPreferencesFacade; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.plaf.FontUIResource; import java.awt.*; import java.util.Locale; import java.util.ResourceBundle; import static org.hvdw.jexiftoolgui.facades.IPreferencesFacade.PreferenceKey.*; /** * Simple but important application class. * The start up and initial configuration point for the application. * * May set / load / change default configuration based on env and runtime. * * May also start several threads */ public class Application { private final static ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Application.class); private static IPreferencesFacade prefs = IPreferencesFacade.defaultInstance; public static ResourceBundle resourceBundle; public static void main(String[] args) { // Doesn't work but leave in System.out.println(SingletonEnum.INSTANCE); Utils.SetApplicationWideLogLevel(); logger.info("Start application jExifToolGUI"); if (args.length > 0) { MyVariables.setcommandLineArgsgiven(true); MyVariables.setcommandLineArgs(args); for (String arg : args) { logger.debug("arg: {}", arg); } } else { MyVariables.setcommandLineArgsgiven(false); } String prefLocale = prefs.getByKey(PREFERRED_APP_LANGUAGE, "System default"); if (!prefLocale.contains("default")) { // We have two deviations here. // Simplified Chinese is according ISO maintained as zn-CH, but java wants zn_CH. // Indonesian (bahasa) is according ISO maintained as id, but java wants in_ID. // Before compilation the script "copybeforecompile.sh" must be executed. // That script is inside src/main/resources/translations String[] localearray = prefLocale.split(" - "); String[] splitlocale = null; Boolean singlelocale = false; if (localearray[0].contains("-")) { // in case of simplified chinese splitlocale = localearray[0].split("-"); } else { splitlocale = localearray[0].split("_"); } //splitlocale[0] = "id"; //splitlocale[1] = "ID"; //logger.info("locale set to id"); logger.info("splitlocale[0] {} splitlocale[1] {}", splitlocale[0].trim(), splitlocale[1].trim()); Locale.setDefault(new Locale(splitlocale[0].trim(), splitlocale[1].trim())); logger.info("Continuing in {}, selecting {} ", prefLocale, splitlocale[0]); //String[] splitPrefLocale = prefLocale.split("_"); Locale currentLocale = new Locale.Builder().setLanguage(splitlocale[0].trim()).setRegion(splitlocale[1].trim()).build(); MyVariables.setCurrentLocale(currentLocale); resourceBundle = ResourceBundle.getBundle("translations/program_strings", new Locale(splitlocale[0].trim(), splitlocale[1].trim())); } else { Locale currentLocale = Locale.getDefault(); MyVariables.setCurrentLocale(currentLocale); logger.info("Continuing in system language or, if not translated, in English"); } Application.OS_NAMES os = Utils.getCurrentOsName(); if (os == OS_NAMES.APPLE) { System.setProperty("apple.laf.UseScreenMenuBar", "true"); } // Get user defined font or use default font String userFont = prefs.getByKey(USER_DEFINED_FONT, "sans-serif"); int userFontSize = Integer.parseInt(prefs.getByKey(USER_DEFINED_FONTSIZE, "12")); Utils.setUIFont(new FontUIResource(userFont, Font.PLAIN, userFontSize)); //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. SwingUtilities.invokeLater(mainScreen::createAndShowGUI); } public enum OS_NAMES { APPLE, MICROSOFT, LINUX } }
4,184
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
TablePasteAdapter.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/TablePasteAdapter.java
package org.hvdw.jexiftoolgui; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.table.DefaultTableModel; import java.awt.*; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.DataFlavor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.datatransfer.StringSelection; import java.util.Vector; /** * TablePasteAdapter enables Cut-Copy-Paste Clipboard functionality on JTables. * The clipboard data format used by the adapter is compatible with * the clipboard format used by spreadsheets. This provides for clipboard * interoperability between enabled JTables and spreadsheets. */ public class TablePasteAdapter implements ActionListener { private final JTable myTable; private final Clipboard myClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); private static final ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(TablePasteAdapter.class); /** * The TablePasteAdapter is constructed with a JTable on which it enables * Cut-Copy-Paste and acts as a Clipboard listener. * @param aTable */ public TablePasteAdapter(JTable aTable) { myTable = aTable; initKeyboardActions(); } /** Register the cut, copy and paste keyboard sequences. */ private void initKeyboardActions() { // Identify the cut, copy and paste KeyStrokes. The user can modify this to // cut, copy and paste with other Key combinations. KeyStroke cut = KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK,false); KeyStroke copy = KeyStroke.getKeyStroke(KeyEvent.VK_C,ActionEvent.CTRL_MASK,false); KeyStroke paste = KeyStroke.getKeyStroke(KeyEvent.VK_V,ActionEvent.CTRL_MASK,false); myTable.registerKeyboardAction(this, "Cut", cut, JComponent.WHEN_FOCUSED); myTable.registerKeyboardAction(this, "Copy", copy, JComponent.WHEN_FOCUSED); myTable.registerKeyboardAction(this, "Paste", paste, JComponent.WHEN_FOCUSED); } /** * This method is activated on the Keystrokes we are listening to * in this implementation. Here it listens for Cut, Copy and Paste ActionCommands. * Selections comprising non-adjacent cells result in invalid selection and * then the cut/copy actions cannot be performed. * Paste is done by aligning the upper left corner of the clipboard data with * the 1st element in the current selection of the JTable. Rows are added * as necessary. * @param e */ @Override public void actionPerformed(ActionEvent e) { // Cut/Copy if (e.getActionCommand().compareTo("Copy") == 0 || e.getActionCommand().compareTo("Cut" ) == 0) { try { // Check to ensure we have selected only a contiguous block of cells int numcols = myTable.getSelectedColumnCount(); int numrows = myTable.getSelectedRowCount(); if (numcols == 0 || numrows == 0) return; // nothing selected. int[] rowsselected = myTable.getSelectedRows(); int[] colsselected = myTable.getSelectedColumns(); if ( ! ((numrows-1 == rowsselected[rowsselected.length-1]-rowsselected[0] && numrows == rowsselected.length) && (numcols-1 == colsselected[colsselected.length-1]-colsselected[0] && numcols == colsselected.length))) { // In FPT discontiguous selections may be forbidden by table properties. logger.info("Invalid Copy selection: not contiguous"); return; } // Collect the selected cells. (Tabs separate cells in same row, // newlines separate rows. Last items in row do not have tabs.) StringBuilder sbf = new StringBuilder(); for (int r = 0; r < numrows; r++) { for (int c = 0; c < numcols; c++) { String cellValue = (String) myTable.getValueAt(rowsselected[r], colsselected[c]); sbf.append(cellValue); if (c < numcols - 1) {sbf.append("\t");} // No tab after last item. } sbf.append("\n"); // After each row. } // Put the selected cells on the clipboard. StringSelection stsel = new StringSelection(sbf.toString()); myClipboard.setContents(stsel, stsel); // If a Cut them clear the cells just copied. if (e.getActionCommand().compareTo("Cut" ) == 0) { for (int r = 0; r < numrows; r++) { for (int c = 0; c < numcols; c++) { myTable.setValueAt("", rowsselected[r], colsselected[c]); } } } } catch (Exception ex) { logger.info("Copy failed. {}", ex); } return; } // Paste if (e.getActionCommand().compareTo("Paste") == 0) { try { // Copy from clipboard to table starting at the top-left selected cell. // If nothing is selected then put at end of table. int startRow = 0; int startCol = 0; if (myTable.getSelectedRows().length == 0) { // Nothing selected, put at end of table, first column. startRow = myTable.getRowCount(); startCol = 0; } else { startRow = (myTable.getSelectedRows())[0]; startCol = (myTable.getSelectedColumns())[0]; } String transferData = (String)(myClipboard.getContents(this). getTransferData(DataFlavor.stringFlavor)); // Make sure at least one row is found. transferData = transferData.replaceAll("\n", " \n"); // Split transfer data into rows. String rowArray[] = transferData.split("\n"); // Paste into a copy of the table, then if successful write the // copy to the real table. This is much faster than updating // the actual table. // Get the table headings. Vector theHeadings = new Vector(); for (int c = 0; c < myTable.getColumnCount(); c++) { theHeadings.add(myTable.getColumnName(c)); } // Get the table data. Vector theData = ((DefaultTableModel) myTable.getModel()).getDataVector(); // If the table must be expanded to accommodate the pasted data // do it before starting to copy. int pasteRowCount = rowArray.length; int rowsToAdd = startRow + pasteRowCount - myTable.getRowCount(); if (rowsToAdd > 0) { // Create a blank row of proper size. Vector blankRow = new Vector(myTable.getColumnCount()); for (int c = 0; c < myTable.getColumnCount(); c++) { blankRow.add(""); } // Add blank rows to the end of the data. for (int r = 0; r < rowsToAdd; r++) { theData.add(blankRow.clone()); } } // Copy the clipboard data into the table. for (int r = 0; r < pasteRowCount; r++) { // Make sure something is found after every tab. Trim later. rowArray[r] = rowArray[r].replaceAll("\t", "\t "); // Get a row of transfer data String colArray[] = rowArray[r].split("\t"); int cCount = rowArray[0].split("\t").length; // Copy a row into the table. for (int c = 0; c < cCount; c++) { // Test overflow on table right edge. if (startCol + c < myTable.getColumnCount()) { String aCellValue = colArray[c].trim(); Vector rowR = (Vector) theData.get(startRow + r); rowR.setElementAt(aCellValue, startCol + c); theData.setElementAt(rowR, startRow + r); } } } // Transfer the table copy into the real table. ((DefaultTableModel) myTable.getModel()).setDataVector(theData, theHeadings); } catch(Exception ex) { logger.info("Paste failed. {}", ex); } } } }
8,997
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
Utils.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/Utils.java
package org.hvdw.jexiftoolgui; import ch.qos.logback.classic.Level; import org.hvdw.jexiftoolgui.controllers.*; import org.hvdw.jexiftoolgui.datetime.DateTime; import org.hvdw.jexiftoolgui.datetime.ModifyDateTime; import org.hvdw.jexiftoolgui.datetime.ShiftDateTime; import org.hvdw.jexiftoolgui.editpane.*; import org.hvdw.jexiftoolgui.facades.IPreferencesFacade; import org.hvdw.jexiftoolgui.facades.SystemPropertyFacade; import org.hvdw.jexiftoolgui.metadata.CreateArgsFile; import org.hvdw.jexiftoolgui.metadata.ExportMetadata; import org.hvdw.jexiftoolgui.metadata.MetaData; import org.hvdw.jexiftoolgui.metadata.RemoveMetadata; import org.hvdw.jexiftoolgui.model.GuiConfig; import org.hvdw.jexiftoolgui.renaming.RenamePhotos; import org.hvdw.jexiftoolgui.view.*; import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.table.*; import java.awt.*; import java.awt.Font; import java.awt.image.BufferedImage; import java.io.*; import java.net.URI; import java.net.URL; import java.text.DecimalFormat; import java.text.NumberFormat; import java.text.ParseException; import java.util.*; import java.util.List; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.stream.Collectors; import java.util.stream.IntStream; import static org.hvdw.jexiftoolgui.Application.OS_NAMES.APPLE; import static org.hvdw.jexiftoolgui.Application.OS_NAMES.LINUX; import static org.hvdw.jexiftoolgui.facades.IPreferencesFacade.PreferenceKey.*; import static org.hvdw.jexiftoolgui.facades.SystemPropertyFacade.SystemPropertyKey.*; import static org.slf4j.LoggerFactory.getLogger; public class Utils { private final static IPreferencesFacade prefs = IPreferencesFacade.defaultInstance; private final static ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) getLogger(Utils.class); private Utils() { SetLoggingLevel(Utils.class); } public static void SetApplicationWideLogLevel() { //Do this for all classes // first to do //main level Utils.SetLoggingLevel(Application.class); Utils.SetLoggingLevel(Utils.class); Utils.SetLoggingLevel(MenuActionListener.class); Utils.SetLoggingLevel(ButtonsActionListener.class); Utils.SetLoggingLevel(SQLiteJDBC.class); Utils.SetLoggingLevel(StandardFileIO.class); Utils.SetLoggingLevel(CheckPreferences.class); Utils.SetLoggingLevel(CommandRunner.class); Utils.SetLoggingLevel(ExifTool.class); Utils.SetLoggingLevel(UpdateActions.class); Utils.SetLoggingLevel(ExifToolCommands.class); Utils.SetLoggingLevel(CommandLineArguments.class); Utils.SetLoggingLevel(ImageFunctions.class); Utils.SetLoggingLevel(MouseListeners.class); Utils.SetLoggingLevel(mainScreen.class); Utils.SetLoggingLevel(ExportToPDF.class); Utils.SetLoggingLevel(TablePasteAdapter.class); Utils.SetLoggingLevel(PreferencesDialog.class); Utils.SetLoggingLevel(RenamePhotos.class); Utils.SetLoggingLevel(DateTime.class); Utils.SetLoggingLevel(ModifyDateTime.class); Utils.SetLoggingLevel(ShiftDateTime.class); Utils.SetLoggingLevel(EditExifdata.class); Utils.SetLoggingLevel(EditGeotaggingdata.class); Utils.SetLoggingLevel(EditGpanodata.class); Utils.SetLoggingLevel(EditGPSdata.class); Utils.SetLoggingLevel(EditLensdata.class); Utils.SetLoggingLevel(EditStringdata.class); Utils.SetLoggingLevel(EditUserDefinedCombis.class); Utils.SetLoggingLevel(EditXmpdata.class); Utils.SetLoggingLevel(MetaData.class); Utils.SetLoggingLevel(CreateArgsFile.class); Utils.SetLoggingLevel(ExportMetadata.class); Utils.SetLoggingLevel(RemoveMetadata.class); Utils.SetLoggingLevel(GuiConfig.class); Utils.SetLoggingLevel(CreateMenu.class); Utils.SetLoggingLevel(ExifToolReferencePanel.class); Utils.SetLoggingLevel(JavaImageViewer.class); Utils.SetLoggingLevel(LinkListener.class); Utils.SetLoggingLevel(WebPageInPanel.class); Utils.SetLoggingLevel(Favorites.class); Utils.SetLoggingLevel(CreateUpdatemyLens.class); Utils.SetLoggingLevel(MetadataUserCombinations.class); Utils.SetLoggingLevel(SelectmyLens.class); Utils.SetLoggingLevel(SimpleWebView.class); } public static boolean containsIndices(int[] selectedIndices) { List<Integer> intList = IntStream.of(selectedIndices).boxed().collect(Collectors.toList()); return intList.size() != 0; } static public void SetLoggingLevel(Class usedClass) { String logLevel = prefs.getByKey(LOG_LEVEL, "Info"); ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) getLogger(usedClass); //Logger logger = getLogger(usedClass); // hardcode in case of debugging/troubleshooting //logLevel = "Trace"; switch (logLevel) { case "Off": logger.setLevel(Level.OFF); break; case "Error": logger.setLevel(Level.ERROR); break; case "Warn": logger.setLevel(Level.WARN); break; case "Info": logger.setLevel(Level.INFO); break; case "Debug": logger.setLevel(Level.DEBUG); break; case "Trace": logger.setLevel(Level.TRACE); break; default: logger.setLevel(Level.INFO); break; } } /* / Set default font for everything in the Application / from: https://stackoverflow.com/questions/7434845/setting-the-default-font-of-swing-program (Romain Hippeau) / To be called like : Utils.setUIFont (new FontUIResource("SansSerif", Font.PLAIN,12)); */ public static void setUIFont (javax.swing.plaf.FontUIResource f){ java.util.Enumeration keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get (key); if (value instanceof javax.swing.plaf.FontUIResource) UIManager.put (key, f); } } /* * Base function to get screen resolution in width and height */ public static int[] getResolution() { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int scrwidth = screenSize.width; MyVariables.setScreenWidth(screenSize.width); int scrheight = screenSize.height; MyVariables.setScreenHeight(screenSize.height); int[] res = {scrwidth, scrheight}; return res; } /* / Base function to get screen bounds (resolution minus taskbar and/or menu bar */ public static Rectangle getScreenBounds() { GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); Rectangle bounds = env.getMaximumWindowBounds(); logger.debug("MyVariables.getScreenWidth {} MyVariables.getScreenHeight {} Screen Bounds {}", MyVariables.getScreenWidth(), MyVariables.getScreenHeight(), bounds); return bounds; } /* * Opens the default browser of the Operating System * and displays the specified URL */ static public void openBrowser(String webUrl) { try { /*if (Desktop.isDesktopSupported()) { Desktop.getDesktop().browse(URI.create(webUrl)); return; }*/ Application.OS_NAMES os = Utils.getCurrentOsName(); Runtime runtime = Runtime.getRuntime(); if ( os == LINUX) { // make an exception for linux, because Ubuntu and Ubuntu derivatives, do not always support the universal "browse" command // So for linux we use the universal xdg-open runtime.exec("xdg-open " + webUrl); } else { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().browse(URI.create(webUrl)); return; } } } catch (IOException | IllegalArgumentException e) { logger.error("Could not open browser", e); } } public static String systemProgramInfo() { StringBuilder infostring = new StringBuilder(); infostring.append("<big>" + ResourceBundle.getBundle("translations/program_strings").getString("sys.title") + "</big><hr><br><table width=\"90%\" border=0>"); infostring.append("<tr><td>" + ResourceBundle.getBundle("translations/program_strings").getString("sys.os") + "</td><td>" + SystemPropertyFacade.getPropertyByKey(OS_NAME) + "</td></tr>"); infostring.append("<tr><td>" + ResourceBundle.getBundle("translations/program_strings").getString("sys.osarch") + "</td><td>" + SystemPropertyFacade.getPropertyByKey(OS_ARCH).replaceAll("(\\r|\\n)", "") + "</td></tr>"); // or use replaceAll(LINE_SEPATATOR, "") or replaceAll("(\\r|\\n)", "") infostring.append("<tr><td>" + ResourceBundle.getBundle("translations/program_strings").getString("sys.osv") + "</td><td>" + SystemPropertyFacade.getPropertyByKey(OS_VERSION).replaceAll(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR), "") + "</td></tr>"); infostring.append("<tr><td>" + ResourceBundle.getBundle("translations/program_strings").getString("sys.uhome") + "</td><td>" + SystemPropertyFacade.getPropertyByKey(USER_HOME).replaceAll(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR), "") + "</td></tr>"); infostring.append("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>"); infostring.append("<tr><td>" + ResourceBundle.getBundle("translations/program_strings").getString("sys.jtgv") + "</td><td>" + ProgramTexts.Version.replaceAll("(\\r|\\n)", "") + "</td></tr>"); infostring.append("<tr><td>" + ResourceBundle.getBundle("translations/program_strings").getString("sys.ev") + "</td><td>" + (MyVariables.getExiftoolVersion()).replaceAll("(\\r|\\n)", "") + "</td></tr>"); infostring.append("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>"); infostring.append("<tr><td>" + ResourceBundle.getBundle("translations/program_strings").getString("sys.jv") + "</td><td>" + SystemPropertyFacade.getPropertyByKey(JAVA_VERSION) + "</td></tr>"); infostring.append("<tr><td>" + ResourceBundle.getBundle("translations/program_strings").getString("sys.jhome") + "</td><td>" + SystemPropertyFacade.getPropertyByKey(JAVA_HOME) + "</td></tr>"); infostring.append("</table></html>"); return infostring.toString(); } /* * The ImageInfo method uses exiftool to read image info which is outputted as csv * This method converts it to 3-column "tabular" data */ public static void readTagsCSV(String tagname) { List<List<String>> tagrecords = new LinkedList<>(); String tags = StandardFileIO.readTextFileAsStringFromResource("resources/tagxml/" + tagname + ".xml"); if (tags.length() > 0) { String[] lines = tags.split(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR)); for (String line : lines) { String[] tagvalues = line.split(","); tagrecords.add(Arrays.asList(tagvalues)); } } } // Displays the license in an option pane public static void showLicense(JPanel myComponent) { String license = StandardFileIO.readTextFileAsStringFromResource("COPYING"); JTextArea textArea = new JTextArea(license); boolean isWindows = Utils.isOsFromMicrosoft(); if (isWindows) { textArea.setFont(new Font("Sans_Serif", Font.PLAIN, 13)); } JScrollPane scrollPane = new JScrollPane(textArea); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scrollPane.setPreferredSize(new Dimension(500, 500)); JOptionPane.showMessageDialog(myComponent, scrollPane, "GNU GENERAL PUBLIC LICENSE Version 3", JOptionPane.INFORMATION_MESSAGE); } // Shows or hides the progressbar when called from some (long) running method static void progressStatus(JProgressBar progressBar, Boolean show) { if (show) { progressBar.setVisible(true); progressBar.setIndeterminate(true); progressBar.setBorderPainted(true); progressBar.repaint(); } else { progressBar.setVisible(false); } } /* * Checks whether the artist (xmp-dc:creator) and Copyright (xmp-dc:rights) and Credits (xmp:credits) preference exists * and uses these in the edit exif/xmp panes */ public static String[] checkPrefsArtistCreditsCopyRights() { String[] ArtCredCopyPrefs = { prefs.getByKey(ARTIST, ""), prefs.getByKey(CREDIT, ""), prefs.getByKey(COPYRIGHTS, "") }; return ArtCredCopyPrefs; } public static List<String> AlwaysAdd() { List<String> AlwaysAddParams = new ArrayList<String>(); String exifartist = prefs.getByKey(ARTIST, ""); String copyright = prefs.getByKey(COPYRIGHTS, ""); String credits = prefs.getByKey(CREDIT, ""); if (!prefs.getByKey(ARTIST, "").equals("") && !prefs.getByKey(ARTIST, "").equals(" ") ) { exifartist = "-exif:Artist=" + (prefs.getByKey(ARTIST, "")).trim(); AlwaysAddParams.add(exifartist); exifartist = "-xmp-dc:creator=" + prefs.getByKey(ARTIST, ""); AlwaysAddParams.add(exifartist); exifartist = "-iptc:by-line=" + prefs.getByKey(ARTIST, ""); AlwaysAddParams.add(exifartist); } if (!prefs.getByKey(CREDIT, "").equals("") && !prefs.getByKey(CREDIT, "").equals(" ")) { credits = "-xmp-photoshop:Credit=" + (prefs.getByKey(CREDIT, "")).trim(); AlwaysAddParams.add(credits); credits = "-iptc:Credit=" + prefs.getByKey(CREDIT, ""); AlwaysAddParams.add(credits); } if (!prefs.getByKey(COPYRIGHTS, "").equals("") && !prefs.getByKey(COPYRIGHTS, "").equals(" ")) { copyright = "-exif:Copyright=" + (prefs.getByKey(COPYRIGHTS, "")).trim(); AlwaysAddParams.add(copyright); copyright = "-xmp-dc:rights=" + prefs.getByKey(COPYRIGHTS, ""); AlwaysAddParams.add(copyright); copyright = "-iptc:copyrightnotice=" + prefs.getByKey(COPYRIGHTS, ""); AlwaysAddParams.add(copyright); } AlwaysAddParams.add("-exif:ProcessingSoftware=jExifToolGUI " + ProgramTexts.Version); //AlwaysAddParams.add("-exif:Software=jExifToolGUI " + ProgramTexts.Version); AlwaysAddParams.add("-xmp-tiff:Software=jExifToolGUI " + ProgramTexts.Version); return AlwaysAddParams; } /* * This method checks for a new version on the repo. * It can be called from startup (preferences setting) or from the Help menu */ public static void checkForNewVersion(String fromWhere) { String web_version = ""; boolean versioncheck = prefs.getByKey(VERSION_CHECK, true); boolean validconnection = true; boolean newer_available = false; String update_url = "https://raw.githubusercontent.com/hvdwolf/jExifToolGUI/master/version.txt"; if (fromWhere.equals("menu") || versioncheck) { try { URL url = new URL(update_url); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); web_version = in.readLine(); in.close(); } catch (IOException ex) { logger.error("upgrade check gives error {}", ex.toString()); ex.printStackTrace(); validconnection = false; JOptionPane.showMessageDialog(null, String.format(ProgramTexts.HTML, 250, ResourceBundle.getBundle("translations/program_strings").getString("msd.nonetwlong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.nonetwork"), JOptionPane.INFORMATION_MESSAGE); } if (validconnection) { String jv = SystemPropertyFacade.getPropertyByKey(JAVA_VERSION); logger.info("Using java version {}: ", jv); logger.info("Version on the web: " + web_version); logger.info("This version: " + ProgramTexts.Version); String[] awebversion = web_version.split("\\."); // Need to escape on literal dot instead of regex ".", which means any character String[] alocalversion = (ProgramTexts.Version).split("\\."); if (Integer.parseInt(awebversion[0]) > Integer.parseInt(alocalversion[0]) ) { newer_available = true; logger.debug("web_digit1 {} local_digit1 {} newer_available {}",awebversion[0], alocalversion[0], newer_available); } else if (Integer.parseInt(awebversion[1]) > Integer.parseInt(alocalversion[1]) ) { newer_available = true; logger.debug("web_digit2 {} local_digit2 {} newer_available {}",awebversion[1], alocalversion[1], newer_available); } else if (Integer.parseInt(awebversion[2]) > Integer.parseInt(alocalversion[2]) ) { newer_available = true; logger.debug("web_digit2 {} local_digit2 {} newer_available {}",awebversion[2], alocalversion[2], newer_available); } //int version_compare = web_version.compareTo(ProgramTexts.Version); if (newer_available) { // This means the version on the web is newer //if (version_compare > 0) { // This means the version on the web is newer //if (Float.valueOf(web_version) > Float.valueOf(ProgramTexts.Version)) { String[] options = {"No", "Yes"}; int choice = JOptionPane.showOptionDialog(null, String.format(ProgramTexts.HTML, 400, ResourceBundle.getBundle("translations/program_strings").getString("msd.jtgnewversionlong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.jtgnewversion"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (choice == 1) { //Yes // Do something openBrowser("https://github.com/hvdwolf/jExifToolGUI/releases"); System.exit(0); } } else { if (fromWhere.equals("menu")) { JOptionPane.showMessageDialog(null, String.format(ProgramTexts.HTML, 250, ResourceBundle.getBundle("translations/program_strings").getString("msd.jtglatestversionlong")), ResourceBundle.getBundle("translations/program_strings").getString("msd.jtglatestversion"), JOptionPane.INFORMATION_MESSAGE); } } } } } //////////////////////////////////////////////////////////////////////////////////////////////////// // Create correct exiftool command call depending on operating system public static String platformExiftool() { // exiftool on windows or other String exiftool = prefs.getByKey(EXIFTOOL_PATH, ""); if (isOsFromMicrosoft()) { exiftool = exiftool.replace("\\", "/"); } return exiftool; } // Get the configured metadata /* / This method checks in which language the user want to see the metadata tags. / This only worksfor the tags that have been treanslated in that language */ public static String getmetadataLanguage() { String metadatalanguage = prefs.getByKey(METADATA_LANGUAGE, ""); if ( ("".equals(metadatalanguage)) || ("exiftool - default".equals(metadatalanguage)) ) { return ""; } else { String[] parts = metadatalanguage.split(" - "); logger.debug("metadatalanguage: " + parts[0]); //return "-lang " + parts[0]; return parts[0]; } } /* / This method checks whther the user wants to see GPS coordinates in decimal degrees or in deg-min-sec (exiftool default */ public static boolean UseDecimalDegrees() { Boolean usedecimaldegrees = prefs.getByKey(SHOW_DECIMAL_DEGREES, false); return usedecimaldegrees; } /* / This method checks whether the user wants tthe tags alphabetically sorted */ public static boolean Sorted_Tags() { boolean sorted_tags = prefs.getByKey(SORT_CATEGORIES_TAGS, false); return sorted_tags; } /* / This method checks whether the user wants to see data from structures as flat tags or as structures */ public static boolean Display_Structured_Data() { Boolean enable_structs = prefs.getByKey(ENABLE_STRUCTS, false); return enable_structs; } public static String stringBetween(String value, String before, String after) { // Return a substring between the two strings before and after. int posA = value.indexOf(before); if (posA == -1) { return ""; } int posB = value.lastIndexOf(after); if (posB == -1) { return ""; } int adjustedPosA = posA + before.length(); if (adjustedPosA >= posB) { return ""; } return value.substring(adjustedPosA, posB); } ////////////////////////////////// Load images and display them /////////////////////////////////// /** * This method returns the file extension based on a filename String * @param filename * @return file extension */ public static String getFileExtension(String filename) { int lastIndexOf = filename.lastIndexOf(".") + 1; if (lastIndexOf == -1) { return ""; // empty extension } return filename.substring(lastIndexOf); } /** * This method returns the file extension based on a File object * @param file * @return file extension */ public static String getFileExtension(File file) { String filename = file.getPath(); int lastIndexOf = filename.lastIndexOf(".") + 1; if (lastIndexOf == -1) { return ""; // empty extension } return filename.substring(lastIndexOf); } public static String getFileNameWithoutExtension(String filename) { return filename.replaceFirst("[.][^.]+$", ""); } public static String getFilePathWithoutExtension(String filepath) { // Duplicate of above, but makes it easier when working with file paths or only file names return filepath.replaceFirst("[.][^.]+$", ""); } /* / an instance of LabelIcon holds an icon and label pair for each row. */ private static class LabelIcon { Icon icon; String label; public LabelIcon(Icon icon, String label) { this.icon = icon; this.label = label; } } /* / This is the extended TableCellRenderer / Because DefaultTableCellRenderer is JLabel, you can use it's text alignment properties in a custom renderer to label the icon. */ private static class LabelIconRenderer extends DefaultTableCellRenderer { public LabelIconRenderer() { setHorizontalTextPosition(JLabel.CENTER); setVerticalTextPosition(JLabel.BOTTOM); } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) { JLabel r = (JLabel) super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, col); setIcon(((LabelIcon) value).icon); setText(((LabelIcon) value).label); return r; } } private static class MultiLineCellRenderer extends JTextArea implements TableCellRenderer { public MultiLineCellRenderer() { setLineWrap(true); setWrapStyleWord(true); setOpaque(true); } public Class getColumnClass(int columnIndex) { return String.class; } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (isSelected) { setForeground(table.getSelectionForeground()); setBackground(table.getSelectionBackground()); } else { setForeground(table.getForeground()); setBackground(table.getBackground()); } setFont(table.getFont()); if (hasFocus) { setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); if (table.isCellEditable(row, column)) { setForeground(UIManager.getColor("Table.focusCellForeground")); setBackground(UIManager.getColor("Table.focusCellBackground")); } } else { setBorder(new EmptyBorder(1, 2, 1, 2)); } setText((value == null) ? "" : value.toString()); return this; } } static public String returnBasicImageDataString(String filename, String stringType) { String strImgData = ""; Double calcFLin35mmFormat = 0.0; // hashmap basicImgData: ImageWidth, ImageHeight, Orientation, ISO, FNumber, ExposureTime, focallength, focallengthin35mmformat HashMap<String, String> imgBasicData = MyVariables.getimgBasicData(); StringBuilder imginfo = new StringBuilder(); NumberFormat df = DecimalFormat.getInstance(Locale.US); df.setMaximumFractionDigits(1); if ("html".equals(stringType)) { //imginfo.append("<html>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.filename") + ": " + filename); imginfo.append("<html>" + filename); imginfo.append("<br><br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.imagesize") + ": " + imgBasicData.get("ImageWidth") + " x " + imgBasicData.get("ImageHeight")); //imginfo.append("<br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.orientation") + imgBasicData.get("Orientation")); if (imgBasicData.containsKey("ISO")) { imginfo.append("<br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.iso") + ": " + imgBasicData.get("ISO")); } else { imginfo.append("<br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.iso") + ": " + ResourceBundle.getBundle("translations/program_strings").getString("lp.notavailable")); } if (imgBasicData.containsKey("FNumber")) { imginfo.append("<br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.fnumber") + ": " + imgBasicData.get("FNumber")); } else { imginfo.append("<br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.fnumber") + ": " + ResourceBundle.getBundle("translations/program_strings").getString("lp.notavailable")); } if (imgBasicData.containsKey("ExposureTime")) { imginfo.append("<br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.exposuretime") + ": 1/" + String.valueOf(Math.round(1 / Float.parseFloat(imgBasicData.get("ExposureTime"))))); } else { imginfo.append("<br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.exposuretime") + ": " + ResourceBundle.getBundle("translations/program_strings").getString("lp.notavailable")); } if (imgBasicData.containsKey("FocalLength")) { imginfo.append("<br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.focallength") + ": " + imgBasicData.get("FocalLength") + " mm"); } else { imginfo.append("<br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.focallength") + ": " + ResourceBundle.getBundle("translations/program_strings").getString("lp.notavailable")); } if (imgBasicData.containsKey("FocalLengthIn35mmFormat") ) { imginfo.append("<br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.focallength35mm") + ": " + imgBasicData.get("FocalLengthIn35mmFormat") + " mm"); } else if (imgBasicData.containsKey("ScaleFactor35efl") ) { try { calcFLin35mmFormat = Double.parseDouble(imgBasicData.get("FocalLength").trim()) * Double.parseDouble(imgBasicData.get("ScaleFactor35efl").trim()); //logger.info("String.valueOf(calcFLin35mmFormat) {} df.format(calcFLin35mmFormat) {}", String.valueOf(calcFLin35mmFormat), df.format(calcFLin35mmFormat)); imginfo.append("<br>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.focallength35mm") + ": " + df.format(calcFLin35mmFormat) + " mm"); } catch (NumberFormatException e) { logger.error("calcFLin35mmFormat failed {}", String.valueOf(calcFLin35mmFormat)); e.printStackTrace(); } } strImgData = imginfo.toString(); } else if ("OneLine".equals(stringType)) { imginfo.append(ResourceBundle.getBundle("translations/program_strings").getString("lp.filename") + ": " + filename); imginfo.append("; " + ResourceBundle.getBundle("translations/program_strings").getString("lp.imagesize") + ": " + imgBasicData.get("ImageWidth") + " x " + imgBasicData.get("ImageHeight")); //imginfo.append("; " + ResourceBundle.getBundle("translations/program_strings").getString("lp.orientation") + imgBasicData.get("Orientation")); if (imgBasicData.containsKey("ISO")) { imginfo.append("; " + ResourceBundle.getBundle("translations/program_strings").getString("lp.iso") + ": " + imgBasicData.get("ISO")); } if (imgBasicData.containsKey("FNumber")) { imginfo.append("; " + ResourceBundle.getBundle("translations/program_strings").getString("lp.fnumber") + ": " + imgBasicData.get("FNumber")); } if (imgBasicData.containsKey("ExposureTime")) { imginfo.append("; " + ResourceBundle.getBundle("translations/program_strings").getString("lp.exposuretime") + ": 1/" + String.valueOf(Math.round(1 / Float.parseFloat(imgBasicData.get("ExposureTime"))))); } if (imgBasicData.containsKey("FocalLength")) { imginfo.append("; " + ResourceBundle.getBundle("translations/program_strings").getString("lp.focallength") + ": " + imgBasicData.get("FocalLength") + " mm"); } if (imgBasicData.containsKey("FocalLengthIn35mmFormat") ) { imginfo.append("; " + ResourceBundle.getBundle("translations/program_strings").getString("lp.focallength35mm") + ": " + imgBasicData.get("FocalLengthIn35mmFormat") + " mm"); } else if (imgBasicData.containsKey("ScaleFactor35efl") ) { try { calcFLin35mmFormat = Double.parseDouble(imgBasicData.get("FocalLength")) * Double.parseDouble(imgBasicData.get("ScaleFactor35efl")); imginfo.append("; " + ResourceBundle.getBundle("translations/program_strings").getString("lp.focallength35mm") + ": " + df.format(calcFLin35mmFormat) + " mm"); } catch (NumberFormatException e) { logger.error("calcFLin35mmFormat failed {}", String.valueOf(calcFLin35mmFormat)); e.printStackTrace(); } } strImgData = imginfo.toString(); } else if ("OneLineHtml".equals(stringType)) { imginfo.append("<html><b>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.filename") + "</b>: " + filename); imginfo.append("; <b>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.imagesize") + ":</b> " + imgBasicData.get("ImageWidth") + " x " + imgBasicData.get("ImageHeight")); //imginfo.append("; " + ResourceBundle.getBundle("translations/program_strings").getString("lp.orientation") + imgBasicData.get("Orientation")); if (imgBasicData.containsKey("ISO")) { imginfo.append("; <b>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.iso") + ":</b> " + imgBasicData.get("ISO")); } if (imgBasicData.containsKey("FNumber")) { imginfo.append("; <b>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.fnumber") + ":</b> " + imgBasicData.get("FNumber")); } if (imgBasicData.containsKey("ExposureTime")) { imginfo.append("; <b>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.exposuretime") + ":</b> 1/" + String.valueOf(Math.round(1 / Float.parseFloat(imgBasicData.get("ExposureTime"))))); } if (imgBasicData.containsKey("FocalLength")) { imginfo.append("; <b>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.focallength") + ":</b> " + imgBasicData.get("FocalLength") + " mm"); } if (imgBasicData.containsKey("FocalLengthIn35mmFormat") ) { imginfo.append("; <b>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.focallength35mm") + ":</b> " + imgBasicData.get("FocalLengthIn35mmFormat") + " mm"); } else if (imgBasicData.containsKey("ScaleFactor35efl") ) { try { calcFLin35mmFormat = Double.parseDouble(imgBasicData.get("FocalLength")) * Double.parseDouble(imgBasicData.get("ScaleFactor35efl")); imginfo.append("; <b>" + ResourceBundle.getBundle("translations/program_strings").getString("lp.focallength35mm") + ":</b> " + df.format(calcFLin35mmFormat) + " mm"); } catch (NumberFormatException e) { logger.error("calcFLin35mmFormat failed {}", String.valueOf(calcFLin35mmFormat)); e.printStackTrace(); } } strImgData = imginfo.toString(); } return strImgData; } public static void progressPane (JPanel rootPanel, boolean visible) { JOptionPane pane = new JOptionPane(); JProgressBar progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setSize(200,20); progressBar.setBorderPainted(true); pane.add(progressBar); progressBar.repaint(); pane.createDialog(progressBar, "busy"); pane.setVisible(visible); } public static File[] loadImages(String loadingType, JPanel rootPanel, JPanel LeftPanel, JScrollPane LeftTableScrollPanel, JScrollPane LeftGridScrollPanel, JTable tableListfiles, JTable previewTable, JList iconViewList, JTable ListexiftoolInfotable, JButton[] commandButtons, JLabel[] mainScreenLabels, JProgressBar progressBar, String[] params, JCheckBox[] loadOptions) { File[] files; boolean files_null = false; //JList iconGridView = null; // "Translate" for clarity, instead of using the array index; JLabel OutputLabel = mainScreenLabels[0]; JLabel lblLoadedFiles = mainScreenLabels[1]; JLabel lblimgSourceFolder = mainScreenLabels[2]; JLabel lblFileNamePath = mainScreenLabels[3]; JButton buttonShowImage = commandButtons[2]; JButton buttonCompare = commandButtons[3]; JButton buttonSearchMetadata = commandButtons[4]; JButton buttonSlideshow = commandButtons[5]; boolean showCreatePreviews = loadOptions[0].isSelected(); boolean loadMetadata = loadOptions[1].isSelected(); //logger.info("Start loadimages: showCreatePreviews {} loadMetadata {}",showCreatePreviews, loadMetadata); // First check if we want to create previews or not. If not we will create the mini preview table at the bottom left if ( (showCreatePreviews) ) { //The user wants to see previews so show the grid, but not the normal listfile table or the mini preview LeftTableScrollPanel.setVisible(false); previewTable.setVisible(false); tableListfiles.setVisible(false); LeftGridScrollPanel.setVisible(true); iconViewList.setVisible(true); } else { //The user doesn't want previews. Show listtable showing file names plus small preview. Hide the grid LeftGridScrollPanel.setVisible(false); iconViewList.setVisible(false); LeftTableScrollPanel.setVisible(true); previewTable.setVisible(true); tableListfiles.setVisible(true); // Preview table: the small preview in the bottom left DefaultTableModel previewTableModel = (DefaultTableModel) previewTable.getModel(); previewTable.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() { protected void setValue(Object value) { if (loadMetadata) { //Userwants metadata which means we don't have to show it here -> single column preview table if (value instanceof ImageIcon) { setIcon((ImageIcon) value); setText(""); } else { setIcon(null); super.setValue(value); } } else { // -> dual-column preview table if (value instanceof LabelIcon) { setIcon(((LabelIcon) value).icon); setHorizontalTextPosition(JLabel.CENTER); setVerticalTextPosition(JLabel.BOTTOM); setText(((LabelIcon) value).label); } } } }); if (loadMetadata) { //User wants metadata which means we do not have to show it in the preview table as it is above in the list table previewTable.setDefaultRenderer(LabelIcon.class, new LabelIconRenderer()); previewTableModel.setColumnIdentifiers(new String[]{ResourceBundle.getBundle("translations/program_strings").getString("lp.filename")}); previewTable.setRowHeight(160); } else { previewTableModel.setColumnIdentifiers(new String[]{ResourceBundle.getBundle("translations/program_strings").getString("lp.thumbtablephotos"), ResourceBundle.getBundle("translations/program_strings").getString("lp.thumbtabledata")}); previewTable.getColumnModel().getColumn(0).setPreferredWidth(170); previewTable.getColumnModel().getColumn(1).setPreferredWidth(250); //previewTable.setRowHeight(160); // Now set rowheight depending on font size int userFontSize = Integer.parseInt(prefs.getByKey(USER_DEFINED_FONTSIZE, "12")); int rowHeight = (int) Math.round( ( (double) userFontSize / (double) 12 * (double) 150 ) ); // 160 is my original row height based on fontsize 12 //logger.debug("userfontsize {}; rowheight{}", String.valueOf(userFontSize), String.valueOf(rowHeight) ); previewTable.setRowHeight(rowHeight); } previewTableModel.setRowCount(0); } String prefFileDialog = prefs.getByKey(PREFERRED_FILEDIALOG, "jfilechooser"); if ("images".equals(loadingType)) { logger.debug("load images pushed or menu load images"); OutputLabel.setText(ResourceBundle.getBundle("translations/program_strings").getString("pt.loadingimages")); if ("jfilechooser".equals(prefFileDialog)) { logger.debug("load images using jfilechooser"); files = StandardFileIO.getFileNames(rootPanel); logger.debug("AFTER load images using jfilechooser"); } else { logger.debug("load images pushed or menu load images using AWT file dialog"); files = StandardFileIO.getFileNamesAwt(rootPanel); logger.debug("AFTER load images using AWT file dialog"); } } else if ("folder".equals(loadingType)) { // loadingType = folder OutputLabel.setText(ResourceBundle.getBundle("translations/program_strings").getString("pt.loadingdirectory")); logger.debug("load folder pushed or menu load folder"); if ("jfilechooser".equals(prefFileDialog)) { logger.debug("load folder using jfilechooser"); files = StandardFileIO.getFolderFiles(rootPanel); logger.debug("AFTER load folder using jfilechooser"); } else { logger.debug("load folder using AWT file dialog"); files = StandardFileIO.getFolderFilesAwt(rootPanel); logger.debug("AFTER load folder using AWT file dialog"); } } else if ("dropped files".equals(loadingType)) { // files dropped onto our app OutputLabel.setText(ResourceBundle.getBundle("translations/program_strings").getString("pt.droppedfiles")); files = MyVariables.getLoadedFiles(); } else if ("reloadfromsearchresult".equals(loadingType)) { // We now reload the images from our metadata search result OutputLabel.setText(ResourceBundle.getBundle("translations/program_strings").getString("pt.reloadimages")); files = MyVariables.getLoadedFiles(); } else { // Use files from command line OutputLabel.setText(ResourceBundle.getBundle("translations/program_strings").getString("pt.commandline")); files = MyVariables.getLoadedFiles(); } if (files != null) { // First show some text to the users when starting to load // In the right table String res = "jExifToolGUI\t" + ResourceBundle.getBundle("translations/program_strings").getString("pt.loadingimages") + "\t" + ResourceBundle.getBundle("translations/program_strings").getString("pt.loadingimages"); displayInfoForSelectedImage(res, ListexiftoolInfotable); // And it the left grid DefaultListModel iconViewListModel = new DefaultListModel(); int count = 0; JList loadingTexts = new JList(iconViewListModel); loadingTexts.setCellRenderer( new LabelGridIconRenderer()); loadingTexts.setLayoutOrientation(JList.HORIZONTAL_WRAP); loadingTexts.setFixedCellHeight(180); loadingTexts.setFixedCellWidth(180); loadingTexts.setVisibleRowCount(-1); for (int i =0; i <= 19; i++ ) { iconViewListModel.add(count++, new LabelIcon(null, ResourceBundle.getBundle("translations/program_strings").getString("pt.loadingimages"))); } LeftGridScrollPanel.setViewportView(loadingTexts); MyVariables.seticonView(loadingTexts); // Initialize our data Hashmap HashMap <String, HashMap<String, String> > imagesData = new HashMap<String, HashMap<String, String>>(); MyVariables.setimagesData(imagesData); lblLoadedFiles.setText(String.valueOf(files.length)); logger.debug("After loading images, loading files or dropping files: no. of files > 0"); Executor executor = Executors.newSingleThreadExecutor(); //JList finalIconGridView = iconGridView; executor.execute(new Runnable() { @Override public void run() { //int jpegcounter = 0; int loopcounter = 0; String filename; File firstFile = null; //boolean showCreatePreview = loadOptions[0].isSelected(); filename = files[0].getName().replace("\\", "/"); lblimgSourceFolder.setText(files[0].getParent()); firstFile = files[0]; // LET OP, Toegevoegd MyVariables.setSelectedImagePath(files[0].getParent()); MyVariables.setSinglePreview(files[0]); MyVariables.setSinglePreviewFileName(filename); // Always Always try to extract thumbnails and previews of selected images. This normally only works for JPGs, RAWs and (modern) TIFFs if (showCreatePreviews) { ImageFunctions.extractThumbnails(); } //logger.info("Before displayfiles: displayprevriew {} loadmetadata {}", showCreatePreviews, loadMetadata); Utils.displayFiles(tableListfiles, iconViewList, LeftPanel, LeftGridScrollPanel, showCreatePreviews, loadMetadata, ListexiftoolInfotable, mainScreenLabels, loadOptions); // After loading check whether we have multiple files, or only one file if (files.length > 1) { // We have multiple images loaded. // Do not display first one automatically but let user select String res = "jExifToolGUI\t" + ResourceBundle.getBundle("translations/program_strings").getString("vdtab.multfilesloaded") + "\t" + ResourceBundle.getBundle("translations/program_strings").getString("vdtab.selectimage"); lblFileNamePath.setText(""); displayInfoForSelectedImage(res, ListexiftoolInfotable); } else { MyVariables.setSelectedRowOrIndex(0); String res = getImageInfoFromSelectedFile(params); displayInfoForSelectedImage(res, ListexiftoolInfotable); lblFileNamePath.setText(firstFile.getPath()); } if (loadMetadata) { buttonSearchMetadata.setEnabled(true); } else { buttonSearchMetadata.setEnabled(false); //Still load all metadata but do it in the background logger.debug("Starting to read all the metadata in the background"); SwingUtilities.invokeLater(new Runnable() { public void run() { progressBar.setVisible(true); mainScreenLabels[0].setText(ResourceBundle.getBundle("translations/program_strings").getString("pt.readingmetadatabackground")); } }); ImageFunctions.getImageData(mainScreenLabels, progressBar, buttonSearchMetadata); } buttonShowImage.setEnabled(true); buttonCompare.setEnabled(true); //buttonSlideshow.setEnabled(true); // Check whether the users wants to see previews when loading. If not display the preview of the first loaded image if ( !(loadOptions[0].isSelected()) ) { //No previews, so single preview in bottom-left pane displaySinglePreview(previewTable, loadMetadata); } //OutputLabel.setText(" Images loaded ..."); OutputLabel.setText(""); // progressbar enabled immedately after this void run starts in the InvokeLater, so I disable it here at the end of this void run Utils.progressStatus(progressBar, false); //progressPane(rootPanel, false); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { progressBar.setVisible(true); //progressPane(rootPanel, true); } }); // Set our setters List<Integer> selectedIndicesList = new ArrayList<>(); MyVariables.setselectedIndicesList(selectedIndicesList); MyVariables.setLoadedFiles(files); } else { logger.debug("no files loaded. User pressed cancel."); files_null = true; lblLoadedFiles.setText(""); OutputLabel.setText(""); } return files; } /* * Display the loaded files with icon and name */ static void displayFiles(JTable jTable_File_Names, JList iconViewList, JPanel LeftPanel, JScrollPane LeftGridScrollPanel, boolean showCreatePreviews, boolean loadMetadata, JTable ListexiftoolInfotable, JLabel[] mainScreenLabels, JCheckBox[] loadOptions) { //static void displayFiles(JTable jTable_File_Names, JList iconGridView, JPanel LeftPanel, JScrollPane LeftGridScrollPanel, boolean showCreatePreviews, boolean loadMetadata) { int selectedRow, selectedColumn; ImageIcon icon = null; File[] files = MyVariables.getLoadedFiles(); boolean gridView = false; DefaultListModel iconViewListModel = new DefaultListModel(); int count = 0; iconViewList = new JList(iconViewListModel); iconViewList.setCellRenderer( new LabelGridIconRenderer()); iconViewList.setLayoutOrientation(JList.HORIZONTAL_WRAP); iconViewList.setFixedCellHeight(180); iconViewList.setFixedCellWidth(180); iconViewList.setVisibleRowCount(-1); boolean singleColumnTable = true; DefaultTableModel tableModel = (DefaultTableModel) jTable_File_Names.getModel(); jTable_File_Names.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() { protected void setValue(Object value) { if (value instanceof LabelIcon) { setIcon(((LabelIcon) value).icon); setHorizontalTextPosition(JLabel.CENTER); setVerticalTextPosition(JLabel.BOTTOM); setText(((LabelIcon) value).label); } } }); if (showCreatePreviews) { iconViewListModel.removeAllElements(); iconViewList.clearSelection(); } else { tableModel.setColumnIdentifiers(new String[]{ResourceBundle.getBundle("translations/program_strings").getString("lp.filename")}); jTable_File_Names.setRowHeight(25); tableModel.setRowCount(0); tableModel.fireTableDataChanged(); jTable_File_Names.clearSelection(); jTable_File_Names.setCellSelectionEnabled(true); //Object[] ImgFilenameRow = new Object[2]; } Object[] ImgFilenameRow = new Object[2]; //Object[] ImgFileNameListCell = new Object[2]; String filename = ""; Application.OS_NAMES currentOsName = getCurrentOsName(); for (File file : files) { filename = file.getName().replace("\\", "/"); logger.debug("Now working on image: " + filename); if (loadMetadata) { ImageFunctions.getImageMetaData(file); } if (showCreatePreviews) { //User wants a preview icon = ImageFunctions.useCachedOrCreateIcon(file); } //logger.info("Before display: Singlecolumntable {} ShowCreatePreview {} loadMetadata {}", singleColumnTable, showCreatePreview, loadMetadata); if (showCreatePreviews) { iconViewListModel.add(count++, new LabelIcon(icon, "<html>" + filename + "</html>")); if (loadMetadata) { String imginfo = returnBasicImageDataString(filename, "html"); } } else { if (loadMetadata) { String imginfo = returnBasicImageDataString(filename, "html"); logger.debug("imginfo {}", imginfo); //ImgFilenameRow[1] = imginfo; ImgFilenameRow[0] = new LabelIcon(null, imginfo); } else { ImgFilenameRow[0] = new LabelIcon(null, "<html>" + filename + "</html>"); } tableModel.addRow(ImgFilenameRow); } } if (showCreatePreviews) { //iconViewList.setPreferredSize(new Dimension(800,1800)); LeftGridScrollPanel.setViewportView(iconViewList); MyVariables.seticonView(iconViewList); ListSelectionModel icongridListSelectionModel; icongridListSelectionModel = iconViewList.getSelectionModel(); iconViewList.setSelectionMode(icongridListSelectionModel.MULTIPLE_INTERVAL_SELECTION); icongridListSelectionModel.addListSelectionListener(new MouseListeners.iconViewListSelectionHandler()); MouseListeners.filesJListListener(iconViewList, ListexiftoolInfotable, mainScreenLabels); MyVariables.setSelectedRowOrIndex(0); MyVariables.setSelectedColumn(0); } else { MyVariables.setSelectedRowOrIndex(0); MyVariables.setSelectedColumn(0); } } /* / This method is used to determine which row has been selected so that / we can set the setSinglePreview setter to the correct file object */ static void selectedRowForSinglePreview() { String res = ""; String fpath = ""; List<String> cmdparams = new ArrayList<String>(); int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); List<Integer> selectedIndicesList = MyVariables.getselectedIndicesList(); File[] files = MyVariables.getLoadedFiles(); if ( !(selectedIndicesList == null) && (selectedIndicesList.size() < 2) ) { //Meaning we have only one image selected logger.debug("selectedRowOrIndex: {}", String.valueOf(selectedRowOrIndex)); if (isOsFromMicrosoft()) { fpath = files[selectedRowOrIndex].getPath().replace("\\", "/"); } else { fpath = files[selectedRowOrIndex].getPath(); } MyVariables.setSinglePreview(new File(fpath)); } } /* / This one displays the single preview and gets the necessary data. / It checks whether we only need to load the preview or also the basic metadata */ static void displaySinglePreview(JTable previewTable, boolean loadMetadata) { int selectedRowOrIndex, selectedColumn; ImageIcon icon = null; File[] files = MyVariables.getLoadedFiles(); File file = MyVariables.getSinglePreview(); String filename = MyVariables.getSinglePreviewFileName(); DefaultTableModel previewTablemodel = (DefaultTableModel) previewTable.getModel(); previewTable.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() { protected void setValue(Object value) { if (loadMetadata) { if (value instanceof LabelIcon) { setIcon(((LabelIcon) value).icon); setHorizontalTextPosition(JLabel.CENTER); setVerticalTextPosition(JLabel.BOTTOM); setText(((LabelIcon) value).label); } } else { if (value instanceof ImageIcon) { setIcon((ImageIcon) value); setText(""); } else { setIcon(null); super.setValue(value); } } } }); Object[] ImgFilenameRow = new Object[2]; //icon = ImageFunctions.analyzeImageAndCreateIcon(file); icon = ImageFunctions.useCachedOrCreateIcon(file); previewTablemodel.setRowCount(0); previewTablemodel.fireTableDataChanged(); previewTable.clearSelection(); previewTable.setCellSelectionEnabled(false); Application.OS_NAMES currentOsName = getCurrentOsName(); filename = file.getName().replace("\\", "/"); logger.debug("Now working on image: " + filename); if (!(loadMetadata)) { ImageFunctions.getImageMetaData(file); } if (loadMetadata) { //means we have it in the big table, we don't need it here ImgFilenameRow[0] = new LabelIcon(icon, filename); } else { //If not, we will need it in the single preview String imginfo = returnBasicImageDataString(filename, "html"); logger.debug("imginfo {}", imginfo); ImgFilenameRow[0] = icon; ImgFilenameRow[1] = imginfo; } previewTablemodel.addRow(ImgFilenameRow); //MyVariables.setSelectedRowOrIndex(0); //MyVariables.setSelectedColumn(0); } /* * This is the ImageInfo method that is called by all when displaying the exiftool info from the image */ public static String getImageInfoFromSelectedFile(String[] whichInfo) { String res = ""; String fpath = ""; List<String> cmdparams = new ArrayList<String>(); int selectedRowOrIndex = MyVariables.getSelectedRowOrIndex(); List<Integer> selectedIndicesList = MyVariables.getselectedIndicesList(); File[] files = MyVariables.getLoadedFiles(); if (selectedIndicesList.size() < 2) { //Meaning we have only one image selected logger.debug("selectedRowOrIndex: {}", String.valueOf(selectedRowOrIndex)); if (isOsFromMicrosoft()) { fpath = files[selectedRowOrIndex].getPath().replace("\\", "/"); } else { fpath = files[selectedRowOrIndex].getPath(); } // Need to build exiftool prefs check MyVariables.setSelectedImagePath(fpath); Application.OS_NAMES currentOsName = getCurrentOsName(); cmdparams.add(Utils.platformExiftool().trim()); // Check if we want to use G1 instead of G boolean useGroup1 = prefs.getByKey(USE_G1_GROUP, false); if (useGroup1) { for (int i = 0; i < whichInfo.length; i++) { if ("-G".equals(whichInfo[i])) { whichInfo[i] = whichInfo[i].replace("-G", "-G1"); } } } // Check for chosen metadata language if (!"".equals(getmetadataLanguage())) { cmdparams.add("-lang"); cmdparams.add(getmetadataLanguage()); } // Check if user wants to see decimal degrees if (UseDecimalDegrees()) { cmdparams.add("-c"); cmdparams.add("%+.6f"); } // Check if users wants to see the tags alphabetically sorted if (Sorted_Tags()) { cmdparams.add("-sort"); } // Check if user wants to see the tags using STRUCTS if (Display_Structured_Data()) { cmdparams.add("-struct"); } cmdparams.addAll(Arrays.asList(whichInfo)); logger.trace("image file path: {}", fpath); cmdparams.add(MyVariables.getSelectedImagePath()); logger.trace("before runCommand: {}", cmdparams); try { res = CommandRunner.runCommand(cmdparams); logger.trace("res is {}", res); //displayInfoForSelectedImage(res, ListexiftoolInfotable); } catch (IOException | InterruptedException ex) { logger.error("Error executing command", ex); } } else { // We have multiple images selected. There is no direct link to the images anymore, // apart from the fact that the last image is automatically selected res = "jExifToolGUI\t" + ResourceBundle.getBundle("translations/program_strings").getString("vdtab.multfiles") + "\t" + ResourceBundle.getBundle("translations/program_strings").getString("vdtab.seloption"); //displayInfoForSelectedImage(res, ListexiftoolInfotable); } return res; } /** * This getImageInfoFromSelectedFile is called from methods that loop through files and need info * @param whichInfo * @param index * @return */ public static String getImageInfoFromSelectedFile(String[] whichInfo, int index) { String res = ""; String fpath = ""; List<String> cmdparams = new ArrayList<String>(); File[] files = MyVariables.getLoadedFiles(); logger.debug("selectedRowOrIndex: {}", String.valueOf(index)); if (isOsFromMicrosoft()) { fpath = files[index].getPath().replace("\\", "/"); } else { fpath = files[index].getPath(); } // Need to build exiftool prefs check MyVariables.setSelectedImagePath(fpath); Application.OS_NAMES currentOsName = getCurrentOsName(); cmdparams.add(Utils.platformExiftool().trim()); // Check if we want to use G1 instead of G boolean useGroup1 = prefs.getByKey(USE_G1_GROUP, false); if (useGroup1) { for (int i = 0; i < whichInfo.length; i++) { if ("-G".equals(whichInfo[i])) { whichInfo[i] = whichInfo[i].replace("-G", "-G1"); } } } // Check for chosen metadata language if (!"".equals(getmetadataLanguage())) { cmdparams.add("-lang"); cmdparams.add(getmetadataLanguage()); } // Check if user wants to see decimal degrees if (UseDecimalDegrees()) { cmdparams.add("-c"); cmdparams.add("%+.6f"); } // Check if users wants to see the tags alphabetically sorted if (Sorted_Tags()) { cmdparams.add("-sort"); } // Check if user wants to see the tags using STRUCTS if (Display_Structured_Data()) { cmdparams.add("-struct"); } cmdparams.addAll(Arrays.asList(whichInfo)); logger.trace("image file path: {}", fpath); cmdparams.add(MyVariables.getSelectedImagePath()); logger.trace("before runCommand: {}", cmdparams); try { res = CommandRunner.runCommand(cmdparams); logger.trace("res is {}", res); //displayInfoForSelectedImage(res, ListexiftoolInfotable); } catch (IOException | InterruptedException ex) { logger.error("Error executing command", ex); } return res; } // This is the "pre-ImageInfo" that is called when the option is chosen to display for a specific Tag Name from the dropdown list without changing the selected image. public static String selectImageInfoByTagName(JComboBox comboBoxViewByTagName, File[] files) { String SelectedTagName = String.valueOf(comboBoxViewByTagName.getSelectedItem()); String[] params = new String[3]; params[0] = "-" + SelectedTagName + ":all"; boolean useGroup1 = prefs.getByKey(USE_G1_GROUP, false); if (useGroup1) { params[1] = "-G1"; } else { params[1] = "-G"; } params[2] = "-tab"; String res = getImageInfoFromSelectedFile(params); return res; } // This is for the "all tags" and "camera makes" static String[] getWhichTagSelected(JComboBox comboBoxViewByTagName) { String SelectedTagName = String.valueOf(comboBoxViewByTagName.getSelectedItem()); String[] params = new String[3]; params[0] = "-" + SelectedTagName + ":all"; boolean useGroup1 = prefs.getByKey(USE_G1_GROUP, false); if (useGroup1) { params[1] = "-G1"; } else { params[1] = "-G"; } params[2] = "-tab"; return params; } // This is for the Common Tags as they can contain combined info public static String[] getWhichCommonTagSelected(JComboBox comboBoxViewByTagName) { String[] params = {"-a","-G","-tab","-exiftool:all"}; // We need to initialize with something String SelectedTagName = String.valueOf(comboBoxViewByTagName.getSelectedItem()); switch (SelectedTagName) { case "exif": params = MyConstants.EXIF_PARAMS; break; case "xmp": params = MyConstants.XMP_PARAMS; break; case "iptc": params = MyConstants.IPTC_PARAMS; break; case "composite": params = MyConstants.COMPOSITE_PARAMS; break; case "gps": params = MyConstants.GPS_PARAMS; break; case "location": params = MyConstants.LOCATION_PARAMS; break; case "lens data": params = MyConstants.LENS_PARAMS; break; case "gpano": params = MyConstants.GPANO_PARAMS; break; case "icc_profile": params = MyConstants.ICC_PARAMS; break; case "makernotes": params = MyConstants.MAKERNOTES_PARAMS; break; default: // Here is where we check if we have "user custom combi tags" String[] customCombis = MyVariables.getCustomCombis(); for (String customCombi : customCombis) { if (customCombi.equals(SelectedTagName)) { //logger.info("SelectedTagName: {}; customCombi: {}",SelectedTagName, customCombi); String sql = "select tag from custommetadatasetLines where customset_name='" + SelectedTagName + "' order by rowcount"; String queryResult = SQLiteJDBC.singleFieldQuery(sql,"tag"); if (queryResult.length() > 0) { String[] customTags = queryResult.split("\\r?\\n"); logger.debug("queryResult {}",queryResult); List<String> tmpparams = new ArrayList<String>(); tmpparams.add("-a"); tmpparams.add("-G"); tmpparams.add("-tab"); for (String customTag : customTags) { logger.trace("customTag {}", customTag); if (customTag.startsWith("-")) { tmpparams.add(customTag); } else { tmpparams.add("-" + customTag); } } String[] tmpArray = new String[tmpparams.size()]; params = tmpparams.toArray(tmpArray); logger.trace("custom tags: {}", params.toString()); } } } break; } boolean useGroup1 = prefs.getByKey(USE_G1_GROUP, false); if (useGroup1) { for (int i =0; i < params.length; i++) { if ("-G".equals(params[i])) { params[i] = params[i].replace("-G", "-G1"); } } } return params; } /* * This method displays the exiftool info in the right 3-column table */ public static void displayInfoForSelectedImage(String exiftoolInfo, JTable ListexiftoolInfotable) { // This will display the metadata info in the right panel logger.trace("String exiftoolInfo {}", exiftoolInfo); DefaultTableModel model = (DefaultTableModel) ListexiftoolInfotable.getModel(); model.setColumnIdentifiers(new String[]{ ResourceBundle.getBundle("translations/program_strings").getString("vdtab.tablegroup"), ResourceBundle.getBundle("translations/program_strings").getString("vdtab.tabletag"), ResourceBundle.getBundle("translations/program_strings").getString("vdtab.tablevalue")}); ListexiftoolInfotable.getColumnModel().getColumn(0).setPreferredWidth(100); ListexiftoolInfotable.getColumnModel().getColumn(1).setPreferredWidth(260); ListexiftoolInfotable.getColumnModel().getColumn(2).setPreferredWidth(440); // Now set rowheight depending on font size int userFontSize = Integer.parseInt(prefs.getByKey(USER_DEFINED_FONTSIZE, "12")); int rowHeight = (int) Math.round( (double) 1 + ( (double) userFontSize / (double) 12 * (double) 16 ) ); // 16 is my original row height based on fontsize 12 //logger.debug("userfontsize {}; rowheight {}", String.valueOf(userFontSize), String.valueOf(rowHeight) ); ListexiftoolInfotable.setRowHeight(rowHeight); model.setRowCount(0); Object[] row = new Object[1]; logger.debug("exiftoolInfo.length() {}; Warning?? {}; Error ?? {}", exiftoolInfo.length(),exiftoolInfo.trim().startsWith("Warning"), exiftoolInfo.trim().startsWith("Error")); // if ( (exiftoolInfo.length() > 0) && !( exiftoolInfo.trim().startsWith("Warning") || exiftoolInfo.trim().startsWith("Error") ) ) { if (exiftoolInfo.length() > 0) { if (exiftoolInfo.trim().startsWith("Warning")) { model.addRow(new Object[]{"ExifTool", "Warning", "Invalid Metadata data"}); } else if (exiftoolInfo.trim().startsWith("Error")) { model.addRow(new Object[]{"ExifTool", "Error", "Invalid Metadata data"}); } else { String[] lines = exiftoolInfo.split(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR)); boolean sort_cats_tags = prefs.getByKey(SORT_CATEGORIES_TAGS, false); if (sort_cats_tags) { List<String> strList = Arrays.asList(lines); Collections.sort(strList); String[] sortedLines = strList.stream().toArray(String[]::new); for (String line : sortedLines) { String[] cells = line.split("\\t", 3); model.addRow(new Object[]{cells[0], cells[1], "<html>" + cells[2] + "</html>" }); } } else { for (String line : lines) { //String[] cells = lines[i].split(":", 2); // Only split on first : as some tags also contain (multiple) : String[] cells = line.split("\\t", 3); model.addRow(new Object[]{cells[0], cells[1], "<html>" + cells[2] + "</html>"}); } } } } } /* * This method displays the selected image in the default image viewer for the relevant mime-type (the extension mostly) */ public static void displaySelectedImageInDefaultViewer(int selectedRowOrIndex, File[] files, JLabel ThumbView) throws IOException { String fpath = ""; if (isOsFromMicrosoft()) { fpath = "\"" + files[selectedRowOrIndex].getPath().replace("\\", "/") + "\""; } else { fpath = "\"" + files[selectedRowOrIndex].getPath() + "\""; } logger.debug("fpath for displaySelectedImageInDefaultViewer is now: {}", fpath); BufferedImage img = ImageIO.read(new File(fpath)); // resize it BufferedImage resizedImg = new BufferedImage(300, 225, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = resizedImg.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2.drawImage(img, 0, 0, 300, 225, null); g2.dispose(); ImageIcon icon = new ImageIcon(resizedImg); ThumbView.setIcon(icon); } /* * Setc checkboxes on first copy data tab. These are the cehckboxes for the selective copy */ static void setCopyMetaDatacheckboxes(boolean state, JCheckBox[] CopyMetaDatacheckboxes) { for (JCheckBox chkbx : CopyMetaDatacheckboxes) { chkbx.setEnabled(state); } } /* / Set checkboxes and radiobuttons on the second copy data tab */ static void setInsideCopyCheckboxesRadiobuttons(boolean state, JRadioButton[] InsideCopyMetadataradiobuttons, JCheckBox[] InsideCopyMetadacheckboxes) { for (JRadioButton rdbtn: InsideCopyMetadataradiobuttons) { rdbtn.setEnabled(state); } for (JCheckBox chkbx : InsideCopyMetadacheckboxes) { chkbx.setEnabled(state); } } /* / Retrieves the icone that is used for the window bar icons in the app (windows/linux) */ static public BufferedImage getFrameIcon() { BufferedImage frameicon = null; try { //frameicon = ImageIO.read(mainScreen.class.getResource("/icons/jexiftoolgui-frameicon.png")); frameicon = ImageIO.read(mainScreen.class.getResource("/icons/logo20-frameicon.png")); } catch (IOException ioe) { logger.info("error loading frame icon {}", ioe.toString()); } return frameicon; } /* / This method is called from displaySelectedImageInExternalViewer() in case of / - no raw viewer defined / - default image / - whatever other file type we encounter */ static void viewInRawViewer(String RawViewerPath) { String command = ""; // macos/linux String[] commands = {}; // windows List<String> cmdparams = new ArrayList<String>(); logger.debug("Selected file {} ", MyVariables.getSelectedImagePath()); //String correctedPath = MyVariables.getSelectedImagePath().replace("\"", ""); //Can contain double quotes when double-clicked logger.debug("RAW viewer started (trying to start)"); Application.OS_NAMES currentOsName = getCurrentOsName(); //Runtime runtime = Runtime.getRuntime(); ProcessBuilder builder = new ProcessBuilder(); Process p; try { switch (currentOsName) { case APPLE: String file_ext = getFileExtension(RawViewerPath); if ("app".equals(file_ext)) { builder.command("open", RawViewerPath.trim(), MyVariables.getSelectedImagePath()); } else { builder.command(RawViewerPath.trim(), MyVariables.getSelectedImagePath()); } p = builder.start(); return; case MICROSOFT: String convImg = "\"" + StandardFileIO.noSpacePath().replace("/", "\\") + "\""; builder.command(RawViewerPath.trim(),MyVariables.getSelectedImagePath()); p = builder.start(); return; case LINUX: //command = RawViewerPath + " " + StandardFileIO.noSpacePath(); command = RawViewerPath + " " + MyVariables.getSelectedImagePath(); //runtime.exec(command); builder.command(RawViewerPath.trim(),MyVariables.getSelectedImagePath()); p = builder.start(); return; } } catch (IOException e) { logger.error("Could not open image app.", e); } } /* / This method is called from displaySelectedImageInExternalViewer() in case of / - no raw viewer defined / - default image / - whatever other file type we encounter */ static void viewInDefaultViewer() { JavaImageViewer JIV = new JavaImageViewer(); JIV.ViewImageInFullscreenFrame(false); } /* / This method is called from main screen. It needs to detect if we have a raw image, a bmp/gif/jpg/png image, or whatever other kind of file / If it is a raw image and we have a raw viewer configured, use method viewInRawViewer / if it is an image (whatever) and we always want to use the raw viewer, use method viewInRawViewer / If no raw viewer defined, or we have whatever other extension (can also be normal or raw image), use method viewInDefaultViewer (based on mime type and default app) */ public static void displaySelectedImageInExternalViewer() { String[] SimpleExtensions = MyConstants.SUPPORTED_IMAGES; String RawViewer = prefs.getByKey(RAW_VIEWER_PATH, ""); boolean AlwaysUseRawViewer = prefs.getByKey(RAW_VIEWER_ALL_IMAGES, false); boolean RawExtension = false; boolean defaultImg = false; Application.OS_NAMES currentOsName = getCurrentOsName(); // check first if we have a raw image (can also be audio/video/whatever) String[] raw_images = MyConstants.RAW_IMAGES; String filenameExt = getFileExtension(MyVariables.getSelectedImagePath()); for (String ext: raw_images) { if ( filenameExt.toLowerCase().equals(ext)) { // it is a raw image RawExtension = true; logger.debug("RawExtension is true"); break; } } if (!RawExtension) { //check if we have another image for (String ext : SimpleExtensions) { if ( filenameExt.toLowerCase().equals(ext)) { // it is a bmp, gif, jpg, png image or tif(f) defaultImg = true; logger.debug("default image is true"); break; } else if ( filenameExt.toLowerCase().equals("heic") && (currentOsName == APPLE) ) { // We first need to use sips to convert logger.debug("heic image(s)"); File file = new File (MyVariables.getSelectedImagePath()); String filename = file.getName(); String exportResult = ImageFunctions.sipsConvertToJPG(file, "full"); String dispfilename = filename.substring(0, filename.lastIndexOf('.')) + ".jpg"; File dispfile = new File(MyVariables.gettmpWorkFolder() + File.separator + dispfilename); } } } if (RawExtension || defaultImg) { // we have an image if (AlwaysUseRawViewer) { viewInRawViewer(RawViewer); } else if (RawExtension) { if (!"".equals(RawViewer)) { // We do have a raw image AND a raw viewer defined viewInRawViewer(RawViewer); } } else { // We have a defaultImg viewInDefaultViewer(); } } else { // Whatever other extension, simply try by default mime type Runtime runtime = Runtime.getRuntime(); try { switch (currentOsName) { case APPLE: filenameExt = getFileExtension(MyVariables.getSelectedImagePath()); String[] Videos = MyConstants.SUPPORTED_VIDEOS; boolean video = false; for (String ext : Videos) { if ( filenameExt.toLowerCase().equals(ext)) { //We have a video video = true; } } if (video) { runtime.exec("open /Applications/QuickTime\\ Player.app " + MyVariables.getSelectedImagePath()); logger.info("quicktime command {}", "open /Applications/QuickTime\\ Player.app " + MyVariables.getSelectedImagePath()); } else { runtime.exec("open /Applications/Preview.app " + MyVariables.getSelectedImagePath()); logger.info("preview command {}", "open /Applications/Preview.app " + MyVariables.getSelectedImagePath()); } return; case MICROSOFT: String convImg = MyVariables.getSelectedImagePath().replace("/", "\\"); String[] commands = {"cmd.exe", "/c", "start", "\"DummyTitle\"", String.format("\"%s\"", convImg)}; runtime.exec(commands); return; case LINUX: String selectedImagePath = MyVariables.getSelectedImagePath().replace(" ", "\\ "); logger.trace("xdg-open {}", selectedImagePath); runtime.exec("xdg-open " + MyVariables.getSelectedImagePath().replace(" ", "\\ ")); return; } } catch (IOException e) { logger.error("Could not open image app.", e); } } } public static Application.OS_NAMES getCurrentOsName() { String OS = SystemPropertyFacade.getPropertyByKey(OS_NAME).toLowerCase(); if (OS.contains("mac")) return APPLE; if (OS.contains("windows")) return Application.OS_NAMES.MICROSOFT; return LINUX; } public static boolean isOsFromMicrosoft() { return getCurrentOsName() == Application.OS_NAMES.MICROSOFT; } public static boolean isOsFromApple() { return getCurrentOsName() == APPLE; } public static boolean in_Range(int checkvalue, int lower, int upper) { // note: lower >=; upper < if (checkvalue >= lower && checkvalue < upper) { return true; } else { return false; } } public static String[] gpsCalculator(JPanel rootPanel, String[] input_lat_lon) throws ParseException { // Here is where we calculate the degrees-minutes-seconds to decimal values float coordinate; //float coordinate; String[] lat_lon = {"", ""}; // No complex method. Simply write it out // first latitude // Note that "South" latitudes and "West" longitudes convert to negative decimal numbers. // In decs-mins-secs, degrees lat < 90 degrees lon < 180, minutes < 60, seconds <60. NOT <= String[] splitCoordinate = null; Integer intCoordinate = 0; if (input_lat_lon[2].contains(",")) { splitCoordinate = input_lat_lon[2].split(","); //logger.info("input_lat_lon[2] {} splitCoordinate {}", input_lat_lon[2], Arrays.toString(splitCoordinate)); intCoordinate = Integer.valueOf((splitCoordinate[0].trim())); } else if (input_lat_lon[2].contains(".")) { splitCoordinate = input_lat_lon[2].split("[.]"); //logger.info("input_lat_lon[2] {} splitCoordinate {}", input_lat_lon[2], Arrays.toString(splitCoordinate)); intCoordinate = Integer.valueOf((splitCoordinate[0].trim())); } else { intCoordinate = Integer.valueOf((input_lat_lon[2])); } //intCoordinate = Integer.valueOf(input_lat_lon[2]); if ( in_Range(intCoordinate, 0, 60)) { //secs coordinate = Float.parseFloat(input_lat_lon[2]) / (float) 60; logger.debug("converted latitude seconds: " + coordinate); } else { JOptionPane.showMessageDialog(rootPanel, ResourceBundle.getBundle("translations/program_strings").getString("gps.calcsecerror"), ResourceBundle.getBundle("translations/program_strings").getString("gps.calcerror"), JOptionPane.ERROR_MESSAGE); lat_lon[0] = "error"; return lat_lon; } if (in_Range(Integer.parseInt(input_lat_lon[1]), 0, 60)) { //mins coordinate = (Float.parseFloat( input_lat_lon[1]) + coordinate) / (float) 60; logger.debug("converted latitude mins + secs: " + coordinate); } else { JOptionPane.showMessageDialog(rootPanel, ResourceBundle.getBundle("translations/program_strings").getString("gps.calcminerror"), ResourceBundle.getBundle("translations/program_strings").getString("gps.calcerror"), JOptionPane.ERROR_MESSAGE); lat_lon[0] = "error"; return lat_lon; } if (in_Range(Integer.parseInt(input_lat_lon[0]), 0, 90)) { //degs coordinate = Float.parseFloat( input_lat_lon[0]) + coordinate; if ("S".equals(input_lat_lon[3])) { //South means negative value coordinate = -(coordinate); } logger.debug("decimal lat: " + coordinate); lat_lon[0] = String.valueOf(coordinate); } else { JOptionPane.showMessageDialog(rootPanel, ResourceBundle.getBundle("translations/program_strings").getString("gps.calcdegerror"), ResourceBundle.getBundle("translations/program_strings").getString("gps.calcerror"), JOptionPane.ERROR_MESSAGE); lat_lon[0] = "error"; return lat_lon; } // Now do the same for longitude if (input_lat_lon[2].contains(",")) { splitCoordinate = input_lat_lon[6].split(","); //logger.info("input_lat_lon[2] {} splitCoordinate {}", input_lat_lon[2], Arrays.toString(splitCoordinate)); intCoordinate = Integer.valueOf((splitCoordinate[0].trim())); } else if (input_lat_lon[6].contains(".")) { splitCoordinate = input_lat_lon[6].split("[.]"); //logger.info("input_lat_lon[2] {} splitCoordinate {}", input_lat_lon[2], Arrays.toString(splitCoordinate)); intCoordinate = Integer.valueOf((splitCoordinate[0].trim())); } else { intCoordinate = Integer.valueOf((input_lat_lon[6])); } if ( in_Range(intCoordinate, 0, 60)) { //secs coordinate = Float.parseFloat(input_lat_lon[6]) / (float) 60; logger.debug("converted longitude seconds: " + coordinate); } else { JOptionPane.showMessageDialog(rootPanel, ResourceBundle.getBundle("translations/program_strings").getString("gps.calcsecerror"), ResourceBundle.getBundle("translations/program_strings").getString("gps.calcerror"), JOptionPane.ERROR_MESSAGE); lat_lon[0] = "error"; return lat_lon; } if (in_Range(Integer.parseInt(input_lat_lon[5]), 0, 60)) { //mins coordinate = (Float.parseFloat( input_lat_lon[5]) + coordinate) / (float) 60; logger.debug("converted longitude mins + secs: " + coordinate); } else { JOptionPane.showMessageDialog(rootPanel, ResourceBundle.getBundle("translations/program_strings").getString("gps.calcminerror"), ResourceBundle.getBundle("translations/program_strings").getString("gps.calcerror"), JOptionPane.ERROR_MESSAGE); lat_lon[0] = "error"; return lat_lon; } if (in_Range(Integer.parseInt(input_lat_lon[4]), 0, 90)) { //degs coordinate = Float.parseFloat( input_lat_lon[4]) + coordinate; if ("W".equals(input_lat_lon[7])) { //West means negative value coordinate = -(coordinate); } lat_lon[1] = String.valueOf(coordinate); logger.debug("decimal lon: " + coordinate); } else { JOptionPane.showMessageDialog(rootPanel, ResourceBundle.getBundle("translations/program_strings").getString("gps.calcdegerror"), ResourceBundle.getBundle("translations/program_strings").getString("gps.calcerror"), JOptionPane.ERROR_MESSAGE); lat_lon[0] = "error"; return lat_lon; } return lat_lon; } /* * This method is used to export all avalaible previews/thumbnails/jpegFromRaw which are in the selected images */ public static void ExportPreviewsThumbnails(JProgressBar progressBar) { // tmpPath is optional and only used to create previews of raw images which can't be displayed directly List<String> cmdparams = new ArrayList<String>(); File myFilePath; String[] options = {ResourceBundle.getBundle("translations/program_strings").getString("dlg.no"), ResourceBundle.getBundle("translations/program_strings").getString("dlg.yes")}; int[] selectedIndices = MyVariables.getSelectedFilenamesIndices(); File[] files = MyVariables.getLoadedFiles(); logger.debug("Export previews/thumbnails.."); int choice = JOptionPane.showOptionDialog(null, String.format(ProgramTexts.HTML, 450, ResourceBundle.getBundle("translations/program_strings").getString("ept.dlgtext")),ResourceBundle.getBundle("translations/program_strings").getString("ept.dlgtitle"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (choice == 1) { //Yes cmdparams.add(Utils.platformExiftool()); boolean isWindows = Utils.isOsFromMicrosoft(); myFilePath = files[0]; String absolutePath = myFilePath.getAbsolutePath(); String myPath = absolutePath.substring(0,absolutePath.lastIndexOf(File.separator)); if (isWindows) { myPath = myFilePath.getPath().replace("\\", "/"); } cmdparams.add("-a"); cmdparams.add("-m"); cmdparams.add("-b"); cmdparams.add("-W"); cmdparams.add(myPath + File.separator + "%f_%t%-c.%s"); cmdparams.add("-preview:all"); for (int index: selectedIndices) { logger.debug("index: {} image path: {}", index, files[index].getPath()); if (isWindows) { cmdparams.add(files[index].getPath().replace("\\", "/")); } else { cmdparams.add(files[index].getPath()); } } // export metadata CommandRunner.runCommandWithProgressBar(cmdparams, progressBar); } } /* / This is the extended TableCellRenderer / Because DefaultTableCellRenderer is JLabel, you can use it's text alignment properties in a custom renderer to label the icon. */ private static class LabelGridIconRenderer extends DefaultListCellRenderer { public LabelGridIconRenderer() { setHorizontalTextPosition(JLabel.CENTER); setVerticalTextPosition(JLabel.BOTTOM); } @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); setIcon(((LabelIcon) value).icon); setHorizontalTextPosition(JLabel.CENTER); setVerticalTextPosition(JLabel.BOTTOM); setText(((LabelIcon) value).label); return label; } //return label; } @SuppressWarnings("SameParameterValue") private static URL getResource(String path) { return Utils.class.getClassLoader().getResource(path); } }
92,119
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
ProgramTexts.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/ProgramTexts.java
package org.hvdw.jexiftoolgui; public class ProgramTexts { /* HTML in Swing components follows the HTML 3.2 standard from 1996. See https://www.w3.org/TR/2018/SPSD-html32-20180315/ All strings use "internal" tags, but not begin and end tags as we use the String.format(ProgramTexts.HTML, <width>, helptext) */ public static final String Author = "Harry van der Wolf"; public static final String ProjectWebSite = "http://hvdwolf.github.io/jExifToolGUI"; public static final String Version = "2.0.2"; public static final String ETrefVersion = "12.58"; public static final String HTML = "<html><body style='width: %1spx'>%1s"; public static final String downloadInstallET = "The program will now open the ExifTool website in your browser and then the program will close itself.<br>" +"After having downloaded and installed ExifTool you can reopen jExifToolGUI.<br><br>If ExifTool is in your PATH, jExifToolGUI will simply continue.<br><br>" +"If ExifTool is NOT in your PATH, you need to specify the location where you installed ExifTool."; public static final String CreateArgsMetaDataUiText = "Which metadata from your selected image(s) do you want to add to your args file(s)?"; }
1,247
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
PreferencesDialog.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/PreferencesDialog.java
package org.hvdw.jexiftoolgui; import ch.qos.logback.classic.Logger; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import org.hvdw.jexiftoolgui.controllers.ExifTool; import org.hvdw.jexiftoolgui.controllers.StandardFileIO; import org.hvdw.jexiftoolgui.facades.IPreferencesFacade; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.border.TitledBorder; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.plaf.FontUIResource; import javax.swing.text.StyleContext; import java.awt.*; import java.awt.event.*; import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Enumeration; import java.util.HashMap; import java.util.Locale; import java.util.ResourceBundle; import static org.hvdw.jexiftoolgui.facades.IPreferencesFacade.PreferenceKey.*; public class PreferencesDialog extends JDialog { JPanel generalPanel; JButton buttonSave; JButton buttonCancel; JTextField ExiftoolLocationtextField; JButton ExiftoolLocationbutton; JTextField ImgStartFoldertextField; JButton ImgStartFolderButton; JTextField ArtisttextField; JTextField CopyrightstextField; JCheckBox UseLastOpenedFoldercheckBox; JCheckBox CheckVersioncheckBox; private JComboBox metadataLanuagecomboBox; private JTextField CreditstextField; private JTextField RawViewerLocationtextField; private JButton RawViewerLocationButton; private JCheckBox RawViewercheckBox; private JTabbedPane tabbedPanel; private JPanel contentPanel; private JComboBox localecomboBox; private JRadioButton JFilechooserradioButton; private JRadioButton AwtdialogradioButton; private JLabel filedialogexplained; private JCheckBox decimaldegreescheckBox; private JComboBox loglevelcomboBox; private JLabel logleveltext; private JPanel loglevelpanel; private JPanel filechooserpanel; private JCheckBox useG1GroupcheckBox; private JTextField udFilefiltertextField; private JCheckBox preserveModDatecheckBox; private JCheckBox DualColumncheckBox; private JLabel ExampleColumnImage; private JCheckBox sortCatsTagscheckBox; private JCheckBox enableStructCheckBox; private JList allSystemFonts; private JList fontSizes; private JLabel fontPreview; private JButton buttonDefaultFont; private JScrollPane allFontsScrollPane; private JScrollPane fontSizesScrollPane; private JButton buttonsetThisFont; private JPanel fontJPanel; private JLabel lblFontSelection; Font userSelectedFont = null; private String thisFont = null; private String thisFontSize = null; // Initialize all the helper classes //AppPreferences AppPrefs = new AppPreferences(); private IPreferencesFacade prefs = IPreferencesFacade.defaultInstance; //private static final ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(PreferencesDialog.class); private final static Logger logger = (Logger) LoggerFactory.getLogger(PreferencesDialog.class); HashMap<String, String> retrievedPreferences = new HashMap<String, String>(); public PreferencesDialog() { setContentPane(contentPanel); setModal(true); getRootPane().setDefaultButton(buttonSave); this.setIconImage(Utils.getFrameIcon()); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); contentPanel.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); buttonSave.addActionListener(e -> onSave()); buttonCancel.addActionListener(e -> onCancel()); buttonDefaultFont.addActionListener(e -> onSetDefaultFont()); buttonsetThisFont.addActionListener(e -> onUseThisFont()); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE generalPanel.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); ExiftoolLocationbutton.addActionListener(actionEvent -> { String ETpath = ""; ETpath = ExifTool.whereIsExiftool(generalPanel); getExiftoolPath(generalPanel, ExiftoolLocationtextField, ETpath, "preferences"); }); ImgStartFolderButton.addActionListener(actionEvent -> getDefaultImagePath(generalPanel, ImgStartFoldertextField)); RawViewerLocationButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { getRawViewerLocation(generalPanel, RawViewerLocationtextField); } }); RawViewercheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (RawViewerLocationtextField.getText().isEmpty()) { RawViewercheckBox.setSelected(false); JOptionPane.showMessageDialog(generalPanel, ResourceBundle.getBundle("translations/program_strings").getString("prefs.chkboxrawtext"), ResourceBundle.getBundle("translations/program_strings").getString("prefs.chkboxrawtitle"), JOptionPane.WARNING_MESSAGE); } } }); DualColumncheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { setExampleImage(); } }); } private void getListOfSystemFonts() { String systemFontList[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); allSystemFonts.setListData(systemFontList); for (int i = 0; i < systemFontList.length; i++) { logger.debug(systemFontList[i]); } allSystemFonts.setModel(new AbstractListModel() { public int getSize() { return systemFontList.length; } public Object getElementAt(int i) { return systemFontList[i]; } }); allSystemFonts.setVisibleRowCount(-1); } /** * Listen for font name or size selection changes. */ class FontSelectionListener implements ListSelectionListener { /** * When a font name or size selection changes update the selected font * and font preview in showFont. * * @param e */ @Override public void valueChanged(ListSelectionEvent e) { if ((String.valueOf(allSystemFonts.getSelectedValue()) == null) || (fontSizes.getSelectedValue() == null)) { setCurrentFont(); } else { String selectedFontName = String.valueOf(allSystemFonts.getSelectedValue()); int selectedFontSize = Integer.parseInt((String) fontSizes.getSelectedValue()); userSelectedFont = new Font(selectedFontName, Font.PLAIN, selectedFontSize); } showFont(); } } /** * Select the default font and size. */ private void onSetDefaultFont() { allSystemFonts.setSelectedValue(MyConstants.appDefFont.getFamily(), true); fontSizes.setSelectedValue(Integer.toString(MyConstants.appDefFont.getSize()), true); userSelectedFont = MyConstants.appDefFont; } /* * Select the current font from preferences. If not available that will automatically be the default font */ private void setCurrentFont() { String userFont = prefs.getByKey(USER_DEFINED_FONT, "sans-serif"); logger.debug("USER_DEFINED_FONT {}", userFont); int userFontSize = Integer.parseInt(prefs.getByKey(USER_DEFINED_FONTSIZE, "12")); logger.debug("USER_DEFINED_FONTSIZE {}", String.valueOf(userFontSize)); userSelectedFont = new Font(userFont, Font.PLAIN, userFontSize); allSystemFonts.setSelectedValue(userFont, true); fontSizes.setSelectedValue(Integer.toString(userFontSize), true); showFont(); } private void showFont() { fontPreview.setFont(userSelectedFont); pack(); } private void onUseThisFont() { Utils.setUIFont(new FontUIResource((String) allSystemFonts.getSelectedValue(), Font.PLAIN, userSelectedFont.getSize())); /*String userFont = prefs.getByKey(USER_DEFINED_FONT, "sans-serif"); int userFontSize = Integer.parseInt((String) prefs.getByKey(USER_DEFINED_FONTSIZE, "12")); userSelectedFont = new Font(userFont, Font.PLAIN, userFontSize); Enumeration enum = UIManager.getDefaults().keys(); while ( enum.hasMoreElements() ) { Object key = enum.nextElement(); Object value = UIManager.get( key ); if ( value instanceof Font ) { UIManager.put( key, font ); } }*/ showFont(); } private void onSave() { // add your code here savePrefs(); dispose(); } private void onCancel() { // add your code here if necessary dispose(); } // As the exiftoolLocator is already created in the Utils as startup check we simply leave it there // although you can discuss that it can also be a preference if we deviate from the standard one // of course we do need the return value which we will get from the listener public void getExiftoolPath(JPanel myComponent, JTextField myExiftoolTextfield, String ePath, String fromWhere) { if ("cancelled".equals(ePath)) { if ("startup".equals(fromWhere)) { JOptionPane.showMessageDialog(myComponent, String.format(ProgramTexts.HTML, 400, ResourceBundle.getBundle("translations/program_strings").getString("prefs.etlocatecanceltext")), ResourceBundle.getBundle("translations/program_strings").getString("prefs.etlocatecanceltitle"), JOptionPane.WARNING_MESSAGE); System.exit(0); } else { JOptionPane.showMessageDialog(myComponent, String.format(ProgramTexts.HTML, 400, ResourceBundle.getBundle("translations/program_strings").getString("prefs.etlocatecanceltext")), ResourceBundle.getBundle("translations/program_strings").getString("prefs.etlocatecanceltitle"), JOptionPane.WARNING_MESSAGE); } } else if ("no exiftool binary".equals(ePath)) { if ("startup".equals(fromWhere)) { JOptionPane.showMessageDialog(myComponent, String.format(ProgramTexts.HTML, 400, ResourceBundle.getBundle("translations/program_strings").getString("prefs.etwrongtext")), ResourceBundle.getBundle("translations/program_strings").getString("prefs.etwrongtitle"), JOptionPane.WARNING_MESSAGE); System.exit(0); } else { JOptionPane.showMessageDialog(myComponent, String.format(ProgramTexts.HTML, 400, ResourceBundle.getBundle("translations/program_strings").getString("prefs.etwrongtext")), ResourceBundle.getBundle("translations/program_strings").getString("prefs.etwrongtitle"), JOptionPane.WARNING_MESSAGE); } } else { // Yes. It looks like we have a correct exiftool selected // remove all possible line breaks ePath = ePath.replace("\n", "").replace("\r", ""); //prefs.put("exiftool", ePath); myExiftoolTextfield.setText(ePath); } } // Locate the default image path, if the user wants it public void getDefaultImagePath(JPanel myComponent, JTextField defImgFolder) { String SelectedFolder; String prefFileDialog = prefs.getByKey(PREFERRED_FILEDIALOG, "jfilechooser"); if ("jfilechooser".equals(prefFileDialog)) { final JFileChooser chooser = new JFileChooser(); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); chooser.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); chooser.setDialogTitle(ResourceBundle.getBundle("translations/program_strings").getString("prefs.locateprefimgfolder")); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int status = chooser.showOpenDialog(myComponent); if (status == JFileChooser.APPROVE_OPTION) { SelectedFolder = chooser.getSelectedFile().getAbsolutePath(); defImgFolder.setText(SelectedFolder); } } else { JFrame dialogframe = new JFrame(""); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); dialogframe.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); FileDialog chooser = new FileDialog(dialogframe, ResourceBundle.getBundle("translations/program_strings").getString("stfio.loadfolder"), FileDialog.LOAD); //chooser.setDirectory(startFolder); chooser.setMultipleMode(false); chooser.setVisible(true); SelectedFolder = chooser.getDirectory(); if (!(SelectedFolder == null)) { defImgFolder.setText(SelectedFolder); } } } /* / Locate the raw viewer (if installed) */ public void getRawViewerLocation(JPanel myComponent, JTextField RawViewerLocationtextField) { String SelectedRawViewer; String selectedBinary = ""; final JFileChooser chooser = new JFileChooser(); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); chooser.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); chooser.setDialogTitle(ResourceBundle.getBundle("translations/program_strings").getString("prefs.locaterawviewer")); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int status = chooser.showOpenDialog(myComponent); if (status == JFileChooser.APPROVE_OPTION) { selectedBinary = chooser.getSelectedFile().getAbsolutePath(); RawViewerLocationtextField.setText(selectedBinary); } } /* / Set ExampleImage for dual-colum single-colum / */ private void setExampleImage() { ImageIcon imageIcon = null; if (DualColumncheckBox.isSelected()) { imageIcon = new ImageIcon(this.getClass().getResource("/dual_column_example.jpg")); } else { imageIcon = new ImageIcon(this.getClass().getResource("/single_column_example.jpg")); } ExampleColumnImage.setIcon(imageIcon); } private void savePrefs() { logger.debug("Saving the preferences"); logger.debug("artist {}", ArtisttextField.getText()); logger.debug("copyrights {}", CopyrightstextField.getText()); logger.debug("credit {}", CreditstextField.getText()); logger.debug("exiftool {}", ExiftoolLocationtextField.getText()); logger.debug("defaultstartfolder {}", ImgStartFoldertextField.getText()); logger.debug("uselastopenedfolder {}", UseLastOpenedFoldercheckBox.isSelected()); logger.debug("Check for new version on startup {}", CheckVersioncheckBox.isSelected()); logger.debug("metadatalanguage {}", metadataLanuagecomboBox.getSelectedItem()); logger.debug("raw viewer {}", RawViewerLocationtextField.getText()); logger.debug("Preferred application language", localecomboBox.getSelectedItem()); if (JFilechooserradioButton.isSelected()) { logger.debug("Preferred file dialog", "jfilechooser"); } else { logger.debug("Preferred file dialog", "awtdialog"); } logger.debug("showdecimaldegrees {}", decimaldegreescheckBox.isSelected()); logger.debug("useg1group {}", useG1GroupcheckBox.isSelected()); logger.debug("preservemodifydate {}", preserveModDatecheckBox.isSelected()); logger.debug("loglevel {}", loglevelcomboBox.getSelectedItem()); logger.debug("userdefinedfilefilter {}", udFilefiltertextField.getText()); logger.debug("userdefinedfont {}", String.valueOf(allSystemFonts.getSelectedValue())); logger.debug("userdefinedfontsize {}", String.valueOf(fontSizes.getSelectedValue())); if (!(retrievedPreferences.get("Artist").equals(ArtisttextField.getText()))) { //if (!ArtisttextField.getText().isEmpty()) { logger.trace("{}: {}", ARTIST.key, ArtisttextField.getText()); prefs.storeByKey(ARTIST, ArtisttextField.getText()); } if (!(retrievedPreferences.get("Credits").equals(CreditstextField.getText()))) { //if (!CreditstextField.getText().isEmpty()) { logger.trace("{}: {}", CREDIT.key, CreditstextField.getText()); prefs.storeByKey(CREDIT, CreditstextField.getText()); } if (!(retrievedPreferences.get("Copyrights").equals(CopyrightstextField.getText()))) { //if (!CopyrightstextField.getText().isEmpty()) { logger.trace("{}: {}", COPYRIGHTS.key, CopyrightstextField.getText()); prefs.storeByKey(COPYRIGHTS, CopyrightstextField.getText()); } if (!(retrievedPreferences.get("ExiftoolLocation").equals(ExiftoolLocationtextField.getText()))) { //if (!ExiftoolLocationtextField.getText().isEmpty()) { logger.trace("{}: {}", EXIFTOOL_PATH.key, ExiftoolLocationtextField.getText()); prefs.storeByKey(EXIFTOOL_PATH, ExiftoolLocationtextField.getText()); } if (!ImgStartFoldertextField.getText().isEmpty()) { logger.trace("{}: {}", DEFAULT_START_FOLDER.key, ImgStartFoldertextField.getText()); prefs.storeByKey(DEFAULT_START_FOLDER, ImgStartFoldertextField.getText()); } if (!RawViewerLocationtextField.getText().isEmpty()) { logger.trace("{}: {}", RAW_VIEWER_PATH.key, RawViewerLocationtextField.getText()); prefs.storeByKey(RAW_VIEWER_PATH, RawViewerLocationtextField.getText()); } if (JFilechooserradioButton.isSelected()) { logger.trace("Preferred file dialog: jfilechooser"); prefs.storeByKey(PREFERRED_FILEDIALOG, "jfilechooser"); } else { logger.trace("Preferred file dialog: awtdialog"); prefs.storeByKey(PREFERRED_FILEDIALOG, "awtdialog"); } if (!(retrievedPreferences.get("udFilefilter").equals(udFilefiltertextField.getText()))) { //if (!udFilefiltertextField.getText().isEmpty()) { logger.trace(" {} {}", USER_DEFINED_FILE_FILTER.key, udFilefiltertextField.getText()); prefs.storeByKey(USER_DEFINED_FILE_FILTER, udFilefiltertextField.getText()); } if ((retrievedPreferences.get("userdefinedfont") == null) || (!(retrievedPreferences.get("userdefinedfont").equals(String.valueOf(allSystemFonts.getSelectedValue()))))) { logger.trace("{}: {}", USER_DEFINED_FONT.key, String.valueOf(allSystemFonts.getSelectedValue())); prefs.storeByKey(USER_DEFINED_FONT, String.valueOf(allSystemFonts.getSelectedValue())); } if ((retrievedPreferences.get("userdefinedfontsize") == null) || (!(retrievedPreferences.get("userdefinedfontsize").equals(String.valueOf(fontSizes.getSelectedValue()))))) { logger.trace("{}: {}", USER_DEFINED_FONTSIZE.key, String.valueOf(fontSizes.getSelectedValue())); prefs.storeByKey(USER_DEFINED_FONTSIZE, String.valueOf(fontSizes.getSelectedValue())); } logger.trace("{}: {}", USE_LAST_OPENED_FOLDER.key, UseLastOpenedFoldercheckBox.isSelected()); prefs.storeByKey(USE_LAST_OPENED_FOLDER, UseLastOpenedFoldercheckBox.isSelected()); logger.trace("{}: {}", VERSION_CHECK.key, CheckVersioncheckBox.isSelected()); prefs.storeByKey(VERSION_CHECK, CheckVersioncheckBox.isSelected()); logger.trace("{}: {}", METADATA_LANGUAGE.key, metadataLanuagecomboBox.getSelectedItem()); prefs.storeByKey(METADATA_LANGUAGE, (String) metadataLanuagecomboBox.getSelectedItem()); logger.trace("{}: {}", RAW_VIEWER_ALL_IMAGES.key, RawViewercheckBox.isSelected()); prefs.storeByKey(RAW_VIEWER_ALL_IMAGES, RawViewercheckBox.isSelected()); logger.trace("{}: {}", PREFERRED_APP_LANGUAGE.key, localecomboBox.getSelectedItem()); prefs.storeByKey(PREFERRED_APP_LANGUAGE, (String) localecomboBox.getSelectedItem()); logger.trace("{}: {}", SHOW_DECIMAL_DEGREES.key, decimaldegreescheckBox.isSelected()); prefs.storeByKey(SHOW_DECIMAL_DEGREES, decimaldegreescheckBox.isSelected()); logger.trace("{}: {}", USE_G1_GROUP.key, useG1GroupcheckBox.isSelected()); prefs.storeByKey(USE_G1_GROUP, useG1GroupcheckBox.isSelected()); logger.trace("{} {}", PRESERVE_MODIFY_DATE.key, preserveModDatecheckBox.isSelected()); prefs.storeByKey(PRESERVE_MODIFY_DATE, preserveModDatecheckBox.isSelected()); logger.trace("{}: {}", LOG_LEVEL.key, loglevelcomboBox.getSelectedItem()); prefs.storeByKey(LOG_LEVEL, (String) loglevelcomboBox.getSelectedItem()); logger.trace("{} {}", DUAL_COLUMN.key, DualColumncheckBox.isSelected()); prefs.storeByKey(DUAL_COLUMN, DualColumncheckBox.isSelected()); logger.trace("{} {}", SORT_CATEGORIES_TAGS.key, sortCatsTagscheckBox.isSelected()); prefs.storeByKey(SORT_CATEGORIES_TAGS, sortCatsTagscheckBox.isSelected()); logger.trace("{} {}", ENABLE_STRUCTS.key, enableStructCheckBox.isSelected()); prefs.storeByKey(ENABLE_STRUCTS, enableStructCheckBox.isSelected()); JOptionPane.showMessageDialog(generalPanel, ResourceBundle.getBundle("translations/program_strings").getString("prefs.settingssaved"), ResourceBundle.getBundle("translations/program_strings").getString("prefs.settingssaved"), JOptionPane.INFORMATION_MESSAGE); } private void retrievePreferences() { // get current preferences ExiftoolLocationtextField.setText(prefs.getByKey(EXIFTOOL_PATH, "")); retrievedPreferences.put("ExiftoolLocation", prefs.getByKey(EXIFTOOL_PATH, "")); ImgStartFoldertextField.setText(prefs.getByKey(DEFAULT_START_FOLDER, "")); retrievedPreferences.put("ImgStartFolder", prefs.getByKey(DEFAULT_START_FOLDER, "")); ArtisttextField.setText(prefs.getByKey(ARTIST, "")); retrievedPreferences.put("Artist", prefs.getByKey(ARTIST, "")); CreditstextField.setText(prefs.getByKey(CREDIT, "")); retrievedPreferences.put("Credits", prefs.getByKey(CREDIT, "")); CopyrightstextField.setText(prefs.getByKey(COPYRIGHTS, "")); retrievedPreferences.put("Copyrights", prefs.getByKey(COPYRIGHTS, "")); UseLastOpenedFoldercheckBox.setSelected(prefs.getByKey(USE_LAST_OPENED_FOLDER, false)); retrievedPreferences.put("UseLastOpenedFolder", String.valueOf(prefs.getByKey(USE_LAST_OPENED_FOLDER, false))); CheckVersioncheckBox.setSelected(prefs.getByKey(VERSION_CHECK, true)); retrievedPreferences.put("CheckVersion", String.valueOf(prefs.getByKey(VERSION_CHECK, true))); metadataLanuagecomboBox.setSelectedItem(prefs.getByKey(METADATA_LANGUAGE, "exiftool - default")); retrievedPreferences.put("metadataLanuage", prefs.getByKey(METADATA_LANGUAGE, "exiftool - default")); RawViewerLocationtextField.setText(prefs.getByKey(RAW_VIEWER_PATH, "")); retrievedPreferences.put("RawViewerLocation", prefs.getByKey(RAW_VIEWER_PATH, "")); RawViewercheckBox.setSelected(prefs.getByKey(RAW_VIEWER_ALL_IMAGES, false)); retrievedPreferences.put("RawViewer", String.valueOf(prefs.getByKey(RAW_VIEWER_ALL_IMAGES, false))); localecomboBox.setSelectedItem(prefs.getByKey(PREFERRED_APP_LANGUAGE, "System default")); retrievedPreferences.put("locale", prefs.getByKey(PREFERRED_APP_LANGUAGE, "System default")); if ("jfilechooser".equals(prefs.getByKey(PREFERRED_FILEDIALOG, "jfilechooser"))) { JFilechooserradioButton.setSelected(true); AwtdialogradioButton.setSelected(false); } else { JFilechooserradioButton.setSelected(false); AwtdialogradioButton.setSelected(true); } retrievedPreferences.put("filedialog", prefs.getByKey(PREFERRED_FILEDIALOG, "jfilechooser")); decimaldegreescheckBox.setSelected(prefs.getByKey(SHOW_DECIMAL_DEGREES, false)); retrievedPreferences.put("decimaldegrees", String.valueOf(prefs.getByKey(SHOW_DECIMAL_DEGREES, false))); loglevelcomboBox.setSelectedItem(prefs.getByKey(LOG_LEVEL, "Info")); retrievedPreferences.put("loglevel", prefs.getByKey(LOG_LEVEL, "Info")); useG1GroupcheckBox.setSelected(prefs.getByKey(USE_G1_GROUP, false)); retrievedPreferences.put("useG1Group", String.valueOf(prefs.getByKey(USE_G1_GROUP, false))); preserveModDatecheckBox.setSelected(prefs.getByKey(PRESERVE_MODIFY_DATE, true)); retrievedPreferences.put("preserveModDate", String.valueOf(prefs.getByKey(PRESERVE_MODIFY_DATE, true))); udFilefiltertextField.setText(prefs.getByKey(USER_DEFINED_FILE_FILTER, "")); retrievedPreferences.put("udFilefilter", prefs.getByKey(USER_DEFINED_FILE_FILTER, "")); DualColumncheckBox.setSelected(prefs.getByKey(DUAL_COLUMN, true)); sortCatsTagscheckBox.setSelected(prefs.getByKey(SORT_CATEGORIES_TAGS, false)); enableStructCheckBox.setSelected(prefs.getByKey(ENABLE_STRUCTS, false)); setExampleImage(); setCurrentFont(); } // The main" function of this class public void showDialog() { //setSize(750, 600); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("preferences.title")); //pack(); double x = getParent().getBounds().getCenterX(); double y = getParent().getBounds().getCenterY(); //setLocation((int) x - getWidth() / 2, (int) y - getHeight() / 2); setLocationRelativeTo(null); String languages = StandardFileIO.readTextFileAsStringFromResource("texts/Languages.txt"); String[] exiftoolLanguages = languages.split("\\r?\\n"); // split on new lines metadataLanuagecomboBox.setModel(new DefaultComboBoxModel(exiftoolLanguages)); String Locales = StandardFileIO.readTextFileAsStringFromResource("texts/Locales.txt"); //String[] appLocales = Locales.split("\\r?\\n"); // split on new lines String[] appLocales = {"System default - default", "de_DE - Deutsch", "en_US - English", "es_ES - Español", "in_ID - Bahasa Indonesia", "iw_HE - עִברִית", "nb_NO - Norsk (bokmål)", "nl_NL - Nederlands", "pt_BR - Portugues do Brasil", "ru_RU - русский язык", "uk_UK - украї́нська мо́ва", "zh_CN - 简体中文"}; localecomboBox.setModel(new DefaultComboBoxModel(appLocales)); filedialogexplained.setText(String.format(ProgramTexts.HTML, 500, ResourceBundle.getBundle("translations/program_strings").getString("prefs.dialogexplained"))); logleveltext.setText(String.format(ProgramTexts.HTML, 500, ResourceBundle.getBundle("translations/program_strings").getString("prefs.logleveltext"))); getListOfSystemFonts(); allSystemFonts.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fontSizes.setModel(new AbstractListModel() { String[] strings = {"10", "12", "14", "16", "18", "20", "22", "24", "28", "32", "36"}; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); fontSizes.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); retrievePreferences(); // Add listeners to the font lists allSystemFonts.getSelectionModel().addListSelectionListener(new FontSelectionListener()); fontSizes.getSelectionModel().addListSelectionListener(new FontSelectionListener()); pack(); setVisible(true); } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPanel = new JPanel(); contentPanel.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); tabbedPanel = new JTabbedPane(); contentPanel.add(tabbedPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(900, 600), null, 1, false)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel1.setMinimumSize(new Dimension(-1, -1)); panel1.setPreferredSize(new Dimension(-1, -1)); tabbedPanel.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.generaltab"), panel1); generalPanel = new JPanel(); generalPanel.setLayout(new GridLayoutManager(4, 1, new Insets(5, 5, 5, 5), -1, -1)); generalPanel.setMaximumSize(new Dimension(-1, -1)); generalPanel.setMinimumSize(new Dimension(-1, -1)); generalPanel.setPreferredSize(new Dimension(-1, -1)); generalPanel.setRequestFocusEnabled(false); panel1.add(generalPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(850, 600), null, 2, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(7, 2, new Insets(5, 5, 5, 5), -1, -1)); generalPanel.add(panel2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label1 = new JLabel(); Font label1Font = this.$$$getFont$$$(null, Font.BOLD, -1, label1.getFont()); if (label1Font != null) label1.setFont(label1Font); this.$$$loadLabelText$$$(label1, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.exiftoolocation")); panel2.add(label1, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel2.add(panel3, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ExiftoolLocationtextField = new JTextField(); ExiftoolLocationtextField.setMinimumSize(new Dimension(300, 30)); ExiftoolLocationtextField.setPreferredSize(new Dimension(550, 30)); panel3.add(ExiftoolLocationtextField); ExiftoolLocationbutton = new JButton(); this.$$$loadButtonText$$$(ExiftoolLocationbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.btnchoose")); panel3.add(ExiftoolLocationbutton); final JLabel label2 = new JLabel(); Font label2Font = this.$$$getFont$$$(null, Font.BOLD, -1, label2.getFont()); if (label2Font != null) label2.setFont(label2Font); this.$$$loadLabelText$$$(label2, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.defaultimgstartdir")); panel2.add(label2, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel4 = new JPanel(); panel4.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel2.add(panel4, new GridConstraints(3, 0, 1, 2, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); ImgStartFoldertextField = new JTextField(); ImgStartFoldertextField.setMinimumSize(new Dimension(300, 30)); ImgStartFoldertextField.setPreferredSize(new Dimension(550, 30)); ImgStartFoldertextField.setText(""); panel4.add(ImgStartFoldertextField); ImgStartFolderButton = new JButton(); this.$$$loadButtonText$$$(ImgStartFolderButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.btnchoose")); panel4.add(ImgStartFolderButton); UseLastOpenedFoldercheckBox = new JCheckBox(); this.$$$loadButtonText$$$(UseLastOpenedFoldercheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.alwaysuselastfolder")); UseLastOpenedFoldercheckBox.setToolTipText("Selecting this checkbox will overrule the \"Default image start directory:\""); panel2.add(UseLastOpenedFoldercheckBox, new GridConstraints(4, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label3 = new JLabel(); Font label3Font = this.$$$getFont$$$(null, Font.BOLD, -1, label3.getFont()); if (label3Font != null) label3.setFont(label3Font); this.$$$loadLabelText$$$(label3, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.udfilefilter")); panel2.add(label3, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel5 = new JPanel(); panel5.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel2.add(panel5, new GridConstraints(6, 0, 1, 2, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); udFilefiltertextField = new JTextField(); udFilefiltertextField.setMinimumSize(new Dimension(350, 30)); udFilefiltertextField.setPreferredSize(new Dimension(450, 30)); udFilefiltertextField.setToolTipText(this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.filterexample")); panel5.add(udFilefiltertextField); final JLabel label4 = new JLabel(); Font label4Font = this.$$$getFont$$$(null, Font.ITALIC, -1, label4.getFont()); if (label4Font != null) label4.setFont(label4Font); this.$$$loadLabelText$$$(label4, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.filterexample")); panel5.add(label4); final JPanel panel6 = new JPanel(); panel6.setLayout(new GridLayoutManager(4, 1, new Insets(0, 5, 0, 0), -1, -1)); generalPanel.add(panel6, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel6.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label5 = new JLabel(); Font label5Font = this.$$$getFont$$$(null, Font.BOLD, -1, label5.getFont()); if (label5Font != null) label5.setFont(label5Font); this.$$$loadLabelText$$$(label5, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.alwaysaddvals")); panel6.add(label5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel7 = new JPanel(); panel7.setLayout(new FlowLayout(FlowLayout.LEFT, 4, 5)); panel6.add(panel7, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label6 = new JLabel(); label6.setMaximumSize(new Dimension(300, 18)); label6.setMinimumSize(new Dimension(220, 18)); label6.setPreferredSize(new Dimension(500, 18)); this.$$$loadLabelText$$$(label6, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.artist")); panel7.add(label6); ArtisttextField = new JTextField(); ArtisttextField.setPreferredSize(new Dimension(325, 30)); panel7.add(ArtisttextField); final JPanel panel8 = new JPanel(); panel8.setLayout(new FlowLayout(FlowLayout.LEFT, 4, 5)); panel6.add(panel8, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label7 = new JLabel(); label7.setMaximumSize(new Dimension(300, 18)); label7.setMinimumSize(new Dimension(220, 18)); label7.setPreferredSize(new Dimension(500, 18)); this.$$$loadLabelText$$$(label7, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.copyright")); panel8.add(label7); CopyrightstextField = new JTextField(); CopyrightstextField.setPreferredSize(new Dimension(325, 30)); CopyrightstextField.setText(""); panel8.add(CopyrightstextField); final JPanel panel9 = new JPanel(); panel9.setLayout(new FlowLayout(FlowLayout.LEFT, 4, 5)); panel6.add(panel9, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label8 = new JLabel(); label8.setMaximumSize(new Dimension(300, 18)); label8.setMinimumSize(new Dimension(250, 18)); label8.setPreferredSize(new Dimension(500, 18)); this.$$$loadLabelText$$$(label8, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.credits")); panel9.add(label8); CreditstextField = new JTextField(); CreditstextField.setPreferredSize(new Dimension(325, 30)); CreditstextField.setText(""); panel9.add(CreditstextField); final JPanel panel10 = new JPanel(); panel10.setLayout(new GridLayoutManager(4, 2, new Insets(5, 5, 5, 5), -1, -1)); generalPanel.add(panel10, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel10.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label9 = new JLabel(); this.$$$loadLabelText$$$(label9, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.rawviewerlocation")); panel10.add(label9, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel11 = new JPanel(); panel11.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel10.add(panel11, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); RawViewerLocationtextField = new JTextField(); RawViewerLocationtextField.setMinimumSize(new Dimension(300, 30)); RawViewerLocationtextField.setPreferredSize(new Dimension(550, 30)); RawViewerLocationtextField.setText(""); panel11.add(RawViewerLocationtextField); RawViewerLocationButton = new JButton(); this.$$$loadButtonText$$$(RawViewerLocationButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.btnchoose")); panel11.add(RawViewerLocationButton); RawViewercheckBox = new JCheckBox(); this.$$$loadButtonText$$$(RawViewercheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.alwaysuserawviewer")); panel10.add(RawViewercheckBox, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label10 = new JLabel(); Font label10Font = this.$$$getFont$$$(null, Font.ITALIC, -1, label10.getFont()); if (label10Font != null) label10.setFont(label10Font); this.$$$loadLabelText$$$(label10, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.macosrawremark")); panel10.add(label10, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel12 = new JPanel(); panel12.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel12.setMinimumSize(new Dimension(-1, -1)); panel12.setPreferredSize(new Dimension(-1, -1)); tabbedPanel.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.languagetab"), panel12); final JPanel panel13 = new JPanel(); panel13.setLayout(new GridLayoutManager(3, 2, new Insets(10, 20, 10, 20), -1, -1)); panel12.add(panel13, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label11 = new JLabel(); this.$$$loadLabelText$$$(label11, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.metdatadisplaylang")); panel13.add(label11, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel13.add(spacer1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); metadataLanuagecomboBox = new JComboBox(); metadataLanuagecomboBox.setPreferredSize(new Dimension(300, 30)); panel13.add(metadataLanuagecomboBox, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label12 = new JLabel(); this.$$$loadLabelText$$$(label12, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.applanguage")); panel13.add(label12, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); localecomboBox = new JComboBox(); panel13.add(localecomboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); final JPanel panel14 = new JPanel(); panel14.setLayout(new GridLayoutManager(9, 2, new Insets(5, 5, 5, 5), -1, -1)); tabbedPanel.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.system"), panel14); final Spacer spacer2 = new Spacer(); panel14.add(spacer2, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); filechooserpanel = new JPanel(); filechooserpanel.setLayout(new GridLayoutManager(2, 2, new Insets(5, 5, 5, 5), -1, -1)); panel14.add(filechooserpanel, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); filechooserpanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label13 = new JLabel(); this.$$$loadLabelText$$$(label13, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.whichdialog")); filechooserpanel.add(label13, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel15 = new JPanel(); panel15.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5)); filechooserpanel.add(panel15, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); JFilechooserradioButton = new JRadioButton(); JFilechooserradioButton.setSelected(true); this.$$$loadButtonText$$$(JFilechooserradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.jfilechooser")); panel15.add(JFilechooserradioButton); AwtdialogradioButton = new JRadioButton(); this.$$$loadButtonText$$$(AwtdialogradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.awtdialog")); panel15.add(AwtdialogradioButton); filedialogexplained = new JLabel(); filedialogexplained.setText("Label"); filechooserpanel.add(filedialogexplained, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); decimaldegreescheckBox = new JCheckBox(); this.$$$loadButtonText$$$(decimaldegreescheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.showdecdegrees")); panel14.add(decimaldegreescheckBox, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); loglevelpanel = new JPanel(); loglevelpanel.setLayout(new GridLayoutManager(2, 3, new Insets(5, 5, 5, 5), -1, -1)); panel14.add(loglevelpanel, new GridConstraints(6, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); loglevelpanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label14 = new JLabel(); this.$$$loadLabelText$$$(label14, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.loglevel")); loglevelpanel.add(label14, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); loglevelcomboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("Off"); defaultComboBoxModel1.addElement("Error"); defaultComboBoxModel1.addElement("Warn"); defaultComboBoxModel1.addElement("Info"); defaultComboBoxModel1.addElement("Debug"); defaultComboBoxModel1.addElement("Trace"); loglevelcomboBox.setModel(defaultComboBoxModel1); loglevelpanel.add(loglevelcomboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 2, false)); final JLabel label15 = new JLabel(); this.$$$loadLabelText$$$(label15, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.logrestart")); loglevelpanel.add(label15, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); logleveltext = new JLabel(); logleveltext.setText("Label"); loglevelpanel.add(logleveltext, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); useG1GroupcheckBox = new JCheckBox(); useG1GroupcheckBox.setSelected(true); this.$$$loadButtonText$$$(useG1GroupcheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.useg1group")); panel14.add(useG1GroupcheckBox, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); CheckVersioncheckBox = new JCheckBox(); this.$$$loadButtonText$$$(CheckVersioncheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.checknewversion")); panel14.add(CheckVersioncheckBox, new GridConstraints(7, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); preserveModDatecheckBox = new JCheckBox(); preserveModDatecheckBox.setSelected(true); this.$$$loadButtonText$$$(preserveModDatecheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.presmoddate")); panel14.add(preserveModDatecheckBox, new GridConstraints(5, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); sortCatsTagscheckBox = new JCheckBox(); this.$$$loadButtonText$$$(sortCatsTagscheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.sortcatstags")); panel14.add(sortCatsTagscheckBox, new GridConstraints(3, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); enableStructCheckBox = new JCheckBox(); this.$$$loadButtonText$$$(enableStructCheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.enablestructs")); panel14.add(enableStructCheckBox, new GridConstraints(4, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel16 = new JPanel(); panel16.setLayout(new GridLayoutManager(2, 1, new Insets(5, 5, 5, 5), -1, -1)); tabbedPanel.addTab(this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.lookandfeeltab"), panel16); final JPanel panel17 = new JPanel(); panel17.setLayout(new GridLayoutManager(1, 2, new Insets(5, 5, 5, 5), -1, -1)); panel17.setVisible(false); panel16.add(panel17, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel17.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); DualColumncheckBox = new JCheckBox(); DualColumncheckBox.setSelected(true); this.$$$loadButtonText$$$(DualColumncheckBox, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.dualcolumn")); panel17.add(DualColumncheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); ExampleColumnImage = new JLabel(); ExampleColumnImage.setText(""); panel17.add(ExampleColumnImage, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(-1, 300), null, 0, false)); fontJPanel = new JPanel(); fontJPanel.setLayout(new GridLayoutManager(3, 3, new Insets(5, 5, 5, 5), -1, -1)); panel16.add(fontJPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(-1, 175), null, 0, false)); fontJPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); fontSizesScrollPane = new JScrollPane(); fontJPanel.add(fontSizesScrollPane, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(-1, 125), null, 1, false)); fontSizes = new JList(); fontSizes.setMaximumSize(new Dimension(-1, 1000)); fontSizes.setMinimumSize(new Dimension(-1, -1)); fontSizes.setPreferredSize(new Dimension(40, 200)); fontSizes.setSelectionMode(0); fontSizesScrollPane.setViewportView(fontSizes); fontPreview = new JLabel(); fontPreview.setText("The quick brown fox jumps over the lazy dog"); fontJPanel.add(fontPreview, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); allFontsScrollPane = new JScrollPane(); allFontsScrollPane.setVerticalScrollBarPolicy(20); fontJPanel.add(allFontsScrollPane, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(400, -1), null, 4, false)); allSystemFonts = new JList(); allSystemFonts.setMaximumSize(new Dimension(-1, 10000)); allSystemFonts.setMinimumSize(new Dimension(-1, 100)); allSystemFonts.setPreferredSize(new Dimension(-1, 5000)); allSystemFonts.setSelectionMode(0); allSystemFonts.setVisibleRowCount(8); allFontsScrollPane.setViewportView(allSystemFonts); buttonDefaultFont = new JButton(); this.$$$loadButtonText$$$(buttonDefaultFont, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.btndefaultfont")); fontJPanel.add(buttonDefaultFont, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonsetThisFont = new JButton(); buttonsetThisFont.setEnabled(false); buttonsetThisFont.setText("Use Font"); buttonsetThisFont.setVisible(false); fontJPanel.add(buttonsetThisFont, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lblFontSelection = new JLabel(); this.$$$loadLabelText$$$(lblFontSelection, this.$$$getMessageFromBundle$$$("translations/program_strings", "prefs.fontpaneltxt")); fontJPanel.add(lblFontSelection, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel18 = new JPanel(); panel18.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); contentPanel.add(panel18, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 1, false)); final Spacer spacer3 = new Spacer(); panel18.add(spacer3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel19 = new JPanel(); panel19.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); panel18.add(panel19, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonSave = new JButton(); this.$$$loadButtonText$$$(buttonSave, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.save")); panel19.add(buttonSave, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonCancel = new JButton(); this.$$$loadButtonText$$$(buttonCancel, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.cancel")); panel19.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); ButtonGroup buttonGroup; buttonGroup = new ButtonGroup(); buttonGroup.add(JFilechooserradioButton); buttonGroup.add(AwtdialogradioButton); } /** * @noinspection ALL */ private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) { if (currentFont == null) return null; String resultName; if (fontName == null) { resultName = currentFont.getName(); } else { Font testFont = new Font(fontName, Font.PLAIN, 10); if (testFont.canDisplay('a') && testFont.canDisplay('1')) { resultName = fontName; } else { resultName = currentFont.getName(); } } Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize()); boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac"); Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize()); return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadLabelText$$$(JLabel component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setDisplayedMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPanel; } }
65,945
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
RenamePhotos.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/renaming/RenamePhotos.java
package org.hvdw.jexiftoolgui.renaming; import ch.qos.logback.classic.Logger; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import org.hvdw.jexiftoolgui.*; import org.hvdw.jexiftoolgui.controllers.CommandRunner; import org.hvdw.jexiftoolgui.controllers.StandardFileIO; import org.hvdw.jexiftoolgui.facades.IPreferencesFacade; import org.hvdw.jexiftoolgui.facades.PreferencesFacade; import org.hvdw.jexiftoolgui.facades.SystemPropertyFacade; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.border.TitledBorder; import javax.swing.plaf.FontUIResource; import javax.swing.text.StyleContext; import java.awt.*; import java.awt.event.*; import java.io.File; import java.io.IOException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.ResourceBundle; import static org.hvdw.jexiftoolgui.facades.IPreferencesFacade.PreferenceKey.*; import static org.hvdw.jexiftoolgui.facades.SystemPropertyFacade.SystemPropertyKey.LINE_SEPARATOR; import static org.hvdw.jexiftoolgui.facades.SystemPropertyFacade.SystemPropertyKey.USER_HOME; public class RenamePhotos extends JDialog { private JPanel rootRenamingPane; private JButton buttonOK; private JButton buttonCancel; private JLabel RenamingGeneralText; private JButton renamingInfobutton; private JTextField RenamingSourceFoldertextField; private JButton RenamingSourceFolderbutton; private JPanel RenamingOptions; private JPanel RenamingsuffixPanel; private JPanel RenamingNumberingPanel; private JLabel RenamingDuplicateNames; private JPanel RenamingFileExtPanel; private JRadioButton prefixDate_timeradioButton; private JComboBox prefixDate_timecomboBox; private JRadioButton prefixDateradioButton; private JComboBox prefixDatecomboBox; private JRadioButton prefixStringradioButton; private JTextField prefixStringtextField; private JRadioButton suffixDonNotUseradioButton; private JRadioButton suffixStringradioButton; private JTextField suffixStringtextField; private JRadioButton suffixDatetimeradioButton; private JComboBox suffixDatetimecomboBox; private JRadioButton suffixDateradioButton; private JComboBox suffixDatecomboBox; private JRadioButton suffixCameramodelradioButton; private JRadioButton suffixOriginalFilenameradioButton; private JComboBox DigitscomboBox; private JComboBox StartOnImgcomboBox; private JRadioButton extLeaveradioButton; private JRadioButton makeLowerCaseRadioButton; private JRadioButton makeUpperCaseRadioButton; private JProgressBar progressBar; private JRadioButton prefixCameramodelradioButton; private JRadioButton suffixCityNameradioButton; private JRadioButton suffixLocationradioButton; private JRadioButton suffixISOradioButton; private JRadioButton suffixFocalLengthradioButton; private final static IPreferencesFacade prefs = PreferencesFacade.defaultInstance; private final static Logger logger = (Logger) LoggerFactory.getLogger(RenamePhotos.class); private int[] selectedFilenamesIndices; public File[] files; boolean selected_files; public RenamePhotos() { StringBuilder res = new StringBuilder(); setContentPane(rootRenamingPane); setModal(true); getRootPane().setDefaultButton(buttonOK); this.setIconImage(Utils.getFrameIcon()); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); rootRenamingPane.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); // button listeners buttonOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { onOK(); } catch (IOException | InterruptedException ee) { logger.error("IOException error", ee); res.append("IOException error") .append(System.lineSeparator()) .append(ee.getMessage()); } } }); buttonCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE rootRenamingPane.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); // This is the info button on the Rename panel renamingInfobutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { JOptionPane.showMessageDialog(rootRenamingPane, String.format(ProgramTexts.HTML, 700, ResourceBundle.getBundle("translations/program_help_texts").getString("renamingtext")), ResourceBundle.getBundle("translations/program_help_texts").getString("renamingtitle"), JOptionPane.INFORMATION_MESSAGE); } }); RenamingSourceFolderbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { String ImgPath = getImagePath(rootRenamingPane); if (!"".equals(ImgPath)) { RenamingSourceFoldertextField.setText(ImgPath); } } }); } public String getImagePath(JPanel myComponent) { String SelectedFolder; //String prefFileDialog = prefs.getByKey(PREFERRED_FILEDIALOG, "jfilechooser"); String startFolder = StandardFileIO.getFolderPathToOpenBasedOnPreferences(); final JFileChooser chooser = new JFileChooser(startFolder); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); chooser.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); chooser.setDialogTitle(ResourceBundle.getBundle("translations/program_strings").getString("rph.locateimgfolder")); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int status = chooser.showOpenDialog(myComponent); if (status == JFileChooser.APPROVE_OPTION) { SelectedFolder = chooser.getSelectedFile().getAbsolutePath(); return SelectedFolder; } else { return ""; } } // Start of the methods public void initDialog() { RenamingGeneralText.setText(String.format(ProgramTexts.HTML, 650, ResourceBundle.getBundle("translations/program_strings").getString("rph.toptext"))); RenamingDuplicateNames.setText(String.format(ProgramTexts.HTML, 370, ResourceBundle.getBundle("translations/program_strings").getString("rph.duplicatestext"))); RenamingSourceFoldertextField.setText(""); for (String item : MyConstants.DATES_TIMES_STRINGS) { prefixDate_timecomboBox.addItem(item); suffixDatetimecomboBox.addItem(item); } for (String item : MyConstants.DATES_STRINGS) { prefixDatecomboBox.addItem(item); suffixDatecomboBox.addItem(item); } for (int digit = 2; digit <= 6; digit++) { DigitscomboBox.addItem(digit); } StartOnImgcomboBox.addItem(ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitszero")); StartOnImgcomboBox.addItem(ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitsone")); StartOnImgcomboBox.addItem(ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitstwo")); StartOnImgcomboBox.setSelectedIndex(1); } private void rename_photos() { //int[] selectedFilenamesIndices = MyVariables.getSelectedFilenamesIndices(); //File[] files = MyVariables.getLoadedFiles(); StringBuilder res = new StringBuilder(); String fpath = ""; List<String> cmdparams = new ArrayList<String>(); StringBuilder exifcommands = new StringBuilder(); String rename_extension = ""; String extension_message = ""; String prefix = "${CreateDate}"; String prefix_message = ""; String prefixformat = ""; boolean fulldatetime = false; String suffix = "${CreateDate}"; String suffix_message = ""; String suffixformat = ""; String startcounting = ""; String startcounting_message = ""; boolean date_used = true; // exiftool on windows or other String exiftool = Utils.platformExiftool(); boolean isWindows = Utils.isOsFromMicrosoft(); if (("".equals(RenamingSourceFoldertextField.getText())) && (!selected_files)) { // Empty folder string and no files selected JOptionPane.showMessageDialog(null, String.format(ProgramTexts.HTML, 350, ResourceBundle.getBundle("translations/program_strings").getString("rph.noimgsnopathtext")), ResourceBundle.getBundle("translations/program_strings").getString("rph.noimgsnopathtitle"), JOptionPane.WARNING_MESSAGE); } else { // analyze what prefix radio button has been chosen if (prefixDate_timeradioButton.isSelected()) { if (prefixDate_timecomboBox.getSelectedItem() == "YYYYMMDDHHMMSS") { prefix_message = "YYYYMMDDHHMMSS"; prefixformat = "%Y%m%d%H%M%S"; } else if (prefixDate_timecomboBox.getSelectedItem() == "YYYYMMDD_HHMMSS") { prefix_message = "YYYYMMDD_HHMMSS"; prefixformat = "%Y%m%d_%H%M%S"; } else if (prefixDate_timecomboBox.getSelectedItem() == "YYYYMMDD-HHMMSS") { prefix_message = "YYYYMMDD-HHMMSS"; prefixformat = "%Y%m%d-%H%M%S"; } else if (prefixDate_timecomboBox.getSelectedItem() == "YYYY_MM_DD_HH_MM_SS") { prefix_message = "YYYY_MM_DD_HH_MM_SS"; prefixformat = "%Y_%m_%d_%H_%M_%S"; } else if (prefixDate_timecomboBox.getSelectedItem() == "YYYY-MM-DD-HH-MM-SS") { prefix_message = "YYYY-MM-DD-HH-MM-SS"; prefixformat = "%Y-%m-%d-%H-%M-%S"; } else if (suffixDatetimecomboBox.getSelectedItem() == "YYYMMDD HHMMSS") { suffix_message = "YYYMMDD HHMMSS"; suffixformat = "%Y%m%d %H%M%S"; } else if (suffixDatetimecomboBox.getSelectedItem() == "YYYY_MM_DD HH_MM_SS") { suffix_message = "YYYY_MM_DD HH_MM_SS"; suffixformat = "%Y_%m_%d %H_%M_%S"; } else if (suffixDatetimecomboBox.getSelectedItem() == "YYYY-MM-DD HH-MM-SS") { suffix_message = "YYYY-MM-DD HH-MM-SS"; suffixformat = "%Y-%m-%d %H-%M-%S"; } fulldatetime = true; } else if (prefixDateradioButton.isSelected()) { if (prefixDatecomboBox.getSelectedItem() == "YYYYMMDD") { prefix_message = "YYYYMMDD"; prefixformat = "%Y%m%d"; } else if (prefixDatecomboBox.getSelectedItem() == "YYYY_MM_DD") { prefix_message = "YYYY_MM_DD"; prefixformat = "%Y_%m_%d"; } else if (prefixDatecomboBox.getSelectedItem() == "YYYY-MM-DD") { prefix_message = "YYYY-MM-DD"; prefixformat = "%Y-%m-%d"; } fulldatetime = false; } else if (prefixStringradioButton.isSelected()) { prefix_message = prefixStringtextField.getText(); prefix = prefixStringtextField.getText(); prefixformat = ""; fulldatetime = false; } else if (prefixCameramodelradioButton.isSelected()) { prefix_message = "${Exif:Model}"; prefix = "${Exif:Model}"; prefixformat = ""; fulldatetime = false; } // analyze if and which suffix radio button has been chosen suffix = "${CreateDate}"; if (suffixDonNotUseradioButton.isSelected()) { suffix_message = ""; suffixformat = ""; suffix = ""; } else { if (suffixStringradioButton.isSelected()) { suffix_message = suffixStringtextField.getText(); suffix = suffixStringtextField.getText(); suffixformat = ""; } else if (suffixDatetimeradioButton.isSelected()) { if (suffixDatetimecomboBox.getSelectedItem() == "YYYYMMDDHHMMSS") { suffix_message = "YYYYMMDDHHMMSS"; suffixformat = "%Y%m%d%H%M%S"; } else if (suffixDatetimecomboBox.getSelectedItem() == "YYYYMMDD_HHMMSS") { suffix_message = "YYYYMMDD_HHMMSS"; suffixformat = "%Y%m%d_%H%M%S"; } else if (suffixDatetimecomboBox.getSelectedItem() == "YYYMMDD-HHMMSS") { suffix_message = "YYYMMDD-HHMMSS"; suffixformat = "%Y%m%d-%H%M%S"; } else if (suffixDatetimecomboBox.getSelectedItem() == "YYYY_MM_DD_HH_MM_SS") { suffix_message = "YYYY_MM_DD_HH_MM_SS"; suffixformat = "%Y_%m_%d_%H_%M_%S"; } else if (suffixDatetimecomboBox.getSelectedItem() == "YYYY-MM-DD-HH-MM-SS") { suffix_message = "YYYY-MM-DD-HH-MM-SS"; suffixformat = "%Y-%m-%d-%H-%M-%S"; } else if (suffixDatetimecomboBox.getSelectedItem() == "YYYMMDD HHMMSS") { suffix_message = "YYYMMDD HHMMSS"; suffixformat = "%Y%m%d %H%M%S"; } else if (suffixDatetimecomboBox.getSelectedItem() == "YYYY_MM_DD HH_MM_SS") { suffix_message = "YYYY_MM_DD HH_MM_SS"; suffixformat = "%Y_%m_%d %H_%M_%S"; } else if (suffixDatetimecomboBox.getSelectedItem() == "YYYY-MM-DD HH-MM-SS") { suffix_message = "YYYY-MM-DD HH-MM-SS"; suffixformat = "%Y-%m-%d %H-%M-%S"; } fulldatetime = true; } else if (suffixDateradioButton.isSelected()) { if (suffixDatecomboBox.getSelectedItem() == "YYYYMMDD") { suffix_message = "YYYYMMDD"; suffixformat = "%Y%m%d"; } else if (suffixDatecomboBox.getSelectedItem() == "YYYY_MM_DD") { suffix_message = "YYYY_MM_DD"; suffixformat = "%Y_%m_%d"; } else if (suffixDatecomboBox.getSelectedItem() == "YYYY-MM-DD") { suffix_message = "YYYY-MM-DD"; suffixformat = "%Y-%m-%d"; } fulldatetime = false; } else if (suffixCameramodelradioButton.isSelected()) { suffix_message = "${Exif:Model}"; suffix = "${Exif:Model}"; suffixformat = ""; } else if (suffixLocationradioButton.isSelected()) { suffix_message = "${xmp:location}"; suffix = "${xmp:location}"; suffixformat = ""; } else if (suffixCityNameradioButton.isSelected()) { suffix_message = "${xmp:city}"; suffix = "${xmp:city}"; suffixformat = ""; } else if (suffixISOradioButton.isSelected()) { suffix_message = "${exif:iso}ISO"; suffix = "${exif:iso}ISO"; suffixformat = ""; } else if (suffixFocalLengthradioButton.isSelected()) { suffix_message = "${exif:focallengthin35mmformat}"; suffix = "${exif:focallengthin35mmformat}"; suffixformat = ""; } else if (suffixOriginalFilenameradioButton.isSelected()) { //suffix_message = "${filename}"; //suffix = "${filename}"; suffix_message = "${BaseName}"; suffix = "${BaseName}"; suffixformat = ""; } } // Now the extension: Does the user want lowercase, uppercase or doesn't care (leave as is)? if (extLeaveradioButton.isSelected()) { rename_extension = ".%e"; extension_message = ResourceBundle.getBundle("translations/program_strings").getString("rph.fileextleave"); } else if (makeLowerCaseRadioButton.isSelected()) { rename_extension = ".%le"; extension_message = ResourceBundle.getBundle("translations/program_strings").getString("rph.fileextlower"); } else if (makeUpperCaseRadioButton.isSelected()) { rename_extension = ".%ue"; extension_message = ResourceBundle.getBundle("translations/program_strings").getString("rph.fileextupper"); } // Finally: Does the user want to start counting as of the first image or starting on the second image if (StartOnImgcomboBox.getSelectedIndex() == 0) { startcounting = ""; logger.info("Do not count"); startcounting_message = ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitszero"); } else if (StartOnImgcomboBox.getSelectedIndex() == 1) { startcounting = "nc"; logger.info("start counting on 1st image"); startcounting_message = ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitsone"); } else { startcounting = "c"; logger.info("start counting on 2nd image"); startcounting_message = ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitstwo"); } // Now ask the user whether the selected options are really what he/she wants String dialogMessage = ResourceBundle.getBundle("translations/program_strings").getString("rph.youselected") + "\n\n" + ResourceBundle.getBundle("translations/program_strings").getString("rph.asprefix") + " "; dialogMessage += prefix_message; if (!suffixDonNotUseradioButton.isSelected()) { dialogMessage += "\n\n" + ResourceBundle.getBundle("translations/program_strings").getString("rph.assuffix") + " "; dialogMessage += suffix_message; } dialogMessage += "\n\n" + ResourceBundle.getBundle("translations/program_strings").getString("rph.forcounting") + " "; dialogMessage += startcounting_message; dialogMessage += "\n\n" + ResourceBundle.getBundle("translations/program_strings").getString("rph.forextension") + " "; dialogMessage += extension_message; String[] options = {ResourceBundle.getBundle("translations/program_strings").getString("dlg.continue"), ResourceBundle.getBundle("translations/program_strings").getString("dlg.cancel")}; int choice = JOptionPane.showOptionDialog(null, dialogMessage, ResourceBundle.getBundle("translations/program_strings").getString("rph.selectedoptionstitle"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (choice == 0) { //Continue //cmdparams.add("-overwrite_original_in_place"); // We need to first cmdparams here, as sometimes the string does not contains spaces and sometimes it does // When it does have spaces we need to create an addition cdmparams // Check if wee need to preserver the file modify date boolean preserveModifyDate = prefs.getByKey(PRESERVE_MODIFY_DATE, true); if ((suffixDonNotUseradioButton.isSelected()) && (prefixStringradioButton.isSelected())) { String userHome = SystemPropertyFacade.getPropertyByKey(USER_HOME); String strjexiftoolguifolder = userHome + File.separator + MyConstants.MY_DATA_FOLDER; // string as prefix and no suffix if (isWindows) { cmdparams.add(Utils.platformExiftool().replace("\\", "/")); if (preserveModifyDate) { cmdparams.add("-preserve"); // We also need the extra config file in case of "Basename" renaming options cmdparams.add("-config"); cmdparams.add(strjexiftoolguifolder + File.separator + "extra_functions.config"); } exifcommands = new StringBuilder("\"-FileName=" + prefix); } else { // The < or > redirect options cannot directly be used within a single param on unixes/linuxes cmdparams.add("/bin/sh"); cmdparams.add("-c"); String configFile = " -config" + strjexiftoolguifolder + File.separator + "extra_functions.config "; if (preserveModifyDate) { exifcommands = new StringBuilder(Utils.platformExiftool().replaceAll(" ", "\\ ") + configFile + " -preserve '-FileName=" + prefix); } else { exifcommands = new StringBuilder(Utils.platformExiftool().replaceAll(" ", "\\ ") + configFile + " '-FileName=" + prefix); } } } else { // Or a suffix or date(time), or both if (isWindows) { cmdparams.add(Utils.platformExiftool().replace("\\", "/")); exifcommands = new StringBuilder("\"-FileName<" + prefix); } else { // The < or > redirect options cannot directly be used within a single param on unixes/linuxes cmdparams.add("/bin/sh"); cmdparams.add("-c"); exifcommands = new StringBuilder(Utils.platformExiftool().replaceAll(" ", "\\ ") + " '-FileName<" + prefix); } } if (!suffixDonNotUseradioButton.isSelected()) { exifcommands.append("_" + suffix); } //logger.info("combobox selection " + StartOnImgcomboBox.getSelectedItem()); if ((StartOnImgcomboBox.getSelectedIndex() > 0)) { if (fulldatetime) { // This means that the autonumber should only work on images that have the same full datetime exifcommands.append("%-" + DigitscomboBox.getSelectedItem() + startcounting); } else { exifcommands.append("%-." + DigitscomboBox.getSelectedItem() + startcounting); } } if (!"".equals(prefixformat)) { // This means that the prefix is a date(time), we do need an additional cmdparams command if (isWindows) { exifcommands.append(rename_extension + "\" -d " + prefixformat); } else { exifcommands.append(rename_extension + "' -d " + prefixformat); } } else { // this means that we use a string instead of date(time) as prefix // if the prefixformat is empty we need to move the "counter" // It also means we must have a suffix if (isWindows) { exifcommands.append(rename_extension + "\""); } else { exifcommands.append(rename_extension + "'"); } if (!"".equals(suffixformat)) { // means that we have a date(time) in the suffix exifcommands.append(" -d " + suffixformat); } } if ((!"".equals(prefixformat)) || (!"".equals(suffixformat))) { // if date time use -fileorder datetimeoriginal# if (isWindows) { exifcommands.append(" \"-fileorder datetimeoriginal#\""); } else { exifcommands.append(" '-fileorder datetimeoriginal#'"); } } // Check whether the directory has been povided (takes precedence) or files have been selected from the main page if (!"".equals(RenamingSourceFoldertextField.getText())) { // not empty, so a selected folder // Add the dir if (isWindows) { cmdparams.add(exifcommands.toString()); cmdparams.add(RenamingSourceFoldertextField.getText().replace(File.separator, "/")); } else { exifcommands.append(" \"" + RenamingSourceFoldertextField.getText().replace(File.separator, "/") + "\""); cmdparams.add(exifcommands.toString()); } } else { // we have images selected in the main screen if (isWindows) { cmdparams.add(exifcommands.toString()); for (int index : selectedFilenamesIndices) { cmdparams.add("\"" + files[index].getPath().replace("\\", "/").replace("(", "\\(").replace(")", "\\)") + "\""); } } else { for (int index : selectedFilenamesIndices) { exifcommands.append(" \"" + files[index].getPath().replace("(", "\\(").replace(")", "\\)") + "\""); } cmdparams.add(exifcommands.toString()); } } logger.info("final cmdparams: " + cmdparams); logger.info("final exifcommands: " + exifcommands.toString()); CommandRunner.runCommandWithProgressBar(cmdparams, progressBar); //} //end of else statement where we do not have a string and not a suffix } // On Cancel we don't have to do anything //JOptionPane.showMessageDialog(null, dialogMessage, "In OnOK", JOptionPane.WARNING_MESSAGE); } } private void onOK() throws IOException, InterruptedException { rename_photos(); //dispose(); } private void onCancel() { // add your code here if necessary dispose(); } public void showDialog(boolean files_selected) { if (files_selected) { selected_files = true; selectedFilenamesIndices = MyVariables.getSelectedFilenamesIndices(); files = MyVariables.getLoadedFiles(); } progressBar.setVisible(false); pack(); //setLocationRelativeTo(null); setLocationByPlatform(true); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("renamephotos.title")); initDialog(); setVisible(true); } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { rootRenamingPane = new JPanel(); rootRenamingPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); rootRenamingPane.setPreferredSize(new Dimension(1100, 900)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 4, new Insets(0, 0, 0, 0), -1, -1)); rootRenamingPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); panel1.add(panel2, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonOK = new JButton(); this.$$$loadButtonText$$$(buttonOK, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.ok")); panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonCancel = new JButton(); this.$$$loadButtonText$$$(buttonCancel, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.close")); panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel1.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label1 = new JLabel(); Font label1Font = this.$$$getFont$$$(null, Font.BOLD | Font.ITALIC, -1, label1.getFont()); if (label1Font != null) label1.setFont(label1Font); label1.setForeground(new Color(-16776961)); label1.setMinimumSize(new Dimension(400, 17)); label1.setPreferredSize(new Dimension(400, 17)); this.$$$loadLabelText$$$(label1, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.nameexample")); panel3.add(label1); final Spacer spacer1 = new Spacer(); panel1.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); panel1.add(progressBar, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(25, 8), new Dimension(85, 15), null, 0, false)); final JPanel panel4 = new JPanel(); panel4.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); rootRenamingPane.add(panel4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel5 = new JPanel(); panel5.setLayout(new GridLayoutManager(3, 1, new Insets(10, 0, 10, 0), -1, -1)); panel4.add(panel5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); RenamingGeneralText = new JLabel(); this.$$$loadLabelText$$$(RenamingGeneralText, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.toptext")); panel5.add(RenamingGeneralText, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label2 = new JLabel(); Font label2Font = this.$$$getFont$$$(null, Font.BOLD, -1, label2.getFont()); if (label2Font != null) label2.setFont(label2Font); this.$$$loadLabelText$$$(label2, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.sourcefolder")); panel5.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel6 = new JPanel(); panel6.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel5.add(panel6, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); RenamingSourceFolderbutton = new JButton(); this.$$$loadButtonText$$$(RenamingSourceFolderbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.browse")); panel6.add(RenamingSourceFolderbutton); RenamingSourceFoldertextField = new JTextField(); RenamingSourceFoldertextField.setPreferredSize(new Dimension(600, 30)); panel6.add(RenamingSourceFoldertextField); renamingInfobutton = new JButton(); this.$$$loadButtonText$$$(renamingInfobutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "button.help")); panel6.add(renamingInfobutton); final JPanel panel7 = new JPanel(); panel7.setLayout(new GridLayoutManager(1, 2, new Insets(10, 0, 10, 0), -1, -1)); panel4.add(panel7, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel7.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); RenamingOptions = new JPanel(); RenamingOptions.setLayout(new GridLayoutManager(6, 1, new Insets(0, 0, 0, 0), -1, -1)); panel7.add(RenamingOptions, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label3 = new JLabel(); Font label3Font = this.$$$getFont$$$(null, Font.BOLD, -1, label3.getFont()); if (label3Font != null) label3.setFont(label3Font); this.$$$loadLabelText$$$(label3, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.selrenameoptions")); RenamingOptions.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label4 = new JLabel(); Font label4Font = this.$$$getFont$$$(null, Font.BOLD, -1, label4.getFont()); if (label4Font != null) label4.setFont(label4Font); this.$$$loadLabelText$$$(label4, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.prefix")); RenamingOptions.add(label4, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel8 = new JPanel(); panel8.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingOptions.add(panel8, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); prefixDate_timeradioButton = new JRadioButton(); prefixDate_timeradioButton.setPreferredSize(new Dimension(140, 19)); prefixDate_timeradioButton.setSelected(true); this.$$$loadButtonText$$$(prefixDate_timeradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.datetime")); panel8.add(prefixDate_timeradioButton); prefixDate_timecomboBox = new JComboBox(); panel8.add(prefixDate_timecomboBox); final JPanel panel9 = new JPanel(); panel9.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingOptions.add(panel9, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); prefixDateradioButton = new JRadioButton(); prefixDateradioButton.setPreferredSize(new Dimension(140, 19)); prefixDateradioButton.setRolloverEnabled(false); this.$$$loadButtonText$$$(prefixDateradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.date")); panel9.add(prefixDateradioButton); prefixDatecomboBox = new JComboBox(); panel9.add(prefixDatecomboBox); final JPanel panel10 = new JPanel(); panel10.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingOptions.add(panel10, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); prefixStringradioButton = new JRadioButton(); prefixStringradioButton.setPreferredSize(new Dimension(140, 19)); this.$$$loadButtonText$$$(prefixStringradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.string")); panel10.add(prefixStringradioButton); prefixStringtextField = new JTextField(); prefixStringtextField.setPreferredSize(new Dimension(200, 30)); panel10.add(prefixStringtextField); final JPanel panel11 = new JPanel(); panel11.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingOptions.add(panel11, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); prefixCameramodelradioButton = new JRadioButton(); prefixCameramodelradioButton.setPreferredSize(new Dimension(145, 19)); this.$$$loadButtonText$$$(prefixCameramodelradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.cammodel")); panel11.add(prefixCameramodelradioButton); final JLabel label5 = new JLabel(); label5.setText("${Exif:Model}"); panel11.add(label5); RenamingsuffixPanel = new JPanel(); RenamingsuffixPanel.setLayout(new GridLayoutManager(11, 1, new Insets(0, 0, 0, 0), -1, -1)); panel7.add(RenamingsuffixPanel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label6 = new JLabel(); Font label6Font = this.$$$getFont$$$(null, Font.BOLD, -1, label6.getFont()); if (label6Font != null) label6.setFont(label6Font); this.$$$loadLabelText$$$(label6, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.suffix")); RenamingsuffixPanel.add(label6, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel12 = new JPanel(); panel12.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingsuffixPanel.add(panel12, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); suffixDonNotUseradioButton = new JRadioButton(); suffixDonNotUseradioButton.setMinimumSize(new Dimension(190, 19)); suffixDonNotUseradioButton.setSelected(true); this.$$$loadButtonText$$$(suffixDonNotUseradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.donotuse")); panel12.add(suffixDonNotUseradioButton); final JPanel panel13 = new JPanel(); panel13.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingsuffixPanel.add(panel13, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); suffixStringradioButton = new JRadioButton(); suffixStringradioButton.setPreferredSize(new Dimension(300, 19)); this.$$$loadButtonText$$$(suffixStringradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.string")); panel13.add(suffixStringradioButton); suffixStringtextField = new JTextField(); suffixStringtextField.setPreferredSize(new Dimension(200, 30)); panel13.add(suffixStringtextField); final JPanel panel14 = new JPanel(); panel14.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingsuffixPanel.add(panel14, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); suffixDatetimeradioButton = new JRadioButton(); suffixDatetimeradioButton.setPreferredSize(new Dimension(300, 19)); this.$$$loadButtonText$$$(suffixDatetimeradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.datetime")); panel14.add(suffixDatetimeradioButton); suffixDatetimecomboBox = new JComboBox(); panel14.add(suffixDatetimecomboBox); final JPanel panel15 = new JPanel(); panel15.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingsuffixPanel.add(panel15, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); suffixDateradioButton = new JRadioButton(); suffixDateradioButton.setPreferredSize(new Dimension(300, 19)); this.$$$loadButtonText$$$(suffixDateradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.date")); panel15.add(suffixDateradioButton); suffixDatecomboBox = new JComboBox(); panel15.add(suffixDatecomboBox); final JPanel panel16 = new JPanel(); panel16.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingsuffixPanel.add(panel16, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); suffixCameramodelradioButton = new JRadioButton(); suffixCameramodelradioButton.setPreferredSize(new Dimension(300, 19)); this.$$$loadButtonText$$$(suffixCameramodelradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.cammodel")); panel16.add(suffixCameramodelradioButton); final JLabel label7 = new JLabel(); label7.setText("${Exif:Model}"); panel16.add(label7); final JPanel panel17 = new JPanel(); panel17.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingsuffixPanel.add(panel17, new GridConstraints(10, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); suffixOriginalFilenameradioButton = new JRadioButton(); suffixOriginalFilenameradioButton.setPreferredSize(new Dimension(300, 19)); this.$$$loadButtonText$$$(suffixOriginalFilenameradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.orgfilename")); panel17.add(suffixOriginalFilenameradioButton); final JLabel label8 = new JLabel(); label8.setText("BaseName"); panel17.add(label8); final JPanel panel18 = new JPanel(); panel18.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingsuffixPanel.add(panel18, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); suffixCityNameradioButton = new JRadioButton(); suffixCityNameradioButton.setPreferredSize(new Dimension(300, 19)); this.$$$loadButtonText$$$(suffixCityNameradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.cityname")); panel18.add(suffixCityNameradioButton); final JLabel label9 = new JLabel(); label9.setText("${Xmp:City}"); panel18.add(label9); final JPanel panel19 = new JPanel(); panel19.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingsuffixPanel.add(panel19, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); suffixLocationradioButton = new JRadioButton(); suffixLocationradioButton.setPreferredSize(new Dimension(300, 19)); this.$$$loadButtonText$$$(suffixLocationradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.location")); panel19.add(suffixLocationradioButton); final JLabel label10 = new JLabel(); label10.setText("${Xmp:Location}"); panel19.add(label10); final JPanel panel20 = new JPanel(); panel20.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingsuffixPanel.add(panel20, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); suffixISOradioButton = new JRadioButton(); suffixISOradioButton.setPreferredSize(new Dimension(300, 19)); this.$$$loadButtonText$$$(suffixISOradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.iso")); panel20.add(suffixISOradioButton); final JLabel label11 = new JLabel(); label11.setText("${Exif:ISO}"); panel20.add(label11); final JPanel panel21 = new JPanel(); panel21.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingsuffixPanel.add(panel21, new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); suffixFocalLengthradioButton = new JRadioButton(); suffixFocalLengthradioButton.setPreferredSize(new Dimension(300, 19)); this.$$$loadButtonText$$$(suffixFocalLengthradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.foclength35mm")); panel21.add(suffixFocalLengthradioButton); final JLabel label12 = new JLabel(); label12.setText("${exif:focallengthin35mmformat}"); panel21.add(label12); final JPanel panel22 = new JPanel(); panel22.setLayout(new GridLayoutManager(1, 2, new Insets(10, 0, 10, 0), -1, -1)); panel4.add(panel22, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel22.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); RenamingNumberingPanel = new JPanel(); RenamingNumberingPanel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); panel22.add(RenamingNumberingPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); RenamingDuplicateNames = new JLabel(); Font RenamingDuplicateNamesFont = this.$$$getFont$$$(null, -1, -1, RenamingDuplicateNames.getFont()); if (RenamingDuplicateNamesFont != null) RenamingDuplicateNames.setFont(RenamingDuplicateNamesFont); this.$$$loadLabelText$$$(RenamingDuplicateNames, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.duplicatestext")); RenamingNumberingPanel.add(RenamingDuplicateNames, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); final JPanel panel23 = new JPanel(); panel23.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); RenamingNumberingPanel.add(panel23, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label13 = new JLabel(); label13.setPreferredSize(new Dimension(140, 18)); this.$$$loadLabelText$$$(label13, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.noofdigits")); panel23.add(label13); DigitscomboBox = new JComboBox(); panel23.add(DigitscomboBox); StartOnImgcomboBox = new JComboBox(); panel23.add(StartOnImgcomboBox); RenamingFileExtPanel = new JPanel(); RenamingFileExtPanel.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1)); panel22.add(RenamingFileExtPanel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label14 = new JLabel(); Font label14Font = this.$$$getFont$$$(null, Font.BOLD, -1, label14.getFont()); if (label14Font != null) label14.setFont(label14Font); this.$$$loadLabelText$$$(label14, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.filextension")); RenamingFileExtPanel.add(label14, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); extLeaveradioButton = new JRadioButton(); extLeaveradioButton.setSelected(true); this.$$$loadButtonText$$$(extLeaveradioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.fileextleave")); RenamingFileExtPanel.add(extLeaveradioButton, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); makeLowerCaseRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(makeLowerCaseRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.fileextlower")); RenamingFileExtPanel.add(makeLowerCaseRadioButton, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); makeUpperCaseRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(makeUpperCaseRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "rph.fileextupper")); RenamingFileExtPanel.add(makeUpperCaseRadioButton, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); ButtonGroup buttonGroup; buttonGroup = new ButtonGroup(); buttonGroup.add(suffixDonNotUseradioButton); buttonGroup.add(suffixStringradioButton); buttonGroup.add(suffixDatetimeradioButton); buttonGroup.add(suffixDateradioButton); buttonGroup.add(suffixCameramodelradioButton); buttonGroup.add(suffixOriginalFilenameradioButton); buttonGroup.add(suffixCityNameradioButton); buttonGroup.add(suffixLocationradioButton); buttonGroup.add(suffixISOradioButton); buttonGroup.add(suffixFocalLengthradioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(extLeaveradioButton); buttonGroup.add(makeLowerCaseRadioButton); buttonGroup.add(makeUpperCaseRadioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(prefixDate_timeradioButton); buttonGroup.add(prefixDateradioButton); buttonGroup.add(prefixStringradioButton); buttonGroup.add(prefixCameramodelradioButton); } /** * @noinspection ALL */ private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) { if (currentFont == null) return null; String resultName; if (fontName == null) { resultName = currentFont.getName(); } else { Font testFont = new Font(fontName, Font.PLAIN, 10); if (testFont.canDisplay('a') && testFont.canDisplay('1')) { resultName = fontName; } else { resultName = currentFont.getName(); } } Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize()); boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac"); Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize()); return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadLabelText$$$(JLabel component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setDisplayedMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return rootRenamingPane; } }
60,403
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
SimpleWebView.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/SimpleWebView.java
package org.hvdw.jexiftoolgui.view; import ch.qos.logback.classic.Logger; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import org.hvdw.jexiftoolgui.MyVariables; import org.hvdw.jexiftoolgui.Utils; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.event.HyperlinkListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Locale; public class SimpleWebView extends JDialog { private JButton OKbutton; private JEditorPane webEditorPane; private JScrollPane webScrollPane; private JPanel contentPane; private final HyperlinkListener linkListener = new LinkListener(); private final static Logger logger = (Logger) LoggerFactory.getLogger(SimpleWebView.class); public SimpleWebView() { setContentPane(contentPane); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); contentPane.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); setModal(true); this.setIconImage(Utils.getFrameIcon()); OKbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { dispose(); } }); } public void HTMLView(String title, String message, int vWidth, int vHeight) { String htmlStart = "<html><style>p, body, tr, th, td {font-family: helvetica; } </style><body><center><table border=0 width=" + String.valueOf(vWidth) + "px><tr><td>"; String htmlEnd = "</td></tr></center></body></html>"; String html = htmlStart + message + htmlEnd; webEditorPane.setContentType("text/html"); webEditorPane.setEditable(false); contentPane.setPreferredSize(new Dimension(((int) Math.round(vWidth + (float) (vWidth / 3))), ((int) Math.round(vHeight + (float) (vHeight / 8))))); setTitle(title); webEditorPane.setText(html); webEditorPane.addHyperlinkListener(linkListener); pack(); double x = getParent().getBounds().getCenterX(); double y = getParent().getBounds().getCenterY(); //setLocation((int) x - getWidth() / 2, (int) y - getHeight() / 2); setLocationRelativeTo(null); setVisible(true); } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPane.setPreferredSize(new Dimension(-1, -1)); webScrollPane = new JScrollPane(); contentPane.add(webScrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); webEditorPane = new JEditorPane(); webEditorPane.setBackground(new Color(-855310)); webEditorPane.setContentType("text/html"); webEditorPane.setEditable(false); webEditorPane.setMinimumSize(new Dimension(-1, -1)); webEditorPane.setPreferredSize(new Dimension(-1, -1)); webEditorPane.setText("<html>\n <head>\n \n </head>\n <body>\n </body>\n</html>\n"); webScrollPane.setViewportView(webEditorPane); final JPanel panel1 = new JPanel(); panel1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); OKbutton = new JButton(); OKbutton.setText("OK"); panel1.add(OKbutton); } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPane; } }
4,446
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
CreateUpdatemyLens.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/CreateUpdatemyLens.java
package org.hvdw.jexiftoolgui.view; import ch.qos.logback.classic.Logger; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import org.hvdw.jexiftoolgui.MyVariables; import org.hvdw.jexiftoolgui.model.Lenses; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.table.DefaultTableModel; import java.awt.*; import java.awt.event.*; import java.io.File; import java.lang.reflect.Method; import java.util.List; import java.util.Locale; import java.util.ResourceBundle; public class CreateUpdatemyLens extends JDialog { private JPanel contentPane; private JButton buttonOK; private JButton buttonCancel; private JTextField lensnametextField; private JTextField descriptiontextField; private JScrollPane scrollPane; private JTable lensnametable; private JLabel addLensTopTxt; private String chosenName = ""; private String chosenDescription = ""; private final static Logger logger = (Logger) LoggerFactory.getLogger(CreateUpdatemyLens.class); public CreateUpdatemyLens() { setContentPane(contentPane); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); contentPane.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); setModal(true); getRootPane().setDefaultButton(buttonOK); buttonOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onOK(); } }); buttonCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); lensnametable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); DefaultTableModel model = (DefaultTableModel) lensnametable.getModel(); int selectedRowIndex = lensnametable.getSelectedRow(); lensnametextField.setText(model.getValueAt(selectedRowIndex, 0).toString()); chosenName = model.getValueAt(selectedRowIndex, 0).toString(); } }); } private void onOK() { // add your code here chosenName = lensnametextField.getText(); chosenDescription = descriptiontextField.getText(); dispose(); } private void onCancel() { // add your code here if necessary dispose(); } public String[] showDialog(JPanel rootpanel) { pack(); //setLocationRelativeTo(null); setLocationByPlatform(true); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("createupdatelens.title")); addLensTopTxt.setText("<html>" + ResourceBundle.getBundle("translations/program_strings").getString("addlens.toptxt") + "<br><br></html>"); // Make table readonly lensnametable.setDefaultEditor(Object.class, null); // Get current defined lenses List<File> lensnames = Lenses.loadlensnames(); logger.info("retrieved lensnames: " + lensnames); Lenses.displaylensnames(lensnames, lensnametable); setVisible(true); String[] chosenValues = new String[]{chosenName, chosenDescription}; return chosenValues; } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(15, 15, 15, 15), -1, -1)); contentPane.setPreferredSize(new Dimension(700, 500)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonOK = new JButton(); this.$$$loadButtonText$$$(buttonOK, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.ok")); panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonCancel = new JButton(); this.$$$loadButtonText$$$(buttonCancel, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.cancel")); panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel4 = new JPanel(); panel4.setLayout(new GridLayoutManager(3, 3, new Insets(0, 0, 0, 0), 5, 5)); panel3.add(panel4, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label1 = new JLabel(); this.$$$loadLabelText$$$(label1, this.$$$getMessageFromBundle$$$("translations/program_strings", "sellens.name")); panel4.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lensnametextField = new JTextField(); panel4.add(lensnametextField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(450, -1), null, 0, false)); final JLabel label2 = new JLabel(); this.$$$loadLabelText$$$(label2, this.$$$getMessageFromBundle$$$("translations/program_strings", "sellens.currentlenses")); panel4.add(label2, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); scrollPane = new JScrollPane(); panel4.add(scrollPane, new GridConstraints(2, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); lensnametable = new JTable(); scrollPane.setViewportView(lensnametable); final Spacer spacer2 = new Spacer(); panel4.add(spacer2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); addLensTopTxt = new JLabel(); addLensTopTxt.setText("<html>Please enter a lens name for this config and optionally a description.<br>Or select a row from the table to copy it in the text fields to update an existing lens configuration.<br><br></html>"); panel3.add(addLensTopTxt, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(450, -1), null, 0, false)); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadLabelText$$$(JLabel component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setDisplayedMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPane; } }
12,376
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
CreateMenu.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/CreateMenu.java
package org.hvdw.jexiftoolgui.view; import org.hvdw.jexiftoolgui.controllers.MenuActionListener; import javax.swing.*; import java.awt.event.KeyEvent; import java.util.ResourceBundle; public class CreateMenu { private JMenuItem menuItem; public void CreateMenuBar(JFrame frame, JPanel rootPanel, JSplitPane splitPanel, JMenuBar menuBar, JMenu myMenu, JLabel OutputLabel, JProgressBar progressBar, JComboBox UserCombiscomboBox) { MenuActionListener mal = new MenuActionListener(frame, rootPanel, splitPanel, menuBar, OutputLabel, progressBar, UserCombiscomboBox); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("fmenu.preferences")); myMenu.setMnemonic(KeyEvent.VK_P); menuItem.setActionCommand("Preferences"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("fmenu.exit")); menuItem.setMnemonic(KeyEvent.VK_X); menuItem.setActionCommand("Exit"); menuItem.addActionListener(mal); myMenu.add(menuItem); // Rename photos menu myMenu = new JMenu(ResourceBundle.getBundle("translations/program_strings").getString("menu.renaming")); menuBar.add(myMenu); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("rmenu.renamephotos")); menuItem.setActionCommand("Rename photos"); //myMenu.setMnemonic(KeyEvent.VK_R); menuItem.addActionListener(mal); myMenu.add(menuItem); // metadata menu myMenu = new JMenu(ResourceBundle.getBundle("translations/program_strings").getString("menu.metadata")); myMenu.setMnemonic(KeyEvent.VK_M); menuBar.add(myMenu); //myMenu.addSeparator(); /*menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("mmenu.exportmetadata")); menuItem.setActionCommand("Export metadata"); menuItem.addActionListener(mal); myMenu.add(menuItem); */ //myMenu.add(exportSidecarSubMenu); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("mmenu.copyallmetadatatoxmpformat")); menuItem.setActionCommand("Copy all metadata to xmp format"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("mmenu.removemetadata")); menuItem.setActionCommand("Remove metadata"); menuItem.addActionListener(mal); myMenu.add(menuItem); // Date/time menu myMenu = new JMenu(ResourceBundle.getBundle("translations/program_strings").getString("menu.datetime")); menuBar.add(myMenu); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("dtmenu.shiftdatetime")); menuItem.setActionCommand("Shift Date/time"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("dtmenu.modifydatetime")); menuItem.setActionCommand("Modify Date/time"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("dtmenu.modifyalldatetime")); menuItem.setActionCommand("Modify all dates and times"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("dtmenu.setfiledatetodatetimeoriginal")); menuItem.setActionCommand("Set file date to DateTimeOriginal"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("dtmenu.setmoviedatetocreatedate")); menuItem.setActionCommand("Set movie date to CreateDate"); menuItem.addActionListener(mal); myMenu.add(menuItem); //myMenu.addSeparator(); // Other myMenu = new JMenu(ResourceBundle.getBundle("translations/program_strings").getString("menu.other")); menuBar.add(myMenu); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("omenu.repairjpgs")); menuItem.setActionCommand("Repair JPGs with corrupted metadata"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("omenu.createargfiles")); menuItem.setActionCommand("Create args file(s)"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("omenu.exportallpreviews")); menuItem.setActionCommand("Export all previews/thumbs from selected"); menuItem.addActionListener(mal); myMenu.add(menuItem); // Tools myMenu = new JMenu(ResourceBundle.getBundle("translations/program_strings").getString("menu.tools")); menuBar.add(myMenu); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("tmenu.mdusercombis")); menuItem.setActionCommand("UserMetadata"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("tmenu.deletefavs")); menuItem.setActionCommand("DeleteFavorites"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("tmenu.deletelens")); menuItem.setActionCommand("DeleteLenses"); menuItem.addActionListener(mal); myMenu.add(menuItem); myMenu.addSeparator(); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("tmenu.exiftooldb")); menuItem.setActionCommand("ExiftoolDatabase"); //myMenu.setMnemonic(KeyEvent.VK_R); menuItem.addActionListener(mal); myMenu.add(menuItem); // exiftool database //myMenu = new JMenu("Database"); //menuBar.add(myMenu); //menuItem = new JMenuItem("Query the exiftool groups/tags database"); //menuItem.addActionListener(mal); // this will be a sub menu of the Help menu containing the help dialogs for the several buttons JMenu helpSubMenu = new JMenu(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.helptopicsprogram")); //menuItem.setActionCommand("Remove metadata"); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("subhmenu.editdataexif")); menuItem.setActionCommand("editdataexif"); menuItem.addActionListener(mal); helpSubMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("subhmenu.editdataxmp")); menuItem.setActionCommand("editdataxmp"); menuItem.addActionListener(mal); helpSubMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("subhmenu.editdatagps")); menuItem.setActionCommand("editdatagps"); menuItem.addActionListener(mal); helpSubMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("subhmenu.editdatageotag")); menuItem.setActionCommand("editdatageotag"); menuItem.addActionListener(mal); helpSubMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("subhmenu.editdatagpano")); menuItem.setActionCommand("editdatagpano"); menuItem.addActionListener(mal); helpSubMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("subhmenu.editdatalens")); menuItem.setActionCommand("editdatalens"); menuItem.addActionListener(mal); helpSubMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("subhmenu.copydata")); menuItem.setActionCommand("copydata"); menuItem.addActionListener(mal); helpSubMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("subhmenu.exiftoolcommands")); menuItem.setActionCommand("exiftoolcommands"); menuItem.addActionListener(mal); helpSubMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("subhmenu.exiftooldb")); menuItem.setActionCommand("exiftooldb"); menuItem.addActionListener(mal); helpSubMenu.add(menuItem); helpSubMenu.addSeparator(); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("subhmenu.menurenaminginfo")); menuItem.setActionCommand("menurenaminginfo"); menuItem.addActionListener(mal); helpSubMenu.add(menuItem); // Help menu myMenu = new JMenu(ResourceBundle.getBundle("translations/program_strings").getString("menu.help")); myMenu.setMnemonic(KeyEvent.VK_H); menuBar.add(myMenu); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.jexiftoolguihomepage")); menuItem.setActionCommand("jExifToolGUI homepage"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.exiftoolhomepage")); menuItem.setActionCommand("ExifTool homepage"); menuItem.addActionListener(mal); myMenu.add(menuItem); //menuItem = new JMenuItem("Manual"); //myMenu.add(menuItem); myMenu.addSeparator(); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.onlinemanual")); menuItem.setActionCommand("Online manual"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.onlinemanueles")); menuItem.setActionCommand("onlinemanuales"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.youtube")); menuItem.setActionCommand("Youtube channel"); menuItem.addActionListener(mal); myMenu.add(menuItem); // Here we add the sub menu with help topics myMenu.add(helpSubMenu); myMenu.addSeparator(); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.credits")); menuItem.setActionCommand("Credits"); myMenu.add(menuItem); menuItem.addActionListener(mal); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.donate")); menuItem.setActionCommand("Donate"); myMenu.add(menuItem); menuItem.addActionListener(mal); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.license")); menuItem.setActionCommand("License"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.translate")); menuItem.setActionCommand("Translate"); menuItem.addActionListener(mal); myMenu.add(menuItem); myMenu.addSeparator(); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.sysproginfo")); menuItem.setActionCommand("System/Program info"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.checkfornewversion")); menuItem.setActionCommand("Check for new version"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.changelog")); menuItem.setActionCommand("Changelog"); menuItem.addActionListener(mal); myMenu.add(menuItem); myMenu.addSeparator(); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.aboutexiftool")); menuItem.setActionCommand("About ExifTool"); menuItem.addActionListener(mal); myMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("hmenu.aboutjexiftoolgui")); menuItem.setActionCommand("About jExifToolGUI"); menuItem.addActionListener(mal); myMenu.add(menuItem); // Finally add menubar to the frame frame.setJMenuBar(menuBar); } }
13,550
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
LinkListener.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/LinkListener.java
package org.hvdw.jexiftoolgui.view; import org.hvdw.jexiftoolgui.Application; import org.hvdw.jexiftoolgui.Utils; import org.slf4j.LoggerFactory; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import java.awt.*; import java.io.IOException; import java.net.URI; public class LinkListener implements HyperlinkListener { private final static ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(LinkListener.class); /* * Opens the default browser of the Operating System * and displays the specified URL * This one is a copy of Utils.openBrowser but that could not be used due to public/static */ static void openBrowser(String webUrl) { try { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().browse(URI.create(webUrl)); return; } Application.OS_NAMES os = Utils.getCurrentOsName(); Runtime runtime = Runtime.getRuntime(); switch (os) { case APPLE: runtime.exec("open " + webUrl); return; case LINUX: runtime.exec("xdg-open " + webUrl); return; case MICROSOFT: runtime.exec("explorer " + webUrl); return; } } catch (IOException | IllegalArgumentException e) { logger.error("Could not open browser", e); } } @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { openBrowser(e.getURL().toString()); } catch (Exception ioe) { logger.info("Hyperlink error: {}", e.toString()); } } } }
1,906
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
ExifToolReferencePanel.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/ExifToolReferencePanel.java
package org.hvdw.jexiftoolgui.view; import org.hvdw.jexiftoolgui.Utils; import org.hvdw.jexiftoolgui.facades.IPreferencesFacade; import org.hvdw.jexiftoolgui.facades.SystemPropertyFacade; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.table.DefaultTableModel; import static org.hvdw.jexiftoolgui.facades.SystemPropertyFacade.SystemPropertyKey.LINE_SEPARATOR; public class ExifToolReferencePanel { private static IPreferencesFacade prefs = IPreferencesFacade.defaultInstance; private final static ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(ExifToolReferencePanel.class); private Favorites Favs = new Favorites(); static String convertWritable(String writable) { // For some stupid reason SQLJDBC always changes "Yes" or "true" to 1, and "false" or "No" to null. // So here we have to change it back if ("1".equals(writable)) { return "Yes"; } else { return "No"; } } public static void displayQueryResults (String queryResult, JTable DBResultsTable) { DefaultTableModel model = (DefaultTableModel) DBResultsTable.getModel(); model.setColumnIdentifiers(new String[]{"Group", "Tagname", "TagType","Writable"}); DBResultsTable.getColumnModel().getColumn(0).setPreferredWidth(100); DBResultsTable.getColumnModel().getColumn(1).setPreferredWidth(260); DBResultsTable.getColumnModel().getColumn(2).setPreferredWidth(240); DBResultsTable.getColumnModel().getColumn(3).setPreferredWidth(100); model.setRowCount(0); Object[] row = new Object[1]; if (queryResult.length() > 0) { String[] lines = queryResult.split(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR)); for (String line : lines) { //String[] cells = lines[i].split(":", 2); // Only split on first : as some tags also contain (multiple) : String[] cells = line.split("\\t", 4); model.addRow(new Object[]{cells[0], cells[1], cells[2], convertWritable(cells[3])}); } } } public static void displayOwnQueryResults (String sql, String queryResult, JTable DBResultsTable) { DefaultTableModel model = (DefaultTableModel) DBResultsTable.getModel(); // get the fields that are being queried on and immediately remove spaces for our table header and number of columns String queryFields = Utils.stringBetween(sql.toLowerCase(), "select", "from").replaceAll("\\s+",""); // regex "\s" is space, extra \ to escape the first \; String[] headerFields = queryFields.split(","); model.setColumnIdentifiers(headerFields); model.setRowCount(0); Object[] row = new Object[1]; if (queryResult.length() > 0) { String[] lines = queryResult.split(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR)); for (String line : lines) { String[] cells = line.split("\\t"); model.addRow(cells); } } } }
3,132
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
CompareImagesWindow.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/CompareImagesWindow.java
package org.hvdw.jexiftoolgui.view; import ch.qos.logback.classic.Logger; import org.hvdw.jexiftoolgui.ExportToPDF; import org.hvdw.jexiftoolgui.MyVariables; import org.hvdw.jexiftoolgui.ProgramTexts; import org.hvdw.jexiftoolgui.Utils; import org.hvdw.jexiftoolgui.controllers.ImageFunctions; import org.hvdw.jexiftoolgui.metadata.ExportMetadata; import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.ResourceBundle; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import static org.slf4j.LoggerFactory.getLogger; public class CompareImagesWindow { private final static Logger logger = (Logger) getLogger(CompareImagesWindow.class); public static void Initialize(List<String[]> tableMetadata, List<String[]> allMetadata) { ImageIcon icon = null; int[] selectedIndices = MyVariables.getSelectedFilenamesIndices(); File[] files = MyVariables.getLoadedFiles(); // Define the frame, the ScrollPanel with the table, the buttonpanel with the close button JFrame frame = new JFrame(); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception weTried) { logger.error("Could not start GUI.", weTried); } Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); frame.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); frame.setTitle(ResourceBundle.getBundle("translations/program_strings").getString("cmpimg.comparetitle")); frame.setIconImage(Utils.getFrameIcon()); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel ciwRootPanel = new JPanel(new BorderLayout()); //JPanel ciwRootPanel = new JPanel(new GridLayout(2,1)); //////////////// JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); JButton ciwCloseButton = new JButton(); JProgressBar progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setSize(200, 30); progressBar.setVisible(false); JLabel outputLabel = new JLabel(); outputLabel.setText(""); //outputLabel.setVisible(false); ciwCloseButton.setText(ResourceBundle.getBundle("translations/program_strings").getString("dlg.close")); ciwCloseButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.dispose(); } }); JButton ciwExportToPDFbutton = new JButton(); ciwExportToPDFbutton.setText(ResourceBundle.getBundle("translations/program_strings").getString("cmpimg.exptopdf")); ciwExportToPDFbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { Executor executor = Executors.newSingleThreadExecutor(); executor.execute(new Runnable() { @Override public void run() { ExportToPDF.WriteToPDF(allMetadata); progressBar.setVisible(false); outputLabel.setText(""); JOptionPane.showMessageDialog(ciwRootPanel, String.format(ProgramTexts.HTML, 400, (ResourceBundle.getBundle("translations/program_strings").getString("exppdf.pdfscreated") + ":<br><br>" + MyVariables.getpdfDocs()), ResourceBundle.getBundle("translations/program_strings").getString("exppdf.pdfscreated"), JOptionPane.INFORMATION_MESSAGE)); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { progressBar.setVisible(true); outputLabel.setText(ResourceBundle.getBundle("translations/program_strings").getString("pt.exppdf")); } }); } }); JButton ciwExpToCSVbutton = new JButton(); ciwExpToCSVbutton.setText(ResourceBundle.getBundle("translations/program_strings").getString("cmpimg.exptocsv")); ciwExpToCSVbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { CsvFromCompareImages CVCI = new CsvFromCompareImages(); String selection = CVCI.showDialog(ciwRootPanel); if ("onecsvperimage".equals(selection)) { ExportMetadata.WriteCSVFromImgComp(allMetadata, ciwRootPanel, selection); // Below option pane als uses the MyVariables.getpdfDocs() variable as we also use that for csvdocs JOptionPane.showMessageDialog(ciwRootPanel, String.format(ProgramTexts.HTML, 400, (ResourceBundle.getBundle("translations/program_strings").getString("cmpimg.csvscreated") + ":<br><br>" + MyVariables.getpdfDocs()), ResourceBundle.getBundle("translations/program_strings").getString("cmpimg.csvscreated"), JOptionPane.INFORMATION_MESSAGE)); } else if ("onecombinedcsv".equals(selection)){ ExportMetadata.WriteCSVFromImgComp(tableMetadata, ciwRootPanel, selection); // Below option pane als uses the MyVariables.getpdfDocs() variable as we also use that for csvdocs JOptionPane.showMessageDialog(ciwRootPanel, String.format(ProgramTexts.HTML, 400, (ResourceBundle.getBundle("translations/program_strings").getString("cmpimg.csvscreated") + ":<br><br>" + MyVariables.getpdfDocs()), ResourceBundle.getBundle("translations/program_strings").getString("cmpimg.csvscreated"), JOptionPane.INFORMATION_MESSAGE)); } //JOptionPane.showMessageDialog(ciwRootPanel, selection, selection, JOptionPane.INFORMATION_MESSAGE); } }); buttonPanel.add(ciwExpToCSVbutton); buttonPanel.add(ciwExportToPDFbutton); buttonPanel.add(ciwCloseButton); buttonPanel.add(progressBar); buttonPanel.add(outputLabel); //////////////// //Create the table header for both tables List<String> theader = new ArrayList<String>(); theader.add(ResourceBundle.getBundle("translations/program_strings").getString("vdtab.tablegroup")); theader.add(ResourceBundle.getBundle("translations/program_strings").getString("vdtab.tabletag")); for (int index : selectedIndices) { String filename = files[index].getName(); theader.add("<html>" + (files[index].getName()) + "</html>"); } String[] tableheader = theader.stream().toArray(String[]::new); // now we create the metadatatable //JTable ciwTable = new JTable(); JTable ciwTable = new JTable(){ @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component component = super.prepareRenderer(renderer, row, column); int rendererWidth = component.getPreferredSize().width; TableColumn tableColumn = getColumnModel().getColumn(column); tableColumn.setPreferredWidth(Math.max(rendererWidth + getIntercellSpacing().width, tableColumn.getPreferredWidth())); return component; } }; ciwTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); DefaultTableModel model = (DefaultTableModel) ciwTable.getModel(); ciwTable.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() { protected void setValue(Object value){ if (value instanceof ImageIcon) { setIcon((ImageIcon) value); setHorizontalAlignment(JLabel.CENTER); setText(""); } else { setIcon(null); setHorizontalTextPosition(JLabel.LEFT); setHorizontalAlignment(JLabel.LEFT); super.setValue("<html>" + value + "</html>"); } } }); model.setRowCount(0); model.fireTableDataChanged(); ciwTable.clearSelection(); ciwTable.setCellSelectionEnabled(false); // Below line makes table uneditable (read-only) ciwTable.setDefaultEditor(Object.class, null); model.setColumnIdentifiers(tableheader); ciwTable.getColumnModel().getColumn(0).setPreferredWidth(150); ciwTable.getColumnModel().getColumn(1).setPreferredWidth(250); int counter = 2; for (int index: selectedIndices) { ciwTable.getColumnModel().getColumn(counter).setPreferredWidth(375); counter++; } // Add thumbnails for files to table Object[] ImgFilenameRow = new Object[(selectedIndices.length + 2)]; ImgFilenameRow[0] = ""; ImgFilenameRow[1] = ""; counter = 2; for (int index : selectedIndices) { File file = files[index]; icon = ImageFunctions.analyzeImageAndCreateIcon(file); //ImgFilenameRow[(index + 2)] = icon; ImgFilenameRow[counter] = icon; counter++; } ciwTable.setRowHeight(0,150); model.addRow(ImgFilenameRow); // Add the metadata to the table for (String[] metadata : tableMetadata) { model.addRow(metadata); } ciwTable.setRowHeight(0,150); //ciwTable.repaint(); JScrollPane ciwScrollPanel = new JScrollPane(ciwTable); // Add the panels to the big container panel Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int TableWidth = 150 + 250 + (selectedIndices.length * 375); ciwTable.setSize(TableWidth, screenSize.height-100); ciwTable.repaint(); ciwRootPanel.add(ciwScrollPanel, BorderLayout.CENTER); ciwRootPanel.add(buttonPanel, BorderLayout.PAGE_END); MyVariables.setScreenWidth(screenSize.width); MyVariables.setScreenHeight(screenSize.height); frame.add(ciwRootPanel); if ((screenSize.width - 50) > (TableWidth)) { MyVariables.setScreenWidth(TableWidth); frame.setSize(TableWidth, screenSize.height-50); } else { frame.setSize(screenSize.width, screenSize.height-50); } //frame.pack(); frame.setVisible(true); } }
10,980
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
CsvFromCompareImages.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/CsvFromCompareImages.java
package org.hvdw.jexiftoolgui.view; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import org.hvdw.jexiftoolgui.MyVariables; import javax.swing.*; import javax.swing.border.TitledBorder; import java.awt.*; import java.awt.event.*; import java.lang.reflect.Method; import java.util.Locale; import java.util.ResourceBundle; public class CsvFromCompareImages extends JDialog { private JPanel contentPane; private JButton buttonOK; private JButton buttonCancel; private JRadioButton csvPerImageRadioBtn; private JRadioButton csvCombinedRadioBtn; String selection = "cancel"; public CsvFromCompareImages() { this.selection = selection; setContentPane(contentPane); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); contentPane.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); setModal(true); getRootPane().setDefaultButton(buttonOK); buttonOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onOK(); } }); buttonCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); } private void onOK() { // add your code here if (csvPerImageRadioBtn.isSelected()) { selection = "onecsvperimage"; } else { selection = "onecombinedcsv"; } dispose(); } private void onCancel() { // add your code here if necessary selection = "cancel"; dispose(); } public String showDialog(JPanel ciwRootPanel) { //CsvFromCompareImages dialog = new CsvFromCompareImages(); pack(); setLocationByPlatform(true); setVisible(true); return selection; } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonOK = new JButton(); this.$$$loadButtonText$$$(buttonOK, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.export")); panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonCancel = new JButton(); this.$$$loadButtonText$$$(buttonCancel, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.cancel")); panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel4 = new JPanel(); panel4.setLayout(new GridLayoutManager(2, 1, new Insets(0, 10, 0, 10), -1, -1)); panel3.add(panel4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel4.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); csvPerImageRadioBtn = new JRadioButton(); csvPerImageRadioBtn.setSelected(true); this.$$$loadButtonText$$$(csvPerImageRadioBtn, this.$$$getMessageFromBundle$$$("translations/program_strings", "cmpimg.rbtnfilepimg")); panel4.add(csvPerImageRadioBtn, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label1 = new JLabel(); label1.setText("<html><b>Example:</b><br>\"ExifIFD\",\"Exposure Time\",\"1/60\"<br> \"ExifIFD\",\"F Number\",\"3.5\"<br> \"ExifIFD\",\"Exposure Program\",\"Program AE\"<br> \"ExifIFD\",\"ISO\",\"500\""); panel4.add(label1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel5 = new JPanel(); panel5.setLayout(new GridLayoutManager(2, 2, new Insets(0, 10, 0, 10), -1, -1)); panel3.add(panel5, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel5.setBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JLabel label2 = new JLabel(); label2.setText("<html><b>Example:</b><br>\"Category\",\"Tag name\",\"image 1\",\"image 2\",\"image 3\",\"image 4\",\"image 5\"<br> \"ExifIFD\",\"Exposure Time\",\"1/160\",\"1/250\",\"1/400\",\"1/60\",\"1/320\"<br> \"GPS\",\"GPS Altitude\",\"51 m\",\"48.343 m\",\"77.5 m\",\"77 m\",\"76.4 m\"<br> \"XMP-exif\",\"Exif Image Height\",\"2248\",\"2048\",\"4000\",\"2248\",\"4096\""); panel5.add(label2, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); csvCombinedRadioBtn = new JRadioButton(); this.$$$loadButtonText$$$(csvCombinedRadioBtn, this.$$$getMessageFromBundle$$$("translations/program_strings", "cmpimg.rbtncombined")); panel5.add(csvCombinedRadioBtn, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); ButtonGroup buttonGroup; buttonGroup = new ButtonGroup(); buttonGroup.add(csvPerImageRadioBtn); buttonGroup.add(csvCombinedRadioBtn); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPane; } }
10,775
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
FoundMetaData.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/FoundMetaData.java
package org.hvdw.jexiftoolgui.view; import ch.qos.logback.classic.Logger; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import org.hvdw.jexiftoolgui.MyVariables; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.table.DefaultTableModel; import java.awt.*; import java.awt.event.*; import java.io.File; import java.lang.reflect.Method; import java.util.*; import java.util.List; import java.util.stream.Collectors; public class FoundMetaData extends JDialog { private JPanel contentPane; private JScrollPane scrollPane; private JTable foundmetadatatable; private JButton OKbutton; private JButton Cancelbutton; private JLabel foundMetadataLabel; private JButton LoadResultImagesbutton; private JPanel jp = null; private String metadata = ""; private String folderPath = ""; private List<String> imageNames = new ArrayList<>(); private File[] imageFileNames = null; private final static Logger logger = (Logger) LoggerFactory.getLogger(FoundMetaData.class); public FoundMetaData() { setContentPane(contentPane); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); contentPane.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); setModal(true); getRootPane().setDefaultButton(OKbutton); OKbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { logger.debug("User closes the \"display found metadata\" panel"); setVisible(false); dispose(); } }); Cancelbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { setVisible(false); dispose(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); // mouse table listener foundmetadatatable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); DefaultTableModel model = (DefaultTableModel) foundmetadatatable.getModel(); int selectedRowIndex = foundmetadatatable.getSelectedRow(); MyVariables.setselectedLensConfig(model.getValueAt(selectedRowIndex, 1).toString()); String img_name = model.getValueAt(selectedRowIndex, 1).toString(); } }); LoadResultImagesbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { List<String> uniqueImageNames = imageNames.stream().distinct().collect(Collectors.toList()); logger.debug("\nunieke bestanden {}", uniqueImageNames.toString()); File[] uniqueFileNames = {}; ArrayList<File> uniqueFileNamesList = new ArrayList<>(); for (String fileName : uniqueImageNames) { logger.debug("found filename for reload {}", fileName); uniqueFileNamesList.add(new File(fileName)); } uniqueFileNames = uniqueFileNamesList.toArray(uniqueFileNames); MyVariables.setLoadedFiles(uniqueFileNames); MyVariables.setreloadImagesFromSearchResult(true); setVisible(false); dispose(); } }); } private void displayfoundmetadata(List<String> foundMetadata) { //Get overall folder name File totalpath = new File(MyVariables.getSelectedImagePath()); folderPath = (totalpath.getParent()).toString(); logger.info("folder path: {}", folderPath); // And now the table DefaultTableModel model = (DefaultTableModel) foundmetadatatable.getModel(); model.setColumnIdentifiers(new String[]{ResourceBundle.getBundle("translations/program_strings").getString("smd.imgname"), ResourceBundle.getBundle("translations/program_strings").getString("smd.keyorvalue"), ResourceBundle.getBundle("translations/program_strings").getString("smd.foundstring")}); foundmetadatatable.getColumnModel().getColumn(0).setPreferredWidth(250); foundmetadatatable.getColumnModel().getColumn(1).setPreferredWidth(70); foundmetadatatable.getColumnModel().getColumn(2).setPreferredWidth(500); model.setRowCount(0); String secondcolumn = ""; String thirdcolumn = ""; foundMetadataLabel.setText(ResourceBundle.getBundle("translations/program_strings").getString("smd.foundmetadata") + " \"" + MyVariables.getSearchPhrase() + "\"."); Object[] row = new Object[1]; for (String metadata : foundMetadata) { logger.debug("the found metadata per line {}", metadata); String[] cells = metadata.split("\\t"); List<String> cellsList = new ArrayList<String>(); //List<String> cellsList = Arrays.asList(cells); // A direct arrays.aslist makes the list also immutable cellsList.addAll(Arrays.asList(cells)); if (cellsList.size() < 4) { cellsList.add("Error in tag or value"); } else if (cellsList.size() < 3) { cellsList.add("Error in tag or value"); cellsList.add("Error in tag or value"); } if ("value-key".equals(cellsList.get(1))) { secondcolumn = ResourceBundle.getBundle("translations/program_strings").getString("smd.value"); thirdcolumn = cellsList.get(2) + " (" + ResourceBundle.getBundle("translations/program_strings").getString("smd.key") + ": " + cellsList.get(3) + ")"; } else { secondcolumn = ResourceBundle.getBundle("translations/program_strings").getString("smd.key"); thirdcolumn = cellsList.get(2) + " (" + ResourceBundle.getBundle("translations/program_strings").getString("smd.value") + ": " + cellsList.get(3) + ")"; } model.addRow(new Object[]{cellsList.get(0), secondcolumn, thirdcolumn}); imageNames.add(cellsList.get(0)); } } private void onCancel() { // add your code here if necessary setVisible(false); dispose(); } public String showDialog(JPanel rootpanel, List<String> foundMetadata) { pack(); //setLocationRelativeTo(null); setLocationByPlatform(true); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("smd.foundmetadatatitle")); // Make table readonly foundmetadatatable.setDefaultEditor(Object.class, null); displayfoundmetadata(foundMetadata); setVisible(true); return metadata; } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(1, 1, new Insets(15, 15, 15, 15), -1, -1)); contentPane.setPreferredSize(new Dimension(1024, 600)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), 5, 5)); panel1.add(panel2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); foundMetadataLabel = new JLabel(); this.$$$loadLabelText$$$(foundMetadataLabel, this.$$$getMessageFromBundle$$$("translations/program_strings", "smd.foundmetadata")); panel2.add(foundMetadataLabel, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); scrollPane = new JScrollPane(); panel2.add(scrollPane, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); foundmetadatatable = new JTable(); scrollPane.setViewportView(foundmetadatatable); final JPanel panel3 = new JPanel(); panel3.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5)); panel1.add(panel3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); LoadResultImagesbutton = new JButton(); this.$$$loadButtonText$$$(LoadResultImagesbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "smd.reloadimages")); panel3.add(LoadResultImagesbutton); OKbutton = new JButton(); this.$$$loadButtonText$$$(OKbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.ok")); panel3.add(OKbutton); Cancelbutton = new JButton(); this.$$$loadButtonText$$$(Cancelbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.cancel")); Cancelbutton.setVisible(false); panel3.add(Cancelbutton); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadLabelText$$$(JLabel component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setDisplayedMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPane; } }
13,319
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
ExportFromCompareImagesView.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/ExportFromCompareImagesView.java
package org.hvdw.jexiftoolgui.view; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import org.hvdw.jexiftoolgui.MyVariables; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.lang.reflect.Method; import java.util.Locale; import java.util.ResourceBundle; public class ExportFromCompareImagesView extends JDialog { private JPanel contentPane; private JButton buttonOK; private JButton buttonCancel; private JRadioButton txtRadioButton; private JRadioButton tabRadioButton; private JRadioButton xmlRadioButton; private JRadioButton htmlRadioButton; private JRadioButton xmpRadioButton; private JRadioButton csvRadioButton; private JCheckBox GenExpuseMetadataTagLanguageCheckBoxport; private JRadioButton pdfRadioButton; public ExportFromCompareImagesView() { setContentPane(contentPane); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); contentPane.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); setModal(true); getRootPane().setDefaultButton(buttonOK); buttonOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onOK(); } }); buttonCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); } private void onOK() { dispose(); } private void onCancel() { // add your code here if necessary dispose(); } public static void main(String[] args) { ExportFromCompareImagesView dialog = new ExportFromCompareImagesView(); dialog.pack(); dialog.setVisible(true); System.exit(0); } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonOK = new JButton(); this.$$$loadButtonText$$$(buttonOK, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.export")); panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonCancel = new JButton(); this.$$$loadButtonText$$$(buttonCancel, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.cancel")); panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel4 = new JPanel(); panel4.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); panel3.add(panel4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label1 = new JLabel(); this.$$$loadLabelText$$$(label1, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.exportto")); panel4.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); panel4.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel5 = new JPanel(); panel5.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel4.add(panel5, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); txtRadioButton = new JRadioButton(); txtRadioButton.setSelected(true); this.$$$loadButtonText$$$(txtRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.txt")); panel5.add(txtRadioButton); tabRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(tabRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.tab")); panel5.add(tabRadioButton); xmlRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(xmlRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.xml")); panel5.add(xmlRadioButton); htmlRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(htmlRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.html")); panel5.add(htmlRadioButton); xmpRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(xmpRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.xmp")); xmpRadioButton.setVisible(false); panel5.add(xmpRadioButton); csvRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(csvRadioButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.csv")); panel5.add(csvRadioButton); pdfRadioButton = new JRadioButton(); pdfRadioButton.setText("pdf"); panel5.add(pdfRadioButton); GenExpuseMetadataTagLanguageCheckBoxport = new JCheckBox(); GenExpuseMetadataTagLanguageCheckBoxport.setSelected(true); this.$$$loadButtonText$$$(GenExpuseMetadataTagLanguageCheckBoxport, this.$$$getMessageFromBundle$$$("translations/program_strings", "emd.uselang")); panel3.add(GenExpuseMetadataTagLanguageCheckBoxport, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); ButtonGroup buttonGroup; buttonGroup = new ButtonGroup(); buttonGroup.add(txtRadioButton); buttonGroup.add(tabRadioButton); buttonGroup.add(xmlRadioButton); buttonGroup.add(htmlRadioButton); buttonGroup.add(csvRadioButton); buttonGroup.add(pdfRadioButton); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadLabelText$$$(JLabel component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setDisplayedMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPane; } }
11,958
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
WebPageInPanel.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/WebPageInPanel.java
package org.hvdw.jexiftoolgui.view; import org.hvdw.jexiftoolgui.MyVariables; import org.hvdw.jexiftoolgui.Utils; import java.awt.*; import java.net.URL; import java.util.Locale; import javax.swing.*; import javax.swing.event.HyperlinkListener; public class WebPageInPanel extends JFrame { private final HyperlinkListener pageListener = new LinkListener(); public void WebPageInPanel(JPanel rootPanel, String url, int panelWidth, int panelHeight) { JFrame webFrame = new JFrame(); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); webFrame.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); this.setIconImage(Utils.getFrameIcon()); //setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); JScrollPane sp=new JScrollPane(); //sp.setPreferredSize(new Dimension(panelWidth, panelHeight)); JEditorPane editorPane = new JEditorPane(); editorPane.setEditable(false); editorPane.addHyperlinkListener(pageListener); editorPane.setPreferredSize(new Dimension(panelWidth, panelHeight)); sp.setViewportView(editorPane); add(sp); try { editorPane.setPage(new URL(url)); } catch (Exception ex) {ex.printStackTrace();} webFrame.add(editorPane); // Position to screen center. Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize(); webFrame.setLocation((int) (screen_size.getWidth() - getWidth()) / 2, (int) (screen_size.getHeight() - getHeight()) / 2); webFrame.pack(); webFrame.setVisible(true); } }
1,689
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
MetadataUserCombinations.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/MetadataUserCombinations.java
package org.hvdw.jexiftoolgui.view; import ch.qos.logback.classic.Logger; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.opencsv.CSVReader; import org.hvdw.jexiftoolgui.MyVariables; import org.hvdw.jexiftoolgui.ProgramTexts; import org.hvdw.jexiftoolgui.TablePasteAdapter; import org.hvdw.jexiftoolgui.Utils; import org.hvdw.jexiftoolgui.controllers.SQLiteJDBC; import org.hvdw.jexiftoolgui.controllers.StandardFileIO; import org.hvdw.jexiftoolgui.model.SQLiteModel; import org.hvdw.jexiftoolgui.facades.SystemPropertyFacade; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.TransferHandler; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.table.DefaultTableModel; import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Reader; import java.lang.reflect.Method; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; import java.util.ArrayList; import java.util.List; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import static org.hvdw.jexiftoolgui.facades.SystemPropertyFacade.SystemPropertyKey.LINE_SEPARATOR; import static org.hvdw.jexiftoolgui.facades.SystemPropertyFacade.SystemPropertyKey.USER_HOME; /** * Original @author Dennis Damico * Heavily modified by Harry van der Wolf */ public class MetadataUserCombinations extends JDialog implements TableModelListener { private final static Logger logger = (Logger) LoggerFactory.getLogger(Utils.class); // The graphic components for the MetadataViewPanel.form private JScrollPane aScrollPanel; private JTable metadataTable; private JButton saveasButton; private JButton saveButton; private JButton helpButton; private JPanel metadatapanel; private JPanel buttonpanel; private JComboBox customSetcomboBox; private JButton closeButton; private JLabel lblCurDispUsercombi; private JLabel lblConfigFile; private JButton deleteButton; private JButton exportButton; private JButton importButton; private JPanel rootpanel; JPanel myPanel = new JPanel(); // we need this for our dialog /** * Object to enable paste into the table. */ private static TablePasteAdapter myPasteHandler = null; /** * Is object initialization complete? */ private boolean initialized = false; private JPopupMenu myPopupMenu = new JPopupMenu(); /** * Create the on-screen Metadata table. */ public MetadataUserCombinations() { setContentPane(metadatapanel); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); metadatapanel.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); setModal(true); setModalityType(ModalityType.DOCUMENT_MODAL); getRootPane().setDefaultButton(saveasButton); this.setIconImage(Utils.getFrameIcon()); // Button listeners saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { // First check whether we have data String haveData = haveTableData(); if ("complete".equals(haveData)) { String[] name_writetype = {"", "", "", ""}; String setName = customSetcomboBox.getSelectedItem().toString(); if (setName.isEmpty()) { // We never saved anything or did not select anything name_writetype = getSetName(); if (!name_writetype[0].isEmpty()) { // We have a name saveMetadata(name_writetype[0], name_writetype[1], name_writetype[2]); } // If not: do nothing } else { // we have a setname and simply overwrite saveMetadata(setName, name_writetype[1], "update"); } } // if incomplete (or empty): do nothing } }); saveasButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { // First check whether we have data String haveData = haveTableData(); if ("complete".equals(haveData)) { String[] name_writetype = getSetName(); if (!"".equals(name_writetype[0])) { saveMetadata(name_writetype[0], name_writetype[1], name_writetype[2]); if (!name_writetype[3].equals("")) { logger.info("filename {} pad {}", name_writetype[1], name_writetype[3]); String copyresult = StandardFileIO.CopyCustomConfigFile(name_writetype[1], name_writetype[3]); if (!copyresult.startsWith("successfully copied")) { JOptionPane.showMessageDialog(metadatapanel, String.format(ProgramTexts.HTML, 200, "Copying your custom configuration file failed"), "Copy configfile failed", JOptionPane.ERROR_MESSAGE); } } } }// if incomplete (or empty): do nothing } }); helpButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { logger.debug("button helpbutton in MatadataUserCombinations class pressed"); //Utils.openBrowser(ProgramTexts.ProjectWebSite + "/manual/jexiftoolgui_usercombis.html"); Utils.openBrowser(ProgramTexts.ProjectWebSite + "/manual/index.html#userdefinedmetadatacombinations"); } }); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { dispose(); } }); customSetcomboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { fillTable(""); } }); deleteButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { String setName = customSetcomboBox.getSelectedItem().toString(); String[] options = {ResourceBundle.getBundle("translations/program_strings").getString("dlg.cancel"), ResourceBundle.getBundle("translations/program_strings").getString("dlg.continue")}; int choice = JOptionPane.showOptionDialog(metadatapanel, String.format(ProgramTexts.HTML, 200, ResourceBundle.getBundle("translations/program_strings").getString("mduc.deltext") + "<br><br><b>" + setName + "</b>"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.deltitle"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (choice == 1) { //Yes, Continue String sql = "delete from CustomMetadatasetLines where customset_name=\"" + setName.trim() + "\""; logger.debug(sql); String queryresult = SQLiteJDBC.insertUpdateQuery(sql, "disk"); sql = "delete from CustomMetadataset where customset_name=\"" + setName.trim() + "\""; logger.debug(sql); queryresult = SQLiteJDBC.insertUpdateQuery(sql, "disk"); // Now update combobox and refresh screen loadCurrentSets("fill_combo"); fillTable("start"); lblCurDispUsercombi.setText(ResourceBundle.getBundle("translations/program_strings").getString("mduc.curdispcombi")); lblConfigFile.setText(ResourceBundle.getBundle("translations/program_strings").getString("mduc.lblconffile")); } } }); exportButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { boolean configFile = false; String configFileName = ""; String csvFileName = ""; String setName = customSetcomboBox.getSelectedItem().toString(); if (!(setName == null) && !("".equals(setName))) { logger.debug("setName selected for export: {}", setName); String sql = "select customset_name, rowcount, screen_label, tag, default_value from CustomMetadatasetLines where customset_name=\"" + setName.trim() + "\" order by rowcount"; logger.debug(sql); String queryResult = SQLiteJDBC.generalQuery(sql, "disk"); if (queryResult.length() > 0) { String[] lines = queryResult.split(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR)); logger.debug("rows selected for export:"); String userHome = SystemPropertyFacade.getPropertyByKey(USER_HOME); //File myObj = new File(userHome + File.separator + setName.trim() + ".csv"); try { FileWriter csvWriter = new FileWriter(userHome + File.separator + setName.trim() + ".csv"); csvFileName = userHome + File.separator + setName.trim() + ".csv"; csvWriter.write("customset_name\trowcount\tscreen_label\ttag\tdefault_value\n"); for (String line : lines) { logger.debug(line); //String[] cells = line.split("\\t", 5); csvWriter.write(line + "\n"); } csvWriter.close(); } catch (IOException e) { e.printStackTrace(); logger.error(e.toString()); } } // Now check if we have a config file sql = "select customset_name, custom_config from custommetadataset where customset_name=\"" + setName.trim() + "\""; logger.debug(sql); queryResult = SQLiteJDBC.generalQuery(sql, "disk"); if (queryResult.length() > 0) { String[] lines = queryResult.split(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR)); String[] fields = lines[0].split("\\t", 3); if (!("".equals(fields[1]))) { configFile = true; configFileName = fields[1].trim(); String copyresult = StandardFileIO.ExportCustomConfigFile(configFileName); } } String expTxt = ResourceBundle.getBundle("translations/program_strings").getString("mduc.exptext") + ": " + csvFileName; if (configFile) { String userHome = SystemPropertyFacade.getPropertyByKey(USER_HOME); expTxt += "<br><br>" + ResourceBundle.getBundle("translations/program_strings").getString("mduc.exptextconfig") + ": " + userHome + File.separator + configFileName; } JOptionPane.showMessageDialog(metadatapanel, String.format(ProgramTexts.HTML, 600, expTxt), ResourceBundle.getBundle("translations/program_strings").getString("mduc.exptitle"), JOptionPane.INFORMATION_MESSAGE); } } }); importButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { //String setName = customSetcomboBox.getSelectedItem().toString(); List<String[]> csvrecords = null; String csvFile = SelectCSVFile(metadatapanel); Path csvPathFile = Paths.get(csvFile); String csvPath = csvPathFile.getParent().toString(); String csvF = csvPathFile.getFileName().toString(); logger.info("selected csv file: {}", csvFile); if (!(csvFile == null) || ("".equals(csvFile))) { try { csvrecords = ReadCSVFile(csvFile); } catch (Exception e) { e.printStackTrace(); logger.error("error importing custommetadataset csv file {}", e.toString()); } } // test /*for (String[] record : csvrecords) { logger.info("record {}", Arrays.toString(record)); }*/ String strBaseFileName = csvF.substring(0, csvF.lastIndexOf(".")); File cfgFile = new File(csvPath + File.separator + strBaseFileName + ".cfg"); File configFile = new File(csvPath + File.separator + strBaseFileName + ".config"); if (cfgFile.exists()) { StandardFileIO.ImportCustomConfigFile(cfgFile.toString()); } else if (configFile.exists()) { StandardFileIO.ImportCustomConfigFile(configFile.toString()); } } }); } /* / Check if we have rows in our table, and if so: do table cells screen_label and tag contain data / returns haveData: being no data (no rows), empty (1-x empty rows), incomplete (some rows missing screen_label and/or tag), complete / sets MyVariables.settableRowsCells */ private String haveTableData() { String haveData = ""; DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel())); List<String> cells = new ArrayList<String>(); List<List> tableRowsCells = new ArrayList<List>(); if ((model.getRowCount() == 0)) { haveData = "no data"; } else { int incomplete_counter = 0; for (int count = 0; count < model.getRowCount(); count++) { cells = new ArrayList<String>(); cells.add(model.getValueAt(count, 0).toString()); cells.add(model.getValueAt(count, 1).toString()); cells.add(model.getValueAt(count, 2).toString()); if ((!cells.get(0).isEmpty()) && (!cells.get(1).isEmpty())) { tableRowsCells.add(cells); } else if ((!cells.get(0).isEmpty()) && (cells.get(1).isEmpty()) || (cells.get(0).isEmpty()) && (!cells.get(1).isEmpty())) { incomplete_counter += 1; } if (incomplete_counter == 0) { haveData = "complete"; } else if (incomplete_counter <= model.getColumnCount()) { haveData = "incomplete"; /*} else if (incomplete_counter == model.getRowCount()) { haveData = "empty"; */ } logger.trace("haveData: {}, incomplete_counter: {}", haveData, incomplete_counter); if ("complete".equals(haveData)) { MyVariables.settableRowsCells(tableRowsCells); } else if ("incomplete".equals(haveData)) { JOptionPane.showMessageDialog(rootpanel, ResourceBundle.getBundle("translations/program_strings").getString("mduc.incompletetext"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.incompletetitle"), JOptionPane.ERROR_MESSAGE); } //logger.info("row {} data: {}, {}, {}", String.valueOf(count), model.getValueAt(count, 0).toString(), model.getValueAt(count, 1).toString(), model.getValueAt(count, 2).toString()); } } return haveData; } /* / Get the config file if a user needs that */ public String CustomconfigFile(JPanel myComponent, JLabel custom_config_field) { String startFolder = StandardFileIO.getFolderPathToOpenBasedOnPreferences(); final JFileChooser chooser = new JFileChooser(startFolder); chooser.setMultiSelectionEnabled(false); chooser.setDialogTitle(ResourceBundle.getBundle("translations/program_strings").getString("mduc.locconfigfile")); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int status = chooser.showOpenDialog(myComponent); if (status == JFileChooser.APPROVE_OPTION) { String selectedCustomconfigFile = chooser.getSelectedFile().getPath(); custom_config_field.setVisible(true); return selectedCustomconfigFile; } else { return ""; } } /* / Get the csv file for the import of the custom metadata set */ public String SelectCSVFile(JPanel myComponent) { String startFolder = SystemPropertyFacade.getPropertyByKey(USER_HOME); final JFileChooser chooser = new JFileChooser(startFolder); FileFilter filter = new FileNameExtensionFilter(ResourceBundle.getBundle("translations/program_strings").getString("mduc.csvfile"), "csv"); chooser.setFileFilter(filter); chooser.setMultiSelectionEnabled(false); chooser.setDialogTitle(ResourceBundle.getBundle("translations/program_strings").getString("mduc.loccsvfile")); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int status = chooser.showOpenDialog(myComponent); if (status == JFileChooser.APPROVE_OPTION) { String selectedCSVFile = chooser.getSelectedFile().getPath(); return selectedCSVFile; } else { return ""; } } /* / Read all csv reader */ public List<String[]> readAll(Reader reader) throws Exception { CSVReader csvReader = new CSVReader(reader); List<String[]> list = new ArrayList<>(); list = csvReader.readAll(); reader.close(); csvReader.close(); return list; } /* / Read the selected csv file using above csvreader */ public List<String[]> ReadCSVFile(String csvFile) throws Exception { //String readLines = ""; Reader reader = Files.newBufferedReader(Paths.get(csvFile)); CSVReader csvReader = new CSVReader(reader); List<String[]> records = csvReader.readAll(); /*Reader reader = Files.newBufferedReader(Paths.get( ClassLoader.getSystemResource(csvFile).toURI())); return readLines.readAll(reader).toString(); */ return records; } /* / get the name for the custom set. Being asked when nothing was selected or no setname available, or when "Save As" was clicked / returns String[] with Name and writetype (update or insert) / */ private String[] getSetName() { String[] name_writetype = {"", "", "", ""}; String chosenName = ""; String custom_config_path = ""; String custom_config_filename = ""; JTextField customset_name_field = new JTextField(15); JLabel custom_config_field = new JLabel(); JButton custom_config_selector = new JButton(ResourceBundle.getBundle("translations/program_strings").getString("mduc.locatebutton")); custom_config_selector.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { //custom_config_field.setText(ResourceBundle.getBundle("translations/program_strings").getString("mduc.lblconffile") + " " + CustomconfigFile(myPanel, custom_config_field)); custom_config_field.setText(CustomconfigFile(myPanel, custom_config_field)); } }); //JPanel myPanel = new JPanel(); myPanel.setLayout(new BorderLayout()); JPanel nameRow = new JPanel(); nameRow.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); JLabel ccname = new JLabel(); ccname.setPreferredSize(new Dimension(250, 25)); ccname.setText(ResourceBundle.getBundle("translations/program_strings").getString("mduc.name")); //nameRow.add(new JLabel("Name:")); nameRow.add(ccname); nameRow.add(customset_name_field); myPanel.add(nameRow, BorderLayout.PAGE_START); myPanel.add(new JLabel(String.format(ProgramTexts.HTML, 450, ResourceBundle.getBundle("translations/program_strings").getString("mduc.explanation"))), BorderLayout.CENTER); JPanel customconfigRow = new JPanel(); customconfigRow.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); JLabel cco = new JLabel(); cco.setPreferredSize(new Dimension(250, 25)); cco.setText(ResourceBundle.getBundle("translations/program_strings").getString("mduc.lblcustconfig")); customconfigRow.add(cco); customconfigRow.add(custom_config_selector); customconfigRow.add(custom_config_field); custom_config_field.setVisible(false); myPanel.add(customconfigRow, BorderLayout.PAGE_END); int result = JOptionPane.showConfirmDialog(metadatapanel, myPanel, ResourceBundle.getBundle("translations/program_strings").getString("mduc.inpdlgname"), JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { chosenName = customset_name_field.getText(); custom_config_path = custom_config_field.getText(); Path p = Paths.get(custom_config_path); custom_config_filename = p.getFileName().toString(); logger.info("chosenName {}; custom_config_path {}", chosenName, custom_config_path); } if ((!(chosenName == null)) && (!(chosenName.isEmpty()))) { // null on cancel String[] checkNames = loadCurrentSets(""); // We expect a new name here for (String name : checkNames) { if (name.equals(chosenName)) { // We have this name already (so why did user select "Save As" anyway? result = JOptionPane.showConfirmDialog(rootpanel, ResourceBundle.getBundle("translations/program_strings").getString("mduc.overwrite") + chosenName + "\"?", ResourceBundle.getBundle("translations/program_strings").getString("mduc.overwriteconfirm"), JOptionPane.OK_CANCEL_OPTION); if (result == 0) { // user OK with overwrite name_writetype[0] = chosenName; name_writetype[1] = custom_config_filename; name_writetype[2] = "update"; name_writetype[3] = custom_config_path; break; } else { name_writetype[0] = ""; name_writetype[1] = ""; name_writetype[2] = ""; name_writetype[3] = ""; } } else { // We have a new name name_writetype[0] = chosenName; name_writetype[1] = custom_config_filename; name_writetype[2] = "insert"; name_writetype[3] = custom_config_path; } } } else { //Cancelled; no name name_writetype[0] = ""; name_writetype[1] = ""; name_writetype[2] = ""; name_writetype[3] = ""; } return name_writetype; } /** * Add a popup menu to the metadata table to handle insertion and * deletion of rows. */ private void addPopupMenu() { myPopupMenu = new JPopupMenu(); // Menu items. JMenuItem menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("mduc.insert")); // index 0 menuItem.addActionListener(new MyMenuHandler()); myPopupMenu.add(menuItem); menuItem = new JMenuItem(ResourceBundle.getBundle("translations/program_strings").getString("mduc.delete")); // index 1 menuItem.addActionListener(new MyMenuHandler()); myPopupMenu.add(menuItem); // Listen for menu invocation. metadataTable.addMouseListener(new MyPopupListener()); } /** * Retrieve the metadata from the SQL database * via a selection popup and save it into the table model. */ private void loadMetadata() { // Use my own sql load statement } /** * Save the metadata into the SQL database * input setName, writetype being insert or update, completeness * In case of insert we insert the name in CustomMetaDataSet and insert the values in CustomMetaDataSetLines * In case of update we simply remove all records from the setName from CustomMetaDataSetLines * and then insert new lines */ private void saveMetadata(String setName, String custom_config, String writetype) { String sql; String queryresult; int queryresultcounter = 0; int rowcount = 0; // We get the rowcells from the getter without checking. We would not be here if we had not checked already //List<String> cells = new ArrayList<String>(); List<List> tableRowsCells = MyVariables.gettableRowsCells(); for (List<String> cells : tableRowsCells) { logger.trace(cells.toString()); } if ("insert".equals(writetype)) { sql = "insert into CustomMetadataset(customset_name, custom_config) values('" + setName + "','" + custom_config + "')"; queryresult = SQLiteJDBC.insertUpdateQuery(sql, "disk"); if (!"".equals(queryresult)) { //means we have an error JOptionPane.showMessageDialog(metadatapanel, ResourceBundle.getBundle("translations/program_strings").getString("mduc.errorinserttext") + " " + setName, ResourceBundle.getBundle("translations/program_strings").getString("mduc.errorinserttitel"), JOptionPane.ERROR_MESSAGE); queryresultcounter += 1; } else { logger.info("no of tablerowcells {}", tableRowsCells.size()); // inserting the setName went OK, now all the table fields rowcount = 0; for (List<String> cells : tableRowsCells) { sql = "insert into CustomMetadatasetLines(customset_name, rowcount, screen_label, tag, default_value) " + "values('" + setName + "', " + rowcount + ",'" + cells.get(0) + "','" + cells.get(1) + "','" + cells.get(2) + "')"; logger.debug(sql); queryresult = SQLiteJDBC.insertUpdateQuery(sql, "disk"); if (!"".equals(queryresult)) { //means we have an error JOptionPane.showMessageDialog(metadatapanel, ResourceBundle.getBundle("translations/program_strings").getString("mduc.errorinserttext") + " " + setName, ResourceBundle.getBundle("translations/program_strings").getString("mduc.errorinserttitel"), JOptionPane.ERROR_MESSAGE); queryresultcounter += 1; } rowcount++; } } //Finally if (queryresultcounter == 0) { loadCurrentSets("fill_combo"); customSetcomboBox.setSelectedItem(setName); JOptionPane.showMessageDialog(metadatapanel, ResourceBundle.getBundle("translations/program_strings").getString("mduc.saved") + " " + setName, ResourceBundle.getBundle("translations/program_strings").getString("mduc.savedb"), JOptionPane.INFORMATION_MESSAGE); } } else { // update queryresult = SQLiteModel.deleteCustomSetRows(setName); if (!"".equals(queryresult)) { //means we have an error JOptionPane.showMessageDialog(metadatapanel, ResourceBundle.getBundle("translations/program_strings").getString("mduc.errorupdatetext") + " " + setName, ResourceBundle.getBundle("translations/program_strings").getString("mduc.errorupdatetitle"), JOptionPane.ERROR_MESSAGE); } else { logger.debug("no of tablerowcells {}", tableRowsCells.size()); // deleting the old records went OK, now (re)insert the rows rowcount = 0; for (List<String> cells : tableRowsCells) { sql = "insert into CustomMetadatasetLines(customset_name, rowcount, screen_label, tag, default_value) " + "values('" + setName + "', " + rowcount + ",'" + cells.get(0) + "','" + cells.get(1) + "','" + cells.get(2) + "')"; logger.debug(sql); queryresult = SQLiteJDBC.insertUpdateQuery(sql, "disk"); if (!"".equals(queryresult)) { //means we have an error JOptionPane.showMessageDialog(metadatapanel, ResourceBundle.getBundle("translations/program_strings").getString("mduc.errorinserttext") + " " + setName, ResourceBundle.getBundle("translations/program_strings").getString("mduc.errorinserttitel"), JOptionPane.INFORMATION_MESSAGE); queryresultcounter += 1; } rowcount++; } } //Finally if (queryresultcounter == 0) { loadCurrentSets("fill_combo"); customSetcomboBox.setSelectedItem(setName); JOptionPane.showMessageDialog(metadatapanel, ResourceBundle.getBundle("translations/program_strings").getString("mduc.saved") + " " + setName, ResourceBundle.getBundle("translations/program_strings").getString("mduc.savedb"), JOptionPane.INFORMATION_MESSAGE); } } } /** * Reorder rows in the table model to match the on-screen view so that * rows get inserted or deleted where the user intends. */ private void reorderRows() { DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel())); Vector modelRows = model.getDataVector(); Vector screenRows = new Vector(); for (int i = 0; i < modelRows.size(); i++) { screenRows.add(modelRows.get(metadataTable.convertRowIndexToModel(i))); } Vector headings = new Vector(Arrays.asList(ResourceBundle.getBundle("translations/program_strings").getString("mduc.columnlabel"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columntag"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columndefault"))); model.setDataVector(screenRows, headings); //metadataTable.getColumnModel().getColumn(2).setMaxWidth(100); // Checkbox. } /** * Save changed metadata to program preferences whenever the * metadata table changes. * * @param e the change event. */ @Override public void tableChanged(TableModelEvent e) { // We might use this "some time" } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { metadatapanel = new JPanel(); metadatapanel.setLayout(new GridLayoutManager(3, 2, new Insets(10, 10, 10, 10), -1, -1)); metadatapanel.setMinimumSize(new Dimension(800, 300)); metadatapanel.setPreferredSize(new Dimension(1000, 500)); buttonpanel = new JPanel(); buttonpanel.setLayout(new GridLayoutManager(1, 8, new Insets(5, 5, 5, 5), -1, -1)); metadatapanel.add(buttonpanel, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_SOUTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); saveasButton = new JButton(); this.$$$loadButtonText$$$(saveasButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "mduc.buttonsaveas")); buttonpanel.add(saveasButton, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); saveButton = new JButton(); this.$$$loadButtonText$$$(saveButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "mduc.buttonsave")); buttonpanel.add(saveButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); helpButton = new JButton(); this.$$$loadButtonText$$$(helpButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "mduc.buttonhelp")); buttonpanel.add(helpButton, new GridConstraints(0, 7, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); customSetcomboBox = new JComboBox(); buttonpanel.add(customSetcomboBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); deleteButton = new JButton(); this.$$$loadButtonText$$$(deleteButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.delete")); buttonpanel.add(deleteButton, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); exportButton = new JButton(); this.$$$loadButtonText$$$(exportButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.export")); buttonpanel.add(exportButton, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); importButton = new JButton(); this.$$$loadButtonText$$$(importButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.import")); buttonpanel.add(importButton, new GridConstraints(0, 5, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); closeButton = new JButton(); this.$$$loadButtonText$$$(closeButton, this.$$$getMessageFromBundle$$$("translations/program_strings", "mduc.buttonclose")); buttonpanel.add(closeButton, new GridConstraints(0, 6, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); aScrollPanel = new JScrollPane(); metadatapanel.add(aScrollPanel, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); metadataTable = new JTable(); metadataTable.setAutoCreateRowSorter(true); metadataTable.setMinimumSize(new Dimension(600, 300)); metadataTable.setPreferredScrollableViewportSize(new Dimension(700, 400)); aScrollPanel.setViewportView(metadataTable); final JPanel panel1 = new JPanel(); panel1.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); metadatapanel.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); lblCurDispUsercombi = new JLabel(); lblCurDispUsercombi.setHorizontalAlignment(10); lblCurDispUsercombi.setHorizontalTextPosition(10); this.$$$loadLabelText$$$(lblCurDispUsercombi, this.$$$getMessageFromBundle$$$("translations/program_strings", "mduc.curdispcombi")); panel1.add(lblCurDispUsercombi); final JPanel panel2 = new JPanel(); panel2.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); metadatapanel.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); lblConfigFile = new JLabel(); lblConfigFile.setHorizontalTextPosition(10); this.$$$loadLabelText$$$(lblConfigFile, this.$$$getMessageFromBundle$$$("translations/program_strings", "mduc.lblconffile")); panel2.add(lblConfigFile); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadLabelText$$$(JLabel component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setDisplayedMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return metadatapanel; } /** * Listen for popup menu invocation. * Need both mousePressed and mouseReleased for cross platform support. */ class MyPopupListener extends MouseAdapter { @Override public void mousePressed(MouseEvent e) { showPopup(e); } @Override public void mouseReleased(MouseEvent e) { showPopup(e); } private void showPopup(MouseEvent e) { if (e.isPopupTrigger()) { // Enable or disable the "Delete Rows" menu item // depending on whether a row is selected. myPopupMenu.getComponent(1).setEnabled( metadataTable.getSelectedRowCount() > 0); myPopupMenu.show(e.getComponent(), e.getX(), e.getY()); } } } /** * Handle popup menu commands. */ class MyMenuHandler implements ActionListener { /** * Popup menu actions. * * @param e the menu event. */ @Override public void actionPerformed(ActionEvent e) { JMenuItem item = (JMenuItem) e.getSource(); if (item.getText().equals(ResourceBundle.getBundle("translations/program_strings").getString("mduc.insert"))) { insertRows(e); } else if (item.getText().equals(ResourceBundle.getBundle("translations/program_strings").getString("mduc.delete"))) { deleteRows(e); } } /** * Insert one or more rows into the table at the clicked row. * * @param e */ private void insertRows(ActionEvent e) { // Get the insert request. DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel())); int theRow = metadataTable.getSelectedRow(); int rowCount = metadataTable.getSelectedRowCount(); // Case of click outside table: Add one row to end of table. if ((theRow == -1) && (rowCount == 0)) { theRow = model.getRowCount() - 1; rowCount = 1; } // Reorder the rows in the model to match the user's view of them. reorderRows(); // Add the new rows beneath theRow. for (int i = 0; i < rowCount; i++) { model.insertRow(theRow + 1 + i, new Object[]{"", "", "", false}); } } /** * Delete one or more rows in the table at the clicked row. * * @param e */ private void deleteRows(ActionEvent e) { // Get the delete request. DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel())); int theRow = metadataTable.getSelectedRow(); int rowCount = metadataTable.getSelectedRowCount(); // Reorder the rows in the model to match the user's view of them. reorderRows(); // Delete the new rows beneath theRow. for (int i = 0; i < rowCount; i++) { model.removeRow(theRow); } } } /** * Enable paste into the metadata table. */ private void enablePaste() { myPasteHandler = new TablePasteAdapter(metadataTable); } /** * Enable reordering of rows by drag and drop. */ private void enableDragging() { metadataTable.setDragEnabled(true); metadataTable.setDropMode(DropMode.USE_SELECTION); metadataTable.setTransferHandler(new MyDraggingHandler()); } class MyDraggingHandler extends TransferHandler { public MyDraggingHandler() { } @Override public int getSourceActions(JComponent c) { return MOVE; } /** * Build a transferable consisting of a string containing values of all * the columns in the selected row separated by newlines. * Replace null values with "". Delete the selected row. * * @param source * @return */ @Override protected Transferable createTransferable(JComponent source) { int row = ((JTable) source).getSelectedRow(); DefaultTableModel model = (DefaultTableModel) ((JTable) (source)).getModel(); String rowValue = ""; for (int c = 0; c < 2; c++) { // 3 columns in metadata table. Object aCell = (Object) model.getValueAt(row, c); if (aCell == null) aCell = ""; rowValue = rowValue + aCell + "\n"; } model.removeRow(row); return new StringSelection(rowValue); } @Override protected void exportDone(JComponent source, Transferable data, int action) { } @Override public boolean canImport(TransferSupport support) { return true; } /** * Insert the transferable at the selected row. If row is outside the * table then insert at end of table. * * @param support * @return */ @Override public boolean importData(TransferSupport support) { try { JTable jt = (JTable) support.getComponent(); DefaultTableModel model = ((DefaultTableModel) (jt.getModel())); int row = jt.getSelectedRow(); // Insert at end? if (row == -1) { row = model.getRowCount(); } // Get the transferable string and convert to vector. // When there are blank cells we may not get 3 items from the // transferable. Supply blanks. String rowValue = (String) support.getTransferable(). getTransferData(DataFlavor.stringFlavor); String[] rowValues = rowValue.split("\n"); Vector aRow = new Vector(); for (int c = 0; c < 2; c++) { // 3 columns in metadata table, 3 strings. if (c < rowValues.length) { aRow.add(rowValues[c]); } else { aRow.add(""); } } model.insertRow(row, aRow); } catch (Exception ex) { logger.info("import data failure {}", ex); } return super.importData(support); } } private String[] loadCurrentSets(String check) { String sqlsets = SQLiteModel.getdefinedCustomSets(); logger.debug("retrieved CustomSets: " + sqlsets); String[] views = sqlsets.split("\\r?\\n"); // split on new lines if ("fill_combo".equals(check)) { // We use this one also for "Save As" to check if user has chosen same name MyVariables.setCustomCombis(views); customSetcomboBox.setModel(new DefaultComboBoxModel(views)); } return views; } private void fillTable(String start) { DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel())); model.setColumnIdentifiers(new String[]{ResourceBundle.getBundle("translations/program_strings").getString("mduc.columnlabel"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columntag"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columndefault")}); model.setRowCount(0); Object[] row = new Object[1]; logger.debug("combo numberof {}, selecteditem {}", customSetcomboBox.getItemCount(), customSetcomboBox.getSelectedItem()); if ((customSetcomboBox.getItemCount() == 0) || ("start".equals(start))) { // We do not have stored custom sets yet, or we are opening this screen. for (int i = 0; i < 10; i++) { model.addRow(new Object[]{"", "", ""}); } } else { String setName = customSetcomboBox.getSelectedItem().toString(); String sql = "select screen_label, tag, default_value from custommetadatasetLines where customset_name='" + setName.trim() + "' order by rowcount"; String queryResult = SQLiteJDBC.generalQuery(sql, "disk"); if (queryResult.length() > 0) { String[] lines = queryResult.split(SystemPropertyFacade.getPropertyByKey(LINE_SEPARATOR)); for (String line : lines) { String[] cells = line.split("\\t", 4); model.addRow(new Object[]{cells[0], cells[1], cells[2]}); } } lblCurDispUsercombi.setText(ResourceBundle.getBundle("translations/program_strings").getString("mduc.curdispcombi") + " " + setName); String configFile = SQLiteJDBC.singleFieldQuery("select custom_config from custommetadataset where customset_name='" + setName.trim() + "'", "custom_config"); if (!configFile.equals("")) { lblConfigFile.setText(ResourceBundle.getBundle("translations/program_strings").getString("mduc.lblconffile") + " " + configFile); } else { lblConfigFile.setText(ResourceBundle.getBundle("translations/program_strings").getString("mduc.lblconffile")); } } } // The main" function of this class public void showDialog(JPanel rootPanel) { //setSize(750, 500); //make sure we have a "local" rootpanel rootpanel = rootPanel; setTitle(ResourceBundle.getBundle("translations/program_strings").getString("mduc.title")); pack(); double x = getParent().getBounds().getCenterX(); double y = getParent().getBounds().getCenterY(); //setLocation((int) x - getWidth() / 2, (int) y - getHeight() / 2); setLocationRelativeTo(null); addPopupMenu(); enablePaste(); enableDragging(); loadCurrentSets("fill_combo"); fillTable("start"); // Initialization is complete. initialized = true; setVisible(true); } }
51,118
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
Favorites.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/Favorites.java
package org.hvdw.jexiftoolgui.view; import ch.qos.logback.classic.Logger; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import org.hvdw.jexiftoolgui.MyConstants; import org.hvdw.jexiftoolgui.MyVariables; import org.hvdw.jexiftoolgui.ProgramTexts; import org.hvdw.jexiftoolgui.controllers.StandardFileIO; import org.hvdw.jexiftoolgui.facades.SystemPropertyFacade; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.table.DefaultTableModel; import java.awt.*; import java.awt.event.*; import java.io.File; import java.lang.reflect.Method; import java.util.*; import static org.hvdw.jexiftoolgui.facades.SystemPropertyFacade.SystemPropertyKey.LINE_SEPARATOR; import static org.hvdw.jexiftoolgui.facades.SystemPropertyFacade.SystemPropertyKey.USER_HOME; public class Favorites extends JDialog { private JPanel contentPane; private JButton buttonOK; private JButton buttonCancel; private JTextField favoritenametextField; private JLabel copiedcommandquerylabel; private JScrollPane scrollPane; private JTable favoritestable; private JLabel lblCommandQuery; private JLabel commandqueryTopText; private JLabel favoritenamelabel; private JLabel favselectlabel; private JButton buttonDelete; private JPanel jp = null; private String favtype = ""; private String chosenName = ""; private String favtypeText = ""; private String cmd_qry = ""; private String favorite_name = ""; String writeresult = ""; String favAction = ""; HashMap<String, String> loadedFavorites = new HashMap<String, String>(); private final String commandTxt = "<html>" + ResourceBundle.getBundle("translations/program_strings").getString("fav.commandtext") + "<br><br></html>"; private final String queryTxt = "<html>" + ResourceBundle.getBundle("translations/program_strings").getString("fav.querytext") + "<br><br></html>"; String strjexiftoolguifolder = SystemPropertyFacade.getPropertyByKey(USER_HOME) + File.separator + MyConstants.MY_DATA_FOLDER; File favoritesFile = new File(strjexiftoolguifolder + File.separator + "favorites.hashmap"); private final static Logger logger = (Logger) LoggerFactory.getLogger(Favorites.class); public Favorites() { setContentPane(contentPane); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); contentPane.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); setModal(true); getRootPane().setDefaultButton(buttonOK); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); favoritestable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); DefaultTableModel model = (DefaultTableModel) favoritestable.getModel(); int selectedRowIndex = favoritestable.getSelectedRow(); if (!"SelectFavorite".equals(favAction)) { favoritenamelabel.setVisible(true); favoritenametextField.setText(model.getValueAt(selectedRowIndex, 0).toString()); favoritenametextField.setVisible(true); copiedcommandquerylabel.setText(model.getValueAt(selectedRowIndex, 1).toString()); copiedcommandquerylabel.setVisible(true); } chosenName = model.getValueAt(selectedRowIndex, 0).toString(); favorite_name = model.getValueAt(selectedRowIndex, 1).toString(); } }); buttonOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onOK(); } }); buttonCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); // delete button only active on deletion of favorites buttonDelete.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { logger.info("favorite for deletion {}", favorite_name); //loadedFavorites.remove(chosenName, favorite_name); loadedFavorites.remove(chosenName); writeresult = StandardFileIO.writeHashMapToFile(favoritesFile, loadedFavorites); if ("Error saving".contains(writeresult)) { //means we have an error JOptionPane.showMessageDialog(jp, ResourceBundle.getBundle("translations/program_strings").getString("fav.delerror") + favorite_name, ResourceBundle.getBundle("translations/program_strings").getString("fav.delerrorshort"), JOptionPane.ERROR_MESSAGE); } else { //success JOptionPane.showMessageDialog(jp, ResourceBundle.getBundle("translations/program_strings").getString("fav.deleted") + " " + favorite_name, ResourceBundle.getBundle("translations/program_strings").getString("fav.deletedshort"), JOptionPane.INFORMATION_MESSAGE); } setVisible(false); dispose(); } }); } private static HashMap<String, String> loadfavorites(String favoriteType) { HashMap<String, String> favorites; String strjexiftoolguifolder = SystemPropertyFacade.getPropertyByKey(USER_HOME) + File.separator + MyConstants.MY_DATA_FOLDER; File favoritesFile = new File(strjexiftoolguifolder + File.separator + "favorites.hashmap"); favorites = StandardFileIO.readHashMapFromFile(favoritesFile); return favorites; } private void displayfavorites(HashMap<String, String> favorites, String favoriteType) { DefaultTableModel model = (DefaultTableModel) favoritestable.getModel(); model.setColumnIdentifiers(new String[]{ResourceBundle.getBundle("translations/program_strings").getString("fav.name"), favoriteType}); //favoritestable.setModel(model); favoritestable.getColumnModel().getColumn(0).setPreferredWidth(150); favoritestable.getColumnModel().getColumn(1).setPreferredWidth(300); model.setRowCount(0); Object[] row = new Object[1]; if (favorites.size() > 0) { for (Map.Entry<String, String> key_value : favorites.entrySet()) { model.addRow(new Object[]{key_value.getKey(), key_value.getValue()}); } } } private void SaveFavorite() { String chosenname = favoritenametextField.getText().trim(); if (!"".equals(chosenname)) { // user gave a favorites name // Check if already exists if (loadedFavorites.containsKey(chosenname)) { int result = JOptionPane.showConfirmDialog(jp, String.format(ProgramTexts.HTML, 400, ResourceBundle.getBundle("translations/program_strings").getString("fav.overwrite") + chosenname + "\"?"), ResourceBundle.getBundle("translations/program_strings").getString("fav.overwriteshort"), JOptionPane.OK_CANCEL_OPTION); if (result == 0) { //OK // user wants us to overwrite logger.info("user wants to update the favorites with name: " + chosenname); loadedFavorites.put(chosenname, cmd_qry); writeresult = StandardFileIO.writeHashMapToFile(favoritesFile, loadedFavorites); if ("Error saving".contains(writeresult)) { //means we have an error JOptionPane.showMessageDialog(jp, String.format(ProgramTexts.HTML, 400, ResourceBundle.getBundle("translations/program_strings").getString("fav.updateerror") + chosenname), ResourceBundle.getBundle("translations/program_strings").getString("fav.updateerrshort"), JOptionPane.ERROR_MESSAGE); } else { //success JOptionPane.showMessageDialog(jp, String.format(ProgramTexts.HTML, 400, ResourceBundle.getBundle("translations/program_strings").getString("fav.saved") + " " + chosenname), ResourceBundle.getBundle("translations/program_strings").getString("fav.savedshort"), JOptionPane.INFORMATION_MESSAGE); } } // result 2 means cancel; do nothing } else { // No name from hashmap loadedFavorites, so a new favorite record logger.debug("insert new favorite named: " + chosenname); loadedFavorites.put(chosenname, cmd_qry); writeresult = StandardFileIO.writeHashMapToFile(favoritesFile, loadedFavorites); if ("Error saving".contains(writeresult)) { //means we have an error JOptionPane.showMessageDialog(jp, String.format(ProgramTexts.HTML, 400, ResourceBundle.getBundle("translations/program_strings").getString("fav.inserterror") + " " + chosenname), ResourceBundle.getBundle("translations/program_strings").getString("fav.inserterrshort"), JOptionPane.ERROR_MESSAGE); } else { //success JOptionPane.showMessageDialog(jp, String.format(ProgramTexts.HTML, 400, ResourceBundle.getBundle("translations/program_strings").getString("fav.saved") + "" + chosenname), ResourceBundle.getBundle("translations/program_strings").getString("fav.savedshort"), JOptionPane.INFORMATION_MESSAGE); } } } else { // user did not provide a lensname to insert/update JOptionPane.showMessageDialog(jp, String.format(ProgramTexts.HTML, 400, ResourceBundle.getBundle("translations/program_strings").getString("fav.nofavname")), ResourceBundle.getBundle("translations/program_strings").getString("fav.nofavnameshort"), JOptionPane.ERROR_MESSAGE); } //return queryresult; } private void onOK() { // add your code here //chosenName = favoritenametextField.getText(); // Make difference between Saving and Selecting if ("AddFavorite".equals(favAction)) { SaveFavorite(); } dispose(); } private void onCancel() { // add your code here if necessary dispose(); } public String showDialog(JPanel rootpanel, String favoriteAction, String favoriteType, String command_query) { // Currently favoriteType is ALWAYS like "command", but we leave the entire logic here // for maybe more favorite types in the future pack(); //setLocationRelativeTo(null); setLocationByPlatform(true); favoritenametextField.setText(""); favtypeText = favoriteType.replace("_", " "); favAction = favoriteAction; // Make table readonly favoritestable.setDefaultEditor(Object.class, null); jp = rootpanel; // Need to save the rootpanel for the onOK method favtype = favoriteType; // for onOK method cmd_qry = command_query; // for onOK method // Get current defined favorites loadedFavorites = loadfavorites(favoriteType); logger.info("retrieved favorites: " + loadedFavorites); displayfavorites(loadedFavorites, favoriteType); // Now check which action we are going to perform if ("AddFavorite".equals(favoriteAction)) { favoritenamelabel.setVisible(true); favoritenametextField.setVisible(true); lblCommandQuery.setVisible(true); favselectlabel.setVisible(false); buttonOK.setVisible(true); getRootPane().setDefaultButton(buttonOK); buttonDelete.setVisible(false); copiedcommandquerylabel.setText(String.format(ProgramTexts.HTML, 400, command_query)); if (favtypeText.contains("Command")) { setTitle(ResourceBundle.getBundle("translations/program_strings").getString("favoriteaddcommand.title")); } else { setTitle(ResourceBundle.getBundle("translations/program_strings").getString("favoriteaddquery.title")); } setTitle("Add " + favtypeText); lblCommandQuery.setText(favtypeText + ": "); if ("Exiftool_Command".equals(favoriteType)) { commandqueryTopText.setText(commandTxt); } else { commandqueryTopText.setText(queryTxt); } } else if ("SelectFavorite".equals(favoriteAction)) { favoritenamelabel.setVisible(false); favoritenametextField.setVisible(false); lblCommandQuery.setVisible(false); favselectlabel.setVisible(true); copiedcommandquerylabel.setVisible(false); buttonOK.setVisible(true); buttonDelete.setVisible(false); getRootPane().setDefaultButton(buttonOK); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("favoriteselect.title")); } else if ("DeleteFavorite".equals(favoriteAction)) { favoritenamelabel.setVisible(false); favoritenametextField.setVisible(false); lblCommandQuery.setVisible(false); favselectlabel.setVisible(true); buttonDelete.setVisible(true); getRootPane().setDefaultButton(buttonDelete); buttonOK.setVisible(false); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("favoriteselect.title")); // same title } setVisible(true); return favorite_name; //return chosenName; } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(15, 15, 15, 15), -1, -1)); contentPane.setPreferredSize(new Dimension(700, 500)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonOK = new JButton(); this.$$$loadButtonText$$$(buttonOK, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.ok")); panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonCancel = new JButton(); this.$$$loadButtonText$$$(buttonCancel, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.cancel")); panel2.add(buttonCancel, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonDelete = new JButton(); this.$$$loadButtonText$$$(buttonDelete, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.delete")); panel2.add(buttonDelete, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel4 = new JPanel(); panel4.setLayout(new GridLayoutManager(5, 3, new Insets(0, 0, 0, 0), 8, 5)); panel3.add(panel4, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 1, false)); favoritenamelabel = new JLabel(); this.$$$loadLabelText$$$(favoritenamelabel, this.$$$getMessageFromBundle$$$("translations/program_strings", "fav.name")); panel4.add(favoritenamelabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); favoritenametextField = new JTextField(); panel4.add(favoritenametextField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(450, -1), null, 0, false)); lblCommandQuery = new JLabel(); lblCommandQuery.setText("Command:"); panel4.add(lblCommandQuery, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); copiedcommandquerylabel = new JLabel(); copiedcommandquerylabel.setText(""); panel4.add(copiedcommandquerylabel, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(450, -1), null, 0, false)); final JLabel label1 = new JLabel(); this.$$$loadLabelText$$$(label1, this.$$$getMessageFromBundle$$$("translations/program_strings", "fav.cursavedfavs")); panel4.add(label1, new GridConstraints(3, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); scrollPane = new JScrollPane(); panel4.add(scrollPane, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); favoritestable = new JTable(); favoritestable.setPreferredScrollableViewportSize(new Dimension(600, 300)); scrollPane.setViewportView(favoritestable); final Spacer spacer2 = new Spacer(); panel4.add(spacer2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); favselectlabel = new JLabel(); this.$$$loadLabelText$$$(favselectlabel, this.$$$getMessageFromBundle$$$("translations/program_strings", "favoriteselect.title")); panel4.add(favselectlabel, new GridConstraints(2, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); commandqueryTopText = new JLabel(); commandqueryTopText.setText(""); panel3.add(commandqueryTopText, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(450, -1), null, 0, false)); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadLabelText$$$(JLabel component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setDisplayedMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPane; } }
24,348
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
JxMapViewer.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/JxMapViewer.java
package org.hvdw.jexiftoolgui.view; import ch.qos.logback.classic.Logger; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import org.hvdw.jexiftoolgui.MyVariables; import org.hvdw.jexiftoolgui.Utils; import org.hvdw.jexiftoolgui.facades.IPreferencesFacade; import org.hvdw.jexiftoolgui.model.Nominatim; import org.jxmapviewer.JXMapKit; import org.jxmapviewer.JXMapViewer; import org.jxmapviewer.OSMTileFactoryInfo; import org.jxmapviewer.cache.FileBasedLocalCache; import org.jxmapviewer.input.CenterMapListener; import org.jxmapviewer.input.PanKeyListener; import org.jxmapviewer.input.PanMouseInputListener; import org.jxmapviewer.input.ZoomMouseWheelListenerCursor; import org.jxmapviewer.viewer.*; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.event.MouseInputListener; import javax.swing.table.DefaultTableModel; import java.awt.*; import java.awt.event.*; import java.awt.geom.Point2D; import java.io.File; import java.io.IOException; import java.lang.reflect.Method; import java.util.*; import java.util.List; import static org.hvdw.jexiftoolgui.facades.IPreferencesFacade.PreferenceKey.*; /** * This class draws the initial map, activates the mouse/key listeners. And handles the search/fin options * It uses the standard jxmapviewer2 functionality, * but in parallel the JXMapKit functionality is also built in, but that is not used currently */ public class JxMapViewer extends JDialog { private JPanel contentPane; private JButton buttonLocation; private JButton buttonOK; private JButton buttonCancel; private JTextField SearchtextField; private JButton searchLocationbutton; private JTable searchResultstable; private JLabel lblDisplay_Name; private JLabel lblLatitude; private JLabel lblLongitude; private JPanel MapViewerPane; private ListSelectionModel listSelectionModel; private String[] returnPlace; private String mapUsageHints; private JXMapViewer mapViewer = new JXMapViewer(); private JXMapKit jXMapKit = new JXMapKit(); private List<String[]> placesList = null; private List<Map> places = null; private Map<String, String> selectedPlace = null; private boolean useXMapKit = false; //private String address = ""; private HashMap<String, String> Address = new HashMap<String, String>(); private final static Logger logger = (Logger) LoggerFactory.getLogger(JxMapViewer.class); private final static IPreferencesFacade prefs = IPreferencesFacade.defaultInstance; public JxMapViewer() { setContentPane(contentPane); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); contentPane.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); setModal(true); this.setIconImage(Utils.getFrameIcon()); getRootPane().setDefaultButton(searchLocationbutton); buttonLocation.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onOnlyLocation(); } }); buttonOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onOK(); } }); buttonCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Save last used position to preferences onCancel(); } }); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); searchLocationbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { String getResult; String searchphrase = SearchtextField.getText(); if (!("".equals(searchphrase))) { try { getResult = Nominatim.SearchLocation(searchphrase); places = Nominatim.parseLocationJson(getResult); if (places.size() > 0) { fillsearchResultstable(places); } else { JOptionPane.showMessageDialog(contentPane, ResourceBundle.getBundle("translations/program_strings").getString("mpv.noresults"), ResourceBundle.getBundle("translations/program_strings").getString("mpv.noresults"), JOptionPane.WARNING_MESSAGE); } } catch (IOException e) { logger.error("Nominatim search error {}", e.toString()); e.printStackTrace(); } } else { JOptionPane.showMessageDialog(contentPane, ResourceBundle.getBundle("translations/program_strings").getString("mpv.nosrchphrs"), ResourceBundle.getBundle("translations/program_strings").getString("mpv.nosrchphrs"), JOptionPane.WARNING_MESSAGE); } } }); searchResultstable.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent mouseEvent) { super.mousePressed(mouseEvent); DefaultTableModel model = (DefaultTableModel) searchResultstable.getModel(); int selectedRowIndex = searchResultstable.getSelectedRow(); updateFieldsVariablesMap(model, selectedRowIndex); logger.info("row with search result pressed"); } }); searchResultstable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); DefaultTableModel model = (DefaultTableModel) searchResultstable.getModel(); int selectedRowIndex = searchResultstable.getSelectedRow(); updateFieldsVariablesMap(model, selectedRowIndex); logger.info("row with search result clicked"); } }); } private void onOnlyLocation() { selectedPlace.put("saveGpsLocation", "false"); dispose(); } private void onOK() { //returnPlace = new String[]{lblDisplay_Name.getText().trim(), lblLatitude.getText().trim(), lblLongitude.getText().trim()}; selectedPlace.put("saveGpsLocation", "true"); if (!"".equals(lblLatitude.getText())) { selectedPlace.put("saveGpsLocation", "true"); try { Double doub = Double.parseDouble(lblLatitude.getText().trim()); prefs.storeByKey(LATITUDE, lblLatitude.getText().trim()); } catch (NumberFormatException ex) { prefs.storeByKey(LATITUDE, "52.515"); } } if (!"".equals(lblLongitude.getText())) { try { Double doub = Double.parseDouble(lblLongitude.getText().trim()); prefs.storeByKey(LONGITUDE, lblLongitude.getText().trim()); } catch (NumberFormatException ex) { prefs.storeByKey(LONGITUDE, "6.098"); } } if ("".equals(lblLatitude.getText()) && "".equals(lblLongitude.getText())) { // We have nothing but user still wants to copy data back selectedPlace = new HashMap<>(); selectedPlace.put("empty", "empty"); } dispose(); } private void onCancel() { //returnPlace = new String[]{"", "", ""}; selectedPlace = new HashMap<>(); selectedPlace.put("empty", "empty"); selectedPlace.put("saveGpsLocation", "true"); dispose(); } /** * This method fills the results table after a search for a location * * @param places */ void fillsearchResultstable(List<Map> places) { //void fillsearchResultstable(List<String[]> placesList) { DefaultTableModel model = (DefaultTableModel) searchResultstable.getModel(); // make table uneditable searchResultstable.setDefaultEditor(Object.class, null); model.setColumnIdentifiers(new String[]{ResourceBundle.getBundle("translations/program_strings").getString("mpv.name"), ResourceBundle.getBundle("translations/program_strings").getString("mpv.tbllat"), ResourceBundle.getBundle("translations/program_strings").getString("mpv.tbllon")}); searchResultstable.getColumnModel().getColumn(0).setPreferredWidth(300); searchResultstable.getColumnModel().getColumn(1).setPreferredWidth(100); searchResultstable.getColumnModel().getColumn(2).setPreferredWidth(100); listSelectionModel = searchResultstable.getSelectionModel(); searchResultstable.setRowSelectionAllowed(true); searchResultstable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); model.setRowCount(0); Object[] row = new Object[1]; // Now start filling the table for (Map place : places) { //model.addRow(new Object[]{place[0], place[1], place[2]}); model.addRow(new Object[]{place.get("display_Name"), place.get("geoLatitude"), place.get("geoLongitude")}); } } /** * This method is called when a user select a result place from the table * * @param model * @param row */ void updateFieldsVariablesMap(DefaultTableModel model, int row) { List<GeoPosition> boundingbox; int selectedRowIndex = searchResultstable.getSelectedRow(); String display_name = model.getValueAt(selectedRowIndex, 0).toString(); String strlat = model.getValueAt(selectedRowIndex, 1).toString(); String strlon = model.getValueAt(selectedRowIndex, 2).toString(); lblDisplay_Name.setText(model.getValueAt(selectedRowIndex, 0).toString()); lblLatitude.setText(strlat); lblLongitude.setText(strlon); MyVariables.setLatitude(strlat); MyVariables.setLongitude(strlon); GeoPosition newPos = new GeoPosition(Double.parseDouble(strlat), Double.parseDouble(strlon)); addWaypoint(newPos); mapViewer.setAddressLocation(newPos); mapViewer.setCenterPosition(newPos); jXMapKit.setAddressLocation(newPos); jXMapKit.setCenterPosition(newPos); for (Map<String, String> place : places) { if (display_name.equals(place.get("display_Name"))) { selectedPlace = place; GeoPosition topleft = new GeoPosition(Double.parseDouble(place.get("bbX1")), Double.parseDouble(place.get("bbY1"))); GeoPosition topright = new GeoPosition(Double.parseDouble(place.get("bbX2")), Double.parseDouble(place.get("bbY1"))); GeoPosition btmleft = new GeoPosition(Double.parseDouble(place.get("bbX1")), Double.parseDouble(place.get("bbY2"))); GeoPosition btmright = new GeoPosition(Double.parseDouble(place.get("bbX2")), Double.parseDouble(place.get("bbY2"))); boundingbox = Arrays.asList(topleft, topright, btmleft, btmright); mapViewer.zoomToBestFit(new HashSet<GeoPosition>(boundingbox), 0.7); } } } /** * This method is called when a use right-clicks on the map to get the clicked position * * @param latitude * @param longitude * @param xLatitude * @param xLongitude */ void updateFieldsVariablesMap(double latitude, double longitude, double xLatitude, double xLongitude) { List<GeoPosition> boundingbox; if (useXMapKit) { lblLatitude.setText(String.valueOf(xLatitude)); lblLongitude.setText(String.valueOf(xLongitude)); MyVariables.setLatitude(String.valueOf(xLatitude)); MyVariables.setLongitude(String.valueOf(xLongitude)); } else { lblLatitude.setText(String.valueOf(latitude)); lblLongitude.setText(String.valueOf(longitude)); MyVariables.setLatitude(String.valueOf(latitude)); MyVariables.setLongitude(String.valueOf(longitude)); } GeoPosition newPos = new GeoPosition(latitude, longitude); GeoPosition newXPos = new GeoPosition(xLatitude, xLongitude); addWaypoint(newPos); mapViewer.setAddressLocation(newPos); mapViewer.setCenterPosition(newPos); jXMapKit.setAddressLocation(newXPos); jXMapKit.setCenterPosition(newXPos); try { String getResult = Nominatim.ReverseSearch(latitude, longitude); selectedPlace = Nominatim.parseReverseLocationJson(getResult); selectedPlace.put("saveGpsLocation", "true"); lblDisplay_Name.setText(selectedPlace.get("display_Name")); GeoPosition topleft = new GeoPosition(Double.parseDouble(selectedPlace.get("bbX1")), Double.parseDouble(selectedPlace.get("bbY1"))); GeoPosition topright = new GeoPosition(Double.parseDouble(selectedPlace.get("bbX2")), Double.parseDouble(selectedPlace.get("bbY1"))); GeoPosition btmleft = new GeoPosition(Double.parseDouble(selectedPlace.get("bbX1")), Double.parseDouble(selectedPlace.get("bbY2"))); GeoPosition btmright = new GeoPosition(Double.parseDouble(selectedPlace.get("bbX2")), Double.parseDouble(selectedPlace.get("bbY2"))); boundingbox = Arrays.asList(topleft, topright, btmleft, btmright); mapViewer.zoomToBestFit(new HashSet<GeoPosition>(boundingbox), 0.7); } catch (IOException e) { logger.error("Nominatim.ReverseSearch error {}", e); e.printStackTrace(); } } /** * This method puts a waypoint marker on the map for the clicked location from the results table * or when a user has right-clicked the map * * @param markerposition */ void addWaypoint(GeoPosition markerposition) { Set<Waypoint> waypoints = new HashSet<Waypoint>(Arrays.asList(new DefaultWaypoint(markerposition))); //crate a WaypointPainter to draw the points WaypointPainter painter = new WaypointPainter(); painter.setWaypoints(waypoints); mapViewer.setOverlayPainter(painter); } /** * This method builds the standard jxmapviewer2 map and activates the mouse listeners */ void buildMapviewer() { useXMapKit = false; // Create a TileFactoryInfo for OpenStreetMap TileFactoryInfo info = new OSMTileFactoryInfo(); DefaultTileFactory tileFactory = new DefaultTileFactory(info); // Setup local file cache File cacheDir = new File(System.getProperty("user.home") + File.separator + ".jxmapviewer2"); tileFactory.setLocalCache(new FileBasedLocalCache(cacheDir, false)); // Setup JXMapViewer mapViewer.setTileFactory(tileFactory); // Set the focus mapViewer.setZoom(7); GeoPosition zwolle = new GeoPosition(52.515, 6.098); String strlat = prefs.getByKey(LATITUDE, "52.515"); String strlon = prefs.getByKey(LONGITUDE, "6.098"); GeoPosition startPos = new GeoPosition(Double.parseDouble(strlat), Double.parseDouble(strlon)); mapViewer.setAddressLocation(startPos); // Add interactions MouseInputListener mia = new PanMouseInputListener(mapViewer); mapViewer.addMouseListener(mia); mapViewer.addMouseMotionListener(mia); mapViewer.addMouseListener(new CenterMapListener(mapViewer)); mapViewer.addMouseWheelListener(new ZoomMouseWheelListenerCursor(mapViewer)); mapViewer.addKeyListener(new PanKeyListener(mapViewer)); LocationSelector ls = new LocationSelector(); mapViewer.addMouseListener(ls); //Add stuff to mapviewer pane MapViewerPane.add(new JLabel(mapUsageHints), BorderLayout.PAGE_START); String attributes = tileFactory.getInfo().getAttribution() + " - " + tileFactory.getInfo().getLicense(); MapViewerPane.add(new JLabel(attributes), BorderLayout.PAGE_END); MapViewerPane.add(mapViewer); } /** * This method builds the JXMapKit mapviewer. On one hand it has some features like a slider, plus/min buttons and a minimap * But it lacks the zoomtobestfit option */ void buildXMapkitviewer() { useXMapKit = true; // Create a TileFactoryInfo for OpenStreetMap TileFactoryInfo info = new OSMTileFactoryInfo(); DefaultTileFactory tileFactory = new DefaultTileFactory(info); // Setup local file cache File cacheDir = new File(System.getProperty("user.home") + File.separator + ".jxmapviewer2"); tileFactory.setLocalCache(new FileBasedLocalCache(cacheDir, false)); // Setup JXMapViewer jXMapKit.setTileFactory(tileFactory); // Set the focus jXMapKit.setZoom(7); GeoPosition zwolle = new GeoPosition(52.515, 6.098); String strlat = prefs.getByKey(LATITUDE, "52.515"); String strlon = prefs.getByKey(LONGITUDE, "6.098"); GeoPosition startPos = new GeoPosition(Double.parseDouble(strlat), Double.parseDouble(strlon)); jXMapKit.setAddressLocation(startPos); // Add interactions JXMapViewer map = jXMapKit.getMainMap(); MouseInputListener mia = new PanMouseInputListener(map); jXMapKit.addMouseListener(mia); LocationSelector ls = new LocationSelector(); map.addMouseListener(ls); jXMapKit.addMouseMotionListener(mia); jXMapKit.addMouseListener(new CenterMapListener(map)); jXMapKit.addMouseWheelListener(new ZoomMouseWheelListenerCursor(map)); jXMapKit.addKeyListener(new PanKeyListener(map)); jXMapKit.addMouseMotionListener(new MouseMotionListener() { @Override public void mouseDragged(MouseEvent e) { // ignore } @Override public void mouseMoved(MouseEvent e) { JXMapViewer map = jXMapKit.getMainMap(); // convert to world bitmap Point2D worldPos = map.getTileFactory().geoToPixel(startPos, map.getZoom()); // convert to screen Rectangle rect = map.getViewportBounds(); int sx = (int) worldPos.getX() - rect.x; int sy = (int) worldPos.getY() - rect.y; Point screenPos = new Point(sx, sy); } }); //Add stuff to mapviewer pane //MapViewerPane.setPreferredSize(1150, 600); MapViewerPane.add(new JLabel(mapUsageHints), BorderLayout.PAGE_START); String attributes = tileFactory.getInfo().getAttribution() + " - " + tileFactory.getInfo().getLicense(); MapViewerPane.add(new JLabel(attributes), BorderLayout.PAGE_END); MapViewerPane.add(jXMapKit); } /** * This class provides the right-click mouselistener to get the geoposition from the map */ private class LocationSelector implements MouseListener { @Override public void mouseClicked(MouseEvent e) { JXMapViewer map = jXMapKit.getMainMap(); if (e.getClickCount() == 1 && e.getButton() == MouseEvent.BUTTON3) { Point p = e.getPoint(); GeoPosition geox = map.convertPointToGeoPosition(p); GeoPosition geo = mapViewer.convertPointToGeoPosition(p); logger.debug("X: {} Y: {}", geo.getLatitude(), geo.getLongitude()); //logger.debug("X: {} Y: {}", geox.getLatitude(), geox.getLongitude()); GeoPosition newPos = new GeoPosition(geo.getLatitude(), geo.getLongitude()); GeoPosition newXPos = new GeoPosition(geox.getLatitude(), geox.getLongitude()); jXMapKit.setAddressLocation(newXPos); jXMapKit.setCenterPosition(newXPos); mapViewer.setAddressLocation(newPos); mapViewer.setCenterPosition(newPos); updateFieldsVariablesMap(geo.getLatitude(), geo.getLongitude(), geox.getLatitude(), geox.getLongitude()); } } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } } // The main" function of this class public Map<String, String> showDialog(String coordinates) { //public String[] showDialog() { //JxMapViewer2 dialog = new JxMapViewer2(); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("mpv.title")); SearchtextField.setText(coordinates); pack(); double x = getParent().getBounds().getCenterX(); double y = getParent().getBounds().getCenterY(); //setLocation((int) x - getWidth() / 2, (int) y - getHeight() / 2); setLocationRelativeTo(null); // Create the mapviewer panel mapUsageHints = ResourceBundle.getBundle("translations/program_strings").getString("mpv.hints"); buildMapviewer(); //buildXMapkitviewer(); setVisible(true); return selectedPlace; //return returnPlace; } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); contentPane.setPreferredSize(new Dimension(1200, 700)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonOK = new JButton(); this.$$$loadButtonText$$$(buttonOK, this.$$$getMessageFromBundle$$$("translations/program_strings", "mpv.okbtn")); panel2.add(buttonOK, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonCancel = new JButton(); this.$$$loadButtonText$$$(buttonCancel, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.close")); panel2.add(buttonCancel, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonLocation = new JButton(); this.$$$loadButtonText$$$(buttonLocation, this.$$$getMessageFromBundle$$$("translations/program_strings", "mpv.locationbtn")); panel2.add(buttonLocation, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JSplitPane splitPane1 = new JSplitPane(); panel3.add(splitPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, 200), null, 0, false)); final JPanel panel4 = new JPanel(); panel4.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1)); panel4.setPreferredSize(new Dimension(350, -1)); splitPane1.setRightComponent(panel4); final JScrollPane scrollPane1 = new JScrollPane(); scrollPane1.setHorizontalScrollBarPolicy(30); panel4.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); searchResultstable = new JTable(); searchResultstable.setAutoResizeMode(0); searchResultstable.setPreferredScrollableViewportSize(new Dimension(400, 400)); scrollPane1.setViewportView(searchResultstable); final JPanel panel5 = new JPanel(); panel5.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); panel4.add(panel5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label1 = new JLabel(); this.$$$loadLabelText$$$(label1, this.$$$getMessageFromBundle$$$("translations/program_strings", "mpv.searchlbl")); panel5.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); SearchtextField = new JTextField(); SearchtextField.setToolTipText("<HTML>Eiffel tower OR<br> Downingstreet 10 OR<br> Pennsylvania Avenue Northwest 1600 OR<br>Iguazu Falls"); panel5.add(SearchtextField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 1, false)); searchLocationbutton = new JButton(); this.$$$loadButtonText$$$(searchLocationbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "mpv.searchbtn")); panel5.add(searchLocationbutton, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); final JPanel panel6 = new JPanel(); panel6.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); panel4.add(panel6, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label2 = new JLabel(); this.$$$loadLabelText$$$(label2, this.$$$getMessageFromBundle$$$("translations/program_strings", "mpv.location")); panel6.add(label2); lblDisplay_Name = new JLabel(); lblDisplay_Name.setText(""); panel6.add(lblDisplay_Name); final JPanel panel7 = new JPanel(); panel7.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel4.add(panel7, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label3 = new JLabel(); this.$$$loadLabelText$$$(label3, this.$$$getMessageFromBundle$$$("translations/program_strings", "mpv.lon")); panel7.add(label3); lblLongitude = new JLabel(); lblLongitude.setText(""); panel7.add(lblLongitude); final JPanel panel8 = new JPanel(); panel8.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); panel4.add(panel8, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label4 = new JLabel(); this.$$$loadLabelText$$$(label4, this.$$$getMessageFromBundle$$$("translations/program_strings", "mpv.lat")); panel8.add(label4); lblLatitude = new JLabel(); lblLatitude.setText(""); panel8.add(lblLatitude); MapViewerPane = new JPanel(); MapViewerPane.setLayout(new BorderLayout(0, 0)); MapViewerPane.setPreferredSize(new Dimension(1150, 600)); splitPane1.setLeftComponent(MapViewerPane); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadLabelText$$$(JLabel component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setDisplayedMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPane; } }
33,375
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
JavaImageViewer.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/JavaImageViewer.java
package org.hvdw.jexiftoolgui.view; import org.apache.commons.lang3.ArrayUtils; import org.hvdw.jexiftoolgui.Application; import org.hvdw.jexiftoolgui.MyVariables; import org.hvdw.jexiftoolgui.Utils; import org.hvdw.jexiftoolgui.controllers.ImageFunctions; import org.slf4j.LoggerFactory; import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.Locale; import static org.hvdw.jexiftoolgui.Utils.getCurrentOsName; /** * Version one of this viewer checked if an image was smaller than screen size or not and would show an image in a frame wirh borders at the exact size. * This version simply displays images full screen as 99.9% of all images are bigger than screen size and it makes it easier for previous/next buttons * And one singel view is eaiser for the eyes than a window constantly resizing. */ public class JavaImageViewer { private final static ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(JavaImageViewer.class); public BufferedImage resizedImg = null; public int panelWidth = 0; public int panelHeight = 0; private BufferedImage ResizeImage(File image, int orientation) { int scrwidth = MyVariables.getScreenWidth(); int scrheight = MyVariables.getScreenHeight()-50; Rectangle screenBounds = Utils.getScreenBounds(); try { BufferedImage img = ImageIO.read(new File(image.getPath().replace("\\", "/"))); if (orientation > 1) { resizedImg = ImageFunctions.rotate(img, orientation); resizedImg = ImageFunctions.scaleImageToContainer(resizedImg, screenBounds.width, screenBounds.height); } else { // No rotation necessary resizedImg = ImageFunctions.scaleImageToContainer(img, screenBounds.width, screenBounds.height); } } catch (IOException iex) { logger.error("error in resizing the image {}", iex); } return resizedImg; } /* / This method is used from inside the viewer when one of the previous/next buttons are clicked */ private void LoadShowImage(JLabel ImgLabel, JLabel infoLabel, String whichaction) { int newindex; boolean bde = false; int[] basicdata = {0, 0, 999, 0, 0, 0, 0, 0}; File image = MyVariables.getCurrentFileInViewer(); File[] files = MyVariables.getLoadedFiles(); int curIndex = ArrayUtils.indexOf(files, image); if ("previous".equals(whichaction)) { newindex = curIndex -1; if (newindex < 0) { //newindex = 0; newindex = files.length -1; // loop from first to last; index starts at 0 } } else { newindex = curIndex + 1; if (newindex >= files.length) { newindex = 0; // loop from last to first } } logger.debug("current index {}; new index {}", curIndex, newindex); image = files[newindex]; MyVariables.setCurrentFileInViewer(image); try { basicdata = ImageFunctions.getImageMetaData(image); } catch (NullPointerException npe) { npe.printStackTrace(); bde = true; } if (bde) { // We had some error. Mostly this is the orientation basicdata[2]= 1; } String fileName = image.getName(); String imginfo = Utils.returnBasicImageDataString(fileName, "OneLineHtml"); infoLabel.setText(imginfo); BufferedImage resizedImg = ResizeImage(image, basicdata[2]); ImageIcon icon = new ImageIcon(resizedImg); ImgLabel.setIcon(icon); } /* / This method deals with next and previous buttons and also Esc(ape) */ public class ArrowAction extends AbstractAction { private String cmd; private JFrame frame; private JLabel ImgLabel; private JLabel infoLabel; public ArrowAction(String cmd, JFrame frame, JLabel ImgLabel, JLabel infoLabel) { this.cmd = cmd; this.frame = frame; this.ImgLabel = ImgLabel; this.infoLabel = infoLabel; } @Override public void actionPerformed(ActionEvent e) { if (cmd.equalsIgnoreCase("Escape")) { logger.debug("The Escape key was pressed!"); frame.dispose(); } else if (cmd.equalsIgnoreCase("LeftArrow")) { logger.debug("The left arrow was pressed!"); LoadShowImage(ImgLabel, infoLabel, "previous"); } else if (cmd.equalsIgnoreCase("RightArrow")) { logger.debug("The right arrow was pressed!"); LoadShowImage(ImgLabel, infoLabel, "next"); /*} else if (cmd.equalsIgnoreCase("UpArrow")) { logger.info("The up arrow was pressed!"); } else if (cmd.equalsIgnoreCase("DownArrow")) { logger.info("The down arrow was pressed!"); */ } } } /** * This is the full screen imageviewer. Currently with close/previous/next buttons. * Later we might make it a time based slideshow also with pause play buttons. **/ public void ViewImageInFullscreenFrame (boolean isSlideshow) { BufferedImage img = null; String fileName = ""; File image = null; boolean frameborder = false; String ImgPath = MyVariables.getSelectedImagePath(); image = new File(ImgPath); MyVariables.setCurrentFileInViewer(image); fileName = image.getName(); Application.OS_NAMES currentOsName = getCurrentOsName(); String filenameExt = Utils.getFileExtension(MyVariables.getSelectedImagePath()); if (filenameExt.toLowerCase().equals("heic") || filenameExt.toLowerCase().equals("heif")) { //We should have a converted jpg in the tempwork folder String tmpfilename = fileName.substring(0, fileName.lastIndexOf('.')) + ".jpg"; image = new File(MyVariables.gettmpWorkFolder() + File.separator + tmpfilename); logger.info("In ViewImageInFullscreenFrame trying a heic"); } try { img = ImageIO.read(image); } catch (IOException ioe) { logger.error("error loading image {}", ioe.toString()); } JFrame frame = new JFrame(fileName); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); frame.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel imageViewPane = new JPanel(); frame.setContentPane(imageViewPane); frame.setIconImage(Utils.getFrameIcon()); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception weTried) { logger.error("Could not set getSystemLookAndFeelClassName.", weTried); } /* Get screen size */ int[] resolution = Utils.getResolution(); int[] basicdata = {0, 0, 9999, 0, 0, 0, 0, 0}; boolean bde = false; try { basicdata = ImageFunctions.getImageMetaData(image); } catch (NullPointerException npe) { npe.printStackTrace(); bde = true; } if (bde) { // We had some error. Mostly this is the orientation basicdata[2] = 1; } resizedImg = ResizeImage(image, basicdata[2]); String imginfo = Utils.returnBasicImageDataString(fileName, "OneLineHtml"); frame.setTitle(Utils.returnBasicImageDataString(fileName, "OneLine")); JPanel thePanel = new JPanel(new BorderLayout()); thePanel.setBackground(Color.white); thePanel.setOpaque(true); JLabel ImgLabel = new JLabel(); ImgLabel.setHorizontalAlignment(JLabel.CENTER); ImgLabel.setVerticalAlignment(JLabel.CENTER); // Create the top info panel JPanel InfoPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); //InfoPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); JLabel infoLabel = new JLabel(); infoLabel.setText(imginfo); InfoPanel.add(infoLabel); InfoPanel.setPreferredSize(new Dimension(MyVariables.getScreenWidth() - 100, 25)); //create the bottom button panel JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); JButton btnClose = new JButton(); btnClose.setIcon(new ImageIcon(getClass().getResource("/icons/baseline_stop_black_24dp.png"))); //btnClose.setIcon(new ImageIcon(getClass().getResource("/icons/outline_stop_black_24dp.png"))); btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.dispose(); } }); // stop button for slideshow JButton btnStop = new JButton(); btnStop.setIcon(new ImageIcon(getClass().getResource("/icons/outline_stop_black_24dp.png"))); btnStop.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.dispose(); } }); JButton btnSkipPrevious = new JButton(); btnSkipPrevious.setIcon(new ImageIcon(getClass().getResource("/icons/baseline_skip_previous_black_24dp.png"))); //btnSkipPrevious.setIcon(new ImageIcon(getClass().getResource("/icons/outline_skip_previous_black_24dp.png"))); btnSkipPrevious.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { LoadShowImage(ImgLabel, infoLabel,"previous"); } }); // play button for slide show JButton btnPlay = new JButton(); btnPlay.setIcon(new ImageIcon(getClass().getResource("/icons/baseline_play_arrow_black_24dp.png"))); //btnPlay.setIcon(new ImageIcon(getClass().getResource("/icons/outline_play_arrow_black_24dp.png"))); // pause button for slide show JButton btnPause = new JButton(); btnPause.setIcon(new ImageIcon(getClass().getResource("/icons/baseline_pause_black_24dp.png"))); //btnPause.setIcon(new ImageIcon(getClass().getResource("/icons/outline_pause_black_24dp.png"))); JButton btnSkipNext = new JButton(); btnSkipNext.setIcon(new ImageIcon(getClass().getResource("/icons/baseline_skip_next_black_24dp.png"))); //btnSkipNext.setIcon(new ImageIcon(getClass().getResource("/icons/outline_skip_next_black_24dp.png"))); btnSkipNext.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { LoadShowImage(ImgLabel, infoLabel, "next"); } }); if (isSlideshow) { buttonPanel.add(btnClose); buttonPanel.add(btnSkipPrevious); buttonPanel.add(btnPause); buttonPanel.add(btnPlay); buttonPanel.add(btnSkipNext); buttonPanel.setPreferredSize(new Dimension(125, 45)); } else { buttonPanel.add(btnClose); buttonPanel.add(btnSkipPrevious); buttonPanel.add(btnSkipNext); buttonPanel.setPreferredSize(new Dimension(75, 45)); } // Create keybindings. No issues with focusing like the keylistener InputMap im = imageViewPane.getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW); ActionMap am = imageViewPane.getActionMap(); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "Escape"); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), "RightArrow"); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), "LeftArrow"); //im.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "UpArrow"); //im.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "DownArrow"); am.put("Escape", new ArrowAction("Escape", frame, ImgLabel, infoLabel)); am.put("RightArrow", new ArrowAction("RightArrow", frame, ImgLabel, infoLabel)); am.put("LeftArrow", new ArrowAction("LeftArrow", frame, ImgLabel, infoLabel)); //am.put("UpArrow", new ArrowAction("UpArrow", frame, ImgLabel, infoLabel)); //am.put("DownArrow", new ArrowAction("DownArrow", frame, ImgLabel, infoLabel)); // End of the key bindings Rectangle screenBounds = Utils.getScreenBounds(); thePanel.add(InfoPanel, BorderLayout.PAGE_START); ImageIcon icon = new ImageIcon(resizedImg); ImgLabel.setIcon(icon); thePanel.add(ImgLabel, BorderLayout.CENTER); thePanel.add(buttonPanel, BorderLayout.PAGE_END); //thePanel.setPreferredSize(new Dimension(panelWidth, panelHeight)); thePanel.setPreferredSize(new Dimension(screenBounds.width, screenBounds.height - 30)); frame.add(thePanel); frame.setLocation(0,0); frame.pack(); frame.setVisible(true); } }
13,474
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
SelectmyLens.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/SelectmyLens.java
package org.hvdw.jexiftoolgui.view; import ch.qos.logback.classic.Logger; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import org.hvdw.jexiftoolgui.MyVariables; import org.hvdw.jexiftoolgui.controllers.SQLiteJDBC; import org.hvdw.jexiftoolgui.editpane.EditLensdata; import org.hvdw.jexiftoolgui.model.Lenses; import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.table.DefaultTableModel; import java.awt.*; import java.awt.event.*; import java.io.File; import java.lang.reflect.Method; import java.util.List; import java.util.ArrayList; import java.util.Locale; import java.util.ResourceBundle; public class SelectmyLens extends JDialog { private JPanel contentPane; private JScrollPane scrollPane; private JTable lensnametable; private JButton OKbutton; private JButton Cancelbutton; private JButton Deletebutton; private JLabel selectLensTopText; private String lensname = ""; private String queryresult = ""; private JPanel rp; private final static Logger logger = (Logger) LoggerFactory.getLogger(SelectmyLens.class); private final String loadLensTxt = "<html>" + ResourceBundle.getBundle("translations/program_strings").getString("sellens.loadlenstxt") + "<br><br></html>"; private final String deleteLensTxt = "<html>" + ResourceBundle.getBundle("translations/program_strings").getString("sellens.deletelenstxt") + "<br><br></html>"; public SelectmyLens() { setContentPane(contentPane); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); contentPane.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); setModal(true); getRootPane().setDefaultButton(OKbutton); // Only active on load lens OKbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { setVisible(false); dispose(); } }); Cancelbutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { setVisible(false); dispose(); } }); // Only active on delete lens Deletebutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { logger.info("lens selected for deletion -{}-", lensname); EditLensdata Edl = new EditLensdata(); Edl.deletelensconfig(contentPane, lensname); setVisible(false); dispose(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); // mouse/table listener lensnametable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); DefaultTableModel model = (DefaultTableModel) lensnametable.getModel(); int selectedRowIndex = lensnametable.getSelectedRow(); MyVariables.setselectedLensConfig(model.getValueAt(selectedRowIndex, 0).toString()); lensname = model.getValueAt(selectedRowIndex, 0).toString(); } }); } private void onCancel() { // add your code here if necessary setVisible(false); dispose(); } public String showDialog(JPanel rootpanel, String action) { pack(); //setLocationRelativeTo(null); rp = rootpanel; setLocationByPlatform(true); List<File> lensnames = new ArrayList<File>(); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("selectlens.title")); if ("load lens".equals(action)) { selectLensTopText.setText(loadLensTxt); OKbutton.setVisible(true); OKbutton.setEnabled(true); Deletebutton.setVisible(false); Deletebutton.setEnabled(false); } else { //Action is to delete the lens selectLensTopText.setText(deleteLensTxt); OKbutton.setVisible(false); OKbutton.setEnabled(false); Deletebutton.setVisible(true); Deletebutton.setEnabled(true); } // Make table readonly lensnametable.setDefaultEditor(Object.class, null); // Get current defined lenses lensnames = Lenses.loadlensnames(); logger.info("retrieved lensnames: " + lensnames); Lenses.displaylensnames(lensnames, lensnametable); setVisible(true); return lensname; } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(1, 1, new Insets(15, 15, 15, 15), -1, -1)); contentPane.setPreferredSize(new Dimension(700, 300)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), 5, 5)); panel1.add(panel2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label1 = new JLabel(); this.$$$loadLabelText$$$(label1, this.$$$getMessageFromBundle$$$("translations/program_strings", "sellens.currentlenses")); panel2.add(label1, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); scrollPane = new JScrollPane(); panel2.add(scrollPane, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); lensnametable = new JTable(); scrollPane.setViewportView(lensnametable); selectLensTopText = new JLabel(); selectLensTopText.setText("<html>Select a row from the table to select and load an existing lens configuration.<br><br></html>"); panel1.add(selectLensTopText, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(450, -1), null, 0, false)); final JPanel panel3 = new JPanel(); panel3.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5)); panel1.add(panel3, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); Deletebutton = new JButton(); this.$$$loadButtonText$$$(Deletebutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.delete")); panel3.add(Deletebutton); OKbutton = new JButton(); this.$$$loadButtonText$$$(OKbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.ok")); panel3.add(OKbutton); Cancelbutton = new JButton(); this.$$$loadButtonText$$$(Cancelbutton, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.cancel")); panel3.add(Cancelbutton); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadLabelText$$$(JLabel component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setDisplayedMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPane; } }
11,456
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
SearchMetadataDialog.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/view/SearchMetadataDialog.java
package org.hvdw.jexiftoolgui.view; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import org.hvdw.jexiftoolgui.MyVariables; import org.hvdw.jexiftoolgui.ProgramTexts; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.lang.reflect.Method; import java.util.Locale; import java.util.ResourceBundle; public class SearchMetadataDialog extends JDialog { private JPanel contentPane; private JButton buttonOK; private JButton buttonCancel; private JTextField searchPhraseTextField; private JLabel searchMDexplanation; private JPanel searchmetadataPanel; String searchPhrase = ""; public SearchMetadataDialog() { setContentPane(contentPane); Locale currentLocale = new Locale.Builder().setLocale(MyVariables.getCurrentLocale()).build(); contentPane.applyComponentOrientation(ComponentOrientation.getOrientation(currentLocale)); setModal(true); getRootPane().setDefaultButton(buttonOK); buttonOK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onOK(); } }); buttonCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); } private void onOK() { searchPhrase = searchPhraseTextField.getText().trim(); dispose(); } private void onCancel() { searchPhrase = ""; dispose(); } public String displayDialog(JPanel rootPanel) { searchMDexplanation.setText(String.format(ProgramTexts.HTML, 325, ResourceBundle.getBundle("translations/program_strings").getString("smd.dlgtext"))); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("smd.dlgtitle")); setLocationByPlatform(true); pack(); setVisible(true); return searchPhrase; } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); buttonOK = new JButton(); this.$$$loadButtonText$$$(buttonOK, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.ok")); panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); buttonCancel = new JButton(); this.$$$loadButtonText$$$(buttonCancel, this.$$$getMessageFromBundle$$$("translations/program_strings", "dlg.cancel")); panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); searchmetadataPanel = new JPanel(); searchmetadataPanel.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPane.add(searchmetadataPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(375, -1), null, 1, false)); searchPhraseTextField = new JTextField(); searchmetadataPanel.add(searchPhraseTextField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final Spacer spacer2 = new Spacer(); searchmetadataPanel.add(spacer2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); searchMDexplanation = new JLabel(); searchMDexplanation.setText("Label"); searchmetadataPanel.add(searchMDexplanation, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); } private static Method $$$cachedGetBundleMethod$$$ = null; private String $$$getMessageFromBundle$$$(String path, String key) { ResourceBundle bundle; try { Class<?> thisClass = this.getClass(); if ($$$cachedGetBundleMethod$$$ == null) { Class<?> dynamicBundleClass = thisClass.getClassLoader().loadClass("com.intellij.DynamicBundle"); $$$cachedGetBundleMethod$$$ = dynamicBundleClass.getMethod("getBundle", String.class, Class.class); } bundle = (ResourceBundle) $$$cachedGetBundleMethod$$$.invoke(null, path, thisClass); } catch (Exception e) { bundle = ResourceBundle.getBundle(path); } return bundle.getString(key); } /** * @noinspection ALL */ private void $$$loadButtonText$$$(AbstractButton component, String text) { StringBuffer result = new StringBuffer(); boolean haveMnemonic = false; char mnemonic = '\0'; int mnemonicIndex = -1; for (int i = 0; i < text.length(); i++) { if (text.charAt(i) == '&') { i++; if (i == text.length()) break; if (!haveMnemonic && text.charAt(i) != '&') { haveMnemonic = true; mnemonic = text.charAt(i); mnemonicIndex = result.length(); } } result.append(text.charAt(i)); } component.setText(result.toString()); if (haveMnemonic) { component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(mnemonicIndex); } } /** * @noinspection ALL */ public JComponent $$$getRootComponent$$$() { return contentPane; } }
8,245
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z
IPreferencesFacade.java
/FileExtraction/Java_unseen/hvdwolf_jExifToolGUI/src/main/java/org/hvdw/jexiftoolgui/facades/IPreferencesFacade.java
package org.hvdw.jexiftoolgui.facades; public interface IPreferencesFacade { enum PreferenceKey { USE_LAST_OPENED_FOLDER("uselastopenedfolder"), LAST_OPENED_FOLDER("lastopenedfolder"), DEFAULT_START_FOLDER("defaultstartfolder"), ARTIST("artist"), // xmp-dc:creator, exif:artist, iptc:by-line COPYRIGHTS("copyrights"), // xmp-dc:rights, exif:Copyright, iptc:copyrightnotice CREDIT("credit"), // xmp-photoshop:credit, iptc:credit VERSION_CHECK("versioncheck"), LAST_APPLICATION_VERSION("applicationVersion"), EXIFTOOL_PATH("exiftool"), METADATA_LANGUAGE("metadatalanguage"), RAW_VIEWER_PATH("rawviewer"), RAW_VIEWER_ALL_IMAGES("rawviewerallimages"), PREFERRED_APP_LANGUAGE("System default"), PREFERRED_FILEDIALOG("jfilechooser"), LOG_LEVEL("loglevel"), SHOW_DECIMAL_DEGREES("showdecimaldegrees"), // exiftool shows coordinates by default as Deg Min Sec USE_G1_GROUP ("useg1group"), USER_DEFINED_FILE_FILTER("userdefinedfilefilter"), PRESERVE_MODIFY_DATE("preservemodifydate"), DUAL_COLUMN("dualcolumn"), GUI_WIDTH("guiwidth"), //rootpanel width GUI_HEIGHT("guiheight"), //rootpanel height SPLITPANEL_POSITION("splitpanelpostion"), //percentual position left/right splitpane LATITUDE("latitude"), // latitude for mapviewer screen LONGITUDE("longitude"), SORT_CATEGORIES_TAGS("sortcategoriestags"), ENABLE_STRUCTS("enable_struct_output"), USER_DEFINED_FONT("userdefinedfont"), USER_DEFINED_FONTSIZE("userdefinedfontsize") ; public final String key; PreferenceKey(String key) { this.key = key; } } boolean keyIsSet(PreferenceKey key); String getByKey(PreferenceKey key, int i); String getByKey(PreferenceKey key, String defaultValue); boolean getByKey(PreferenceKey key, boolean defaultValue); void storeByKey(PreferenceKey key, String value); void storeByKey(PreferenceKey key, boolean value); IPreferencesFacade defaultInstance = PreferencesFacade.thisFacade; }
2,179
Java
.java
hvdwolf/jExifToolGUI
421
35
33
2019-05-17T13:36:07Z
2023-12-11T23:08:29Z