|
From: Michal P. <mic...@us...> - 2002-09-12 14:39:21
|
Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/wizards In directory usw-pr-cvs1:/tmp/cvs-serv25608/net/sourceforge/javaprofiler/module/wizards Added Files: ConnectorWizardArgumentPanel.java Log Message: Initial import. --- NEW FILE: ConnectorWizardArgumentPanel.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License Version * 1.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is available at http://www.sun.com/ * * The Original Code is the Java Profiler module. * The Initial Developers of the Original Code are Jan Stola, Pavel Vacha, * Michal Pise, Petr Luner, Lukas Petru and Marek Przeczek. * Portions created by Jan Stola are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Pavel Vacha are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Michal Pise are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Petr Luner are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Lukas Petru are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Marek Przeczek are Copyright (C) 2000-2001. All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.module.wizards; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; import org.openide.*; import org.openide.util.*; import net.sourceforge.javaprofiler.jpi.*; import net.sourceforge.javaprofiler.jpi.connect.*; public class ConnectorWizardArgumentPanel implements WizardDescriptor.Panel { private final JPanel masterPanel = new JPanel(); private final JPanel panel = new JPanel(); private final JScrollPane pane = new JScrollPane( panel); private Connector connector; private Map arguments; public ConnectorWizardArgumentPanel () { masterPanel.setName( "Connector"); masterPanel.setPreferredSize( new Dimension( 400, 200)); masterPanel.setLayout( new BoxLayout( masterPanel, BoxLayout.Y_AXIS)); masterPanel.add( pane); pane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); panel.setLayout( new BoxLayout( panel, BoxLayout.Y_AXIS)); } private void reloadArguments() { panel.removeAll(); Iterator i = arguments.values().iterator(); while ( i.hasNext()) { Connector.Argument a = (Connector.Argument) i.next(); panel.add( new JLabel( a.label() + ( a.isMandatory() ? " (mandatory)" : ""))); JTextField field = new JTextField( a.value()); field.setToolTipText( a.description()); field.addActionListener( new ArgumentChangeListener( a)); panel.add( field); } } private static class ArgumentChangeListener implements ActionListener { private final Connector.Argument argument; public ArgumentChangeListener( Connector.Argument argument) { this.argument = argument; } public void actionPerformed( ActionEvent e) { argument.setValue( ((JTextField)e.getSource()).getText()); } } public HelpCtx getHelp() { return new HelpCtx (ConnectorWizardArgumentPanel.class); } public void storeSettings( Object settings) { ((Map)settings).put( "connector", connector); ((Map)settings).put( "arguments", arguments); } public void readSettings( Object settings) { connector = (Connector)((Map)settings).get( "connector"); arguments = (Map)((Map)settings).get( "arguments"); if ( arguments == null) arguments = connector.defaultArguments(); reloadArguments(); } public void addChangeListener( ChangeListener l) {} public void removeChangeListener( ChangeListener l) {} public boolean isValid() { return true; } public Component getComponent() { return masterPanel; } } |