Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 15768 invoked from network); 28 May 2002 07:05:16 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 28 May 2002 07:05:16 -0000 Received: (qmail 9966 invoked by uid 97); 28 May 2002 07:05:23 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 9905 invoked by uid 97); 28 May 2002 07:05:22 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 9893 invoked by uid 97); 28 May 2002 07:05:21 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Date: 28 May 2002 07:05:05 -0000 Message-ID: <20020528070505.28571.qmail@icarus.apache.org> From: donaldp@apache.org To: jakarta-ant-myrmidon-cvs@apache.org Subject: cvs commit: jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/frontends SwingUI.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N donaldp 02/05/28 00:05:05 Added: container/src/java/org/apache/myrmidon/frontends SwingUI.java Log: Start to create a basic SwingGUI for executing build files similar to junits SwingRunner Revision Changes Path 1.1 jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/frontends/SwingUI.java Index: SwingUI.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.myrmidon.frontends; import java.awt.Container; import java.awt.Font; import java.awt.Frame; import java.awt.TextField; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.TextEvent; import java.awt.event.TextListener; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingUtilities; import org.apache.myrmidon.Constants; class SwingUI extends JDialog { private static final Font PLAIN_FONT = new Font( "dialog", Font.PLAIN, 12 ); private JButton m_buildButton; private JProgressBar m_progressBar; private TextField m_fileField; private JCheckBox m_reloadLibsCheckBox; private JCheckBox m_reloadFileCheckBox; public SwingUI() { super( (Frame)null, Constants.BUILD_BANNER, true ); final Container contentPane = getContentPane(); final BoxLayout layout = new BoxLayout( contentPane, BoxLayout.Y_AXIS ); contentPane.setLayout( layout ); final JPanel entryPanel = createEntryPanel(); final JPanel statusPanel = createStatusPanel(); final JPanel resultsPanel = createResultsPanel(); contentPane.add( entryPanel ); contentPane.add( statusPanel ); contentPane.add( resultsPanel ); pack(); validate(); doLayout(); } private JPanel createResultsPanel() { final JPanel panel = new JPanel(); return panel; } private JPanel createStatusPanel() { final JPanel panel = new JPanel(); m_progressBar = new JProgressBar( 0, 300 ); panel.add( m_progressBar ); return panel; } private JPanel createEntryPanel() { final JPanel panel = new JPanel(); m_buildButton = createBuildButton(); m_fileField = createFileField(); m_reloadLibsCheckBox = new JCheckBox( "Reload Libraries", true ); m_reloadFileCheckBox = new JCheckBox( "Reload Build File", true ); panel.add( m_fileField ); panel.add( m_buildButton ); panel.add( m_reloadLibsCheckBox ); panel.add( m_reloadFileCheckBox ); return panel; } private TextField createFileField() { final TextField fileField = new TextField( "" ); fileField.selectAll(); fileField.requestFocus(); fileField.setFont( PLAIN_FONT ); fileField.setColumns( 40 ); final ActionListener actionListener = new ActionListener() { public void actionPerformed( final ActionEvent action ) { action_build(); } }; fileField.addActionListener( actionListener ); final TextListener textListener = new TextListener() { public void textValueChanged( final TextEvent event ) { file_textChanged(); } }; fileField.addTextListener( textListener ); return fileField; } private JButton createBuildButton() { final JButton button = new JButton( "Build" ); button.setToolTipText( "Build Project" ); final ActionListener actionListener = new ActionListener() { public void actionPerformed( final ActionEvent action ) { action_build(); } }; button.addActionListener( actionListener ); return button; } private void action_build() { m_buildButton.setEnabled( false ); final Runnable runnable = new Runnable() { public void run() { doBuild(); } }; SwingUtilities.invokeLater( runnable ); } /** * Actually do the build in this method. */ private void doBuild() { System.out.println( "SwingUI.doBuild" ); // final boolean reloadLibs = m_reloadLibsCheckBox.isSelected(); // if( reloadLibs ) // { // //rebuild workspace/module // } final String buildFilename = m_fileField.getText(); final boolean reloadFile = m_reloadFileCheckBox.isSelected(); // if( buildFilename.equals( m_oldBuildFile ) || reloadFile || reloadLibs ) // { // //reload build file here // } //Hook up event listener here //Process Module here m_buildButton.setEnabled( true ); } private void file_textChanged() { m_buildButton.setEnabled( m_fileField.getText().length() > 0 ); //m_statusLine.setText( "" ); } } -- To unsubscribe, e-mail: For additional commands, e-mail: