Index: topia/src/java/org/codelutin/topia/ui/ManagementButtonsPanel.java diff -u /dev/null topia/src/java/org/codelutin/topia/ui/ManagementButtonsPanel.java:1.1 --- /dev/null Tue Jul 20 16:02:30 2004 +++ topia/src/java/org/codelutin/topia/ui/ManagementButtonsPanel.java Tue Jul 20 16:02:24 2004 @@ -0,0 +1,108 @@ +/* *##% +* Copyright (C) 2002, 2003 Code Lutin +* +* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*##%*/ + +/* * +* ManagementButtonsPanel.java +* +* Created: Jun 1, 2004 +* +* @author Benjamin Poussin +* Copyright Code Lutin +* @version $Revision: 1.1 $ +* +* Mise a jour: $Date: 2004/07/20 16:02:24 $ +* par : $Author: mazelier $ +*/ + +package org.codelutin.topia.ui; + +import javax.swing.JPanel; +import javax.swing.JButton; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionListener; + +import java.beans.EventHandler; + + +/** +* Panel constitue de 4 boutons Save, Cancel, Delete, Search utils +* a la manipulation des entites. +*/ +public class ManagementButtonsPanel extends JPanel{ // ManagementButtonsPanel + + JButton buttonSave = new JButton("Save"); + JButton buttonCancel = new JButton("Cancel"); + JButton buttonDelete = new JButton("Delete"); + JButton buttonSearch = new JButton("Search"); + + public ManagementButtonsPanel(){ + super(); + init(); + } + + protected void addButton(JButton button, GridBagLayout layout, + GridBagConstraints constraint) { + layout.setConstraints(button, constraint); + add(button); + } + + public void init() { + GridBagLayout layout = new GridBagLayout(); + GridBagConstraints constraint = new GridBagConstraints(); + + setLayout(layout); + + //Bouton Save + constraint.gridx=0; + constraint.gridy=0; + constraint.fill=GridBagConstraints.HORIZONTAL; + addButton(buttonSave, layout, constraint); + // Ajout d'un listener + Object l = EventHandler.create(ActionListener.class, this, "on_save"); + buttonSave.addActionListener((ActionListener)l); + + //Bouton Cancel + constraint.gridx=0; + constraint.gridy=1; + addButton(buttonCancel, layout, constraint); + // Ajout d'un event + l = EventHandler.create(ActionListener.class, this, "on_cancel"); + buttonCancel.addActionListener((ActionListener)l); + + //Bouton Delete + constraint.gridx=0; + constraint.gridy=2; + addButton(buttonDelete, layout, constraint); + // Ajout d'un event + l = EventHandler.create(ActionListener.class, this, "on_delete"); + buttonDelete.addActionListener((ActionListener)l); + + //Bouton Search + constraint.gridx=0; + constraint.gridy=3; + addButton(buttonSearch, layout, constraint); + // Ajout d'un event + l = EventHandler.create(ActionListener.class, this, "on_search"); + buttonSearch.addActionListener((ActionListener)l); + + } + + +} // ManagementButtonsPanel Index: topia/src/java/org/codelutin/topia/ui/SelectionButtonsPanel.java diff -u /dev/null topia/src/java/org/codelutin/topia/ui/SelectionButtonsPanel.java:1.1 --- /dev/null Tue Jul 20 16:02:30 2004 +++ topia/src/java/org/codelutin/topia/ui/SelectionButtonsPanel.java Tue Jul 20 16:02:24 2004 @@ -0,0 +1,103 @@ +/* *##% + * Copyright (C) 2002, 2003 Code Lutin + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * SelectionButtonsPanel.java + * + * Created: Jul 20, 2004 + * + * @author Benjamin Poussin + * Copyright Code Lutin + * @version $Revision: 1.1 $ + * + * Mise a jour: $Date: 2004/07/20 16:02:24 $ + * par : $Author: mazelier $ + */ + +package org.codelutin.topia.ui; + +import javax.swing.JPanel; +import javax.swing.JButton; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionListener; + +import java.beans.EventHandler; + + +public class SelectionButtonsPanel extends JPanel{ // SelectionButtonsPanel + + JButton buttonSelectAll = new JButton("Select All"); + JButton buttonReset = new JButton("Reset"); + JButton buttonOk = new JButton("Ok"); + JButton buttonCancel = new JButton("Cancel"); + + public SelectionButtonsPanel(){ + super(); + init(); + } + + protected void addButton(JButton button, GridBagLayout layout, + GridBagConstraints constraint) { + layout.setConstraints(button, constraint); + add(button); + } + + public void init() { + GridBagLayout layout = new GridBagLayout(); + GridBagConstraints constraint = new GridBagConstraints(); + + setLayout(layout); + + //Bouton Select All + constraint.gridx=0; + constraint.gridy=0; + constraint.fill=GridBagConstraints.HORIZONTAL; + addButton(buttonSelectAll, layout, constraint); + // Ajout d'un event + Object l = EventHandler.create(ActionListener.class, this, "on_selectAll"); + buttonSelectAll.addActionListener((ActionListener)l); + + //Bouton Reset + constraint.gridx=1; + constraint.gridy=0; + addButton(buttonReset, layout, constraint); + // Ajout d'un event + l = EventHandler.create(ActionListener.class, this, "on_reset"); + buttonReset.addActionListener((ActionListener)l); + + //Bouton Ok + constraint.gridx=2; + constraint.gridy=0; + addButton(buttonOk, layout, constraint); + // Ajout d'un event + l = EventHandler.create(ActionListener.class, this, "on_ok"); + buttonOk.addActionListener((ActionListener)l); + + //Bouton Cancel + constraint.gridx=3; + constraint.gridy=0; + addButton(buttonCancel, layout, constraint); + // Ajout d'un event + l = EventHandler.create(ActionListener.class, this, "on_cancel"); + buttonCancel.addActionListener((ActionListener)l); + } + +} // SelectionButtonsPanel +