1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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 }