1 /*
2  *  CVS: $Id: PlayerEditorComposite.java,v 1.7 2004/07/25 21:40:56 marcus Exp $
3  * 
4  *  This file is part of zuul.
5  *
6  *  zuul is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10 *
11 *  zuul is distributed in the hope that it will be useful,
12 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 *  GNU General Public License for more details.
15 *
16 *  You should have received a copy of the GNU General Public License
17 *  along with zuul; if not, write to the Free Software
18 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 * 
20 *  Copyrigth 2004 by marcus, leh
21 * 
22 */
23package org.jzuul.gdk.swt;
24
25import org.eclipse.swt.SWT;
26import org.eclipse.swt.events.SelectionEvent;
27import org.eclipse.swt.events.SelectionListener;
28import org.eclipse.swt.layout.FillLayout;
29import org.eclipse.swt.layout.GridLayout;
30import org.eclipse.swt.widgets.Button;
31import org.eclipse.swt.widgets.Composite;
32import org.eclipse.swt.widgets.Group;
33import org.eclipse.swt.widgets.Shell;
34import org.jdom.Element;
35
36
37/**
38 * 
39 * Created on Jul 14, 2004
40 * 
41 * 
42 * @version $Revision: 1.7 $
43 */
44public class PlayerEditorComposite extends Composite {
45    Element player;
46    
47    /**
48     * @param arg0
49     * @param arg1
50     */
51    public PlayerEditorComposite(Composite arg0, int arg1) {
52        super(arg0, arg1);
53        this.setLayout(new FillLayout());
54        
55        Group mainGroup = new Group(this, SWT.NONE);
56        mainGroup.setText(Messages.getString("PLAYER_OPTIONS")); //$NON-NLS-1$
57        mainGroup.setLayout(new GridLayout(1,true));
58        
59        Button contentButton = new Button(mainGroup,SWT.PUSH);
60        contentButton.setText(Messages.getString("EDIT_CONTENTS")); //$NON-NLS-1$
61        
62        contentButton.addSelectionListener(new SelectionListener() {
63
64            public void widgetSelected(SelectionEvent arg0) {
65                ContentsEditorDialog ed = new ContentsEditorDialog(new Shell(arg0.display), SWT.NONE);
66                ed.open(player);
67            }
68
69            public void widgetDefaultSelected(SelectionEvent arg0) {}
70        });
71        
72        Button targetButton = new Button(mainGroup, SWT.PUSH);
73        targetButton.setText(Messages.getString("EDIT_TARGETS")); //$NON-NLS-1$
74        
75        targetButton.addSelectionListener(new SelectionListener() {
76
77            public void widgetSelected(SelectionEvent arg0) {
78                TargetEditor ed = new TargetEditor(new Shell(arg0.display), SWT.NONE);
79                ed.open(player);
80            }
81
82            public void widgetDefaultSelected(SelectionEvent arg0) {}
83        });
84        
85        
86    }
87    
88    public void showPlayer(Element player) {
89        this.player = player;
90    }
91    
92    public void clear() {
93        this.player = null;
94    }
95    
96    public void updateData() {
97        // I believe nothing to be done here
98    }
99
00
01}
02