[Java-link-svn] SF.net SVN: java-link: [3]
Status: Pre-Alpha
Brought to you by:
welterde0
From: <wel...@us...> - 2006-03-11 14:59:51
|
Revision: 3 Author: welterde0 Date: 2006-03-11 06:58:56 -0800 (Sat, 11 Mar 2006) ViewCVS: http://svn.sourceforge.net/java-link/?rev=3&view=rev Log Message: ----------- updated MainMenu to use the new MainMenu added simple PasswordLoginWidget added folder web to hold the homepage of JLink Modified Paths: -------------- trunk/Client/nbproject/private/private.properties trunk/Client/nbproject/project.properties trunk/Client/src/org/jlink/ClientCore.java trunk/Client/src/org/jlink/ClientFrontend.java trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.form trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.java trunk/Client/src/org/jlink/client/frontend/theme/Theme.java trunk/Share/src/org/jlink/resources/FontLoader.java trunk/themes/default/menues/main/system-change_server.png trunk/themes/default/theme.xml Added Paths: ----------- trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.form trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.java trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidgetListener.java trunk/Client/src/org/jlink/client/frontend/controll/ trunk/Client/src/org/jlink/client/frontend/controll/FrontendController.java trunk/Client/src/org/jlink/client/frontend/controll/MainMenuController.java trunk/Client/src/org/jlink/client/frontend/gal/ trunk/Client/src/org/jlink/client/frontend/gal/Frontend.java trunk/Client/src/org/jlink/client/frontend/gal/FrontendListener.java trunk/Client/src/org/jlink/client/frontend/gal/MainMenu.java trunk/Client/src/org/jlink/client/frontend/gal/impl/ trunk/Client/src/org/jlink/client/frontend/gal/impl/FrontendImpl.java trunk/Client/src/org/jlink/client/frontend/menu/MainMenuListener.java trunk/lib/jdom/ trunk/lib/jdom/jaxen-core.jar trunk/lib/jdom/jaxen-jdom.jar trunk/lib/jdom/jdom.jar trunk/lib/jdom/saxpath.jar web/ web/doc_trunk/ Modified: trunk/Client/nbproject/private/private.properties =================================================================== --- trunk/Client/nbproject/private/private.properties 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/nbproject/private/private.properties 2006-03-11 14:58:56 UTC (rev 3) @@ -1,6 +1,10 @@ application.args=../ +file.reference.jaxen-core.jar=../lib/jdom/jaxen-core.jar +file.reference.jaxen-jdom.jar=../lib/jdom/jaxen-jdom.jar +file.reference.jdom.jar=../lib/jdom/jdom.jar file.reference.log4j.jar=../lib/log4j/log4j.jar -file.reference.swing-layout.jar=/home/tassilo/Documents/dev/jlink/svn/trunk/lib/other/swing-layout.jar +file.reference.saxpath.jar=../lib/jdom/saxpath.jar +file.reference.swing-layout.jar=../lib/other/swing-layout.jar javac.debug=true javadoc.preview=true project.Share=../Share Modified: trunk/Client/nbproject/project.properties =================================================================== --- trunk/Client/nbproject/project.properties 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/nbproject/project.properties 2006-03-11 14:58:56 UTC (rev 3) @@ -16,12 +16,20 @@ dist.dir=dist dist.jar=${dist.dir}/Client.jar dist.javadoc.dir=${dist.dir}/javadoc +file.reference.jaxen-core.jar=../lib/jdom/jaxen-core.jar +file.reference.jaxen-jdom.jar=../lib/jdom/jaxen-jdom.jar +file.reference.jdom.jar=../lib/jdom/jdom.jar +file.reference.saxpath.jar=../lib/jdom/saxpath.jar file.reference.swing-layout.jar=../lib/other/swing-layout.jar jar.compress=true javac.classpath=\ ${reference.Share.jar}:\ ${file.reference.log4j.jar}:\ ${file.reference.swing-layout.jar}:\ + ${file.reference.jdom.jar}:\ + ${file.reference.jaxen-core.jar}:\ + ${file.reference.jaxen-jdom.jar}:\ + ${file.reference.saxpath.jar}:\ ${libs.swing-layout.classpath} # Space-separated list of extra javac options javac.compilerargs=-Xlint:unchecked Modified: trunk/Client/src/org/jlink/ClientCore.java =================================================================== --- trunk/Client/src/org/jlink/ClientCore.java 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/src/org/jlink/ClientCore.java 2006-03-11 14:58:56 UTC (rev 3) @@ -53,7 +53,7 @@ ret.log = Logger.getLogger("jlink.coreD"); ret.log.debug("Core created"); //Core::init() - ret.pool_run_now = new ThreadPoolExecutor(6, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue(20, true)); + ret.pool_run_now = new ThreadPoolExecutor(6, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(20, true)); //mods::init() Modified: trunk/Client/src/org/jlink/ClientFrontend.java =================================================================== --- trunk/Client/src/org/jlink/ClientFrontend.java 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/src/org/jlink/ClientFrontend.java 2006-03-11 14:58:56 UTC (rev 3) @@ -28,6 +28,8 @@ import org.jlink.Options; //import::own::frontend import org.jlink.client.frontend.MainFrame; +import org.jlink.client.frontend.menu.MainMenu; +import org.jlink.client.frontend.menu.MainMenuListener; import org.jlink.client.frontend.theme.ThemeManager; import org.jlink.client.frontend.theme.Theme; //import::own::gui @@ -58,10 +60,13 @@ public class ClientFrontend implements Module, ServerController { private ClientFrontend() { } + + + //The Module itself public static ClientFrontend create(ClientCore c) { ClientFrontend ret = null; ret = new ClientFrontend(); - ret.c = c; + ret.modCore = c; ret.log = Logger.getLogger("jlink.frontend"); ret.log.debug("ClientFrontend::create(Core) called"); @@ -99,56 +104,67 @@ return ret; } public void run() throws IllegalStateException { - if(!this.active) - throw new IllegalStateException("already destroyed"); - this.root.enable(); - this.mainmenu = this.createMainMenu(); - this.root.setFrame(this.mainmenu.getComponent()); - while(this.active) { - try { - this.operate(); + this.modThread = Thread.currentThread(); + try { + if(!this.modActive) + throw new IllegalStateException("already destroyed"); + + + log.debug("setting up"); + this.frntMainMenu = new MainMenu(); + this.frntMainMenu.setListener(new MainMenuListener() { + public void runChangeServer() { + } + + public void runOptions() { + } + + public void runCreateAcc() { + } + + public void runExit() { + modCore.destroy(); + } + + }); + + this.root.setFrame(this.frntMainMenu); + this.root.enable(); + while(this.modActive) { + try { + this.operate(); + } + catch(Exception e) { + log.error("caught Exception", e); + } } - catch(Exception e) { - this.log.error("caught Exception", e); - } + this.root.disable(); + } finally { + this.modThread = null; } - this.root.disable(); } - public void destroy() { - this.active = false; + this.modActive = false; } - public boolean isDestroyed() { - return this.active; + return this.modActive; } + public void join() { + if(this.modThread == null) + throw new IllegalStateException("Module not running"); + while(true) { + try { + this.modThread.join(); + break; + } catch(InterruptedException e) { + } + } + } //Run methods ///////////// private void operate() throws Exception { - synchronized(this.lock0) { - log.debug("lock0::wait()"); - this.lock0.wait(); - log.debug("lock0::wait() done"); - } - if(this.mainCh == -1) - return; - switch(this.mainCh) { - case 1: - //showing Input Dialog - String h = null; - int p = 0; - h = JOptionPane.showInputDialog(this.mainmenu.getComponent(), "Please enter the Server host"); - //TODO: ask for port - p = 3470; - log.debug("setting Core::server variables to {}:{}", h, p); - this.c.setServerHost(h); - this.c.setServerPort(p); - log.debug("calling Core::connect()"); - this.c.connect(); - log.debug("done"); - } } @@ -158,101 +174,50 @@ //private classes //private Methods - private MenuBean createMainMenu() { - MenuBean ret = new MenuBean(this.mx, this.my); - - ThemeManager tm = ThemeManager.get(); - log.debug("loading Images"); - //Image img_sys_exit = Toolkit.getDefaultToolkit().createImage(new File(ClientMain. - // getDir_app(), "themes/default/menues/main/system-exit.png").getAbsolutePath()); - //Image img_sys_cs = Toolkit.getDefaultToolkit().createImage(new File(ClientMain. - // getDir_app(), "themes/default/menues/main/system-change_server.png").getAbsolutePath()); - Image img_sys_exit = tm.getCurrentTheme().getImage("menues/main/system-exit.png"); - Image img_sys_cs = tm.getCurrentTheme().getImage("menues/main/system-change_server.png"); - //TODO: add other imgs(on demand) - log.debug("scaling images"); - int x0 = (int) (64 * mx); - int y0 = (int) (64 * my); - int x1 = (int) (64 * mx); - int y1 = (int) (64 * my); - img_sys_exit = img_sys_exit.getScaledInstance(x0, y0, Image.SCALE_SMOOTH); - img_sys_cs = img_sys_cs.getScaledInstance(x1, y1, Image.SCALE_SMOOTH); - - log.debug("waiting for being scaled"); - MediaTracker mt = new MediaTracker(ret.getComponent()); - mt.addImage(img_sys_exit, 0); - mt.addImage(img_sys_cs, 1); - //TODO: add other imgs(on demand) - try { - mt.waitForAll(); - } catch (InterruptedException ex) { - //do nothing - } - - log.debug("adding buttons"); - ret.addButton("sys_exit", new ImageIcon(img_sys_exit), 896, 448, 56, 53, "Exits JLink."); - ret.addButtonListener("sys_exit", new ActionListener() { - public void actionPerformed(ActionEvent evt) { - c.destroy(); - } - }); - ret.addButton("sys-change_server", new ImageIcon(img_sys_cs), 896, 64, 70, 64, "Changes the Server"); - ret.addButtonListener("sys-change_server", new ActionListener() { - public void actionPerformed(ActionEvent evt) { - synchronized(lock0) { - lock0.notify(); - } - mainCh = 1; - } - }); - - return ret; - } public void connect() { log.debug("Frontend::connect() delegated"); - this.c.connect(); + this.modCore.connect(); } public void disconnect() { log.debug("Frontend::disconnect() delegated"); - this.c.disconnect(); + this.modCore.disconnect(); } public void setServerHost(String nhost) { log.debug("Frontend::setServerHost({}) delegated", nhost); - this.c.setServerHost(nhost); + this.modCore.setServerHost(nhost); } public String getServerHost() { log.debug("Frontend::getServerHost() delegated"); - return this.c.getServerHost(); + return this.modCore.getServerHost(); } public void setServerPort(int nport) { log.debug("Frontend::setServerPort({}) delegated"); - this.c.setServerPort(nport); + this.modCore.setServerPort(nport); } public int getServerPort() { log.debug("Frontend::getServerPort() delegated"); - return this.c.getServerPort(); + return this.modCore.getServerPort(); } - - public void join() { - } + //The Module itself + private Thread modThread = null; + private boolean modActive = true; + private ClientCore modCore = null; + //The Frontend itself + private MainMenu frntMainMenu = null; + //private Attributes - private boolean active = true; private MainFrame root = null; private double mx = 1; private double my = 1; private Logger log = null; - private ClientCore c = null; - private String lock0 = ""; - private byte mainCh = -1; - private MenuBean mainmenu = null; } Added: trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.form =================================================================== --- trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.form (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.form 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> + <AuxValues> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel1" alignment="0" pref="376" max="32767" attributes="0"/> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jPasswordField1" alignment="0" pref="314" max="32767" attributes="0"/> + <Component id="jTextField1" alignment="0" pref="314" max="32767" attributes="0"/> + </Group> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + <EmptySpace pref="247" max="32767" attributes="0"/> + <Component id="jButton2" min="-2" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" pref="42" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jPasswordField1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace pref="165" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="text" type="java.lang.String" value="Please Login now"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="text" type="java.lang.String" value="User-ID"/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField1"> + </Component> + <Component class="javax.swing.JPasswordField" name="jPasswordField1"> + </Component> + <Component class="javax.swing.JLabel" name="jLabel3"> + <Properties> + <Property name="text" type="java.lang.String" value="Pass-ID"/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="text" type="java.lang.String" value="back"/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="text" type="java.lang.String" value="login"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="actionLogin"/> + </Events> + </Component> + </SubComponents> +</Form> Added: trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,134 @@ +/* + * PasswordLoginWidget.java + * + * Created on 10. März 2006, 22:16 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend; + +/** + * + * @author tassilo + */ +public class PasswordLoginWidget extends javax.swing.JPanel { + + /** Creates new form PasswordLoginWidget */ + public PasswordLoginWidget() { + initComponents(); + } + + public void setListener(PasswordLoginWidgetListener l) { + this.list = l; + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents + private void initComponents() { + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jPasswordField1 = new javax.swing.JPasswordField(); + jLabel3 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + + jLabel1.setText("Please Login now"); + + jLabel2.setText("User-ID"); + + jLabel3.setText("Pass-ID"); + + jButton1.setText("back"); + + jButton2.setText("login"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + actionLogin(evt); + } + }); + + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE) + .add(layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel2) + .add(jLabel3)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPasswordField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) + .add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE))) + .add(layout.createSequentialGroup() + .add(jButton1) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 247, Short.MAX_VALUE) + .add(jButton2))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 42, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel2) + .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jPasswordField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel3)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jButton1) + .add(jButton2)) + .addContainerGap(165, Short.MAX_VALUE)) + ); + }// </editor-fold>//GEN-END:initComponents + + private void actionLogin(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_actionLogin + if(this.list == null) + return; + String u = this.jTextField1.getText(); + String p = new String(this.jPasswordField1.getPassword()); + this.list.goLogin(u, p); + }//GEN-LAST:event_actionLogin + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JPasswordField jPasswordField1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables + + private PasswordLoginWidgetListener list = null; +} Added: trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidgetListener.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidgetListener.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidgetListener.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,39 @@ +/* + * PasswordLoginWidgetListener.java + * + * Created on 10. März 2006, 22:25 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend; + +//import +//import::sys +//import::sys::util +import java.util.EventListener; +import java.util.EventObject; + +/** + * + * @author tassilo + */ +public interface PasswordLoginWidgetListener extends EventListener { + public void goLogin(String user, String pass); + public void goBack(); +} Added: trunk/Client/src/org/jlink/client/frontend/controll/FrontendController.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/controll/FrontendController.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/controll/FrontendController.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,43 @@ +/* + * FrontendController.java + * + * Created on 10. März 2006, 23:01 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.controll; + +//import +//import::own +//import::sys + + +/** + * + * @author tassilo + */ +public class FrontendController { + + + private FrontendController() { + } + + + +} Added: trunk/Client/src/org/jlink/client/frontend/controll/MainMenuController.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/controll/MainMenuController.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/controll/MainMenuController.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,36 @@ +/* + * MainMenuController.java + * + * Created on 10. März 2006, 23:03 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.controll; + +/** + * + * @author tassilo + */ +public class MainMenuController { + + /** Creates a new instance of MainMenuController */ + public MainMenuController() { + } + +} Added: trunk/Client/src/org/jlink/client/frontend/gal/Frontend.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/gal/Frontend.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/gal/Frontend.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,48 @@ +/* + * Frontend.java + * + * Created on 11. März 2006, 12:36 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.gal; + +/** + * + * @author tassilo + */ +public interface Frontend { + public static final char VIEW_MAINMENU = 0; + public static final char VIEW_OPTIONS = 1; + public static final char VIEW_ACC_CREATE = 2; + public static final char VIEW_GAME = 3; + + //general Visualization + public void show(); + public void dispose(); + public boolean isVisible(); + + //Views + public char getView(); + public void gotoMainMenu(); + public void gotoOptions(); + public void gotoAccCreation(); + public void gotoGame(); + public void setListener(FrontendListener l); +} Added: trunk/Client/src/org/jlink/client/frontend/gal/FrontendListener.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/gal/FrontendListener.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/gal/FrontendListener.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,38 @@ +/* + * FrontendListener.java + * + * Created on 11. März 2006, 15:18 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.gal; + +//import +//import::sys +//import::sys::util +import java.util.EventListener; + +/** + * + * @author tassilo + */ +public interface FrontendListener extends EventListener { + public void changedView(char oldView, char newView); + +} Added: trunk/Client/src/org/jlink/client/frontend/gal/MainMenu.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/gal/MainMenu.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/gal/MainMenu.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,32 @@ +/* + * MainMenu.java + * + * Created on 11. März 2006, 12:37 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.gal; + +/** + * + * @author tassilo + */ +public interface MainMenu { + +} Added: trunk/Client/src/org/jlink/client/frontend/gal/impl/FrontendImpl.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/gal/impl/FrontendImpl.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/gal/impl/FrontendImpl.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,82 @@ +/* + * FrontendImpl.java + * + * Created on 11. März 2006, 15:03 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.gal.impl; + +//import +//import::own +//import::own::frontend +//import::own::frontend::GAL +import org.jlink.client.frontend.gal.Frontend; +import org.jlink.client.frontend.gal.FrontendListener; + +/** + * + * @author tassilo + */ +public class FrontendImpl implements Frontend { + + /** Creates a new instance of FrontendImpl */ + public FrontendImpl() { + } + + public void show() { + + this.viewActive = true; + } + + public void dispose() { + + this.viewActive = false; + } + + public boolean isVisible() { + return this.viewActive; + } + + public char getView() { + return this.viewCur; + } + + public void gotoMainMenu() { + } + + public void gotoOptions() { + } + + public void gotoAccCreation() { + } + + public void gotoGame() { + } + + public void setListener(FrontendListener l) { + this.list = l; + } + + + private char viewCur = 0; + private boolean viewActive = false; + + private FrontendListener list = null; +} Modified: trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.form =================================================================== --- trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.form 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.form 2006-03-11 14:58:56 UTC (rev 3) @@ -14,12 +14,14 @@ <Group type="102" attributes="0"> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="1" attributes="0"> - <Component id="jLabel1" pref="330" max="32767" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="connectButton" min="-2" max="-2" attributes="0"/> - </Group> + <Component id="jLabel1" pref="424" max="32767" attributes="0"/> + <Component id="passwordLoginWidget1" alignment="0" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="changeServerButton" alignment="1" min="-2" max="-2" attributes="0"/> <Component id="optionsButton" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="createButton" alignment="1" min="-2" max="-2" attributes="0"/> <Component id="exitButton" alignment="1" min="-2" max="-2" attributes="0"/> </Group> <EmptySpace max="-2" attributes="0"/> @@ -31,29 +33,55 @@ <Group type="102" alignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> - <Component id="connectButton" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="changeServerButton" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel1" alignment="3" min="-2" pref="58" max="-2" attributes="0"/> </Group> <EmptySpace max="-2" attributes="0"/> - <Component id="optionsButton" min="-2" max="-2" attributes="0"/> - <EmptySpace pref="235" max="32767" attributes="0"/> - <Component id="exitButton" min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="optionsButton" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="createButton" min="-2" max="-2" attributes="0"/> + <EmptySpace pref="114" max="32767" attributes="0"/> + <Component id="exitButton" min="-2" max="-2" attributes="0"/> + </Group> + <Component id="passwordLoginWidget1" min="-2" max="-2" attributes="0"/> + </Group> <EmptySpace max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> </Layout> <SubComponents> - <Component class="javax.swing.JButton" name="connectButton"> + <Component class="javax.swing.JButton" name="changeServerButton"> <Properties> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> - <Connection code="getIcon("menues/main/systen-server_connect.png")" type="code"/> + <Connection code="getIcon("menues/main/system-change_server.png")" type="code"/> </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[64, 64]"/> + </Property> </Properties> </Component> <Component class="javax.swing.JButton" name="optionsButton"> + <Properties> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[64, 64]"/> + </Property> + </Properties> </Component> <Component class="javax.swing.JButton" name="exitButton"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="getIcon("menues/main/system-exit.png")" type="code"/> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[64, 64]"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exitClicked"/> + </Events> </Component> <Component class="javax.swing.JLabel" name="jLabel1"> <Properties> @@ -63,5 +91,17 @@ <Property name="text" type="java.lang.String" value="JLink"/> </Properties> </Component> + <Component class="javax.swing.JButton" name="createButton"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="getIcon("menues/main/account-register.png")" type="code"/> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[64, 64]"/> + </Property> + </Properties> + </Component> + <Component class="org.jlink.client.frontend.PasswordLoginWidget" name="passwordLoginWidget1"> + </Component> </SubComponents> </Form> Modified: trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.java 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.java 2006-03-11 14:58:56 UTC (rev 3) @@ -27,10 +27,12 @@ //import::own import org.jlink.resources.FontLoader; //import::sys +import org.apache.log4j.Logger; import java.awt.Image; import java.awt.MediaTracker; import javax.swing.ImageIcon; import javax.swing.JPanel; +import org.jlink.client.frontend.PasswordLoginWidget; import org.jlink.client.frontend.theme.Theme; import org.jlink.client.frontend.theme.ThemeManager; @@ -42,10 +44,16 @@ /** Creates new form MainMenu */ public MainMenu() { + log = Logger.getLogger("frontend.mainmenu"); + log.debug("MainMenu created"); cur = ThemeManager.get().getCurrentTheme(); initComponents(); } + public void setListener(MainMenuListener l) { + this.list = l; + } + /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is @@ -53,16 +61,32 @@ */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { - connectButton = new javax.swing.JButton(); + changeServerButton = new javax.swing.JButton(); optionsButton = new javax.swing.JButton(); exitButton = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); + createButton = new javax.swing.JButton(); + passwordLoginWidget1 = new org.jlink.client.frontend.PasswordLoginWidget(); - connectButton.setIcon(getIcon("menues/main/systen-server_connect.png")); + changeServerButton.setIcon(getIcon("menues/main/system-change_server.png")); + changeServerButton.setPreferredSize(new java.awt.Dimension(64, 64)); + optionsButton.setPreferredSize(new java.awt.Dimension(64, 64)); + + exitButton.setIcon(getIcon("menues/main/system-exit.png")); + exitButton.setPreferredSize(new java.awt.Dimension(64, 64)); + exitButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + exitClicked(evt); + } + }); + jLabel1.setFont(FontLoader.getFont0().deriveFont(30)); jLabel1.setText("JLink"); + createButton.setIcon(getIcon("menues/main/account-register.png")); + createButton.setPreferredSize(new java.awt.Dimension(64, 64)); + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -70,12 +94,14 @@ .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() - .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(connectButton)) - .add(org.jdesktop.layout.GroupLayout.TRAILING, optionsButton) - .add(org.jdesktop.layout.GroupLayout.TRAILING, exitButton)) + .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE) + .add(passwordLoginWidget1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(org.jdesktop.layout.GroupLayout.TRAILING, changeServerButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, optionsButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, createButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, exitButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); layout.setVerticalGroup( @@ -83,33 +109,55 @@ .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(connectButton) - .add(jLabel1)) + .add(changeServerButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 58, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(optionsButton) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 235, Short.MAX_VALUE) - .add(exitButton) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .add(optionsButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(createButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 114, Short.MAX_VALUE) + .add(exitButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(passwordLoginWidget1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents + + private void exitClicked(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitClicked + if(this.list == null) + return; + this.list.runExit(); + }//GEN-LAST:event_exitClicked private ImageIcon getIcon(String p) { + log.debug("loading image: {}", p); Image i = this.cur.getImage(p); - i = i.getScaledInstance(64, 64, Image.SCALE_SMOOTH); + log.debug("scaling"); + i = i.getScaledInstance(54, 54, Image.SCALE_SMOOTH); + log.debug("waiting"); MediaTracker mt = new MediaTracker(this); mt.addImage(i, 0); try { mt.waitForAll(); } catch (InterruptedException ex) { } + log.debug("returning"); return new ImageIcon(i); } + + + // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton connectButton; + private javax.swing.JButton changeServerButton; + private javax.swing.JButton createButton; private javax.swing.JButton exitButton; private javax.swing.JLabel jLabel1; private javax.swing.JButton optionsButton; + private org.jlink.client.frontend.PasswordLoginWidget passwordLoginWidget1; // End of variables declaration//GEN-END:variables - private Theme cur = null; + private Theme cur = null; + private Logger log = null; + private MainMenuListener list = null; } Added: trunk/Client/src/org/jlink/client/frontend/menu/MainMenuListener.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/menu/MainMenuListener.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/menu/MainMenuListener.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,41 @@ +/* + * MainMenuListener.java + * + * Created on 10. März 2006, 21:47 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.menu; + +//import +//import::sys +//import::sys::util +import java.util.EventListener; +import java.util.EventObject; + +/** + * + * @author tassilo + */ +public interface MainMenuListener extends EventListener { + public void runChangeServer(); + public void runOptions(); + public void runCreateAcc(); + public void runExit(); +} Modified: trunk/Client/src/org/jlink/client/frontend/theme/Theme.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/theme/Theme.java 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/src/org/jlink/client/frontend/theme/Theme.java 2006-03-11 14:58:56 UTC (rev 3) @@ -26,30 +26,99 @@ //import::sys import java.io.File; import org.apache.log4j.Logger; -//import::awt +import org.apache.log4j.NDC; +//import::sys::awt import java.awt.Image; import java.awt.Toolkit; import java.awt.MediaTracker; +import java.awt.Color; +//import::sys::jdom +import org.jdom.Document; +import org.jdom.JDOMException; +import org.jdom.input.SAXBuilder; +import org.jdom.xpath.XPath; /** * * @author tassilo */ public class Theme { + public static final int MENU_MAIN = 0; + public static Theme load(File dir) { if(!dir.isDirectory()) throw new IllegalArgumentException(); Theme ret = null; ret = new Theme(); ret.log = Logger.getLogger("jlink.frontend.theme"); - ret.log.debug("loaded Theme from {}", dir.getAbsolutePath()); + ret.log.debug("loading Theme from {}", dir.getAbsolutePath()); + ret.dir = dir; ret.name = dir.getName(); + ret.validate(0); + try { + ret.loadConfig(); + } catch(Exception e) { + ret.log.error("Cannot load theme", e); + return null; + } + return ret; } + public void loadConfig() throws Exception { + log.debug("loading Theme config"); + File c = new File(this.dir, "theme.xml"); + SAXBuilder build = new SAXBuilder(); + log.debug("loading XML"); + this.doc = build.build(c); + } + //Core Operations + public boolean validate(int maxMissing) { + if(maxMissing < 0) + throw new IllegalArgumentException("maxMissing found: [" + maxMissing + "] required: >= 0"); + NDC.push(this.name); + log.debug("Theme::{}::validate({})", this.name, maxMissing); + NDC.push("validate"); + + log.debug("checking MainMenu images"); + + log.debug("checking for: menues/main/system-exit.png"); + File img0 = new File(dir, "menues/main/system-exit.png"); + if(!img0.exists()) { + log.info("Image /menues/main/system-exit.png not found"); + maxMissing--; + } + + log.debug("checking for: menues/main/system-change_server.png"); + File img1 = new File(dir, "menues/main/system-change_server.png"); + if(!img1.exists()) { + log.info("Image /menues/main/system-change_server.png not found"); + maxMissing--; + } + + log.debug("checking for: menues/main/account-register.png"); + File img2 = new File(dir, "menues/main/account-register.png"); + if(!img2.exists()) { + log.info("Image /menues/main/account-register.png not found"); + maxMissing--; + } + + if(maxMissing < 0) { + log.debug("returning false"); + NDC.pop(); + NDC.pop(); + return false; + } else { + log.debug("returning true"); + NDC.pop(); + NDC.pop(); + return true; + } + } + //Core props public String getName() { return this.name; @@ -76,11 +145,38 @@ } + //Color Operations + public Color getMenuBGColor(int id) { + Color ret = null; + boolean e = false; + switch(id) { + case MENU_MAIN: + + try { + String t = XPath.selectSingleNode(this.doc, "/child::menu/attribute::name[(child::text() = \"main\")]/child::background/attribute::color").toString(); + } catch (JDOMException ex) { + log.error("Error reading from Theme config", ex); + ret = null; + } + break; + } + + if(ret == null) + throw new IllegalArgumentException(); + + return ret; + } + private Theme() { } - private String name = null; + + + private String name = null; + private Document doc = null; + + private Logger log = null; private File dir = null; Modified: trunk/Share/src/org/jlink/resources/FontLoader.java =================================================================== --- trunk/Share/src/org/jlink/resources/FontLoader.java 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Share/src/org/jlink/resources/FontLoader.java 2006-03-11 14:58:56 UTC (rev 3) @@ -49,7 +49,7 @@ } - return ret; + return ret.deriveFont(60f); } Added: trunk/lib/jdom/jaxen-core.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/jdom/jaxen-core.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/lib/jdom/jaxen-jdom.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/jdom/jaxen-jdom.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/lib/jdom/jdom.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/jdom/jdom.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/lib/jdom/saxpath.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/jdom/saxpath.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/themes/default/menues/main/system-change_server.png =================================================================== (Binary files differ) Modified: trunk/themes/default/theme.xml =================================================================== --- trunk/themes/default/theme.xml 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/themes/default/theme.xml 2006-03-11 14:58:56 UTC (rev 3) @@ -2,7 +2,10 @@ <theme> <meta> - <property name="name" value="default"/> + <property name="name" value="Standard"/> <property name="author" value="Tassilo Schweyer"/> </meta> + <menu name="main"> + <background color="00186f"/> + </menu> </theme> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |