View Javadoc

1   /**********************************************
2    * Copyright (C) 2011 Lukas Laag
3    * This file is part of svgreal.
4    * 
5    * svgreal is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    * 
10   * svgreal is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   * 
15   * You should have received a copy of the GNU General Public License
16   * along with svgreal.  If not, see http://www.gnu.org/licenses/
17   **********************************************/
18  package org.vectomatic.svg.edit.client.inspector;
19  
20  import org.vectomatic.svg.edit.client.AppConstants;
21  import org.vectomatic.svg.edit.client.command.ICommandFactory;
22  import org.vectomatic.svg.edit.client.model.ModelCategory;
23  
24  import com.extjs.gxt.ui.client.event.ButtonEvent;
25  import com.extjs.gxt.ui.client.event.SelectionListener;
26  import com.extjs.gxt.ui.client.widget.button.Button;
27  import com.extjs.gxt.ui.client.widget.form.FormPanel;
28  
29  public class ManipulatorSectionFactory extends GenericSectionFactory {
30  	private ICommandFactory commandFactory;
31  	public ManipulatorSectionFactory(ICommandFactory commandFactory) {
32  		this.commandFactory = commandFactory;
33  	}
34  	@Override
35  	public IInspectorSection createSection(final ModelCategory category) {
36  		FormInspectorSection section = (FormInspectorSection) super.createSection(category);
37  		FormPanel panel = (FormPanel) section.getPanel();
38  		Button button = new Button(AppConstants.INSTANCE.displayManipulatorButton());
39  		button.addSelectionListener(new SelectionListener<ButtonEvent>() {
40  			@Override
41  			public void componentSelected(ButtonEvent ce) {
42  				commandFactory.start(ManipulatorSectionFactory.this);
43  			}
44  		});
45  		panel.add(button);
46  		return section;
47  	}
48  }