├── imagemagick ├── win32 │ ├── config │ │ └── hack.txt │ ├── X11.dll │ ├── convert.exe │ ├── CORE_RL_png_.dll │ ├── CORE_RL_ttf_.dll │ ├── CORE_RL_bzlib_.dll │ ├── CORE_RL_jpeg_.dll │ ├── CORE_RL_lcms_.dll │ ├── CORE_RL_tiff_.dll │ ├── CORE_RL_zlib_.dll │ ├── CORE_RL_magick_.dll │ ├── modules │ │ ├── IM_MOD_RL_bmp_.dll │ │ ├── IM_MOD_RL_gif_.dll │ │ ├── IM_MOD_RL_png_.dll │ │ ├── IM_MOD_RL_psd_.dll │ │ ├── IM_MOD_RL_jpeg_.dll │ │ ├── IM_MOD_RL_pict_.dll │ │ └── modules.mgk │ └── im.properties ├── HOWTO ├── im.properties.preinstalled ├── macos │ └── im.properties ├── im.properties.applet └── LICENSE ├── img ├── Copy16.gif ├── Cut16.gif ├── Down16.gif ├── New16.gif ├── Open16.gif ├── Save16.gif ├── Stop16.gif ├── Up16.gif ├── Delete16.gif ├── Paste16.gif ├── computer.gif ├── default.gif ├── FlipHoriz24.gif ├── uploading.gif ├── Information16.gif ├── Preferences16.gif ├── RotateLeft24.gif ├── RotateRight24.gif ├── WebComponent16.gif └── WebComponentAdd16.gif ├── lib ├── junit.jar ├── httpcore.jar ├── httpmime.jar ├── JSX1.0.7.4.jar ├── httpclient.jar ├── jarbundler.jar ├── json_simple.jar ├── junit-dep.jar ├── xstream-1.3.jar ├── commons-codec.jar ├── JavaApplicationStub ├── commons-logging.jar ├── saverbeans-ant.jar ├── saverbeans-api.jar ├── AppleJavaExtensions.jar ├── commons-logging-api.jar └── metadata-extractor-2.1.jar ├── rar_icon_16.gif ├── rar_icon_32.gif ├── rar_about_gr1.png ├── rar_icon_128_gr1.icns ├── jpegtran ├── linux │ ├── jpegtran │ └── jpegtran.properties ├── macos │ ├── jpegtran │ └── jpegtran.properties ├── win32 │ ├── jpegtran.exe │ └── jpegtran.properties ├── jpegtran.preinstalled └── jpegtran.properties.applet ├── AppletExcludes.txt ├── com └── gallery │ └── GalleryRemote │ ├── resources │ ├── GRResources_en.properties │ ├── GRResources.properties │ └── GRResources_ca.properties │ ├── PictureSelection.java │ ├── prefs │ ├── PreferencesDialog.java │ ├── panes_applet.properties │ ├── panes.properties │ ├── PreferencePanel.java │ ├── QuickConfigPanel.java │ ├── ProxyPanel.java │ ├── PreferenceNames.java │ ├── GalleryEditorDialog.java │ └── URLPanel.java │ ├── CancellableTransferListener.java │ ├── NewAlbumDialogUnitTest.java │ ├── insecureutil │ └── UnsignedTest.java │ ├── model │ ├── ExifData.java │ └── GalleryItem.java │ ├── GalleryRemoteCore.java │ ├── util │ ├── PrivateShutdown.java │ ├── BrowserLink.java │ ├── DialogUtil.java │ ├── OsShutdown.java │ ├── UrlMessageDialog.java │ ├── NaturalOrderComparator.java │ ├── ColorWellButton.java │ ├── MacOSXAdapter.java │ ├── ExifImageUtils.java │ ├── GRI18n.java │ └── HTMLEscaper.java │ ├── GR2Exception.java │ ├── GalleryRemoteMini.java │ ├── AddFileDialog.java │ ├── GalleryCommCapabilities.java │ ├── StatusUpdateAdapter.java │ ├── StatusUpdate.java │ ├── GalleryFileFilter.java │ ├── GalleryCommTest.java │ ├── GalleryComm2Consts.java │ ├── Base64.java │ ├── GalleryRemoteMainFrame.java │ ├── MoveAlbumDialog.java │ ├── GRAppletSlideshow.java │ ├── ThumbnailCache.java │ ├── CoreUtils.java │ ├── AboutBox.java │ ├── Log.java │ ├── StatusBar.java │ └── GRApplet.java ├── magick.reg ├── AppletMiniExcludes.txt ├── ScreenSaverExcludes.txt ├── deploy.sh ├── ReadMe.html ├── gal_remote_proto-2.html ├── ApertureToGallery.applescript ├── README └── gallery_remote.jpx /imagemagick/win32/config/hack.txt: -------------------------------------------------------------------------------- 1 | so CVS creates the directory -------------------------------------------------------------------------------- /img/Copy16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/Copy16.gif -------------------------------------------------------------------------------- /img/Cut16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/Cut16.gif -------------------------------------------------------------------------------- /img/Down16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/Down16.gif -------------------------------------------------------------------------------- /img/New16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/New16.gif -------------------------------------------------------------------------------- /img/Open16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/Open16.gif -------------------------------------------------------------------------------- /img/Save16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/Save16.gif -------------------------------------------------------------------------------- /img/Stop16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/Stop16.gif -------------------------------------------------------------------------------- /img/Up16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/Up16.gif -------------------------------------------------------------------------------- /lib/junit.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/junit.jar -------------------------------------------------------------------------------- /img/Delete16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/Delete16.gif -------------------------------------------------------------------------------- /img/Paste16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/Paste16.gif -------------------------------------------------------------------------------- /img/computer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/computer.gif -------------------------------------------------------------------------------- /img/default.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/default.gif -------------------------------------------------------------------------------- /lib/httpcore.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/httpcore.jar -------------------------------------------------------------------------------- /lib/httpmime.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/httpmime.jar -------------------------------------------------------------------------------- /rar_icon_16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/rar_icon_16.gif -------------------------------------------------------------------------------- /rar_icon_32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/rar_icon_32.gif -------------------------------------------------------------------------------- /img/FlipHoriz24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/FlipHoriz24.gif -------------------------------------------------------------------------------- /img/uploading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/uploading.gif -------------------------------------------------------------------------------- /lib/JSX1.0.7.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/JSX1.0.7.4.jar -------------------------------------------------------------------------------- /lib/httpclient.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/httpclient.jar -------------------------------------------------------------------------------- /lib/jarbundler.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/jarbundler.jar -------------------------------------------------------------------------------- /lib/json_simple.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/json_simple.jar -------------------------------------------------------------------------------- /lib/junit-dep.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/junit-dep.jar -------------------------------------------------------------------------------- /lib/xstream-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/xstream-1.3.jar -------------------------------------------------------------------------------- /rar_about_gr1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/rar_about_gr1.png -------------------------------------------------------------------------------- /img/Information16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/Information16.gif -------------------------------------------------------------------------------- /img/Preferences16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/Preferences16.gif -------------------------------------------------------------------------------- /img/RotateLeft24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/RotateLeft24.gif -------------------------------------------------------------------------------- /img/RotateRight24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/RotateRight24.gif -------------------------------------------------------------------------------- /lib/commons-codec.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/commons-codec.jar -------------------------------------------------------------------------------- /rar_icon_128_gr1.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/rar_icon_128_gr1.icns -------------------------------------------------------------------------------- /img/WebComponent16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/WebComponent16.gif -------------------------------------------------------------------------------- /jpegtran/linux/jpegtran: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/jpegtran/linux/jpegtran -------------------------------------------------------------------------------- /jpegtran/macos/jpegtran: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/jpegtran/macos/jpegtran -------------------------------------------------------------------------------- /lib/JavaApplicationStub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/JavaApplicationStub -------------------------------------------------------------------------------- /lib/commons-logging.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/commons-logging.jar -------------------------------------------------------------------------------- /lib/saverbeans-ant.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/saverbeans-ant.jar -------------------------------------------------------------------------------- /lib/saverbeans-api.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/saverbeans-api.jar -------------------------------------------------------------------------------- /AppletExcludes.txt: -------------------------------------------------------------------------------- 1 | com/gallery/GalleryRemote/insecureutil/* 2 | com/gallery/GalleryRemote/DummyAppletContext* -------------------------------------------------------------------------------- /imagemagick/win32/X11.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/X11.dll -------------------------------------------------------------------------------- /img/WebComponentAdd16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/img/WebComponentAdd16.gif -------------------------------------------------------------------------------- /imagemagick/win32/convert.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/convert.exe -------------------------------------------------------------------------------- /jpegtran/win32/jpegtran.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/jpegtran/win32/jpegtran.exe -------------------------------------------------------------------------------- /lib/AppleJavaExtensions.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/AppleJavaExtensions.jar -------------------------------------------------------------------------------- /lib/commons-logging-api.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/commons-logging-api.jar -------------------------------------------------------------------------------- /lib/metadata-extractor-2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/lib/metadata-extractor-2.1.jar -------------------------------------------------------------------------------- /imagemagick/win32/CORE_RL_png_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/CORE_RL_png_.dll -------------------------------------------------------------------------------- /imagemagick/win32/CORE_RL_ttf_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/CORE_RL_ttf_.dll -------------------------------------------------------------------------------- /imagemagick/win32/CORE_RL_bzlib_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/CORE_RL_bzlib_.dll -------------------------------------------------------------------------------- /imagemagick/win32/CORE_RL_jpeg_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/CORE_RL_jpeg_.dll -------------------------------------------------------------------------------- /imagemagick/win32/CORE_RL_lcms_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/CORE_RL_lcms_.dll -------------------------------------------------------------------------------- /imagemagick/win32/CORE_RL_tiff_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/CORE_RL_tiff_.dll -------------------------------------------------------------------------------- /imagemagick/win32/CORE_RL_zlib_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/CORE_RL_zlib_.dll -------------------------------------------------------------------------------- /imagemagick/win32/CORE_RL_magick_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/CORE_RL_magick_.dll -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/resources/GRResources_en.properties: -------------------------------------------------------------------------------- 1 | Location: http://gallery.menalto.com/modules.php?oCommon.translator=Pierre-Luc Paour -------------------------------------------------------------------------------- /imagemagick/win32/modules/IM_MOD_RL_bmp_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/modules/IM_MOD_RL_bmp_.dll -------------------------------------------------------------------------------- /imagemagick/win32/modules/IM_MOD_RL_gif_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/modules/IM_MOD_RL_gif_.dll -------------------------------------------------------------------------------- /imagemagick/win32/modules/IM_MOD_RL_png_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/modules/IM_MOD_RL_png_.dll -------------------------------------------------------------------------------- /imagemagick/win32/modules/IM_MOD_RL_psd_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/modules/IM_MOD_RL_psd_.dll -------------------------------------------------------------------------------- /imagemagick/win32/modules/IM_MOD_RL_jpeg_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/modules/IM_MOD_RL_jpeg_.dll -------------------------------------------------------------------------------- /imagemagick/win32/modules/IM_MOD_RL_pict_.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/imagemagick/win32/modules/IM_MOD_RL_pict_.dll -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/PictureSelection.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/com/gallery/GalleryRemote/PictureSelection.java -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/prefs/PreferencesDialog.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/com/gallery/GalleryRemote/prefs/PreferencesDialog.java -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/resources/GRResources.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/com/gallery/GalleryRemote/resources/GRResources.properties -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/resources/GRResources_ca.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gallery/gallery-remote/master/com/gallery/GalleryRemote/resources/GRResources_ca.properties -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/prefs/panes_applet.properties: -------------------------------------------------------------------------------- 1 | pane.1=com.gallery.GalleryRemote.prefs.GeneralPanel 2 | pane.2=com.gallery.GalleryRemote.prefs.UploadPanel 3 | pane.3=com.gallery.GalleryRemote.prefs.ProxyPanel 4 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/CancellableTransferListener.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote; 2 | 3 | import com.gallery.GalleryRemote.model.Picture; 4 | 5 | /** 6 | * Created by IntelliJ IDEA. 7 | * User: paour 8 | * Date: Jan 20, 2004 9 | */ 10 | public interface CancellableTransferListener { 11 | public boolean dataTransferred(int transferred, int overall, double kbPerSecond, Picture picture); 12 | } 13 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/prefs/panes.properties: -------------------------------------------------------------------------------- 1 | pane.1=com.gallery.GalleryRemote.prefs.GeneralPanel 2 | pane.2=com.gallery.GalleryRemote.prefs.UploadPanel 3 | pane.3=com.gallery.GalleryRemote.prefs.SlideshowPanel 4 | pane.4=com.gallery.GalleryRemote.prefs.URLPanel 5 | #pane.5=com.gallery.GalleryRemote.prefs.ProxyPanel 6 | #pane.6=com.gallery.GalleryRemote.prefs.QuickConfigPanel 7 | #pane.6=com.gallery.GalleryRemote.prefs.FilePanel 8 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/NewAlbumDialogUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote; 2 | 3 | import junit.framework.TestCase; 4 | 5 | /** 6 | * @author brianegge 7 | */ 8 | public class NewAlbumDialogUnitTest extends TestCase { 9 | public void testCharacterReplace() { 10 | assertEquals("a_new_and_exciting_album", NewAlbumDialog.getDefaultName("A new & exciting album")); 11 | assertEquals("fun_times", NewAlbumDialog.getDefaultName("Fun + times")); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /jpegtran/linux/jpegtran.properties: -------------------------------------------------------------------------------- 1 | # should jpegtran support be enabled? 2 | jp.enabled=true 3 | 4 | # should lossless cropping be enabled? 5 | jp.crop.enabled=true 6 | 7 | # path to the executable, including the name of the executable (jpegtran) 8 | # use forward slashes (/) rather than back slashes (\) even on Windows 9 | jp.path=jpegtran/linux/jpegtran 10 | 11 | # ignore error code sent back by the executable 12 | # there's a bug in the Linux Java VM that returns a failed code 13 | # even when the executable sends back a success code... 14 | jp.ignoreErrorCode=false -------------------------------------------------------------------------------- /jpegtran/macos/jpegtran.properties: -------------------------------------------------------------------------------- 1 | # should jpegtran support be enabled? 2 | jp.enabled=true 3 | 4 | # should lossless cropping be enabled? 5 | jp.crop.enabled=false 6 | 7 | # path to the executable, including the name of the executable (jpegtran) 8 | # use forward slashes (/) rather than back slashes (\) even on Windows 9 | jp.path=Contents/MacOS/jpegtran 10 | 11 | # ignore error code sent back by the executable 12 | # there's a bug in the Linux Java VM that returns a failed code 13 | # even when the executable sends back a success code... 14 | jp.ignoreErrorCode=false -------------------------------------------------------------------------------- /jpegtran/win32/jpegtran.properties: -------------------------------------------------------------------------------- 1 | # should jpegtran support be enabled? 2 | jp.enabled=true 3 | 4 | # should lossless cropping be enabled? 5 | jp.crop.enabled=true 6 | 7 | # path to the executable, including the name of the executable (jpegtran) 8 | # use forward slashes (/) rather than back slashes (\) even on Windows 9 | jp.path=jpegtran/win32/jpegtran.exe 10 | 11 | # ignore error code sent back by the executable 12 | # there's a bug in the Linux Java VM that returns a failed code 13 | # even when the executable sends back a success code... 14 | jp.ignoreErrorCode=false -------------------------------------------------------------------------------- /jpegtran/jpegtran.preinstalled: -------------------------------------------------------------------------------- 1 | # should jpegtran support be enabled? 2 | jp.enabled=true 3 | 4 | # should lossless cropping be enabled? 5 | jp.crop.enabled=true 6 | 7 | # path to the executable (must be a fully-qualified path), including the name of the executable (jpegtran) 8 | # use forward slashes (/) rather than back slashes (\) even on Windows 9 | jp.path=jpegtran 10 | 11 | # ignore error code sent back by the executable 12 | # there's a bug in the Linux Java VM that returns a failed code 13 | # even when the executable sends back a success code... 14 | jp.ignoreErrorCode=true -------------------------------------------------------------------------------- /jpegtran/jpegtran.properties.applet: -------------------------------------------------------------------------------- 1 | # should jpegtran support be enabled? 2 | jp.enabled=true 3 | 4 | # path to the executable (must be a fully-qualified path), including the name of the executable (jpegtran) 5 | # use forward slashes (/) rather than back slashes (\) even on Windows 6 | jp.path=jpegtran 7 | 8 | # should lossless cropping be enabled? 9 | jp.crop.enabled=false 10 | 11 | # ignore error code sent back by the executable 12 | # there's a bug in the Linux Java VM that returns a failed code 13 | # even when the executable sends back a success code... 14 | jp.ignoreErrorCode=true -------------------------------------------------------------------------------- /magick.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_LOCAL_MACHINE\SOFTWARE\ImageMagick] 4 | 5 | [HKEY_LOCAL_MACHINE\SOFTWARE\ImageMagick\5.4.8] 6 | 7 | [HKEY_LOCAL_MACHINE\SOFTWARE\ImageMagick\5.4.8\Q:16] 8 | "ApplicationDefaultsPath"="@PATH@\\config" 9 | "BinPath"="@PATH@" 10 | "LibPath"="@PATH@" 11 | "ModulesPath"="@PATH@\\modules" 12 | "SharePath"="@PATH@\\config" 13 | 14 | [HKEY_LOCAL_MACHINE\SOFTWARE\ImageMagick\Current] 15 | "Version"="5.4.8" 16 | "QuantumDepth"=dword:00000010 17 | "ApplicationDefaultsPath"="@PATH@\\config" 18 | "BinPath"="@PATH@" 19 | "LibPath"="@PATH@" 20 | "ModulesPath"="@PATH@\\modules" 21 | "SharePath"="@PATH@\\config" 22 | 23 | toto@PATH@tata -------------------------------------------------------------------------------- /AppletMiniExcludes.txt: -------------------------------------------------------------------------------- 1 | com/gallery/GalleryRemote/prefs/FilePanel* 2 | com/gallery/GalleryRemote/prefs/GeneralPanel* 3 | com/gallery/GalleryRemote/prefs/ProxyPanel* 4 | com/gallery/GalleryRemote/prefs/QuickConfigPanel* 5 | com/gallery/GalleryRemote/prefs/UploadPanel* 6 | com/gallery/GalleryRemote/prefs/URLPanel* 7 | com/gallery/GalleryRemote/prefs/*Dialog* 8 | 9 | com/gallery/GalleryRemote/util/MacOSXAdapter* 10 | com/gallery/GalleryRemote/util/NaturalOrderComparator* 11 | com/gallery/GalleryRemote/util/PostChangeLog* 12 | 13 | com/gallery/GalleryRemote/AboutBox* 14 | com/gallery/GalleryRemote/*Inspector* 15 | com/gallery/GalleryRemote/DroppableTree* 16 | com/gallery/GalleryRemote/GalleryRemoteMainFrame* 17 | com/gallery/GalleryRemote/MainFrame* 18 | com/gallery/GalleryRemote/MoveAlbumDialog* 19 | com/gallery/GalleryRemote/NewAlbumDialog* 20 | com/gallery/GalleryRemote/Update* 21 | 22 | rar_* 23 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/insecureutil/UnsignedTest.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.insecureutil; 2 | 3 | import com.gallery.GalleryRemote.Log; 4 | 5 | import java.io.BufferedWriter; 6 | import java.io.FileWriter; 7 | import java.io.File; 8 | 9 | public class UnsignedTest { 10 | public static final String MODULE = "UnsignedTest"; 11 | 12 | public static void createFile() { 13 | // if this code is not signed, the expectation is that the following will 14 | // throw an exception and not create the file 15 | try { 16 | BufferedWriter writer = new BufferedWriter( 17 | new FileWriter(new File(System.getProperty("java.io.tmpdir"), "GalleryRemoteUnsignedTest.txt"))); 18 | 19 | writer.write("Obviously the file was created"); 20 | writer.close(); 21 | } catch (Throwable e) { 22 | Log.log(Log.LEVEL_TRACE, MODULE, "Error creating the file, this is expected"); 23 | Log.logException(Log.LEVEL_TRACE, MODULE, e); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/model/ExifData.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.model; 2 | 3 | import com.gallery.GalleryRemote.util.ImageUtils; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * Created by IntelliJ IDEA. 9 | * User: paour 10 | * Date: Sep 8, 2004 11 | * Time: 11:00:25 AM 12 | */ 13 | public class ExifData { 14 | String caption; 15 | Date creationDate; 16 | ImageUtils.AngleFlip targetOrientation; 17 | 18 | public String getCaption() { 19 | return caption; 20 | } 21 | 22 | public void setCaption(String caption) { 23 | this.caption = caption; 24 | } 25 | 26 | public Date getCreationDate() { 27 | return creationDate; 28 | } 29 | 30 | public void setCreationDate(Date creationDate) { 31 | this.creationDate = creationDate; 32 | } 33 | 34 | public ImageUtils.AngleFlip getTargetOrientation() { 35 | return targetOrientation; 36 | } 37 | 38 | public void setTargetOrientation(ImageUtils.AngleFlip targetOrientation) { 39 | this.targetOrientation = targetOrientation; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/prefs/PreferencePanel.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.prefs; 2 | 3 | import com.gallery.GalleryRemote.MainFrame; 4 | 5 | import javax.swing.*; 6 | 7 | /** 8 | * Interface for Preference Panels 9 | * User: paour 10 | * Date: May 8, 2003 11 | */ 12 | public abstract class PreferencePanel extends JPanel { 13 | protected JPanel panel = new JPanel(); 14 | protected boolean hasBeenRead = false; 15 | JDialog dialog = null; 16 | 17 | public abstract JLabel getIcon(); 18 | 19 | public boolean isReversible() { 20 | return true; 21 | } 22 | 23 | public abstract void buildUI(); 24 | 25 | public void readPropertiesFirst(PropertiesFile props) { 26 | if (!hasBeenRead) { 27 | hasBeenRead = true; 28 | readProperties(props); 29 | } 30 | } 31 | 32 | public abstract void readProperties(PropertiesFile props); 33 | 34 | public abstract void writeProperties(PropertiesFile props); 35 | 36 | public boolean hasBeenRead() { 37 | return hasBeenRead; 38 | } 39 | 40 | public void setDialog(JDialog dialog) { 41 | this.dialog = dialog; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /imagemagick/HOWTO: -------------------------------------------------------------------------------- 1 | To enable ImageMagick support for your platform, copy the "im.properties" in the 2 | corresponding folder to this folder. You should only need to do this if you got 3 | Gallery Remote from the CVS repository. 4 | 5 | If you already have ImageMagick installed on your system, just rename the 6 | "im.properties.preinstalled" to "im.properties" and set the "imConvertPath" 7 | property to the exact path to the Convert executable in your ImageMagick 8 | installation. 9 | 10 | If you compiled ImageMagick for a platform we don't already have support for, 11 | please get in touch with me at paour@sourceforge.net so we can include your 12 | binaries in our standard distributions. 13 | 14 | Unless Gallery Remote was installed with the installer, you should perform these 15 | post-install steps: 16 | 17 | Win32: 18 | 19 | - in the main gallery_remote directory, run 'ant imReg' 20 | 21 | Linux: 22 | 23 | - ImageMagick is not automatically installed on Linux. You need to download it and 24 | install it yourself, then edit the "im.properties.preinstalled" file to 25 | tell Gallery Remote where it was installed. -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/GalleryRemoteCore.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote; 2 | 3 | import com.gallery.GalleryRemote.model.Picture; 4 | import com.gallery.GalleryRemote.model.Album; 5 | 6 | import javax.swing.*; 7 | import java.util.Iterator; 8 | import java.io.File; 9 | import java.awt.*; 10 | 11 | /** 12 | * Created by IntelliJ IDEA. 13 | * User: paour 14 | * Date: Jan 14, 2004 15 | */ 16 | public interface GalleryRemoteCore { 17 | public void startup(); 18 | 19 | public void shutdown(); 20 | public void shutdown(boolean shutdownOs); 21 | 22 | public void flushMemory(); 23 | public void preloadThumbnails(Iterator pictures); 24 | public Image getThumbnail(Picture p); 25 | public StatusUpdate getMainStatusUpdate(); 26 | 27 | public void thumbnailLoadedNotify(); 28 | public void setInProgress(boolean inProgress); 29 | 30 | public void addPictures(File[] files, int index, boolean select); 31 | public void addPictures(Picture[] pictures, int index, boolean select); 32 | 33 | public DefaultComboBoxModel getGalleries(); 34 | public Album getCurrentAlbum(); 35 | 36 | public JList getPicturesList(); 37 | } 38 | -------------------------------------------------------------------------------- /ScreenSaverExcludes.txt: -------------------------------------------------------------------------------- 1 | com/gallery/GalleryRemote/prefs/FilePanel* 2 | com/gallery/GalleryRemote/prefs/GeneralPanel* 3 | com/gallery/GalleryRemote/prefs/ProxyPanel* 4 | com/gallery/GalleryRemote/prefs/QuickConfigPanel* 5 | com/gallery/GalleryRemote/prefs/UploadgPanel* 6 | com/gallery/GalleryRemote/prefs/URLPanel* 7 | com/gallery/GalleryRemote/prefs/*Dialog* 8 | 9 | com/gallery/GalleryRemote/resources/GRResources_*.properties 10 | 11 | com/gallery/GalleryRemote/util/MacOSXAdapter* 12 | com/gallery/GalleryRemote/util/NaturalOrderComparator* 13 | com/gallery/GalleryRemote/util/OsShutdown* 14 | com/gallery/GalleryRemote/util/PostChangeLog* 15 | edu/stanford/ejalbert/BrowserLauncher* 16 | 17 | com/gallery/GalleryRemote/AboutBox* 18 | com/gallery/GalleryRemote/*Inspector* 19 | com/gallery/GalleryRemote/DroppableTree* 20 | com/gallery/GalleryRemote/GalleryRemoteMainFrame* 21 | com/gallery/GalleryRemote/MainFrame* 22 | com/gallery/GalleryRemote/MoveAlbumDialog* 23 | com/gallery/GalleryRemote/NewAlbumDialog* 24 | com/gallery/GalleryRemote/ThumbnailCache* 25 | com/gallery/GalleryRemote/Update* 26 | com/gallery/GalleryRemote/*Applet* 27 | 28 | rar_* 29 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/util/PrivateShutdown.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.util; 2 | 3 | import com.gallery.GalleryRemote.Log; 4 | import com.gallery.GalleryRemote.util.OsShutdown; 5 | 6 | /** 7 | * Shut down the OS. Idea by Nick77. 8 | * OS names from 9 | * User: paour 10 | * Date: Sep 25, 2003 11 | */ 12 | public class PrivateShutdown { 13 | public static final String MODULE = "Shutdown"; 14 | 15 | public static void shutdown() { 16 | String win9x = "rundll32 user,exitwindows"; 17 | String winNT = "shutdown -s -f -t 01"; 18 | String unix = "shutdown -fh now"; 19 | 20 | String cmd = null; 21 | 22 | if (OsShutdown.isWin9x()) { 23 | cmd = win9x; 24 | } else if (OsShutdown.isWinNT()) { 25 | cmd = winNT; 26 | } else if (OsShutdown.isUnix()) { 27 | cmd = unix; 28 | } else { 29 | Log.log(Log.LEVEL_ERROR, MODULE, "Platform not recognized; shutdown will not be performed"); 30 | } 31 | 32 | exec(cmd); 33 | } 34 | 35 | public static void exec(final String cmd) { 36 | try { 37 | if (cmd != null) { 38 | Log.log(Log.LEVEL_TRACE, MODULE, "Executing " + cmd); 39 | Runtime.getRuntime().exec(cmd); 40 | } 41 | } catch (java.io.IOException io) { 42 | Log.logException(Log.LEVEL_ERROR, MODULE, io); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /imagemagick/win32/im.properties: -------------------------------------------------------------------------------- 1 | # should ImageMagick support be enabled? 2 | im.enabled=true 3 | 4 | # path to the convert executable installed with ImageMagick, including the name of the executable (jpegtran) 5 | # use forward slashes (/) rather than back slashes (\) even on Windows 6 | im.convertPath=convert.exe 7 | 8 | # Filters 9 | # Point 10 | # Box 11 | # Triangle 12 | # Hermite 13 | # Hanning 14 | # Hamming 15 | # Blackman 16 | # Gaussian 17 | # Quadratic 18 | # Cubic 19 | # Catrom 20 | # Mitchell 21 | # Lanczos Default 22 | # Bessel 23 | # Sinc 24 | 25 | # filter used for resize of thumbnails 26 | im.thumbnailResizeFilter=Box 27 | 28 | # filter used for resize of preview 29 | im.previewResizeFilter=Lanczos 30 | 31 | # filter used for resize of upload 32 | im.uploadResizeFilter=Lanczos 33 | 34 | # Formats 35 | # jpg Better for large images 36 | # gif Better for small images (8-bit) 37 | 38 | # filter used for resize of thumbnails 39 | im.thumbnailResizeFormat=gif 40 | 41 | # filter used for resize of preview 42 | im.previewResizeFormat=jpg 43 | 44 | # jpeg quality 45 | im.jpegQuality=80 46 | 47 | # ignore error code sent back by the executable 48 | # there's a bug in the Linux Java VM that returns a failed code 49 | # even when the executable sends back a success code... 50 | im.ignoreErrorCode=false -------------------------------------------------------------------------------- /imagemagick/im.properties.preinstalled: -------------------------------------------------------------------------------- 1 | # should ImageMagick support be enabled? 2 | im.enabled=true 3 | 4 | # path to the convert executable installed with ImageMagick, including the name of the executable (jpegtran) 5 | # use forward slashes (/) rather than back slashes (\) even on Windows 6 | im.convertPath=convert 7 | 8 | # Filters 9 | # Point 10 | # Box 11 | # Triangle 12 | # Hermite 13 | # Hanning 14 | # Hamming 15 | # Blackman 16 | # Gaussian 17 | # Quadratic 18 | # Cubic 19 | # Catrom 20 | # Mitchell 21 | # Lanczos Default 22 | # Bessel 23 | # Sinc 24 | 25 | # filter used for resize of thumbnails 26 | im.thumbnailResizeFilter=Box 27 | 28 | # filter used for resize of preview 29 | im.previewResizeFilter=Lanczos 30 | 31 | # filter used for resize of upload 32 | im.uploadResizeFilter=Lanczos 33 | 34 | # Formats 35 | # jpg Better for large images 36 | # gif Better for small images (8-bit) 37 | 38 | # filter used for resize of thumbnails 39 | im.thumbnailResizeFormat=gif 40 | 41 | # filter used for resize of preview 42 | im.previewResizeFormat=jpg 43 | 44 | # jpeg quality 45 | im.jpegQuality=80 46 | 47 | # ignore error code sent back by the executable 48 | # there's a bug in the Linux Java VM that returns a failed code 49 | # even when the executable sends back a success code... 50 | im.ignoreErrorCode=true -------------------------------------------------------------------------------- /imagemagick/macos/im.properties: -------------------------------------------------------------------------------- 1 | # should ImageMagick support be enabled? 2 | im.enabled=true 3 | 4 | # path to the convert executable installed with ImageMagick, including the name of the executable (jpegtran) 5 | # use forward slashes (/) rather than back slashes (\) even on Windows 6 | im.convertPath=/usr/local/bin/convert 7 | 8 | # Filters 9 | # Point 10 | # Box 11 | # Triangle 12 | # Hermite 13 | # Hanning 14 | # Hamming 15 | # Blackman 16 | # Gaussian 17 | # Quadratic 18 | # Cubic 19 | # Catrom 20 | # Mitchell 21 | # Lanczos Default 22 | # Bessel 23 | # Sinc 24 | 25 | # filter used for resize of thumbnails 26 | im.thumbnailResizeFilter=Box 27 | 28 | # filter used for resize of preview 29 | im.previewResizeFilter=Lanczos 30 | 31 | # filter used for resize of upload 32 | im.uploadResizeFilter=Lanczos 33 | 34 | # Formats 35 | # jpg Better for large images 36 | # gif Better for small images (8-bit) 37 | 38 | # filter used for resize of thumbnails 39 | im.thumbnailResizeFormat=gif 40 | 41 | # filter used for resize of preview 42 | im.previewResizeFormat=jpg 43 | 44 | # jpeg quality 45 | im.jpegQuality=80 46 | 47 | # ignore error code sent back by the executable 48 | # there's a bug in the Linux Java VM that returns a failed code 49 | # even when the executable sends back a success code... 50 | im.ignoreErrorCode=false -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/GR2Exception.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | package com.gallery.GalleryRemote; 23 | 24 | import java.io.IOException; 25 | 26 | /** 27 | * An exception for protocol-related problems. 28 | * 29 | * @author Tim Miller 30 | * @version $id$ 31 | */ 32 | public class GR2Exception extends IOException { 33 | public GR2Exception(String message) { 34 | super(message); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /imagemagick/im.properties.applet: -------------------------------------------------------------------------------- 1 | # should ImageMagick support be enabled? 2 | im.enabled=true 3 | 4 | # path to the convert executable installed with ImageMagick, including the name of the executable (jpegtran) 5 | # use forward slashes (/) rather than back slashes (\) even on Windows 6 | im.convertPath=convert 7 | 8 | # Filters 9 | # Point 10 | # Box 11 | # Triangle 12 | # Hermite 13 | # Hanning 14 | # Hamming 15 | # Blackman 16 | # Gaussian 17 | # Quadratic 18 | # Cubic 19 | # Catrom 20 | # Mitchell 21 | # Lanczos Default 22 | # Bessel 23 | # Sinc 24 | 25 | # filter used for resize of thumbnails 26 | im.thumbnailResizeFilter=Box 27 | 28 | # filter used for resize of preview 29 | im.previewResizeFilter=Lanczos 30 | 31 | # filter used for resize of upload 32 | im.uploadResizeFilter=Lanczos 33 | 34 | # Formats 35 | # jpg Better for large images 36 | # gif Better for small images (8-bit) 37 | 38 | # filter used for resize of thumbnails 39 | im.thumbnailResizeFormat=gif 40 | 41 | # filter used for resize of preview 42 | im.previewResizeFormat=jpg 43 | 44 | # jpeg quality 45 | im.jpegQuality=90 46 | 47 | # ignore error code sent back by the executable 48 | # there's a bug in the Linux Java VM that returns a failed code 49 | # even when the executable sends back a success code... 50 | im.ignoreErrorCode=true -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | # gallery_docs is no longer maintained, don't bother updating it... 2 | #echo -e "Updating docs SVN...\n\n"; 3 | #pushd ../gallery_docs; svn update; popd; 4 | 5 | set ANT=/usr/local/bin/ant; 6 | 7 | echo -e "Updating SVN...\n\n"; 8 | svn update; 9 | 10 | version=`grep version= defaults.properties | awk -F= '{print $2}'`; 11 | echo -e "\n\nVersion: $version\n\n"; 12 | 13 | echo -e "Checking nightly site...\n\n"; 14 | if (lynx -dump -head http://www.gallery2.hu/download/GalleryRemote/gallery_remote_${version}.zip \ 15 | | grep "HTTP/1.1 404") then 16 | echo -e "\n\nWe have a new version."; 17 | 18 | echo -e "\n\nBuilding...\n\n"; 19 | ant nightly; 20 | 21 | echo -e "\n\nUploading to the nightly site...\n\n"; 22 | ncftpput -f gallery2hu.cfg -C gallery_remote.zip gallery_remote_${version}.zip; 23 | ncftpput -f gallery2hu.cfg -C gallery_remote.zip current_gallery_remote.zip; 24 | ncftpput -f gallery2hu.cfg -C gallery_remote_applets.zip gallery_remote_applets_${version}.zip; 25 | ncftpput -f gallery2hu.cfg -C gallery_remote_applets.zip current_gallery_remote_applets.zip; 26 | ncftpput -f gallery2hu.cfg -C GalleryRemote.MacOSX.NoVM.tgz GalleryRemote.${version}.MacOSX.NoVM.tgz; 27 | ncftpput -f gallery2hu.cfg -C GalleryRemote.MacOSX.NoVM.tgz current_GalleryRemote.MacOSX.NoVM.tgz; 28 | 29 | echo -e "\n\nPosting new version info on version check site...\n\n"; 30 | ant post; 31 | 32 | if ( [ -f deploy_local.sh ] ) then 33 | echo -e "\n\nRunning local script...\n\n"; 34 | . deploy_local.sh; 35 | fi 36 | fi 37 | -------------------------------------------------------------------------------- /ReadMe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Gallery Remote roadmap 9 | 42 | 49 | 57 | 58 | 59 | 60 | The Gallery Remote manual is now online. 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /gal_remote_proto-2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Gallery Remote roadmap 9 | 42 | 49 | 57 | 58 | 59 | 60 | The Gallery Remote protocol documentation is now online. 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/util/BrowserLink.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.util; 2 | 3 | import com.gallery.GalleryRemote.Log; 4 | import edu.stanford.ejalbert.BrowserLauncher; 5 | 6 | import javax.swing.*; 7 | import java.awt.*; 8 | import java.awt.event.MouseEvent; 9 | import java.awt.event.MouseListener; 10 | import java.io.IOException; 11 | 12 | /** 13 | * Created by IntelliJ IDEA. 14 | * User: paour 15 | * Date: Dec 16, 2003 16 | */ 17 | public class BrowserLink extends JLabel implements MouseListener { 18 | public static final String MODULE = "BrowserLink"; 19 | String url = null; 20 | 21 | public BrowserLink() { 22 | super(); 23 | 24 | setForeground(Color.blue); 25 | 26 | addMouseListener(this); 27 | } 28 | 29 | public BrowserLink(String url) { 30 | super(url); 31 | 32 | setForeground(Color.blue); 33 | 34 | addMouseListener(this); 35 | } 36 | 37 | public void setText(String text) { 38 | url = text; 39 | 40 | super.setText("" + text + ""); 41 | } 42 | 43 | public void setUrl(String url) { 44 | this.url = url; 45 | } 46 | 47 | public String getUrl() { 48 | return url; 49 | } 50 | 51 | /* MouseListener Interface */ 52 | public void mouseClicked(MouseEvent e) { 53 | try { 54 | BrowserLauncher.openURL(url); 55 | } catch (IOException e1) { 56 | Log.logException(Log.LEVEL_ERROR, MODULE, e1); 57 | } 58 | } 59 | 60 | public void mouseEntered(MouseEvent e) { 61 | } 62 | 63 | public void mouseExited(MouseEvent e) { 64 | } 65 | 66 | public void mousePressed(MouseEvent e) { 67 | } 68 | 69 | public void mouseReleased(MouseEvent e) { 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/GalleryRemoteMini.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote; 2 | 3 | import com.gallery.GalleryRemote.util.DialogUtil; 4 | import com.gallery.GalleryRemote.prefs.PropertiesFile; 5 | import com.gallery.GalleryRemote.prefs.PreferenceNames; 6 | 7 | import java.awt.*; 8 | import java.io.File; 9 | import java.io.IOException; 10 | 11 | /** 12 | * Created by IntelliJ IDEA. 13 | * User: paour 14 | * Date: Jan 14, 2004 15 | */ 16 | public class GalleryRemoteMini extends GalleryRemote { 17 | protected void initializeGR() { 18 | super.initializeGR(); 19 | 20 | CoreUtils.initCore(); 21 | 22 | Log.startLog(_().properties.getIntProperty(PreferenceNames.LOG_LEVEL), _().properties.getBooleanProperty("toSysOut")); 23 | } 24 | 25 | public void createProperties() { 26 | super.createProperties(); 27 | 28 | properties = getAppletOverrides(properties, "GRDefault_"); 29 | 30 | File f = new File(System.getProperty("user.home") 31 | + File.separator + ".GalleryRemote" 32 | + File.separator); 33 | 34 | f.mkdirs(); 35 | 36 | File pf = new File(f, "GalleryRemoteApplet.properties"); 37 | 38 | if (!pf.exists()) { 39 | try { 40 | pf.createNewFile(); 41 | } catch (IOException e) { 42 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 43 | } 44 | } 45 | 46 | properties = new PropertiesFile(properties, pf.getPath(), "user"); 47 | 48 | properties = getAppletOverrides(properties, "GROverride_"); 49 | } 50 | 51 | public Frame getMainFrame() { 52 | return DialogUtil.findParentWindow(applet); 53 | } 54 | 55 | public GalleryRemoteCore getCore() { 56 | return (GalleryRemoteCore) applet; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /imagemagick/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2002 ImageMagick Studio, a non-profit organization dedicated 2 | to making software imaging solutions freely available. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files ("ImageMagick"), to deal 6 | in ImageMagick without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of ImageMagick, and to permit persons to whom the ImageMagick is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of ImageMagick. 13 | 14 | The software is provided "as is", without warranty of any kind, express or 15 | implied, including but not limited to the warranties of merchantability, 16 | fitness for a particular purpose and noninfringement. In no event shall 17 | ImageMagick Studio be liable for any claim, damages or other liability, 18 | whether in an action of contract, tort or otherwise, arising from, out of or 19 | in connection with ImageMagick or the use or other dealings in ImageMagick. 20 | 21 | Except as contained in this notice, the name of the ImageMagick Studio shall 22 | not be used in advertising or otherwise to promote the sale, use or other 23 | dealings in ImageMagick without prior written authorization from the 24 | ImageMagick Studio. 25 | 26 | ImageMagick is available as 27 | 28 | ftp://ftp.imagemagick.org/pub/ImageMagick/ 29 | 30 | The official ImageMagick WWW page is 31 | 32 | http://www.imagemagick.org/ -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/util/DialogUtil.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.util; 2 | 3 | import com.gallery.GalleryRemote.GalleryRemote; 4 | 5 | import java.awt.*; 6 | 7 | /** 8 | * Created by IntelliJ IDEA. 9 | * User: paour 10 | * Date: Jun 2, 2003 11 | */ 12 | public class DialogUtil { 13 | public static void center(Window window, Window owner) { 14 | Rectangle sr = window.getGraphicsConfiguration().getBounds(); 15 | Rectangle or; 16 | if (owner != null && owner.isVisible()) { 17 | or = owner.getBounds(); 18 | } else { 19 | or = sr; 20 | } 21 | Dimension d = window.getSize(); 22 | 23 | Rectangle r = new Rectangle(); 24 | r.setSize(d); 25 | 26 | int x = (int) (or.getX() + or.getWidth() / 2 - d.getWidth() / 2); 27 | int y = (int) (or.getY() + or.getHeight() / 2 - d.getHeight() / 2); 28 | 29 | if (x < 0) x = 0; 30 | if (y < 0) y = 0; 31 | if (x + r.getWidth() > sr.getMaxX()) x = (int) (sr.getMaxX() - r.getWidth()); 32 | if (y + r.getHeight() > sr.getMaxY()) y = (int) (sr.getMaxY() - r.getHeight()); 33 | 34 | r.setLocation(x, y); 35 | 36 | window.setBounds(r); 37 | } 38 | 39 | public static void center(Window window) { 40 | center(window, null); 41 | } 42 | 43 | public static void maxSize(Window window) { 44 | Rectangle sr = window.getGraphicsConfiguration().getBounds(); 45 | if (GalleryRemote.IS_MAC_OS_X) { 46 | // leave room for the menu bar 47 | sr.y += 22; 48 | sr.height -= 22; 49 | } 50 | 51 | window.setBounds(sr); 52 | } 53 | 54 | public static Frame findParentWindow(Component c) { 55 | if (c instanceof Frame) { 56 | return (Frame) c; 57 | } 58 | 59 | if (c.getParent() == null) { 60 | return null; 61 | } 62 | 63 | return findParentWindow(c.getParent()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ApertureToGallery.applescript: -------------------------------------------------------------------------------- 1 | on run argv 2 | set destination to "/tmp/" 3 | set outputFile to "ApertureToGallery.txt" 4 | set decision to "" 5 | 6 | try 7 | repeat 8 | do shell script "/bin/ls " & destination & outputFile 9 | tell application "System Events" 10 | activate 11 | set decision to display dialog "The file used to communicate between Aperture and Gallery Remote is already present. This may mean Gallery Remote has not yet finished processing Aperture's output." buttons {"Continue anyway", "Retry", "Cancel"} default button 3 with icon caution 12 | end tell 13 | log decision 14 | set decision to button returned of decision 15 | if decision is not "Retry" then 16 | exit repeat 17 | end if 18 | end repeat 19 | on error errStr number errorNumber 20 | if errorNumber is -128 then 21 | set decision to "Cancel" 22 | return "user cancelled" 23 | end if 24 | end try 25 | 26 | with timeout of (30 * 60) seconds 27 | tell application "Aperture" 28 | set myselected to the selection 29 | set captions to {} 30 | repeat with imageversion in myselected 31 | if exists the value of the IPTC tag named "Caption/Abstract" of imageversion then 32 | set myCaption to the value of the IPTC tag named "Caption/Abstract" of imageversion 33 | copy myCaption to the end of captions 34 | else 35 | copy "" to the end of captions 36 | end if 37 | end repeat 38 | export myselected using export setting "JPEG - Original size" to destination 39 | set exportedFiles to the result 40 | 41 | end tell 42 | end timeout 43 | 44 | set fileRef to open for access (POSIX file (destination & outputFile)) with write permission 45 | set eof fileRef to 0 46 | try 47 | repeat with i from 1 to count exportedFiles 48 | set tmpFile to POSIX path of item i of exportedFiles 49 | write tmpFile to fileRef 50 | write "\t" & item i of captions to fileRef 51 | write "\r" to fileRef 52 | end repeat 53 | end try 54 | close access fileRef 55 | 56 | return "done" 57 | end run -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/AddFileDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | package com.gallery.GalleryRemote; 23 | 24 | import com.gallery.GalleryRemote.util.GRI18n; 25 | 26 | import javax.swing.*; 27 | import java.awt.*; 28 | import java.io.File; 29 | 30 | public class AddFileDialog { 31 | public static final String MODULE = "AddFileDialog"; 32 | 33 | static File[] addFiles(Component parent) { 34 | JFileChooser fc = new JFileChooser(); 35 | 36 | fc.addChoosableFileFilter(new GalleryFileFilter()); 37 | fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); 38 | fc.setMultiSelectionEnabled(true); 39 | 40 | File currentDirectory = GalleryRemote._().properties.getCurrentDirectory(); 41 | if (currentDirectory != null) { 42 | fc.setCurrentDirectory(currentDirectory); 43 | } 44 | 45 | fc.setDialogTitle(GRI18n.getString(MODULE, "Title")); 46 | 47 | int retval = fc.showDialog(parent, GRI18n.getString(MODULE, "Add")); 48 | if (retval != JFileChooser.CANCEL_OPTION) { 49 | GalleryRemote._().properties.setCurrentDirectory(fc.getCurrentDirectory()); 50 | 51 | File[] files = fc.getSelectedFiles(); 52 | 53 | return files; 54 | } 55 | 56 | return null; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/GalleryCommCapabilities.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | package com.gallery.GalleryRemote; 22 | 23 | 24 | /** 25 | * This interface includes capacity keys for various versions of 26 | * the Gallery Remote protocols. 27 | * 28 | * @author Pierre-Luc Paour 29 | * @version $id$ 30 | */ 31 | public interface GalleryCommCapabilities { 32 | public static final int CAPA_UPLOAD_FILES = 1; 33 | public static final int CAPA_FETCH_ALBUMS = 2; 34 | public static final int CAPA_UPLOAD_CAPTION = 3; 35 | public static final int CAPA_FETCH_HIERARCHICAL = 4; 36 | public static final int CAPA_ALBUM_INFO = 5; 37 | public static final int CAPA_NEW_ALBUM = 6; 38 | public static final int CAPA_FETCH_ALBUMS_PRUNE = 7; 39 | public static final int CAPA_FORCE_FILENAME = 8; 40 | public static final int CAPA_FETCH_ALBUM_IMAGES = 9; 41 | public static final int CAPA_MOVE_ALBUM = 10; 42 | public static final int CAPA_FETCH_ALBUMS_TOO = 11; 43 | public static final int CAPA_FETCH_NON_WRITEABLE_ALBUMS = 12; 44 | public static final int CAPA_FETCH_HONORS_HIDDEN = 13; 45 | public static final int CAPA_IMAGE_MAX_SIZE = 14; 46 | public static final int CAPA_INCREMENT_VIEW_COUNT = 15; 47 | public static final int CAPA_FETCH_RANDOM = 16; 48 | } 49 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/model/GalleryItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by IntelliJ IDEA. 3 | * User: paour 4 | * Date: Feb 25, 2004 5 | * Time: 7:26:45 PM 6 | */ 7 | package com.gallery.GalleryRemote.model; 8 | 9 | import com.gallery.GalleryRemote.util.HTMLEscaper; 10 | 11 | import javax.swing.tree.DefaultMutableTreeNode; 12 | 13 | public abstract class GalleryItem extends DefaultMutableTreeNode implements Cloneable { 14 | public static final String MODULE = "GalleryItem"; 15 | 16 | transient Gallery gallery = null; 17 | String title = null; 18 | String description = null; 19 | String url = null; 20 | boolean canEdit = true; 21 | 22 | transient String escapedDescription = null; 23 | 24 | public GalleryItem(Gallery gallery) { 25 | this.gallery = gallery; 26 | } 27 | 28 | public Object clone() { 29 | GalleryItem newGalleryItem = null; 30 | 31 | newGalleryItem = (GalleryItem) super.clone(); 32 | 33 | newGalleryItem.description = description; 34 | newGalleryItem.gallery = gallery; 35 | 36 | return newGalleryItem; 37 | } 38 | 39 | public Album getParentAlbum() { 40 | return (Album) getParent(); 41 | } 42 | 43 | public void setDescription(String description) { 44 | this.description = description; 45 | this.escapedDescription = null; 46 | } 47 | 48 | public String getDescription() { 49 | return description; 50 | } 51 | 52 | public void setTitle(String title) { 53 | this.title = title; 54 | } 55 | 56 | public String getTitle() { 57 | return title; 58 | } 59 | 60 | public String getUrl() { 61 | return url; 62 | } 63 | 64 | public void setUrl(String url) { 65 | this.url = url; 66 | } 67 | 68 | public void setCanEdit(boolean b) { 69 | canEdit = b; 70 | } 71 | 72 | public boolean getCanEdit() { 73 | return canEdit; 74 | } 75 | 76 | /** 77 | * Cache the escapedDescription because the escaping is lengthy and this is called by a frequent UI method 78 | * 79 | * @return the HTML escaped version of the description 80 | */ 81 | public String getEscapedDescription() { 82 | if (escapedDescription == null) { 83 | if (description != null) { 84 | escapedDescription = HTMLEscaper.escape(description); 85 | } 86 | } 87 | 88 | return escapedDescription; 89 | } 90 | } -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/util/OsShutdown.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.util; 2 | 3 | import com.gallery.GalleryRemote.Log; 4 | import com.gallery.GalleryRemote.GalleryRemote; 5 | 6 | import java.lang.reflect.Method; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | /** 10 | * Shut down the OS. Idea by Nick77. 11 | * OS names from 12 | * User: paour 13 | * Date: Sep 25, 2003 14 | */ 15 | public class OsShutdown { 16 | public static final String MODULE = "Shutdown"; 17 | public static final String osname = System.getProperty("os.name").toLowerCase(); 18 | 19 | public static void shutdown() { 20 | Method m = getPrivateShutdownMethod(); 21 | 22 | if (m != null) { 23 | try { 24 | m.invoke(null); 25 | } catch (Throwable e) { 26 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 27 | } 28 | } 29 | } 30 | 31 | private static Method getPrivateShutdownMethod() { 32 | try { 33 | Class c = GalleryRemote.secureClassForName("com.gallery.GalleryRemote.util.PrivateShutdown"); 34 | return c.getMethod("shutdown"); 35 | } catch (Throwable e) { 36 | Log.log(Log.LEVEL_TRACE, MODULE, "Could not load PrivateShutdown, this is expected for the applet"); 37 | return null; 38 | } 39 | } 40 | 41 | public static boolean isWindows() { 42 | return osname.indexOf("windows") != -1; 43 | } 44 | 45 | public static boolean isWin9x() { 46 | return isWindows() && (osname.indexOf("9") != -1 || osname.indexOf("me") != -1); 47 | } 48 | 49 | public static boolean isWinNT() { 50 | return isWindows() && !isWin9x(); 51 | } 52 | 53 | public static boolean isMacOS() { 54 | return osname.indexOf("mac") != -1 && osname.indexOf("os") != -1; 55 | } 56 | 57 | public static boolean isMacOSX() { 58 | return osname.indexOf("mac os x") != -1; 59 | } 60 | 61 | public static boolean isLinux() { 62 | return osname.indexOf("linux") != -1; 63 | } 64 | 65 | public static boolean isSolaris() { 66 | return osname.indexOf("solaris") != -1; 67 | } 68 | 69 | public static boolean isUnix() { 70 | return isMacOSX() || isLinux() || isSolaris(); 71 | } 72 | 73 | public static boolean canShutdown() { 74 | return (isWin9x() || isWinNT() || (isUnix() && !isMacOSX())) && getPrivateShutdownMethod() != null; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/StatusUpdateAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | package com.gallery.GalleryRemote; 22 | 23 | import com.gallery.GalleryRemote.model.Picture; 24 | 25 | /** 26 | * This is an event adapter for the StatusUpdateListener class. 27 | * 28 | * @author Tim Miller 29 | * @version $id$ 30 | */ 31 | public class StatusUpdateAdapter implements StatusUpdate { 32 | /* level-bound methods */ 33 | public void startProgress(int level, int min, int max, String message, boolean undetermined) { 34 | } 35 | 36 | public void updateProgressValue(int level, int value) { 37 | } 38 | 39 | public void updateProgressValue(int level, int value, int maxValue) { 40 | } 41 | 42 | public void setUndetermined(int level, boolean undetermined) { 43 | } 44 | 45 | public void updateProgressStatus(int level, String message) { 46 | } 47 | 48 | public void stopProgress(int level, String message) { 49 | } 50 | 51 | /* level-independant methods */ 52 | public void setInProgress(boolean inProgress) { 53 | } 54 | 55 | public void setStatus(String message) { 56 | } 57 | 58 | public void error(String message) { 59 | } 60 | 61 | public int getProgressValue(int level) { 62 | return 0; 63 | } 64 | 65 | public int getProgressMinValue(int level) { 66 | return 0; 67 | } 68 | 69 | public int getProgressMaxValue(int level) { 70 | return 0; 71 | } 72 | 73 | public void doneUploading(String newItemName, Picture picture) { 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/StatusUpdate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | package com.gallery.GalleryRemote; 22 | 23 | import com.gallery.GalleryRemote.model.Picture; 24 | 25 | /** 26 | * This interface decouples the status updating methods from MainFrame. 27 | * 28 | * @author Tim Miller 29 | * @version $id$ 30 | */ 31 | public interface StatusUpdate { 32 | public static final int LEVEL_GENERIC = 0; 33 | public static final int LEVEL_BACKGROUND = 1; 34 | public static final int LEVEL_CACHE = 2; 35 | public static final int LEVEL_UPLOAD_ONE = 3; 36 | public static final int LEVEL_UPLOAD_ALL = 4; 37 | public static final int LEVEL_UNINTERUPTIBLE = 5; 38 | public static final int NUM_LEVELS = 6; 39 | 40 | /* level-bound methods */ 41 | public void setStatus(String message); 42 | 43 | public void startProgress(int level, int min, int max, String message, boolean undetermined); 44 | 45 | public void updateProgressValue(int level, int value); 46 | 47 | public void updateProgressValue(int level, int value, int maxValue); 48 | 49 | public void updateProgressStatus(int level, String message); 50 | 51 | public void setUndetermined(int level, boolean undetermined); 52 | 53 | public int getProgressValue(int level); 54 | 55 | public int getProgressMinValue(int level); 56 | 57 | public int getProgressMaxValue(int level); 58 | 59 | public void stopProgress(int level, String message); 60 | 61 | /* level-independant methods */ 62 | public void setInProgress(boolean inProgress); 63 | 64 | public void error(String message); 65 | 66 | public void doneUploading(String newItemName, Picture picture); 67 | } 68 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Gallery Remote Readme 2 | 3 | CONTENTS: 4 | 1. What is Gallery Remote? 5 | 2. What is Gallery? 6 | 3. Using Gallery Remote 7 | 4. Can I run Gallery Remote on my non-Windows OS? 8 | 5. Known problems 9 | 6. HELP!! Where do I go for Help? 10 | 11 | 1 WHAT IS GALLERY REMOTE? 12 | 13 | Gallery Remote is a Desktop file upload utility for Gallery. 14 | 15 | 16 | 2. WHAT IS GALLERY? 17 | 18 | Gallery is a web based photo album viewer/creator. For the latest 19 | information, check out the web site: 20 | 21 | http://gallery.sourceforge.net/ 22 | 23 | 24 | 3. USING GALLERY REMOTE 25 | 26 | You're on your own here, but it's pretty straightforward. 27 | 28 | 29 | 4. CAN I RUN GALLERY REMOTE ON MY NON-WINDOWS OS? 30 | 31 | Yes, maybe. Gallery Remote was written in Java. If you have Java 1.3 or later 32 | installed on your machine, you may be able to run the app with the command: 33 | 34 | java -cp GalleryRemote.jar com.gallery.GalleryRemote.GalleryRemote 35 | 36 | assuming you are in the same directory as the GalleryRemote.jar file. 37 | 38 | 39 | 5. KNOWN PROBLEMS 40 | 41 | There are many, I am sure. 42 | 43 | 44 | 6. HELP!! WHERE DO I GO FOR HELP? 45 | 46 | We're here to help you. We want you to get Gallery up and running. 47 | But please remember that Gallery is installed on many websites and 48 | the Gallery authors get bombarded with lots of emails every day. 49 | Be kind to us and try to use the resources we make available before 50 | you fire off an email to us. 51 | 52 | The first thing you should do is to read the Gallery Frequently 53 | Asked Questions page, which is found here: 54 | 55 | http://gallery.sourceforge.net/faq.php 56 | 57 | If you can't find your answer there, send your help requests to the 58 | mailing lists. 59 | 60 | The Gallery users mailing list is here: 61 | 62 | http://lists.sourceforge.net/lists/listinfo/gallery-users 63 | 64 | there's an archive of all the emails for the past few months here: 65 | 66 | http://marc.theaimsgroup.com/?l=gallery-users&r=1&w=2 67 | 68 | We respond to each and every request for help. There are very few 69 | problems that we have not been able to work through. We *will* get 70 | you up and running. But, remember that every email we respond to robs 71 | us of time that we could be spending improving the quality of Gallery 72 | and adding new features. 73 | 74 | Speaking of quality and features, if you find a bug you can file 75 | it in our Bug Tracker: 76 | 77 | http://sourceforge.net/tracker/?group_id=7130&atid=107130 78 | 79 | and if you think of a new feature, you can file it in our Feature 80 | Tracker: 81 | 82 | http://sourceforge.net/tracker/?atid=357130&group_id=7130&func=browse 83 | 84 | It's a good idea to check through these databases to see if the 85 | bug/feature that you're referring to is already in there. 86 | 87 | THE END. -------------------------------------------------------------------------------- /imagemagick/win32/modules/modules.mgk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/GalleryFileFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | package com.gallery.GalleryRemote; 23 | 24 | import javax.swing.filechooser.FileFilter; 25 | import java.io.File; 26 | import java.util.Arrays; 27 | import java.util.List; 28 | 29 | public class GalleryFileFilter extends FileFilter { 30 | public static String[] ext 31 | = {"gif", "jpeg", "jpg", "avi", "mpg", "mpeg", "moov", "png", "jpe"}; 32 | public static final List validExtensions = Arrays.asList(ext); 33 | 34 | public static String[] ext1 35 | = {"gif", "jpeg", "jpg", "png", "jpe"}; 36 | public static final List manipulateExtensions = Arrays.asList(ext1); 37 | 38 | public static String[] ext2 39 | = {"jpg", "jpeg", "jpe"}; 40 | public static final List manipulateJpegExtensions = Arrays.asList(ext2); 41 | 42 | // Accept all directories and all gif, jpg files. 43 | public boolean accept(File f) { 44 | if (f.isDirectory()) { 45 | return true; 46 | } 47 | 48 | String extension = getExtension(f); 49 | 50 | return (extension != null && validExtensions.contains(extension)); 51 | } 52 | 53 | public static boolean canManipulate(String filename) { 54 | String extension = getExtension(filename); 55 | 56 | return (extension != null && manipulateExtensions.contains(extension)); 57 | } 58 | 59 | public static boolean canManipulateJpeg(String filename) { 60 | String extension = getExtension(filename); 61 | 62 | return (extension != null && manipulateJpegExtensions.contains(extension)); 63 | } 64 | 65 | // The description of this filter 66 | public String getDescription() { 67 | return "Gallery Items"; 68 | } 69 | 70 | public static String getExtension(File f) { 71 | return getExtension(f.getName()); 72 | } 73 | 74 | public static String getExtension(String s) { 75 | String ext = null; 76 | int i = s.lastIndexOf('.'); 77 | 78 | if (i > 0 && i < s.length() - 1) { 79 | ext = s.substring(i + 1).toLowerCase(); 80 | } 81 | 82 | return ext; 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/GalleryCommTest.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote; 2 | 3 | import com.gallery.GalleryRemote.model.Album; 4 | import com.gallery.GalleryRemote.model.Gallery; 5 | import com.gallery.GalleryRemote.model.Picture; 6 | import org.junit.AfterClass; 7 | import org.junit.Before; 8 | import org.junit.BeforeClass; 9 | import org.junit.Test; 10 | 11 | import java.io.File; 12 | 13 | import static org.junit.Assert.*; 14 | 15 | /** 16 | * Created by IntelliJ IDEA. 17 | * User: paour 18 | * Date: Jun 18, 2010 19 | * Time: 4:05:33 PM 20 | */ 21 | public class GalleryCommTest { 22 | public static final String MODULE = "CommTest"; 23 | private Gallery g; 24 | private StatusUpdate su; 25 | private GalleryComm comm; 26 | 27 | @Test 28 | public void testFetchAlbums() { 29 | Log.log(Log.LEVEL_INFO, MODULE, "Starting fetchAlbums"); 30 | comm.fetchAlbums(su, false); 31 | } 32 | 33 | @Test 34 | public void testFetchAlbumsBadKey() { 35 | Log.log(Log.LEVEL_INFO, MODULE, "Starting fetchAlbums"); 36 | g.setKey("badkey"); 37 | comm.fetchAlbums(su, false); 38 | } 39 | 40 | @Test 41 | public void testCheckAuthBadKey() { 42 | g.setKey("badkey"); 43 | g.setUsername("admin"); 44 | g.setPassword("admin"); 45 | assertTrue(comm.checkAuth()); 46 | } 47 | 48 | @Test 49 | public void testGetKey() { 50 | g.setKey(""); 51 | g.setUsername("admin"); 52 | g.setPassword("admin"); 53 | assertTrue(comm.checkAuth()); 54 | } 55 | 56 | @Test 57 | public void testGetKeyBadPass() { 58 | g.setKey(""); 59 | g.setUsername("admin"); 60 | g.setPassword("adminfalse"); 61 | assertFalse(comm.checkAuth()); 62 | } 63 | 64 | @Test 65 | public void testUploadFiles() { 66 | comm.fetchAlbums(su, false); 67 | 68 | Album a = g.getRootAlbum(); 69 | Picture p = new Picture(g, new File("Voeux2010.jpg")); 70 | a.addPicture(p); 71 | assertNull(p.getUrl()); 72 | comm.uploadFiles(su, false); 73 | assertNotNull(p.getUrl()); 74 | } 75 | @Test 76 | public void testUploadFilesToRoot() { 77 | Album a = new Album(g); 78 | a.setUrl(g.getUrlString() + "index.php/rest/item/1"); 79 | Picture p = new Picture(g, new File("Voeux2010.jpg")); 80 | a.addPicture(p); 81 | g.setRoot(a); 82 | assertNull(p.getUrl()); 83 | comm.uploadFiles(su, false); 84 | assertNotNull(p.getUrl()); 85 | } 86 | 87 | @Test 88 | public void testCreateAlbumToRoot() { 89 | Album a = new Album(g); 90 | a.setUrl(g.getUrlString() + "index.php/rest/item/1"); 91 | Album na = new Album(g); 92 | a.add(na); 93 | g.setRoot(a); 94 | na.setName("New Album"); 95 | na.setTitle("New Album Title"); 96 | na.setDescription("Created by testCreateNewAlbum"); 97 | assertNull(na.getUrl()); 98 | comm.newAlbum(su, na, false); 99 | assertNotNull(na.getUrl()); 100 | } 101 | 102 | @BeforeClass 103 | public static void setupAll() { 104 | GalleryRemote.createInstance("com.gallery.GalleryRemote.GalleryRemoteMainFrame", null); 105 | 106 | GalleryRemote._().initializeGR(); 107 | } 108 | 109 | @Before 110 | public void setup() { 111 | su = new StatusUpdateAdapter(); 112 | g = new Gallery(su); 113 | g.setUrlString("http://localhost/~paour/gallery3/"); 114 | g.setKey("7c507344c89daeeb9c2c645d2d4b73b7"); 115 | comm = GalleryComm.getCommInstance(su, g); 116 | } 117 | 118 | @AfterClass 119 | public static void shutdownAll() { 120 | Log.shutdown(); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/util/UrlMessageDialog.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.util; 2 | 3 | import com.gallery.GalleryRemote.GalleryRemote; 4 | 5 | import javax.swing.*; 6 | import java.awt.*; 7 | import java.awt.event.ActionListener; 8 | import java.awt.event.ActionEvent; 9 | 10 | /** 11 | * Created by IntelliJ IDEA. 12 | * User: paour 13 | * Date: Jan 13, 2004 14 | */ 15 | public class UrlMessageDialog extends JDialog implements ActionListener { 16 | public static final String MODULE = "ImageUtils"; 17 | 18 | JLabel jIcon = new JLabel(); 19 | JLabel jMessage = new JLabel(); 20 | BrowserLink jURL = new BrowserLink(); 21 | JCheckBox jDontShow = new JCheckBox(); 22 | JButton jButton1 = new JButton(); 23 | JButton jButton2 = new JButton(); 24 | JPanel jButtons = new JPanel(new GridLayout(1, 0, 5, 0)); 25 | 26 | int buttonChosen = 0; 27 | 28 | public UrlMessageDialog(String message, String url, String urlText) { 29 | this(message, url, urlText, null, null); 30 | } 31 | 32 | public UrlMessageDialog(String message, String url, String urlText, String button1Label, String button2Label) { 33 | super(GalleryRemote._().getMainFrame(), 34 | GRI18n.getString(MODULE, "warningTitle"), 35 | true); 36 | 37 | jIcon.setIcon(UIManager.getIcon("OptionPane.warningIcon")); 38 | setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); 39 | getContentPane().setLayout(new GridBagLayout()); 40 | jMessage.setText(message); 41 | 42 | if (url != null) { 43 | if (urlText != null) { 44 | jURL.setText(urlText); 45 | } else { 46 | jURL.setText(url); 47 | } 48 | 49 | jURL.setUrl(url); 50 | } 51 | 52 | jDontShow.setText(GRI18n.getString(MODULE, "warningDontShow")); 53 | 54 | if (button1Label != null) { 55 | jButton1.setText(button1Label); 56 | } else { 57 | jButton1.setText(GRI18n.getString("Common", "OK")); 58 | } 59 | jButton1.addActionListener(this); 60 | 61 | if (button2Label != null) { 62 | jButton2.setText(button2Label); 63 | jButton2.addActionListener(this); 64 | } 65 | 66 | getContentPane().add(jIcon, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 67 | , GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(5, 5, 0, 10), 0, 0)); 68 | getContentPane().add(jMessage, new GridBagConstraints(1, 0, 2, 1, 1.0, 1.0 69 | , GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 0, 0, 5), 0, 0)); 70 | if (url != null) { 71 | getContentPane().add(jURL, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0 72 | , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 5), 0, 0)); 73 | } 74 | getContentPane().add(jDontShow, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 75 | , GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 0, 0, 5), 0, 0)); 76 | getContentPane().add(jButtons, new GridBagConstraints(2, 2, 1, 2, 0.0, 0.0 77 | , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0)); 78 | jButtons.add(jButton1); 79 | if (button2Label != null) { 80 | jButtons.add(jButton2); 81 | } 82 | 83 | getRootPane().setDefaultButton(jButton1); 84 | 85 | pack(); 86 | 87 | DialogUtil.center(this, getOwner()); 88 | 89 | setVisible(true); 90 | } 91 | 92 | public void actionPerformed(ActionEvent e) { 93 | if (e.getSource() == jButton1) { 94 | buttonChosen = 1; 95 | } else { 96 | buttonChosen = 2; 97 | } 98 | 99 | setVisible(false); 100 | } 101 | 102 | public boolean dontShow() { 103 | return jDontShow.isSelected(); 104 | } 105 | 106 | public int getButtonChosen() { 107 | return buttonChosen; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/GalleryComm2Consts.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | package com.gallery.GalleryRemote; 23 | 24 | /** 25 | * This interface includes status code constants for version 2 of the 26 | * Gallery Remote protocol. 27 | * 28 | * @version $Id$ 29 | * @author Tim Miller 30 | */ 31 | public interface GalleryComm2Consts { 32 | 33 | /** Protocol version string. No longer used by the server, still being sent... */ 34 | public static final String PROTOCOL_VERSION = "2.3"; 35 | 36 | /** Remote scriptname that provides version 2 of the protocol on the server. */ 37 | public static final String PROTOCOL_MAGIC = "#__GR2PROTO__"; 38 | 39 | 40 | /* 41 | * STATUS CODES 42 | */ 43 | 44 | /** 45 | * The command the client sent in the request completed successfully. The 46 | * data (if any) in the response should be considered valid. 47 | */ 48 | public static final String GR_STAT_SUCCESS = "0"; 49 | 50 | /** The protocol major version the client is using is not supported; */ 51 | public static final String GR_STAT_PROTO_MAJ_VER_INVAL = "101"; 52 | 53 | /** The protocol minor version the client is using is not supported. */ 54 | public static final String GR_STAT_PROTO_MIN_VER_INVAL = "102"; 55 | 56 | /** The format of the protocol version string the client sent in the request is invalid. */ 57 | public static final String GR_STAT_PROTO_VER_FMT_INVAL = "103"; 58 | 59 | /** The request did not contain the required protocol_version key. */ 60 | public static final String GR_STAT_PROTO_VER_MISSING = "104"; 61 | 62 | /** The password and/or username the client send in the request is invalid. */ 63 | public static final String GR_STAT_PASSWD_WRONG = "201"; 64 | 65 | /** 66 | * The client used the login command in the request but failed to include 67 | * either the username or password (or both) in the request. 68 | */ 69 | public static final String GR_STAT_LOGIN_MISSING = "202"; 70 | 71 | /** 72 | * The client used the login command in the request but failed to include 73 | * either the username or password (or both) in the request. 74 | */ 75 | public static final String GR_STAT_UNKNOWN_CMD = "301"; 76 | 77 | /** The user does not have permission to add an item to the gallery. */ 78 | public static final String GR_STAT_NO_ADD_PERMISSION = "401"; 79 | 80 | /** No filename was specified. */ 81 | public static final String GR_STAT_NO_FILENAME = "402"; 82 | 83 | /** The file was received, but could not be processed or added to the album. */ 84 | public static final String GR_STAT_UPLOAD_PHOTO_FAIL = "403"; 85 | 86 | /** The file was received, but could not be processed or added to the album. */ 87 | public static final String GR_STAT_NO_CREATE_ALBUM_PERMISSION = "403"; 88 | } 89 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/Base64.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Provides encoding of raw bytes to base64-encoded characters, and 3 | * decoding of base64 characters to raw bytes. 4 | * 5 | * @author Kevin Kelley (kelley@iguana.ruralnet.net) 6 | * @version 1.0 7 | * @date 06 August 1998 8 | */ 9 | 10 | package com.gallery.GalleryRemote; 11 | 12 | public class Base64 { 13 | public static String encode(String data) { 14 | return new String(encode(data.getBytes())); 15 | } 16 | 17 | public static String decode(String data) { 18 | char[] dataArr = new char[data.length()]; 19 | data.getChars(0, data.length(), dataArr, 0); 20 | return new String(decode(dataArr)); 21 | } 22 | 23 | /** 24 | * returns an array of base64-encoded characters to represent the 25 | * passed data array. 26 | * 27 | * @param data the array of bytes to encode 28 | * @return base64-coded character array. 29 | */ 30 | 31 | static public char[] encode(byte[] data) { 32 | char[] out = new char[((data.length + 2) / 3) * 4]; 33 | 34 | // 35 | // 3 bytes encode to 4 chars. Output is always an even 36 | // multiple of 4 characters. 37 | // 38 | for (int i = 0, index = 0; i < data.length; i += 3, index += 4) { 39 | boolean quad = false; 40 | boolean trip = false; 41 | 42 | int val = (0xFF & (int) data[i]); 43 | val <<= 8; 44 | if ((i + 1) < data.length) { 45 | val |= (0xFF & (int) data[i + 1]); 46 | trip = true; 47 | } 48 | val <<= 8; 49 | if ((i + 2) < data.length) { 50 | val |= (0xFF & (int) data[i + 2]); 51 | quad = true; 52 | } 53 | out[index + 3] = alphabet[(quad ? (val & 0x3F) : 64)]; 54 | val >>= 6; 55 | out[index + 2] = alphabet[(trip ? (val & 0x3F) : 64)]; 56 | val >>= 6; 57 | out[index + 1] = alphabet[val & 0x3F]; 58 | val >>= 6; 59 | out[index + 0] = alphabet[val & 0x3F]; 60 | } 61 | return out; 62 | } 63 | 64 | /** 65 | * Returns an array of bytes which were encoded in the passed 66 | * character array. 67 | * 68 | * @param data the array of base64-encoded characters 69 | * @return decoded data array 70 | */ 71 | static public byte[] decode(char[] data) { 72 | int len = ((data.length + 3) / 4) * 3; 73 | if (data.length > 0 && data[data.length - 1] == '=') --len; 74 | if (data.length > 1 && data[data.length - 2] == '=') --len; 75 | byte[] out = new byte[len]; 76 | 77 | int shift = 0; // # of excess bits stored in accum 78 | int accum = 0; // excess bits 79 | int index = 0; 80 | 81 | for (int ix = 0; ix < data.length; ix++) { 82 | int value = codes[data[ix] & 0xFF]; // ignore high byte of char 83 | if (value >= 0) { // skip over non-code 84 | accum <<= 6; // bits shift up by 6 each time thru 85 | shift += 6; // loop, with new bits being put in 86 | accum |= value; // at the bottom. 87 | if (shift >= 8) { // whenever there are 8 or more shifted in, 88 | shift -= 8; // write them out (from the top, leaving any 89 | out[index++] = // excess at the bottom for next iteration. 90 | (byte) ((accum >> shift) & 0xff); 91 | } 92 | } 93 | } 94 | if (index != out.length) 95 | throw new Error("miscalculated data length!"); 96 | 97 | return out; 98 | } 99 | 100 | // 101 | // code characters for values 0..63 102 | // 103 | static private char[] alphabet = 104 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" 105 | .toCharArray(); 106 | 107 | // 108 | // lookup table for converting base64 characters to value in range 0..63 109 | // 110 | static private byte[] codes = new byte[256]; 111 | 112 | static { 113 | for (int i = 0; i < 256; i++) codes[i] = -1; 114 | for (int i = 'A'; i <= 'Z'; i++) codes[i] = (byte) (i - 'A'); 115 | for (int i = 'a'; i <= 'z'; i++) codes[i] = (byte) (26 + i - 'a'); 116 | for (int i = '0'; i <= '9'; i++) codes[i] = (byte) (52 + i - '0'); 117 | codes['+'] = 62; 118 | codes['/'] = 63; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /gallery_remote.jpx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/prefs/QuickConfigPanel.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.prefs; 2 | 3 | import com.gallery.GalleryRemote.GalleryRemote; 4 | import com.gallery.GalleryRemote.Log; 5 | import com.gallery.GalleryRemote.model.Gallery; 6 | import com.gallery.GalleryRemote.util.GRI18n; 7 | 8 | import javax.swing.*; 9 | import java.awt.*; 10 | import java.awt.event.ActionEvent; 11 | import java.awt.event.ActionListener; 12 | import java.io.InputStream; 13 | import java.net.URL; 14 | import java.util.Iterator; 15 | 16 | /** 17 | * Created by IntelliJ IDEA. 18 | * User: paour 19 | * Date: May 8, 2003 20 | */ 21 | public class QuickConfigPanel extends PreferencePanel implements ActionListener { 22 | public static final String MODULE = "QuickCPa"; 23 | 24 | 25 | GalleryProperties newProps = null; 26 | 27 | JLabel icon = new JLabel(GRI18n.getString(MODULE, "icon")); 28 | GridBagLayout gridBagLayout1 = new GridBagLayout(); 29 | JLabel jLabel1 = new JLabel(); 30 | JTextField jURL = new JTextField(); 31 | JButton jSetup = new JButton(); 32 | JLabel jLabel2 = new JLabel(); 33 | 34 | public JLabel getIcon() { 35 | return icon; 36 | } 37 | 38 | public boolean isReversible() { 39 | return false; 40 | } 41 | 42 | public void readProperties(PropertiesFile props) { 43 | } 44 | 45 | public void writeProperties(PropertiesFile props) { 46 | } 47 | 48 | public void buildUI() { 49 | jbInit(); 50 | } 51 | 52 | private void jbInit() { 53 | jLabel1.setText(GRI18n.getString(MODULE, "URL")); 54 | this.setLayout(gridBagLayout1); 55 | 56 | jSetup.setText(GRI18n.getString(MODULE, "setup")); 57 | jLabel2.setText(GRI18n.getString(MODULE, "info")); 58 | jLabel2.setVerticalAlignment(SwingConstants.TOP); 59 | jLabel2.setPreferredSize(new Dimension(200, 100)); 60 | this.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 61 | , GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 2, 0, 2), 0, 0)); 62 | this.add(jURL, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0 63 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); 64 | this.add(jSetup, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0 65 | , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0)); 66 | this.add(jLabel2, new GridBagConstraints(0, 1, 3, 1, 1.0, 1.0 67 | , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 0, 0, 0), 0, 0)); 68 | 69 | jSetup.addActionListener(this); 70 | } 71 | 72 | public void actionPerformed(ActionEvent e) { 73 | try { 74 | InputStream content = (InputStream) new URL(jURL.getText()).getContent(); 75 | GalleryProperties newProps = new GalleryProperties(); 76 | newProps.load(content); 77 | 78 | StringBuffer overridden = new StringBuffer(""); 109 | 110 | JOptionPane.showMessageDialog(this, GRI18n.getString(MODULE, "confLoaded") + overridden.toString() + "", GRI18n.getString(MODULE, "done"), JOptionPane.PLAIN_MESSAGE); 111 | 112 | dialog.setVisible(false); 113 | } else { 114 | JOptionPane.showMessageDialog(this, GRI18n.getString(MODULE, "emptyConfFile"), "Error", JOptionPane.ERROR_MESSAGE); 115 | } 116 | } catch (Exception ex) { 117 | JOptionPane.showMessageDialog(this, "Could not find configuration file.", GRI18n.getString(MODULE, "error"), JOptionPane.ERROR_MESSAGE); 118 | Log.log(Log.LEVEL_ERROR, MODULE, "Fetching configuration failed"); 119 | Log.logException(Log.LEVEL_ERROR, MODULE, ex); 120 | } 121 | } 122 | 123 | public void resetUIState() { 124 | } 125 | } -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/GalleryRemoteMainFrame.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote; 2 | 3 | import com.gallery.GalleryRemote.prefs.PropertiesFile; 4 | import com.gallery.GalleryRemote.prefs.PreferenceNames; 5 | import com.gallery.GalleryRemote.util.OsShutdown; 6 | 7 | import javax.swing.*; 8 | import java.io.File; 9 | import java.io.IOException; 10 | import java.awt.*; 11 | import java.lang.reflect.Method; 12 | 13 | /** 14 | * Created by IntelliJ IDEA. 15 | * User: paour 16 | * Date: Jan 14, 2004 17 | */ 18 | public class GalleryRemoteMainFrame extends GalleryRemote { 19 | private MainFrame mainFrame = null; 20 | 21 | public void createProperties() { 22 | super.createProperties(); 23 | 24 | if (isAppletMode()) { 25 | properties = getAppletOverrides(properties, "GRDefault_"); 26 | } 27 | 28 | File f = new File(System.getProperty("user.home") 29 | + File.separator + ".GalleryRemote" 30 | + File.separator); 31 | 32 | boolean created = f.mkdirs(); 33 | 34 | File pf = new File(f, "GalleryRemote.properties"); 35 | 36 | if (!pf.exists()) { 37 | try { 38 | pf.createNewFile(); 39 | } catch (IOException e) { 40 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 41 | } 42 | } 43 | 44 | // On unix os's try to chmod the properties file because it contains passwords 45 | // [ 1738472 ] [GR] Insecure permissions - user/password world readable 46 | if (created && OsShutdown.isUnix()) { 47 | try { 48 | Class c = GalleryRemote.secureClassForName("com.gallery.GalleryRemote.PrivateShutdown"); 49 | Method m = c.getMethod("exec"); 50 | m.invoke(null, "chmod -R go-rwx " + f.getPath().replaceAll(" ", "\\ ")); 51 | } catch (Throwable e) { 52 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 53 | } 54 | } 55 | 56 | properties = new PropertiesFile(properties, pf.getPath(), "user"); 57 | 58 | if (isAppletMode()) { 59 | properties = getAppletOverrides(properties, "GROverride_"); 60 | } 61 | } 62 | 63 | protected void initializeGR() { 64 | super.initializeGR(); 65 | 66 | Log.startLog(properties.getIntProperty(PreferenceNames.LOG_LEVEL), 67 | properties.getBooleanProperty("toSysOut") || 68 | (System.getProperty("lax.stdout.redirect") != null && System.getProperty("lax.stdout.redirect").length() > 0)); 69 | 70 | try { 71 | if (isAppletMode() || !Update.upgrade()) { 72 | mainFrame = new MainFrame(); 73 | CoreUtils.initCore(); 74 | mainFrame.initMainFrame(); 75 | } else { 76 | Log.shutdown(); 77 | System.exit(0); 78 | } 79 | } catch (Exception e) { 80 | Log.logException(Log.LEVEL_CRITICAL, "Startup", e); 81 | Log.shutdown(); 82 | } 83 | 84 | if (!isAppletMode()) { 85 | new Thread() { 86 | public void run() { 87 | Update update = new Update(); 88 | update.check(true); 89 | } 90 | }.start(); 91 | } 92 | } 93 | 94 | public Frame getMainFrame() { 95 | return mainFrame; 96 | } 97 | 98 | public GalleryRemoteCore getCore() { 99 | return mainFrame; 100 | } 101 | 102 | protected void loadIcons() { 103 | super.loadIcons(); 104 | 105 | try { 106 | iAbout = new ImageIcon(GalleryRemote.class.getResource("/Information16.gif")); 107 | iSave = new ImageIcon(GalleryRemote.class.getResource("/Save16.gif")); 108 | iOpen = new ImageIcon(GalleryRemote.class.getResource("/Open16.gif")); 109 | iPreferences = new ImageIcon(GalleryRemote.class.getResource("/Preferences16.gif")); 110 | iQuit = new ImageIcon(GalleryRemote.class.getResource("/Stop16.gif")); 111 | iCut = new ImageIcon(GalleryRemote.class.getResource("/Cut16.gif")); 112 | iCopy = new ImageIcon(GalleryRemote.class.getResource("/Copy16.gif")); 113 | iPaste = new ImageIcon(GalleryRemote.class.getResource("/Paste16.gif")); 114 | 115 | iNewGallery = new ImageIcon(GalleryRemote.class.getResource("/WebComponentAdd16.gif")); 116 | iLogin = new ImageIcon(GalleryRemote.class.getResource("/WebComponent16.gif")); 117 | iNewAlbum = new ImageIcon(GalleryRemote.class.getResource("/New16.gif")); 118 | iNew = iNewAlbum; 119 | 120 | iUp = new ImageIcon(GalleryRemote.class.getResource("/Up16.gif")); 121 | iDown = new ImageIcon(GalleryRemote.class.getResource("/Down16.gif")); 122 | iDelete = new ImageIcon(GalleryRemote.class.getResource("/Delete16.gif")); 123 | iRight = new ImageIcon(GalleryRemote.class.getResource("/RotateRight24.gif")); 124 | iLeft = new ImageIcon(GalleryRemote.class.getResource("/RotateLeft24.gif")); 125 | iFlip = new ImageIcon(GalleryRemote.class.getResource("/FlipHoriz24.gif")); 126 | } catch (Exception e) { 127 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/util/NaturalOrderComparator.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.util; 2 | 3 | /* 4 | NaturalOrderComparator.java -- Perform 'natural order' comparisons of strings in Java. 5 | Copyright (C) 2003 by Pierre-Luc Paour 6 | 7 | Based on the C version by Martin Pool, of which this is more or less a straight conversion. 8 | Copyright (C) 2000 by Martin Pool 9 | 10 | This software is provided 'as-is', without any express or implied 11 | warranty. In no event will the authors be held liable for any damages 12 | arising from the use of this software. 13 | 14 | Permission is granted to anyone to use this software for any purpose, 15 | including commercial applications, and to alter it and redistribute it 16 | freely, subject to the following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you must not 19 | claim that you wrote the original software. If you use this software 20 | in a product, an acknowledgment in the product documentation would be 21 | appreciated but is not required. 22 | 2. Altered source versions must be plainly marked as such, and must not be 23 | misrepresented as being the original software. 24 | 3. This notice may not be removed or altered from any source distribution. 25 | */ 26 | 27 | import java.util.Arrays; 28 | import java.util.Collections; 29 | import java.util.Comparator; 30 | import java.util.List; 31 | 32 | public class NaturalOrderComparator implements Comparator { 33 | int compareRight(String a, String b) { 34 | int bias = 0; 35 | int ia = 0; 36 | int ib = 0; 37 | 38 | // The longest run of digits wins. That aside, the greatest 39 | // value wins, but we can't know that it will until we've scanned 40 | // both numbers to know that they have the same magnitude, so we 41 | // remember it in BIAS. 42 | for (; ; ia++, ib++) { 43 | char ca = charAt(a, ia); 44 | char cb = charAt(b, ib); 45 | 46 | if (!Character.isDigit(ca) 47 | && !Character.isDigit(cb)) { 48 | return bias; 49 | } else if (!Character.isDigit(ca)) { 50 | return -1; 51 | } else if (!Character.isDigit(cb)) { 52 | return +1; 53 | } else if (ca < cb) { 54 | if (bias == 0) { 55 | bias = -1; 56 | } 57 | } else if (ca > cb) { 58 | if (bias == 0) 59 | bias = +1; 60 | } else if (ca == 0 && cb == 0) { 61 | return bias; 62 | } 63 | } 64 | } 65 | 66 | public int compare(T o1, T o2) { 67 | String a = o1.toString(); 68 | String b = o2.toString(); 69 | 70 | int ia = 0, ib = 0; 71 | int nza = 0, nzb = 0; 72 | char ca, cb; 73 | int result; 74 | 75 | while (true) { 76 | // only count the number of zeroes leading the last number compared 77 | nza = nzb = 0; 78 | 79 | ca = charAt(a, ia); 80 | cb = charAt(b, ib); 81 | 82 | // skip over leading spaces or zeros 83 | while (Character.isSpaceChar(ca) || ca == '0') { 84 | if (ca == '0') { 85 | nza++; 86 | } else { 87 | // only count consecutive zeroes 88 | nza = 0; 89 | } 90 | 91 | ca = charAt(a, ++ia); 92 | } 93 | 94 | while (Character.isSpaceChar(cb) || cb == '0') { 95 | if (cb == '0') { 96 | nzb++; 97 | } else { 98 | // only count consecutive zeroes 99 | nzb = 0; 100 | } 101 | 102 | cb = charAt(b, ++ib); 103 | } 104 | 105 | // process run of digits 106 | if (Character.isDigit(ca) && Character.isDigit(cb)) { 107 | if ((result = compareRight(a.substring(ia), b.substring(ib))) != 0) { 108 | return result; 109 | } 110 | } 111 | 112 | if (ca == 0 && cb == 0) { 113 | // The strings compare the same. Perhaps the caller 114 | // will want to call strcmp to break the tie. 115 | return nza - nzb; 116 | } 117 | 118 | if (ca < cb) { 119 | return -1; 120 | } else if (ca > cb) { 121 | return +1; 122 | } 123 | 124 | ++ia; 125 | ++ib; 126 | } 127 | } 128 | 129 | static char charAt(String s, int i) { 130 | if (i >= s.length()) { 131 | return 0; 132 | } else { 133 | return s.charAt(i); 134 | } 135 | } 136 | 137 | public static void main(String[] args) { 138 | String[] strings = new String[]{"1-2", "1-02", "1-20", "10-20", "fred", "jane", 139 | "pic01", "pic2", "pic02", "pic02a", "pic3", "pic4", 140 | "pic 4 else", "pic 5", "pic05", "pic 5", "pic 5 something", 141 | "pic 6", "pic 7", "pic100", "pic100a", "pic120", "pic121", 142 | "pic02000", "tom", "x2-g8", "x2-y7", "x2-y08", "x8-y8"}; 143 | 144 | List orig = Arrays.asList(strings); 145 | 146 | System.out.println("Original: " + orig); 147 | 148 | List scrambled = Arrays.asList(strings); 149 | Collections.shuffle(scrambled); 150 | 151 | System.out.println("Scrambled: " + scrambled); 152 | 153 | Collections.sort(scrambled, new NaturalOrderComparator()); 154 | 155 | System.out.println("Sorted: " + scrambled); 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/util/ColorWellButton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2004 Bharat Mediratta 6 | * 7 | * ColorWellButton.java - Shows color chooser when clicked 8 | * 9 | * Copyright (C) 2002 Slava Pestov 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 | */ 25 | package com.gallery.GalleryRemote.util; 26 | 27 | import javax.swing.*; 28 | import java.awt.*; 29 | import java.awt.event.ActionEvent; 30 | import java.awt.event.ActionListener; 31 | 32 | public class ColorWellButton extends JButton { 33 | public static final String MODULE = "ColorWell"; 34 | 35 | public ColorWellButton(Color color) { 36 | setIcon(new ColorWell(color)); 37 | setMargin(new Insets(2, 2, 2, 2)); 38 | addActionListener(new ActionHandler()); 39 | } 40 | 41 | public Color getSelectedColor() { 42 | return ((ColorWell) getIcon()).color; 43 | } 44 | 45 | public void setSelectedColor(Color color) { 46 | ((ColorWell) getIcon()).color = color; 47 | repaint(); 48 | } 49 | 50 | static class ColorWell implements Icon { 51 | Color color; 52 | 53 | ColorWell(Color color) { 54 | this.color = color; 55 | } 56 | 57 | public int getIconWidth() { 58 | return 35; 59 | } 60 | 61 | public int getIconHeight() { 62 | return 10; 63 | } 64 | 65 | public void paintIcon(Component c, Graphics g, int x, int y) { 66 | if (color == null) 67 | return; 68 | 69 | g.setColor(color); 70 | g.fillRect(x, y, getIconWidth(), getIconHeight()); 71 | g.setColor(color.darker()); 72 | g.drawRect(x, y, getIconWidth() - 1, getIconHeight() - 1); 73 | } 74 | } 75 | 76 | class ActionHandler implements ActionListener { 77 | public void actionPerformed(ActionEvent evt) { 78 | Frame parent = DialogUtil.findParentWindow(ColorWellButton.this); 79 | JDialog dialog; 80 | if (parent != null) { 81 | dialog = new ColorPickerDialog(parent, 82 | GRI18n.getString(MODULE, "colorChooserTitle"), 83 | true); 84 | } else { 85 | dialog = new ColorPickerDialog(JOptionPane.getFrameForComponent(ColorWellButton.this), 86 | GRI18n.getString(MODULE, "colorChooserTitle"), 87 | true); 88 | } 89 | dialog.pack(); 90 | dialog.show(); 91 | } 92 | } 93 | 94 | /** 95 | * Replacement for the color picker dialog provided with Swing. This version 96 | * supports dialog as well as frame parents. 97 | * 98 | * @since jEdit 4.1pre7 99 | */ 100 | private class ColorPickerDialog extends JDialog implements ActionListener { 101 | public ColorPickerDialog(Frame parent, String title, boolean modal) { 102 | super(parent, title, modal); 103 | 104 | init(); 105 | } 106 | 107 | public ColorPickerDialog(Dialog parent, String title, boolean modal) { 108 | super(parent, title, modal); 109 | 110 | getContentPane().setLayout(new BorderLayout()); 111 | 112 | init(); 113 | } 114 | 115 | public void ok() { 116 | Color c = chooser.getColor(); 117 | if (c != null) 118 | setSelectedColor(c); 119 | setVisible(false); 120 | } 121 | 122 | public void cancel() { 123 | setVisible(false); 124 | } 125 | 126 | public void actionPerformed(ActionEvent evt) { 127 | if (evt.getSource() == ok) 128 | ok(); 129 | else 130 | cancel(); 131 | } 132 | 133 | private JColorChooser chooser; 134 | private JButton ok; 135 | private JButton cancel; 136 | 137 | private void init() { 138 | Color c = getSelectedColor(); 139 | if (c == null) 140 | chooser = new JColorChooser(); 141 | else 142 | chooser = new JColorChooser(c); 143 | 144 | getContentPane().add(BorderLayout.CENTER, chooser); 145 | 146 | Box buttons = new Box(BoxLayout.X_AXIS); 147 | buttons.add(Box.createGlue()); 148 | 149 | ok = new JButton(GRI18n.getString("Common", "OK")); 150 | ok.addActionListener(this); 151 | buttons.add(ok); 152 | buttons.add(Box.createHorizontalStrut(6)); 153 | getRootPane().setDefaultButton(ok); 154 | cancel = new JButton(GRI18n.getString("Common", "Cancel")); 155 | cancel.addActionListener(this); 156 | buttons.add(cancel); 157 | buttons.add(Box.createGlue()); 158 | 159 | getContentPane().add(BorderLayout.SOUTH, buttons); 160 | pack(); 161 | setLocationRelativeTo(getParent()); 162 | } 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/prefs/ProxyPanel.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.prefs; 2 | 3 | import com.gallery.GalleryRemote.util.GRI18n; 4 | 5 | import javax.swing.*; 6 | import java.awt.*; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | 10 | /** 11 | * Created by IntelliJ IDEA. 12 | * User: paour 13 | * Date: May 8, 2003 14 | */ 15 | public class ProxyPanel extends PreferencePanel implements ActionListener, PreferenceNames { 16 | public static final String MODULE = "ProxyPa"; 17 | 18 | 19 | JLabel icon = new JLabel(GRI18n.getString(MODULE, "icon")); 20 | GridBagLayout gridBagLayout1 = new GridBagLayout(); 21 | JCheckBox jUseProxy = new JCheckBox(); 22 | JLabel jLabel1 = new JLabel(); 23 | JLabel jLabel2 = new JLabel(); 24 | JLabel jLabel3 = new JLabel(); 25 | JLabel jLabel4 = new JLabel(); 26 | JTextField jProxyHost = new JTextField(); 27 | JTextField jProxyPort = new JTextField(); 28 | JTextField jProxyUsername = new JTextField(); 29 | JTextField jProxyPassword = new JTextField(); 30 | JPanel jPanel1 = new JPanel(); 31 | 32 | public JLabel getIcon() { 33 | return icon; 34 | } 35 | 36 | public void readProperties(PropertiesFile props) { 37 | jUseProxy.setSelected(props.getBooleanProperty(USE_PROXY)); 38 | 39 | jProxyHost.setText(props.getProperty(PROXY_HOST)); 40 | jProxyPort.setText(props.getProperty(PROXY_PORT)); 41 | jProxyUsername.setText(props.getProperty(PROXY_USERNAME)); 42 | jProxyPassword.setText(props.getBase64Property(PROXY_PASSWORD)); 43 | 44 | resetUIState(); 45 | } 46 | 47 | public void writeProperties(PropertiesFile props) { 48 | props.setBooleanProperty(USE_PROXY, jUseProxy.isSelected()); 49 | 50 | props.setProperty(PROXY_HOST, jProxyHost.getText()); 51 | props.setProperty(PROXY_PORT, jProxyPort.getText()); 52 | props.setProperty(PROXY_USERNAME, jProxyUsername.getText()); 53 | props.setBase64Property(PROXY_PASSWORD, jProxyPassword.getText()); 54 | } 55 | 56 | public void resetUIState() { 57 | if (jUseProxy.isSelected()) { 58 | jProxyHost.setEnabled(true); 59 | jProxyPort.setEnabled(true); 60 | jProxyUsername.setEnabled(true); 61 | jProxyPassword.setEnabled(true); 62 | jProxyHost.setBackground(UIManager.getColor("TextField.background")); 63 | jProxyPort.setBackground(UIManager.getColor("TextField.background")); 64 | jProxyUsername.setBackground(UIManager.getColor("TextField.background")); 65 | jProxyPassword.setBackground(UIManager.getColor("TextField.background")); 66 | } else { 67 | jProxyHost.setEnabled(false); 68 | jProxyPort.setEnabled(false); 69 | jProxyUsername.setEnabled(false); 70 | jProxyPassword.setEnabled(false); 71 | jProxyHost.setBackground(UIManager.getColor("TextField.inactiveBackground")); 72 | jProxyPort.setBackground(UIManager.getColor("TextField.inactiveBackground")); 73 | jProxyUsername.setBackground(UIManager.getColor("TextField.inactiveBackground")); 74 | jProxyPassword.setBackground(UIManager.getColor("TextField.inactiveBackground")); 75 | } 76 | } 77 | 78 | public void buildUI() { 79 | jbInit(); 80 | } 81 | 82 | private void jbInit() { 83 | jUseProxy.setText(GRI18n.getString(MODULE, "useProxy")); 84 | this.setLayout(gridBagLayout1); 85 | jLabel1.setText(GRI18n.getString(MODULE, "proxyURL")); 86 | jLabel2.setText(GRI18n.getString(MODULE, "proxyPort")); 87 | jLabel3.setText(GRI18n.getString(MODULE, "username")); 88 | jLabel4.setText(GRI18n.getString(MODULE, "passwd")); 89 | jProxyHost.setText(""); 90 | jProxyPort.setText(""); 91 | jProxyUsername.setText(""); 92 | jProxyPassword.setText(""); 93 | this.add(jUseProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0 94 | , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); 95 | this.add(jLabel1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 96 | , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 20, 5, 5), 0, 0)); 97 | this.add(jLabel2, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 98 | , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 20, 5, 5), 0, 0)); 99 | this.add(jLabel3, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 100 | , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 20, 5, 5), 0, 0)); 101 | this.add(jLabel4, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0 102 | , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 20, 5, 5), 0, 0)); 103 | this.add(jProxyHost, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 104 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0)); 105 | this.add(jProxyPort, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0 106 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0)); 107 | this.add(jProxyUsername, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0 108 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0)); 109 | this.add(jProxyPassword, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0 110 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0)); 111 | this.add(jPanel1, new GridBagConstraints(0, 5, 2, 1, 1.0, 1.0 112 | , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); 113 | 114 | jUseProxy.addActionListener(this); 115 | } 116 | 117 | public void actionPerformed(ActionEvent e) { 118 | resetUIState(); 119 | } 120 | } 121 | 122 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/MoveAlbumDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | package com.gallery.GalleryRemote; 22 | 23 | import com.gallery.GalleryRemote.model.Album; 24 | import com.gallery.GalleryRemote.model.Gallery; 25 | import com.gallery.GalleryRemote.util.DialogUtil; 26 | import com.gallery.GalleryRemote.util.GRI18n; 27 | 28 | import javax.swing.*; 29 | import java.awt.*; 30 | import java.awt.event.ActionEvent; 31 | import java.awt.event.ActionListener; 32 | import java.util.Vector; 33 | import java.util.Enumeration; 34 | 35 | /** 36 | * Description of the Class 37 | * 38 | * @author paour 39 | * @created October 18, 2002 40 | */ 41 | public class MoveAlbumDialog extends JDialog 42 | implements ActionListener { 43 | public final static String MODULE = "MoveAlbum"; 44 | 45 | Gallery gallery = null; 46 | Album album = null; 47 | //Album rootAlbum = null; 48 | 49 | JLabel jLabel2 = new JLabel(); 50 | JLabel jLabel3 = new JLabel(); 51 | JLabel jLabel4 = new JLabel(); 52 | JLabel jLabel5 = new JLabel(); 53 | JLabel jLabel1 = new JLabel(); 54 | JLabel jAlbumName = new JLabel(); 55 | JComboBox jAlbum = null; 56 | JPanel jPanel2 = new JPanel(); 57 | JButton jOk = new JButton(); 58 | JButton jCancel = new JButton(); 59 | 60 | Album newParent = null; 61 | 62 | 63 | /** 64 | * Constructor for the NewAlbumDialog object 65 | * 66 | * @param owner Description of Parameter 67 | * @param gallery Description of Parameter 68 | * @param defaultAlbum Description of Parameter 69 | */ 70 | public MoveAlbumDialog(Frame owner, Gallery gallery, Album album) { 71 | super(owner, true); 72 | 73 | this.gallery = gallery; 74 | this.album = album; 75 | 76 | jbInit(); 77 | 78 | pack(); 79 | DialogUtil.center(this, owner); 80 | 81 | setVisible(true); 82 | } 83 | 84 | 85 | private void jbInit() { 86 | this.getContentPane().setLayout(new GridBagLayout()); 87 | this.setModal(true); 88 | this.setTitle(GRI18n.getString(MODULE, "title")); 89 | 90 | Vector albums = new Vector(gallery.getFlatAlbumList()); 91 | //rootAlbum = new Album(gallery); 92 | //rootAlbum.setSuppressEvents(true); 93 | //rootAlbum.setTitle(GRI18n.getString(MODULE, "rootAlbmTitle")); 94 | //rootAlbum.setName("root.root"); 95 | Object rootAlbum = gallery.getRoot(); 96 | if (album.getParentAlbum() == rootAlbum) { 97 | albums.remove(rootAlbum); 98 | } 99 | removeChildren(albums, album); 100 | 101 | jAlbum = new JComboBox(albums); 102 | jAlbum.setFont(UIManager.getFont("Label.font")); 103 | 104 | jCancel.setText(GRI18n.getString("Common", "Cancel")); 105 | jCancel.setActionCommand("Cancel"); 106 | jOk.setText(GRI18n.getString("Common", "OK")); 107 | jOk.setActionCommand("OK"); 108 | jAlbumName.setText(GRI18n.getString(MODULE, "moveAlbm", new String[] {album.getName()})); 109 | 110 | jLabel2.setText(GRI18n.getString(MODULE, "parentAlbm")); 111 | 112 | this.getContentPane().add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 113 | , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 4)); 114 | this.getContentPane().add(jAlbumName, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0 115 | , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); 116 | this.getContentPane().add(jAlbum, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 117 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 5), 0, 0)); 118 | this.getContentPane().add(jPanel2, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 119 | , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); 120 | 121 | jPanel2.setLayout(new GridLayout(1, 2, 5, 0)); 122 | jPanel2.add(jCancel, null); 123 | jPanel2.add(jOk, null); 124 | 125 | jOk.addActionListener(this); 126 | jCancel.addActionListener(this); 127 | 128 | getRootPane().setDefaultButton(jOk); 129 | } 130 | 131 | public void removeChildren(Vector albums, Album album) { 132 | for (Enumeration it = album.children(); it.hasMoreElements();) { 133 | Album subAlbum = (Album) it.nextElement(); 134 | removeChildren(albums, subAlbum); 135 | } 136 | 137 | albums.remove(album); 138 | } 139 | 140 | /** 141 | * Description of the Method 142 | * 143 | * @param e Description of Parameter 144 | */ 145 | public void actionPerformed(ActionEvent e) { 146 | String command = e.getActionCommand(); 147 | Log.log(Log.LEVEL_INFO, MODULE, "Command selected " + command); 148 | 149 | if (command.equals("Cancel")) { 150 | setVisible(false); 151 | } else if (command.equals("OK")) { 152 | newParent = (Album) jAlbum.getSelectedItem(); 153 | //if (newParent == rootAlbum) { 154 | // newParent = null; 155 | //} 156 | 157 | setVisible(false); 158 | } 159 | } 160 | 161 | public Album getNewParent() { 162 | return newParent; 163 | } 164 | } 165 | 166 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/GRAppletSlideshow.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote; 2 | 3 | import com.gallery.GalleryRemote.util.GRI18n; 4 | import com.gallery.GalleryRemote.util.ImageUtils; 5 | import com.gallery.GalleryRemote.model.Album; 6 | import com.gallery.GalleryRemote.model.Picture; 7 | import com.gallery.GalleryRemote.prefs.SlideshowPanel; 8 | import com.gallery.GalleryRemote.prefs.PreferenceNames; 9 | 10 | import javax.swing.*; 11 | import javax.swing.event.ListDataListener; 12 | import javax.swing.event.ListDataEvent; 13 | import java.awt.*; 14 | import java.awt.event.ActionEvent; 15 | import java.awt.event.ActionListener; 16 | import java.util.ArrayList; 17 | 18 | /** 19 | * Created by IntelliJ IDEA. 20 | * User: paour 21 | * Date: Oct 30, 2003 22 | */ 23 | public class GRAppletSlideshow 24 | extends GRAppletMini 25 | implements GalleryRemoteCore, ActionListener, ListDataListener, PreferenceNames { 26 | public static final String MODULE = "AppletSlideshow"; 27 | JButton jStart; 28 | SlideshowPanel jSlidePanel; 29 | SlideshowFrame slideshowFrame = null; 30 | AppletInfo info; 31 | 32 | public GRAppletSlideshow() { 33 | coreClass = "com.gallery.GalleryRemote.GalleryRemoteMini"; 34 | } 35 | 36 | public void startup() { 37 | galleries = new DefaultComboBoxModel(); 38 | info = getGRAppletInfo(); 39 | 40 | gallery = info.gallery; 41 | 42 | galleries.addElement(gallery); 43 | ImageUtils.deferredTasks(); 44 | 45 | album = new Album(gallery); 46 | album.setName(info.albumName); 47 | album.addListDataListener(this); 48 | 49 | album.fetchAlbumImages(jStatusBar, 50 | GalleryRemote._().properties.getBooleanProperty(SLIDESHOW_RECURSIVE, true), 51 | GalleryRemote._().properties.getIntProperty(SLIDESHOW_MAX_PICTURES, 0)); 52 | } 53 | 54 | protected void jbInit() { 55 | getContentPane().setLayout(new GridBagLayout()); 56 | 57 | jStart = new JButton(GRI18n.getString(MODULE, "Start")); 58 | 59 | jStatusBar = new StatusBar(75); 60 | 61 | jSlidePanel = new SlideshowPanel(); 62 | 63 | JPanel filler1 = new JPanel(); 64 | filler1.setMinimumSize(new Dimension(0, 0)); 65 | JPanel filler2 = new JPanel(); 66 | filler2.setMinimumSize(new Dimension(0, 0)); 67 | 68 | getContentPane().add(jSlidePanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0 69 | , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); 70 | getContentPane().add(new JLabel(GRI18n.getString(MODULE, "Disabled")), new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0 71 | , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0)); 72 | getContentPane().add(filler2, new GridBagConstraints(0, 2, 1, 1, 0.1, 1.0 73 | , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0)); 74 | getContentPane().add(jStart, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0 75 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0)); 76 | getContentPane().add(filler1, new GridBagConstraints(0, 4, 1, 1, 0.1, 1.0 77 | , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0)); 78 | getContentPane().add(jStatusBar, new GridBagConstraints(0, 5 , 1, 1, 1.0, 0.0 79 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); 80 | 81 | jSlidePanel.buildUI(); 82 | jSlidePanel.remove(jSlidePanel.spacerPanel); 83 | jSlidePanel.readProperties(GalleryRemote._().properties); 84 | jStart.addActionListener(this); 85 | jStart.setEnabled(false); 86 | 87 | jPicturesList = new DroppableList(); 88 | } 89 | 90 | public void setInProgress(boolean inProgress) { 91 | jStart.setEnabled(!inProgress && album.getSize() > 0); 92 | 93 | this.inProgress = inProgress; 94 | } 95 | 96 | public void actionPerformed(ActionEvent e) { 97 | jSlidePanel.writeProperties(GalleryRemote._().properties); 98 | 99 | if (slideshowFrame == null) { 100 | slideshowFrame = new SlideshowFrame(); 101 | } 102 | 103 | slideshowFrame.showSlideshow(); 104 | slideshowFrame.start(album.getPicturesList()); 105 | 106 | // null slideshowFrame so that next time the user clicks the button 107 | // they get a blank one, in case they changed positioning 108 | slideshowFrame = null; 109 | } 110 | 111 | public void shutdown() { 112 | if (hasStarted && GalleryRemote._() != null) { 113 | jSlidePanel.writeProperties(GalleryRemote._().properties); 114 | //GalleryRemote._().properties.write(); 115 | } 116 | 117 | super.shutdown(); 118 | } 119 | 120 | public void contentsChanged(ListDataEvent e) { 121 | if (album.isHasFetchedImages()) { 122 | Log.log(Log.LEVEL_TRACE, MODULE, "Pictures were just added to the album. Preload the first one."); 123 | 124 | new Thread() { 125 | public void run() { 126 | slideshowFrame = new SlideshowFrame(); 127 | int index = 0; 128 | ArrayList picturesList = album.getPicturesList(); 129 | 130 | if (info.slideshowFrom != null) { 131 | for (int i = 0; i < picturesList.size(); i++) { 132 | if (info.slideshowFrom.equals(((Picture) picturesList.get(i)).getUniqueId())) { 133 | Log.log(Log.LEVEL_TRACE, MODULE, "Starting slideshow from index " + i); 134 | index = i; 135 | slideshowFrame.wantIndex = i - 1; 136 | break; 137 | } 138 | } 139 | } 140 | 141 | if (album.getSize() > index) { 142 | ImageUtils.download((Picture) picturesList.get(index), getGraphicsConfiguration().getBounds().getSize(), GalleryRemote._().getCore().getMainStatusUpdate(), null); 143 | } else { 144 | JOptionPane.showMessageDialog(GRAppletSlideshow.this, GRI18n.getString(MODULE, "emptyAlbum")); 145 | } 146 | } 147 | }.start(); 148 | } 149 | } 150 | 151 | public void intervalAdded(ListDataEvent e) {} 152 | 153 | public void intervalRemoved(ListDataEvent e) {} 154 | } 155 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/util/MacOSXAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | 22 | package com.gallery.GalleryRemote.util; 23 | 24 | import com.apple.eawt.ApplicationAdapter; 25 | import com.apple.eawt.ApplicationEvent; 26 | import com.gallery.GalleryRemote.Log; 27 | 28 | import javax.swing.*; 29 | import java.lang.reflect.Method; 30 | 31 | /** 32 | * Single class with hooks to handle existing functionality "about", "quit" 33 | * and "preferences" within the MacOSX application menu 34 | * 35 | * @author iluvatar 36 | * Date: Aug 27, 2003 37 | * Time: 5:52:55 PM 38 | */ 39 | public class MacOSXAdapter extends ApplicationAdapter { 40 | private static MacOSXAdapter theAdapter; 41 | private static com.apple.eawt.Application theApplication; 42 | 43 | private JFrame mainApplication; 44 | 45 | private static String quitMethod; 46 | private static String preferencesMethod; 47 | private static String aboutMethod; 48 | 49 | public static final String MODULE = "MacOSX"; 50 | 51 | 52 | public static void registerMacOSXApplication(JFrame srcApp, String about, String quit, String pref) { 53 | if (theApplication == null) { 54 | theApplication = new com.apple.eawt.Application(); 55 | } 56 | 57 | if (theAdapter == null) { 58 | theAdapter = new MacOSXAdapter(srcApp); 59 | } 60 | theApplication.addApplicationListener(theAdapter); 61 | 62 | aboutMethod = about; 63 | quitMethod = quit; 64 | if (!pref.equalsIgnoreCase("")) { 65 | theApplication.setEnabledPreferencesMenu(true); 66 | preferencesMethod = pref; 67 | } 68 | } 69 | 70 | public void handleAbout(ApplicationEvent ae) { 71 | if (mainApplication != null) { 72 | try { 73 | ae.setHandled(true); 74 | // this may happen outside of main application flow 75 | Class caller = Class.forName(mainApplication.getClass().getName()); 76 | Method callMethod = caller.getDeclaredMethod(aboutMethod); 77 | if (callMethod != null) { 78 | callMethod.invoke(mainApplication); 79 | } 80 | 81 | } catch (NoClassDefFoundError e) { 82 | Log.log(Log.LEVEL_ERROR, MODULE, "This version of Mac OS X does not support the Apple EAWT. Application Menu handling has been disabled (" + e + ")"); 83 | } catch (ClassNotFoundException e) { 84 | Log.log(Log.LEVEL_ERROR, MODULE, "This version of Mac OS X does not support the Apple EAWT. Application Menu handling has been disabled (" + e + ")"); 85 | } catch (Exception e) { 86 | Log.log(Log.LEVEL_ERROR, MODULE, "Exception while loading the MacOSXAdapter:"); 87 | e.printStackTrace(); 88 | } 89 | 90 | } else { 91 | throw new IllegalStateException("handleAbout: mainApplication instance detached"); 92 | } 93 | } 94 | 95 | public void handleQuit(ApplicationEvent ae) { 96 | if (mainApplication != null) { 97 | try { 98 | ae.setHandled(false); 99 | // this may happen outside of main application flow 100 | Class caller = Class.forName(mainApplication.getClass().getName()); 101 | Method callMethod = caller.getDeclaredMethod(quitMethod); 102 | if (callMethod != null) { 103 | callMethod.invoke(mainApplication); 104 | } 105 | 106 | } catch (NoClassDefFoundError e) { 107 | Log.log(Log.LEVEL_ERROR, MODULE, "This version of Mac OS X does not support the Apple EAWT. Application Menu handling has been disabled (" + e + ")"); 108 | } catch (ClassNotFoundException e) { 109 | Log.log(Log.LEVEL_ERROR, MODULE, "This version of Mac OS X does not support the Apple EAWT. Application Menu handling has been disabled (" + e + ")"); 110 | } catch (Exception e) { 111 | Log.log(Log.LEVEL_ERROR, MODULE, "Exception while loading the MacOSXAdapter:"); 112 | e.printStackTrace(); 113 | } 114 | 115 | } else { 116 | throw new IllegalStateException("handleQuit: mainApplication instance detached"); 117 | } 118 | } 119 | 120 | public void handlePreferences(ApplicationEvent ae) { 121 | if (mainApplication != null) { 122 | try { 123 | // this may happen outside of main application flow 124 | Class caller = Class.forName(mainApplication.getClass().getName()); 125 | Method callMethod = caller.getDeclaredMethod(preferencesMethod); 126 | if (callMethod != null) { 127 | callMethod.invoke(mainApplication); 128 | } 129 | ae.setHandled(true); 130 | 131 | } catch (NoClassDefFoundError e) { 132 | Log.log(Log.LEVEL_ERROR, MODULE, "This version of Mac OS X does not support the Apple EAWT. Application Menu handling has been disabled (" + e + ")"); 133 | } catch (ClassNotFoundException e) { 134 | Log.log(Log.LEVEL_ERROR, MODULE, "This version of Mac OS X does not support the Apple EAWT. Application Menu handling has been disabled (" + e + ")"); 135 | } catch (Exception e) { 136 | Log.log(Log.LEVEL_ERROR, MODULE, "Exception while loading the MacOSXAdapter:"); 137 | e.printStackTrace(); 138 | } 139 | 140 | } else { 141 | throw new IllegalStateException("handlePreferences: mainApplication instance detached"); 142 | } 143 | } 144 | 145 | private MacOSXAdapter(JFrame srcApp) { 146 | mainApplication = srcApp; 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/prefs/PreferenceNames.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.prefs; 2 | 3 | /** 4 | * Created by IntelliJ IDEA. 5 | * User: paour 6 | * Date: Jun 11, 2003 7 | */ 8 | public interface PreferenceNames { 9 | // General panel 10 | public static final String SHOW_THUMBNAILS = "showThumbnails"; 11 | public static final String THUMBNAIL_SIZE = "thumbnailSize"; 12 | public static final String SAVE_PASSWORDS = "savePasswords"; 13 | public static final String LOG_LEVEL = "logLevel"; 14 | public static final String UPDATE_CHECK = "updateCheck"; 15 | public static final String UPDATE_CHECK_BETA = "updateCheckBeta"; 16 | public static final String UPDATE_URL = "updateUrl"; 17 | public static final String UPDATE_URL_BETA = "updateUrlBeta"; 18 | public static final String UI_LOCALE = "uiLocale"; 19 | public static final String UI_LOCALE_DEV = "uiLocaleDev"; 20 | public static final String MRU_COUNT = "mruCount"; 21 | public static final String MRU_BASE = "mruItem."; 22 | public static final String LOAD_LAST_FILE = "loadLastMRU"; 23 | 24 | // Upload panel 25 | public static final String RESIZE_BEFORE_UPLOAD = "resizeBeforeUpload"; 26 | public static final String RESIZE_TO = "resizeTo"; 27 | public static final String RESIZE_TO_DEFAULT = "resizeToDefault"; 28 | public static final String AUTO_CAPTIONS = "autoCaptions"; 29 | public static final int AUTO_CAPTIONS_NONE = 0; 30 | public static final int AUTO_CAPTIONS_FILENAME = 1; 31 | public static final int AUTO_CAPTIONS_COMMENT = 2; 32 | public static final int AUTO_CAPTIONS_DATE = 3; 33 | //public static final String SET_CAPTIONS_NONE = "setCaptionsNone"; 34 | //public static final String SET_CAPTIONS_WITH_FILENAMES = "setCaptionsWithFilenames"; 35 | //public static final String SET_CAPTIONS_WITH_METADATA_COMMENT = "setCaptionsWithMetadataComment"; 36 | public static final String CAPTION_STRIP_EXTENSION = "captionStripExtension"; 37 | public static final String HTML_ESCAPE_CAPTIONS = "htmlEscapeCaptions"; 38 | public static final String EXIF_AUTOROTATE = "exifAutorotate"; 39 | 40 | // URL panel 41 | public static final String USERNAME = "username."; 42 | public static final String PASSWORD = "password."; 43 | public static final String GURL = "url."; 44 | public static final String APPLET = "Applet"; 45 | public static final String ALIAS = "alias."; 46 | public static final String KEY = "key."; 47 | public static final String FORCE_GALLERY_VERSION = "forceGalleryVersion."; 48 | public static final String FORCE_PROTOCOL_ENCODING = "forceProtocolEncoding."; 49 | public static final String RESIZE_JPEG_QUALITY = "resizeJpegQuality."; 50 | public static final String AUTO_LOAD_ON_STARTUP = "autoLoadOnStartup."; 51 | 52 | // Proxy panel 53 | public static final String USE_PROXY = "useProxy"; 54 | public static final String PROXY_HOST = "proxyHost"; 55 | public static final String PROXY_PORT = "proxyPort"; 56 | public static final String PROXY_USERNAME = "proxyUsername"; 57 | public static final String PROXY_PASSWORD = "proxyPassword"; 58 | 59 | // Slideshow 60 | public static final String SLIDESHOW_PROGRESS = "slideshowProgressLocation"; 61 | public static final String SLIDESHOW_CAPTION = "slideshowCaptionLocation"; 62 | public static final String SLIDESHOW_EXTRA = "slideshowExtraLocation"; 63 | public static final String SLIDESHOW_URL = "slideshowUrlLocation"; 64 | public static final String SLIDESHOW_ALBUM = "slideshowAlbumLocation"; 65 | public static final String SLIDESHOW_SUMMARY = "slideshowSummaryLocation"; 66 | public static final String SLIDESHOW_DESCRIPTION = "slideshowDescriptionLocation"; 67 | public static final String SLIDESHOW_DELAY = "slideshowDelay"; 68 | public static final String SLIDESHOW_LOWREZ = "slideshowLowRez"; 69 | public static final String SLIDESHOW_RANDOM = "slideshowRandom"; 70 | public static final String SLIDESHOW_MAX_PICTURES = "slideshowMaxPictures"; 71 | public static final String SLIDESHOW_RECURSIVE = "slideshowRecursive"; 72 | public static final String SLIDESHOW_NOSTRETCH = "slideshowNoStretch"; 73 | public static final String SLIDESHOW_COLOR = "slideshowColor"; 74 | public static final String SLIDESHOW_PRELOADALL = "slideshowPreloadAll"; 75 | public static final String SLIDESHOW_LOOP = "slideshowLoop"; 76 | public static final String SLIDESHOW_FONTNAME = "slideshowFontName"; 77 | public static final String SLIDESHOW_FONTSIZE = "slideshowFontSize"; 78 | public static final String SLIDESHOW_FONTTHICKNESS = "slideshowFontThickness"; 79 | public static final String SLIDESHOW_TRANSITION_DURATION = "slideshowTransitionDuration"; 80 | 81 | // Other 82 | public static final String SUPPRESS_WARNING_IM = "suppressWarningIM"; 83 | public static final String SUPPRESS_WARNING_JPEGTRAN = "suppressWarningJpegtran"; 84 | public static final String SUPPRESS_WARNING_JPEGTRAN_CROP = "suppressWarningJpegtranCrop"; 85 | public static final String SUPPRESS_WARNING_CORRUPTED = "suppressWarningCorrupted"; 86 | public static final String SUPPRESS_WARNING_JAVA = "suppressWarningJava"; 87 | public static final String SUPPRESS_WARNING_OUT_OF_MEMORY = "suppressWarningOutOfMemory"; 88 | public static final String USE_JAVA_RESIZE = "useJavaResize"; 89 | public static final String FONT_OVERRIDE_NAME = "fontOverrideName"; 90 | public static final String FONT_OVERRIDE_STYLE = "fontOverrideStyle"; 91 | public static final String FONT_OVERRIDE_SIZE = "fontOverrideSize"; 92 | public static final String PREVIEW_TRANSITION_DURATION = "previewTransitionDuration"; 93 | public static final String ALLOW_UNACCELERATED_TRANSITION = "allowUnacceleratedTransition"; 94 | public static final String PREVIEW_DRAW_THIRDS = "previewDrawThirds"; 95 | 96 | // Applet 97 | public static final String APPLET_SHOW_RESIZE = "appletShowResize"; 98 | public static final String APPLET_DIVIDER_LOCATION = "appletDividerLocation"; 99 | public static final String APPLET_FONTSIZE = "appletFontSize"; 100 | 101 | // Sort 102 | public static final String SORT_TYPE = "sortType"; 103 | public static final int SORT_TYPES = 2; 104 | public static final int SORT_TYPE_FILENAME = 1; 105 | public static final int SORT_TYPE_EXIF_CREATION = 2; 106 | } 107 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/util/ExifImageUtils.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.util; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.text.ParseException; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Date; 8 | 9 | import com.drew.imaging.jpeg.JpegMetadataReader; 10 | import com.drew.imaging.jpeg.JpegProcessingException; 11 | import com.drew.metadata.Directory; 12 | import com.drew.metadata.Metadata; 13 | import com.drew.metadata.exif.ExifDirectory; 14 | import com.drew.metadata.iptc.IptcDirectory; 15 | import com.gallery.GalleryRemote.GalleryFileFilter; 16 | import com.gallery.GalleryRemote.Log; 17 | import com.gallery.GalleryRemote.model.ExifData; 18 | 19 | /** 20 | * Created by IntelliJ IDEA. 21 | * User: paour 22 | * Date: Dec 8, 2003 23 | */ 24 | public class ExifImageUtils { 25 | public static final String MODULE = "ExifUtils"; 26 | 27 | static SimpleDateFormat sdf = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss"); 28 | 29 | public static ExifData getExifData(String filename) { 30 | if (GalleryFileFilter.canManipulateJpeg(filename)) { 31 | File jpegFile = new File(filename); 32 | 33 | try { 34 | Metadata metadata = JpegMetadataReader.readMetadata(jpegFile); 35 | Directory exifDirectory = metadata.getDirectory(ExifDirectory.class); 36 | Directory iptcDirectory = metadata.getDirectory(IptcDirectory.class); 37 | 38 | ExifData exif = new ExifData(); 39 | 40 | exif.setCaption(getCaption(exifDirectory, iptcDirectory, filename)); 41 | exif.setTargetOrientation(getTargetOrientation(exifDirectory, iptcDirectory, filename)); 42 | exif.setCreationDate(getCreationDate(exifDirectory, iptcDirectory, filename)); 43 | 44 | return exif; 45 | } catch (FileNotFoundException e) { 46 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 47 | return null; 48 | } catch (JpegProcessingException e) { 49 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 50 | return null; 51 | } 52 | } else { 53 | return null; 54 | } 55 | } 56 | 57 | public static Date getCreationDate(Directory exifDirectory, Directory iptcDirectory, String filename) { 58 | String exifDateCreated = exifDirectory.getString(ExifDirectory.TAG_DATETIME_ORIGINAL); 59 | 60 | if (exifDateCreated == null) { 61 | Log.log(Log.LEVEL_TRACE, MODULE, "Picture " + filename + 62 | " has no EXIF Date Created"); 63 | return null; 64 | } 65 | 66 | Log.log(Log.LEVEL_TRACE, MODULE, "Picture " + filename + 67 | " has EXIF Date Created of " + exifDateCreated); 68 | try { 69 | return sdf.parse(exifDateCreated); 70 | } catch (ParseException e) { 71 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 72 | return null; 73 | } 74 | } 75 | 76 | public static String getCaption(Directory exifDirectory, Directory iptcDirectory, String filename) { 77 | String caption = exifDirectory.getString(ExifDirectory.TAG_IMAGE_DESCRIPTION); 78 | 79 | if (caption != null && caption.length() != 0) { 80 | Log.log(Log.LEVEL_TRACE, MODULE, "Picture " + filename + " TAG_IMAGE_DESCRIPTION: " + caption); 81 | return caption.trim(); 82 | } 83 | 84 | caption = exifDirectory.getString(ExifDirectory.TAG_USER_COMMENT); 85 | 86 | if (caption != null && caption.length() !=0) { 87 | Log.log(Log.LEVEL_TRACE, MODULE, "Picture " + filename + " TAG_USER_COMMENT: " + caption); 88 | return caption.trim(); 89 | } 90 | 91 | caption = iptcDirectory.getString(IptcDirectory.TAG_CAPTION); 92 | 93 | if (caption != null && caption.length() !=0) { 94 | Log.log(Log.LEVEL_TRACE, MODULE, "Picture " + filename + " IPTC DESCRIPTION: " + caption); 95 | return caption.trim(); 96 | } 97 | 98 | Log.log(Log.LEVEL_TRACE, MODULE, "Picture " + filename + " has no usable EXIF or IPTC info"); 99 | return null; 100 | } 101 | 102 | public static ImageUtils.AngleFlip getTargetOrientation(Directory exifDirectory, Directory iptcDirectory, String filename) { 103 | String orientation = exifDirectory.getString(ExifDirectory.TAG_ORIENTATION); 104 | 105 | if (orientation == null) { 106 | Log.log(Log.LEVEL_TRACE, MODULE, "Picture " + filename + " has no EXIF ORIENTATION tag"); 107 | return null; 108 | } else { 109 | Log.log(Log.LEVEL_TRACE, MODULE, "Picture " + filename + " EXIF ORIENTATION: " + orientation); 110 | 111 | int or = 0; 112 | ImageUtils.AngleFlip af = null; 113 | try { 114 | or = Integer.parseInt(orientation); 115 | } catch (NumberFormatException e) { 116 | Log.log(Log.LEVEL_ERROR, MODULE, "Couldn't parse orientation " + orientation + " for " + filename); 117 | return null; 118 | } 119 | 120 | switch (or) { 121 | case 1: 122 | af = new ImageUtils.AngleFlip(0, false); 123 | break; 124 | 125 | case 2: 126 | af = new ImageUtils.AngleFlip(0, true); 127 | break; 128 | 129 | case 3: 130 | af = new ImageUtils.AngleFlip(2, false); 131 | break; 132 | 133 | case 4: 134 | af = new ImageUtils.AngleFlip(2, true); 135 | break; 136 | 137 | case 5: 138 | af = new ImageUtils.AngleFlip(1, true); 139 | break; 140 | 141 | case 6: 142 | af = new ImageUtils.AngleFlip(1, false); 143 | break; 144 | 145 | case 7: 146 | af = new ImageUtils.AngleFlip(3, true); 147 | break; 148 | 149 | case 8: 150 | af = new ImageUtils.AngleFlip(3, false); 151 | break; 152 | 153 | default: 154 | Log.log(Log.LEVEL_ERROR, MODULE, "Couldn't parse orientation " + orientation + " for " + filename); 155 | return null; 156 | } 157 | 158 | return af; 159 | } 160 | } 161 | 162 | /*public static void resetExifOrientation(String filename) { 163 | if (GalleryFileFilter.canManipulateJpeg(filename)) { 164 | File jpegFile = new File(filename); 165 | try { 166 | Metadata metadata = JpegMetadataReader.readMetadata(jpegFile); 167 | 168 | Directory exifDirectory = metadata.getDirectory(ExifDirectory.class); 169 | exifDirectory.setString(ExifDirectory.TAG_ORIENTATION, "1"); 170 | 171 | // todo: this doesn't do anything at present: the library can only READ 172 | // EXIF, not write to it... 173 | } catch (FileNotFoundException e) { 174 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 175 | } catch (JpegProcessingException e) { 176 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 177 | } 178 | } 179 | }*/ 180 | } 181 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/ThumbnailCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | package com.gallery.GalleryRemote; 22 | 23 | import com.gallery.GalleryRemote.model.Picture; 24 | import com.gallery.GalleryRemote.util.GRI18n; 25 | import com.gallery.GalleryRemote.util.ImageUtils; 26 | 27 | import javax.imageio.ImageIO; 28 | import javax.imageio.ImageReader; 29 | import javax.imageio.IIOException; 30 | import javax.imageio.stream.ImageInputStream; 31 | import java.awt.*; 32 | import java.awt.image.BufferedImage; 33 | import java.util.HashMap; 34 | import java.util.Iterator; 35 | import java.util.Stack; 36 | import java.io.IOException; 37 | import java.net.URLConnection; 38 | 39 | /** 40 | * Thumbnail cache loads and resizes images in the background for display in 41 | * the list of Pictures 42 | * 43 | * @author paour 44 | */ 45 | public class ThumbnailCache implements Runnable { 46 | public static final String MODULE = "ThumbCache"; 47 | 48 | boolean stillRunning = false; 49 | Stack toLoad = new Stack(); 50 | HashMap thumbnails = new HashMap(); 51 | 52 | /** 53 | * Main processing method for the ThumbnailLoader object 54 | */ 55 | public void run() { 56 | Thread.yield(); 57 | int loaded = 0; 58 | GalleryRemote._().getCore().getMainStatusUpdate().startProgress(StatusUpdate.LEVEL_CACHE, 0, toLoad.size(), GRI18n.getString(MODULE, "loadThmb"), false); 59 | //Log.log(Log.TRACE, MODULE, "Starting " + iFilename); 60 | while (!toLoad.isEmpty()) { 61 | Picture p = (Picture) toLoad.pop(); 62 | Image i = null; 63 | 64 | if (!thumbnails.containsKey(p)) { 65 | if (p.isOnline()) { 66 | Log.log(Log.LEVEL_TRACE, MODULE, "Fetching thumbnail " + p.getUrlThumbnail()); 67 | try { 68 | URLConnection conn = ImageUtils.openUrlConnection(p.getUrlThumbnail(), p); 69 | conn.connect(); 70 | 71 | ImageReader reader = (ImageReader) ImageIO.getImageReadersByFormatName("jpeg").next(); 72 | ImageInputStream inputStream = ImageIO.createImageInputStream(conn.getInputStream()); 73 | reader.setInput(inputStream); 74 | 75 | i = reader.read(0); 76 | 77 | reader.dispose(); 78 | } catch (IIOException e) { 79 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 80 | } catch (IOException e) { 81 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 82 | } 83 | 84 | if (i != null) { 85 | Image scaled; 86 | Dimension newD = ImageUtils.getSizeKeepRatio( 87 | new Dimension(((BufferedImage) i).getWidth(), ((BufferedImage) i).getHeight()), 88 | GalleryRemote._().properties.getThumbnailSize(), true); 89 | if (newD != null) { 90 | scaled = i.getScaledInstance(newD.width, newD.height, Image.SCALE_FAST); 91 | i.flush(); 92 | i = scaled; 93 | } 94 | } else { 95 | i = ImageUtils.unrecognizedThumbnail; 96 | } 97 | } else { 98 | i = ImageUtils.load( 99 | p.getSource().getPath(), 100 | GalleryRemote._().properties.getThumbnailSize(), 101 | ImageUtils.THUMB); 102 | } 103 | 104 | thumbnails.put(p, i); 105 | 106 | loaded++; 107 | 108 | Log.log(Log.LEVEL_TRACE, MODULE, "update progress " + loaded + "/" + (loaded + toLoad.size())); 109 | GalleryRemote._().getCore().getMainStatusUpdate().updateProgressValue(StatusUpdate.LEVEL_CACHE, loaded, loaded + toLoad.size()); 110 | GalleryRemote._().getCore().thumbnailLoadedNotify(); 111 | } 112 | } 113 | stillRunning = false; 114 | 115 | GalleryRemote._().getCore().getMainStatusUpdate().stopProgress(StatusUpdate.LEVEL_CACHE, GRI18n.getString(MODULE, "thmbLoaded")); 116 | 117 | //Log.log(Log.TRACE, MODULE, "Ending"); 118 | } 119 | 120 | 121 | /** 122 | * Ask for the thumbnail to be loaded as soon as possible 123 | */ 124 | public void preloadThumbnailFirst(Picture p) { 125 | Log.log(Log.LEVEL_TRACE, MODULE, "preloadThumbnailFirst " + p); 126 | 127 | if (!thumbnails.containsKey(p)) { 128 | toLoad.push(p); 129 | 130 | rerun(); 131 | } 132 | } 133 | 134 | 135 | /** 136 | * Ask for several thumnails to be loaded 137 | * 138 | * @param pictures enumeration of Picture objects that should be loaded 139 | */ 140 | public void preloadThumbnails(Iterator pictures) { 141 | Log.log(Log.LEVEL_TRACE, MODULE, "preloadThumbnails"); 142 | 143 | while (pictures.hasNext()) { 144 | Picture p = (Picture) pictures.next(); 145 | 146 | if (!thumbnails.containsKey(p)) { 147 | toLoad.add(0, p); 148 | } 149 | } 150 | 151 | rerun(); 152 | } 153 | 154 | public void reload() { 155 | Iterator it = ((HashMap) thumbnails.clone()).keySet().iterator(); 156 | thumbnails.clear(); 157 | preloadThumbnails(it); 158 | } 159 | 160 | public void flushMemory() { 161 | Iterator it = thumbnails.values().iterator(); 162 | while (it.hasNext()) { 163 | Image i = (Image) it.next(); 164 | if (i != null) { 165 | i.flush(); 166 | } 167 | } 168 | 169 | thumbnails.clear(); 170 | } 171 | 172 | void rerun() { 173 | if (!stillRunning && GalleryRemote._().properties.getShowThumbnails()) { 174 | stillRunning = true; 175 | Log.log(Log.LEVEL_TRACE, MODULE, "Calling Start"); 176 | new Thread(this).start(); 177 | } 178 | } 179 | 180 | void cancelLoad() { 181 | toLoad.clear(); 182 | } 183 | 184 | 185 | /** 186 | * Retrieves a thumbnail from the thumbnail cache 187 | * 188 | * @return The thumbnail object 189 | */ 190 | public Image getThumbnail(Picture p) { 191 | return (Image) thumbnails.get(p); 192 | } 193 | } 194 | 195 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/CoreUtils.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote; 2 | 3 | import com.gallery.GalleryRemote.model.Picture; 4 | import com.gallery.GalleryRemote.model.Album; 5 | 6 | import javax.swing.*; 7 | import java.util.Arrays; 8 | import java.awt.*; 9 | import java.io.File; 10 | 11 | /** 12 | * Created by IntelliJ IDEA. 13 | * User: paour 14 | * Date: Jan 15, 2004 15 | */ 16 | public class CoreUtils { 17 | public static final String MODULE = "CoreUtils"; 18 | 19 | static GalleryRemoteCore core = null; 20 | 21 | public static void initCore() { 22 | core = GalleryRemote._().getCore(); 23 | } 24 | 25 | public static void deleteSelectedPictures() { 26 | JList jPicturesList = core.getPicturesList(); 27 | int[] indices = jPicturesList.getSelectedIndices(); 28 | int selected = jPicturesList.getSelectedIndex(); 29 | Picture reselect = null; 30 | 31 | // find non-selected item after selected index 32 | Arrays.sort(indices); 33 | boolean found = false; 34 | 35 | int i = selected + 1; 36 | while (i < jPicturesList.getModel().getSize()) { 37 | if (Arrays.binarySearch(indices, i) < 0) { 38 | found = true; 39 | break; 40 | } 41 | 42 | i++; 43 | } 44 | 45 | if (!found) { 46 | i = selected - 1; 47 | while (i >= 0) { 48 | if (Arrays.binarySearch(indices, i) < 0) { 49 | found = true; 50 | break; 51 | } 52 | 53 | i--; 54 | } 55 | } 56 | 57 | if (found) { 58 | reselect = (Picture) jPicturesList.getModel().getElementAt(i); 59 | } 60 | 61 | core.getCurrentAlbum().removePictures(indices); 62 | 63 | if (reselect != null) { 64 | jPicturesList.setSelectedValue(reselect, true); 65 | } 66 | } 67 | 68 | 69 | /** 70 | * Move selected Pictures up 71 | */ 72 | public static void movePicturesUp() { 73 | JList jPicturesList = core.getPicturesList(); 74 | int[] indices = jPicturesList.getSelectedIndices(); 75 | int[] reselect = new int[indices.length]; 76 | 77 | Arrays.sort(indices); 78 | 79 | for (int i = 0; i < indices.length; i++) { 80 | if (indices[i] > 0) { 81 | Album currentAlbum = core.getCurrentAlbum(); 82 | 83 | Picture buf = currentAlbum.getPicture(indices[i]); 84 | currentAlbum.setPicture(indices[i], currentAlbum.getPicture(indices[i] - 1)); 85 | currentAlbum.setPicture(indices[i] - 1, buf); 86 | //jPicturesList.setSelectedIndex( indices[i] - 1 ); 87 | reselect[i] = indices[i] - 1; 88 | } else { 89 | reselect[i] = indices[i]; 90 | } 91 | } 92 | 93 | jPicturesList.setSelectedIndices(reselect); 94 | jPicturesList.ensureIndexIsVisible(jPicturesList.getSelectedIndex()); 95 | } 96 | 97 | 98 | /** 99 | * Move selected Pictures down 100 | */ 101 | public static void movePicturesDown() { 102 | JList jPicturesList = core.getPicturesList(); 103 | int[] indices = jPicturesList.getSelectedIndices(); 104 | int[] reselect = new int[indices.length]; 105 | 106 | Arrays.sort(indices); 107 | 108 | for (int i = indices.length - 1; i >= 0; i--) { 109 | Album currentAlbum = core.getCurrentAlbum(); 110 | 111 | if (indices[i] < currentAlbum.sizePictures() - 1) { 112 | Picture buf = currentAlbum.getPicture(indices[i]); 113 | currentAlbum.setPicture(indices[i], currentAlbum.getPicture(indices[i] + 1)); 114 | currentAlbum.setPicture(indices[i] + 1, buf); 115 | //jPicturesList.setSelectedIndex( sel + 1 ); 116 | reselect[i] = indices[i] + 1; 117 | } else { 118 | reselect[i] = indices[i]; 119 | } 120 | } 121 | 122 | jPicturesList.setSelectedIndices(reselect); 123 | jPicturesList.ensureIndexIsVisible(jPicturesList.getSelectedIndex()); 124 | } 125 | 126 | public static void selectNextPicture() { 127 | JList jPicturesList = core.getPicturesList(); 128 | int i = jPicturesList.getSelectedIndex(); 129 | 130 | if (i < jPicturesList.getModel().getSize() - 1) { 131 | jPicturesList.setSelectedIndex(i + 1); 132 | jPicturesList.ensureIndexIsVisible(i + 1); 133 | } 134 | } 135 | 136 | public static void selectPrevPicture() { 137 | JList jPicturesList = core.getPicturesList(); 138 | int i = jPicturesList.getSelectedIndex(); 139 | 140 | if (i > 0) { 141 | jPicturesList.setSelectedIndex(i - 1); 142 | jPicturesList.ensureIndexIsVisible(i - 1); 143 | } 144 | } 145 | 146 | static class FileCellRenderer extends DefaultListCellRenderer { 147 | 148 | public Component getListCellRendererComponent( 149 | JList list, Object value, int index, 150 | boolean selected, boolean hasFocus) { 151 | super.getListCellRendererComponent(list, value, index, selected, hasFocus); 152 | 153 | Album currentAlbum = core.getCurrentAlbum(); 154 | if ( null != currentAlbum 155 | && null != value 156 | && -1 != index) { 157 | 158 | try { 159 | Picture p = currentAlbum.getPicture(index); 160 | 161 | if (p.isOnline()) { 162 | if (p.getParentAlbum() != p.getAlbumOnServer() 163 | || p.getIndex() != p.getIndexOnServer()) { 164 | setForeground(Color.red); 165 | } else { 166 | setForeground(Color.green); 167 | } 168 | } else { 169 | //setForeground(Color.black); 170 | } 171 | 172 | if (GalleryRemote._().properties.getShowThumbnails()) { 173 | Image icon = core.getThumbnail(p); 174 | if (icon != null) { 175 | Icon iicon = getIcon(); 176 | if (iicon == null || ! (iicon instanceof ImageIcon)) { 177 | setIcon((iicon = new ImageIcon())); 178 | } 179 | ((ImageIcon) iicon).setImage(icon); 180 | 181 | setIconTextGap(4 + GalleryRemote._().properties.getThumbnailSize().width - icon.getWidth(this)); 182 | } 183 | } 184 | 185 | StringBuffer text = new StringBuffer(); 186 | text.append("

