• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.clients
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 5635

Show
Ignore:
Timestamp:
09/30/08 10:37:20 (8 weeks ago)
Author:
jburel
Message:

Allow customisation of Screen login and logo
Fixed problem while building the omero-clients jar, icons didn't have the correct path

Location:
trunk
Files:
9 modified

  • SRC/org/openmicroscopy/shoola/env/Container.java (modified) (1 diff)
  • SRC/org/openmicroscopy/shoola/env/LookupNames.java (modified) (1 diff)
  • SRC/org/openmicroscopy/shoola/env/ui/SplashScreenManager.java (modified) (6 diffs)
  • SRC/org/openmicroscopy/shoola/util/ui/IconFactory.java (modified) (2 diffs)
  • SRC/org/openmicroscopy/shoola/util/ui/login/ScreenLogin.java (modified) (1 diff)
  • SRC/org/openmicroscopy/shoola/util/ui/login/ServerTable.java (modified) (5 diffs)
  • build/app.xml (modified) (2 diffs)
  • build/build.xml (modified) (1 diff)
  • build/dist.xml (modified) (1 diff)

Legend:

Unmodified
Added
Removed
  • trunk/SRC/org/openmicroscopy/shoola/env/Container.java

    r4856 r5635  
    224224        public String resolveConfigFile(String fileName) 
    225225        { 
    226                 if (fileName == null)   throw new NullPointerException(); 
     226                //if (fileName == null) throw new NullPointerException(); 
    227227                StringBuffer relPath = new StringBuffer(CONFIG_DIR); 
    228228                relPath.append(File.separatorChar); 
  • trunk/SRC/org/openmicroscopy/shoola/env/LookupNames.java

    r5632 r5635  
    6060        public static final String SPLASH_SCREEN_LOGO = "SplashScreenLogo"; 
    6161         
     62        /** Field to access the <code>Splash screen</code> information. */ 
     63        public static final String SPLASH_SCREEN_LOGIN = "SplashScreenLogin"; 
     64         
    6265        /** Field to access the <code>Help on line</code> information. */ 
    6366        public static final String HELP_ON_LINE = "HelpOnLine"; 
  • trunk/SRC/org/openmicroscopy/shoola/env/ui/SplashScreenManager.java

    r5632 r5635  
    3434import java.beans.PropertyChangeEvent; 
    3535import java.beans.PropertyChangeListener; 
     36import java.io.File; 
    3637import javax.swing.Icon; 
     38import javax.swing.ImageIcon; 
    3739import javax.swing.JFrame; 
    3840 
    … …  
    4244import org.openmicroscopy.shoola.env.Container; 
    4345import org.openmicroscopy.shoola.env.LookupNames; 
     46import org.openmicroscopy.shoola.env.config.Registry; 
    4447import org.openmicroscopy.shoola.env.data.login.UserCredentials; 
    4548import org.openmicroscopy.shoola.util.ui.NotificationDialog; 
    … …  
    106109        private SplashScreen            component; 
    107110     
     111        /** The splash login. */ 
     112        private Icon                            splashLogin; 
     113         
    108114        /** 
    109115         * Attempts to log onto <code>OMERO</code>. 
    … …  
    156162        Image img = IconManager.getOMEImageIcon(); 
    157163        Object version = container.getRegistry().lookup(LookupNames.VERSION); 
    158         view = new ScreenLogin(TITLE, IconManager.getLoginBackground(), img, 
    159                                 (String) version); 
     164        String v = ""; 
     165        if (version != null && version instanceof String) 
     166                v = (String) version; 
     167        view = new ScreenLogin(TITLE, splashLogin, img, v); 
    160168                view.showConnectionSpeed(true); 
    161169                Dimension d = viewTop.getExtendedSize(); 
    … …  
    168176    } 
    169177     
     178    /** 
     179     * Creates the splash screen logo and login 
     180     *  
     181     * @param name The name of the image. 
     182     * @param path The path to the config file. 
     183     * @return See above. 
     184     */ 
     185    private Icon createIcon(String name, String path) 
     186    { 
     187        StringBuffer buf; 
     188        if (name == null) return null; 
     189        buf = new StringBuffer(path); 
     190                buf.append(File.separatorChar); 
     191                buf.append(name); 
     192        try { 
     193                Image img = Toolkit.getDefaultToolkit().getImage(buf.toString()); 
     194                if (img == null) return null; 
     195                Icon icon = new ImageIcon(img); 
     196                if (icon.getIconHeight() <= 0 || icon.getIconWidth() <= 0) 
     197                        return null; 
     198                return icon; 
     199        } catch (Exception e) { 
     200                //log the exception 
     201                container.getRegistry().getLogger().error(this, "Cannot create " + 
     202                                "the icon."); 
     203        } 
     204        return null; 
     205    } 
     206     
    170207        /** 
    171208         * Creates the splash screen component. 
    … …  
    180217                this.component = component; 
    181218                Image img = IconManager.getOMEImageIcon(); 
    182                 String n = (String) c.getRegistry().lookup(LookupNames.SPLASH_SCREEN_LOGO); 
    183                 IconManager im = IconManager.getInstance(c.getRegistry()); 
    184                 Icon splashScreen = im.getIcon(n); 
     219                Registry reg = c.getRegistry(); 
     220                String n = (String) reg.lookup(LookupNames.SPLASH_SCREEN_LOGO); 
     221                 
     222                String f = container.resolveConfigFile(null); 
     223                Icon splashScreen = createIcon(n, f); 
    185224                if (splashScreen == null) 
    186225                        splashScreen = IconManager.getSplashScreen(); 
    187         view = new ScreenLogin(TITLE, IconManager.getLoginBackground(), img); 
     226                n = (String) reg.lookup(LookupNames.SPLASH_SCREEN_LOGIN); 
     227                 
     228                splashLogin = createIcon(n, f); 
     229                if (splashLogin == null) 
     230                        splashLogin = IconManager.getLoginBackground(); 
     231                 
     232        view = new ScreenLogin(TITLE, splashLogin, img); 
    188233                viewTop = new ScreenLogo(TITLE, splashScreen, img); 
    189234                Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 
  • trunk/SRC/org/openmicroscopy/shoola/util/ui/IconFactory.java

    r4695 r5635  
    5656     * The path is relative to the application classpath. 
    5757     */ 
    58     private String  location = "graphx"; 
     58    private String  location = "/org/openmicroscopy/shoola/util/ui/graphx/"; 
    5959     
    6060    /** 
    … …  
    6767    String getResourcePathname(String iconFileName) 
    6868    { 
    69         return location+"/"+iconFileName; 
     69        return location+iconFileName; 
    7070    } 
    7171     
  • trunk/SRC/org/openmicroscopy/shoola/util/ui/login/ScreenLogin.java

    r5628 r5635  
    322322                connectionSpeedText = new JLabel(getConnectionSpeed()); 
    323323                connectionSpeedText.setForeground(TEXT_COLOR); 
    324                  
    325324                serverText = UIUtilities.buildTextPane(serverName, TEXT_COLOR); 
    326325                serverTextPane = UIUtilities.buildComponentPanelRight(serverText,  
  • trunk/SRC/org/openmicroscopy/shoola/util/ui/login/ServerTable.java

    r5519 r5635  
    6767        private static final int        INDENT = 4; 
    6868         
     69        /** The default size of an icon. */ 
     70        private static final int        DEFAULT_ICON_SIZE = 22; 
     71         
    6972        /** Index of the previously selected row. */ 
    7073        private int                             previousRow; 
    … …  
    9598         * @param parent        Reference to the model. Mustn't be <code>null</code>. 
    9699         * @param servers       Collection of servers. 
    97          * @param icon          The icon to display netx to the server's name. 
     100         * @param icon          The icon to display next to the server's name. 
    98101         */ 
    99102        ServerTable(ServerEditor parent, List servers, Icon icon) 
    … …  
    122125                        } 
    123126                } 
     127                int w = DEFAULT_ICON_SIZE; 
     128                int h = DEFAULT_ICON_SIZE; 
     129                if (icon != null) { 
     130                        w = icon.getIconWidth(); 
     131                        h = icon.getIconHeight(); 
     132                } 
    124133                focus = Boolean.FALSE; 
    125134                putClientProperty("terminateEditOnFocusLost", focus); 
    … …  
    127136                setModel(new ServerTableModel(objects, columnNames)); 
    128137                setDefaultRenderer(Object.class, new ServerListRenderer()); 
    129                 setRowHeight(icon.getIconHeight()+INDENT); 
     138                setRowHeight(h+INDENT); 
    130139                setShowHorizontalLines(true); 
    131140                setShowVerticalLines(false); 
    … …  
    135144                setIntercellSpacing(new Dimension(0, d.height)); 
    136145                TableColumn column = getColumnModel().getColumn(0); 
    137                 int n = icon.getIconWidth()+INDENT; 
     146                int n = w+INDENT; 
    138147                column.setMaxWidth(n); 
    139148                column.setMinWidth(n); 
  • trunk/build/app.xml

    r5604 r5635  
    6666  
    6767<property name="app.compiled.util.dir" location="${app.dir}/compiled/util"/>  
    68 <fileset id="app.resources.util" dir="${base.src.util.dir}" excludes="**/*.java"/> 
     68<fileset id="app.resources.util" dir="${base.src.dir}"> 
     69        <include name="org/openmicroscopy/shoola/util/**" /> 
     70        <exclude name="**/*.java" /> 
     71</fileset> 
     72<fileset id="app.resources.svc" dir="${base.src.dir}"> 
     73                <include name="org/openmicroscopy/shoola/svc/**" /> 
     74                <exclude name="**/*.java" /> 
     75        </fileset> 
    6976  
    7077   
    … …  
    9198         <fileset refid="app.resources.util"/> 
    9299        </copy>  
     100        <copy todir="${app.compiled.svc.dir}"> 
     101                 <fileset refid="app.resources.svc"/> 
     102                </copy> 
    93103  </target> 
    94104  
  • trunk/build/build.xml

    r5604 r5635  
    9292  
    9393 <property name="base.src.util.dir" location="SRC/org/openmicroscopy/shoola/util"/> 
    94         <property name="base.src.svc.dir" location="SRC/org/openmicroscopy/shoola/svc"/> 
    95            
     94 <property name="base.src.svc.dir" location="SRC/org/openmicroscopy/shoola/svc"/>  
     95  
     96         
    9697  <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
    9798   * Include the tasks lib and all children.  
  • trunk/build/dist.xml

    r5628 r5635  
    121121            <jar destfile="${dist.dir}/${dist.util.name}.jar"> 
    122122              <fileset dir="${app.compiled.util.dir}"/> 
     123                <manifest> 
     124                        <attribute name="Created-By" value="OMERO Development Team"/> 
     125                      </manifest>  
    123126            </jar> 
    124127          </target>  

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/