Thread: [Jsmooth-cvs] jsmooth/src/net/charabia/jsmoothgen/application/gui/editors ExecutableIcon.java, 1.2
Status: Beta
Brought to you by:
reyes
From: Rodrigo R. <re...@us...> - 2007-05-27 09:15:56
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/editors In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14961/src/net/charabia/jsmoothgen/application/gui/editors Modified Files: ExecutableIcon.java ExecutableName.java SkeletonPropertiesEditor.java Log Message: adds support for the splash screen in the jsmooth application Index: SkeletonPropertiesEditor.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/editors/SkeletonPropertiesEditor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SkeletonPropertiesEditor.java 7 Apr 2007 10:47:33 -0000 1.4 --- SkeletonPropertiesEditor.java 27 May 2007 09:15:49 -0000 1.5 *************** *** 1,244 **** ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003 Rodrigo Reyes <re...@ch...> ! ! 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., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! package net.charabia.jsmoothgen.application.gui.editors; ! ! import net.charabia.jsmoothgen.application.gui.skeleditors.*; ! ! import net.charabia.jsmoothgen.skeleton.*; ! import net.charabia.jsmoothgen.application.*; ! import net.charabia.jsmoothgen.application.gui.*; ! import net.charabia.jsmoothgen.application.gui.util.*; ! import javax.swing.*; ! import java.awt.*; ! import java.util.*; ! import com.l2fprod.common.swing.*; ! import com.l2fprod.common.propertysheet.*; ! ! import se.datadosen.component.RiverLayout; ! ! public class SkeletonPropertiesEditor extends Editor implements JSmoothModelBean.SkeletonChangedListener ! { ! private String m_currentSkelName = null; ! private SkeletonBean m_skel = null; ! private SkelPanel m_panel = new SkelPanel(); ! private Vector m_editors = new Vector(); ! ! public SkeletonPropertiesEditor() ! { ! setLayout(new BorderLayout()); ! add(m_panel, BorderLayout.CENTER); ! } ! ! public void rebuildProperties() ! { ! // System.out.println("============================================="); ! // System.out.println("============================================="); ! // System.out.println("=== REBUILD PROPERTIES !!!! ==========="); ! // System.out.println("============================================="); ! // System.out.println("============================================="); ! ! m_skel = null; ! if (m_currentSkelName != null) ! m_skel = Main.SKELETONS.getSkeleton(m_currentSkelName); ! ! SkeletonProperty[] sprops = null; ! if (m_skel != null) ! sprops = m_skel.getSkeletonProperties(); ! else ! sprops = new SkeletonProperty[0]; ! ! m_panel.removeAll(); ! m_panel.setLayout(new RiverLayout()); ! m_editors.clear(); ! ! for (int i=0; i<sprops.length; i++) ! { ! SkelPropEditor spe = null; ! if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_STRING)) ! { ! spe = new StringEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_TEXTAREA)) ! { ! spe = new TextAreaEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_BOOLEAN)) ! { ! spe = new CheckBoxEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_AUTODOWNLOADURL)) ! { ! spe = new AutoDownloadURLEditor(); ! } ! ! if (spe == null) ! { ! spe = new StringEditor(); ! } ! ! m_editors.add(spe); ! spe.bind(sprops[i]); ! ! if (spe.labelAtLeft()) ! { ! m_panel.add("br", new JLabel(Main.local(sprops[i].getLabel()))); ! m_panel.add("tab", new HelpButton(Main.local(sprops[i].getDescription()))); ! m_panel.add("tab hfill", spe.getGUI()); ! } ! else ! { ! m_panel.add("br right", spe.getGUI()); ! m_panel.add("tab", new HelpButton(Main.local(sprops[i].getDescription()))); ! m_panel.add("tab hfill", new JLabel(Main.local(sprops[i].getLabel()))); ! } ! } ! ! revalidate(); ! m_panel.revalidate(); ! doLayout(); ! m_panel.doLayout(); ! } ! ! public void dataChanged() ! { ! // System.out.println("========================================================"); ! // System.out.println("SkeletonPropertiesEditor: data changed, " + m_model.getSkeletonName()); ! if (m_model.getSkeletonName() == null) ! { ! // System.out.println("SkeletonPropertiesEditor, no name"); ! m_currentSkelName = null; ! rebuildProperties(); ! } ! ! if ((m_model != null) && (m_model.getSkeletonName() != null) && (!m_model.getSkeletonName().equalsIgnoreCase(m_currentSkelName))) ! { ! // System.out.println("SkeletonPropertiesEditor, different..."); ! m_currentSkelName = m_model.getSkeletonName(); ! rebuildProperties(); ! } ! ! JSmoothModelBean.Property[] jsprop = m_model.getSkeletonProperties(); ! // System.out.println("jsprop is null ? " + jsprop + " / " + ((jsprop!=null)?jsprop.length:-1)); ! if (jsprop != null) ! { ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! JSmoothModelBean.Property p = getPropertyInstance(spe.getIdName()); ! if (p != null) ! spe.valueChanged(p.getValue()); ! } ! } ! else ! { // if no properties are defined for this model, we use the default values ! ! SkeletonBean skel = Main.SKELETONS.getSkeleton( m_model.getSkeletonName() ); ! SkeletonProperty[] sprops = null; ! if (skel != null) ! sprops = skel.getSkeletonProperties(); ! ! if (sprops != null) ! { ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! for (int i=0; i<sprops.length; i++) ! { ! if (sprops[i].getIdName().equals(spe.getIdName())) ! spe.valueChanged(sprops[i].getValue()); ! } ! } ! } ! } ! ! // System.out.println("DONE NOTHING! " +m_currentSkelName + "/" + m_model.getSkeletonName()); ! } ! ! JSmoothModelBean.Property getPropertyInstance(String name) ! { ! JSmoothModelBean.Property[] jsprop = m_model.getSkeletonProperties(); ! for (int i=0; i<jsprop.length; i++) ! { ! if (jsprop[i].getKey().equals(name)) ! return jsprop[i]; ! } ! return null; ! } ! ! public void updateModel() ! { ! if (m_skel != null) ! { ! JSmoothModelBean.Property[] props = new JSmoothModelBean.Property[m_editors.size()]; ! int index = 0; ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! // System.out.println("IMODEL property " + spe + "/" + spe.getIdName() + "=" + spe.get()); ! props[index] = new JSmoothModelBean.Property(); ! props[index].setKey(spe.getIdName()); ! props[index].setValue(spe.get()); ! index++; ! } ! m_model.setSkeletonProperties(props); ! } ! ! // if (m_skel != null) ! // { ! // System.out.println("UPDATE MODEL for skeletons..."); ! // SkeletonProperty[] sp = m_skel.getSkeletonProperties(); ! // JSmoothModelBean.Property[] props = new JSmoothModelBean.Property[sp.length]; ! // for (int i=0; i<sp.length; i++) ! // { ! // props[i] = new JSmoothModelBean.Property(); ! // props[i].setKey(sp[i].getIdName()); ! // props[i].setValue(sp[i].getValue()); ! // System.out.println(props[i]); ! // } ! // m_model.setSkeletonProperties(props); ! // } ! ! } ! ! ! public void skeletonChanged() ! { ! // dataChanged(); ! rebuildProperties(); ! dataChanged(); ! } ! ! public String getLabel() ! { ! return "SKELETONPROPERTIES_LABEL"; ! } ! ! public String getDescription() ! { ! return "SKELETONPROPERTIES_HELP"; ! } ! ! public boolean needsBigSpace() ! { ! return true; ! } ! ! } --- 1,242 ---- ! /* ! JSmooth: a VM wrapper toolkit for Windows ! Copyright (C) 2003 Rodrigo Reyes <re...@ch...> ! ! 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., 675 Mass Ave, Cambridge, MA 02139, USA. ! ! */ ! ! package net.charabia.jsmoothgen.application.gui.editors; ! ! import net.charabia.jsmoothgen.application.gui.skeleditors.*; ! ! import net.charabia.jsmoothgen.skeleton.*; ! import net.charabia.jsmoothgen.application.*; ! import net.charabia.jsmoothgen.application.gui.*; ! import net.charabia.jsmoothgen.application.gui.util.*; ! import javax.swing.*; ! import java.awt.*; ! import java.util.*; ! import com.l2fprod.common.swing.*; ! //import com.l2fprod.common.propertysheet.*; ! ! import se.datadosen.component.RiverLayout; ! ! public class SkeletonPropertiesEditor extends Editor implements JSmoothModelBean.SkeletonChangedListener ! { ! private String m_currentSkelName = null; ! private SkeletonBean m_skel = null; ! private SkelPanel m_panel = new SkelPanel(); ! private Vector m_editors = new Vector(); ! ! public SkeletonPropertiesEditor() ! { ! setLayout(new BorderLayout()); ! add(m_panel, BorderLayout.CENTER); ! } ! ! public void rebuildProperties() ! { ! m_skel = null; ! if (m_currentSkelName != null) ! m_skel = Main.SKELETONS.getSkeleton(m_currentSkelName); ! ! SkeletonProperty[] sprops = null; ! if (m_skel != null) ! sprops = m_skel.getSkeletonProperties(); ! else ! sprops = new SkeletonProperty[0]; ! ! m_panel.removeAll(); ! m_panel.setLayout(new RiverLayout()); ! m_editors.clear(); ! ! for (int i=0; i<sprops.length; i++) ! { ! SkelPropEditor spe = null; ! if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_STRING)) ! { ! spe = new StringEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_TEXTAREA)) ! { ! spe = new TextAreaEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_BOOLEAN)) ! { ! spe = new CheckBoxEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_AUTODOWNLOADURL)) ! { ! spe = new AutoDownloadURLEditor(); ! } ! else if (sprops[i].getType().equalsIgnoreCase(SkeletonProperty.TYPE_IMAGESELECTOR)) ! { ! spe = new ImageSelectorEditor(); ! } ! ! if (spe == null) ! { ! spe = new StringEditor(); ! } ! ! m_editors.add(spe); ! spe.bind(sprops[i]); ! ! if (spe.labelAtLeft()) ! { ! m_panel.add("br", new JLabel(Main.local(sprops[i].getLabel()))); ! m_panel.add("tab", new HelpButton(Main.local(sprops[i].getDescription()))); ! m_panel.add("tab hfill", spe.getGUI()); ! } ! else ! { ! m_panel.add("br right", spe.getGUI()); ! m_panel.add("tab", new HelpButton(Main.local(sprops[i].getDescription()))); ! m_panel.add("tab hfill", new JLabel(Main.local(sprops[i].getLabel()))); ! } ! } ! ! revalidate(); ! m_panel.revalidate(); ! doLayout(); ! m_panel.doLayout(); ! } ! ! public void dataChanged() ! { ! // System.out.println("========================================================"); ! // System.out.println("SkeletonPropertiesEditor: data changed, " + m_model.getSkeletonName()); ! ! ! if (m_model.getSkeletonName() == null) ! { ! // System.out.println("SkeletonPropertiesEditor, no name"); ! m_currentSkelName = null; ! rebuildProperties(); ! } ! ! if ((m_model != null) && (m_model.getSkeletonName() != null) && (!m_model.getSkeletonName().equalsIgnoreCase(m_currentSkelName))) ! { ! // System.out.println("SkeletonPropertiesEditor, different..."); ! m_currentSkelName = m_model.getSkeletonName(); ! rebuildProperties(); ! } ! ! JSmoothModelBean.Property[] jsprop = m_model.getSkeletonProperties(); ! // System.out.println("jsprop is null ? " + jsprop + " / " + ((jsprop!=null)?jsprop.length:-1)); ! if (jsprop != null) ! { ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! JSmoothModelBean.Property p = getPropertyInstance(spe.getIdName()); ! if (p != null) ! spe.valueChanged(p.getValue()); ! } ! } ! else ! { // if no properties are defined for this model, we use the default values ! ! SkeletonBean skel = Main.SKELETONS.getSkeleton( m_model.getSkeletonName() ); ! SkeletonProperty[] sprops = null; ! if (skel != null) ! sprops = skel.getSkeletonProperties(); ! ! if (sprops != null) ! { ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! for (int i=0; i<sprops.length; i++) ! { ! if (sprops[i].getIdName().equals(spe.getIdName())) ! spe.valueChanged(sprops[i].getValue()); ! } ! } ! } ! } ! ! java.io.File root = Main.MAIN.getProjectFile(); ! if ((root != null) && (root.getParentFile() != null)) ! { ! root = root.getParentFile(); ! ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! spe.setBaseDir(root); ! } ! } ! ! // System.out.println("DONE NOTHING! " +m_currentSkelName + "/" + m_model.getSkeletonName()); ! } ! ! JSmoothModelBean.Property getPropertyInstance(String name) ! { ! JSmoothModelBean.Property[] jsprop = m_model.getSkeletonProperties(); ! for (int i=0; i<jsprop.length; i++) ! { ! if (jsprop[i].getKey().equals(name)) ! return jsprop[i]; ! } ! return null; ! } ! ! public void updateModel() ! { ! if (m_skel != null) ! { ! JSmoothModelBean.Property[] props = new JSmoothModelBean.Property[m_editors.size()]; ! int index = 0; ! for (Enumeration e=m_editors.elements(); e.hasMoreElements(); ) ! { ! SkelPropEditor spe = (SkelPropEditor)e.nextElement(); ! // System.out.println("IMODEL property " + spe + "/" + spe.getIdName() + "=" + spe.get()); ! props[index] = new JSmoothModelBean.Property(); ! props[index].setKey(spe.getIdName()); ! props[index].setValue(spe.get()); ! props[index].isLocalFile = spe.isLocalFile(); ! index++; ! } ! m_model.setSkeletonProperties(props); ! } ! ! } ! ! ! public void skeletonChanged() ! { ! // dataChanged(); ! rebuildProperties(); ! dataChanged(); ! } ! ! public String getLabel() ! { ! return "SKELETONPROPERTIES_LABEL"; ! } ! ! public String getDescription() ! { ! return "SKELETONPROPERTIES_HELP"; ! } ! ! public boolean needsBigSpace() ! { ! return true; ! } ! ! } Index: ExecutableIcon.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/editors/ExecutableIcon.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExecutableIcon.java 7 Apr 2007 10:47:33 -0000 1.2 --- ExecutableIcon.java 27 May 2007 09:15:48 -0000 1.3 *************** *** 74,77 **** --- 74,80 ---- public void updateModel() { + if (m_model == null) + return; + File f = m_selector.getFile(); if (f != null) Index: ExecutableName.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/editors/ExecutableName.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExecutableName.java 16 Mar 2004 08:05:16 -0000 1.1 --- ExecutableName.java 27 May 2007 09:15:49 -0000 1.2 *************** *** 50,53 **** --- 50,54 ---- else m_selector.setFile(null); + } |