"); 187 | 188 | if (p.isOnline()) { 189 | text.append(p.getName()); 190 | } else { 191 | File f = p.getSource(); 192 | text.append(f.getName()); 193 | if (GalleryRemote._().properties.getShowPath()) { 194 | text.append(" [").append(f.getParent()).append("]

"); 195 | } 196 | } 197 | 198 | if (p.getDescription() != null && getIcon() != null) { 199 | text.append("

").append(p.getEscapedDescription()).append("

"); 200 | } 201 | 202 | text.append(""); 203 | //Log.log(Log.TRACE, MODULE, text.toString()); 204 | setText(text.toString()); 205 | } catch (Exception e) { 206 | setText("Problem..."); 207 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 208 | } 209 | } else { 210 | setText("dummy"); 211 | } 212 | 213 | return this; 214 | } 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/prefs/GalleryEditorDialog.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.prefs; 2 | 3 | import com.gallery.GalleryRemote.Log; 4 | import com.gallery.GalleryRemote.model.Gallery; 5 | import com.gallery.GalleryRemote.util.DialogUtil; 6 | import com.gallery.GalleryRemote.util.GRI18n; 7 | 8 | import javax.swing.*; 9 | import java.awt.*; 10 | import java.awt.event.ActionEvent; 11 | import java.awt.event.ActionListener; 12 | 13 | /** 14 | * Created by IntelliJ IDEA. 15 | * User: paour 16 | * Date: May 27, 2003 17 | */ 18 | public class GalleryEditorDialog extends JDialog implements ActionListener { 19 | public static final String MODULE = "GEdiDlog"; 20 | 21 | Gallery gallery; 22 | boolean isOK = false; 23 | 24 | JPanel jMainPanel = new JPanel(); 25 | JLabel jUsernameLabel = new JLabel(); 26 | JLabel jPasswordLabel = new JLabel(); 27 | JLabel jUrlLabel = new JLabel(); 28 | JLabel jUrlHelpLabel = new JLabel(); 29 | JLabel jAliasLabel = new JLabel(); 30 | JLabel jKeyLabel = new JLabel(); 31 | 32 | JTextField jUsername = new JTextField(); 33 | JPasswordField jPassword = new JPasswordField(); 34 | JTextField jAlias = new JTextField(); 35 | JTextField jKey = new JTextField(); 36 | 37 | JTextField jUrl = new JTextField(); 38 | 39 | JCheckBox jAutoLogin = new JCheckBox(); 40 | 41 | JPanel jButtonPanel = new JPanel(); 42 | JButton jOk = new JButton(); 43 | JButton jCancel = new JButton(); 44 | GridLayout gridLayout1 = new GridLayout(); 45 | 46 | public GalleryEditorDialog(JDialog owner) { 47 | this(owner, null); 48 | } 49 | 50 | public GalleryEditorDialog(JDialog owner, Gallery gallery) { 51 | super(owner, true); 52 | this.gallery = gallery; 53 | 54 | jbInit(); 55 | 56 | resetUIState(); 57 | 58 | pack(); 59 | DialogUtil.center(this, owner); 60 | 61 | setVisible(true); 62 | } 63 | 64 | private void jbInit() { 65 | this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); 66 | this.setTitle(GRI18n.getString(MODULE, "title")); 67 | 68 | jMainPanel.setLayout(new GridBagLayout()); 69 | jAliasLabel.setText(GRI18n.getString(MODULE, "alias")); 70 | jAlias.setToolTipText(GRI18n.getString(MODULE, "aliasTip")); 71 | jUsernameLabel.setText(GRI18n.getString(MODULE, "username")); 72 | jPasswordLabel.setText(GRI18n.getString(MODULE, "passwd")); 73 | 74 | jOk.setText(GRI18n.getString("Common", "OK")); 75 | jOk.setActionCommand("OK"); 76 | jCancel.setText(GRI18n.getString("Common", "Cancel")); 77 | jCancel.setActionCommand("Cancel"); 78 | jButtonPanel.setLayout(gridLayout1); 79 | gridLayout1.setHgap(5); 80 | 81 | jUrlLabel.setText(GRI18n.getString(MODULE, "stndAln")); 82 | /*jUrlHelpLabel.setText(GRI18n.getString(MODULE, "stndAlnHlp")); 83 | jUrlHelpLabel.setVerticalAlignment(SwingConstants.TOP); 84 | jUrlHelpLabel.setVerticalTextPosition(SwingConstants.CENTER);*/ 85 | 86 | jAutoLogin.setText(GRI18n.getString(MODULE, "autoLogin")); 87 | 88 | this.getContentPane().add(jMainPanel, BorderLayout.CENTER); 89 | jMainPanel.add(jAliasLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 90 | , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); 91 | jMainPanel.add(jUsernameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 92 | , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); 93 | jMainPanel.add(jPasswordLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 94 | , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); 95 | jMainPanel.add(jKeyLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 96 | , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); 97 | jMainPanel.add(jUrlLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0 98 | , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 20, 5, 5), 0, 0)); 99 | jMainPanel.add(jAlias, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0 100 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); 101 | jMainPanel.add(jUsername, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0 102 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 5), 0, 0)); 103 | jMainPanel.add(jPassword, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0 104 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 5), 0, 0)); 105 | jMainPanel.add(jKey, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0 106 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 5), 0, 0)); 107 | jMainPanel.add(jUrl, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0 108 | , GridBagConstraints.SOUTHEAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0)); 109 | /*jMainPanel.add(jUrlHelpLabel, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0 110 | , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 20, 0, 0), 0, 0));*/ 111 | jMainPanel.add(jAutoLogin, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0 112 | , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 5), 0, 0)); 113 | jMainPanel.add(jButtonPanel, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0 114 | , GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0)); 115 | jButtonPanel.add(jOk, null); 116 | jButtonPanel.add(jCancel, null); 117 | 118 | jOk.addActionListener(this); 119 | jCancel.addActionListener(this); 120 | 121 | getRootPane().setDefaultButton(jOk); 122 | } 123 | 124 | public void resetUIState() { 125 | jUsername.setText(gallery.getUsername()); 126 | jPassword.setText(gallery.getPassword()); 127 | jAlias.setText(gallery.getAlias() == null?"":gallery.getAlias()); 128 | jKey.setText(gallery.getKey() == null?"":gallery.getKey()); 129 | 130 | jUrl.setText(gallery.getUrlString()); 131 | 132 | 133 | jAutoLogin.setSelected(gallery.isAutoLoadOnStartup()); 134 | } 135 | 136 | public void readUIState() { 137 | gallery.setUsername(jUsername.getText()); 138 | gallery.setPassword(jPassword.getText()); 139 | String alias = jAlias.getText().trim(); 140 | gallery.setAlias(alias.length() == 0?null:alias); 141 | String key = jKey.getText().trim(); 142 | gallery.setKey(key.length() == 0?null:key); 143 | 144 | gallery.setUrlString(jUrl.getText()); 145 | 146 | gallery.setAutoLoadOnStartup(jAutoLogin.isSelected()); 147 | } 148 | 149 | public void actionPerformed(ActionEvent e) { 150 | String cmd = e.getActionCommand(); 151 | Log.log(Log.LEVEL_INFO, MODULE, "Command selected " + cmd); 152 | 153 | if (cmd.equals("OK")) { 154 | readUIState(); 155 | isOK = true; 156 | setVisible(false); 157 | } else if (cmd.equals("Cancel")) { 158 | setVisible(false); 159 | } else { 160 | Log.log(Log.LEVEL_ERROR, MODULE, "Unknown command: " + cmd); 161 | } 162 | } 163 | 164 | public boolean isOK() { 165 | return isOK; 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/AboutBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | package com.gallery.GalleryRemote; 22 | 23 | import com.gallery.GalleryRemote.util.DialogUtil; 24 | import com.gallery.GalleryRemote.util.GRI18n; 25 | 26 | import javax.swing.*; 27 | import javax.swing.border.MatteBorder; 28 | import java.awt.*; 29 | import java.awt.event.MouseEvent; 30 | import java.net.URL; 31 | import java.util.ArrayList; 32 | import java.util.StringTokenizer; 33 | 34 | /** 35 | * Gallery Remote About Box 36 | * 37 | * @author paour 38 | */ 39 | public class AboutBox extends JDialog { 40 | public static final String MODULE = "About"; 41 | public static int TOP = 5; 42 | public static int BOTTOM = 105; 43 | 44 | 45 | /** 46 | * Constructor for the AboutBox object 47 | */ 48 | public AboutBox() { 49 | super(); 50 | init(); 51 | } 52 | 53 | 54 | /** 55 | * Constructor for the AboutBox object 56 | * 57 | * @param owner Description of Parameter 58 | */ 59 | public AboutBox(Frame owner) { 60 | super(owner); 61 | init(); 62 | } 63 | 64 | 65 | private void init() { 66 | setModal(true); 67 | getContentPane().add(new AboutPanel(), BorderLayout.CENTER); 68 | setTitle(GRI18n.getString(MODULE, "title")); 69 | 70 | pack(); 71 | 72 | DialogUtil.center(this); 73 | 74 | addMouseListener( 75 | new java.awt.event.MouseAdapter() { 76 | public void mouseClicked(MouseEvent e) { 77 | thisWindowClosing(); 78 | } 79 | }); 80 | addWindowListener( 81 | new java.awt.event.WindowAdapter() { 82 | public void windowClosing(MouseEvent e) { 83 | thisWindowClosing(); 84 | } 85 | }); 86 | } 87 | 88 | // Close the window when the box is clicked 89 | void thisWindowClosing() { 90 | setVisible(false); 91 | dispose(); 92 | } 93 | 94 | 95 | /** 96 | * AboutPanel: scrolling panel of credits for About boxes 97 | * 98 | * @author paour 99 | */ 100 | public class AboutPanel extends JComponent { 101 | ImageIcon image; 102 | ArrayList text; 103 | int scrollPosition; 104 | AnimationThread thread; 105 | int maxWidth; 106 | FontMetrics fm; 107 | int initialPosition; 108 | 109 | /** 110 | * Constructor for the AboutPanel object 111 | */ 112 | public AboutPanel() { 113 | setFont(UIManager.getFont("Label.font")); 114 | fm = getFontMetrics(getFont()); 115 | 116 | URL imu = getClass().getResource("/rar_about_gr1.png"); 117 | Log.log(Log.LEVEL_TRACE, MODULE, "Looking for splash screen in " + imu.toString()); 118 | image = new ImageIcon(imu); 119 | 120 | setBorder(new MatteBorder(1, 1, 1, 1, Color.gray)); 121 | 122 | text = new ArrayList(); 123 | StringTokenizer st = new StringTokenizer( 124 | GalleryRemote._().properties.getProperty("aboutText"), "\n"); 125 | while (st.hasMoreTokens()) { 126 | String line = st.nextToken(); 127 | text.add(line); 128 | maxWidth = Math.max(maxWidth, 129 | fm.stringWidth(line) + 10); 130 | } 131 | initialPosition = getHeight() - BOTTOM /*- BOTTOM*/ - TOP - TOP; 132 | scrollPosition = initialPosition; 133 | 134 | thread = new AnimationThread(); 135 | } 136 | 137 | /** 138 | * Gets the preferredSize attribute of the AboutPanel object 139 | * 140 | * @return The preferredSize value 141 | */ 142 | public Dimension getPreferredSize() { 143 | return new Dimension(1 + image.getIconWidth(), 144 | 1 + image.getIconHeight()); 145 | } 146 | 147 | /** 148 | * Description of the Method 149 | * 150 | * @param g Description of Parameter 151 | */ 152 | public void paintComponent(Graphics g) { 153 | //g.setColor(new Color(96, 96, 96)); 154 | image.paintIcon(this, g, 1, 1); 155 | 156 | FontMetrics fm = g.getFontMetrics(); 157 | 158 | String version = GalleryRemote._().properties.getProperty("version"); 159 | g.drawString(version, (getWidth() - fm.stringWidth(version)) / 2, 160 | getHeight() - 5); 161 | 162 | g = g.create((getWidth() - maxWidth) / 2, TOP, maxWidth, 163 | getHeight() - TOP - BOTTOM); 164 | 165 | int height = fm.getHeight(); 166 | int firstLine = scrollPosition / height; 167 | 168 | int firstLineOffset = height - scrollPosition % height; 169 | int lines = (getHeight() - TOP - BOTTOM) / height; 170 | 171 | int y = firstLineOffset; 172 | g.setColor(new Color(255, 255, 255)); 173 | for (int i = 0; i <= lines; i++) { 174 | if (i + firstLine >= 0 && i + firstLine < text.size()) { 175 | String line = (String) text.get(i + firstLine); 176 | g.drawString(line, (maxWidth - fm.stringWidth(line)) / 2, y); 177 | } 178 | y += fm.getHeight(); 179 | } 180 | } 181 | 182 | /** 183 | * Adds a feature to the Notify attribute of the AboutPanel object 184 | */ 185 | public void addNotify() { 186 | super.addNotify(); 187 | thread.start(); 188 | } 189 | 190 | /** 191 | * Description of the Method 192 | */ 193 | public void removeNotify() { 194 | super.removeNotify(); 195 | thread.kill(); 196 | } 197 | 198 | /** 199 | * Animation thread 200 | * 201 | * @author paour 202 | */ 203 | class AnimationThread extends Thread { 204 | private boolean running = true; 205 | 206 | 207 | AnimationThread() { 208 | super(GRI18n.getString(MODULE, "aboutAnim")); 209 | setPriority(Thread.MIN_PRIORITY); 210 | } 211 | 212 | 213 | /** 214 | * Description of the Method 215 | */ 216 | public void kill() { 217 | running = false; 218 | } 219 | 220 | 221 | /** 222 | * Main processing method for the AnimationThread object 223 | */ 224 | public void run() { 225 | FontMetrics fm = getFontMetrics(getFont()); 226 | int max = (text.size() * fm.getHeight()); 227 | long start = System.currentTimeMillis(); 228 | 229 | while (running) { 230 | scrollPosition = initialPosition + (int) ((System.currentTimeMillis() - start) / 40); 231 | 232 | if (scrollPosition > max) { 233 | scrollPosition = initialPosition; 234 | start = System.currentTimeMillis(); 235 | } 236 | 237 | try { 238 | Thread.sleep(100/60); 239 | } catch (Exception e) { } 240 | 241 | repaint(getWidth() / 2 - maxWidth, 242 | TOP, maxWidth * 2, 243 | getHeight() - TOP - BOTTOM); 244 | } 245 | } 246 | } 247 | } 248 | } 249 | 250 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/Log.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Gallery Remote - a File Upload Utility for Gallery 3 | * 4 | * Gallery - a web based photo album viewer and editor 5 | * Copyright (C) 2000-2001 Bharat Mediratta 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or (at 10 | * your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 | */ 21 | package com.gallery.GalleryRemote; 22 | 23 | import com.gallery.GalleryRemote.prefs.PreferenceNames; 24 | 25 | import java.io.*; 26 | import java.util.*; 27 | 28 | /** 29 | * Log manager 30 | * 31 | * @author paour 32 | */ 33 | public class Log implements PreferenceNames, Runnable { 34 | public final static int LEVEL_CRITICAL = 0; 35 | public final static int LEVEL_ERROR = 1; 36 | public final static int LEVEL_INFO = 2; 37 | public final static int LEVEL_TRACE = 3; 38 | 39 | static String levelName[] = {"CRITI", "ERROR", "INFO ", "TRACE"}; 40 | 41 | public final static int sleepInterval = 500; 42 | public final static int moduleLength = 10; 43 | public final static String emptyModule = " "; 44 | public final static String emptyTime = " "; 45 | public static long startTime = System.currentTimeMillis(); 46 | 47 | public static int maxLevel = LEVEL_TRACE; 48 | public static boolean toSysOut; 49 | 50 | Thread loggerThread = null; 51 | 52 | static int threadPriority = (Thread.MIN_PRIORITY + Thread.NORM_PRIORITY) / 2; 53 | static Log singleton = new Log(); 54 | static boolean started = false; 55 | 56 | List logLines = Collections.synchronizedList(new LinkedList()); 57 | boolean running = false; 58 | List moduleList = null; 59 | 60 | private Log() {} 61 | 62 | public static void log(int level, String module, String message) { 63 | if (level <= maxLevel || !started) { 64 | if (module == null) { 65 | module = emptyModule; 66 | } else { 67 | module = (module + emptyModule).substring(0, moduleLength); 68 | } 69 | 70 | if (singleton.moduleList != null && !singleton.moduleList.contains(module)) { 71 | return; 72 | } 73 | 74 | String time = emptyTime + (System.currentTimeMillis() - startTime); 75 | time = time.substring(time.length() - emptyTime.length()); 76 | 77 | singleton.logLines.add(time + "|" 78 | + levelName[level] + "|" 79 | + module + "|" 80 | + message); 81 | } 82 | } 83 | 84 | public static void log(int level, Class c, String message) { 85 | log(level, c.getName(), message); 86 | } 87 | 88 | public static void log(int level, Object o, String message) { 89 | log(level, getShortClassName(o.getClass()), message); 90 | } 91 | 92 | public static void log(int level, String message) { 93 | log(level, (String) null, message); 94 | } 95 | 96 | public static void log(Class c, String message) { 97 | log(LEVEL_TRACE, getShortClassName(c), message); 98 | } 99 | 100 | public static void log(Object o, String message) { 101 | log(LEVEL_TRACE, getShortClassName(o.getClass()), message); 102 | } 103 | 104 | public static void log(String module, String message) { 105 | log(LEVEL_TRACE, module, message); 106 | } 107 | 108 | public static void log(String message) { 109 | log(LEVEL_TRACE, (String) null, message); 110 | } 111 | 112 | public static void logStack(int level, String module) { 113 | if (level <= maxLevel || !started) { 114 | CharArrayWriter caw = new CharArrayWriter(); 115 | try { 116 | throw new Exception("Dump stack"); 117 | } catch (Exception e) { 118 | e.printStackTrace(new PrintWriter(caw)); 119 | } 120 | 121 | log(level, module, caw.toString()); 122 | } 123 | } 124 | 125 | public static void logException(int level, String module, Throwable t) { 126 | if (level <= maxLevel || !started) { 127 | //log(level, module, t.toString()); 128 | 129 | CharArrayWriter caw = new CharArrayWriter(); 130 | t.printStackTrace(new PrintWriter(caw)); 131 | 132 | log(level, module, caw.toString()); 133 | } 134 | } 135 | 136 | public static String getShortClassName(Class c) { 137 | String name = c.getName(); 138 | int i = name.lastIndexOf("."); 139 | 140 | if (i == -1) { 141 | return name; 142 | } else { 143 | return name.substring(i + 1); 144 | } 145 | } 146 | 147 | public static void shutdown() { 148 | singleton.running = false; 149 | try { 150 | singleton.loggerThread.join(); 151 | } catch (InterruptedException ee) { 152 | System.err.println("Logger thread killed"); 153 | } catch (Throwable ignored) {} 154 | 155 | started = false; 156 | singleton = new Log(); 157 | } 158 | 159 | 160 | /** 161 | * Main processing method for the Log object 162 | */ 163 | public void run() { 164 | System.out.println("Logger thread running"); 165 | 166 | BufferedWriter writer = null; 167 | running = true; 168 | try { 169 | System.out.println("Creating log file in " + System.getProperty("java.io.tmpdir")); 170 | writer = new BufferedWriter(new FileWriter(new File(System.getProperty("java.io.tmpdir"), "GalleryRemoteLog.txt"))); 171 | while (running) { 172 | Thread.sleep(sleepInterval); 173 | while (!logLines.isEmpty()) { 174 | String s = logLines.remove(0); 175 | writer.write(s); 176 | writer.newLine(); 177 | 178 | if (toSysOut) { 179 | System.out.println(s); 180 | } 181 | } 182 | 183 | writer.flush(); 184 | } 185 | } catch (IOException e) { 186 | System.err.println("Can't write to log file. Disabling log..."); 187 | maxLevel = -1; 188 | } catch (InterruptedException e) { 189 | System.err.println("Logger thread killed"); 190 | } finally { 191 | running = false; 192 | try { 193 | if (writer != null) { 194 | writer.close(); 195 | } 196 | } catch (IOException e) { 197 | e.printStackTrace(); 198 | } 199 | } 200 | 201 | System.out.println("Logger thread shutting down"); 202 | } 203 | 204 | public static void startLog(int maxLevel, boolean toSysOut) { 205 | if (Log.maxLevel != maxLevel) { 206 | Log.maxLevel = maxLevel; 207 | singleton.logLines.add(emptyTime + "|" 208 | + levelName[LEVEL_TRACE] + "|" 209 | + emptyModule + "|" 210 | + "Setting Log level to " + levelName[Log.maxLevel]); 211 | } 212 | 213 | Log.toSysOut = toSysOut; 214 | 215 | try { 216 | String modules = System.getenv("GR_LOG_MODULES"); 217 | if (modules != null) { 218 | singleton.moduleList = Arrays.asList(modules.split(",")); 219 | } 220 | } catch (Throwable ignored) {} 221 | 222 | singleton.loggerThread = new Thread(singleton); 223 | singleton.loggerThread.setPriority(threadPriority); 224 | singleton.loggerThread.start(); 225 | } 226 | } 227 | 228 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/util/GRI18n.java: -------------------------------------------------------------------------------- 1 | /** 2 | * User: iluvatar 3 | * Date: Sep 18, 2003 4 | * Time: 7:46:36 PM 5 | */ 6 | package com.gallery.GalleryRemote.util; 7 | 8 | import com.gallery.GalleryRemote.GalleryRemote; 9 | import com.gallery.GalleryRemote.Log; 10 | import com.gallery.GalleryRemote.prefs.PreferenceNames; 11 | 12 | import java.text.MessageFormat; 13 | import java.util.*; 14 | import java.io.InputStream; 15 | import java.io.IOException; 16 | 17 | 18 | public class GRI18n implements PreferenceNames { 19 | private static final String RESNAME = 20 | "com.gallery.GalleryRemote.resources.GRResources"; 21 | private static final String RESNAME_DEV = 22 | "GRResources"; 23 | private static final String RESPATH = 24 | "com/gallery/GalleryRemote/resources/GRResources"; 25 | private static final String MODULE = "GRI18n"; 26 | 27 | private static Locale grLocale; 28 | private static ResourceBundle grResBundle; 29 | private static HashMap formats = new HashMap(); 30 | 31 | private static List lAvailLoc = null; 32 | 33 | private static boolean devMode = false; 34 | private static Properties devResProperties = null; 35 | 36 | static { 37 | String myLocale = GalleryRemote._().properties.getProperty(UI_LOCALE); 38 | devMode = GalleryRemote._().properties.getBooleanProperty(UI_LOCALE_DEV); 39 | 40 | grLocale = parseLocaleString(myLocale); 41 | 42 | Log.log(Log.LEVEL_INFO, MODULE, grLocale.toString()); 43 | 44 | setResBundle(); 45 | } 46 | 47 | public static Locale parseLocaleString(String localeString) { 48 | if (localeString == null) { 49 | return Locale.getDefault(); 50 | } else { 51 | int i = localeString.indexOf("_"); 52 | 53 | if (i != -1) { 54 | return new Locale(localeString.substring(0, i), localeString.substring(i + 1)); 55 | } else { 56 | return new Locale(localeString, ""); 57 | } 58 | } 59 | } 60 | 61 | 62 | public static void setLocale(String language, String country) { 63 | grLocale = new Locale(language, country); 64 | setResBundle(); 65 | } 66 | 67 | 68 | public static String getString(String className, String key) { 69 | String msg; 70 | String extKey = className + "." + key; 71 | try { 72 | msg = grResBundle.getString(extKey); 73 | 74 | if (devResProperties != null && devResProperties.getProperty(extKey) == null) { 75 | if (msg.startsWith("")) { 76 | msg = "***" + msg.substring(6); 77 | } else { 78 | msg = "***" + msg; 79 | } 80 | } 81 | } catch (NullPointerException e) { 82 | Log.log(Log.LEVEL_ERROR, MODULE, "Key null error"); 83 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 84 | msg = "[NULLKEY]"; 85 | } catch (MissingResourceException e) { 86 | Log.log(Log.LEVEL_INFO, MODULE, "Key [" + extKey + "] not defined"); 87 | Log.logException(Log.LEVEL_INFO, MODULE, e); 88 | msg = "[" + extKey + "]"; 89 | } 90 | 91 | return msg; 92 | } 93 | 94 | 95 | public static String getString(String className, String key, Object[] params) { 96 | String msg; 97 | String extKey = className + "." + key; 98 | try { 99 | MessageFormat format = (MessageFormat) formats.get(extKey); 100 | if (format == null) { 101 | format = new MessageFormat(fixQuotes(grResBundle.getString(extKey)), grLocale); 102 | formats.put(extKey, format); 103 | } 104 | msg = format.format(params); 105 | 106 | if (devResProperties != null && devResProperties.getProperty(extKey) == null) { 107 | if (msg.startsWith("")) { 108 | msg = "***" + msg.substring(6); 109 | } else { 110 | msg = "***" + msg; 111 | } 112 | } 113 | } catch (NullPointerException e) { 114 | Log.log(Log.LEVEL_ERROR, MODULE, "Key null error"); 115 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 116 | msg = "[NULLKEY]"; 117 | } catch (MissingResourceException e) { 118 | Log.log(Log.LEVEL_INFO, MODULE, "Key [" + extKey + "] not defined"); 119 | Log.logException(Log.LEVEL_INFO, MODULE, e); 120 | msg = "[" + extKey + "]"; 121 | } 122 | 123 | return msg; 124 | } 125 | 126 | public static String fixQuotes(String s) { 127 | StringBuffer sb = new StringBuffer(); 128 | for (int i = 0; i < s.length(); i++) { 129 | char c = s.charAt(i); 130 | if (c == '\'') { 131 | sb.append("''"); 132 | } else { 133 | sb.append(c); 134 | } 135 | } 136 | 137 | return sb.toString(); 138 | } 139 | 140 | public static Locale getCurrentLocale() { 141 | return grLocale; 142 | } 143 | 144 | 145 | private static void setResBundle() { 146 | try { 147 | grResBundle = ResourceBundle.getBundle(devMode?RESNAME_DEV:RESNAME, grLocale); 148 | 149 | if (devMode) { 150 | devResProperties = getLocaleProperties(grLocale); 151 | } 152 | } catch (MissingResourceException e) { 153 | Log.log(Log.LEVEL_ERROR, MODULE, "Resource bundle error"); 154 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 155 | } 156 | } 157 | 158 | public static Properties getLocaleProperties(Locale locale) { 159 | Properties p = new Properties(); 160 | String filename; 161 | if (locale == null) { 162 | filename = (devMode?RESNAME_DEV:RESPATH) + ".properties"; 163 | } else { 164 | filename = (devMode?RESNAME_DEV:RESPATH) + "_" + locale.toString() + ".properties"; 165 | } 166 | InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream(filename); 167 | if (is != null) { 168 | try { 169 | p.load(is); 170 | } catch (IOException e) { 171 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 172 | } 173 | } else { 174 | Log.log(Log.LEVEL_ERROR, MODULE, "No file for " + filename); 175 | } 176 | 177 | return p; 178 | } 179 | 180 | 181 | public static List getAvailableLocales() { 182 | if (lAvailLoc == null) 183 | lAvailLoc = initAvailableLocales(); 184 | return lAvailLoc; 185 | } 186 | 187 | private static List initAvailableLocales() { 188 | String locPath; 189 | String loc; 190 | List aList = new LinkedList(); 191 | long start = System.currentTimeMillis(); 192 | 193 | // todo: it seems that the dialog can't be displayed because all this 194 | // is running in the Swing event thread. Need to find a better way... 195 | // JDialog dialog = new JDialog(GalleryRemote.getInstance().mainFrame, "Please wait..."); 196 | // dialog.getContentPane().add("Center", new JLabel("Parsing list of locales for this platform." + 197 | // "
This can take between 1 and 10 seconds...")); 198 | // dialog.pack(); 199 | // DialogUtil.center(dialog); 200 | // dialog.setVisible(true); 201 | // Thread.yield(); 202 | 203 | Log.log(Log.LEVEL_TRACE, MODULE, "Getting the list of locales"); 204 | 205 | // this call is apparently very slow... 206 | Locale[] list = Locale.getAvailableLocales(); 207 | 208 | Log.log(Log.LEVEL_TRACE, MODULE, "The platform supports " + list.length + " locales. Pruning..."); 209 | 210 | String prefix = "##DUMMY"; 211 | for (int i = 0; i < list.length; i++) { 212 | loc = list[i].toString(); 213 | 214 | // perf optimization: don't go through all the regions if the main language was not found 215 | if (!loc.startsWith(prefix)) { 216 | prefix = loc; 217 | if (devMode) { 218 | Log.log(Log.LEVEL_TRACE, MODULE, "Trying locale: " + loc); 219 | } 220 | 221 | locPath = (devMode?RESNAME_DEV:RESPATH) + "_" + loc + ".properties"; 222 | if (ClassLoader.getSystemClassLoader().getResource(locPath) != null) { 223 | Log.log(Log.LEVEL_INFO, MODULE, "Found locale: " + loc); 224 | aList.add(list[i]); 225 | prefix = "##DUMMY"; 226 | } 227 | } 228 | } 229 | 230 | Log.log(Log.LEVEL_TRACE, MODULE, "Pruned locales in " + (System.currentTimeMillis() - start) + "ms"); 231 | //dialog.setVisible(false); 232 | 233 | return aList; 234 | } 235 | 236 | /*class PatienceDialog extends JDialog implements Runnable { 237 | public boolean done = false; 238 | 239 | public void run() { 240 | try { 241 | Thread.sleep(1000); 242 | 243 | 244 | } catch (InterruptedException e) {} 245 | } 246 | }*/ 247 | } 248 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/StatusBar.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote; 2 | 3 | import com.gallery.GalleryRemote.util.DialogUtil; 4 | import com.gallery.GalleryRemote.util.GRI18n; 5 | import com.gallery.GalleryRemote.model.Picture; 6 | 7 | import javax.swing.*; 8 | import javax.swing.border.BevelBorder; 9 | import java.awt.*; 10 | 11 | /** 12 | * Created by IntelliJ IDEA. 13 | * User: paour 14 | * Date: Sep 17, 2003 15 | */ 16 | public class StatusBar extends JPanel implements StatusUpdate { 17 | public static final String MODULE = "StatusBar"; 18 | JProgressBar jProgress = new JProgressBar(); 19 | JLabel jStatus = new JLabel(); 20 | 21 | StatusLevelData data[] = new StatusLevelData[NUM_LEVELS]; 22 | int currentLevel = -1; 23 | 24 | int progressWidth; 25 | 26 | public StatusBar(int progressWidth) { 27 | for (int i = 0; i < data.length; i++) { 28 | data[i] = new StatusLevelData(); 29 | } 30 | 31 | data[0].active = true; 32 | 33 | this.progressWidth = progressWidth; 34 | 35 | jbInit(); 36 | } 37 | 38 | public StatusBar() { 39 | this(150); 40 | } 41 | 42 | boolean raiseLevel(int level) { 43 | if (level < currentLevel) { 44 | return false; 45 | } 46 | 47 | if (level > currentLevel) { 48 | currentLevel = level; 49 | //data[currentLevel].active = true; 50 | } 51 | 52 | return true; 53 | } 54 | 55 | public void setStatus(String message) { 56 | updateProgressStatus(LEVEL_GENERIC, message); 57 | } 58 | 59 | public void startProgress(int level, int minValue, int maxValue, String message, boolean undetermined) { 60 | data[level].minValue = minValue; 61 | data[level].maxValue = maxValue; 62 | data[level].value = 0; 63 | data[level].message = message; 64 | data[level].undetermined = undetermined; 65 | data[level].active = true; 66 | 67 | if (raiseLevel(level)) { 68 | resetUIState(); 69 | } 70 | } 71 | 72 | public void updateProgressValue(int level, int value) { 73 | data[level].value = value; 74 | 75 | if (level == currentLevel && data[level].active) { 76 | resetUIState(); 77 | } else { 78 | //Log.log(Log.TRACE, MODULE, "Trying to use updateProgressValue when not progressOn or with wrong level"); 79 | //Log.logStack(Log.TRACE, MODULE); 80 | } 81 | } 82 | 83 | public void updateProgressValue(int level, int value, int maxValue) { 84 | data[level].maxValue = maxValue; 85 | data[level].value = value; 86 | 87 | if (level == currentLevel && data[level].active) { 88 | resetUIState(); 89 | } else { 90 | //Log.log(Log.TRACE, MODULE, "Trying to use updateProgressValue when not progressOn or with wrong level"); 91 | //Log.logStack(Log.TRACE, MODULE); 92 | } 93 | } 94 | 95 | public void updateProgressStatus(int level, String message) { 96 | data[level].message = message; 97 | 98 | if (level == currentLevel && data[level].active) { 99 | resetUIState(); 100 | } else { 101 | //Log.log(Log.TRACE, MODULE, "Trying to use updateProgressStatus when not progressOn or with wrong level"); 102 | //Log.logStack(Log.TRACE, MODULE); 103 | } 104 | } 105 | 106 | public void setUndetermined(int level, boolean undetermined) { 107 | //To change body of implemented methods use Options | File Templates. 108 | } 109 | 110 | public int getProgressValue(int level) { 111 | return data[level].value; 112 | } 113 | 114 | public int getProgressMinValue(int level) { 115 | return data[level].minValue; 116 | } 117 | 118 | public int getProgressMaxValue(int level) { 119 | return data[level].maxValue; 120 | } 121 | 122 | public void stopProgress(int level, String message) { 123 | data[LEVEL_GENERIC].message = message; 124 | 125 | if (level == currentLevel && data[level].active) { 126 | if (data[level].undeterminedThread != null) { 127 | data[level].undeterminedThread.interrupt(); 128 | data[level].undeterminedThread = null; 129 | } 130 | 131 | data[level].minValue = 0; 132 | data[level].maxValue = 0; 133 | data[level].value = 0; 134 | data[level].undetermined = false; 135 | 136 | if (level > LEVEL_GENERIC) { 137 | data[level].active = false; 138 | } 139 | 140 | // find the next active level 141 | //currentLevel = level - 1; 142 | while (currentLevel > LEVEL_GENERIC && data[currentLevel].active == false) { 143 | currentLevel--; 144 | } 145 | 146 | //if (currentLevel == -1) { 147 | resetUIState(); 148 | //} else { 149 | // resetUIState(); 150 | //} 151 | } 152 | 153 | //setStatus(message); 154 | } 155 | 156 | public void setInProgress(boolean inProgress) { 157 | GalleryRemote._().getCore().setInProgress(inProgress); 158 | } 159 | 160 | public void error(String message) { 161 | JOptionPane.showMessageDialog(DialogUtil.findParentWindow(this), message, GRI18n.getString(MODULE, "Error"), JOptionPane.ERROR_MESSAGE); 162 | } 163 | 164 | public void jbInit() { 165 | jProgress.setMinimumSize(new Dimension(10, 18)); 166 | jProgress.setPreferredSize(new Dimension(progressWidth, 18)); 167 | jProgress.setMaximumSize(new Dimension(progressWidth, 18)); 168 | jProgress.setStringPainted(false); 169 | 170 | jStatus.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.white, SystemColor.control, SystemColor.control, Color.gray)); 171 | jStatus.setMinimumSize(new Dimension(100, 18)); 172 | jStatus.setPreferredSize(new Dimension(100, 18)); 173 | 174 | setLayout(new GridBagLayout()); 175 | add(jStatus, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0 176 | , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); 177 | add(jProgress, new GridBagConstraints(1, 0, 1, 1, 0, 0.0 178 | , GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); 179 | } 180 | 181 | private void resetUIState() { 182 | Log.log(Log.LEVEL_TRACE, MODULE, "level: " + currentLevel + " - " + data[currentLevel].message + " - " + data[currentLevel].value); 183 | if (currentLevel >= 0) { 184 | jProgress.setMinimum(data[currentLevel].minValue); 185 | jProgress.setValue(data[currentLevel].value); 186 | jProgress.setMaximum(data[currentLevel].maxValue); 187 | 188 | try { 189 | jProgress.setIndeterminate(data[currentLevel].undetermined); 190 | } catch (Throwable t) { 191 | // we end up here if the method is not implemented and we don't have indeterminate progress 192 | // bars: come up with our own... 193 | if (data[currentLevel].undetermined && data[currentLevel].undeterminedThread == null) { 194 | data[currentLevel].undeterminedThread = new UndeterminedThread(StatusBar.this, currentLevel); 195 | data[currentLevel].undeterminedThread.start(); 196 | } 197 | } 198 | 199 | jStatus.setText(data[currentLevel].message); 200 | } else { 201 | jStatus.setText(""); 202 | jProgress.setValue(jProgress.getMinimum()); 203 | 204 | try { 205 | jProgress.setIndeterminate(false); 206 | } catch (Throwable t) { 207 | data[currentLevel].undeterminedThread.interrupt(); 208 | } 209 | } 210 | } 211 | 212 | public void doneUploading(String newItemName, Picture picture) { 213 | } 214 | 215 | class StatusLevelData { 216 | boolean active = false; 217 | String message; 218 | int minValue; 219 | int maxValue; 220 | int value; 221 | boolean undetermined; 222 | UndeterminedThread undeterminedThread; 223 | } 224 | 225 | public class UndeterminedThread extends Thread { 226 | StatusUpdate su; 227 | int level; 228 | 229 | public UndeterminedThread(StatusUpdate su, int level) { 230 | this.su = su; 231 | this.level = level; 232 | } 233 | 234 | public void run() { 235 | boolean forward = true; 236 | while (!interrupted()) { 237 | if (su.getProgressValue(level) >= su.getProgressMaxValue(level)) { 238 | forward = false; 239 | } else if (su.getProgressValue(level) <= su.getProgressMinValue(level)) { 240 | forward = true; 241 | } 242 | 243 | su.updateProgressValue(level, su.getProgressValue(level) + (forward ? 1 : -1)); 244 | 245 | try { 246 | sleep(500); 247 | } catch (InterruptedException e) { 248 | } 249 | } 250 | } 251 | } 252 | } 253 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/util/HTMLEscaper.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | HTML Escaping code 4 | Copyright (C) 2000 Marc Palmer / AnyWare Ltd. 5 | 6 | Acording to Marc, this code may be used under any license. 7 | Thanks to Jason Hunter for his great book "JAVA Servlet Programming" used as 8 | the source for the entity mappings. Thanks to CARDIACS for making the 9 | most joyful music (www.cardiacs.com/button.html) 10 | 11 | http://www.anyware.co.uk/java for updates and other stuff 12 | 13 | @author Marc Palmer 14 | @author Marcel Huijkman 15 | 16 | @version 15-07-2002 17 | */ 18 | 19 | package com.gallery.GalleryRemote.util; 20 | 21 | import com.gallery.GalleryRemote.Log; 22 | 23 | import java.util.HashMap; 24 | 25 | /** 26 | * This class will escape characters that have an HTML entity 27 | * representation. It will not escape standard ASCII characters unless 28 | * it is necessary (i.e. will not escape ASCI #32 but will escape "&"). 29 | * Any characters with no corresponding entity are passed through unchanged. 30 | * It uses a quick string -> array mapping to avoid creating thousands of 31 | * temporary objects. 32 | */ 33 | public class HTMLEscaper { 34 | public static final String MODULE = "HTMLEsc"; 35 | 36 | /** 37 | * A little bit of unit testing 38 | */ 39 | public static void main(String[] args) { 40 | 41 | String text = 42 | "This is a test of the html escaper & let's hope it really, " + 43 | "really works! Is there an \u00f7 with an umlaut in the house?" + 44 | "This code is \u00a9copyleft. I like to be paid in \u00fa\u00fa\u00fas"; 45 | 46 | System.out.println("NOTE: Due to differences in ASCII fonts, the text " + 47 | "sent to the escaper may not display properly. Hopefully you will be " + 48 | "able to tell what it should have looked like from the escaped output."); 49 | System.out.println("in: " + text); 50 | 51 | System.out.println("out: " + escape(text)); 52 | 53 | System.out.println("rev: " + unescape(escape(text) + " & toto")); 54 | } 55 | 56 | /** 57 | * This method will take the input and escape characters that have 58 | * an HTML entity representation. 59 | * It uses a quick string -> array mapping to avoid creating thousands of 60 | * temporary objects. 61 | * 62 | * @param nonHTMLsrc String containing the text to make HTML-safe 63 | * @return String containing new copy of string with ENTITIES escaped 64 | */ 65 | public static final String escape(String nonHTMLsrc) { 66 | StringBuffer res = new StringBuffer(); 67 | int l = nonHTMLsrc.length(); 68 | int idx; 69 | char c; 70 | for (int i = 0; i < l; i++) { 71 | c = nonHTMLsrc.charAt(i); 72 | 73 | if (c > 255) { 74 | res.append("&#").append((int) c).append(";"); 75 | } else { 76 | idx = entityMap.indexOf(c); 77 | if (idx == -1) { 78 | res.append(c); 79 | } else { 80 | res.append(quickEntities[idx]); 81 | } 82 | } 83 | } 84 | return res.toString(); 85 | } 86 | 87 | public static final String unescape(String HTMLsrc) { 88 | if (HTMLsrc == null) { 89 | return null; 90 | } 91 | 92 | StringBuffer res = new StringBuffer(); 93 | 94 | while (HTMLsrc.length() > 0) { 95 | int i = HTMLsrc.indexOf('&'); 96 | 97 | if (i == -1) { 98 | res.append(HTMLsrc); 99 | break; 100 | } 101 | 102 | int j = HTMLsrc.indexOf(';', i); 103 | 104 | if (j == -1) { 105 | // this should never happen, but it does... 106 | res.append(HTMLsrc.substring(0, i)).append("&"); 107 | HTMLsrc = HTMLsrc.substring(i + 1); 108 | continue; 109 | } 110 | 111 | String entity = HTMLsrc.substring(i + 1, j); 112 | String decodedEntity = (String) quickRevEntities.get(entity); 113 | 114 | if (decodedEntity == null) { 115 | if (entity.startsWith("#")) { 116 | res.append(HTMLsrc.substring(0, i)); 117 | char c = (char) Integer.parseInt(entity.substring(1)); 118 | //Log.log(Log.LEVEL_TRACE, MODULE, "c: " + c + " " + entity.substring(1)); 119 | res.append(c); 120 | HTMLsrc = HTMLsrc.substring(j + 1); 121 | } else { 122 | res.append(HTMLsrc.substring(0, i)).append("&"); 123 | HTMLsrc = HTMLsrc.substring(i + 1); 124 | } 125 | 126 | continue; 127 | } 128 | 129 | res.append(HTMLsrc.substring(0, i)).append(decodedEntity); 130 | 131 | HTMLsrc = HTMLsrc.substring(j + 1); 132 | } 133 | 134 | return res.toString(); 135 | } 136 | 137 | /** 138 | * These are probably HTML 3.2 level... as it looks like some HTML 4 entities 139 | * are not present. 140 | */ 141 | private static final String[][] ENTITIES = { 142 | /* We probably don't want to filter regular ASCII chars so we leave them out */ 143 | {"&", "amp"}, 144 | {"<", "lt"}, 145 | {">", "gt"}, 146 | {"\"", "quot"}, 147 | 148 | {"\u0083", "#131"}, 149 | {"\u0084", "#132"}, 150 | {"\u0085", "#133"}, 151 | {"\u0086", "#134"}, 152 | {"\u0087", "#135"}, 153 | {"\u0089", "#137"}, 154 | {"\u008A", "#138"}, 155 | {"\u008B", "#139"}, 156 | {"\u008C", "#140"}, 157 | {"\u0091", "#145"}, 158 | {"\u0092", "#146"}, 159 | {"\u0093", "#147"}, 160 | {"\u0094", "#148"}, 161 | {"\u0095", "#149"}, 162 | {"\u0096", "#150"}, 163 | {"\u0097", "#151"}, 164 | {"\u0099", "#153"}, 165 | {"\u009A", "#154"}, 166 | {"\u009B", "#155"}, 167 | {"\u009C", "#156"}, 168 | {"\u009F", "#159"}, 169 | 170 | {"\u00A0", "nbsp"}, 171 | {"\u00A1", "iexcl"}, 172 | {"\u00A2", "cent"}, 173 | {"\u00A3", "pound"}, 174 | {"\u00A4", "curren"}, 175 | {"\u00A5", "yen"}, 176 | {"\u00A6", "brvbar"}, 177 | {"\u00A7", "sect"}, 178 | {"\u00A8", "uml"}, 179 | {"\u00A9", "copy"}, 180 | {"\u00AA", "ordf"}, 181 | {"\u00AB", "laquo"}, 182 | {"\u00AC", "not"}, 183 | {"\u00AD", "shy"}, 184 | {"\u00AE", "reg"}, 185 | {"\u00AF", "macr"}, 186 | {"\u00B0", "deg"}, 187 | {"\u00B1", "plusmn"}, 188 | {"\u00B2", "sup2"}, 189 | {"\u00B3", "sup3"}, 190 | 191 | {"\u00B4", "acute"}, 192 | {"\u00B5", "micro"}, 193 | {"\u00B6", "para"}, 194 | {"\u00B7", "middot"}, 195 | {"\u00B8", "cedil"}, 196 | {"\u00B9", "sup1"}, 197 | {"\u00BA", "ordm"}, 198 | {"\u00BB", "raquo"}, 199 | {"\u00BC", "frac14"}, 200 | {"\u00BD", "frac12"}, 201 | {"\u00BE", "frac34"}, 202 | {"\u00BF", "iquest"}, 203 | 204 | {"\u00C0", "Agrave"}, 205 | {"\u00C1", "Aacute"}, 206 | {"\u00C2", "Acirc"}, 207 | {"\u00C3", "Atilde"}, 208 | {"\u00C4", "Auml"}, 209 | {"\u00C5", "Aring"}, 210 | {"\u00C6", "AElig"}, 211 | {"\u00C7", "Ccedil"}, 212 | {"\u00C8", "Egrave"}, 213 | {"\u00C9", "Eacute"}, 214 | {"\u00CA", "Ecirc"}, 215 | {"\u00CB", "Euml"}, 216 | {"\u00CC", "Igrave"}, 217 | {"\u00CD", "Iacute"}, 218 | {"\u00CE", "Icirc"}, 219 | {"\u00CF", "Iuml"}, 220 | 221 | {"\u00D0", "ETH"}, 222 | {"\u00D1", "Ntilde"}, 223 | {"\u00D2", "Ograve"}, 224 | {"\u00D3", "Oacute"}, 225 | {"\u00D4", "Ocirc"}, 226 | {"\u00D5", "Otilde"}, 227 | {"\u00D6", "Ouml"}, 228 | {"\u00D7", "times"}, 229 | {"\u00D8", "Oslash"}, 230 | {"\u00D9", "Ugrave"}, 231 | {"\u00DA", "Uacute"}, 232 | {"\u00DB", "Ucirc"}, 233 | {"\u00DC", "Uuml"}, 234 | {"\u00DD", "Yacute"}, 235 | {"\u00DE", "THORN"}, 236 | {"\u00DF", "szlig"}, 237 | 238 | {"\u00E0", "agrave"}, 239 | {"\u00E1", "aacute"}, 240 | {"\u00E2", "acirc"}, 241 | {"\u00E3", "atilde"}, 242 | {"\u00E4", "auml"}, 243 | {"\u00E5", "aring"}, 244 | {"\u00E6", "aelig"}, 245 | {"\u00E7", "ccedil"}, 246 | {"\u00E8", "egrave"}, 247 | {"\u00E9", "eacute"}, 248 | {"\u00EA", "ecirc"}, 249 | {"\u00EB", "euml"}, 250 | {"\u00EC", "igrave"}, 251 | {"\u00ED", "iacute"}, 252 | {"\u00EE", "icirc"}, 253 | {"\u00EF", "iuml"}, 254 | 255 | {"\u00F0", "eth"}, 256 | {"\u00F1", "ntilde"}, 257 | {"\u00F2", "ograve"}, 258 | {"\u00F3", "oacute"}, 259 | {"\u00F4", "ocirc"}, 260 | {"\u00F5", "otilde"}, 261 | {"\u00F6", "ouml"}, 262 | {"\u00F7", "divid"}, 263 | {"\u00F8", "oslash"}, 264 | {"\u00F9", "ugrave"}, 265 | {"\u00FA", "uacute"}, 266 | {"\u00FB", "ucirc"}, 267 | {"\u00FC", "uuml"}, 268 | {"\u00FD", "yacute"}, 269 | {"\u00FE", "thorn"}, 270 | {"\u00FF", "yuml"}, 271 | {"\u0080", "euro"} 272 | }; 273 | 274 | private static String entityMap; 275 | private static String[] quickEntities; 276 | private static HashMap quickRevEntities = new HashMap(ENTITIES.length); 277 | 278 | static { 279 | // Initialize some local mappings to speed it all up 280 | int l = ENTITIES.length; 281 | StringBuffer temp = new StringBuffer(); 282 | 283 | quickEntities = new String[l]; 284 | for (int i = 0; i < l; i++) { 285 | temp.append(ENTITIES[i][0]); 286 | quickEntities[i] = "&" + ENTITIES[i][1] + ";"; 287 | quickRevEntities.put(ENTITIES[i][1], ENTITIES[i][0]); 288 | } 289 | entityMap = temp.toString(); 290 | } 291 | } 292 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/GRApplet.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote; 2 | 3 | import com.gallery.GalleryRemote.util.DialogUtil; 4 | import com.gallery.GalleryRemote.util.ImageUtils; 5 | import com.gallery.GalleryRemote.util.GRI18n; 6 | import com.gallery.GalleryRemote.model.Gallery; 7 | 8 | import javax.swing.*; 9 | import java.net.URL; 10 | import java.net.MalformedURLException; 11 | import java.util.Locale; 12 | 13 | /** 14 | * Created by IntelliJ IDEA. 15 | * User: paour 16 | * Date: Oct 30, 2003 17 | */ 18 | public class GRApplet extends JApplet { 19 | public static final String MODULE = "GRApplet"; 20 | 21 | protected JLabel jLabel; 22 | boolean hasStarted = false; 23 | String coreClass = "com.gallery.GalleryRemote.GalleryRemoteMainFrame"; 24 | 25 | public void init() { 26 | System.out.println("Applet init"); 27 | } 28 | 29 | public void start() { 30 | System.out.println("Applet transitionStart"); 31 | initGalleryRemote(); 32 | 33 | if (hasStarted) { 34 | GalleryRemote._().initializeGR(); 35 | 36 | String localeString = getParameter("gr_locale"); 37 | if (localeString != null && localeString.length() > 1) { 38 | Locale locale = GRI18n.parseLocaleString(localeString); 39 | GRI18n.setLocale(locale.getLanguage(), locale.getCountry()); 40 | Log.log(Log.LEVEL_INFO, MODULE, "Set locale to: " + locale); 41 | } 42 | 43 | initUI(); 44 | 45 | new Thread() { 46 | public void run() { 47 | GalleryRemote._().runGR(); 48 | } 49 | }.start(); 50 | } else { 51 | initDummyUI(); 52 | } 53 | } 54 | 55 | protected void initUI() { 56 | jLabel = new JLabel("
The Gallery Remote applet is running. Please don't close this window or navigate away!
"); 57 | getContentPane().add(jLabel); 58 | } 59 | 60 | protected void initDummyUI() { 61 | jLabel = new JLabel("
The Gallery Remote applet is not running because another is running in the same browser
"); 62 | getContentPane().add(jLabel); 63 | } 64 | 65 | protected void initGalleryRemote() { 66 | if (! GalleryRemote.createInstance(coreClass, this)) { 67 | JOptionPane.showMessageDialog(DialogUtil.findParentWindow(this), 68 | "Only one instance of the Gallery Remote can run at the same time...", 69 | "Error", JOptionPane.ERROR_MESSAGE); 70 | } else { 71 | hasStarted = true; 72 | } 73 | } 74 | 75 | public void stop() { 76 | System.out.println("Applet stop"); 77 | // don't shutdown the applet if it didn't transitionStart... 78 | if (hasStarted && GalleryRemote._() != null) { 79 | GalleryRemote._().getCore().shutdown(); 80 | } 81 | 82 | ImageUtils.purgeTemp(); 83 | 84 | Log.log(Log.LEVEL_INFO, MODULE, "Shutting down log"); 85 | Log.shutdown(); 86 | } 87 | 88 | public void hasShutdown() { 89 | jLabel.setText("
The Gallery Remote applet has stopped, you can navigate away or close the window
"); 90 | } 91 | 92 | protected AppletInfo getGRAppletInfo() { 93 | AppletInfo info = new AppletInfo(); 94 | 95 | info.gallery = new Gallery(GalleryRemote._().getCore().getMainStatusUpdate()); 96 | info.gallery.setBlockWrites(true); 97 | 98 | String url = getParameter("gr_url"); 99 | String urlFull = getParameter("gr_url_full"); 100 | String urlOverride = getParameter("gr_url_override"); 101 | String cookieName = getParameter("gr_cookie_name"); 102 | String cookieValue = getParameter("gr_cookie_value"); 103 | String cookieDomain = getParameter("gr_cookie_domain"); 104 | String cookiePath = getParameter("gr_cookie_path"); 105 | String userAgent = getParameter("gr_user_agent"); 106 | String galleryVersion = getParameter("gr_gallery_version"); 107 | String slideshowFrom = getParameter("gr_slideshow_start_from"); 108 | 109 | info.albumName = getParameter("gr_album"); 110 | 111 | Log.log(Log.LEVEL_INFO, MODULE, "Applet parameters:"); 112 | Log.log(Log.LEVEL_INFO, MODULE, "gr_url: " + url); 113 | Log.log(Log.LEVEL_INFO, MODULE, "gr_url_full: " + urlFull); 114 | Log.log(Log.LEVEL_INFO, MODULE, "gr_url_override: " + urlOverride); 115 | Log.log(Log.LEVEL_INFO, MODULE, "gr_cookie_name: " + cookieName); 116 | Log.log(Log.LEVEL_INFO, MODULE, "gr_cookie_domain: " + cookieDomain); 117 | Log.log(Log.LEVEL_INFO, MODULE, "gr_cookie_path: " + cookiePath); 118 | Log.log(Log.LEVEL_INFO, MODULE, "gr_album: " + info.albumName); 119 | Log.log(Log.LEVEL_INFO, MODULE, "gr_user_agent: " + userAgent); 120 | Log.log(Log.LEVEL_INFO, MODULE, "gr_gallery_version: " + galleryVersion); 121 | Log.log(Log.LEVEL_INFO, MODULE, "gr_slideshow_start_from: " + slideshowFrom); 122 | 123 | if (cookieDomain == null || cookieDomain.length() < 1) { 124 | try { 125 | cookieDomain = new URL(url).getHost(); 126 | } catch (MalformedURLException e) { 127 | URL documentBase = getDocumentBase(); 128 | cookieDomain = documentBase.getHost(); 129 | 130 | Log.log(Log.LEVEL_INFO, MODULE, "URL probably doesn't have a host part because the Gallery " + 131 | "is in (unsupported) relative mode. Using the Applet documentBase: " + cookieDomain); 132 | 133 | try { 134 | url = new URL(documentBase.getProtocol(), documentBase.getHost(), documentBase.getPort(), 135 | url).toString(); 136 | } catch (MalformedURLException e1) { 137 | Log.logException(Log.LEVEL_ERROR, MODULE, e1); 138 | } 139 | } 140 | } 141 | 142 | if (urlOverride != null) { 143 | info.gallery.setType(Gallery.TYPE_APPLET); 144 | info.gallery.setApUrlString(urlOverride); 145 | urlFull = urlOverride; 146 | } else if (urlFull != null) { 147 | // the server specified a full URL, we're probably in embedded mode 148 | // and we have to recreate the URL 149 | 150 | URL documentBase = getDocumentBase(); 151 | 152 | // if urlFull is indeed a full URL, use it 153 | try { 154 | URL urlFullU = new URL(urlFull); 155 | 156 | if (urlFullU.getHost().equals(documentBase.getHost()) 157 | && urlFullU.getPort() == documentBase.getPort()) { 158 | info.gallery.setType(Gallery.TYPE_APPLET); 159 | info.gallery.setApUrlString(urlFull); 160 | 161 | Log.log(Log.LEVEL_TRACE, MODULE, "Full URL: " + urlFull); 162 | } else { 163 | Log.log(Log.LEVEL_TRACE, MODULE, "urlFull doesn't match documentBase for important data"); 164 | 165 | throw new MalformedURLException(); 166 | } 167 | } catch (MalformedURLException e) { 168 | Log.log(Log.LEVEL_TRACE, MODULE, "urlFull is not a valid URL: recomposing it from documentBase"); 169 | 170 | try { 171 | String path = null; 172 | 173 | if (urlFull.startsWith("/")) { 174 | path = urlFull; 175 | } else { 176 | path = documentBase.getPath(); 177 | int i = path.lastIndexOf("/"); 178 | if (i != -1) { 179 | path = path.substring(0, i); 180 | } 181 | 182 | path += "/" + urlFull; 183 | } 184 | 185 | urlFull = new URL(documentBase.getProtocol(), documentBase.getHost(), documentBase.getPort(), 186 | path).toString(); 187 | 188 | info.gallery.setType(Gallery.TYPE_APPLET); 189 | info.gallery.setApUrlString(urlFull); 190 | 191 | Log.log(Log.LEVEL_TRACE, MODULE, "Full URL: " + urlFull); 192 | } catch (MalformedURLException ee) { 193 | Log.logException(Log.LEVEL_ERROR, MODULE, ee); 194 | urlFull = null; 195 | } 196 | } 197 | } 198 | 199 | if (urlFull == null) { 200 | // old versions of Gallery, or bad urlFull 201 | info.gallery.setType(Gallery.TYPE_STANDALONE); 202 | info.gallery.setUrlString(url); 203 | } 204 | 205 | info.gallery.setUserAgent(userAgent); 206 | info.gallery.cookieLogin = true; 207 | if (galleryVersion != null) { 208 | try { 209 | info.gallery.forceGalleryVersion = Integer.parseInt(galleryVersion); 210 | } catch (RuntimeException e) { 211 | Log.logException(Log.LEVEL_ERROR, MODULE, e); 212 | } 213 | } 214 | info.slideshowFrom = slideshowFrom; 215 | 216 | /*CookieModule.discardAllCookies(); 217 | if (cookieName != null) { 218 | Cookie cookie = new Cookie(cookieName, cookieValue, cookieDomain, cookiePath, null, false); 219 | Log.log(Log.LEVEL_TRACE, MODULE, "Adding cookie: " + cookie); 220 | CookieModule.addCookie(cookie); 221 | } 222 | 223 | int cookieNum = 1; 224 | String name = null; 225 | while ((name = getParameter("gr_cookie" + cookieNum + "_name")) != null) { 226 | String value = getParameter("gr_cookie" + cookieNum + "_value"); 227 | Cookie cookie1 = new Cookie(name, value, cookieDomain, cookiePath, null, false); 228 | Log.log(Log.LEVEL_TRACE, MODULE, "Adding cookie: " + cookie1); 229 | CookieModule.addCookie(cookie1); 230 | cookieNum++; 231 | }*/ 232 | 233 | return info; 234 | } 235 | 236 | class AppletInfo { 237 | String albumName; 238 | Gallery gallery; 239 | String slideshowFrom; 240 | } 241 | } 242 | -------------------------------------------------------------------------------- /com/gallery/GalleryRemote/prefs/URLPanel.java: -------------------------------------------------------------------------------- 1 | package com.gallery.GalleryRemote.prefs; 2 | 3 | import com.gallery.GalleryRemote.Log; 4 | import com.gallery.GalleryRemote.GalleryRemote; 5 | import com.gallery.GalleryRemote.MainFrame; 6 | import com.gallery.GalleryRemote.model.Gallery; 7 | import com.gallery.GalleryRemote.util.GRI18n; 8 | 9 | import javax.swing.*; 10 | import javax.swing.border.TitledBorder; 11 | import javax.swing.event.ListSelectionEvent; 12 | import javax.swing.event.ListSelectionListener; 13 | import javax.swing.event.TreeModelListener; 14 | import java.awt.*; 15 | import java.awt.event.ActionEvent; 16 | import java.awt.event.ActionListener; 17 | import java.awt.event.MouseEvent; 18 | import java.awt.event.MouseAdapter; 19 | 20 | /** 21 | * Created by IntelliJ IDEA. 22 | * User: paour 23 | * Date: May 8, 2003 24 | */ 25 | public class URLPanel extends PreferencePanel implements ListSelectionListener, ActionListener { 26 | public static final String MODULE = "URLPa"; 27 | 28 | 29 | JLabel icon = new JLabel(GRI18n.getString(MODULE, "icon")); 30 | 31 | GridBagLayout gridBagLayout1 = new GridBagLayout(); 32 | JScrollPane jScrollPane1 = new JScrollPane(); 33 | JList jGalleries = new JList(); 34 | JButton jModify = new JButton(); 35 | JButton jNew = new JButton(); 36 | JButton jDelete = new JButton(); 37 | JPanel jPanel1 = new JPanel(); 38 | JLabel jDetails = new JLabel(); 39 | GridLayout gridLayout1 = new GridLayout(); 40 | 41 | public JLabel getIcon() { 42 | return icon; 43 | } 44 | 45 | public boolean isReversible() { 46 | return false; 47 | } 48 | 49 | public void readProperties(PropertiesFile props) { 50 | } 51 | 52 | public void writeProperties(PropertiesFile props) { 53 | } 54 | 55 | public void buildUI() { 56 | jbInit(); 57 | } 58 | 59 | private void jbInit() { 60 | this.setLayout(gridBagLayout1); 61 | jModify.setActionCommand("Modify"); 62 | jModify.setText(GRI18n.getString(MODULE, "modify")); 63 | jNew.setActionCommand("New"); 64 | jNew.setText(GRI18n.getString(MODULE, "new")); 65 | jDelete.setActionCommand("Delete"); 66 | jDelete.setText(GRI18n.getString(MODULE, "delete")); 67 | jPanel1.setBorder(new TitledBorder(BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)), GRI18n.getString(MODULE, "details"))); 68 | jPanel1.setLayout(gridLayout1); 69 | gridLayout1.setColumns(1); 70 | jDetails.setMinimumSize(new Dimension(0, 50)); 71 | jDetails.setPreferredSize(new Dimension(0, 50)); 72 | jDetails.setHorizontalAlignment(SwingConstants.LEFT); 73 | jDetails.setVerticalAlignment(SwingConstants.TOP); 74 | this.add(jScrollPane1, new GridBagConstraints(0, 0, 1, 3, 1.0, 1.0 75 | , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); 76 | this.add(jModify, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 77 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); 78 | this.add(jNew, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 79 | , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); 80 | this.add(jDelete, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 81 | , GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); 82 | this.add(jPanel1, new GridBagConstraints(0, 3, 2, 1, 1.0, 1.0 83 | , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); 84 | jPanel1.add(jDetails, null); 85 | jScrollPane1.getViewport().add(jGalleries, null); 86 | 87 | jGalleries.setModel(GalleryRemote._().getCore().getGalleries()); 88 | jGalleries.setCellRenderer(new GalleryCellRenderer()); 89 | jGalleries.addListSelectionListener(this); 90 | 91 | jGalleries.addMouseListener(new MouseAdapter() { 92 | public void mouseClicked(MouseEvent e) { 93 | if (e.getClickCount() == 2) { 94 | int index = jGalleries.locationToIndex(e.getPoint()); 95 | modifyGallery((Gallery) jGalleries.getModel().getElementAt(index)); 96 | } 97 | } 98 | }); 99 | 100 | if (GalleryRemote._().getCore().getGalleries().getSize() > 0) { 101 | jGalleries.setSelectedIndex(0); 102 | } else { 103 | resetUIState(); 104 | } 105 | 106 | jModify.addActionListener(this); 107 | jNew.addActionListener(this); 108 | jDelete.addActionListener(this); 109 | } 110 | 111 | public void valueChanged(ListSelectionEvent e) { 112 | resetUIState(); 113 | } 114 | 115 | public void actionPerformed(ActionEvent e) { 116 | String cmd = e.getActionCommand(); 117 | Gallery g = (Gallery) jGalleries.getSelectedValue(); 118 | 119 | Log.log(Log.LEVEL_INFO, MODULE, "Command selected " + cmd + " Gallery: " + g); 120 | 121 | if (cmd.equals("Modify")) { 122 | modifyGallery(g); 123 | } else if (cmd.equals("New")) { 124 | Gallery newG = new Gallery(GalleryRemote._().getCore().getMainStatusUpdate()); 125 | if (GalleryRemote._().getCore() instanceof TreeModelListener) { 126 | newG.addTreeModelListener((TreeModelListener) GalleryRemote._().getCore()); 127 | } 128 | 129 | GalleryEditorDialog ged = new GalleryEditorDialog(dialog, newG); 130 | 131 | if (ged.isOK()) { 132 | GalleryRemote._().getCore().getGalleries().addElement(newG); 133 | jGalleries.setSelectedValue(newG, true); 134 | 135 | Gallery.uncacheAmbiguousUrl(); 136 | 137 | resetUIState(); 138 | } 139 | } else if (cmd.equals("Delete")) { 140 | Object[] params = {g.getUrl()}; 141 | int n = JOptionPane.showConfirmDialog(this, GRI18n.getString(MODULE, "delConfirm", params), 142 | GRI18n.getString(MODULE, "delete"), 143 | JOptionPane.WARNING_MESSAGE, 144 | JOptionPane.YES_NO_OPTION); 145 | 146 | if (n == JOptionPane.YES_OPTION) { 147 | ((MainFrame) GalleryRemote._().getCore()).removeGallery(g); 148 | 149 | Gallery.uncacheAmbiguousUrl(); 150 | } 151 | } else if (cmd.equals("GalleryEditorDialog")) { 152 | Gallery newG = (Gallery) e.getSource(); 153 | 154 | if (GalleryRemote._().getCore().getGalleries().getIndexOf(newG) == -1) { 155 | GalleryRemote._().getCore().getGalleries().addElement(newG); 156 | jGalleries.setSelectedValue(newG, true); 157 | } 158 | 159 | Gallery.uncacheAmbiguousUrl(); 160 | resetUIState(); 161 | } else { 162 | Log.log(Log.LEVEL_ERROR, MODULE, "Unknown command: " + cmd); 163 | } 164 | } 165 | 166 | private void modifyGallery(Gallery g) { 167 | GalleryEditorDialog ged = new GalleryEditorDialog(dialog, g); 168 | 169 | if (ged.isOK()) { 170 | //jGalleries.repaint(); 171 | int i = GalleryRemote._().getCore().getGalleries().getIndexOf(g); 172 | GalleryRemote._().getCore().getGalleries().removeElementAt(i); 173 | GalleryRemote._().getCore().getGalleries().insertElementAt(g, i); 174 | 175 | Gallery.uncacheAmbiguousUrl(); 176 | } 177 | } 178 | 179 | public void resetUIState() { 180 | Gallery selectedGallery = (Gallery) jGalleries.getSelectedValue(); 181 | 182 | StringBuffer sb = new StringBuffer(); 183 | 184 | if (selectedGallery != null) { 185 | sb.append(""); 186 | 187 | sb.append(GRI18n.getString(MODULE, "gllryURL")).append(selectedGallery.getUrlString()).append("
"); 188 | 189 | String username = selectedGallery.getUsername(); 190 | if (username == null || username.length() == 0) { 191 | username = "<Not set>"; 192 | } 193 | sb.append(GRI18n.getString(MODULE, "username")).append(username).append("
"); 194 | 195 | if (selectedGallery.isAutoLoadOnStartup()) { 196 | sb.append(GRI18n.getString(MODULE, "autoLogin")).append("
"); 197 | } 198 | 199 | sb.append(""); 200 | 201 | jModify.setEnabled(true); 202 | jDelete.setEnabled(true); 203 | } else { 204 | jModify.setEnabled(false); 205 | jDelete.setEnabled(false); 206 | } 207 | 208 | jDetails.setText(sb.toString()); 209 | } 210 | 211 | public class GalleryCellRenderer extends DefaultListCellRenderer { 212 | /** 213 | * Gets the listCellRendererComponent attribute of the FileCellRenderer 214 | * object 215 | * 216 | * @param list Description of Parameter 217 | * @param value Description of Parameter 218 | * @param index Description of Parameter 219 | * @param selected Description of Parameter 220 | * @param hasFocus Description of Parameter 221 | * @return The listCellRendererComponent value 222 | */ 223 | public Component getListCellRendererComponent( 224 | JList list, Object value, int index, 225 | boolean selected, boolean hasFocus) { 226 | super.getListCellRendererComponent(list, value, index, selected, hasFocus); 227 | 228 | Gallery g = (Gallery) value; 229 | 230 | setText(g.toString()); 231 | 232 | if (g.isAutoLoadOnStartup()) { 233 | setFont(getFont().deriveFont(Font.BOLD)); 234 | } else { 235 | setFont(getFont().deriveFont(Font.PLAIN)); 236 | } 237 | 238 | return this; 239 | } 240 | } 241 | } 242 | 243 | --------------------------------------------------------------------------------