jsmooth-cvs Mailing List for JSmooth (Page 17)
Status: Beta
Brought to you by:
reyes
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(64) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(44) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
|
Mar
|
Apr
(23) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
(35) |
Mar
(75) |
Apr
(105) |
May
(89) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(12) |
Nov
|
Dec
|
2014 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2016 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29016/util Modified Files: CommandRunner.java EditableListFileEditor.java FileSelectionTextField.java RecentFileMenu.java SortedEditableList.java Added Files: ClassChooserDialog.java CompilationDialog.java GenericFileFilter.java HTMLPane.java LayoutLengthDescriptor.java OptionalHelpPanel.java PanelLayout.java PropertyEditorDialog.java RegExDocument.java Removed Files: ClassPathFileFilter.java FileSelectionTextField.form JarClassChooser.form JarClassChooser.java NumericTextField.form NumericTextField.java SortedEditableList.form VersionEditor.form VersionEditor.java WarningNotRelativeFilesDialog.form WarningNotRelativeFilesDialog.java Log Message: new swing GUI update Index: SortedEditableList.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/util/SortedEditableList.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SortedEditableList.java 10 Sep 2003 20:07:14 -0000 1.2 --- SortedEditableList.java 16 Mar 2004 08:05:17 -0000 1.3 *************** *** 210,213 **** --- 210,214 ---- m_itemList.setSelectedIndex(index+1); } + modelChanged(); }//GEN-LAST:event_buttonDownActionPerformed *************** *** 222,226 **** m_itemList.setSelectedIndex(index-1); } ! }//GEN-LAST:event_buttonUpActionPerformed --- 223,227 ---- m_itemList.setSelectedIndex(index-1); } ! modelChanged(); }//GEN-LAST:event_buttonUpActionPerformed *************** *** 253,257 **** } } ! }//GEN-LAST:event_buttonEditActionPerformed --- 254,258 ---- } } ! modelChanged(); }//GEN-LAST:event_buttonEditActionPerformed *************** *** 270,273 **** --- 271,275 ---- } } + modelChanged(); }//GEN-LAST:event_buttonRemoveActionPerformed *************** *** 293,299 **** m_model.addElement(item); } } }//GEN-LAST:event_buttonAddActionPerformed ! // Variables declaration - do not modify//GEN-BEGIN:variables --- 295,305 ---- m_model.addElement(item); } + modelChanged(); } }//GEN-LAST:event_buttonAddActionPerformed ! ! protected void modelChanged() ! { ! } // Variables declaration - do not modify//GEN-BEGIN:variables Index: EditableListFileEditor.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/util/EditableListFileEditor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EditableListFileEditor.java 10 Sep 2003 20:07:14 -0000 1.3 --- EditableListFileEditor.java 16 Mar 2004 08:05:16 -0000 1.4 *************** *** 26,91 **** public class EditableListFileEditor implements SortedEditableList.Editor { ! private File m_rootDir; ! private JFileChooser m_fileChooser = new JFileChooser(); ! ! /** Creates a new instance of EditableListFileEditor */ ! public EditableListFileEditor() ! { ! } ! public void setFileChooser(JFileChooser chooser) ! { ! m_fileChooser = chooser; ! } ! public void setRootDir(File dir) ! { ! m_rootDir = dir; ! m_fileChooser.setCurrentDirectory(dir); ! } ! public File getRootDir() ! { ! return m_rootDir; ! } ! public Object createNewItem(SortedEditableList selist) ! { ! if (m_fileChooser.showOpenDialog(selist) == JFileChooser.APPROVE_OPTION) ! { ! File[] files = m_fileChooser.getSelectedFiles(); ! for (int i=0; i<files.length; i++) { ! File f = files[i]; ! if (m_rootDir != null) ! { ! f = net.charabia.jsmoothgen.application.JSmoothModelPersistency.makePathRelativeIfPossible(m_rootDir, f); ! files[i] = f; ! } } ! return files; ! } ! return null; ! } ! public Object editItem(SortedEditableList selist, Object item) ! { ! m_fileChooser.setSelectedFile((File)item); ! if (m_fileChooser.showOpenDialog(selist) == JFileChooser.APPROVE_OPTION) ! { ! File f = m_fileChooser.getSelectedFile(); ! if (m_rootDir != null) ! { ! f = net.charabia.jsmoothgen.application.JSmoothModelPersistency.makePathRelativeIfPossible(m_rootDir, f); ! } ! return f; ! } ! return null; ! } ! public boolean removeItem(SortedEditableList selist, Object item) ! { ! return true; ! } } --- 26,96 ---- public class EditableListFileEditor implements SortedEditableList.Editor { ! private File m_rootDir; ! private JFileChooser m_fileChooser = new JFileChooser(); ! /** Creates a new instance of EditableListFileEditor */ ! public EditableListFileEditor() ! { ! } ! ! public void setFileChooser(JFileChooser chooser) ! { ! m_fileChooser = chooser; ! } ! ! public JFileChooser getFileChooser() ! { ! return m_fileChooser; ! } ! public void setRootDir(File dir) ! { ! m_rootDir = dir; ! m_fileChooser.setCurrentDirectory(dir); ! } ! public File getRootDir() ! { ! return m_rootDir; ! } ! public Object createNewItem(SortedEditableList selist) ! { ! if (m_fileChooser.showOpenDialog(selist) == JFileChooser.APPROVE_OPTION) ! { ! File[] files = m_fileChooser.getSelectedFiles(); ! for (int i=0; i<files.length; i++) ! { ! File f = files[i]; ! if (m_rootDir != null) { ! f = net.charabia.jsmoothgen.application.JSmoothModelPersistency.makePathRelativeIfPossible(m_rootDir, f); ! files[i] = f; } ! } ! return files; ! } ! return null; ! } ! public Object editItem(SortedEditableList selist, Object item) ! { ! m_fileChooser.setSelectedFile((File)item); ! if (m_fileChooser.showOpenDialog(selist) == JFileChooser.APPROVE_OPTION) ! { ! File f = m_fileChooser.getSelectedFile(); ! if (m_rootDir != null) ! { ! f = net.charabia.jsmoothgen.application.JSmoothModelPersistency.makePathRelativeIfPossible(m_rootDir, f); ! } ! return f; ! } ! return null; ! } ! public boolean removeItem(SortedEditableList selist, Object item) ! { ! return true; ! } } --- WarningNotRelativeFilesDialog.form DELETED --- --- NEW FILE: ClassChooserDialog.java --- /* 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.util; import java.util.jar.*; import java.util.*; import javax.swing.tree.*; import javax.swing.event.*; public class ClassChooserDialog extends javax.swing.JDialog { JarEntryTreeNode m_root; private boolean m_valid = false; public class ClassTreeListener implements TreeSelectionListener { public void valueChanged(TreeSelectionEvent e) { TreePath tp = e.getPath(); JarEntryTreeNode last = (JarEntryTreeNode)tp.getLastPathComponent(); if (last.getChildCount()>0) { m_buttonSelect.setEnabled(false); } else { m_buttonSelect.setEnabled(true); } } } public class JarEntryTreeNode extends javax.swing.tree.DefaultMutableTreeNode { public JarEntryTreeNode(String value) { super(value); DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer(); java.net.URL imgurl = getClass().getResource("/icons/stock_form-autopilots-16.png"); if (imgurl != null) { javax.swing.ImageIcon leaf = new javax.swing.ImageIcon(imgurl); renderer.setLeafIcon(leaf); } m_tree.setCellRenderer(renderer); m_tree.addTreeSelectionListener(new ClassTreeListener()); m_tree.setEditable(false); } /** * Attach a java path to this node. */ public void add(String[] items) { JarEntryTreeNode current = this; for (int i=0; i<items.length; i++) { JarEntryTreeNode next = null; for (Enumeration e=current.children(); (e.hasMoreElements()) && (next == null); ) { JarEntryTreeNode jtn = (JarEntryTreeNode)e.nextElement(); if (jtn.getUserObject().equals(items[i])) { next = jtn; } } if (next == null) { next = new JarEntryTreeNode(items[i]); current.add(next); current = next; } else { current = next; } } } } /** Creates new form ClassChooserDialog */ public ClassChooserDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } public void clear() { JarEntryTreeNode root = new JarEntryTreeNode("Available Classes"); m_root = root; m_tree.setModel(new DefaultTreeModel(m_root)); } public void addJar(JarFile jf) { for (Enumeration e=jf.entries(); e.hasMoreElements(); ) { JarEntry entry = (JarEntry)e.nextElement(); String[] res = entry.toString().split("/"); // System.out.println("JarEntry: " + entry); if ((res.length > 0) && (res[res.length-1].toLowerCase().endsWith(".class"))) { String rs = res[res.length-1]; rs = rs.substring(0, rs.length()-6); res[res.length-1] = rs; m_root.add(res); } } } public void setJar(JarFile jf) { JarEntryTreeNode root = new JarEntryTreeNode(jf.getName()); m_root = root; m_tree.setModel(new DefaultTreeModel(root)); } public String getClassName() { TreePath path = m_tree.getSelectionPath(); Object[] objs = path.getPath(); StringBuffer cname = new StringBuffer(); for (int i=1; i<objs.length; i++) { if (i>1) cname.append("."); cname.append(((JarEntryTreeNode)objs[i]).getUserObject().toString()); } return cname.toString(); } public void setClassName(String classname) { if (m_root == null) return; String[] res = classname.split("[.]"); JarEntryTreeNode node = m_root; JarEntryTreeNode best = m_root; for (int i=0; i<res.length; i++) { String item = res[i]; JarEntryTreeNode next = null; for (Enumeration e=node.children(); e.hasMoreElements(); ) { JarEntryTreeNode opt = (JarEntryTreeNode)e.nextElement(); if (item.equals(opt.getUserObject())) next = opt; } node = next; if (node != null) best = node; } TreePath tp = new TreePath(best.getPath()); m_tree.setSelectionPath(tp); m_tree.makeVisible(tp); } /** 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. */ private void initComponents()//GEN-BEGIN:initComponents { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); m_tree = new javax.swing.JTree(); jPanel2 = new javax.swing.JPanel(); m_buttonSelect = new javax.swing.JButton(); jSeparator1 = new javax.swing.JSeparator(); m_buttonCancel = new javax.swing.JButton(); setTitle("Class Selector"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); jPanel1.setLayout(new java.awt.BorderLayout()); jPanel1.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(10, 10, 10, 10))); jPanel1.setFocusable(false); jLabel1.setText("Select a class..."); jLabel1.setFocusable(false); jPanel1.add(jLabel1, java.awt.BorderLayout.NORTH); jPanel3.setLayout(new java.awt.BorderLayout()); jPanel3.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(1, 1, 1, 1))); jPanel3.setFocusable(false); jScrollPane1.setFocusable(false); jScrollPane1.setViewportView(m_tree); jPanel3.add(jScrollPane1, java.awt.BorderLayout.CENTER); jPanel1.add(jPanel3, java.awt.BorderLayout.CENTER); getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); jPanel2.setFocusable(false); m_buttonSelect.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_calc-accept-16.png"))); m_buttonSelect.setText("Select"); m_buttonSelect.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonSelectActionPerformed(evt); } }); jPanel2.add(m_buttonSelect); jPanel2.add(jSeparator1); m_buttonCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_calc-cancel-16.png"))); m_buttonCancel.setText("Cancel"); m_buttonCancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonCancelActionPerformed(evt); } }); jPanel2.add(m_buttonCancel); getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width-371)/2, (screenSize.height-260)/2, 371, 260); }//GEN-END:initComponents private void buttonSelectActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_buttonSelectActionPerformed {//GEN-HEADEREND:event_buttonSelectActionPerformed // Add your handling code here: m_valid = true; hide(); }//GEN-LAST:event_buttonSelectActionPerformed private void buttonCancelActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_buttonCancelActionPerformed {//GEN-HEADEREND:event_buttonCancelActionPerformed // Add your handling code here: m_valid = false; hide(); }//GEN-LAST:event_buttonCancelActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog m_valid = false; setVisible(false); dispose(); }//GEN-LAST:event_closeDialog /** * @param args the command line arguments */ public static void main(String args[]) { new ClassChooserDialog(new javax.swing.JFrame(), true).show(); } public boolean validated() { return m_valid; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSeparator jSeparator1; private javax.swing.JButton m_buttonCancel; private javax.swing.JButton m_buttonSelect; private javax.swing.JTree m_tree; // End of variables declaration//GEN-END:variables } --- WarningNotRelativeFilesDialog.java DELETED --- --- NEW FILE: GenericFileFilter.java --- /* 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.util; import java.util.*; public class GenericFileFilter extends javax.swing.filechooser.FileFilter { private Vector m_suffix = new Vector();; private String m_description; public GenericFileFilter() { m_description = "?"; } public GenericFileFilter(String desc) { m_description = desc; } public GenericFileFilter(String suffix, String desc) { m_suffix.add(suffix.toUpperCase()); m_description = desc; } public void addSuffix(String suffix) { m_suffix.add(suffix.toUpperCase()); } public boolean accept(java.io.File f) { if (f.isDirectory()) return true; String suffix = getSuffix(f).toUpperCase(); return m_suffix.contains(suffix); } public String getDescription() { return m_description; } private String getSuffix(java.io.File f) { String fstr = f.getAbsolutePath(); int lastDot = fstr.lastIndexOf('.'); if ((lastDot >= 0) && ((lastDot+1) < fstr.length())) { return fstr.substring(lastDot+1); } return ""; } } --- FileSelectionTextField.form DELETED --- --- ClassPathFileFilter.java DELETED --- --- NEW FILE: HTMLPane.java --- /* 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.util; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import java.io.*; import com.l2fprod.common.swing.*; /** * Represents a JTextField associated with a button that pops up a * file dialog selector. * */ public class HTMLPane extends JPanel { private JScrollPane m_scroller; private JEditorPane m_html; public HTMLPane() { m_html = new JEditorPane("text/html","<html></html>"); m_scroller = new JScrollPane(m_html); setLayout(new BorderLayout()); m_html.setEditable(false); add(BorderLayout.CENTER, m_scroller); } public void setText(String s) { m_html.setText(s); m_html.setCaretPosition(0); } } --- SortedEditableList.form DELETED --- --- JarClassChooser.form DELETED --- --- VersionEditor.java DELETED --- --- VersionEditor.form DELETED --- --- JarClassChooser.java DELETED --- Index: CommandRunner.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/util/CommandRunner.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CommandRunner.java 26 Aug 2003 21:39:40 -0000 1.1 --- CommandRunner.java 16 Mar 2004 08:05:16 -0000 1.2 *************** *** 25,29 **** /** * - * @author 'Rodrigo Reyes" */ public class CommandRunner --- 25,28 ---- Index: FileSelectionTextField.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/util/FileSelectionTextField.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FileSelectionTextField.java 23 Nov 2003 18:59:31 -0000 1.7 --- FileSelectionTextField.java 16 Mar 2004 08:05:16 -0000 1.8 *************** *** 24,32 **** import java.io.*; public class FileSelectionTextField extends javax.swing.JPanel { ! private File m_basedir = null; ! private java.util.Vector m_listeners = new java.util.Vector(); public interface FileSelected --- 24,42 ---- import java.io.*; + + /** + * Represents a JTextField associated with a button that pops up a + * file dialog selector. + * + */ + public class FileSelectionTextField extends javax.swing.JPanel { + private JButton m_buttonFileSelection; + private JFileChooser m_fileChooser; + private JTextField m_filename; ! private File m_basedir = null; ! private java.util.Vector m_listeners = new java.util.Vector(); public interface FileSelected *************** *** 35,43 **** } ! /** Creates new form BeanForm */ ! public FileSelectionTextField() ! { ! initComponents(); ! } public void addListener(FileSelected fs) --- 45,92 ---- } ! public FileSelectionTextField() ! { ! m_fileChooser = new javax.swing.JFileChooser(); ! m_filename = new javax.swing.JTextField(); ! m_buttonFileSelection = new javax.swing.JButton(); ! ! setLayout(new java.awt.BorderLayout()); ! ! add(m_filename, java.awt.BorderLayout.CENTER); ! ! m_buttonFileSelection.setText("..."); ! m_buttonFileSelection.addActionListener(new java.awt.event.ActionListener() ! { ! public void actionPerformed(java.awt.event.ActionEvent evt) ! { ! buttonFileSelectionActionPerformed(evt); ! } ! }); ! ! m_filename.addActionListener(new java.awt.event.ActionListener() ! { ! public void actionPerformed(java.awt.event.ActionEvent evt) ! { ! if (m_filename.getText().length() > 0) ! setFile(new java.io.File(m_filename.getText())); ! else ! setFile(null); ! notifyListeners(m_filename.getText()); ! } ! }); ! m_filename.addFocusListener(new java.awt.event.FocusAdapter() { ! public void focusLost(java.awt.event.FocusEvent e) ! { ! if (m_filename.getText().length() > 0) ! setFile(new java.io.File(m_filename.getText())); ! else ! setFile(null); ! // setFile(new java.io.File(m_filename.getText())); ! notifyListeners(m_filename.getText()); ! } ! }); ! ! add(m_buttonFileSelection, java.awt.BorderLayout.EAST); ! } public void addListener(FileSelected fs) *************** *** 60,151 **** } ! /** 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. ! */ ! private void initComponents()//GEN-BEGIN:initComponents { ! m_fileChooser = new javax.swing.JFileChooser(); ! m_filename = new javax.swing.JTextField(); ! m_buttonFileSelection = new javax.swing.JButton(); ! ! setLayout(new java.awt.BorderLayout()); ! ! add(m_filename, java.awt.BorderLayout.CENTER); ! ! m_buttonFileSelection.setText("..."); ! m_buttonFileSelection.addActionListener(new java.awt.event.ActionListener() ! { ! public void actionPerformed(java.awt.event.ActionEvent evt) ! { ! buttonFileSelectionActionPerformed(evt); ! } ! }); ! ! add(m_buttonFileSelection, java.awt.BorderLayout.EAST); ! ! }//GEN-END:initComponents ! ! private void buttonFileSelectionActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_buttonFileSelectionActionPerformed ! {//GEN-HEADEREND:event_buttonFileSelectionActionPerformed ! // Add your handling code here: ! java.io.File cur = new java.io.File(m_filename.getText()); ! if ((cur.isAbsolute() == false) && (m_basedir != null)) ! { ! cur = new File(m_basedir, cur.toString()).getAbsoluteFile(); ! try { ! cur = cur.getCanonicalFile(); ! } catch (IOException iox) ! { ! iox.printStackTrace(); ! } ! } ! m_fileChooser.setSelectedFile(cur); ! if (m_fileChooser.showDialog(this, "Select") == JFileChooser.APPROVE_OPTION) ! { ! java.io.File f = m_fileChooser.getSelectedFile(); ! if (m_basedir != null) ! { ! File rel = net.charabia.jsmoothgen.application.JSmoothModelPersistency.makePathRelativeIfPossible(m_basedir, f); ! m_filename.setText(rel.toString()); ! notifyListeners(rel.toString()); ! } ! else ! { ! m_filename.setText(f.getAbsolutePath()); ! notifyListeners(f.getAbsolutePath()); ! } ! } ! }//GEN-LAST:event_buttonFileSelectionActionPerformed ! ! public void setFile(java.io.File f) ! { ! if (f == null) ! { ! m_filename.setText(""); ! } ! else if (m_basedir != null) ! { File rel = net.charabia.jsmoothgen.application.JSmoothModelPersistency.makePathRelativeIfPossible(m_basedir, f); m_filename.setText(rel.toString()); ! } else ! { m_filename.setText(f.getAbsolutePath()); ! } ! } ! public java.io.File getFile() ! { ! if (m_filename.getText().trim().length() == 0) ! return null; ! return new java.io.File(m_filename.getText()); ! } ! public void setFileChooser(JFileChooser jfc) ! { ! m_fileChooser = jfc; ! } public void setFileSelectionMode(int mode) --- 109,179 ---- } ! private void buttonFileSelectionActionPerformed(java.awt.event.ActionEvent evt) { ! String fname = m_filename.getText().trim(); ! java.io.File cur = new java.io.File(fname); ! if ((cur.isAbsolute() == false) && (m_basedir != null)) ! { ! cur = new File(m_basedir, cur.toString()).getAbsoluteFile(); ! try { ! cur = cur.getCanonicalFile(); ! } catch (IOException iox) ! { ! iox.printStackTrace(); ! } ! } ! m_fileChooser.setSelectedFile(cur); ! if (m_fileChooser.showDialog(this, "Select") == JFileChooser.APPROVE_OPTION) ! { ! java.io.File f = m_fileChooser.getSelectedFile(); ! if (m_basedir != null) ! { File rel = net.charabia.jsmoothgen.application.JSmoothModelPersistency.makePathRelativeIfPossible(m_basedir, f); m_filename.setText(rel.toString()); ! notifyListeners(rel.toString()); ! } else ! { m_filename.setText(f.getAbsolutePath()); ! notifyListeners(f.getAbsolutePath()); ! } ! } ! } ! public void setFile(java.io.File f) ! { ! System.out.println("Setting File: " + f + " / " + m_basedir); ! if (f == null) ! { ! m_filename.setText(""); ! } ! else if (m_basedir != null) ! { ! try { ! File rel = net.charabia.jsmoothgen.application.JSmoothModelPersistency.makePathRelativeIfPossible(m_basedir, f); ! m_filename.setText(rel.toString()); ! } catch (Throwable thr) ! { ! m_filename.setText(f.toString()); ! } ! } ! else ! { ! m_filename.setText(f.toString()); ! } ! System.out.println("Filename: " + m_filename.getText()); ! } ! ! public java.io.File getFile() ! { ! if (m_filename.getText().trim().length() == 0) ! return null; ! return new java.io.File(m_filename.getText()); ! } ! public void setFileChooser(JFileChooser jfc) ! { ! m_fileChooser = jfc; ! } public void setFileSelectionMode(int mode) *************** *** 154,179 **** } ! public void setBaseDir(File root) ! { ! m_basedir = root; ! } ! public File getBaseDir() ! { ! return m_basedir; ! } ! public void setEnabled(boolean b) ! { ! System.out.println("set enabled to " + b); ! m_buttonFileSelection.setEnabled(b); ! m_filename.setEnabled(b); ! } - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton m_buttonFileSelection; - private javax.swing.JFileChooser m_fileChooser; - private javax.swing.JTextField m_filename; - // End of variables declaration//GEN-END:variables } --- 182,202 ---- } ! public void setBaseDir(File root) ! { ! m_fileChooser.setCurrentDirectory(root); ! m_basedir = root; ! } ! public File getBaseDir() ! { ! return m_basedir; ! } ! public void setEnabled(boolean b) ! { ! m_buttonFileSelection.setEnabled(b); ! m_filename.setEnabled(b); ! } } Index: RecentFileMenu.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/util/RecentFileMenu.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RecentFileMenu.java 26 Aug 2003 21:13:16 -0000 1.2 --- RecentFileMenu.java 16 Mar 2004 08:05:17 -0000 1.3 *************** *** 25,28 **** --- 25,30 ---- import javax.swing.*; import java.util.prefs.*; + import java.util.Vector; + /** * *************** *** 31,142 **** public class RecentFileMenu { ! private JMenu m_root; ! private String[] m_recent; ! private Class m_prefAttach; ! private RecentFileMenu.Action m_action; ! ! public interface Action ! { ! public void action(String path); ! } ! /** Creates a new instance of RecentFileMenu */ ! public RecentFileMenu(JMenu menuroot, int recentCount, Class prefAttach, RecentFileMenu.Action action) ! { ! m_recent = new String[recentCount]; ! m_root = menuroot; ! m_prefAttach = prefAttach; ! m_action = action; ! loadRecentPrefs(); ! } ! private void loadRecentPrefs() ! { ! Preferences p = Preferences.systemNodeForPackage(m_prefAttach); ! int count = p.getInt("recentfilecount", 0); ! int offset = 0; ! for (int i=0; i<count; i++) ! { ! String rf = p.get("recentfile_" + i, null); ! if ((rf != null) && (offset<m_recent.length)) ! { ! m_recent[offset++] = rf; ! } ! } ! buildMenu(); ! } ! public void savePrefs() ! { ! Preferences p = Preferences.systemNodeForPackage(m_prefAttach); ! int offset = 0; ! for (int i=0; i<m_recent.length; i++) ! { ! if (m_recent[i] != null) ! { ! p.put("recentfile_" + offset, m_recent[i]); ! offset ++; ! } ! } ! p.putInt("recentfilecount", offset); ! } ! public class ActionRecent implements java.awt.event.ActionListener ! { ! public int Offset; ! public void actionPerformed(java.awt.event.ActionEvent evt) ! { ! if (m_recent[Offset]!=null) ! RecentFileMenu.this.m_action.action(m_recent[Offset]); ! } ! } ! ! private void buildMenu() { ! m_root.removeAll(); ! for (int i=0; i<m_recent.length; i++) { ! if (m_recent[i] != null) ! { ! JMenuItem item = new JMenuItem(m_recent[i]); ! ActionRecent ar = new ActionRecent(); ! ar.Offset = i; ! item.addActionListener(ar); ! m_root.add(item); ! } } - m_root.addSeparator(); - JMenuItem clear = new JMenuItem("Clear"); - clear.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - for (int i=0; i<m_recent.length; i++) - { - m_recent[i] = null; - } - buildMenu(); - } - }); - m_root.add(clear); } ! public void add(String rec) ! { ! for (int i=m_recent.length-1; i>=0; i--) ! { ! if (rec.equals(m_recent[i])) ! return; ! } ! ! for (int i=m_recent.length-1; i>0; i--) { ! m_recent[i] = m_recent[i-1]; } ! m_recent[0] = rec; ! buildMenu(); ! } } --- 33,132 ---- public class RecentFileMenu { ! private JMenu m_root; ! private Vector m_recent; ! private Class m_prefAttach; ! private RecentFileMenu.Action m_action; ! private int m_recentCount; ! public interface Action ! { ! public void action(String path); ! } ! /** Creates a new instance of RecentFileMenu */ ! public RecentFileMenu(JMenu menuroot, int recentCount, Class prefAttach, RecentFileMenu.Action action) ! { ! m_recent = new Vector(recentCount); ! m_recentCount = recentCount; ! m_root = menuroot; ! m_prefAttach = prefAttach; ! m_action = action; ! loadRecentPrefs(); ! } ! private void loadRecentPrefs() ! { ! Preferences p = Preferences.systemNodeForPackage(m_prefAttach); ! int count = p.getInt("recentfilecount", 0); ! m_recent.removeAllElements(); ! for (int i=0; i<count; i++) ! { ! String rf = p.get("recentfile_" + i, null); ! if ((rf != null) && (m_recent.size()<m_recentCount)) ! { ! m_recent.add(rf); ! } ! } ! ! buildMenu(); ! } ! public void savePrefs() ! { ! Preferences p = Preferences.systemNodeForPackage(m_prefAttach); ! ! for (int i=0; i<m_recent.size(); i++) ! { ! p.put("recentfile_" + i, m_recent.elementAt(i).toString()); ! } ! p.putInt("recentfilecount", m_recent.size()); ! } ! public class ActionRecent implements java.awt.event.ActionListener ! { ! public int Offset; ! public void actionPerformed(java.awt.event.ActionEvent evt) { ! if (m_recent.elementAt(Offset)!=null) { ! RecentFileMenu.this.m_action.action(m_recent.elementAt(Offset).toString()); ! add(m_recent.elementAt(Offset).toString()); } } + } ! private void buildMenu() ! { ! m_root.removeAll(); ! for (int i=0; i<Math.min(m_recent.size(),m_recentCount); i++) ! { ! JMenuItem item = new JMenuItem(m_recent.elementAt(i).toString()); ! ActionRecent ar = new ActionRecent(); ! ar.Offset = i; ! item.addActionListener(ar); ! m_root.add(item); ! } ! m_root.addSeparator(); ! JMenuItem clear = new JMenuItem("Clear"); ! clear.addActionListener(new java.awt.event.ActionListener() { ! public void actionPerformed(java.awt.event.ActionEvent evt) { ! m_recent.removeAllElements(); ! buildMenu(); } ! }); ! m_root.add(clear); ! } ! ! public void add(String rec) ! { ! m_recent.remove(rec); ! m_recent.insertElementAt(rec, 0); ! while (m_recent.size()>m_recentCount) ! m_recent.remove(m_recent.size()-1); ! buildMenu(); ! } } --- NumericTextField.form DELETED --- --- NEW FILE: PropertyEditorDialog.java --- /* 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.util; import net.charabia.jsmoothgen.application.*; import net.charabia.jsmoothgen.application.gui.*; import java.util.*; import com.l2fprod.common.swing.*; import javax.swing.*; import java.awt.*; /** * * @author Rodrigo */ public class PropertyEditorDialog extends BaseDialog { private JavaPropertyPair m_prop; private JTextField m_key = new JTextField(); private JTextField m_value = new JTextField(); public PropertyEditorDialog(JavaPropertyPair prop) { super(); setTitle(Main.local("JAVAPROP_DIALOG_TITLE")); setModal(true); m_prop = prop; getContentPane().setLayout(new PanelLayout()); JLabel eq = new JLabel(" = "); eq.setHorizontalAlignment(JLabel.CENTER); OptionalHelpPanel keypane = new OptionalHelpPanel(); keypane.setLabel(Main.local("JAVAPROP_DIALOG_LABEL")); keypane.setHelpText(Main.local("JAVAPROP_DIALOG_HELP")); keypane.getContentPane().setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = GridBagConstraints.RELATIVE; c.gridy = GridBagConstraints.RELATIVE; c.gridwidth = 1; // GridBagConstraints.RELATIVE; c.weightx = 0.5; keypane.getContentPane().add(new JLabel(Main.local("JAVAPROP_NAME")), c); c.weightx = 0.1; keypane.getContentPane().add(new JLabel(""), c); c.weightx = 0.5; c.gridwidth = GridBagConstraints.REMAINDER; keypane.getContentPane().add(new JLabel(Main.local("JAVAPROP_VALUE")), c); c.gridwidth = 1; // GridBagConstraints.RELATIVE; c.weightx = 0.5; keypane.getContentPane().add(m_key, c); c.weightx = 0.1; keypane.getContentPane().add(eq, c); c.weightx = 0.5; keypane.getContentPane().add(m_value, c); getContentPane().add(keypane); getBanner().setVisible(false); setResizable(false); pack(); m_key.setText(m_prop.getName()); m_value.setText(m_prop.getValue()); } public Dimension getMinimumSize() { return new Dimension(400,250); } public Dimension getPreferredSize() { return new Dimension(400,250); } public void ok() { m_prop.setName(m_key.getText()); m_prop.setValue(m_value.getText()); super.ok(); } } --- NEW FILE: RegExDocument.java --- /* 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.util; import java.util.*; import javax.swing.text.*; import java.text.*; import java.util.regex.*; public class RegExDocument extends PlainDocument { private java.util.regex.Pattern m_pattern; public RegExDocument(String pattern) { m_pattern = java.util.regex.Pattern.compile(pattern); } public void insertString(int offset, String string, AttributeSet attributes) throws BadLocationException { if (string == null) return; String result; int length = getLength(); if (length == 0) { result = string; } else { String currentContent = getText(0, length); StringBuffer currentBuffer = new StringBuffer(currentContent); currentBuffer.insert(offset, string); result = currentBuffer.toString(); } java.util.regex.Matcher m = m_pattern.matcher(result); if (m.matches()) { super.insertString(offset, string, attributes); } java.awt.Toolkit.getDefaultToolkit().beep(); } } --- NEW FILE: OptionalHelpPanel.java --- /* 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.util; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import java.io.*; import com.l2fprod.common.swing.*; /** * Represents a JTextField associated with a button that pops up a * file dialog selector. * */ public class OptionalHelpPanel extends JPanel { private JPanel m_panel = new JPanel(); protected boolean m_limitHeight = true; private HTMLPane m_helpPanel = new HTMLPane() { public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); if (OptionalHelpPanel.this.m_limitHeight) { if (d.height>180) d.height = 180; } return d; } }; private JPanel m_titlePanel = new JPanel(); private JLabel m_title = new JLabel(); private JButton m_helptoggle = new JButton("?"); private boolean m_helpActive = false; public OptionalHelpPanel() { setLayout(new GridBagLayout()); m_helptoggle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { m_helpActive = !m_helpActive; toggleHelpCheck(); } }); setLayout(new PanelLayout()); m_titlePanel.setLayout(new BorderLayout()); m_titlePanel.add(BorderLayout.CENTER, m_title); m_titlePanel.add(BorderLayout.EAST, m_helptoggle); m_titlePanel.setOpaque(true); m_helptoggle.setOpaque(false); m_helptoggle.setBorder(null); m_title.setBorder(BorderFactory.createEmptyBorder(2,10,2,2)); add(m_titlePanel); add(m_panel); add(m_helpPanel); setBorder(BorderFactory.createCompoundBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2,2,2,2), BorderFactory.createBevelBorder(BevelBorder.RAISED)), BorderFactory.createEmptyBorder(2,2,2,2))); java.net.URL helpimgurl = getClass().getResource("/icons/stock_help-agent.png"); if (helpimgurl != null) { javax.swing.ImageIcon leaf = new javax.swing.ImageIcon(helpimgurl); m_helptoggle.setIcon(leaf); m_helptoggle.setText(""); } else { m_helptoggle.setText("(?)"); } setLabelColor(Color.white, Color.darkGray); toggleHelpCheck(); } private void toggleHelpCheck() { m_helpPanel.setVisible(m_helpActive); validate(); repaint(); } public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.width = 1; return d; } public JPanel getContentPane() { return m_panel; } public void setLabel(String label) { label = "<html><b>" + label + "</b></hmtl>"; m_title.setText(label); } public void setHelpText(String help) { m_helpPanel.setText(help); } public void setLabelColor(Color fore, Color back) { m_titlePanel.setBackground(back); m_title.setForeground(fore); repaint(); } public void setLimitHeight(boolean b) { m_limitHeight = b; validate(); repaint(); } public static void main(String[] args) { JFrame f = new JFrame("test"); OptionalHelpPanel ohp = new OptionalHelpPanel(); ohp.setHelpText("This is my help text"); ohp.setLabel("My label1"); ohp.getContentPane().setLayout(new BorderLayout()); // ohp.getContentPane().add(BorderLayout.CENTER, new JScrollPane(new JTextArea(40,40))); ohp.getContentPane().add(BorderLayout.CENTER, new FileSelectionTextField()); OptionalHelpPanel ohp2 = new OptionalHelpPanel(); ohp.setLabel("hop2"); ohp2.setHelpText("<html><h1>This is my second help text</h1>le géant du logiciel va-t-il écouter et arrêter le déluge promotionel qui vise à faire connaitre les nouveautés de Office 2003 alors que les utilisateurs sont satisfaits des versions précédentes et que les responsables zieutent lourdement du coté de Linux et d'OpenOffice ?"); ohp2.getContentPane().setLayout(new BorderLayout()); ohp2.getContentPane().add(BorderLayout.CENTER, new JTextField()); f.getContentPane().setLayout(new PanelLayout()); f.getContentPane().add(ohp); f.getContentPane().add(ohp2); f.setSize(300,300); f.show(); } } --- NEW FILE: PanelLayout.java --- /* 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.util; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.util.*; public class PanelLayout implements LayoutManager { private Dimension m_minimumSize; private Hashtable m_componentToLayoutLengthDescriptor = new Hashtable(); public PanelLayout() { } public void addLayoutComponent(String name, Component comp) { LayoutLengthDescriptor ld = new LayoutLengthDescriptor(name); m_componentToLayoutLengthDescriptor.put(comp, ld); } public void removeLayoutComponent(Component comp) { m_componentToLayoutLengthDescriptor.remove(comp); } private void calculateMinimumSize(Container parent) { m_minimumSize = new Dimension(); for (int i = 0; i < parent.getComponentCount(); i++) { Component element = parent.getComponent(i); if (element.isVisible()) { Dimension eld = element.getPreferredSize(); LayoutLengthDescriptor ld = (LayoutLengthDescriptor)m_componentToLayoutLengthDescriptor.get(element); if (ld != null) eld.height = ld.getLength(parent.getHeight()); m_minimumSize.height += eld.height; m_minimumSize.width = Math.max(m_minimumSize.width, eld.width); } } } public Dimension preferredLayoutSize(Container parent) { return minimumLayoutSize(parent); } /* Required by LayoutManager. */ public Dimension minimumLayoutSize(Container parent) { // if (m_minimumSize == null) calculateMinimumSize(parent); Dimension dim = new Dimension(m_minimumSize); //Always add the container's insets! Insets insets = parent.getInsets(); dim.width += insets.left + insets.right; dim.height += insets.top + insets.bottom; return dim; } public void layoutContainer(Container parent) { Insets insets = parent.getInsets(); int xoffset = insets.left; int yoffset = insets.top; int maxcwidth = parent.getWidth()-(insets.right+insets.left); int maxcheight = parent.getHeight()-insets.bottom; for (int i = 0; i < parent.getComponentCount(); i++) { Component element = parent.getComponent(i); if (element.isVisible()) { Dimension eld = element.getPreferredSize(); LayoutLengthDescriptor ld = (LayoutLengthDescriptor)m_componentToLayoutLengthDescriptor.get(element); if (ld != null) eld.height = ld.getLength(parent.getHeight()); if ((eld.height + yoffset) > maxcheight) eld.height = maxcheight - yoffset; element.setBounds(xoffset, yoffset, maxcwidth, eld.height); yoffset += eld.height; } } } // public void layoutContainer(Container parent) { // Insets insets = parent.getInsets(); // int maxWidth = parent.getWidth() - (insets.left + insets.right); // int maxHeight = parent.getHeight() - (insets.top + insets.bottom); // int nComps = parent.getComponentCount(); // int previousWidth = 0, previousHeight = 0; // int x = 0, y = insets.top; // int rowh = 0, start = 0; // int xFudge = 0, yFudge = 0; // boolean oneColumn = false; // // Go through the components' sizes, if neither // // preferredLayoutSize nor minimumLayoutSize has // // been called. // if (sizeUnknown) { // setSizes(parent); // } // if (maxWidth <= minWidth) { // oneColumn = true; // } // if (maxWidth != preferredWidth) { // xFudge = (maxWidth - preferredWidth)/(nComps - 1); // } // if (maxHeight > preferredHeight) { // yFudge = (maxHeight - preferredHeight)/(nComps - 1); // } // for (int i = 0 ; i < nComps ; i++) { // Component c = parent.getComponent(i); // if (c.isVisible()) { // Dimension d = c.getPreferredSize(); // // increase x and y, if appropriate // if (i > 0) { // if (!oneColumn) { // x += previousWidth/2 + xFudge; // } // y += previousHeight + vgap + yFudge; // } // // If x is too large, // if ((!oneColumn) && // (x + d.width) > // (parent.getWidth() - insets.right)) { // // reduce x to a reasonable number. // x = parent.getWidth() // - insets.bottom - d.width; // } // // If y is too large, // if ((y + d.height) // > (parent.getHeight() - insets.bottom)) { // // do nothing. // // Another choice would be to do what we do to x. // } // // Set the component's size and position. // c.setBounds(x, y, d.width, d.height); // previousWidth = d.width; // previousHeight = d.height; // } // } // } } --- NEW FILE: LayoutLengthDescriptor.java --- /* 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.util; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.util.*; public class LayoutLengthDescriptor { public static final int PIXEL = 1; public static final int PERCENT = 2; private int m_length; private int m_unit; public LayoutLengthDescriptor(String s) { try { s = s.trim(); StringBuffer len = new StringBuffer(); StringBuffer unit = new StringBuffer(); int offset = 0; for (; offset < s.length(); offset++) { char c = s.charAt(offset); if (Character.isDigit(c) == false) break; len.append(c); } for (; offset < s.length(); offset++) { char c = s.charAt(offset); if (Character.isWhitespace(c) == false) break; } for (; offset < s.length(); offset++) { char c = s.charAt(offset); unit.append(c); } System.out.println("len: " + len); System.out.println("unit: " + unit); m_length = Integer.parseInt(len.toString()); String sunit = unit.toString(); if (sunit.equals("px")) m_unit = PIXEL; else if (sunit.equals("%")) m_unit = PERCENT; } catch (Exception exc) { throw new RuntimeException("Error parsing " + s); } } public int getLength(int totalLength) { if (m_unit == PIXEL) return m_length; if (totalLength == 0) return 0; return (totalLength * 100) / totalLength; } } --- NumericTextField.java DELETED --- --- NEW FILE: CompilationDialog.java --- /* 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.util; import net.charabia.jsmoothgen.application.*; import java.util.*; /** * * @author Rodrigo */ public class CompilationDialog extends javax.swing.JDialog implements ExeCompiler.StepListener { private ExeCompiler m_compiler; private boolean m_result = false; private boolean m_canceled = false; /** Creates new form CompilationDialog */ public CompilationDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } /** 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. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; jLabel1 = new javax.swing.JLabel(); m_progress = new javax.swing.JProgressBar(); jScrollPane1 = new javax.swing.JScrollPane(); m_state = new javax.swing.JTextArea(10,60); m_state.setLineWrap(true); m_cancelbutton = new javax.swing.JButton(); getContentPane().setLayout(new java.awt.GridBagLayout()); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Progress"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; getContentPane().add(jLabel1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(5, 20, 5, 20); getContentPane().add(m_progress, gridBagConstraints); // jScrollPane1.setBorder(new javax.swing.border.TitledBorder("Compilation Information")); // m_state.setBackground((java.awt.Color) javax.swing.UIManager.getDefaults().get("Button.background")); // m_state.setBorder(null); m_state.setEditable(false); jScrollPane1.setViewportView(m_state); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 10, 5, 10); getContentPane().add(jScrollPane1, gridBagConstraints); m_cancelbutton.setText("Cancel"); m_cancelbutton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelbuttonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10); gridBagConstraints.weighty = 0.0001; gridBagConstraints.fill = java.awt.GridBagConstraints.NONE; getContentPane().add(m_cancelbutton, gridBagConstraints); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width-319)/2, (screenSize.height-158)/2, 319, 158); }//GEN-END:initComponents private void cancelbuttonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cancelbuttonActionPerformed {//GEN-HEADEREND:event_cancelbuttonActionPerformed // Add your handling code here: m_result = false; m_canceled = true; dispose(); }//GEN-LAST:event_cancelbuttonActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog { setVisible(false); dispose(); }//GEN-LAST:event_closeDialog public void setCompiler(ExeCompiler comp) { m_compiler = comp; comp.addListener(this); m_progress.setMaximum(100); m_progress.setMinimum(0); m_state.setText(""); } public void compile(Runnable r) { Thread t = new Thread(r); t.start(); setModal(true); show(); } /** * @param args the command line arguments */ public static void main(String args[]) { new CompilationDialog(new javax.swing.JFrame(), true).show(); } public void complete() { if (!m_canceled) { m_result = true; setNewState(100, "Done"); m_cancelbutton.setText("Done"); m_cancelbutton.grabFocus(); } } public void failed() { if (!m_canceled) { m_result = false; StringBuffer buf = new StringBuffer(); buf.append("Compilation failed!\n"); Vector v = m_compiler.getErrors(); for (int i=0; i<v.size(); i++) { buf.append("\n- "); buf.append(v.get(i).toString()); } buf.append("\n"); setNewState(100, buf.toString()); } } public void setNewState(int percentComplete, String state) { m_progress.setValue(percentComplete); m_state.append(state+"\n"); } public boolean getResult() { return m_result; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JButton m_cancelbutton; private javax.swing.JProgressBar m_progress; private javax.swing.JTextArea m_state; // End of variables declaration//GEN-END:variables } |
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29016 Modified Files: AboutBox.java MainFrame.java Splash.java Added Files: Editor.java EditorPool.java Main.java MasterPanel.java Removed Files: AboutBox.form CompilationDialog.form CompilationDialog.java Executable.form Executable.java JVMConfigurationPanel.form JVMConfigurationPanel.java JVMSelectionPanel.form JVMSelectionPanel.java JavaApp.form JavaApp.java MainController.java MainFrame.form ModelUpdater.java SkeletonChooser.form SkeletonChooser.java SkeletonPropertiesPanel.form SkeletonPropertiesPanel.java StaticWizard.form StaticWizard.java UserInteractionPanel.form UserInteractionPanel.java Log Message: new swing GUI update --- NEW FILE: Editor.java --- /* 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; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.io.File; import com.l2fprod.common.swing.*; import net.charabia.jsmoothgen.application.*; public abstract class Editor extends JPanel { protected JSmoothModelBean m_model; protected java.io.File m_basedir; public void attach(JSmoothModelBean model, java.io.File basedir) { m_model = model; m_basedir = basedir; } public void detach() { m_model = null; m_basedir = null; } protected JSmoothModelBean getModel() { return m_model; } protected java.io.File getBaseDir() { return m_basedir; } abstract public void dataChanged(); abstract public void updateModel(); abstract public String getLabel(); abstract public String getDescription(); protected java.io.File getAbsolutePath(java.io.File f) { if (f.isAbsolute()) return f; return new java.io.File(m_basedir.getAbsoluteFile(), f.toString()); } } --- AboutBox.form DELETED --- --- StaticWizard.form DELETED --- --- SkeletonPropertiesPanel.java DELETED --- --- MainController.java DELETED --- --- JVMConfigurationPanel.form DELETED --- --- JVMConfigurationPanel.java DELETED --- --- MainFrame.form DELETED --- --- ModelUpdater.java DELETED --- --- CompilationDialog.form DELETED --- Index: Splash.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/Splash.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Splash.java 12 Sep 2003 21:31:52 -0000 1.1 --- Splash.java 16 Mar 2004 08:05:15 -0000 1.2 *************** *** 61,72 **** } - public class Closer extends MouseAdapter - { - public void mouseClicked(MouseEvent e) - { - // Splash.this.m_window.dispose(); - } - } - public Splash(Frame parent, String imagefilename, boolean dialog) { --- 61,64 ---- *************** *** 74,83 **** { m_window = new MyDialog(parent); - m_window.addMouseListener(new Closer()); } else { m_window = new MyWindow(parent); - m_window.addMouseListener(new Closer()); } javax.swing.ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource(imagefilename)); --- 66,73 ---- --- UserInteractionPanel.form DELETED --- Index: MainFrame.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/MainFrame.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** MainFrame.java 23 Nov 2003 18:34:24 -0000 1.26 --- MainFrame.java 16 Mar 2004 08:05:15 -0000 1.27 *************** *** 21,741 **** package net.charabia.jsmoothgen.application.gui; - import net.charabia.jsmoothgen.application.*; - import net.charabia.jsmoothgen.application.gui.util.*; - import net.charabia.jsmoothgen.skeleton.*; - import java.io.*; - import java.util.*; - import javax.swing.*; - import java.util.prefs.*; - import java.awt.*; ! public class MainFrame extends javax.swing.JFrame implements MainController { - private StaticWizard m_wizard; - private SkeletonList m_skelList; - private File m_projectFile = null; - - final static public String VERSION = "@{VERSION}@"; - final static public String RELEASEINFO = "@{RELEASEINFO}@"; - private RecentFileMenu m_recentMenuManager; - /** Creates new form MainFrame */ - public MainFrame() - { - super(); - - Splash splash = new Splash(this, "/icons/splash.png", false); - splash.setVersion(VERSION); - splash.show(); - m_skelList = new SkeletonList(new File("skeletons")); - - initComponents(); - m_recentMenuManager = new RecentFileMenu(m_recentMenu, 5, - MainFrame.class, - new RecentFileMenu.Action() { - public void action(String path) - { - openDirect(new File(path)); - } - }); - - m_wizard = new StaticWizard(); - m_wizard.setMainController(this); - m_centralPane.add(m_wizard); - - m_projectFileChooser.addChoosableFileFilter(new SimpleFileFilter("jsmooth", "JSmooth Project Files")); - - loadWindowSettings(); - show(); - - splash.dispose(); - } - - /** 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. - */ - private void initComponents()//GEN-BEGIN:initComponents - { - javax.swing.JMenu jMenu1; - - m_projectFileChooser = new javax.swing.JFileChooser(); - jToolBar1 = new javax.swing.JToolBar(); - m_buttonNew = new javax.swing.JButton(); - m_buttonOpen = new javax.swing.JButton(); - m_buttonSave = new javax.swing.JButton(); - m_buttonSaveAs = new javax.swing.JButton(); - jSeparator4 = new javax.swing.JSeparator(); - m_buttonCompile = new javax.swing.JButton(); - m_buttonRunExe = new javax.swing.JButton(); - jSeparator5 = new javax.swing.JSeparator(); - jButton1 = new javax.swing.JButton(); - jSeparator6 = new javax.swing.JSeparator(); - jSeparator7 = new javax.swing.JSeparator(); - jSeparator8 = new javax.swing.JSeparator(); - jPanel1 = new javax.swing.JPanel(); - jSeparator1 = new javax.swing.JSeparator(); - jTextField1 = new javax.swing.JTextField(); - m_centralPane = new javax.swing.JPanel(); - jMenuBar1 = new javax.swing.JMenuBar(); - jMenu1 = new javax.swing.JMenu(); - m_menuNew = new javax.swing.JMenuItem(); - jSeparator2 = new javax.swing.JSeparator(); - m_menuLoad = new javax.swing.JMenuItem(); - m_menuSave = new javax.swing.JMenuItem(); - m_menuSaveAs = new javax.swing.JMenuItem(); - jSeparator3 = new javax.swing.JSeparator(); - m_recentMenu = new javax.swing.JMenu(); - jSeparator9 = new javax.swing.JSeparator(); - m_menuExit = new javax.swing.JMenuItem(); - m_menuProject = new javax.swing.JMenu(); - m_menuCompile = new javax.swing.JMenuItem(); - m_menuRunExe = new javax.swing.JMenuItem(); - jMenu2 = new javax.swing.JMenu(); - m_menuAbout = new javax.swing.JMenuItem(); - - setTitle("JSmooth " + VERSION); - addWindowListener(new java.awt.event.WindowAdapter() - { - public void windowClosing(java.awt.event.WindowEvent evt) - { - exitForm(evt); - } - }); - - m_buttonNew.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_new.png"))); - m_buttonNew.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - buttonNewActionPerformed(evt); - } - }); - - jToolBar1.add(m_buttonNew); - - m_buttonOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_open.png"))); - m_buttonOpen.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - buttonOpenActionPerformed(evt); - } - }); - - jToolBar1.add(m_buttonOpen); - - m_buttonSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_save.png"))); - m_buttonSave.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - buttonSaveActionPerformed(evt); - } - }); - - jToolBar1.add(m_buttonSave); - - m_buttonSaveAs.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_save_as.png"))); - m_buttonSaveAs.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - buttonSaveAsActionPerformed(evt); - } - }); - - jToolBar1.add(m_buttonSaveAs); - - jToolBar1.add(jSeparator4); - - m_buttonCompile.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_autopilot-24.png"))); - m_buttonCompile.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - buttonCompileActionPerformed(evt); - } - }); - - jToolBar1.add(m_buttonCompile); - - m_buttonRunExe.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_next.png"))); - m_buttonRunExe.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - buttonRunExeActionPerformed(evt); - } - }); - - jToolBar1.add(m_buttonRunExe); - - jToolBar1.add(jSeparator5); - - jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_about.png"))); - jButton1.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - menuAboutActionPerformed(evt); - } - }); - - jToolBar1.add(jButton1); - - jToolBar1.add(jSeparator6); - - jToolBar1.add(jSeparator7); - - jToolBar1.add(jSeparator8); - - getContentPane().add(jToolBar1, java.awt.BorderLayout.NORTH); - - jPanel1.setLayout(new java.awt.BorderLayout()); - - jSeparator1.setBorder(new javax.swing.border.CompoundBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(5, 1, 2, 1)), new javax.swing.border.EtchedBorder())); - jPanel1.add(jSeparator1, java.awt.BorderLayout.NORTH); - - jTextField1.setEditable(false); - jTextField1.setHorizontalAlignment(javax.swing.JTextField.LEFT); - jTextField1.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(1, 1, 1, 1))); - jTextField1.setFocusable(false); - jPanel1.add(jTextField1, java.awt.BorderLayout.CENTER); - - getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH); - - m_centralPane.setLayout(new java.awt.GridLayout(1, 1)); - - getContentPane().add(m_centralPane, java.awt.BorderLayout.CENTER); - - jMenu1.setText("File"); - m_menuNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); - m_menuNew.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_new-16.png"))); - m_menuNew.setText("New"); - m_menuNew.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - menuNewActionPerformed(evt); - } - }); - - jMenu1.add(m_menuNew); - - jMenu1.add(jSeparator2); - - m_menuLoad.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK)); - m_menuLoad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_open-16.png"))); - m_menuLoad.setText("Open project..."); - m_menuLoad.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - menuLoadActionPerformed(evt); - } - }); - - jMenu1.add(m_menuLoad); - - m_menuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); - m_menuSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_save-16.png"))); - m_menuSave.setText("Save"); - m_menuSave.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - menuSaveActionPerformed(evt); - } - }); - - jMenu1.add(m_menuSave); - - m_menuSaveAs.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_save_as-16.png"))); - m_menuSaveAs.setText("Save as..."); - m_menuSaveAs.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - menuSaveAsActionPerformed(evt); - } - }); - - jMenu1.add(m_menuSaveAs); - - jMenu1.add(jSeparator3); - - m_recentMenu.setText("Recent Files"); - jMenu1.add(m_recentMenu); - - jMenu1.add(jSeparator9); - - m_menuExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_exit-16.png"))); - m_menuExit.setText("Exit"); - m_menuExit.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - menuExitActionPerformed(evt); - } - }); - - jMenu1.add(m_menuExit); - - jMenuBar1.add(jMenu1); - - m_menuProject.setText("Project"); - m_menuCompile.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_autopilot-16.png"))); - m_menuCompile.setText("Create Exe"); - m_menuCompile.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - menuCompileActionPerformed(evt); - } - }); - - m_menuProject.add(m_menuCompile); - - m_menuRunExe.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_next-16.png"))); - m_menuRunExe.setText("Run Exe"); - m_menuRunExe.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - menuRunExeActionPerformed(evt); - } - }); - - m_menuProject.add(m_menuRunExe); - - jMenuBar1.add(m_menuProject); - - jMenu2.setText("Help"); - m_menuAbout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stock_about-16.png"))); - m_menuAbout.setText("About"); - m_menuAbout.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent evt) - { - menuAboutActionPerformed(evt); - } - }); - - jMenu2.add(m_menuAbout); - - jMenuBar1.add(jMenu2); - - setJMenuBar(jMenuBar1); - - java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); - setBounds((screenSize.width-578)/2, (screenSize.height-462)/2, 578, 462); - }//GEN-END:initComponents - - private void menuExitActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_menuExitActionPerformed - {//GEN-HEADEREND:event_menuExitActionPerformed - // Add your handling code here: - exitForm(null); - }//GEN-LAST:event_menuExitActionPerformed - - private void buttonNewActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_buttonNewActionPerformed - {//GEN-HEADEREND:event_buttonNewActionPerformed - // Add your handling code here: - JSmoothModelBean model = new JSmoothModelBean(); - setTitle("JSmooth " + VERSION + ": New project"); - m_wizard.setModel(null, model); - m_projectFile = null; - }//GEN-LAST:event_buttonNewActionPerformed - - private void buttonRunExeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_buttonRunExeActionPerformed - {//GEN-HEADEREND:event_buttonRunExeActionPerformed - // Add your handling code here: - runexe(); - }//GEN-LAST:event_buttonRunExeActionPerformed - - private void menuRunExeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_menuRunExeActionPerformed - {//GEN-HEADEREND:event_menuRunExeActionPerformed - // Add your handling code here: - runexe(); - }//GEN-LAST:event_menuRunExeActionPerformed - - private void menuCompileActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_menuCompileActionPerformed - {//GEN-HEADEREND:event_menuCompileActionPerformed - // Add your handling code here: - compile(); - }//GEN-LAST:event_menuCompileActionPerformed - - private void menuAboutActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_menuAboutActionPerformed - {//GEN-HEADEREND:event_menuAboutActionPerformed - // Add your handling code here: - AboutBox ab = new AboutBox(this, true); - ab.setVersion(VERSION + " (" + RELEASEINFO + ")"); - ab.show(); - }//GEN-LAST:event_menuAboutActionPerformed - - private void buttonSaveAsActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_buttonSaveAsActionPerformed - {//GEN-HEADEREND:event_buttonSaveAsActionPerformed - // Add your handling code here: - save(true); - }//GEN-LAST:event_buttonSaveAsActionPerformed - - private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_buttonSaveActionPerformed - {//GEN-HEADEREND:event_buttonSaveActionPerformed - // Add your handling code here: - save(false); - }//GEN-LAST:event_buttonSaveActionPerformed - - private void buttonOpenActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_buttonOpenActionPerformed - {//GEN-HEADEREND:event_buttonOpenActionPerformed - // Add your handling code here: - open(); - }//GEN-LAST:event_buttonOpenActionPerformed - - private void buttonCompileActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_buttonCompileActionPerformed - {//GEN-HEADEREND:event_buttonCompileActionPerformed - // Add your handling code here: - compile(); - }//GEN-LAST:event_buttonCompileActionPerformed - - - public boolean compile() - { - m_wizard.updateModel(); - - if (m_projectFile == null) - { - JOptionPane.showMessageDialog(this, "Save the project first!"); - return false; - } - - m_wizard.getModel().normalizePaths(m_projectFile.getParentFile()); - - JSmoothModelBean model = m_wizard.getModel(); - if (model.getSkeletonName() == null) - { - String msg = "The skeleton is not specified!"; - JOptionPane.showMessageDialog(this, msg); - return false; - } - SkeletonBean skel = m_skelList.getSkeleton(model.getSkeletonName()); - if (skel == null) - { - String msg = "The skeleton is not registered!"; - JOptionPane.showMessageDialog(this, msg); - return false; - } - File skelroot = m_skelList.getDirectory(skel); - File basedir = m_projectFile.getParentFile(); - File exedir = basedir; - - try - { - File out = null; - if (new File(model.getExecutableName()).isAbsolute() == false) - out = new File(exedir, model.getExecutableName()); - else - out = new File(model.getExecutableName()); - - System.out.println("out = "+ out.getAbsolutePath()); - ExeCompiler compiler = new ExeCompiler(); - ExeCompiler.CompilerRunner runner = compiler.getRunnable(skelroot, skel, basedir, model, out); - - CompilationDialog dia = new CompilationDialog(this, true); - dia.setCompiler(compiler); - dia.compile(runner); - System.out.println("FINISH !!"); - return dia.getResult(); - - // boolean res = compiler.compile(skelroot, skel, model, out); - // compiler.compileAsync(skelroot, skel, model, out); - // if (res == false) - // { - // String msg = "<html>There are errors in the compilation process:<p><ol>"; - // Vector errs = compiler.getErrors(); - // for (Iterator i=errs.iterator(); i.hasNext(); ) - // { - // msg += "<li>" + i.next().toString() + "<br>"; - // } - // msg += "</ol></html>"; - // JOptionPane.showMessageDialog(this, msg); - // return false; - // } - } catch (Exception exc) - { - String msg = "Not all the parameters have been specified.\nCompilation aborted."; - JOptionPane.showMessageDialog(this, msg); - return false; - } - } - - public void runexe() - { - m_wizard.updateModel(); - JSmoothModelBean model = m_wizard.getModel(); - - try - { - File basedir = m_projectFile.getParentFile(); - File f = new File(basedir, model.getExecutableName()); - String[] cmd = new String[]{ - f.getAbsolutePath() - }; - - System.out.println("RUNNING " + cmd[0] + " @ " + basedir); - - CommandRunner.run(cmd, f.getParentFile()); - - } catch (Exception exc) - { - //exc.printStackTrace(); - } - } - - private void menuLoadActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_menuLoadActionPerformed - {//GEN-HEADEREND:event_menuLoadActionPerformed - // Add your handling code here: - open(); - }//GEN-LAST:event_menuLoadActionPerformed - - private void menuSaveActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_menuSaveActionPerformed - {//GEN-HEADEREND:event_menuSaveActionPerformed - // Add your handling code here: - save(false); - }//GEN-LAST:event_menuSaveActionPerformed - - private void menuSaveAsActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_menuSaveAsActionPerformed - {//GEN-HEADEREND:event_menuSaveAsActionPerformed - // Add your handling code here: - save(true); - }//GEN-LAST:event_menuSaveAsActionPerformed - - private String getSuffix(java.io.File f) - { - String fstr = f.getAbsolutePath(); - int lastDot = fstr.lastIndexOf('.'); - if ((lastDot >= 0) && ((lastDot+1) < fstr.length())) - { - return fstr.substring(lastDot+1); - } - return ""; - } - public void open() - { - if (m_projectFileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) - { - if (openDirect(m_projectFileChooser.getSelectedFile())) - m_recentMenuManager.add(m_projectFileChooser.getSelectedFile().getAbsolutePath()); - } - } - - public boolean openDirect(File path) - { - this.setTitle("JSmooth " + VERSION + ": " + path.toString()); - m_projectFile = path; - try - { - JSmoothModelBean model = JSmoothModelPersistency.load(m_projectFile); - File basedir = m_projectFile.getParentFile(); - m_wizard.setModel(basedir, model); - return true; - } catch (IOException iox) - { - iox.printStackTrace(); - return false; - } - } - - public void save(boolean forceNewFile) - { - m_wizard.updateModel(); - - if (forceNewFile || (m_projectFile == null)) - { - if (m_projectFileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) - { - if (m_projectFile != null) - m_wizard.getModel().normalizePaths(m_projectFile.getParentFile(), false); - - m_projectFile = m_projectFileChooser.getSelectedFile(); - String suf = getSuffix(m_projectFile); - if ("jsmooth".equalsIgnoreCase(suf) == false) - { - m_projectFile = new File(m_projectFile.toString() + ".jsmooth"); - } - - m_wizard.getModel().normalizePaths(m_projectFile.getParentFile(), true); - } - else - { - return; - } - this.setTitle("JSmooth " +VERSION + ": " + m_projectFile.toString()); - } - try - { - String[]res = m_wizard.getModel().normalizePaths(m_projectFile.getParentFile()); - - Preferences prefs = Preferences.systemNodeForPackage(this.getClass()); - String prefname = "filesNotRelativeWarningDontDisplay"; - if ((res != null) && (prefs.getBoolean(prefname, false) == false)) - { - WarningNotRelativeFilesDialog wnrfd = new WarningNotRelativeFilesDialog(this, true); - wnrfd.setErrors(res); - wnrfd.show(); - - if (wnrfd.dontDisplayAnymore() == true) - { - prefs.putBoolean(prefname, true); - } - } - - JSmoothModelPersistency.save(m_projectFile, m_wizard.getModel()); - } catch (IOException iox) - { - iox.printStackTrace(); - } - - JSmoothModelBean model = m_wizard.getModel(); - File basedir = m_projectFile.getParentFile(); - m_wizard.setModel(basedir, model); - - m_recentMenuManager.add(m_projectFile.getAbsolutePath()); - } - - private void menuNewActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_menuNewActionPerformed - {//GEN-HEADEREND:event_menuNewActionPerformed - // Add your handling code here: - JSmoothModelBean model = new JSmoothModelBean(); - m_wizard.setModel(null, model); - m_projectFile = null; - }//GEN-LAST:event_menuNewActionPerformed - - /** Exit the Application */ - private void exitForm(java.awt.event.WindowEvent evt)//GEN-FIRST:event_exitForm - { - m_recentMenuManager.savePrefs(); - saveWindowSettings(); - System.exit(0); - }//GEN-LAST:event_exitForm - - /** - * @param args the command line arguments - */ public static void main(String args[]) { ! try { ! UIManager.setLookAndFeel( ! UIManager.getSystemLookAndFeelClassName()); ! } catch (Exception e) { } ! ! new MainFrame().show(); ! } ! ! public void setStateText(String text) ! { ! } ! ! public SkeletonList getSkeletonList() ! { ! return m_skelList; ! } ! ! public void saveWindowSettings() ! { ! Preferences prefs = Preferences.systemNodeForPackage(this.getClass()); ! System.out.println("prefs: " + prefs); ! prefs.putInt("window-x", (int)this.getLocation().getX()); ! prefs.putInt("window-y", (int)this.getLocation().getY()); ! ! prefs.putInt("window-width", (int)this.getWidth()); ! prefs.putInt("window-height", (int)this.getHeight()); ! ! Rectangle r = this.getMaximizedBounds(); ! if (r != null) ! { ! prefs.putInt("window-maximized-x", (int)r.getX()); ! prefs.putInt("window-maximized-y", (int)r.getY()); ! prefs.putInt("window-maximized-width", (int)r.getWidth()); ! prefs.putInt("window-maximized-height", (int)r.getHeight()); ! } ! ! prefs.putInt("window-state", this.getExtendedState()); ! } ! ! public void loadWindowSettings() ! { ! Preferences prefs = Preferences.systemNodeForPackage(this.getClass()); ! ! this.setExtendedState(prefs.getInt("window-state", Frame.NORMAL)); ! ! if (prefs.getInt("window-x", -1) > 0) ! { ! this.setLocation(prefs.getInt("window-x", 10), prefs.getInt("window-y", 10)); ! this.setSize(prefs.getInt("window-width", 500), prefs.getInt("window-height", 400)); ! ! if (prefs.getInt("window-maximized-x", -1) > 0) ! { ! Rectangle maxb = new Rectangle(); ! maxb.setLocation(prefs.getInt("window-maximized-x", 10), prefs.getInt("window-maximized-y", 10)); ! maxb.setSize(prefs.getInt("window-maximized-width", 500), prefs.getInt("window-maximized-height", 400)); ! } ! } } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton jButton1; - private javax.swing.JMenu jMenu2; - private javax.swing.JMenuBar jMenuBar1; - private javax.swing.JPanel jPanel1; - private javax.swing.JSeparator jSeparator1; - private javax.swing.JSeparator jSeparator2; - private javax.swing.JSeparator jSeparator3; - private javax.swing.JSeparator jSeparator4; - private javax.swing.JSeparator jSeparator5; - private javax.swing.JSeparator jSeparator6; - private javax.swing.JSeparator jSeparator7; - private javax.swing.JSeparator jSeparator8; - private javax.swing.JSeparator jSeparator9; - private javax.swing.JTextField jTextField1; - private javax.swing.JToolBar jToolBar1; - private javax.swing.JButton m_buttonCompile; - private javax.swing.JButton m_buttonNew; - private javax.swing.JButton m_buttonOpen; - private javax.swing.JButton m_buttonRunExe; - private javax.swing.JButton m_buttonSave; - private javax.swing.JButton m_buttonSaveAs; - private javax.swing.JPanel m_centralPane; - private javax.swing.JMenuItem m_menuAbout; - private javax.swing.JMenuItem m_menuCompile; - private javax.swing.JMenuItem m_menuExit; - private javax.swing.JMenuItem m_menuLoad; - private javax.swing.JMenuItem m_menuNew; - private javax.swing.JMenu m_menuProject; - private javax.swing.JMenuItem m_menuRunExe; - private javax.swing.JMenuItem m_menuSave; - private javax.swing.JMenuItem m_menuSaveAs; - private javax.swing.JFileChooser m_projectFileChooser; - private javax.swing.JMenu m_recentMenu; - // End of variables declaration//GEN-END:variables - } --- 21,30 ---- package net.charabia.jsmoothgen.application.gui; ! public class MainFrame { public static void main(String args[]) { ! Main.main(args); } } Index: AboutBox.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/AboutBox.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AboutBox.java 24 Aug 2003 19:51:56 -0000 1.3 --- AboutBox.java 16 Mar 2004 08:05:15 -0000 1.4 *************** *** 1,6 **** /* ! * AboutBox.java ! * ! * Created on 10 août 2003, 00:52 */ --- 1,20 ---- /* ! 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. ! */ --- StaticWizard.java DELETED --- --- SkeletonChooser.form DELETED --- --- JVMSelectionPanel.form DELETED --- --- SkeletonChooser.java DELETED --- --- JVMSelectionPanel.java DELETED --- --- NEW FILE: MasterPanel.java --- /* 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; import net.charabia.jsmoothgen.application.*; import net.charabia.jsmoothgen.skeleton.*; import net.charabia.jsmoothgen.application.gui.util.*; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.io.File; import java.util.*; import com.l2fprod.common.swing.*; public class MasterPanel extends JPanel { private JButtonBar m_leftBar = new JButtonBar(JButtonBar.VERTICAL); private ButtonGroup m_leftGroup = new ButtonGroup(); private JPanel m_mainpanel = new JPanel(); private JScrollBar m_mainpanelVBar; // private ResourceBundle m_texts; private Vector m_displayedElements = new Vector(); private JSmoothModelBean m_model = new JSmoothModelBean(); private java.io.File m_modelLocation = null; private EditorPool m_edPool = new EditorPool(); private String m_currentPanelName = ""; private Class[] m_skelElements = { net.charabia.jsmoothgen.application.gui.editors.SkeletonChooser.class, net.charabia.jsmoothgen.application.gui.editors.SkeletonProperties.class }; private Class[] m_execElements = { net.charabia.jsmoothgen.application.gui.editors.ExecutableName.class , net.charabia.jsmoothgen.application.gui.editors.ExecutableIcon.class , net.charabia.jsmoothgen.application.gui.editors.CurrentDirectory.class }; private Class[] m_appElements = { net.charabia.jsmoothgen.application.gui.editors.MainClass.class, net.charabia.jsmoothgen.application.gui.editors.ApplicationArguments.class, net.charabia.jsmoothgen.application.gui.editors.EmbeddedJar.class, net.charabia.jsmoothgen.application.gui.editors.ClassPath.class }; private Class[] m_jvmSelElements = { net.charabia.jsmoothgen.application.gui.editors.MinVersion.class, net.charabia.jsmoothgen.application.gui.editors.MaxVersion.class, net.charabia.jsmoothgen.application.gui.editors.JVMBundle.class, net.charabia.jsmoothgen.application.gui.editors.JVMSearchSequence.class }; private Class[] m_jvmCfgElements = { net.charabia.jsmoothgen.application.gui.editors.MaxMemoryHeap.class, net.charabia.jsmoothgen.application.gui.editors.InitialMemoryHeap.class, net.charabia.jsmoothgen.application.gui.editors.JavaProperties.class }; public MasterPanel() { setLayout(new BorderLayout()); add(BorderLayout.WEST, new JScrollPane(m_leftBar)); JScrollPane scp = new JScrollPane(m_mainpanel); m_mainpanelVBar = scp.getVerticalScrollBar(); add(BorderLayout.CENTER, scp); scp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); PanelLayout pl = new PanelLayout(); m_mainpanel.setLayout(pl); addAction("Skeleton", "/icons/stock_new-template.png", m_skelElements); addAction("Executable", "/icons/stock_autopilot-24.png", m_execElements); addAction("Application", "/icons/stock_form-image-control.png", m_appElements); addAction("JVM Selection", "/icons/stock_search.png", m_jvmSelElements); addAction("JVM Configuration", "/icons/stock_form-properties.png", m_jvmCfgElements); // m_texts = PropertyResourceBundle.getBundle("locale.Texts"); } private String getLocaleText(String key) { try { String value = Main.TEXTS.getString(key); return value; } catch (Exception exc) { } return key; } private void addAction(final String name, String iconloc, final Class[] els) { final Action a = new AbstractAction( name, new ImageIcon(getClass().getResource(iconloc))) { public void actionPerformed(ActionEvent e) { if (m_currentPanelName.equals(name)) return; setupPanel(els); m_currentPanelName = name; } }; JToggleButton jtb = new JToggleButton(a); m_leftGroup.add(jtb); m_leftBar.add(jtb); } public void setupPanel(Class[] els) { fireUpdateModel(); detachAll(); m_mainpanel.removeAll(); m_displayedElements.removeAllElements(); System.out.println("Adding " + els); if (els == null) return; for (int i=0; i<els.length; i++) { try { // Editor ed = (Editor)els[i].newInstance(); Editor ed = m_edPool.getInstance(els[i]); OptionalHelpPanel help = new OptionalHelpPanel(); help.getContentPane().setLayout(new BorderLayout()); help.getContentPane().add(BorderLayout.CENTER, ed); help.setLabel(getLocaleText(ed.getLabel())); help.setHelpText(getLocaleText(ed.getDescription())); m_mainpanel.add(help); m_displayedElements.add(ed); } catch (Exception exc) { exc.printStackTrace(); } } m_mainpanelVBar.setValue(0); attachAll(); validate(); repaint(); } public void fireUpdateModel() { for (Iterator i=m_displayedElements.iterator(); i.hasNext(); ) { Editor ed = (Editor)i.next(); ed.updateModel(); } } public void fireModelChanged() { for (Iterator i=m_displayedElements.iterator(); i.hasNext(); ) { Editor ed = (Editor)i.next(); ed.dataChanged(); } } private void detachAll() { for (Iterator i=m_displayedElements.iterator(); i.hasNext(); ) { Editor ed = (Editor)i.next(); if (ed instanceof JSmoothModelBean.Listener) m_model.removeListener((JSmoothModelBean.Listener)ed); if (ed instanceof JSmoothModelBean.SkeletonChangedListener) m_model.removeSkeletonChangedListener((JSmoothModelBean.SkeletonChangedListener)ed); ed.detach(); } } private void attachAll() { System.out.println("Attaching all with " + m_modelLocation + ": " + m_model); for (Iterator i=m_displayedElements.iterator(); i.hasNext(); ) { Editor ed = (Editor)i.next(); File basedir = null; if (m_modelLocation != null) basedir = m_modelLocation.getParentFile(); ed.attach(m_model, basedir); if (ed instanceof JSmoothModelBean.Listener) m_model.addListener((JSmoothModelBean.Listener)ed); if (ed instanceof JSmoothModelBean.SkeletonChangedListener) m_model.addSkeletonChangedListener((JSmoothModelBean.SkeletonChangedListener)ed); ed.dataChanged(); } } public void newModel() { JSmoothModelBean bean = new JSmoothModelBean(); newModel(bean, null); } public void newModel(JSmoothModelBean bean, java.io.File location) { detachAll(); m_model = bean; m_modelLocation = location; attachAll(); } public boolean openFile(java.io.File f) { m_modelLocation = f; try { JSmoothModelBean model = JSmoothModelPersistency.load(m_modelLocation); newModel(model, f); return true; } catch (java.io.IOException iox) { iox.printStackTrace(); return false; } } public boolean save() { if (m_modelLocation == null) return false; try { fireUpdateModel(); m_model.normalizePaths(m_modelLocation.getParentFile(), true); JSmoothModelPersistency.save(m_modelLocation, m_model); fireModelChanged(); return true; } catch (java.io.IOException iox) { iox.printStackTrace(); } return false; } private Vector m_lastErrors = new Vector(); public Vector getLastErrors() { return m_lastErrors; } public ExeCompiler.CompilerRunner getCompiler() { fireUpdateModel(); m_model.normalizePaths(m_modelLocation.getParentFile()); m_lastErrors.removeAllElements(); SkeletonBean skel = Main.SKELETONS.getSkeleton(m_model.getSkeletonName()); if (skel == null) { m_lastErrors.add(Main.local("UNKNOWN_SKEL")); return null; } File skelroot = Main.SKELETONS.getDirectory(skel); File basedir = m_modelLocation.getParentFile(); File exedir = basedir; try { File out = null; if (new File(m_model.getExecutableName()).isAbsolute() == false) out = new File(exedir, m_model.getExecutableName()); else out = new File(m_model.getExecutableName()); System.out.println("out = "+ out.getAbsolutePath()); ExeCompiler compiler = new ExeCompiler(); ExeCompiler.CompilerRunner runner = compiler.getRunnable(skelroot, skel, basedir, m_model, out); return runner; } catch (Exception exc) { exc.printStackTrace(); m_lastErrors.add(exc.getMessage()); return null; } } public void runexe() { fireUpdateModel(); try { File basedir = m_modelLocation.getParentFile(); File f = new File(basedir, m_model.getExecutableName()); String[] cmd = new String[]{ f.getAbsolutePath() }; System.out.println("RUNNING " + cmd[0] + " @ " + basedir); CommandRunner.run(cmd, f.getParentFile()); } catch (Exception exc) { exc.printStackTrace(); } } public java.io.File getProjectFile() { return m_modelLocation; } public void setProjectFile(java.io.File prjfile) { m_modelLocation = prjfile; } public JSmoothModelBean getModel() { return m_model; } public static void main(String args[]) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } JFrame test = new JFrame("test"); test.getContentPane().add(new MasterPanel()); test.pack(); test.setVisible(true); } } --- UserInteractionPanel.java DELETED --- --- NEW FILE: Main.java --- /* 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; import javax.swing.*; import java.awt.event.*; import java.awt.*; import net.charabia.jsmoothgen.skeleton.*; import java.util.*; import net.charabia.jsmoothgen.application.gui.util.*; import net.charabia.jsmoothgen.application.*; import java.util.prefs.*; public class Main extends JFrame { final static public SkeletonList SKELETONS = new SkeletonList(new java.io.File("skeletons")); final static public String VERSION = "@{VERSION}@"; final static public String RELEASEINFO = "@{RELEASEINFO}@"; final static public ResourceBundle TEXTS = PropertyResourceBundle.getBundle("locale.Texts"); static public Main MAIN; private MasterPanel m_panel; private javax.swing.JFileChooser m_projectFileChooser = new JFileChooser(); private RecentFileMenu m_recentFiles = null; private Main() { Splash splash = new Splash(this, "/icons/splash.png", false); splash.setVersion(VERSION); splash.show(); m_projectFileChooser.addChoosableFileFilter(new SimpleFileFilter("jsmooth", "JSmooth Project Files")); getContentPane().setLayout(new BorderLayout()); m_panel = new MasterPanel(); getContentPane().add(BorderLayout.CENTER, m_panel); setupMenus(); setupToolBar(); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { EXIT.actionPerformed(null); } }); setTitle("Untitled"); loadWindowSettings(); splash.dispose(); } private void setupMenus() { JMenuBar bar = new JMenuBar(); setJMenuBar(bar); JMenu menu = new JMenu(local("MENU_SYSTEM")); menu.add(new JMenuItem(NEW)); menu.addSeparator(); menu.add(new JMenuItem(OPEN)); menu.add(new JMenuItem(SAVE)); menu.add(new JMenuItem(SAVE_AS)); menu.addSeparator(); JMenu recentfiles = new JMenu(Main.local("MENU_RECENT")); m_recentFiles = new RecentFileMenu(recentfiles, 5, Main.class, new RecentFileMenu.Action() { public void action(String path) { if (m_panel.openFile(new java.io.File(path))) setTitle(path); } }); menu.add(recentfiles); menu.addSeparator(); menu.add(new JMenuItem(EXIT)); bar.add(menu); menu = new JMenu(local("MENU_PROJECT")); menu.add(new JMenuItem(COMPILE)); menu.add(new JMenuItem(RUNEXE)); bar.add(menu); menu = new JMenu(local("MENU_HELP")); menu.add(new JMenuItem(ABOUT)); bar.add(menu); } private void setupToolBar() { JToolBar bar = new JToolBar(); bar.add(NEW); bar.addSeparator(); bar.add(OPEN); bar.add(SAVE); bar.add(SAVE_AS); bar.addSeparator(); bar.add(COMPILE); bar.add(RUNEXE); bar.addSeparator(); bar.add(ABOUT); getContentPane().add(BorderLayout.NORTH, bar); } public static String local(String key) { try { String value = Main.TEXTS.getString(key); return value; } catch (Exception exc) { } return key; } private final Icon ICON_NEW = new javax.swing.ImageIcon(getClass().getResource("/icons/stock_new.png")); public final Action NEW = new AbstractAction(local("NEW"), ICON_NEW) { public void actionPerformed(ActionEvent e) { m_panel.newModel(); setTitle("Untitled"); } }; private final Icon ICON_OPEN = new javax.swing.ImageIcon(getClass().getResource("/icons/stock_open.png")); public final Action OPEN = new AbstractAction(local("OPEN"), ICON_OPEN) { public void actionPerformed(ActionEvent e) { if (m_projectFileChooser.showOpenDialog(Main.this) == JFileChooser.APPROVE_OPTION) { java.io.File f = m_projectFileChooser.getSelectedFile(); if (m_panel.openFile(f)) { // TODO m_recentFiles.add(f.getAbsolutePath()); setTitle(f.getAbsolutePath()); } // if (openDirect(m_projectFileChooser.getSelectedFile())) // m_recentMenuManager.add(m_projectFileChooser.getSelectedFile().getAbsolutePath()); } } }; private final Icon ICON_SAVE = new javax.swing.ImageIcon(getClass().getResource("/icons/stock_save.png")); public final Action SAVE = new AbstractAction(local("SAVE"), ICON_SAVE) { public void actionPerformed(ActionEvent e) { if (m_panel.getProjectFile() == null) SAVE_AS.actionPerformed(e); else { m_panel.save(); } } }; private final Icon ICON_SAVE_AS = new javax.swing.ImageIcon(getClass().getResource("/icons/stock_save_as.png")); public final Action SAVE_AS = new AbstractAction(local("SAVE_AS"), ICON_SAVE_AS) { public void actionPerformed(ActionEvent e) { if (m_projectFileChooser.showSaveDialog(Main.this) == JFileChooser.APPROVE_OPTION) { if ((m_panel.getModel() != null) && (m_panel.getProjectFile() != null)) m_panel.getModel().normalizePaths(m_panel.getProjectFile().getParentFile(), false); java.io.File nf = m_projectFileChooser.getSelectedFile(); String suf = getSuffix(nf); if ("jsmooth".equalsIgnoreCase(suf) == false) { nf = new java.io.File(nf.toString() + ".jsmooth"); } if (m_panel.getModel() != null) m_panel.getModel().normalizePaths(nf.getParentFile(), true); m_panel.setProjectFile(nf); setTitle(nf.getAbsolutePath()); m_panel.save(); m_recentFiles.add(nf.getAbsolutePath()); } } }; private final Icon ICON_EXIT = new javax.swing.ImageIcon(getClass().getResource("/icons/stock_exit-16.png")); public final Action EXIT = new AbstractAction(local("EXIT"), ICON_EXIT) { public void actionPerformed(ActionEvent e) { m_recentFiles.savePrefs(); saveWindowSettings(); if (m_panel.getProjectFile() != null) { m_panel.save(); } System.exit(0); } }; private final Icon ICON_COMPILE = new javax.swing.ImageIcon(getClass().getResource("/icons/stock_autopilot-24.png")); public final Action COMPILE = new AbstractAction(local("COMPILE"), ICON_COMPILE) { public void actionPerformed(ActionEvent e) { m_panel.fireUpdateModel(); SAVE.actionPerformed(e); if (m_panel.getProjectFile() == null) return; final ExeCompiler.CompilerRunner compiler = m_panel.getCompiler(); CompilationDialog dia = new CompilationDialog(Main.this, true); dia.setTitle(Main.local("COMPILATION_DIALOG_TITLE")); dia.pack(); if (compiler != null) { dia.setCompiler(compiler.getCompiler()); dia.compile(compiler); System.out.println("FINISH !!"); // return dia.getResult(); } else { dia.setNewState(100, "Error, compiler couldn't be created. Error description should follow:"); Vector v = m_panel.getLastErrors(); for (Iterator i=v.iterator(); i.hasNext(); ) { dia.setNewState(100, "- " + (i.next().toString())); } dia.show(); } } }; private final Icon ICON_RUNEXE = new javax.swing.ImageIcon(getClass().getResource("/icons/stock_next.png")); public final Action RUNEXE = new AbstractAction(local("RUNEXE"), ICON_RUNEXE) { public void actionPerformed(ActionEvent e) { m_panel.runexe(); } }; private final Icon ICON_ABOUT = new javax.swing.ImageIcon(getClass().getResource("/icons/stock_about.png")); public final Action ABOUT = new AbstractAction(local("ABOUT"), ICON_ABOUT) { public void actionPerformed(ActionEvent e) { AboutBox ab = new AboutBox(Main.this, true); ab.setVersion(Main.VERSION + " (" + Main.RELEASEINFO + ")"); ab.show(); } }; private String getSuffix(java.io.File f) { String fstr = f.getAbsolutePath(); int lastDot = fstr.lastIndexOf('.'); if ((lastDot >= 0) && ((lastDot+1) < fstr.length())) { return fstr.substring(lastDot+1); } return ""; } public void setTitle(String title) { super.setTitle("JSmooth " + Main.VERSION + ": " + title); } public void saveWindowSettings() { Preferences prefs = Preferences.systemNodeForPackage(this.getClass()); System.out.println("prefs: " + prefs); prefs.putInt("window-state", this.getExtendedState()); setExtendedState(NORMAL); prefs.putInt("window-x", (int)this.getLocation().getX()); prefs.putInt("window-y", (int)this.getLocation().getY()); prefs.putInt("window-width", (int)this.getWidth()); prefs.putInt("window-height", (int)this.getHeight()); } public void loadWindowSettings() { Preferences prefs = Preferences.systemNodeForPackage(this.getClass()); this.setExtendedState(prefs.getInt("window-state", Frame.NORMAL)); if (prefs.getInt("window-x", -1) > 0) { this.setLocation(prefs.getInt("window-x", 10), prefs.getInt("window-y", 10)); int w = prefs.getInt("window-width", 500); int h = prefs.getInt("window-height", 400); if (w <= 0) w = 400; if (h <= 0) h = 400; this.setSize(w,h); setExtendedState(prefs.getInt("window-state", NORMAL)); } } public static void main(String args[]) { System.out.println("Running JSmooth..."); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } Main.MAIN = new Main(); Main.MAIN.show(); } } --- Executable.form DELETED --- --- NEW FILE: EditorPool.java --- /* 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; import java.util.*; public class EditorPool { private Hashtable m_classToInstance = new Hashtable(); public EditorPool() { add(net.charabia.jsmoothgen.application.gui.editors.SkeletonChooser.class); add(net.charabia.jsmoothgen.application.gui.editors.SkeletonProperties.class); add(net.charabia.jsmoothgen.application.gui.editors.ExecutableName.class ); add(net.charabia.jsmoothgen.application.gui.editors.ExecutableIcon.class ); add(net.charabia.jsmoothgen.application.gui.editors.CurrentDirectory.class); add(net.charabia.jsmoothgen.application.gui.editors.MainClass.class); add(net.charabia.jsmoothgen.application.gui.editors.ApplicationArguments.class); add(net.charabia.jsmoothgen.application.gui.editors.EmbeddedJar.class); add(net.charabia.jsmoothgen.application.gui.editors.ClassPath.class); add(net.charabia.jsmoothgen.application.gui.editors.MinVersion.class); add(net.charabia.jsmoothgen.application.gui.editors.MaxVersion.class); add(net.charabia.jsmoothgen.application.gui.editors.JVMBundle.class); add(net.charabia.jsmoothgen.application.gui.editors.JVMSearchSequence.class); add(net.charabia.jsmoothgen.application.gui.editors.MaxMemoryHeap.class); add(net.charabia.jsmoothgen.application.gui.editors.InitialMemoryHeap.class); add(net.charabia.jsmoothgen.application.gui.editors.JavaProperties.class); } private void add(Class clzz) { try { m_classToInstance.put(clzz, clzz.newInstance()); } catch (Exception exc) { exc.printStackTrace(); } } public Editor getInstance(Class clzz) { Editor e = (Editor)m_classToInstance.get(clzz); if (e == null) { try { e = (Editor)clzz.newInstance(); m_classToInstance.put(clzz, e); } catch (Exception exc) { exc.printStackTrace(); } } return e; } } --- JavaApp.java DELETED --- --- Executable.java DELETED --- --- JavaApp.form DELETED --- --- SkeletonPropertiesPanel.form DELETED --- --- CompilationDialog.java DELETED --- |
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/editors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29016/editors Added Files: ApplicationArguments.java ClassPath.java CurrentDirectory.java EmbeddedJar.java ExecutableIcon.java ExecutableName.java InitialMemoryHeap.java JVMBundle.java JVMSearchSequence.java JavaProperties.java MainClass.java MaxMemoryHeap.java MaxVersion.java MinVersion.java SkeletonChooser.java SkeletonProperties.java Log Message: new swing GUI update --- NEW FILE: MinVersion.java --- /* 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.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 java.io.File; import java.util.jar.*; import com.l2fprod.common.swing.*; import com.l2fprod.common.propertysheet.*; public class MinVersion extends Editor { private JTextField m_args = new JTextField(); public MinVersion() { setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_args); m_args.setDocument(new RegExDocument("[0-9]+((([.][0-9]+)*)[.]?)")); } public void dataChanged() { m_args.setText(m_model.getMinimumVersion()); } public void updateModel() { m_model.setMinimumVersion(m_args.getText()); } public String getLabel() { return "MINVERSION_LABEL"; } public String getDescription() { return "MINVERSION_HELP"; } } --- NEW FILE: ExecutableIcon.java --- /* 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.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 java.io.*; import com.l2fprod.common.swing.*; import com.l2fprod.common.propertysheet.*; public class ExecutableIcon extends Editor { private FileSelectionTextField m_selector = new FileSelectionTextField(); private JLabel m_iconDisplay = new JLabel("(no image)"); public ExecutableIcon() { setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_selector); add(BorderLayout.SOUTH, m_iconDisplay); m_iconDisplay.setHorizontalAlignment(JLabel.CENTER); m_selector.addListener(new FileSelectionTextField.FileSelected() { public void fileSelected(String filename) { System.out.println("new icon: " + filename); setIconLocation(new File(filename)); } }); } public void dataChanged() { if (getBaseDir() != null) m_selector.setBaseDir(getBaseDir()); if (m_model.getIconLocation() != null) { m_selector.setFile(getAbsolutePath(new java.io.File(m_model.getIconLocation()))); setIconLocation(getAbsolutePath(new java.io.File(m_model.getIconLocation()))); } else { m_selector.setFile(null); setIconLocation(new File("")); } } public void updateModel() { File f = m_selector.getFile(); if (f != null) m_model.setIconLocation(m_selector.getFile().toString()); else m_model.setIconLocation(null); } public String getLabel() { return "ICONLOCATION_LABEL"; } public String getDescription() { return "ICONLOCATION_HELP"; } private void setIconLocation(File iconfile) { if (iconfile.isAbsolute() == false) { iconfile = new File(m_basedir, iconfile.toString()); } ImageIcon icon = null; System.out.println("setIconLocation: " + iconfile); if (iconfile.toString().toUpperCase().endsWith(".ICO")) { // // Try to load with our ico codec... // try { java.awt.image.BufferedImage[] images = net.charabia.util.codec.IcoCodec.loadImages(iconfile); if ((images != null) && (images.length>0)) { java.awt.Image img = images[0]; icon = new ImageIcon(img); } } catch (java.io.IOException exc) { exc.printStackTrace(); } } else // Otherwise try with the standard toolkit functions... { icon = new javax.swing.ImageIcon(iconfile.getAbsolutePath(), "default icon"); } if (icon != null) { int width = icon.getIconWidth(); int height = icon.getIconHeight(); m_iconDisplay.setIcon(icon); m_iconDisplay.setText(""); m_model.setIconLocation(iconfile.getAbsolutePath()); this.validate(); this.invalidate(); } else { m_iconDisplay.setIcon(null); m_iconDisplay.setText("(no image)"); m_model.setIconLocation(null); } doLayout(); invalidate(); validate(); repaint(); } } --- NEW FILE: SkeletonProperties.java --- /* 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.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.*; public class SkeletonProperties extends Editor implements JSmoothModelBean.SkeletonChangedListener { private PropertySheetPanel m_skelprops = new PropertySheetPanel(); private String m_currentSkelName = null; private SkeletonBean m_skel = null; public class SkeletonPropertyProxy extends DefaultProperty { SkeletonProperty m_property; public SkeletonPropertyProxy(SkeletonProperty prop) { m_property = prop; } public String getDisplayName() { return m_property.getLabel(); } public String getName() { System.out.println("proxy, getname " + m_property.getIdName()); return m_property.getIdName(); } public String getShortDescription() { return m_property.getDescription(); } public Class getType() { if (m_property.getType().equals("boolean")) return Boolean.class; else if (m_property.getType().equals("textarea")) return String.class; else if (m_property.getType().equals("string")) return String.class; return String.class; } public boolean isEditable() { return true; } public Object getValue() { if (m_property.getType().equals("boolean")) return new Boolean(m_property.getValue().equals("1")); return m_property.getValue(); } public void setValue(Object o) { System.out.println("SET VALUE " + o); if (o instanceof Boolean) { if (((Boolean)o).booleanValue() == true) m_property.setValue("1"); else m_property.setValue("0"); } else { m_property.setValue(o.toString()); } } } public SkeletonProperties() { setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_skelprops); m_skelprops.setDescriptionVisible(true); m_skelprops.setToolBarVisible(false); } public Dimension getPreferredSize() { return new Dimension(100,200); } public void setProperties() { 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]; SkeletonPropertyProxy[] proxy = new SkeletonPropertyProxy[sprops.length]; for (int i=0; i<sprops.length; i++) { proxy[i] = new SkeletonPropertyProxy( sprops[i] ); System.out.println("Added property " + sprops[i].getLabel()); } JSmoothModelBean.Property[] jsprop = m_model.getSkeletonProperties(); for (int i=0; i<jsprop.length; i++) { // search for the proxy and set the value for (int j=0; j<proxy.length; j++) { if (proxy[j].getName().equals(jsprop[i].getKey())) { proxy[j].setValue(jsprop[i].getValue()); break; } } } m_skelprops.setProperties(proxy); } public void dataChanged() { System.out.println("SkeletonProperties: data changed, " + m_model.getSkeletonName()); if (m_model.getSkeletonName() == null) { m_currentSkelName = null; setProperties(); return; } if ( ! m_model.getSkeletonName().equalsIgnoreCase(m_currentSkelName)) { m_currentSkelName = m_model.getSkeletonName(); setProperties(); } } public void updateModel() { if (m_skel != null) { 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(); } public String getLabel() { return "SKELETONPROPERTIES_LABEL"; } public String getDescription() { return "SKELETONPROPERTIES_HELP"; } } --- NEW FILE: InitialMemoryHeap.java --- /* 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.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 java.io.File; import java.util.jar.*; public class InitialMemoryHeap extends Editor { private JTextField m_args = new JTextField(); private JComboBox m_units = new JComboBox(); public InitialMemoryHeap() { setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_args); m_args.setDocument(new RegExDocument("[0-9]+")); m_args.setHorizontalAlignment(JTextField.RIGHT); Vector u = new Vector(); u.add(Main.local("UNIT_MB")); u.add(Main.local("UNIT_KB")); u.add(Main.local("UNIT_BYTE")); DefaultComboBoxModel mod = new DefaultComboBoxModel(u); m_units.setModel(mod); add(BorderLayout.EAST, m_units); } public void dataChanged() { setValueCombo(m_model.getInitialMemoryHeap(), m_args, m_units); } public void updateModel() { int value; System.out.println("Parsing " + m_args.getText()); try { value = Integer.parseInt(m_args.getText()); } catch (Exception exc) { // nothing here m_model.setInitialMemoryHeap(-1); return; } System.out.println("sel index: " + m_units.getSelectedIndex() + " / " + value + " / " + (value*1024*1024)); switch(m_units.getSelectedIndex()) { case 0: if (value>2047) value = 2047; m_model.setInitialMemoryHeap(value * 1024 * 1024); break; case 1: m_model.setInitialMemoryHeap(value * 1024); break; case 2: m_model.setInitialMemoryHeap(value); break; } System.out.println("Resulting initmem: " + m_model.getInitialMemoryHeap()); } public String getLabel() { return "INITIALMEMORY_LABEL"; } public String getDescription() { return "INITIALMEMORY_HELP"; } public void setValueCombo(int value, JTextField num, JComboBox box) { if (value >= (1024 * 1024)) { num.setText( new Integer(value / (1024*1024)).toString()); box.setSelectedIndex(0); } else if (value >= 1024) { num.setText( new Integer(value / 1024).toString()); box.setSelectedIndex(1); } else if (value > 0) { num.setText( new Integer(value).toString()); box.setSelectedIndex(2); } else { num.setText(""); box.setSelectedIndex(0); } } } --- NEW FILE: SkeletonChooser.java --- /* 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.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.event.*; import java.util.*; import com.l2fprod.common.swing.*; import com.l2fprod.common.propertysheet.*; public class SkeletonChooser extends Editor implements JSmoothModelBean.SkeletonChangedListener { private JComboBox m_skelcombo = new JComboBox(); private HTMLPane m_skeldesc = new HTMLPane() { public java.awt.Dimension getPreferredSize() { java.awt.Dimension d = super.getPreferredSize(); if (d.height<100) d.height=100; return d; } }; public SkeletonChooser() { PanelLayout pl = new PanelLayout(); setLayout(pl); m_skelcombo.addItem("<none>"); for (Iterator i=Main.SKELETONS.getIteratorNoDebugName(); i.hasNext(); ) { m_skelcombo.addItem(i.next().toString()); } add(m_skelcombo); add(m_skeldesc); m_skelcombo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateModel(); doLayout(); validate(); repaint(); } }); } private void updateSkeletonData() { String skelname = (String) m_skelcombo.getSelectedItem(); if (skelname == null) return; SkeletonBean skel = Main.SKELETONS.getSkeleton(skelname); System.out.println("SKEL: " + skel.toString()); if (skel != null) { m_skeldesc.setText(skel.getDescription()); } } public void dataChanged() { String skelname = m_model.getSkeletonName(); if (skelname != null) { SkeletonBean skel = Main.SKELETONS.getSkeleton(skelname); if (skel != null) { m_skeldesc.setText(skel.getDescription()); m_skelcombo.setSelectedItem(skelname); } else { m_skelcombo.setSelectedItem(""); m_skeldesc.setText(""); } } else { m_skelcombo.setSelectedItem(""); m_skeldesc.setText("<none>"); } } public void updateModel() { String skelname = (String) m_skelcombo.getSelectedItem(); if (skelname == null) return; if (skelname.equals("<none>")) skelname = "<none>"; m_model.setSkeletonName(skelname); } public String getLabel() { return "SKELETONCHOOSER_LABEL"; } public String getDescription() { return "SKELETONCHOOSER_HELP"; } public void skeletonChanged() { dataChanged(); } } --- NEW FILE: ClassPath.java --- /* 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.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 java.io.File; import java.util.jar.*; import com.l2fprod.common.swing.*; import com.l2fprod.common.propertysheet.*; public class ClassPath extends Editor { private JFileChooser m_jarLocFileChooser = new JFileChooser(); private EditableListFileEditor m_fileeditor = new EditableListFileEditor(); private SortedEditableList m_list = new SortedEditableList() { protected void modelChanged() { ClassPath.this.updateModel(); } }; public ClassPath() { m_jarLocFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); m_jarLocFileChooser.setMultiSelectionEnabled(true); GenericFileFilter filter = new GenericFileFilter("Zip, Jar, or directories"); filter.addSuffix("jar"); filter.addSuffix("zip"); m_jarLocFileChooser.addChoosableFileFilter(filter); m_fileeditor.setFileChooser(m_jarLocFileChooser); m_list.setEditor(m_fileeditor); setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_list); } public void dataChanged() { if (getBaseDir() != null) { m_jarLocFileChooser.setCurrentDirectory(getBaseDir()); } String[] cp = m_model.getClassPath(); if (cp == null) m_list.setData(new Object[0]); else m_list.setData((Object[])cp); } public void updateModel() { Object[] cpels = m_list.getData(); String[] cp = new String[cpels.length]; for (int i=0; i<cp.length; i++) { cp[i] = cpels[i].toString(); } m_model.setClassPath(cp); } public String getLabel() { return "CLASSPATH_LABEL"; } public String getDescription() { return "CLASSPATH_HELP"; } } --- NEW FILE: EmbeddedJar.java --- /* 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.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 java.io.File; import com.l2fprod.common.swing.*; import com.l2fprod.common.propertysheet.*; public class EmbeddedJar extends Editor { private JCheckBox m_checker = new JCheckBox(); private FileSelectionTextField m_selector = new FileSelectionTextField(); public EmbeddedJar() { setLayout(new PanelLayout()); add(m_checker); add(m_selector); m_checker.setAction(new AbstractAction(Main.local("EMBEDDEDJAR_CHECKBOX")) { public void actionPerformed(java.awt.event.ActionEvent e) { System.out.println("Embedded jar, checkbox action"); m_selector.setEnabled(m_checker.isSelected()); updateModel(); } }); m_selector.addListener(new FileSelectionTextField.FileSelected() { public void fileSelected(String filename) { updateModel(); } }); } public void dataChanged() { m_checker.setSelected(m_model.getEmbeddedJar()); m_selector.setBaseDir(getBaseDir()); if (m_model.getJarLocation() != null) m_selector.setFile(new File(m_model.getJarLocation())); else m_selector.setFile(null); if (m_checker.isSelected()) m_selector.setEnabled(true); else m_selector.setEnabled(false); } public void updateModel() { m_model.setEmbeddedJar(m_checker.isSelected()); if (m_selector.getFile() != null) m_model.setJarLocation(m_selector.getFile().toString()); else m_model.setJarLocation(null); } public String getLabel() { return "EMBEDDEDJAR_LABEL"; } public String getDescription() { return "EMBEDDEDJAR_HELP"; } } --- NEW FILE: JVMBundle.java --- /* 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.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 java.io.File; import com.l2fprod.common.swing.*; import com.l2fprod.common.propertysheet.*; public class JVMBundle extends Editor { private JCheckBox m_checker = new JCheckBox(); private FileSelectionTextField m_selector = new FileSelectionTextField(); public JVMBundle() { setLayout(new PanelLayout()); add(m_checker); add(m_selector); m_selector.setFileChooser(new JDirectoryChooser()); m_checker.setAction(new AbstractAction(Main.local("JVMBUNDLE_CHECKBOX")) { public void actionPerformed(java.awt.event.ActionEvent e) { m_selector.setEnabled(m_checker.isSelected()); } }); } public void dataChanged() { String bundle = m_model.getBundledJVMPath(); if (bundle == null) { m_checker.setSelected(false); m_selector.setBaseDir(getBaseDir()); m_selector.setFile(null); } else { m_checker.setSelected(true); m_selector.setBaseDir(getBaseDir()); m_selector.setFile(new java.io.File(bundle)); } } public void updateModel() { if (m_checker.isSelected()) { File f = m_selector.getFile(); m_model.setBundledJVMPath(f.toString()); } else { m_model.setBundledJVMPath(null); } } public String getLabel() { return "JVMBUNDLE_LABEL"; } public String getDescription() { return "JVMBUNDLE_HELP"; } } --- NEW FILE: JavaProperties.java --- /* 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.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 java.io.File; import java.util.jar.*; public class JavaProperties extends Editor { private SortedEditableList m_props = new SortedEditableList(); public class PropEditor implements SortedEditableList.Editor { public Object createNewItem(SortedEditableList selist) { JavaPropertyPair jpp = new JavaPropertyPair("", ""); PropertyEditorDialog dia = new PropertyEditorDialog(jpp); if (dia.ask() && (jpp.getName().trim().length() > 0)) return jpp; else return null; } public Object editItem(SortedEditableList selist, Object item) { JavaPropertyPair jpp = (JavaPropertyPair)item; PropertyEditorDialog dia = new PropertyEditorDialog(jpp); dia.show(); return item; } public boolean removeItem(SortedEditableList selist, Object item) { return true; } } public JavaProperties() { setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_props); m_props.setEditor(new PropEditor()); } public void dataChanged() { JavaPropertyPair[] props = m_model.getJavaProperties(); m_props.setData(props); } public void updateModel() { Object[] po = m_props.getData(); JavaPropertyPair[] props = new JavaPropertyPair[po.length]; for (int i=0; i<po.length; i++) { props[i] = (JavaPropertyPair)po[i]; } m_model.setJavaProperties(props); } public String getLabel() { return "JAVAPROP_LABEL"; } public String getDescription() { return "JAVAPROP_HELP"; } } --- NEW FILE: CurrentDirectory.java --- /* 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.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.*; public class CurrentDirectory extends Editor { private FileSelectionTextField m_selector = new FileSelectionTextField(); public CurrentDirectory() { setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_selector); m_selector.setFileChooser(new JDirectoryChooser()); } public void dataChanged() { System.out.println("CurDir, basedir=" + getBaseDir()); m_selector.setBaseDir(getBaseDir()); String dir = m_model.getCurrentDirectory(); System.out.println("Cur Directory data changed: " + dir); if ((dir != null) && (dir.trim().length()>0)) { m_selector.setFile(new java.io.File(dir)); } else { m_selector.setFile(null); } } public void updateModel() { System.out.println("UPDATE MODEL: " + m_selector.getFile()); if (m_selector.getFile() != null) m_model.setCurrentDirectory(m_selector.getFile().toString()); else m_model.setCurrentDirectory(null); } public String getLabel() { return "CURRENTDIR_LABEL"; } public String getDescription() { return "CURRENTDIR_HELP"; } } --- NEW FILE: ExecutableName.java --- /* 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.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.*; public class ExecutableName extends Editor { private FileSelectionTextField m_selector = new FileSelectionTextField(); public ExecutableName() { setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_selector); } public void dataChanged() { if (getBaseDir() != null) m_selector.setBaseDir(getBaseDir()); if (m_model.getExecutableName() != null) m_selector.setFile(getAbsolutePath(new java.io.File(m_model.getExecutableName()))); else m_selector.setFile(null); } public void updateModel() { if (m_selector.getFile() != null) m_model.setExecutableName(m_selector.getFile().toString()); else m_model.setExecutableName(null); } public String getLabel() { return "EXECUTABLE_LABEL"; } public String getDescription() { return "EXECUTABLE_HELP"; } } --- NEW FILE: MaxMemoryHeap.java --- /* 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.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 java.io.File; import java.util.jar.*; public class MaxMemoryHeap extends Editor { private JTextField m_args = new JTextField(); private JComboBox m_units = new JComboBox(); public MaxMemoryHeap() { setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_args); m_args.setDocument(new RegExDocument("[0-9]+")); m_args.setHorizontalAlignment(JTextField.RIGHT); Vector u = new Vector(); u.add(Main.local("UNIT_MB")); u.add(Main.local("UNIT_KB")); u.add(Main.local("UNIT_BYTE")); DefaultComboBoxModel mod = new DefaultComboBoxModel(u); m_units.setModel(mod); add(BorderLayout.EAST, m_units); } public void dataChanged() { setValueCombo(m_model.getMaximumMemoryHeap(), m_args, m_units); } public void updateModel() { int value; try { value = Integer.parseInt(m_args.getText()); } catch (Exception exc) { // nothing here m_model.setInitialMemoryHeap(-1); return; } switch(m_units.getSelectedIndex()) { case 0: if (value>2047) value = 2047; m_model.setMaximumMemoryHeap(value * 1024 * 1024); break; case 1: m_model.setMaximumMemoryHeap(value * 1024); break; case 2: m_model.setMaximumMemoryHeap(value); break; } } public String getLabel() { return "MAXMEMORY_LABEL"; } public String getDescription() { return "MAXMEMORY_HELP"; } public void setValueCombo(int value, JTextField num, JComboBox box) { if (value >= (1024 * 1024)) { num.setText( new Integer(value / (1024*1024)).toString()); box.setSelectedIndex(0); } else if (value >= 1024) { num.setText( new Integer(value / 1024).toString()); box.setSelectedIndex(1); } else if (value > 0) { num.setText( new Integer(value).toString()); box.setSelectedIndex(2); } else { num.setText(""); box.setSelectedIndex(0); } } } --- NEW FILE: ApplicationArguments.java --- /* 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.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 java.io.File; import java.util.jar.*; public class ApplicationArguments extends Editor { private JTextField m_args = new JTextField(); public ApplicationArguments() { setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_args); } public void dataChanged() { m_args.setText(m_model.getArguments()); } public void updateModel() { m_model.setArguments(m_args.getText()); } public String getLabel() { return "ARGUMENTS_LABEL"; } public String getDescription() { return "ARGUMENTS_HELP"; } } --- NEW FILE: MaxVersion.java --- /* 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.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 java.io.File; import java.util.jar.*; import com.l2fprod.common.swing.*; import com.l2fprod.common.propertysheet.*; public class MaxVersion extends Editor { private JTextField m_args = new JTextField(); public MaxVersion() { setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_args); m_args.setDocument(new RegExDocument("[0-9]+((([.][0-9]+)*)[.]?)")); } public void dataChanged() { m_args.setText(m_model.getMaximumVersion()); } public void updateModel() { m_model.setMaximumVersion(m_args.getText()); } public String getLabel() { return "MAXVERSION_LABEL"; } public String getDescription() { return "MAXVERSION_HELP"; } } --- NEW FILE: JVMSearchSequence.java --- /* 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.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 java.io.File; import java.util.jar.*; public class JVMSearchSequence extends Editor { private SortedEditableList m_vmSearch = new SortedEditableList(); public JVMSearchSequence() { m_vmSearch.setEditableItems(false); setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_vmSearch); } public void dataChanged() { if (m_model.getJVMSearchPath() == null) { m_vmSearch.setData(JVMSearchElement.Elements); } else { Vector v = new Vector(); String[] els = m_model.getJVMSearchPath(); for (int i=0; i<els.length; i++) { JVMSearchElement el = JVMSearchElement.getStandardElement(els[i]); if (el != null) v.add(el); } m_vmSearch.setData(v.toArray()); } } public void updateModel() { String[] ids = new String[m_vmSearch.dataSize()]; Object[] data = m_vmSearch.getData(); for (int i=0; i<ids.length; i++) { ids[i] = ((JVMSearchElement)data[i]).getId(); } m_model.setJVMSearchPath(ids); } public String getLabel() { return "JVMSEARCH_LABEL"; } public String getDescription() { return "JVMSEARCH_HELP"; } } --- NEW FILE: MainClass.java --- /* 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.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 java.io.File; import java.util.jar.*; import com.l2fprod.common.swing.*; import com.l2fprod.common.propertysheet.*; public class MainClass extends Editor { private JTextField m_classname = new JTextField(); private JButton m_chooserButton = new JButton("..."); public MainClass() { setLayout(new BorderLayout()); add(BorderLayout.CENTER, m_classname); add(BorderLayout.EAST, m_chooserButton); m_chooserButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { displayChooser(); } }); } public void dataChanged() { m_classname.setText(m_model.getMainClassName()); } public void updateModel() { m_model.setMainClassName(m_classname.getText()); } public String getLabel() { return "MAINCLASS_LABEL"; } public String getDescription() { return "MAINCLASS_HELP"; } protected void displayChooser() { ClassChooserDialog chooser = new ClassChooserDialog(Main.MAIN, true); Vector jars = new Vector(); if (m_model.getEmbeddedJar() == true) { String ejar = m_model.getJarLocation(); if (ejar != null) { File f = getAbsolutePath(new File(ejar)); jars.add(f); } } String[] cp = m_model.getClassPath(); if (cp != null) { for (int i=0; i<cp.length; i++) { jars.add(getAbsolutePath(new File(cp[i]))); } } chooser.clear(); for (Iterator i=jars.iterator(); i.hasNext(); ) { File f = (File)i.next(); System.out.println("Adding jar <" + f + ">"); try { chooser.addJar(new JarFile(f)); } catch (Exception ex) { ex.printStackTrace(); } } chooser.setClassName(m_classname.getText()); chooser.show(); if (chooser.validated()) { String classname = chooser.getClassName(); m_classname.setText(classname); } } } |
From: Rodrigo R. <re...@us...> - 2004-03-16 08:11:17
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/editors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28325/editors Log Message: Directory /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/editors added to the repository |
From: Rodrigo R. <re...@us...> - 2004-03-16 08:01:52
|
Update of /cvsroot/jsmooth/jsmooth/src/locale In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26579 Added Files: Texts.properties Log Message: locale for the swing app --- NEW FILE: Texts.properties --- # # Actions... # MENU_SYSTEM=System MENU_PROJECT=Project MENU_RECENT=Recent files MENU_HELP=Help NEW=New OPEN=Open... SAVE=Save SAVE_AS=Save As... EXIT=Exit COMPILE=Compile... RUNEXE=Run the exe... ABOUT=About... # # Texts from the panels... # SKELETONCHOOSER_LABEL=Skeleton Chooser SKELETONCHOOSER_HELP=Choose your skeleton according to the properties you wish to set up for your executable binary. Read carefully the description of the wrapper, and choose it according to your needs relative to the applications. EXECUTABLE_LABEL=Executable Binary EXECUTABLE_HELP=This is the name given to the executable binary.<br>It must end with the ".exe" suffix. For instance, <tt>myprogram.exe</tt> is just fine. CURRENTDIR_LABEL=Current Directory CURRENTDIR_HELP=Selects the directory to be set as "current directory" when the application is launched. <p>Leave it empty to keep the current directory unmodified.<p>Typical use of this option is to modify the current path for executable located in a <tt>bin</tt> sub-directory, but the program expects to be launched from the root directory of the application.<p><b>WARNING</b>: Unlike the other files or directory options, which are all relative to the project file, this value is always relative to the generated executable location. That is, if you set ".." or "an\\other\\dir" here, the generated wrapper will change to this directory from <u>its</u> current own current directory. SKELETONPROPERTIES_LABEL=Skeleton Properties SKELETONPROPERTIES_HELP=The table above shows the properties associated to the selected skeleton. Change the values of the properties to customize the behaviour of the native executable wrapper generated. ICONLOCATION_LABEL=Executable Icon ICONLOCATION_HELP=Optionnally, you can select an icon to be compiled with the executable. This icon is typically used by the operating system to represent the file.<p>You should prefer .ICO files, as this is the format natively used for Win32 executable images, but <tt>GIF</tt>, <tt>JPEG</tt>, or <tt>PNG</tt> files should work fine, at the expense of an image quality decrease. ARGUMENTS_LABEL=Application Arguments ARGUMENTS_HELP=Arguments can be passed to the application at launch time. This option allows you to specify default arguments. The expected behaviour of the wrappers is to use those arguments only if none are passed by the user (in other words, they are overloaded by manual arguments). EMBEDDEDJAR_LABEL=Embedded jar EMBEDDEDJAR_HELP=You can embed a jar file into the compiled executable. This jar file is extracted each time the executable binary is launched. This is typically used to create a single binary that contains everything (for instance for an installer). EMBEDDEDJAR_CHECKBOX=Use an embedded jar CLASSPATH_LABEL=Classpath CLASSPATH_HELP=Specify here the classpath used by the java application.<p>You can select jar or zip files, but also directories. MINVERSION_LABEL=Minimum JVM Version MINVERSION_HELP=Specify here the minimum java version that your application needs to run properly.<p>For instance, <tt>1.2</tt> or <tt>1.4.2</tt> should be fine. MAXVERSION_LABEL=Maximum JVM Version MAXVERSION_HELP=Specify here the minimum java version that your application needs to run properly.<p>Most of the time, you won't need to set anything here because Java ensure a very good backward compatibility. However, in some specific cases, you may need to target an older VM.<p><b>NOTE</b>: To limit your application to using JVM, say, 1.2, it is best to specify 1.2.999 as the maximum. This is because users may have a 1.2.x installed (1.2 is equivalent to 1.2.0 for JSmooth). MAINCLASS_LABEL=Main class MAINCLASS_HELP=Choose the main class, among all the classes available in the classpath. JVMBUNDLE_LABEL=JVM Bundle JVMBUNDLE_CHECKBOX=Use a JVM bundled with your application JVMBUNDLE_HELP=Use this option only if you intend to bundle a full JVM with your application distribution. This option specifies the directory where JSmooth should be able to find a full-featured JVM.<p>For instance, people often distribute a Java Virtual Machine under a <tt>jre</tt> or a <tt>java</tt> sub-directory of the distribution root, as thus this is the value expected here. JVMSEARCH_LABEL=JVM Search Sequence JVMSEARCH_HELP=This is where you can specify the order in which the JVM available are looked for.<p>The default is to search first in the Windows registry, then in standard environment variables, then in the system Path, then check if JView is installed.<p>The default should be fine for most users, but you can customize this search order by moving the elements up or down (preferred element are on top). MAXMEMORY_LABEL=Maximum Memory MAXMEMORY_HELP=The maximum memory that the JVM is allowed to allocate. The default depends on the JVM implementation, but a common value is 64MB. One should typically change it to a higher number for applications that consume lot of memory. UNIT_MB=MB UNIT_KB=KB UNIT_BYTE=B INITIALMEMORY_LABEL=Initial Memory Allocation INITIALMEMORY_HELP=JVMs often start with a small memory allocation. If your application allocates a lot of memory during the startup, increasing the initial memory allocated by the VM can dramatically speed up the launch. JAVAPROP_LABEL=Java Properties JAVAPROP_HELP=You can specify environment variable that are passed to the Java Virtual Machine at launch time.<p>Such variables are are typically accessed with the <tt>System.getProperty()</tt> method. JAVAPROP_DIALOG_TITLE=Java Property Edition JAVAPROP_DIALOG_LABEL=Property JAVAPROP_NAME=Name JAVAPROP_VALUE=Value JAVAPROP_DIALOG_HELP=Java properties are name/value pairs that are passed to the JVM, and are accessible by java applications using the <tt>System.getProperty()</tt> method.<p>Additionally, in the <tt>Value</tt> field, you can set specific values:<p><ul><li>Environment Variable: If you pass a string of the form <tt>%ENV%</tt> in the value field of the property, the wrappers will replace the string with the content of the ENV environment variable.<li>JSmooth can also makes some special variable accessible for your application: <tt>${EXECUTABLEPATH}</tt>, <tt>${EXECUTABLENAME}</tt>, <tt>${COMPUTERNAME}</tt>, <tt>${VMSELECTION}</tt>, <tt>${VMSPAWNTYPE}</tt>.<p>Please refer to the documentation for further details. COMPILATION_DIALOG_TITLE=Compilation Dialog # # Misc texts # UNKNOWN_SKEL=Selected skeleton is unknown. |
From: Rodrigo R. <re...@us...> - 2004-03-16 07:59:49
|
Update of /cvsroot/jsmooth/jsmooth/src/locale In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26296/locale Log Message: Directory /cvsroot/jsmooth/jsmooth/src/locale added to the repository |
From: <du...@us...> - 2004-03-11 13:37:16
|
Update of /cvsroot/jsmooth/jsmooth In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16231 Modified Files: resources.properties Log Message: Index: resources.properties =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/resources.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** resources.properties 23 Dec 2003 18:32:13 -0000 1.2 --- resources.properties 11 Mar 2004 13:10:36 -0000 1.3 *************** *** 1,15 **** # Change the dummy_wizban.gif to the apropriate image, when available. # No change in java code needed ! ! resources.images.new_project_wizban = res/dummy_wizban.gif ! resources.images.classpath_wizban = res/dummy_wizban.gif ! resources.images.jar_wizban = res/dummy_wizban.gif ! resources.images.main_class_wizban = res/dummy_wizban.gif ! resources.images.java_app_wizban = res/dummy_wizban.gif ! resources.images.jre_wizban = res/dummy_wizban.gif ! resources.images.exe_wizban = res/dummy_wizban.gif ! resources.images.add_item = res/add_item.gif ! resources.images.remove_item = res/remove_item.gif ! resources.images.edit_item = res/edit_item.gif ! resources.images.move_up = res/move_up.gif ! resources.images.move_down = res/move_down.gif \ No newline at end of file --- 1,11 ---- # Change the dummy_wizban.gif to the apropriate image, when available. # No change in java code needed ! ! img.new_project_wizban = res/dummy_wizban.gif ! img.classpath_wizban = res/dummy_wizban.gif ! img.main_class_wizban = res/dummy_wizban.gif ! img.jre_wizban = res/dummy_wizban.gif ! img.exe_wizban = res/dummy_wizban.gif ! img.new_project = res/new_project_wizard.gif ! img.move_up = res/move_up.gif ! img.move_down = res/move_down.gif |
From: <du...@us...> - 2004-03-11 13:36:50
|
Update of /cvsroot/jsmooth/jsmooth/res In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16172/res Added Files: new_project_wizard.gif Removed Files: add_item.gif edit_item.gif remove_item.gif Log Message: --- NEW FILE: new_project_wizard.gif --- (This appears to be a binary file; contents omitted.) --- add_item.gif DELETED --- --- edit_item.gif DELETED --- --- remove_item.gif DELETED --- |
From: <du...@us...> - 2004-03-11 13:34:40
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/swtgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15675/src/net/charabia/jsmoothgen/application/swtgui Modified Files: ProjectFileWizardPage.java JREBundleWizardPage.java MainClassWizardPage.java JRESearchWizardPage.java ExecutableWizardPage.java JSmoothResources.java MainWindow.java NewProjectWizard.java ClasspathWizardPage.java Added Files: Util.java Log Message: Wrote the first code for the Main SWT Window. The New Project Wizard now is launched through a menu/toolbar action. --- NEW FILE: Util.java --- /* * Created on Jan 26, 2004 */ package net.charabia.jsmoothgen.application.swtgui; import org.eclipse.swt.graphics.FontMetrics; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.widgets.Control; /** * @author Dumon */ public class Util { private static final int BUTTON_EXTRA_WIDTH = 6; private static int convertWidth(Control control, int chars) { GC gc = new GC(control); gc.setFont(control.getFont()); FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); return fontMetrics.getAverageCharWidth() * chars; } public static int computeWidth(Control control, String string) { int stringWidth = convertWidth(control, string.length()); int extraWidth = convertWidth(control, BUTTON_EXTRA_WIDTH); return stringWidth + extraWidth; } } Index: ProjectFileWizardPage.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/swtgui/ProjectFileWizardPage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ProjectFileWizardPage.java 23 Dec 2003 18:32:10 -0000 1.2 --- ProjectFileWizardPage.java 11 Mar 2004 13:07:58 -0000 1.3 *************** *** 6,13 **** --- 6,18 ---- import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; + import org.eclipse.swt.events.ModifyEvent; + import org.eclipse.swt.events.ModifyListener; + import org.eclipse.swt.events.SelectionAdapter; + import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; + import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; *************** *** 17,70 **** */ public class ProjectFileWizardPage extends WizardPage { ! private static final String NEW_PROJECT_WIZBAN = ! JSmoothResources.NEW_PROJECT_WIZBAN; ! private static final int BUTTON_EXTRA_WIDTH = 6; ! public ProjectFileWizardPage() { super("wizard.project_file"); setTitle("JSmooth Project"); ! setMessage("Create a new JSmooth project."); ! setImageDescriptor( ! JSmoothResources.getDescriptor(NEW_PROJECT_WIZBAN)); } ! ! /* (non-Javadoc) ! * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) ! */ public void createControl(Composite parent) { ! Composite comp = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(3, false); ! comp.setLayout(layout); ! createFile(comp); ! setControl(comp); } ! private void createFile(Composite parent) { ! GridData layoutData = null; ! ! Label label = new Label(parent, SWT.NONE); ! layoutData = new GridData(GridData.FILL); ! label.setLayoutData(layoutData); ! label.setText("Project file:"); ! ! Text text = new Text(parent, SWT.BORDER); ! layoutData = new GridData(GridData.FILL_HORIZONTAL); ! text.setLayoutData(layoutData); ! ! Button button = new Button(parent, SWT.PUSH); ! layoutData = new GridData(GridData.FILL); ! String buttonText = "Browse..."; ! layoutData.widthHint = ! computeButtonWidth(button, buttonText); ! button.setLayoutData(layoutData); ! button.setText(buttonText); } ! private int computeButtonWidth(Button button, String text) { ! initializeDialogUnits(button); ! return convertWidthInCharsToPixels( ! text.toCharArray().length + BUTTON_EXTRA_WIDTH); } } --- 22,107 ---- */ public class ProjectFileWizardPage extends WizardPage { ! ! private static final String STR_BROWSE = "Browse..."; ! private static final String STR_DESCRIPTION_MESSAGE = "Create a new JSmooth project."; ! ! private Text txtProjectFile; ! private Button btnBrowse; ! public ProjectFileWizardPage() { super("wizard.project_file"); setTitle("JSmooth Project"); ! setMessage(STR_DESCRIPTION_MESSAGE); ! String key = JSmoothResources.IMG_NEW_PROJECT_WIZBAN; ! setImageDescriptor(JSmoothResources.getDescriptor(key)); } ! public void createControl(Composite parent) { ! Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(3, false); ! composite.setLayout(layout); ! ! Label label = new Label(composite, SWT.NONE); ! label.setText("Project file:"); ! GridData layoutData = new GridData(GridData.FILL); ! label.setLayoutData(layoutData); ! ! txtProjectFile = new Text(composite, SWT.BORDER); ! layoutData = new GridData(GridData.FILL_HORIZONTAL); ! txtProjectFile.setLayoutData(layoutData); ! txtProjectFile.addModifyListener(new ModifyListener() { ! /* (non-Javadoc) ! * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) ! */ ! public void modifyText(ModifyEvent e) { ! projectFileModified(); ! } ! }); ! ! btnBrowse = new Button(composite, SWT.NONE); ! btnBrowse.setSize(Util.computeWidth(btnBrowse, STR_BROWSE), SWT.DEFAULT); ! btnBrowse.setText(STR_BROWSE); ! layoutData = new GridData(GridData.FILL); ! layoutData.widthHint = btnBrowse.getSize().x; ! btnBrowse.setLayoutData(layoutData); ! btnBrowse.addSelectionListener(new SelectionAdapter() { ! /* (non-Javadoc) ! * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) ! */ ! public void widgetSelected(SelectionEvent e) { ! browseSelected(); ! } ! }); ! setPageComplete(!isFileEmpty()); ! setControl(composite); ! } ! ! private void projectFileModified() { ! setPageComplete(!isFileEmpty()); ! setNewProjectWizardMessage(); ! } ! ! private void browseSelected() { ! FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); ! String file = dialog.open(); ! if(file != null) { ! txtProjectFile.setText(file); ! } } ! private boolean isFileEmpty() { ! String fileText = txtProjectFile.getText(); ! return fileText.trim().length() == 0; } ! private void setNewProjectWizardMessage() { ! if (isFileEmpty()) { ! setMessage("File name must be specified."); ! } else { ! setMessage(STR_DESCRIPTION_MESSAGE); ! } } + } Index: JREBundleWizardPage.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/swtgui/JREBundleWizardPage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JREBundleWizardPage.java 23 Dec 2003 18:32:10 -0000 1.2 --- JREBundleWizardPage.java 11 Mar 2004 13:07:58 -0000 1.3 *************** *** 19,153 **** */ public class JREBundleWizardPage extends WizardPage { - private static final int BUTTON_EXTRA_WIDTH = 6; - private static final int VERSION_TEXT_WIDTH = 40; - private static final int VERSION_TEXT_LIMIT = 5; - private static final int JRE_SEARCH_HEIGHT = 10; - private static final String JRE_WIZBAN = JSmoothResources.JRE_WIZBAN; - private static final String ADD_ITEM = JSmoothResources.ADD_ITEM; - private static final String REMOVE_ITEM = JSmoothResources.REMOVE_ITEM; - private static final String EDIT_ITEM = JSmoothResources.EDIT_ITEM; - private static final String MOVE_UP = JSmoothResources.MOVE_UP; - private static final String MOVE_DOWN = JSmoothResources.MOVE_DOWN; ! private Text versionText; ! private Text bundleText; ! private Button bundleBrowse; public JREBundleWizardPage() { super("wizard.jre_bundle"); setTitle("JRE Bundle"); setMessage("Java Runtime Environment bundle."); ! setImageDescriptor(JSmoothResources.getDescriptor(JRE_WIZBAN)); } ! /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { ! GridLayout layout = null; ! GridData layoutData = null; ! Composite comp = new Composite(parent, SWT.NONE); ! layout = new GridLayout(3, false); ! comp.setLayout(layout); ! createJREBundle(comp); ! createJREVersion(comp); ! setControl(comp); } - - private void createJREVersion(Composite parent) { - GridData layoutData = null; - - Composite comp = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(2, false); - layout.marginWidth = 0; - comp.setLayout(layout); - layoutData = new GridData(GridData.FILL); - layoutData.horizontalSpan = 3; - comp.setLayoutData(layoutData); - - Button check = new Button( - comp, - SWT.CHECK | SWT.LEFT_TO_RIGHT); - layoutData = new GridData(GridData.FILL); - check.setLayoutData(layoutData); - check.setText("Need minimum JRE version"); - check.addSelectionListener( - new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - toggleJREVersionEnable(e); - } ! }); ! ! versionText = new Text(comp, SWT.BORDER); ! layoutData = new GridData(GridData.FILL); ! layoutData.widthHint = VERSION_TEXT_WIDTH; ! versionText.setLayoutData(layoutData); ! versionText.setTextLimit(VERSION_TEXT_LIMIT); ! versionText.setEnabled(false); ! } ! ! /** ! * @param e ! */ ! protected void toggleJREVersionEnable(SelectionEvent e) { ! Button check = (Button) e.widget; ! versionText.setEnabled(check.getSelection()); ! } ! /** ! * @param e ! */ ! protected void toggleJREBundleEnable(SelectionEvent e) { ! Button check = (Button) e.widget; ! bundleText.setEnabled(check.getSelection()); ! bundleBrowse.setEnabled(check.getSelection()); ! } ! ! private void createJREBundle(Composite parent) { ! GridData layoutData = null; ! ! Button check = new Button( ! parent, ! SWT.CHECK | SWT.LEFT_TO_RIGHT); ! layoutData = new GridData(GridData.FILL); layoutData.horizontalSpan = 3; ! check.setLayoutData(layoutData); ! check.setText("Use JRE bundle"); ! check.addSelectionListener( ! new SelectionAdapter() { ! public void widgetSelected(SelectionEvent e) { ! toggleJREBundleEnable(e); ! } ! ! }); Label label = new Label(parent, SWT.NONE); - layoutData = new GridData(GridData.FILL); label.setText("Directory:"); ! bundleText = new Text(parent, SWT.BORDER); layoutData = new GridData(GridData.FILL_HORIZONTAL); ! bundleText.setLayoutData(layoutData); ! bundleText.setEnabled(false); ! bundleBrowse = new Button(parent, SWT.PUSH); layoutData = new GridData(GridData.FILL); ! String buttonText = "Browse..."; ! layoutData.widthHint = ! computeButtonWidth(bundleBrowse, buttonText); ! bundleBrowse.setLayoutData(layoutData); ! bundleBrowse.setText(buttonText); ! bundleBrowse.setEnabled(false); } ! ! private int computeButtonWidth(Button button, String text) { ! initializeDialogUnits(button); ! return convertWidthInCharsToPixels( ! text.toCharArray().length + BUTTON_EXTRA_WIDTH); } ! } --- 19,98 ---- */ public class JREBundleWizardPage extends WizardPage { ! private Button chkUseJREBundle; ! private Text txtJREBundle; ! private Button btnJREBundle; + private static final int DIM_VERSION_TEXT_WIDTH = 40; + private static final int DIM_VERSION_TEXT_LIMIT = 5; + private static final int DIM_JRE_SEARCH_HEIGHT = 10; + private static final String STR_BROWSE = "Browse..."; + public JREBundleWizardPage() { super("wizard.jre_bundle"); setTitle("JRE Bundle"); setMessage("Java Runtime Environment bundle."); ! String key = JSmoothResources.IMG_JRE_WIZBAN; ! setImageDescriptor(JSmoothResources.getDescriptor(key)); } ! /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { ! Composite composite = new Composite(parent, SWT.NONE); ! GridLayout layout = new GridLayout(3, false); ! composite.setLayout(layout); ! createWidgets(composite); ! useJREBundleSelected(); ! setControl(composite); } ! private void createWidgets(Composite parent) { ! chkUseJREBundle = new Button(parent, SWT.CHECK | SWT.LEFT_TO_RIGHT); ! chkUseJREBundle.setText("Use JRE bundle"); ! chkUseJREBundle.addSelectionListener(new SelectionAdapter() { ! public void widgetSelected(SelectionEvent e) { ! useJREBundleSelected(); ! } ! }); ! GridData layoutData = new GridData(GridData.FILL); layoutData.horizontalSpan = 3; ! chkUseJREBundle.setLayoutData(layoutData); Label label = new Label(parent, SWT.NONE); label.setText("Directory:"); + layoutData = new GridData(GridData.FILL); + label.setLayoutData(layoutData); ! txtJREBundle = new Text(parent, SWT.BORDER); layoutData = new GridData(GridData.FILL_HORIZONTAL); ! txtJREBundle.setLayoutData(layoutData); ! btnJREBundle = new Button(parent, SWT.NONE); ! btnJREBundle.setSize(Util.computeWidth(btnJREBundle, STR_BROWSE), SWT.DEFAULT); ! btnJREBundle.setText(STR_BROWSE); layoutData = new GridData(GridData.FILL); ! layoutData.widthHint = btnJREBundle.getSize().x; ! btnJREBundle.setLayoutData(layoutData); ! ! ! Composite composite = new Composite(parent, SWT.NONE); ! GridLayout layout = new GridLayout(2, false); ! layout.marginWidth = 0; ! composite.setLayout(layout); ! layoutData = new GridData(GridData.FILL); ! layoutData.horizontalSpan = 3; ! composite.setLayoutData(layoutData); } ! ! private void useJREBundleSelected() { ! txtJREBundle.setEnabled(chkUseJREBundle.getSelection()); ! btnJREBundle.setEnabled(chkUseJREBundle.getSelection()); } ! } Index: MainClassWizardPage.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/swtgui/MainClassWizardPage.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MainClassWizardPage.java 23 Dec 2003 18:32:10 -0000 1.3 --- MainClassWizardPage.java 11 Mar 2004 13:07:58 -0000 1.4 *************** *** 19,144 **** */ public class MainClassWizardPage extends WizardPage { - private static final int BUTTON_EXTRA_WIDTH = 6; - private static final int CLASSPATH_HEIGHT = 10; - private static final String JAVA_APP_WIZBAN = JSmoothResources.JAVA_APP_WIZBAN; - private static final String ADD_ITEM = JSmoothResources.ADD_ITEM; - private static final String REMOVE_ITEM = JSmoothResources.REMOVE_ITEM; - private static final String EDIT_ITEM = JSmoothResources.EDIT_ITEM; - private static final String MOVE_UP = JSmoothResources.MOVE_UP; - private static final String MOVE_DOWN = JSmoothResources.MOVE_DOWN; - - private Text jarFile; - private Button jarBrowse; public MainClassWizardPage() { super("wizard.main_class"); setTitle("Main Class"); setMessage("The Java application main class."); ! setImageDescriptor(JSmoothResources.getDescriptor(JAVA_APP_WIZBAN)); } ! /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { ! GridLayout layout = null; ! GridData layoutData = null; ! Composite comp = new Composite(parent, SWT.NONE); ! layout = new GridLayout(3, false); ! comp.setLayout(layout); ! createJARFile(comp); ! createMainClass(comp); ! createArguments(comp); ! setControl(comp); } ! private void createJARFile(Composite parent) { ! GridData layoutData = null; ! ! Button check = new Button( ! parent, ! SWT.CHECK | SWT.LEFT_TO_RIGHT); ! layoutData = new GridData(GridData.FILL); ! layoutData.horizontalSpan = 3; ! check.setLayoutData(layoutData); ! check.setText("Use JAR file"); ! check.addSelectionListener( ! new SelectionAdapter() { ! public void widgetSelected(SelectionEvent e) { ! toggleJARFileEnable(e); ! } ! }); Label label = new Label(parent, SWT.NONE); layoutData = new GridData(GridData.FILL); label.setLayoutData(layoutData); - label.setText("JAR location:"); ! jarFile = new Text(parent, SWT.BORDER); layoutData = new GridData(GridData.FILL_HORIZONTAL); ! jarFile.setLayoutData(layoutData); ! jarFile.setEnabled(false); ! jarBrowse = new Button(parent, SWT.PUSH); layoutData = new GridData(GridData.FILL); ! String buttonText = "Browse..."; ! layoutData.widthHint = ! computeButtonWidth(jarBrowse, buttonText); ! jarBrowse.setLayoutData(layoutData); ! jarBrowse.setText(buttonText); ! jarBrowse.setEnabled(false); ! } ! ! /** ! * ! */ ! protected void toggleJARFileEnable(SelectionEvent e) { ! Button check = (Button) e.widget; ! jarFile.setEnabled(check.getSelection()); ! jarBrowse.setEnabled(check.getSelection()); ! } ! ! private void createMainClass(Composite parent) { ! GridData layoutData = null; ! ! Label label = new Label(parent, SWT.NONE); layoutData = new GridData(GridData.FILL); label.setLayoutData(layoutData); - label.setText("Main class:"); Text text = new Text(parent, SWT.BORDER); layoutData = new GridData(GridData.FILL_HORIZONTAL); ! text.setLayoutData(layoutData); ! Button button = new Button(parent, SWT.PUSH); layoutData = new GridData(GridData.FILL); ! String buttonText = "Browse..."; ! layoutData.widthHint = computeButtonWidth(button, buttonText); button.setLayoutData(layoutData); - button.setText(buttonText); - } - - private int computeButtonWidth(Button button, String text) { - initializeDialogUnits(button); - return convertWidthInCharsToPixels( - text.toCharArray().length + BUTTON_EXTRA_WIDTH); - } - - private void createArguments(Composite parent) { - GridData layoutData = null; ! Label label = new Label(parent, SWT.NONE); layoutData = new GridData(GridData.FILL); label.setLayoutData(layoutData); - label.setText("Arguments:"); ! Text text = new Text(parent, SWT.BORDER); layoutData = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(layoutData); } } --- 19,111 ---- */ public class MainClassWizardPage extends WizardPage { + private Button chkUseJarFile; + private Text txtJarLocation; + private Button btnJarLocation; + private static final int DIM_CLASSPATH_HEIGHT = 10; + private static final String STR_BROWSE = "Browse..."; + public MainClassWizardPage() { super("wizard.main_class"); setTitle("Main Class"); setMessage("The Java application main class."); ! String key = JSmoothResources.IMG_MAIN_CLASS_WIZBAN; ! setImageDescriptor(JSmoothResources.getDescriptor(key)); } ! /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { ! Composite composite = new Composite(parent, SWT.NONE); ! GridLayout layout = new GridLayout(3, false); ! composite.setLayout(layout); ! createWidgets(composite); ! useJarFileSelected(); ! setControl(composite); } ! private void createWidgets(Composite parent) { ! chkUseJarFile = new Button(parent, SWT.CHECK | SWT.LEFT_TO_RIGHT); ! chkUseJarFile.setText("Use JAR file"); ! chkUseJarFile.addSelectionListener(new SelectionAdapter() { ! public void widgetSelected(SelectionEvent e) { ! useJarFileSelected(); ! } ! }); ! GridData layoutData = new GridData(GridData.FILL); ! layoutData.horizontalSpan = 3; ! chkUseJarFile.setLayoutData(layoutData); Label label = new Label(parent, SWT.NONE); + label.setText("JAR location:"); layoutData = new GridData(GridData.FILL); label.setLayoutData(layoutData); ! txtJarLocation = new Text(parent, SWT.BORDER); layoutData = new GridData(GridData.FILL_HORIZONTAL); ! txtJarLocation.setLayoutData(layoutData); ! btnJarLocation = new Button(parent, SWT.NONE); ! btnJarLocation.setSize(Util.computeWidth(btnJarLocation, STR_BROWSE), SWT.DEFAULT); ! btnJarLocation.setText(STR_BROWSE); layoutData = new GridData(GridData.FILL); ! layoutData.widthHint = btnJarLocation.getSize().x; ! btnJarLocation.setLayoutData(layoutData); ! ! label = new Label(parent, SWT.NONE); ! label.setText("Main class:"); layoutData = new GridData(GridData.FILL); label.setLayoutData(layoutData); Text text = new Text(parent, SWT.BORDER); layoutData = new GridData(GridData.FILL_HORIZONTAL); ! text .setLayoutData(layoutData); ! Button button = new Button(parent, SWT.NONE); ! button.setSize(Util.computeWidth(button, STR_BROWSE), SWT.DEFAULT); ! button.setText(STR_BROWSE); layoutData = new GridData(GridData.FILL); ! layoutData.widthHint = button.getSize().x; button.setLayoutData(layoutData); ! label = new Label(parent, SWT.NONE); ! label.setText("Arguments:"); layoutData = new GridData(GridData.FILL); label.setLayoutData(layoutData); ! text = new Text(parent, SWT.BORDER); layoutData = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(layoutData); } + + private void useJarFileSelected() { + txtJarLocation.setEnabled(chkUseJarFile.getSelection()); + btnJarLocation.setEnabled(chkUseJarFile.getSelection()); + } } Index: JRESearchWizardPage.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/swtgui/JRESearchWizardPage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JRESearchWizardPage.java 23 Dec 2003 18:32:10 -0000 1.1 --- JRESearchWizardPage.java 11 Mar 2004 13:07:58 -0000 1.2 *************** *** 6,10 **** import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; - import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; --- 6,9 ---- *************** *** 17,108 **** */ public class JRESearchWizardPage extends WizardPage { ! private static final int BUTTON_EXTRA_WIDTH = 6; ! private static final int VERSION_TEXT_WIDTH = 40; ! private static final int VERSION_TEXT_LIMIT = 5; private static final int JRE_SEARCH_HEIGHT = 10; ! private static final String JRE_WIZBAN = ! JSmoothResources.JRE_WIZBAN; ! private static final String ADD_ITEM = ! JSmoothResources.ADD_ITEM; ! private static final String REMOVE_ITEM = ! JSmoothResources.REMOVE_ITEM; ! private static final String EDIT_ITEM = ! JSmoothResources.EDIT_ITEM; ! private static final String MOVE_UP = ! JSmoothResources.MOVE_UP; ! private static final String MOVE_DOWN = ! JSmoothResources.MOVE_DOWN; ! public JRESearchWizardPage() { super("wizard.jre_search"); setTitle("JRE Search"); setMessage("Locations to search the Java Runtime Environment."); ! setImageDescriptor( ! JSmoothResources.getDescriptor(JRE_WIZBAN)); } /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { ! GridLayout layout = null; ! GridData layoutData = null; ! ! Composite comp = new Composite(parent, SWT.NONE); ! layout = new GridLayout(2, false); ! comp.setLayout(layout); ! createJRESearch(comp); ! setControl(comp); } ! ! private void createJRESearch(Composite parent) { ! GridData layoutData = null; ! List list = new List(parent, SWT.BORDER); ! layoutData = new GridData(GridData.FILL_BOTH); list.setLayoutData(layoutData); ! ! Composite jreSearchButtonBar = new Composite(parent, SWT.NONE); ! jreSearchButtonBar.setLayout(new GridLayout()); layoutData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); ! layoutData.heightHint = ! list.getItemHeight() * JRE_SEARCH_HEIGHT; ! jreSearchButtonBar.setLayoutData(layoutData); ! ! createButtonForJRESearch(jreSearchButtonBar, "Add..."); ! createButtonForJRESearch(jreSearchButtonBar, "Remove..."); ! createButtonForJRESearch(jreSearchButtonBar, "Edit..."); ! } ! ! private int computeButtonWidth(Button button, String text) { ! initializeDialogUnits(button); ! return convertWidthInCharsToPixels( ! text.toCharArray().length + BUTTON_EXTRA_WIDTH); ! } ! ! private Button createButtonForJRESearch( ! Composite parent, ! String text, ! Image image) { ! ! Button button = new Button(parent, SWT.PUSH); ! GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); ! layoutData.widthHint = computeButtonWidth(button, text); ! button.setLayoutData(layoutData); ! button.setText(text); ! button.setImage(image); ! ! return button; ! } ! ! private Button createButtonForJRESearch(Composite parent, String text) { ! return createButtonForJRESearch(parent, text, null); ! } ! ! private Button createButtonForJRESearch(Composite parent, Image image) { ! return createButtonForJRESearch(parent, "", image); } ! } --- 16,88 ---- */ public class JRESearchWizardPage extends WizardPage { ! private static final int JRE_SEARCH_HEIGHT = 10; ! private static final String MOVE_DOWN = JSmoothResources.IMG_MOVE_DOWN; ! private static final String MOVE_UP = JSmoothResources.IMG_MOVE_UP; ! ! private static final String STRING_ADD = "Add..."; ! private static final String STRING_EDIT = "Edit..."; ! private static final String STRING_REMOVE = "Remove..."; ! private static final int VERSION_TEXT_LIMIT = 5; ! private static final int VERSION_TEXT_WIDTH = 40; ! ! private static final String WIDGET_ADD_BUTTON = "AddButton"; ! private static final String WIDGET_BUTTON_BAR = "ButtonBar"; ! private static final String WIDGET_EDIT_BUTTON = "EditButton"; ! private static final String WIDGET_LIST = "List"; ! private static final String WIDGET_REMOVE_BUTTON = "RemoveButton"; ! private static final String WIDGET_TOP = "Top"; ! public JRESearchWizardPage() { super("wizard.jre_search"); setTitle("JRE Search"); setMessage("Locations to search the Java Runtime Environment."); ! String key = JSmoothResources.IMG_JRE_WIZBAN; ! setImageDescriptor(JSmoothResources.getDescriptor(key)); } + private void createButton(Composite parent, String label) { + Button button = new Button(parent, SWT.PUSH); + button.setSize(Util.computeWidth(button, label), SWT.DEFAULT); + button.setText(label); + GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); + layoutData.widthHint = button.getSize().x; + button.setLayoutData(layoutData); + } + + private void createButtons(Composite parent) { + createButton(parent, STRING_ADD); + createButton(parent, STRING_EDIT); + createButton(parent, STRING_REMOVE); + } + /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { ! Composite composite = new Composite(parent, SWT.NONE); ! GridLayout layout = new GridLayout(2, false); ! composite.setLayout(layout); ! createWidgets(composite); ! setControl(composite); } ! ! private void createWidgets(Composite parent) { List list = new List(parent, SWT.BORDER); ! GridData layoutData = new GridData(GridData.FILL_BOTH); list.setLayoutData(layoutData); ! ! Composite composite = new Composite(parent, SWT.NONE); ! GridLayout layout = new GridLayout(); ! layout.marginHeight = 0; ! layout.marginWidth = 0; ! composite.setLayout(layout); layoutData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); ! composite.setLayoutData(layoutData); ! ! createButtons(composite); } ! } Index: ExecutableWizardPage.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/swtgui/ExecutableWizardPage.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExecutableWizardPage.java 23 Dec 2003 18:32:10 -0000 1.3 --- ExecutableWizardPage.java 11 Mar 2004 13:07:58 -0000 1.4 *************** *** 17,22 **** */ public class ExecutableWizardPage extends WizardPage { ! private static final int BUTTON_EXTRA_WIDTH = 6; ! private static final String EXE_WIZBAN = JSmoothResources.EXE_WIZBAN; public ExecutableWizardPage() { --- 17,31 ---- */ public class ExecutableWizardPage extends WizardPage { ! private static final String EXE_WIZBAN = JSmoothResources.IMG_EXE_WIZBAN; ! private static final String STRING_BROWSE = "Browse..."; ! ! private static final String WIDGET_ICON = "Icon"; ! private static final String WIDGET_ICON_BUTTON = "IconButton"; ! private static final String WIDGET_ICON_COMPOSITE = "IconComposite"; ! private static final String WIDGET_ICON_LABEL = "IconLabel"; ! private static final String WIDGET_NAME_BUTTON = "NameButton"; ! private static final String WIDGET_NAME_LABEL = "NameLabel"; ! private static final String WIDGET_NAME_TEXT = "NameText"; ! private static final String WIDGET_TOP = "Top"; public ExecutableWizardPage() { *************** *** 31,106 **** */ public void createControl(Composite parent) { ! GridLayout layout = null; ! GridData layoutData = null; ! ! Composite comp = new Composite(parent, SWT.NONE); ! layout = new GridLayout(3, false); ! comp.setLayout(layout); ! createExecutableName(comp); ! createExecutableIcon(comp); ! setControl(comp); } ! /** ! * @param comp ! */ ! private void createExecutableIcon(Composite parent) { ! GridData layoutData = null; Label label = new Label(parent, SWT.NONE); ! layoutData = new GridData(GridData.FILL); label.setLayoutData(layoutData); - label.setText("Executable icon:"); ! Composite comp = new Composite(parent, SWT.NONE); layoutData = new GridData(GridData.FILL); ! comp.setLayoutData(layoutData); ! GridLayout layout = new GridLayout(2, false); ! layout.marginHeight = 0; ! layout.marginWidth = 0; ! comp.setLayout(layout); ! Label icon = new Label(comp, SWT.BORDER); layoutData = new GridData(GridData.FILL); ! layoutData.widthHint = 32; ! layoutData.heightHint = 32; ! icon.setLayoutData(layoutData); ! Button button = new Button(comp, SWT.NONE); layoutData = new GridData(GridData.FILL); ! layoutData.widthHint = computeButtonWidth(button, "Browse..."); ! button.setLayoutData(layoutData); ! button.setText("Browse..."); ! Label blank = new Label(parent, SWT.NONE); } ! /** ! * @param comp */ ! private void createExecutableName(Composite parent) { ! GridData layoutData = null; ! Label label = new Label(parent, SWT.NONE); ! layoutData = new GridData(GridData.FILL); label.setLayoutData(layoutData); - label.setText("Executable name:"); - - Text text = new Text(parent, SWT.BORDER); - layoutData = new GridData(GridData.FILL_HORIZONTAL); - text.setLayoutData(layoutData); Button button = new Button(parent, SWT.NONE); layoutData = new GridData(GridData.FILL); ! layoutData.widthHint = computeButtonWidth(button, "Browse..."); button.setLayoutData(layoutData); - button.setText("Browse..."); } - private int computeButtonWidth(Button button, String text) { - initializeDialogUnits(button); - return convertWidthInCharsToPixels( - text.toCharArray().length + BUTTON_EXTRA_WIDTH); - } - } --- 40,102 ---- */ public void createControl(Composite parent) { ! Composite composite = new Composite(parent, SWT.NONE); ! GridLayout layout = new GridLayout(3, false); ! composite.setLayout(layout); ! createWidgets(composite); ! setControl(composite); } ! private void createWidgets(Composite parent) { Label label = new Label(parent, SWT.NONE); ! label.setText("Executable name:"); ! GridData layoutData = new GridData(GridData.FILL); label.setLayoutData(layoutData); ! Text text = new Text(parent, SWT.BORDER); ! layoutData = new GridData(GridData.FILL_HORIZONTAL); ! text.setLayoutData(layoutData); ! ! Button button = new Button(parent, SWT.NONE); ! button.setSize(Util.computeWidth(button, STRING_BROWSE), SWT.DEFAULT); ! button.setText(STRING_BROWSE); layoutData = new GridData(GridData.FILL); ! layoutData.widthHint = button.getSize().x; ! button.setLayoutData(layoutData); ! label = new Label(parent, SWT.NONE); ! label.setText("Executable icon:"); layoutData = new GridData(GridData.FILL); ! label.setLayoutData(layoutData); ! Composite composite = new Composite(parent, SWT.NONE); ! GridLayout layout = new GridLayout(2, false); ! layout.marginHeight = 0; ! layout.marginWidth = 0; ! composite.setLayout(layout); layoutData = new GridData(GridData.FILL); ! composite.setLayoutData(layoutData); ! createIconWidgets(composite); } ! /** ! * @param parent */ ! private void createIconWidgets(Composite parent) { ! Label label = new Label(parent, SWT.BORDER); ! GridData layoutData = new GridData(GridData.FILL); ! layoutData.widthHint = 32; ! layoutData.heightHint = 32; label.setLayoutData(layoutData); Button button = new Button(parent, SWT.NONE); + button.setSize(Util.computeWidth(button, STRING_BROWSE), SWT.DEFAULT); + button.setText(STRING_BROWSE); layoutData = new GridData(GridData.FILL); ! layoutData.widthHint = button.getSize().x; button.setLayoutData(layoutData); } } Index: JSmoothResources.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/swtgui/JSmoothResources.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JSmoothResources.java 23 Dec 2003 18:32:10 -0000 1.2 --- JSmoothResources.java 11 Mar 2004 13:07:58 -0000 1.3 *************** *** 22,58 **** */ public class JSmoothResources { ! public static final String NEW_PROJECT_WIZBAN = "resources.images.new_project_wizban"; ! public static final String CLASSPATH_WIZBAN = "resources.images.classpath_wizban"; ! public static final String JAR_WIZBAN = "resources.images.jar_wizban"; ! public static final String MAIN_CLASS_WIZBAN = "resources.images.main_class_wizban"; ! public static final String JAVA_APP_WIZBAN = "resources.images.java_app_wizban"; ! public static final String JRE_WIZBAN = "resources.images.jre_wizban"; ! public static final String EXE_WIZBAN = "resources.images.exe_wizban"; ! ! public static final String ADD_ITEM = "resources.images.add_item"; ! public static final String REMOVE_ITEM = "resources.images.remove_item"; ! public static final String EDIT_ITEM = "resources.images.edit_item"; ! public static final String MOVE_UP = "resources.images.move_up"; ! public static final String MOVE_DOWN = "resources.images.move_down"; ! private static final String RESOURCES_PROPERTIES = "resources.properties"; ! private static ImageRegistry imageRegistry; private static URL context; private static ResourceBundle bundle; ! public static void loadResources(Display display, String path) { imageRegistry = new ImageRegistry(display); ! try{ context = new URL("file", "localhost", path); ! } catch(MalformedURLException muex) { muex.printStackTrace(System.err); } ! InputStream input = null; try { ! bundle = new PropertyResourceBundle( ! new FileInputStream( ! path + "/" + RESOURCES_PROPERTIES)); } catch (FileNotFoundException fnfex) { fnfex.printStackTrace(System.err); --- 22,52 ---- */ public class JSmoothResources { ! public static final String IMG_NEW_PROJECT_WIZBAN = "img.new_project_wizban"; ! public static final String IMG_CLASSPATH_WIZBAN = "img.classpath_wizban"; ! public static final String IMG_MAIN_CLASS_WIZBAN = "img.main_class_wizban"; ! public static final String IMG_JRE_WIZBAN = "img.jre_wizban"; ! public static final String IMG_EXE_WIZBAN = "img.exe_wizban"; ! ! public static final String IMG_NEW_PROJECT = "img.new_project"; ! public static final String IMG_MOVE_UP = "img.move_up"; ! public static final String IMG_MOVE_DOWN = "img.move_down"; ! private static final String RESOURCES_PROPERTIES = "resources.properties"; ! private static ImageRegistry imageRegistry; private static URL context; private static ResourceBundle bundle; ! public static void loadResources(Display display, String path) { imageRegistry = new ImageRegistry(display); ! try { context = new URL("file", "localhost", path); ! } catch (MalformedURLException muex) { muex.printStackTrace(System.err); } ! InputStream input = null; try { ! bundle = new PropertyResourceBundle(new FileInputStream(path + "/" + RESOURCES_PROPERTIES)); } catch (FileNotFoundException fnfex) { fnfex.printStackTrace(System.err); *************** *** 60,102 **** ioex.printStackTrace(System.err); } ! loadImages(); } ! public static void loadResources(String path) { loadResources(Display.getCurrent(), path); } ! private static void loadImages() { ! loadImage(NEW_PROJECT_WIZBAN); ! loadImage(CLASSPATH_WIZBAN); ! loadImage(JAR_WIZBAN); ! loadImage(MAIN_CLASS_WIZBAN); ! loadImage(JAVA_APP_WIZBAN); ! loadImage(JRE_WIZBAN); ! loadImage(EXE_WIZBAN); ! loadImage(ADD_ITEM); ! loadImage(REMOVE_ITEM); ! loadImage(EDIT_ITEM); ! loadImage(MOVE_UP); ! loadImage(MOVE_DOWN); } ! private static void loadImage(String key) { URL url = null; try { url = new URL(context, bundle.getString(key)); ! } catch (MalformedURLException e) { ! e.printStackTrace(System.err); } ! ImageDescriptor descriptor = ! ImageDescriptor.createFromURL(url); imageRegistry.put(key, descriptor); } ! public static Image getImage(String key) { return getDescriptor(key).createImage(true); } ! public static ImageDescriptor getDescriptor(String key) { return imageRegistry.getDescriptor(key); --- 54,91 ---- ioex.printStackTrace(System.err); } ! loadImages(); } ! public static void loadResources(String path) { loadResources(Display.getCurrent(), path); } ! private static void loadImages() { ! loadImage(IMG_NEW_PROJECT_WIZBAN); ! loadImage(IMG_CLASSPATH_WIZBAN); ! loadImage(IMG_MAIN_CLASS_WIZBAN); ! loadImage(IMG_JRE_WIZBAN); ! loadImage(IMG_EXE_WIZBAN); ! loadImage(IMG_NEW_PROJECT); ! loadImage(IMG_MOVE_UP); ! loadImage(IMG_MOVE_DOWN); } ! private static void loadImage(String key) { URL url = null; try { url = new URL(context, bundle.getString(key)); ! } catch (MalformedURLException muex) { ! muex.printStackTrace(System.err); } ! ImageDescriptor descriptor = ImageDescriptor.createFromURL(url); imageRegistry.put(key, descriptor); } ! public static Image getImage(String key) { return getDescriptor(key).createImage(true); } ! public static ImageDescriptor getDescriptor(String key) { return imageRegistry.getDescriptor(key); Index: MainWindow.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/swtgui/MainWindow.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MainWindow.java 3 Dec 2003 19:02:59 -0000 1.1 --- MainWindow.java 11 Mar 2004 13:07:58 -0000 1.2 *************** *** 5,41 **** import java.io.File; - import java.io.IOException; import net.charabia.jsmoothgen.application.JSmoothModelBean; - import net.charabia.jsmoothgen.application.JSmoothModelPersistency; - import net.charabia.jsmoothgen.application.gui.MainController; import net.charabia.jsmoothgen.skeleton.SkeletonList; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.window.ApplicationWindow; import org.eclipse.swt.SWT; - import org.eclipse.swt.widgets.Display; - import org.eclipse.swt.widgets.FileDialog; - import org.eclipse.swt.widgets.Shell; /** * @author Dumon */ ! public class MainWindow extends ApplicationWindow implements MainController { ! private static final String FILE_ITEM = "File"; ! private static final String PROJECT_ITEM = "Project"; ! ! private File m_projectFile; ! private SkeletonList m_skeletonList; ! public MainWindow() { super(null); setBlockOnOpen(true); addMenuBar(); ! } ! ! public static void main(String[] args) { ! new MainWindow().open(); } --- 5,43 ---- import java.io.File; import net.charabia.jsmoothgen.application.JSmoothModelBean; import net.charabia.jsmoothgen.skeleton.SkeletonList; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.MenuManager; + import org.eclipse.jface.action.ToolBarManager; import org.eclipse.jface.window.ApplicationWindow; + import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.SWT; /** * @author Dumon */ ! public class MainWindow extends ApplicationWindow { ! private static final String STR_FILE_ITEM = "File"; ! private static final String STR_PROJECT_ITEM = "Project"; ! private static final String STR_NEW_PROJECT = "New Project..."; ! private static final String STR_TOOLTIP_NEW_PROJECT = "New Project"; ! ! private static final String DIR_SKELETON = "skeletons"; ! ! private Action actionNewProject = new NewProjectAction(); ! ! private SkeletonList skeletonList; ! private JSmoothModelBean model; ! private File projectFile; ! public MainWindow() { super(null); setBlockOnOpen(true); addMenuBar(); ! addToolBar(SWT.FLAT | SWT.NO_FOCUS); ! ! skeletonList = new SkeletonList(new File(DIR_SKELETON)); } *************** *** 44,112 **** */ protected MenuManager createMenuManager() { ! MenuManager mainMenu = new MenuManager(); ! MenuManager fileMenu = new MenuManager(FILE_ITEM); ! fileMenu.add(new NewProjectAction()); ! fileMenu.add(new OpenProjectAction()); mainMenu.add(fileMenu); - MenuManager projectMenu = new MenuManager(PROJECT_ITEM); - mainMenu.add(projectMenu); - return mainMenu; } /* (non-Javadoc) ! * @see net.charabia.jsmoothgen.application.gui.MainController#getSkeletonList() ! */ ! public SkeletonList getSkeletonList() { ! return m_skeletonList; ! } ! ! /* (non-Javadoc) ! * @see net.charabia.jsmoothgen.application.gui.MainController#setStateText(java.lang.String) */ ! public void setStateText(String text) { ! } ! ! class OpenProjectAction extends Action { ! private static final String NAME = "Open..."; ! ! public OpenProjectAction() { ! super(NAME); ! } ! ! public void run() { ! Shell wShell = Display.getCurrent().getActiveShell(); ! FileDialog fileDialog = ! new FileDialog(wShell, SWT.OPEN); ! String[] extensions = new String[] { "*.jsmooth" }; ! fileDialog.setFilterExtensions(extensions); ! String sFile = fileDialog.open(); ! if (sFile == null) { ! return; ! } ! m_projectFile = new File(sFile); ! ! JSmoothModelBean model = null; ! try { ! model = ! JSmoothModelPersistency.load( ! m_projectFile); ! } catch (IOException e) { ! e.printStackTrace(); ! } ! } } class NewProjectAction extends Action { - private static final String NAME = "New"; - public NewProjectAction() { ! super(NAME); } public void run() { ! m_projectFile = null; } } --- 46,78 ---- */ protected MenuManager createMenuManager() { ! MenuManager mainMenu = super.createMenuManager(); ! MenuManager fileMenu = new MenuManager(STR_FILE_ITEM); ! fileMenu.add(actionNewProject); mainMenu.add(fileMenu); return mainMenu; } /* (non-Javadoc) ! * @see org.eclipse.jface.window.ApplicationWindow#createToolBarManager(int) */ ! protected ToolBarManager createToolBarManager(int style) { ! ToolBarManager toolbar = super.createToolBarManager(style); ! toolbar.add(actionNewProject); ! return toolbar; } class NewProjectAction extends Action { public NewProjectAction() { ! super(STR_NEW_PROJECT); ! String key = JSmoothResources.IMG_NEW_PROJECT; ! setImageDescriptor(JSmoothResources.getDescriptor(key)); ! setToolTipText(STR_TOOLTIP_NEW_PROJECT); } public void run() { ! WizardDialog wizard = new WizardDialog(getShell(), new NewProjectWizard()); ! wizard.open(); } } Index: NewProjectWizard.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/swtgui/NewProjectWizard.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NewProjectWizard.java 23 Dec 2003 18:32:10 -0000 1.4 --- NewProjectWizard.java 11 Mar 2004 13:07:58 -0000 1.5 *************** *** 4,7 **** --- 4,9 ---- package net.charabia.jsmoothgen.application.swtgui; + import net.charabia.jsmoothgen.application.JSmoothModelBean; + import org.eclipse.jface.wizard.Wizard; *************** *** 11,23 **** public class NewProjectWizard extends Wizard { public NewProjectWizard() { ! setWindowTitle("New Project"); ! ! addPage(new ProjectFileWizardPage()); ! addPage(new ClasspathWizardPage()); ! addPage(new MainClassWizardPage()); ! addPage(new JRESearchWizardPage()); ! addPage(new JREBundleWizardPage()); ! addPage(new ExecutableWizardPage()); } --- 13,21 ---- public class NewProjectWizard extends Wizard { + private JSmoothModelBean model; + public NewProjectWizard() { ! setWindowTitle("New JSmooth Project"); ! model = new JSmoothModelBean(); } *************** *** 26,31 **** */ public boolean performFinish() { ! // TODO Auto-generated method stub ! return false; } --- 24,40 ---- */ public boolean performFinish() { ! return true; ! } ! ! /* (non-Javadoc) ! * @see org.eclipse.jface.wizard.IWizard#addPages() ! */ ! public void addPages() { ! addPage(new ProjectFileWizardPage()); ! addPage(new ClasspathWizardPage()); ! addPage(new MainClassWizardPage()); ! addPage(new JRESearchWizardPage()); ! addPage(new JREBundleWizardPage()); ! addPage(new ExecutableWizardPage()); } Index: ClasspathWizardPage.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/swtgui/ClasspathWizardPage.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ClasspathWizardPage.java 23 Dec 2003 18:32:10 -0000 1.3 --- ClasspathWizardPage.java 11 Mar 2004 13:07:58 -0000 1.4 *************** *** 4,14 **** package net.charabia.jsmoothgen.application.swtgui; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; ! import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.List; --- 4,20 ---- package net.charabia.jsmoothgen.application.swtgui; + import java.io.File; + import java.util.Arrays; + import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; ! import org.eclipse.swt.events.SelectionAdapter; ! import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; + import org.eclipse.swt.widgets.DirectoryDialog; + import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.List; *************** *** 17,28 **** */ public class ClasspathWizardPage extends WizardPage { ! private static final int BUTTON_EXTRA_WIDTH = 6; ! private static final int CLASSPATH_HEIGHT = 10; ! private static final String JAVA_APP_WIZBAN = JSmoothResources.JAVA_APP_WIZBAN; ! private static final String ADD_ITEM = JSmoothResources.ADD_ITEM; ! private static final String REMOVE_ITEM = JSmoothResources.REMOVE_ITEM; ! private static final String EDIT_ITEM = JSmoothResources.EDIT_ITEM; ! private static final String MOVE_UP = JSmoothResources.MOVE_UP; ! private static final String MOVE_DOWN = JSmoothResources.MOVE_DOWN; public ClasspathWizardPage() { --- 23,44 ---- */ public class ClasspathWizardPage extends WizardPage { ! ! private static final String STRING_ADD_JAR = "Add JAR..."; ! private static final String STRING_ADD_CLASS_FOLDER = "Add Class Folder..."; ! private static final String STRING_EDIT = "Edit..."; ! private static final String STRING_REMOVE = "Remove"; ! ! private static final String WIDGET_ADD_BUTTON = "AddButton"; ! private static final String WIDGET_BUTTON_BAR = "ButtonBar"; ! private static final String WIDGET_EDIT_BUTTON = "EditButton"; ! private static final String WIDGET_REMOVE_BUTTON = "RemoveButton"; ! private static final String WIDGET_LIST = "List"; ! private static final String WIDGET_TOP = "Top"; ! ! private Button btnAddJar; ! private Button btnAddClassFolder; ! private Button btnRemove; ! private Button btnEdit; ! private List lstClasspath; public ClasspathWizardPage() { *************** *** 30,99 **** setTitle("Classpath"); setMessage("The Java application classpath."); ! setImageDescriptor( ! JSmoothResources.getDescriptor(JAVA_APP_WIZBAN)); } ! /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { ! GridLayout layout = null; ! GridData layoutData = null; ! Composite comp = new Composite(parent, SWT.NONE); ! layout = new GridLayout(2, false); ! comp.setLayout(layout); ! createClasspath(comp); ! setControl(comp); ! } ! ! private int computeButtonWidth(Button button, String text) { ! initializeDialogUnits(button); ! return convertWidthInCharsToPixels( ! text.toCharArray().length + BUTTON_EXTRA_WIDTH); ! } ! ! private void createClasspath(Composite parent) { ! GridData layoutData = null; ! List list = new List(parent, SWT.BORDER); ! layoutData = new GridData(GridData.FILL_BOTH); ! list.setLayoutData(layoutData); ! Composite classpathButtonBar = new Composite(parent, SWT.NONE); ! classpathButtonBar.setLayout(new GridLayout()); ! layoutData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); ! layoutData.heightHint = ! list.getItemHeight() * CLASSPATH_HEIGHT; ! classpathButtonBar.setLayoutData(layoutData); ! createButtonForClasspath(classpathButtonBar, "Add..."); ! createButtonForClasspath(classpathButtonBar, "Remove..."); ! createButtonForClasspath(classpathButtonBar, "Edit..."); } ! private Button createButtonForClasspath( ! Composite parent, ! String text, ! Image image) { ! ! Button button = new Button(parent, SWT.PUSH); ! GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); ! layoutData.widthHint = computeButtonWidth(button, text); ! button.setLayoutData(layoutData); ! button.setText(text); ! button.setImage(image); ! return button; } ! ! private Button createButtonForClasspath(Composite parent, String text) { ! return createButtonForClasspath(parent, text, null); } ! ! private Button createButtonForClasspath(Composite parent, Image image) { ! return createButtonForClasspath(parent, "", image); } --- 46,201 ---- setTitle("Classpath"); setMessage("The Java application classpath."); ! String key = JSmoothResources.IMG_CLASSPATH_WIZBAN; ! setImageDescriptor(JSmoothResources.getDescriptor(key)); } ! /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { ! Composite composite = new Composite(parent, SWT.NONE); ! GridLayout layout = new GridLayout(2, false); ! composite.setLayout(layout); ! lstClasspath = new List(composite, ! SWT.BORDER | ! SWT.H_SCROLL | ! SWT.V_SCROLL | ! SWT.SINGLE); ! GridData layoutData = new GridData(GridData.FILL_BOTH); ! lstClasspath.setLayoutData(layoutData); ! Composite buttonBar = new Composite(composite, SWT.NONE); ! layout = new GridLayout(); ! layout.marginHeight = 0; ! layout.marginWidth = 0; ! buttonBar.setLayout(layout); ! layoutData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); ! buttonBar.setLayoutData(layoutData); ! btnAddJar = new Button(buttonBar, SWT.PUSH); ! btnAddJar.setSize(Util.computeWidth(btnAddJar, STRING_ADD_JAR), SWT.DEFAULT); ! btnAddJar.setText(STRING_ADD_JAR); ! layoutData = new GridData(GridData.FILL_HORIZONTAL); ! layoutData.widthHint = btnAddJar.getSize().x; ! btnAddJar.setLayoutData(layoutData); ! btnAddJar.addSelectionListener(new SelectionAdapter(){ ! /* (non-Javadoc) ! * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) ! */ ! public void widgetSelected(SelectionEvent e) { ! addJarButtonPressed(); ! } ! }); ! btnAddClassFolder = new Button(buttonBar, SWT.PUSH); ! btnAddClassFolder.setSize(Util.computeWidth(btnAddClassFolder, STRING_ADD_CLASS_FOLDER), SWT.DEFAULT); ! btnAddClassFolder.setText(STRING_ADD_CLASS_FOLDER); ! layoutData = new GridData(GridData.FILL_HORIZONTAL); ! layoutData.widthHint = btnAddClassFolder.getSize().x; ! btnAddClassFolder.setLayoutData(layoutData); ! btnAddClassFolder.addSelectionListener(new SelectionAdapter(){ ! /* (non-Javadoc) ! * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) ! */ ! public void widgetSelected(SelectionEvent e) { ! addClassFolderButtonPressed(); ! } ! }); ! btnEdit = new Button(buttonBar, SWT.PUSH); ! btnEdit.setSize(Util.computeWidth(btnEdit, STRING_EDIT), SWT.DEFAULT); ! btnEdit.setText(STRING_EDIT); ! layoutData = new GridData(GridData.FILL_HORIZONTAL); ! layoutData.widthHint = btnEdit.getSize().x; ! btnEdit.setLayoutData(layoutData); ! btnEdit.addSelectionListener(new SelectionAdapter(){ ! /* (non-Javadoc) ! * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) ! */ ! public void widgetSelected(SelectionEvent e) { ! editButtonButtonPressed(); ! } ! }); ! btnRemove = new Button(buttonBar, SWT.PUSH); ! btnRemove.setSize(Util.computeWidth(btnRemove, STRING_REMOVE), SWT.DEFAULT); ! btnRemove.setText(STRING_REMOVE); ! layoutData = new GridData(GridData.FILL_HORIZONTAL); ! layoutData.widthHint = btnRemove.getSize().x; ! btnRemove.setLayoutData(layoutData); ! btnRemove.addSelectionListener(new SelectionAdapter(){ ! /* (non-Javadoc) ! * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) ! */ ! public void widgetSelected(SelectionEvent e) { ! removeButtonPressed(); ! } ! }); ! ! setControl(composite); } ! /** ! * Called when the "Edit" btton is pressed. It checks whether the ! * selected list item is a folder or a file. Then, based on ! * the result, the event is delegated to addJarButtonPressed() or ! * addClassFolderPressed(). ! * Within the dialogs that pop up, the respective folder or file is ! * selected. ! */ ! private void editButtonButtonPressed() { ! String[] items = lstClasspath.getSelection(); ! // No selection. ! if(items.length == 0) return; ! ! // We now there can be max one item. ! // Due to the SWT.SINGLE style of the list. ! File file = new File(items[0]); ! if(file.isFile()) { ! addJarButtonPressed(); ! } ! if(file.isDirectory()) { ! addClassFolderButtonPressed(); ! } } ! ! /** ! * Called when the "Remove" button is pressed. ! * Deletes all the selected lines from the list. ! */ ! private void removeButtonPressed() { ! for (int i = 0; i < lstClasspath.getItemCount(); i++) { ! if(lstClasspath.isSelected(i)) lstClasspath.remove(i); ! } } ! ! private void addJarButtonPressed() { ! FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); ! String file = dialog.open(); ! ! // True if the dialog _wasn't_ cancelled. ! if(file != null) { ! String[] items = lstClasspath.getItems(); ! java.util.List list = Arrays.asList(items); ! if(!list.contains(file)) { ! lstClasspath.add(file); ! } ! } ! } ! ! private void addClassFolderButtonPressed() { ! DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.OPEN); ! String folder = dialog.open(); ! ! // True if the dialog _wasn't_ cancelled. ! if(folder != null) { ! String[] items = lstClasspath.getItems(); ! java.util.List list = Arrays.asList(items); ! if(!list.contains(folder)) { ! lstClasspath.add(folder); ! } ! } } |
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/swtgui/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15675/src/net/charabia/jsmoothgen/application/swtgui/tests Added Files: MainWindow_Tests.java NewProjectWizard_Tests.java Removed Files: NewProjectWizard_VisualTests.java Log Message: Wrote the first code for the Main SWT Window. The New Project Wizard now is launched through a menu/toolbar action. --- NEW FILE: MainWindow_Tests.java --- /* * Created on Nov 21, 2003 */ package net.charabia.jsmoothgen.application.swtgui.tests; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import net.charabia.jsmoothgen.application.swtgui.JSmoothResources; import net.charabia.jsmoothgen.application.swtgui.MainWindow; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; /** * @author Dumon */ public class MainWindow_Tests extends TestCase { private Shell shell; // The trailing "/" required ! private String installPath = "C:/eclipse-2.1.2/workspace/jsmooth/"; public void testVisual() { new MainWindow().open(); } /* (non-Javadoc) * @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { shell = Display.getDefault().getActiveShell(); JSmoothResources.loadResources(installPath); } public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(MainWindow_Tests.class); } } --- NEW FILE: NewProjectWizard_Tests.java --- /* * Created on Nov 21, 2003 */ package net.charabia.jsmoothgen.application.swtgui.tests; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import net.charabia.jsmoothgen.application.swtgui.JSmoothResources; import net.charabia.jsmoothgen.application.swtgui.NewProjectWizard; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; /** * @author Dumon */ public class NewProjectWizard_Tests extends TestCase { private Shell shell; // The trailing "/" required ! private String installPath = "C:/eclipse-2.1.1/workspace/jsmooth/"; public void testVisual() { NewProjectWizard newProjectWizard = new NewProjectWizard(); WizardDialog wizardDialog = new WizardDialog(shell, newProjectWizard); wizardDialog.setMinimumPageSize(50, 50); wizardDialog.open(); } /* (non-Javadoc) * @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { shell = Display.getDefault().getActiveShell(); JSmoothResources.loadResources(installPath); } public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } public static Test suite() { return new TestSuite(NewProjectWizard_Tests.class); } } --- NewProjectWizard_VisualTests.java DELETED --- |
From: <re...@us...> - 2004-03-08 10:57:07
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13333/src/net/charabia/jsmoothgen/application Modified Files: ExeCompiler.java Log Message: dead code removed Index: ExeCompiler.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/ExeCompiler.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ExeCompiler.java 23 Nov 2003 19:11:03 -0000 1.17 --- ExeCompiler.java 8 Mar 2004 10:32:51 -0000 1.18 *************** *** 158,161 **** --- 158,162 ---- ByteBuffer propdata = convert(props); resb = resdir.replaceResource(skel.getResourceCategory(), skel.getResourcePropsId(), 1033, propdata); + if (data.getIconLocation() != null) { *************** *** 295,315 **** } - // System.out.println("BEFORE..."); - // for (int y=0; y<height; y++) - // { - // for (int x=0; x<width; x++) - // { - // // int rgb = ((BufferedImage)img).getRGB(x, y); - // int rgb = data[x][y]; - // if (((rgb>>24)&0xFF)>0) - // { - // // System.out.print("."); - // } - // else - // System.out.print("*"); - // } - // // System.out.println(""); - // } - int[][] savedata = new int[width][height]; --- 296,299 ---- *************** *** 329,341 **** cmap[(i*4)+3] = (byte) 0xFF; } - // System.out.println("Quantized image to " + palette.length + " colors"); IndexColorModel colmodel = new IndexColorModel(8, palette.length, cmap, 0, true, 0); - // System.out.println("INDEX0 = " + colmodel.getRGB(0)); - // BufferedImage result = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_INDEXED); BufferedImage result = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); - - // result.setRGB(0,0, width, height, pixelbuffer, 0, width); - // // The normal manner of quantizing would be to run --- 313,319 ---- *************** *** 369,434 **** } - // System.out.println("COLORS TOTAL: " + set.size()); - - Hashtable set2 = calculateColorCount(result); - // System.out.println("COLORS TOTAL 2: " + set2.size()); - - // System.out.println("INDEX0+ = " + colmodel.getRGB(0)); - // System.out.println("AFTER..."); - // WritableRaster raster = result.getRaster(); - // for (int y=0; y<result.getHeight(); y++) - // { - // for (int x=0; x<result.getWidth(); x++) - // { - // if (((savedata[x][y]>>24)&0xFF) == 0) - // { - // System.out.print("."); - // // result.setRGB(x,y,0x00FFFFFF); - // raster.setSample(x,y,0,0); - // } - // else - // { - // System.out.print("*"); - // } - // } - // System.out.println(""); - // } - - // System.out.println("SAMPLES..."); - // raster = result.getRaster(); - // for (int y=0; y<result.getHeight(); y++) - // { - // for (int x=0; x<result.getWidth(); x++) - // { - // int pix = raster.getSample(x,y,0); - // if (pix == 0) - // { - // System.out.print("."); - // } - // else - // { - // System.out.print("*"); - // } - // } - // System.out.println(""); - // } - - // System.out.println("FINAL..."); - // for (int y=0; y<result.getHeight(); y++) - // { - // for (int x=0; x<result.getWidth(); x++) - // { - // int rgb = result.getRGB(x,y); - // if (((rgb>>24)&0xFF) == 0) - // { - // System.out.print("."); - // } - // else - // { - // System.out.print("*"); - // } - // } - // System.out.println(""); - // } return result; --- 347,350 ---- |
From: <re...@us...> - 2004-03-07 19:44:43
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13828/src/net/charabia/jsmoothgen/application Modified Files: PropertiesBuilder.java Log Message: fixed header + added a few comments Index: PropertiesBuilder.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/PropertiesBuilder.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PropertiesBuilder.java 19 Nov 2003 22:17:25 -0000 1.12 --- PropertiesBuilder.java 7 Mar 2004 19:20:53 -0000 1.13 *************** *** 1,7 **** /* ! * PropertiesBuilder.java ! * ! * Created on 9 août 2003, 19:36 ! */ package net.charabia.jsmoothgen.application; --- 1,21 ---- /* ! 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; *************** *** 15,18 **** --- 29,44 ---- public class PropertiesBuilder { + /** + * Creates a text containing all the relevant properties of a + * JSmoothModelBean object. The properties are output in the form + * "key=value". + * <p> + * + * Note that all the paths are converted to be made relative to + * the basedir parameter provided. All the paths converted are + * expected to be relative to the targetted executable binary + * (before the conversion is applied, that is). + * + */ static public String makeProperties(File basedir, JSmoothModelBean obj) { *************** *** 119,123 **** return out.toString(); } ! static public String getRenormalizedPathIfNeeded(String value, File previousbasedir, File newbasedir) { --- 145,153 ---- return out.toString(); } ! ! /** ! * Converts a path relative to previousbasedir into a path ! * relative to newbasedir. ! */ static public String getRenormalizedPathIfNeeded(String value, File previousbasedir, File newbasedir) { *************** *** 130,134 **** File abs = new File(previousbasedir, value).getAbsoluteFile(); File n = JSmoothModelPersistency.makePathRelativeIfPossible(newbasedir, abs); - // System.out.println("PROPERTY RENORM " + value + " -> " + n.toString()); return n.toString(); --- 160,163 ---- |
From: <re...@us...> - 2004-03-06 22:45:05
|
Update of /cvsroot/jsmooth/jsmooth In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25591 Modified Files: build.xml Log Message: added changelog file to dist Index: build.xml =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/build.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** build.xml 6 Mar 2004 10:08:43 -0000 1.19 --- build.xml 6 Mar 2004 22:21:59 -0000 1.20 *************** *** 218,221 **** --- 218,222 ---- <copy todir="${dist}" file="${tmp}/docs/readme.txt"/> <copy todir="${dist}" file="${tmp}/docs/license.txt"/> + <copy todir="${dist}" file="Changelog"/> <!-- Compile the wrappers --> |
From: <re...@us...> - 2004-03-06 22:40:59
|
Update of /cvsroot/jsmooth/jsmooth In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25025 Modified Files: build.number Changelog Log Message: -nt Index: build.number =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/build.number,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** build.number 6 Mar 2004 20:48:55 -0000 1.15 --- build.number 6 Mar 2004 22:17:43 -0000 1.16 *************** *** 1,3 **** #Build Number for ANT. Do not edit! ! #Sat Mar 06 20:47:30 GMT+01:00 2004 ! build.number=83 --- 1,3 ---- #Build Number for ANT. Do not edit! ! #Sat Mar 06 22:03:51 GMT+01:00 2004 ! build.number=84 Index: Changelog =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/Changelog,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Changelog 6 Mar 2004 08:59:25 -0000 1.19 --- Changelog 6 Mar 2004 22:17:43 -0000 1.20 *************** *** 11,14 **** --- 11,18 ---- - adds sorting of the registry JVMs from highest version number to lower (thus, most recent JVMs are tried first). + - Applied patch #883175 (make jsmooth ant task more verbose). + - Implemented feature #895967 (Command Line pass-through). + - fixed bug #880441 (Jvm search from PATH environment variable) + - fixed bug #880439 (Jvm search from environment variables) 0.9.5 |
From: <re...@us...> - 2004-03-06 22:33:39
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/commonjava In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23932/skeletons/commonjava Modified Files: JavaMachineManager.cpp SunJVMLauncher.cpp SunJVMLauncher.h Log Message: fixed bug #880441(Jvm search from PATH environment variable) and bug #880441 (Jvm search from PATH environment variable) Index: JavaMachineManager.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/JavaMachineManager.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** JavaMachineManager.cpp 6 Mar 2004 20:48:07 -0000 1.10 --- JavaMachineManager.cpp 6 Mar 2004 22:10:34 -0000 1.11 *************** *** 27,32 **** m_registryVms = JVMRegistryLookup::lookupJVM(); m_javahomeVm = JVMEnvVarLookup::lookupJVM("JAVA_HOME"); ! m_jrepathVm = JVMEnvVarLookup::lookupJVM("JRE_PATH"); ! m_jdkpathVm = JVMEnvVarLookup::lookupJVM("JDK_PATH"); if (resman.getProperty("bundledvm").length() > 0) --- 27,32 ---- m_registryVms = JVMRegistryLookup::lookupJVM(); m_javahomeVm = JVMEnvVarLookup::lookupJVM("JAVA_HOME"); ! m_jrepathVm = JVMEnvVarLookup::lookupJVM("JRE_HOME"); ! m_jdkpathVm = JVMEnvVarLookup::lookupJVM("JDK_HOME"); if (resman.getProperty("bundledvm").length() > 0) *************** *** 155,162 **** } else if (*i == "jrepath") { ! DEBUG("- Trying to use JREPATH"); if (m_jrepathVm.size()>0) { ! if (m_jrepathVm[0].runProc(m_resman, dontUseConsole, "jrepath")) { return true; --- 155,162 ---- } else if (*i == "jrepath") { ! DEBUG("- Trying to use JRE_HOME"); if (m_jrepathVm.size()>0) { ! if (m_jrepathVm[0].runProc(m_resman, dontUseConsole, "jrehome")) { return true; *************** *** 165,178 **** } else if (*i == "jdkpath") { ! DEBUG("- Trying to use JDKPATH"); if (m_jdkpathVm.size()>0) { ! if (m_jdkpathVm[0].runProc(m_resman, dontUseConsole, "jdkpath")) { return true; } } ! } } DEBUG("Couldn't run any suitable JVM!"); return false; --- 165,192 ---- } else if (*i == "jdkpath") { ! DEBUG("- Trying to use JDK_HOME"); if (m_jdkpathVm.size()>0) { ! if (m_jdkpathVm[0].runProc(m_resman, dontUseConsole, "jdkhome")) { return true; } } ! } else if (*i == "exepath") ! { ! DEBUG("- Trying to use PATH"); ! string exename = dontUseConsole?"javaw.exe":"java.exe"; ! SunJVMLauncher launcher; ! launcher.VmVersion = launcher.guessVersionByProcess(exename); ! if (launcher.VmVersion.isValid()) ! { ! DEBUG("Found valid java machine " + exename + " on PATH (" + launcher.VmVersion.toString() + ")"); ! Version v12("1.2.0"); ! if (launcher.runExe(exename, false, m_resman, dontUseConsole, (launcher.VmVersion<v12)?"1.1":"1.2", "path")) ! return true; ! } ! } } + DEBUG("Couldn't run any suitable JVM!"); return false; Index: SunJVMLauncher.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/SunJVMLauncher.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SunJVMLauncher.cpp 6 Mar 2004 13:43:59 -0000 1.14 --- SunJVMLauncher.cpp 6 Mar 2004 22:10:34 -0000 1.15 *************** *** 494,499 **** bool SunJVMLauncher::runExe(const string& exepath, bool forceFullClasspath, ResourceManager& resource, bool noConsole, const string& version, const string& origin) { - if (FileUtils::fileExists(exepath)) - { DEBUG("Running new proc for " + exepath); --- 494,497 ---- *************** *** 599,603 **** DEBUG("Can't run " + exeline); } - } return false; --- 597,600 ---- Index: SunJVMLauncher.h =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/SunJVMLauncher.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SunJVMLauncher.h 5 Mar 2004 22:52:51 -0000 1.6 --- SunJVMLauncher.h 6 Mar 2004 22:10:34 -0000 1.7 *************** *** 102,105 **** --- 102,107 ---- friend bool operator < (const SunJVMLauncher& v1, const SunJVMLauncher& v2); + bool runExe(const string& exepath, bool forceFullClasspath, ResourceManager& resource, bool noConsole, const std::string& version, const string& origin); + private: *************** *** 108,113 **** bool runVM11proc(ResourceManager& resource, bool noConsole, const string& origin); bool runVM12proc(ResourceManager& resource, bool noConsole, const string& origin); - - bool runExe(const string& exepath, bool forceFullClasspath, ResourceManager& resource, bool noConsole, const std::string& version, const string& origin); std::string sizeToString(int size); --- 110,113 ---- |
From: <re...@us...> - 2004-03-06 21:20:10
|
Update of /cvsroot/jsmooth/jsmooth/ant/net/charabia/jsmooth/ant In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10785/ant/net/charabia/jsmooth/ant Modified Files: JSmoothGen.java Log Message: Applied patch #883175 (Make jsmooth ant task more verbose) Index: JSmoothGen.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/ant/net/charabia/jsmooth/ant/JSmoothGen.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JSmoothGen.java 21 Sep 2003 14:07:55 -0000 1.1 --- JSmoothGen.java 6 Mar 2004 20:57:09 -0000 1.2 *************** *** 30,33 **** --- 30,34 ---- private java.io.File m_prjfile; private java.io.File m_skeletonRoot; + private boolean verbose; public void setProject(java.io.File prjfile) *************** *** 41,44 **** --- 42,50 ---- } + public void setVerbose(boolean val) + { + verbose = val; + } + public void execute() throws org.apache.tools.ant.BuildException { *************** *** 64,68 **** File basedir = prj.getParentFile(); - SkeletonList skelList = new SkeletonList(m_skeletonRoot); --- 70,73 ---- *************** *** 71,78 **** File skelroot = skelList.getDirectory(skel); ! ExeCompiler compiler = new ExeCompiler(); ! compiler.compile(skelroot, skel, basedir, model, out); - log("Java application wrapped in " + model.getExecutableName()); } catch (Exception exc) { --- 76,96 ---- File skelroot = skelList.getDirectory(skel); ! final ExeCompiler compiler = new ExeCompiler(); ! if (verbose) { ! compiler.addListener(new ExeCompiler.StepListener() { ! public void complete() {} ! public void failed() {} ! ! public void setNewState(int percentComplete, String state) { ! log("jsmooth: " + state + " ( " + percentComplete + "%)"); ! } ! }); ! } ! ! if (compiler.compile(skelroot, skel, basedir, model, out)) ! log("Java application wrapped in " + model.getExecutableName()); ! else ! log("jsmoothgen failed: " + compiler.getErrors()); } catch (Exception exc) { |
From: <re...@us...> - 2004-03-06 21:11:56
|
Update of /cvsroot/jsmooth/jsmooth In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9098 Modified Files: build.number Log Message: -nt Index: build.number =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/build.number,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** build.number 6 Mar 2004 10:00:49 -0000 1.14 --- build.number 6 Mar 2004 20:48:55 -0000 1.15 *************** *** 1,3 **** #Build Number for ANT. Do not edit! ! #Sat Mar 06 10:57:23 GMT+01:00 2004 ! build.number=77 --- 1,3 ---- #Build Number for ANT. Do not edit! ! #Sat Mar 06 20:47:30 GMT+01:00 2004 ! build.number=83 |
From: <re...@us...> - 2004-03-06 21:11:08
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/commonjava In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8925/skeletons/commonjava Modified Files: JavaMachineManager.cpp Log Message: fixed erroneous use of un-initialized variable hWnd Index: JavaMachineManager.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/JavaMachineManager.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** JavaMachineManager.cpp 5 Mar 2004 22:52:51 -0000 1.9 --- JavaMachineManager.cpp 6 Mar 2004 20:48:07 -0000 1.10 *************** *** 175,179 **** } } ! return false; } --- 175,179 ---- } } ! DEBUG("Couldn't run any suitable JVM!"); return false; } |
From: <re...@us...> - 2004-03-06 21:11:07
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/simplewrap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8925/skeletons/simplewrap Modified Files: main.cpp Log Message: fixed erroneous use of un-initialized variable hWnd Index: main.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/simplewrap/main.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** main.cpp 6 Mar 2004 13:51:42 -0000 1.19 --- main.cpp 6 Mar 2004 20:48:07 -0000 1.20 *************** *** 56,63 **** int nFunsterStil) { - HWND hwnd; /* This is the handle for our window */ - MSG messages; /* Here messages to the application are saved */ - WNDCLASSEX wincl; /* Data structure for the windowclass */ - atexit(lastExit); --- 56,59 ---- *************** *** 96,104 **** if (man.run(true, preferDLL) == false) { std::string errmsg = globalResMan->getProperty("skel_Message"); std::string url = globalResMan->getProperty("skel_URL"); ! if (MessageBox(hwnd, errmsg.c_str(), "No Java?", MB_OKCANCEL|MB_ICONQUESTION|MB_APPLMODAL) == IDOK) { ! ShellExecute(hwnd, "open", url.c_str(), NULL, "", 0); } } --- 92,101 ---- if (man.run(true, preferDLL) == false) { + DEBUG("Displaying error message to user..."); std::string errmsg = globalResMan->getProperty("skel_Message"); std::string url = globalResMan->getProperty("skel_URL"); ! if (MessageBox(NULL, errmsg.c_str(), "No Java?", MB_OKCANCEL|MB_ICONQUESTION|MB_APPLMODAL) == IDOK) { ! ShellExecute(NULL, "open", url.c_str(), NULL, "", 0); } } *************** *** 108,112 **** /* The program return-value is 0 - The value that PostQuitMessage() gave */ ! return messages.wParam; } --- 105,109 ---- /* The program return-value is 0 - The value that PostQuitMessage() gave */ ! return 0; } |
From: <re...@us...> - 2004-03-06 18:54:27
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/consolewrapper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14282/skeletons/consolewrapper Modified Files: main.cpp Log Message: added command line arguments support Index: main.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/consolewrapper/main.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** main.cpp 4 Mar 2004 22:35:01 -0000 1.9 --- main.cpp 6 Mar 2004 18:31:30 -0000 1.10 *************** *** 65,69 **** } ! globalResMan->setProperty(string(ResourceManager::KEY_ARGUMENTS), args); JavaMachineManager man(*globalResMan); --- 65,70 ---- } ! if (args.length() > 0) ! globalResMan->setProperty(string(ResourceManager::KEY_ARGUMENTS), args); JavaMachineManager man(*globalResMan); |
From: <re...@us...> - 2004-03-06 18:53:49
|
Update of /cvsroot/jsmooth/jsmooth/jsprj In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14101/jsprj Modified Files: prooftest.jsmooth Log Message: added command line arguments support Index: prooftest.jsmooth =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/jsprj/prooftest.jsmooth,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** prooftest.jsmooth 6 Mar 2004 08:59:47 -0000 1.2 --- prooftest.jsmooth 6 Mar 2004 18:30:51 -0000 1.3 *************** *** 7,10 **** --- 7,11 ---- <JVMSearchPath>exepath</JVMSearchPath> <JVMSearchPath>jview</JVMSearchPath> + <arguments>simpleargument "multiple tokens"</arguments> <embeddedJar>true</embeddedJar> <executableName>..\proof-test.exe</executableName> |
From: <re...@us...> - 2004-03-06 18:53:47
|
Update of /cvsroot/jsmooth/jsmooth/sample/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14101/sample/src Modified Files: JSmoothPropertiesDisplayer.java Log Message: added command line arguments support Index: JSmoothPropertiesDisplayer.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/sample/src/JSmoothPropertiesDisplayer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** JSmoothPropertiesDisplayer.java 12 Sep 2003 21:12:19 -0000 1.5 --- JSmoothPropertiesDisplayer.java 6 Mar 2004 18:30:51 -0000 1.6 *************** *** 14,21 **** public class JSmoothPropertiesDisplayer extends java.awt.Frame { ! /** Creates new form Frame */ ! public JSmoothPropertiesDisplayer() ! { initComponents(); displayInformation(); --- 14,22 ---- public class JSmoothPropertiesDisplayer extends java.awt.Frame { ! private String[] m_args; /** Creates new form Frame */ ! public JSmoothPropertiesDisplayer(String[] args) ! { ! m_args = args; initComponents(); displayInformation(); *************** *** 91,95 **** public static void main(String args[]) { ! new JSmoothPropertiesDisplayer().show(); } --- 92,96 ---- public static void main(String args[]) { ! new JSmoothPropertiesDisplayer(args).show(); } *************** *** 99,102 **** --- 100,111 ---- out.append("-- Sample --\n\n"); + out.append("Arguments passed on the command line: " + m_args.length + " \n"); + for (int i=0; i<m_args.length; i++) + { + out.append("" + i + ". " + m_args[i]); + out.append("\n"); + } + out.append("\n"); + out.append("Free Heap Memory: " + Runtime.getRuntime().freeMemory() + " bytes\n"); // out.append("Max Heap Memory: " + Runtime.getRuntime().maxMemory() + " bytes\n"); |
From: <re...@us...> - 2004-03-06 14:14:30
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/simplewrap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25341/skeletons/simplewrap Modified Files: main.cpp Log Message: minor update (added debug trace for command line arguments) Index: main.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/simplewrap/main.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** main.cpp 6 Mar 2004 13:31:52 -0000 1.18 --- main.cpp 6 Mar 2004 13:51:42 -0000 1.19 *************** *** 76,79 **** --- 76,80 ---- if ((lpszArgument!=NULL) && (strlen(lpszArgument)>0)) { + DEBUG(string("Setting arguments: ") + lpszArgument); // Note that this overwrites an existing KEY_ARGUMENTS globalResMan->setProperty(string(ResourceManager::KEY_ARGUMENTS), lpszArgument); |
From: <re...@us...> - 2004-03-06 14:13:40
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/commonjava In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25135/skeletons/commonjava Modified Files: Version.cpp Log Message: Removed a debug Index: Version.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/Version.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Version.cpp 2 Sep 2003 05:48:01 -0000 1.1 --- Version.cpp 6 Mar 2004 13:50:49 -0000 1.2 *************** *** 63,67 **** bool operator < (const Version& v1, const Version& v2) { - DEBUG("<version v1="+v1.toString() + " , v2="+v2.toString()); if ((v1.m_major == 0) && (v1.m_minor == 0) && (v1.m_sub == 0)) return true; --- 63,66 ---- |
From: <re...@us...> - 2004-03-06 14:06:48
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/commonjava In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23965/skeletons/commonjava Modified Files: SunJVMLauncher.cpp Log Message: removed WaitWithMessageLoop code Index: SunJVMLauncher.cpp =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/commonjava/SunJVMLauncher.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SunJVMLauncher.cpp 6 Mar 2004 13:29:54 -0000 1.13 --- SunJVMLauncher.cpp 6 Mar 2004 13:43:59 -0000 1.14 *************** *** 22,63 **** extern "C" { - - // - // Grabbed the function below in a MS KB, solves the issue of the - // WaitForSingleObject() blocking Windows Explorer - // - BOOL WaitWithMessageLoop(HANDLE hEvent) - { - DWORD dwRet; - MSG msg; - - while(1) - { - dwRet = MsgWaitForMultipleObjects( 1, // One event to wait for - &hEvent, // The array of events - FALSE, // Wait for 1 event - INFINITE, // Timeout value - QS_ALLINPUT); // Any message wakes up - if(dwRet == WAIT_OBJECT_0) - { - // The event was signaled, return - return TRUE; - } else if(dwRet == WAIT_OBJECT_0 + 1) - { - // There is a window message available. Dispatch it. - while(PeekMessage(&msg,NULL,NULL,NULL,PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } else - { - // Something else happened. Return. - return FALSE; - } - } - } - - static jint JNICALL myvprintf(FILE *fp, const char *format, va_list args) { --- 22,25 ---- *************** *** 629,634 **** { DEBUG("WAITING: " + StringUtils::toString(res)); ! // WaitForSingleObject(procinfo.hProcess, INFINITE); ! WaitWithMessageLoop(procinfo.hProcess); DEBUG("WAIT ENDED"); return true; --- 591,595 ---- { DEBUG("WAITING: " + StringUtils::toString(res)); ! WaitForSingleObject(procinfo.hProcess, INFINITE); DEBUG("WAIT ENDED"); return true; *************** *** 678,682 **** if (res != 0) { - // WaitWithMessageLoop(procinfo.hProcess); WaitForSingleObject(procinfo.hProcess, INFINITE); CloseHandle(tmph); --- 639,642 ---- |