/** * Copyright (C) 2010 INRIA, University of Lille 1 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Contact: frascati@ow2.org * * Author: Christophe Demarey * * Contributor(s): */ package com.programmez.sca.myweather.explorer; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JTextPane; import org.objectweb.util.explorer.api.TreeView; import org.ow2.frascati.explorer.gui.AbstractSelectionPanel; import com.programmez.sca.myweather.TwitterWeather; /** * Panel used to call myWeather service and display the result in explorer. */ public class MyWeatherPanel extends AbstractSelectionPanel { /** * Default constructor used to add GUI components. */ public MyWeatherPanel() { super(); final JButton button = new JButton("Call myWeather service"); this.setLayout( new BoxLayout(this, BoxLayout.PAGE_AXIS) ); add(button); final JTextPane resultArea = new JTextPane(); resultArea.setEditable(false); add(resultArea); button.addActionListener( new ActionListener() { public final void actionPerformed(ActionEvent e) { resultArea.setText( selected.getWeatherForUser() ); } } ); } @Override public void selected(TreeView treeView) { super.selected(treeView); } }