Author: DartPeng
Date: 2010-06-07 03:46:49 -0400 (Mon, 07 Jun 2010)
New Revision: 22594
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/InputSourceContainerEditPart.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/OutputContainerEditPart.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputSourceContainerModel.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/OutputTargetModel.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/ContainerBorder.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/ContainerFigure.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/FillLayout.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/SourceContainerFigure.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/TargetContainerFigure.java
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.core/plugin.xml
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/common/RootModel.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/RootEditPart.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksEditFactory.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/autolayout/JavaMappingAutoLayout.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/SmooksGraphUtil.java
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/SmooksRootEditPart.java
Log:
add scrolled figures
Modified: workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.core/plugin.xml
===================================================================
--- workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.core/plugin.xml 2010-06-07
02:12:01 UTC (rev 22593)
+++ workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.core/plugin.xml 2010-06-07
07:46:49 UTC (rev 22594)
@@ -4,18 +4,7 @@
<extension
point="org.eclipse.core.contenttype.contentTypes">
</extension>
- <extension point="org.eclipse.emf.ecore.generated_package">
- <package
-
uri="http://www.milyn.org/xsd/smooks/groovy-1.1.xsd"
- class="org.jboss.tools.smooks.model.groovy.GroovyPackage"
- genModel="model/groovy-1.1.genmodel"/>
- </extension>
-
- <extension point="org.eclipse.emf.ecore.extension_parser">
- <parser
- type="groovy"
-
class="org.jboss.tools.smooks.model.groovy.util.GroovyResourceFactoryImpl"/>
- </extension>
+
<extension point="org.eclipse.emf.ecore.generated_package">
@@ -57,32 +46,8 @@
class="org.jboss.tools.smooks.model.smooks.util.SmooksResourceFactoryImpl"/>
</extension>
- <extension point="org.eclipse.emf.ecore.generated_package">
- <package
-
uri="http://www.milyn.org/xsd/smooks/xsl-1.1.xsd"
- class="org.jboss.tools.smooks.model.xsl.XslPackage"
- genModel="ecore.model/xsl-1.1.genmodel"/>
- </extension>
-
- <extension point="org.eclipse.emf.ecore.extension_parser">
- <parser
- type="xsl"
-
class="org.jboss.tools.smooks.model.xsl.util.XslResourceFactoryImpl"/>
- </extension>
+
- <extension point="org.eclipse.emf.ecore.generated_package">
- <package
-
uri="http://www.milyn.org/xsd/smooks/javabean-1.1.xsd"
- class="org.jboss.tools.smooks.model.javabean.JavabeanPackage"
- genModel="ecore.model/javabean-1.1.genmodel"/>
- </extension>
-
- <extension point="org.eclipse.emf.ecore.extension_parser">
- <parser
- type="javabean"
-
class="org.jboss.tools.smooks.model.javabean.util.JavabeanResourceFactoryImpl"/>
- </extension>
-
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd"
@@ -96,97 +61,10 @@
class="org.jboss.tools.smooks.model.medi.util.MEdiResourceFactoryImpl"/>
</extension>
- <extension point="org.eclipse.emf.ecore.generated_package">
- <package
-
uri="http://www.milyn.org/xsd/smooks/file-routing-1.1.xsd"
-
class="org.jboss.tools.smooks.model.fileRouting.FileRoutingPackage"
- genModel="model/file-routing-1.1.genmodel"/>
- </extension>
-
- <extension point="org.eclipse.emf.ecore.extension_parser">
- <parser
- type="filerouting"
-
class="org.jboss.tools.smooks.model.fileRouting.util.FileRoutingResourceFactoryImpl"/>
- </extension>
-
- <extension point="org.eclipse.emf.ecore.generated_package">
- <package
-
uri="http://www.milyn.org/xsd/smooks/csv-1.1.xsd"
- class="org.jboss.tools.smooks.model.csv.CsvPackage"
- genModel="model/csv-1.1.genmodel"/>
- </extension>
+
<extension
point="org.eclipse.emf.ecore.generated_package">
<package
- class="org.jboss.tools.smooks.model.iorouting.IoroutingPackage"
- genModel="model/io-routing-1.1.genmodel"
-
uri="http://www.milyn.org/xsd/smooks/io-routing-1.1.xsd">
- </package>
- </extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
- class="org.jboss.tools.smooks.model.dbrouting.DbroutingPackage"
- genModel="model/db-routing-1.1.genmodel"
-
uri="http://www.milyn.org/xsd/smooks/db-routing-1.1.xsd">
- </package>
- </extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
- class="org.jboss.tools.smooks.model.jmsrouting.JmsroutingPackage"
- genModel="model/jms-routing-1.1.genmodel"
-
uri="http://www.milyn.org/xsd/smooks/jms-routing-1.1.xsd">
- </package>
- </extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
- class="org.jboss.tools.smooks.model.json.JsonPackage"
- genModel="model/json-1.1.genmodel"
-
uri="http://www.milyn.org/xsd/smooks/json-1.1.xsd">
- </package>
- </extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
- class="org.jboss.tools.smooks.model.edi.EdiPackage"
- genModel="model/edi-1.1.genmodel"
-
uri="http://www.milyn.org/xsd/smooks/edi-1.1.xsd">
- </package>
- </extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
- class="org.jboss.tools.smooks.model.datasource.DatasourcePackage"
- genModel="model/datasource-1.1.genmodel"
-
uri="http://www.milyn.org/xsd/smooks/datasource-1.1.xsd">
- </package>
- </extension>
-
- <extension point="org.eclipse.emf.ecore.generated_package">
- <package
-
uri="http://www.milyn.org/xsd/smooks/calc-1.1.xsd"
- class="org.jboss.tools.smooks.model.calc.CalcPackage"
- genModel="model/calc-1.1.genmodel"/>
- </extension>
-
- <extension point="org.eclipse.emf.ecore.extension_parser">
- <parser
- type="calc"
-
class="org.jboss.tools.smooks.model.calc.util.CalcResourceFactoryImpl"/>
- </extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
- class="org.jboss.tools.smooks.model.esbrouting.EsbroutingPackage"
- genModel="model/esbrouting-1.0.genmodel"
-
uri="http://www.jboss.org/xsd/jbossesb/smooks/routing-1.0.xsd">
- </package>
- </extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
class="org.jboss.tools.smooks.model.javabean12.Javabean12Package"
genModel="model/smooks-1.2-models/javabean12.genmodel"
uri="http://www.milyn.org/xsd/smooks/javabean-1.2.xsd">
@@ -216,39 +94,8 @@
uri="http://www.milyn.org/xsd/smooks/edi-1.2.xsd">
</package>
</extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
-
class="org.jboss.tools.smooks.model.jmsrouting12.Jmsrouting12Package"
- genModel="model/smooks-1.2-models/jmsrouting12.genmodel"
-
uri="http://www.milyn.org/xsd/smooks/jms-routing-1.2.xsd">
- </package>
- </extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
-
class="org.jboss.tools.smooks.model.persistence12.Persistence12Package"
- genModel="model/smooks-1.2-models/persistence12.genmodel"
-
uri="http://www.milyn.org/xsd/smooks/persistence-1.2.xsd">
- </package>
- </extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
- class="org.jboss.tools.smooks.model.rules10.Rules10Package"
- genModel="model/smooks-1.2-models/rules10.genmodel"
-
uri="http://www.milyn.org/xsd/smooks/rules-1.0.xsd">
- </package>
- </extension>
- <extension
- point="org.eclipse.emf.ecore.generated_package">
- <package
-
class="org.jboss.tools.smooks.model.validation10.Validation10Package"
- genModel="model/smooks-1.2-models/validation10.genmodel"
-
uri="http://www.milyn.org/xsd/smooks/validation-1.0.xsd">
- </package>
- </extension>
+
</plugin>
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/common/RootModel.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/common/RootModel.java 2010-06-07
02:12:01 UTC (rev 22593)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/common/RootModel.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -9,10 +9,10 @@
public class RootModel extends AbstractSmooksGraphicalModel{
- public RootModel() {
- super(null);
- }
-
+ private RootModel targetContainerModel = null;
+
+ private RootModel sourceContainerModel = null;
+
public static final String ADD_CHILDREN = "__pro_add_children"; //$NON-NLS-1$
public static final String REMOVE_CHILDREN = "__pro_remove_children";
//$NON-NLS-1$
@@ -21,6 +21,37 @@
private List<AbstractSmooksGraphicalModel> children;
+
+ public RootModel() {
+ super(null);
+ }
+
+
+
+ public RootModel getTargetContainerModel() {
+ return targetContainerModel;
+ }
+
+
+
+ public void setTargetContainerModel(RootModel targetContainerModel) {
+ this.targetContainerModel = targetContainerModel;
+ }
+
+
+
+ public RootModel getSourceContainerModel() {
+ return sourceContainerModel;
+ }
+
+
+
+ public void setSourceContainerModel(RootModel sourceContainerModel) {
+ this.sourceContainerModel = sourceContainerModel;
+ }
+
+
+
public List<AbstractSmooksGraphicalModel> getChildren() {
if (children == null) {
children = new ArrayList<AbstractSmooksGraphicalModel>();
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/RootEditPart.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/RootEditPart.java 2010-06-07
02:12:01 UTC (rev 22593)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/RootEditPart.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -8,12 +8,15 @@
import java.util.List;
import org.eclipse.draw2d.FreeformLayer;
-import org.eclipse.draw2d.FreeformLayout;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.jboss.tools.smooks.gef.common.RootModel;
import org.jboss.tools.smooks.gef.tree.editpolicy.RootPanelXYLayoutEditPolicy;
+import org.jboss.tools.smooks.graphical.figures.FillLayout;
/**
* @author DartPeng
@@ -26,8 +29,11 @@
*/
@Override
protected IFigure createFigure() {
+
FreeformLayer layer = new FreeformLayer();
- layer.setLayoutManager(new FreeformLayout());
+ ToolbarLayout tl = new ToolbarLayout();
+ tl.setVertical(true);
+ layer.setLayoutManager(new
FillLayout(((GraphicalViewer)((GraphicalEditPart)this).getViewer()).getControl()));
return layer;
}
@@ -60,7 +66,7 @@
*/
@Override
protected void createEditPolicies() {
- this.installEditPolicy(EditPolicy.LAYOUT_ROLE, new RootPanelXYLayoutEditPolicy());
+// this.installEditPolicy(EditPolicy.LAYOUT_ROLE, new RootPanelXYLayoutEditPolicy());
}
protected List<?> getModelChildren(){
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksEditFactory.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksEditFactory.java 2010-06-07
02:12:01 UTC (rev 22593)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksEditFactory.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -25,6 +25,8 @@
import org.jboss.tools.smooks.gef.tree.model.ValueBindingConnection;
import org.jboss.tools.smooks.graphical.editors.editparts.InputDataContainerEditPart;
import org.jboss.tools.smooks.graphical.editors.editparts.InputDataTreeNodeEditPart;
+import org.jboss.tools.smooks.graphical.editors.editparts.InputSourceContainerEditPart;
+import org.jboss.tools.smooks.graphical.editors.editparts.OutputContainerEditPart;
import org.jboss.tools.smooks.graphical.editors.editparts.ResourceConfigEditFactory;
import org.jboss.tools.smooks.graphical.editors.editparts.SmooksRootEditPart;
import org.jboss.tools.smooks.graphical.editors.editparts.TriggerConnectionEditPart;
@@ -34,6 +36,8 @@
import org.jboss.tools.smooks.graphical.editors.model.AbstractResourceConfigGraphModel;
import org.jboss.tools.smooks.graphical.editors.model.InputDataContianerModel;
import org.jboss.tools.smooks.graphical.editors.model.InputDataTreeNodeModel;
+import org.jboss.tools.smooks.graphical.editors.model.InputSourceContainerModel;
+import org.jboss.tools.smooks.graphical.editors.model.OutputTargetModel;
/**
* @author Dart
@@ -41,14 +45,13 @@
*/
public class SmooksEditFactory extends SmooksGEFEditFactory implements EditPartFactory {
private ResourceConfigEditFactory resourceConfigFactory;
-
+
private boolean displayInput = true;
public SmooksEditFactory() {
super();
resourceConfigFactory = new ResourceConfigEditFactory();
}
-
/**
* @return the displayInput
@@ -57,21 +60,27 @@
return displayInput;
}
-
-
/**
- * @param displayInput the displayInput to set
+ * @param displayInput
+ * the displayInput to set
*/
public void setDisplayInput(boolean displayInput) {
this.displayInput = displayInput;
}
-
-
public EditPart createEditPart(EditPart context, Object model) {
EditPart editPart = null;
+
if (model instanceof RootModel) {
- editPart = new SmooksRootEditPart();
+ if (model instanceof OutputTargetModel) {
+ editPart = new OutputContainerEditPart();
+ }
+ if (model instanceof InputSourceContainerModel) {
+ editPart = new InputSourceContainerEditPart();
+ }
+ if (editPart == null) {
+ editPart = new SmooksRootEditPart();
+ }
}
if (model.getClass() == TreeNodeModel.class) {
editPart = new TreeNodeEditPart();
@@ -86,20 +95,19 @@
editPart = new InputDataContainerEditPart();
}
- if (model instanceof AbstractResourceConfigGraphModel
- || model instanceof AbstractResourceConfigChildNodeGraphModel) {
+ if (model instanceof AbstractResourceConfigGraphModel || model instanceof
AbstractResourceConfigChildNodeGraphModel) {
editPart = resourceConfigFactory.createEditPart(model);
}
if (model.getClass() == TreeNodeConnection.class) {
editPart = new TreeNodeConnectionEditPart();
}
- if(model.getClass() == TriggerConnection.class){
+ if (model.getClass() == TriggerConnection.class) {
editPart = new TriggerConnectionEditPart();
}
- if(model.getClass() == ValueBindingConnection.class){
+ if (model.getClass() == ValueBindingConnection.class) {
editPart = new ValueBindingConnectionEditPart();
}
- if(model.getClass() == BeanReferenceConnection.class){
+ if (model.getClass() == BeanReferenceConnection.class) {
editPart = new BeanReferenceConnectionEditPart();
}
if (editPart != null) {
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2010-06-07
02:12:01 UTC (rev 22593)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -51,6 +51,7 @@
import org.eclipse.gef.commands.CommandStackEvent;
import org.eclipse.gef.commands.CommandStackEventListener;
import org.eclipse.gef.dnd.TemplateTransferDropTargetListener;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.eclipse.gef.editparts.FreeformGraphicalRootEditPart;
import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.gef.ui.parts.GraphicalEditor;
@@ -64,6 +65,10 @@
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
@@ -96,12 +101,16 @@
import org.jboss.tools.smooks.graphical.actions.AutoLayoutAction;
import org.jboss.tools.smooks.graphical.editors.autolayout.IAutoLayout;
import org.jboss.tools.smooks.graphical.editors.commands.IgnoreException;
+import org.jboss.tools.smooks.graphical.editors.editparts.InputSourceContainerEditPart;
+import org.jboss.tools.smooks.graphical.editors.editparts.OutputContainerEditPart;
import
org.jboss.tools.smooks.graphical.editors.editparts.RightClickSelectMarqueeDragTraker;
import org.jboss.tools.smooks.graphical.editors.editparts.SmooksGraphUtil;
import org.jboss.tools.smooks.graphical.editors.model.IValidatableModel;
import org.jboss.tools.smooks.graphical.editors.model.InputDataContianerModel;
import org.jboss.tools.smooks.graphical.editors.model.InputDataRootModel;
import org.jboss.tools.smooks.graphical.editors.model.InputDataTreeNodeModel;
+import org.jboss.tools.smooks.graphical.editors.model.InputSourceContainerModel;
+import org.jboss.tools.smooks.graphical.editors.model.OutputTargetModel;
import org.jboss.tools.smooks.graphical.editors.process.TaskType;
import org.jboss.tools.smooks.model.javabean12.BeanType;
import org.jboss.tools.smooks.model.javabean12.Javabean12Package;
@@ -114,8 +123,8 @@
* @author Dart
*
*/
-public class SmooksGraphicalEditorPart extends GraphicalEditor implements
ISelectionChangedListener,
- ISourceSynchronizeListener, IGraphicalEditorPart, ITaskNodeProvider,
ISmooksModelValidateListener {
+public class SmooksGraphicalEditorPart extends GraphicalEditor implements
ISelectionChangedListener, ISourceSynchronizeListener,
+ IGraphicalEditorPart, ITaskNodeProvider, ISmooksModelValidateListener {
private CommandStackListener emfCommandStackListener = null;
@@ -186,8 +195,7 @@
private void createEMFCommandStackListener() {
emfCommandStackListener = new org.eclipse.emf.common.command.CommandStackListener() {
public void commandStackChanged(EventObject event) {
- final Command mostRecentCommand = ((org.eclipse.emf.common.command.CommandStack)
event.getSource())
- .getMostRecentCommand();
+ final Command mostRecentCommand = ((org.eclipse.emf.common.command.CommandStack)
event.getSource()).getMostRecentCommand();
final EventObject fe = event;
getEditorSite().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
@@ -197,10 +205,8 @@
rawCommand = ((CommandWrapper) rawCommand).getCommand();
}
int commandType = EXECUTE_COMMAND;
- Command undoCommand = ((org.eclipse.emf.common.command.CommandStack)
fe.getSource())
- .getUndoCommand();
- Command redoCommand = ((org.eclipse.emf.common.command.CommandStack)
fe.getSource())
- .getRedoCommand();
+ Command undoCommand = ((org.eclipse.emf.common.command.CommandStack)
fe.getSource()).getUndoCommand();
+ Command redoCommand = ((org.eclipse.emf.common.command.CommandStack)
fe.getSource()).getRedoCommand();
if (undoCommand != null || rawCommand.equals(undoCommand)) {
commandType = EXECUTE_COMMAND;
}
@@ -215,8 +221,8 @@
command = ((CommandWrapper) command).getCommand();
}
handleInputParamChange(command);
- if (command instanceof SetCommand || command instanceof AddCommand
- || command instanceof DeleteCommand || command instanceof RemoveCommand) {
+ if (command instanceof SetCommand || command instanceof AddCommand || command
instanceof DeleteCommand
+ || command instanceof RemoveCommand) {
refershRecentAffectedModel(command, command.getAffectedObjects(),
commandType);
}
}
@@ -224,8 +230,7 @@
if (rawCommand instanceof SetCommand || rawCommand instanceof AddCommand
|| rawCommand instanceof DeleteCommand || rawCommand instanceof RemoveCommand)
{
handleInputParamChange(rawCommand);
- refershRecentAffectedModel(rawCommand, mostRecentCommand.getAffectedObjects(),
- commandType);
+ refershRecentAffectedModel(rawCommand, mostRecentCommand.getAffectedObjects(),
commandType);
}
}
}
@@ -266,6 +271,7 @@
mainComposite.setLayout(fillLayout);
super.createPartControl(mainComposite);
return;
+
}
super.createPartControl(parent);
}
@@ -288,8 +294,7 @@
@Override
public void dispose() {
if (smooksModelProvider != null) {
- smooksModelProvider.getEditingDomain().getCommandStack()
- .removeCommandStackListener(emfCommandStackListener);
+ smooksModelProvider.getEditingDomain().getCommandStack().removeCommandStackListener(emfCommandStackListener);
}
super.dispose();
}
@@ -424,8 +429,7 @@
getSelectionActions().add(autoLayout.getId());
}
- private void deleteRelatedConnection(AbstractSmooksGraphicalModel effecedNode,
EStructuralFeature feature,
- SetCommand command) {
+ private void deleteRelatedConnection(AbstractSmooksGraphicalModel effecedNode,
EStructuralFeature feature, SetCommand command) {
EObject data = (EObject) AdapterFactoryEditingDomain.unwrap(effecedNode.getData());
if (feature.equals(SmooksUIUtils.getBeanIDRefFeature(data))) {
@@ -435,7 +439,8 @@
TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator.next();
AbstractSmooksGraphicalModel target = treeNodeConnection.getTargetNode();
Object refValue = command.getValue();
- if(refValue == null) continue;
+ if (refValue == null)
+ continue;
String refID = refValue.toString();
Object targetModel = AdapterFactoryEditingDomain.unwrap(target.getData());
if (targetModel instanceof EObject) {
@@ -552,7 +557,7 @@
if (graphModel == null)
continue;
AbstractSmooksGraphicalModel.disconnectAllConnections(graphModel);
- root.removeTreeNode(graphModel);
+ root.getTargetContainerModel().removeTreeNode(graphModel);
}
}
} else {
@@ -579,7 +584,7 @@
if (graphModel == null)
continue;
try {
- root.addTreeNode(graphModel);
+ root.getTargetContainerModel().addTreeNode(graphModel);
} catch (Throwable t) {
t.printStackTrace();
}
@@ -618,7 +623,7 @@
object2 = AdapterFactoryEditingDomain.unwrap(object2);
AbstractSmooksGraphicalModel gmodel = findGraphicalModel(object2);
if (gmodel != null) {
- root.removeTreeNode(gmodel);
+ root.getTargetContainerModel().removeTreeNode(gmodel);
break;
}
}
@@ -661,7 +666,7 @@
if (graphModel == null)
continue;
node = graphModel;
- root.addTreeNode(graphModel);
+ root.getTargetContainerModel().addTreeNode(graphModel);
Collection<TreeNodeConnection> connections =
createAllConnection(graphModel);
expandConnectedModels(connections);
applyGraphicalInformation(graphModel);
@@ -708,7 +713,23 @@
super.configureGraphicalViewer();
getGraphicalViewer().setEditDomain(editDomain);
getGraphicalViewer().setEditPartFactory(createEdtiPartFactory());
+ getGraphicalViewer().getControl().addControlListener(new ControlListener() {
+ public void controlResized(ControlEvent e) {
+ }
+
+ public void controlMoved(ControlEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+ getGraphicalViewer().getControl().addPaintListener(new PaintListener() {
+
+ public void paintControl(PaintEvent e) {
+ //
((AbstractGraphicalEditPart)getGraphicalViewer().getRootEditPart()).getFigure().getLayoutManager().layout(null);
+ }
+ });
+
getGraphicalViewer().setRootEditPart(new FreeformGraphicalRootEditPart() {
public DragTracker getDragTracker(Request req) {
return new RightClickSelectMarqueeDragTraker();
@@ -719,8 +740,7 @@
(TransferDropTargetListener) new
TemplateTransferDropTargetListener(getGraphicalViewer()));
GraphicalViewerKeyHandler keyHandler = new
GraphicalViewerKeyHandler(getGraphicalViewer());
- keyHandler.put(org.eclipse.gef.KeyStroke.getPressed(SWT.DEL, 0),
this.getActionRegistry().getAction(
- ActionFactory.DELETE.getId()));
+ keyHandler.put(org.eclipse.gef.KeyStroke.getPressed(SWT.DEL, 0),
this.getActionRegistry().getAction(ActionFactory.DELETE.getId()));
ContextMenuProvider provider = getContextMenuProvider();
getGraphicalViewer().setContextMenu(provider);
@@ -745,6 +765,9 @@
protected List<AbstractSmooksGraphicalModel> createInputDataGraphModel() {
List<AbstractSmooksGraphicalModel> inputGraphModel = new
ArrayList<AbstractSmooksGraphicalModel>();
if (inputDataList != null && root != null) {
+ InputSourceContainerModel tcontainer = new InputSourceContainerModel();
+ root.setSourceContainerModel(tcontainer);
+ root.addTreeNode(tcontainer);
for (Iterator<?> iterator = inputDataList.iterator(); iterator.hasNext();) {
Object object = (Object) iterator.next();
ITreeContentProvider contentProvider = new XMLStructuredDataContentProvider();
@@ -758,9 +781,9 @@
}
containerModel.getChildren().add((IXMLStructuredObject) object);
if (containerModel != null) {
- TreeContainerModel container = new InputDataContianerModel(containerModel,
contentProvider,
- labelProvider, getSmooksModelProvider());
- root.addTreeNode(container);
+ TreeContainerModel container = new InputDataContianerModel(containerModel,
contentProvider, labelProvider,
+ getSmooksModelProvider());
+ tcontainer.addTreeNode(container);
inputGraphModel.add(container);
}
}
@@ -785,8 +808,10 @@
Object obj = smooksModelProvider.getSmooksModel();
if (obj == null)
return;
- AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain)
smooksModelProvider
- .getEditingDomain();
+ OutputTargetModel targetContainer = new OutputTargetModel();
+ root.addTreeNode(targetContainer);
+ root.setTargetContainerModel(targetContainer);
+ AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain)
smooksModelProvider.getEditingDomain();
if (inputDataList != null && obj != null && obj instanceof DocumentRoot
&& editingDomain != null) {
createInputDataGraphModel();
SmooksResourceListType listType = ((DocumentRoot) obj).getSmooksResourceList();
@@ -795,7 +820,7 @@
Object object = (Object) iterator.next();
AbstractSmooksGraphicalModel gmodel = createGraphModel(object);
if (gmodel != null) {
- root.addTreeNode(gmodel);
+ targetContainer.addTreeNode(gmodel);
}
}
getGraphicalViewer().setContents(root);
@@ -832,7 +857,15 @@
protected List<TreeNodeConnection> createConnectionModel() {
List<TreeNodeConnection> connections = new
ArrayList<TreeNodeConnection>();
if (root != null) {
- createConnection(root.getChildren(), connections);
+ List<AbstractSmooksGraphicalModel> children = new
ArrayList<AbstractSmooksGraphicalModel>();
+ List<?> containers = root.getChildren();
+ for (Iterator<?> iterator = containers.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ if (object instanceof RootModel) {
+ children.addAll(((RootModel) object).getChildren());
+ }
+ }
+ createConnection(children, connections);
}
return connections;
}
@@ -870,30 +903,12 @@
List<TreeNodeConnection> cs = new ArrayList<TreeNodeConnection>();
if (connectionModelFactory != null) {
if (connectionModelFactory.hasConnection(model)) {
- Collection<TreeNodeConnection> cList =
connectionModelFactory.createConnection(inputDataList,
- getSmooksResourceList(), root, model);
+ Collection<TreeNodeConnection> cList =
connectionModelFactory.createConnection(inputDataList, getSmooksResourceList(),
+ root, model);
if (cList != null) {
cs.addAll(cList);
}
}
- // if (connectionModelFactory.hasBeanIDConnection(model)) {
- // Collection<TreeNodeConnection> c =
- // connectionModelFactory.createBeanIDReferenceConnection(
- // getSmooksResourceList(), root, model);
- // if (c != null) {
- // cs.addAll(c);
- // }
- // }
- // // for xsl template
- //
- // if (connectionModelFactory.hasXSLConnection(model)) {
- // Collection<TreeNodeConnection> c =
- // connectionModelFactory.createXSLConnection(inputDataList, root,
- // model);
- // if (c != null) {
- // cs.addAll(c);
- // }
- // }
}
if (cs.isEmpty())
return null;
@@ -962,16 +977,14 @@
public void createConnection(List<AbstractSmooksGraphicalModel> children,
List<TreeNodeConnection> connections) {
for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator.next();
- if (!(abstractSmooksGraphicalModel instanceof InputDataContianerModel)) {
- if (canCreateConnection(abstractSmooksGraphicalModel)) {
- Collection<TreeNodeConnection> c =
createConnection(abstractSmooksGraphicalModel);
- if (c != null) {
- connections.addAll(c);
- }
+ if (canCreateConnection(abstractSmooksGraphicalModel)) {
+ Collection<TreeNodeConnection> c =
createConnection(abstractSmooksGraphicalModel);
+ if (c != null) {
+ connections.addAll(c);
}
- List<AbstractSmooksGraphicalModel> cchildren =
abstractSmooksGraphicalModel.getChildren();
- createConnection(cchildren, connections);
}
+ List<AbstractSmooksGraphicalModel> cchildren =
abstractSmooksGraphicalModel.getChildren();
+ createConnection(cchildren, connections);
}
}
@@ -1033,21 +1046,15 @@
}
EditPart rootEditPart = getGraphicalViewer().getContents();
if (rootEditPart != null) {
- List<?> childrenEditPart = rootEditPart.getChildren();
+ List<?> containers = rootEditPart.getChildren();
+ List<?> childrenEditPart = new ArrayList();
+ for (Iterator iterator = containers.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ childrenEditPart.addAll(((EditPart)object).getChildren());
+ }
for (Iterator<?> iterator = childrenEditPart.iterator(); iterator.hasNext();) {
Object object = (Object) iterator.next();
-// Object model = ((EditPart) object).getModel();
-// if (object instanceof InputDataContainerEditPart || model instanceof
XSLTemplateGraphicalModel) {
- SmooksUIUtils.expandGraphTree(expanedTreeNodeList, (TreeNodeEditPart) object);
-// }
- // if(model instanceof XSLTemplateGraphicalModel){
- // ((TreeNodeEditPart) object).expandNode();
- // if(!((TreeNodeEditPart) object).getChildren().isEmpty()){
- // SmooksUIUtils.expandGraphTree(expanedTreeNodeList,
- // (TreeNodeEditPart) ((TreeNodeEditPart)
- // object).getChildren().get(0));
- // }
- // }
+ SmooksUIUtils.expandGraphTree(expanedTreeNodeList, (TreeNodeEditPart) object);
}
}
@@ -1061,6 +1068,7 @@
@Override
protected void initializeGraphicalViewer() {
initGraphicalModel();
+ ((GraphicalEditPart) getGraphicalViewer().getRootEditPart()).getFigure().validate();
}
protected void applyGraphicalInformation(AbstractSmooksGraphicalModel graphicalModel) {
@@ -1126,9 +1134,12 @@
Node node = (Node) nodeMap.get(part);
figureList.add(part);
graphAnimation.recordInit(part);
- IMoveableModel graphicalModel = (IMoveableModel) part.getModel();
- map.put(graphicalModel, new Point(node.x, node.y));
- graphAnimation.recordFinal(part, new Rectangle(node.x, node.y, 0, 0));
+ Object gm = part.getModel();
+ if (gm instanceof IMoveableModel) {
+ IMoveableModel graphicalModel = (IMoveableModel) gm;
+ map.put(graphicalModel, new Point(node.x, node.y));
+ graphAnimation.recordFinal(part, new Rectangle(node.x, node.y, 0, 0));
+ }
}
IEditorSite editorSite = getEditorSite();
@@ -1188,7 +1199,17 @@
return graph;
}
EditPart rootEditorPart = this.getGraphicalViewer().getContents();
- List<?> children = rootEditorPart.getChildren();
+
+ List<?> containers = rootEditorPart.getChildren();
+ List children = new ArrayList();
+ for (Iterator iterator = containers.iterator(); iterator.hasNext();) {
+ Object c = (Object) iterator.next();
+ if (c instanceof OutputContainerEditPart || c instanceof InputSourceContainerEditPart)
{
+ children.addAll(((AbstractGraphicalEditPart) c).getChildren());
+ }
+ // children.add(c);
+ }
+
// HashMap<Object, Edge> edgeMap = new HashMap<Object, Edge>();
for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
Object object = (Object) iterator.next();
@@ -1308,8 +1329,8 @@
public void selectionChanged(SelectionChangedEvent event) {
updateActions(getSelectionActions());
- ISelectionProvider provider =
((SmooksTaskDetailsEditorSite)getSite()).getMultiPageEditor().getSite().getSelectionProvider();
- if(provider != null){
+ ISelectionProvider provider = ((SmooksTaskDetailsEditorSite)
getSite()).getMultiPageEditor().getSite().getSelectionProvider();
+ if (provider != null) {
provider.setSelection(event.getSelection());
}
}
@@ -1356,8 +1377,7 @@
List<AbstractSmooksGraphicalModel> children = root.getChildren();
// remove all input data graph model
for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
- AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator
- .next();
+ AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator.next();
if (abstractSmooksGraphicalModel instanceof InputDataContianerModel) {
inputs.add((InputDataContianerModel) abstractSmooksGraphicalModel);
}
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-06-07
02:12:01 UTC (rev 22593)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -47,6 +47,7 @@
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -141,7 +142,7 @@
private GraphViewer processGraphViewer;
- private ScrolledPageBook pageBook;
+// private ScrolledPageBook pageBook;
private Map<String, Object> registedTaskPages = new HashMap<String,
Object>();
@@ -152,7 +153,11 @@
private ProcessType process;
private Map<Object, String> smooksModelIdMap = new HashMap<Object,
String>();
+
+ private Map<String,Object> detailsControlMap = new HashMap<String,
Object>();
+ private Composite detailsContentsComposite;
+
public SmooksProcessGraphicalEditor(FormEditor editor, String id, String title,
ISmooksModelProvider provider) {
super(editor, id, title);
this.smooksModelProvider = provider;
@@ -533,14 +538,17 @@
Section section = toolkit.createSection(taskDetailsComposite, Section.TITLE_BAR);
section.setText(Messages.SmooksProcessGraphicalEditor_TaskConfigurationSectionTitle);
- pageBook = new ScrolledPageBook(section);
- pageBook.setBackground(toolkit.getColors().getBackground());
- section.setClient(pageBook);
+ detailsContentsComposite = toolkit.createComposite(section);
+ section.setClient(detailsContentsComposite);
+// pageBook = new ScrolledPageBook(section);
+ section.setLayout(new FillLayout());
+// pageBook.setBackground(toolkit.getColors().getBackground());
+// section.setClient(pageBook);
- Composite emptyComposite = pageBook.createPage(emptyKey);
- emptyComposite.setLayout(new FillLayout());
- createEmptyTaskPanel(emptyComposite, toolkit);
- pageBook.showPage(emptyKey);
+// Composite emptyComposite = pageBook.createPage(emptyKey);
+// emptyComposite.setLayout(new FillLayout());
+// createEmptyTaskPanel(emptyComposite, toolkit);
+// pageBook.showPage(emptyKey);
}
/*
@@ -575,7 +583,7 @@
createTaskDetailsSection(toolkit, sashForm);
- sashForm.setWeights(new int[] { 3, 7 });
+ sashForm.setWeights(new int[] { 2, 8 });
validateEnd(null);
}
@@ -891,20 +899,45 @@
}
public Object getActiveEditorPage() {
- if (pageBook != null) {
- Control control = pageBook.getCurrentPage();
- return control.getData();
+ if(detailsContentsComposite != null){
+ Control[] controls = detailsContentsComposite.getChildren();
+ for (int i = 0; i < controls.length; i++) {
+ Control control = controls[i];
+ if( control.isVisible()){
+ return control.getData();
+ }
+ }
}
+// if (pageBook != null) {
+// Control control = pageBook.getCurrentPage();
+// return control.getData();
+// }
return null;
}
+
+ private void showEmptyPage(){
+ Control[] childrens = detailsContentsComposite.getChildren();
+ for (int i = 0; i < childrens.length; i++) {
+ Control child = childrens[i];
+ GridData gd = new GridData();
+ gd.exclude = true;
+ child.setLayoutData(gd);
+ child.setVisible(false);
+ child.setBounds(new Rectangle(0, 0, 0, 0));
+ }
+ detailsContentsComposite.setLayout(new GridLayout());
+ detailsContentsComposite.layout(false);
+ }
protected void showTaskControl(Object model) {
- if (pageBook == null)
+ if (detailsContentsComposite == null)
return;
- if (model == null)
- pageBook.showEmptyPage();
+ if (model == null){
+ showEmptyPage();
+ }
final Object finalModel = model;
- pageBook.getShell().getDisplay().syncExec(new Runnable() {
+ detailsContentsComposite.setLayout(new FillLayout());
+ detailsContentsComposite.getShell().getDisplay().syncExec(new Runnable() {
/*
* (non-Javadoc)
@@ -929,34 +962,60 @@
}
}
if (id != null) {
- if (!pageBook.hasPage(id)) {
- Composite parent = pageBook.createPage(id);
+ if (!detailsControlMap.containsKey(id)) {
+// Composite parent = pageBook.createPage(id);
+ Control[] childrens = detailsContentsComposite.getChildren();
+ for (int i = 0; i < childrens.length; i++) {
+ Control child = childrens[i];
+ child.setVisible(false);
+ child.setBounds(new Rectangle(0, 0, 0, 0));
+ if(child.getLayoutData() instanceof GridData){
+ ((GridData)child.getLayoutData()).exclude = true;
+ }
+ }
Object page = getRegisteTaskPage(id);
if (page != null && page instanceof IEditorPart) {
try {
- parent.setLayout(new FillLayout());
-
+ detailsContentsComposite.setLayout(new GridLayout());
+ Composite contentParent = toolkit.createComposite(detailsContentsComposite);
+ contentParent.setLayout(new FillLayout());
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ contentParent.setLayoutData(gd);
ITaskNodeProvider nodeProvider = (ITaskNodeProvider) ((IEditorPart) page)
.getAdapter(ITaskNodeProvider.class);
if (nodeProvider != null) {
nodeProvider.setTaskType((TaskType) finalModel);
}
- createTaskPage((IEditorPart) page, parent);
- pageBook.showPage(id);
- parent.setData(page);
+ createTaskPage((IEditorPart) page, contentParent);
+ detailsContentsComposite.layout(false);
+ contentParent.setData(page);
+ detailsControlMap.put(id, contentParent);
} catch (Throwable e) {
e.printStackTrace();
- pageBook.removePage(id);
- pageBook.showPage(emptyKey);
+ detailsControlMap.remove(id);
+ showEmptyPage();
}
} else {
- Control control = createTaskPanel(parent, toolkit, id);
+ for (int i = 0; i < childrens.length; i++) {
+ Control child = childrens[i];
+ child.setVisible(false);
+ child.setBounds(new Rectangle(0, 0, 0, 0));
+ if(child.getLayoutData() instanceof GridData){
+ ((GridData)child.getLayoutData()).exclude = true;
+ }
+ }
+ Control control = createTaskPanel(detailsContentsComposite, toolkit, id);
if (control != null) {
- pageBook.showPage(id);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ control.setLayoutData(gd);
+ detailsContentsComposite.layout(false);
+ detailsControlMap.put(id, control);
} else {
- pageBook.removePage(id);
- pageBook.showPage(emptyKey);
+ detailsControlMap.remove(id);
+ showEmptyPage();
+// pageBook.removePage(id);
+// pageBook.showPage(emptyKey);
}
}
} else {
@@ -966,17 +1025,115 @@
if (nodeProvider != null) {
nodeProvider.setTaskType((TaskType) finalModel);
}
- pageBook.showPage(id);
+ Control[] childrens = detailsContentsComposite.getChildren();
+ for (int i = 0; i < childrens.length; i++) {
+ Control child = childrens[i];
+ GridData gd = new GridData();
+ gd.exclude = true;
+ child.setLayoutData(gd);
+ child.setVisible(false);
+ child.setBounds(new Rectangle(0, 0, 0, 0));
+ }
+ detailsContentsComposite.setLayout(new GridLayout());
+
+ Control contentParent = (Control)detailsControlMap.get(id);
+ contentParent.setVisible(true);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ contentParent.setLayoutData(gd);
+ detailsContentsComposite.layout(false);
}
}
} else {
- // pageBook.showEmptyPage();
+ showEmptyPage();
}
}
});
updateGlobalActions();
}
+
+// protected void showTaskControl(Object model) {
+// if (pageBook == null)
+// return;
+// if (model == null){
+// pageBook.showEmptyPage();
+// }
+// final Object finalModel = model;
+// pageBook.setLayout(new FillLayout());
+// pageBook.setAlwaysShowScrollBars(false);
+// pageBook.getShell().getDisplay().syncExec(new Runnable() {
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see java.lang.Runnable#run()
+// */
+// public void run() {
+// FormToolkit toolkit = ((AbstractSmooksFormEditor)
smooksModelProvider).getToolkit();
+// if (finalModel instanceof TaskType) {
+// String id = ((TaskType) finalModel).getId();
+// if (!isSingltonEditor(id)) {
+// String idref = generateTaskSpecailID((TaskType) finalModel);
+// if (idref != null) {
+// // idref = id + "_" + idref;
+// if (getRegisteTaskPage(idref) == null) {
+// IEditorPart editor = createEditorPart(finalModel);
+// registeTaskDetailsPage(editor, idref);
+// }
+// id = idref;
+// } else {
+// id = id + "_unknown"; //$NON-NLS-1$
+// }
+// }
+// if (id != null) {
+// if (!pageBook.hasPage(id)) {
+// Composite parent = pageBook.createPage(id);
+// Object page = getRegisteTaskPage(id);
+// if (page != null && page instanceof IEditorPart) {
+// try {
+// parent.setLayout(new FillLayout());
+//
+// ITaskNodeProvider nodeProvider = (ITaskNodeProvider) ((IEditorPart) page)
+// .getAdapter(ITaskNodeProvider.class);
+// if (nodeProvider != null) {
+// nodeProvider.setTaskType((TaskType) finalModel);
+// }
+// createTaskPage((IEditorPart) page, parent);
+// pageBook.showPage(id);
+// parent.setData(page);
+//
+// } catch (Throwable e) {
+// e.printStackTrace();
+// pageBook.removePage(id);
+// pageBook.showPage(emptyKey);
+// }
+// } else {
+// Control control = createTaskPanel(parent, toolkit, id);
+// if (control != null) {
+// pageBook.showPage(id);
+// } else {
+// pageBook.removePage(id);
+// pageBook.showPage(emptyKey);
+// }
+// }
+// } else {
+// Object page = getRegisteTaskPage(id);
+// ITaskNodeProvider nodeProvider = (ITaskNodeProvider) ((IEditorPart) page)
+// .getAdapter(ITaskNodeProvider.class);
+// if (nodeProvider != null) {
+// nodeProvider.setTaskType((TaskType) finalModel);
+// }
+// pageBook.showPage(id);
+// }
+// }
+// } else {
+// // pageBook.showEmptyPage();
+// }
+// }
+//
+// });
+// updateGlobalActions();
+// }
protected IEditorSite createSite(IEditorPart editor) {
return new SmooksTaskDetailsEditorSite(this.getEditor(), editor, this);
@@ -1014,16 +1171,22 @@
}
registedTaskPages.clear();
- if (pageBook != null) {
- List<TaskTypeDescriptor> tasks = TaskTypeManager.getAllTaskList();
- for (Iterator<?> iterator = tasks.iterator(); iterator.hasNext();) {
- TaskTypeDescriptor taskTypeDescriptor = (TaskTypeDescriptor) iterator.next();
- pageBook.removePage(taskTypeDescriptor.getId(), true);
+ if (detailsContentsComposite != null) {
+ Control[] controls = detailsContentsComposite.getChildren();
+ for (int i = 0; i < controls.length; i++) {
+ Control c = controls[i];
+ c.dispose();
}
- for (Iterator<String> iterator = smooksModelIdMap.values().iterator();
iterator.hasNext();) {
- String id = (String) iterator.next();
- pageBook.removePage(id, true);
- }
+ detailsControlMap.clear();
+// List<TaskTypeDescriptor> tasks = TaskTypeManager.getAllTaskList();
+// for (Iterator<?> iterator = tasks.iterator(); iterator.hasNext();) {
+// TaskTypeDescriptor taskTypeDescriptor = (TaskTypeDescriptor) iterator.next();
+// pageBook.removePage(taskTypeDescriptor.getId(), true);
+// }
+// for (Iterator<String> iterator = smooksModelIdMap.values().iterator();
iterator.hasNext();) {
+// String id = (String) iterator.next();
+// pageBook.removePage(id, true);
+// }
}
List<TaskTypeDescriptor> tasks = TaskTypeManager.getAllTaskList();
@@ -1034,49 +1197,9 @@
this.registeTaskDetailsPage(part, taskTypeDescriptor.getId());
}
}
-
- // registedTaskPages.clear();
- // Collection<Object> editors = registedTaskPages.values();
- // for (Iterator<?> iterator = editors.iterator(); iterator.hasNext();)
- // {
- // Object object = (Object) iterator.next();
- // if (object instanceof ISmooksGraphChangeListener) {
- // ((ISourceSynchronizeListener) object).sourceChange(model);
- // }
- // }
}
- // public void graphChanged(SmooksGraphicsExtType extType) {
- // Collection<Object> editors = registedTaskPages.values();
- // for (Iterator<?> iterator = editors.iterator(); iterator.hasNext();) {
- // Object object = (Object) iterator.next();
- // if (object instanceof ISmooksGraphChangeListener) {
- // ((ISmooksGraphChangeListener) object).graphChanged(extType);
- // }
- // }
- // }
- // public void graphPropertyChange(EStructuralFeature featre, Object value)
- // {
- // Collection<Object> editors = registedTaskPages.values();
- // for (Iterator<?> iterator = editors.iterator(); iterator.hasNext();) {
- // Object object = (Object) iterator.next();
- // if (object instanceof ISmooksGraphChangeListener) {
- // ((ISmooksGraphChangeListener) object).graphPropertyChange(featre, value);
- // }
- // }
- // }
-
- // public void inputTypeChanged(SmooksGraphicsExtType extType) {
- // Collection<Object> editors = registedTaskPages.values();
- // for (Iterator<?> iterator = editors.iterator(); iterator.hasNext();) {
- // Object object = (Object) iterator.next();
- // if (object instanceof ISmooksGraphChangeListener) {
- // ((ISmooksGraphChangeListener) object).inputTypeChanged(extType);
- // }
- // }
- // }
-
public void propertyChanged(Object source, int propId) {
this.firePropertyChange(propId);
if (propId == PROP_DIRTY) {
@@ -1266,7 +1389,7 @@
private void disposeTaskDetails(Object deleteTask) {
final Object finalModel = deleteTask;
- pageBook.getShell().getDisplay().syncExec(new Runnable() {
+ detailsContentsComposite.getShell().getDisplay().syncExec(new Runnable() {
/*
* (non-Javadoc)
@@ -1284,12 +1407,19 @@
id = id + "_unknown"; //$NON-NLS-1$
}
if (id != null) {
- if (pageBook.hasPage(id)) {
- pageBook.removePage(id);
+ if(detailsControlMap.containsKey(id)){
+ ((Control)detailsControlMap.get(id)).dispose();
+ detailsControlMap.remove(id);
Object registPage = getRegisteTaskPage(id);
removeTaskDetailsPage((IEditorPart) registPage, id);
} else {
}
+// if (pageBook.hasPage(id)) {
+// pageBook.removePage(id);
+// Object registPage = getRegisteTaskPage(id);
+// removeTaskDetailsPage((IEditorPart) registPage, id);
+// } else {
+// }
}
}
} else {
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/autolayout/JavaMappingAutoLayout.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/autolayout/JavaMappingAutoLayout.java 2010-06-07
02:12:01 UTC (rev 22593)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/autolayout/JavaMappingAutoLayout.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -64,7 +64,7 @@
input_y = cha;
}
inputNode.y = input_y;
- java_x = inputNode.x + inputNode.width + INPUT_JAVA_WIDTH;
+ java_x = inputNode.x ;
}
for (Iterator<?> iterator = javaNodes.iterator(); iterator.hasNext();) {
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/InputSourceContainerEditPart.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/InputSourceContainerEditPart.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/InputSourceContainerEditPart.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -0,0 +1,91 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.graphical.editors.editparts;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.jboss.tools.smooks.gef.common.RootModel;
+import org.jboss.tools.smooks.gef.tree.editpolicy.RootPanelXYLayoutEditPolicy;
+import org.jboss.tools.smooks.gef.tree.editpolicy.SmooksRootEditPartLayoutEditPolicy;
+import org.jboss.tools.smooks.graphical.figures.ContainerFigure;
+import org.jboss.tools.smooks.graphical.figures.SourceContainerFigure;
+
+/**
+ * @author Dart
+ *
+ */
+public class InputSourceContainerEditPart extends AbstractGraphicalEditPart implements
PropertyChangeListener{
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
+ */
+ @Override
+ protected IFigure createFigure() {
+ IFigure fi = new SourceContainerFigure();
+ fi.setBounds(new Rectangle(10,50,400,300));
+ return fi;
+ }
+
+ @Override
+ public IFigure getContentPane() {
+ return ((ContainerFigure)getFigure()).getContentsPane();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#activate()
+ */
+ @Override
+ public void activate() {
+ ((RootModel)getModel()).addPropertyChangeListener(this);
+ super.activate();
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#deactivate()
+ */
+ @Override
+ public void deactivate() {
+ super.deactivate();
+ ((RootModel)getModel()).removePropertyChangeListener(this);
+ }
+
+ @Override
+ public DragTracker getDragTracker(Request request) {
+ return new RightClickSelectMarqueeDragTraker();
+// return super.getDragTracker(request);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
+ */
+ @Override
+ protected void createEditPolicies() {
+ this.installEditPolicy(EditPolicy.LAYOUT_ROLE, new RootPanelXYLayoutEditPolicy());
+ this.installEditPolicy(EditPolicy.LAYOUT_ROLE, new
SmooksRootEditPartLayoutEditPolicy());
+ }
+
+ protected List<?> getModelChildren(){
+ RootModel list = (RootModel) getModel();
+ return list.getChildren();
+ }
+
+
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if(evt.getPropertyName().equals(RootModel.ADD_CHILDREN) ||
evt.getPropertyName().equals(RootModel.REMOVE_CHILDREN)){
+ this.refreshChildren();
+ }
+ }
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/InputSourceContainerEditPart.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/OutputContainerEditPart.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/OutputContainerEditPart.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/OutputContainerEditPart.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -0,0 +1,94 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.graphical.editors.editparts;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.jboss.tools.smooks.gef.common.RootModel;
+import org.jboss.tools.smooks.gef.tree.editpolicy.RootPanelXYLayoutEditPolicy;
+import org.jboss.tools.smooks.gef.tree.editpolicy.SmooksRootEditPartLayoutEditPolicy;
+import org.jboss.tools.smooks.graphical.figures.ContainerFigure;
+import org.jboss.tools.smooks.graphical.figures.TargetContainerFigure;
+
+/**
+ * @author Dart
+ *
+ */
+public class OutputContainerEditPart extends AbstractGraphicalEditPart implements
PropertyChangeListener{
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
+ */
+ @Override
+ protected IFigure createFigure() {
+ IFigure fi = new TargetContainerFigure();
+ fi.setBounds(new Rectangle(500,50,400,300));
+ return fi;
+ }
+
+ @Override
+ public IFigure getContentPane() {
+ return ((ContainerFigure)getFigure()).getContentsPane();
+ }
+
+
+
+ @Override
+ public DragTracker getDragTracker(Request request) {
+ return new RightClickSelectMarqueeDragTraker();
+// return super.getDragTracker(request);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#activate()
+ */
+ @Override
+ public void activate() {
+ ((RootModel)getModel()).addPropertyChangeListener(this);
+ super.activate();
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#deactivate()
+ */
+ @Override
+ public void deactivate() {
+ super.deactivate();
+ ((RootModel)getModel()).removePropertyChangeListener(this);
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
+ */
+ @Override
+ protected void createEditPolicies() {
+ this.installEditPolicy(EditPolicy.LAYOUT_ROLE, new RootPanelXYLayoutEditPolicy());
+ this.installEditPolicy(EditPolicy.LAYOUT_ROLE, new
SmooksRootEditPartLayoutEditPolicy());
+ }
+
+ protected List<?> getModelChildren(){
+ RootModel list = (RootModel) getModel();
+ return list.getChildren();
+ }
+
+
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if(evt.getPropertyName().equals(RootModel.ADD_CHILDREN) ||
evt.getPropertyName().equals(RootModel.REMOVE_CHILDREN)){
+ this.refreshChildren();
+ }
+ }
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/OutputContainerEditPart.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/SmooksGraphUtil.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/SmooksGraphUtil.java 2010-06-07
02:12:01 UTC (rev 22593)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/SmooksGraphUtil.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -90,15 +90,25 @@
public static AbstractSmooksGraphicalModel findSmooksGraphModel(RootModel root, Object
object) {
if (root != null && object != null) {
- List<?> children = root.getChildren();
+
+ List<?> rc = root.getChildren();
+ List<AbstractSmooksGraphicalModel> children = new ArrayList();
+ for (Iterator iterator = rc.iterator(); iterator.hasNext();) {
+ Object object2 = (Object) iterator.next();
+ if(object2 instanceof RootModel){
+ children.addAll( ((RootModel)object2).getChildren());
+ }
+ }
for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
AbstractSmooksGraphicalModel child = (AbstractSmooksGraphicalModel) iterator.next();
-// if (child instanceof InputDataContianerModel) {
-// continue;
-// }
- AbstractSmooksGraphicalModel model = findGraphicalModel(child, object);
- if (model != null) {
- return model;
+ if(child instanceof RootModel){
+ AbstractSmooksGraphicalModel result = findSmooksGraphModel((RootModel)child,
object);
+ if(result != null) return result;
+ }else{
+ AbstractSmooksGraphicalModel model = findGraphicalModel(child, object);
+ if (model != null) {
+ return model;
+ }
}
}
}
@@ -144,7 +154,12 @@
break;
}
}
- List<AbstractSmooksGraphicalModel> children = graphRoot.getChildren();
+ List<AbstractSmooksGraphicalModel> containers = graphRoot.getChildren();
+ List<AbstractSmooksGraphicalModel> children = new
ArrayList<AbstractSmooksGraphicalModel>();
+ for (Iterator<?> iterator = containers.iterator(); iterator.hasNext();) {
+ AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator.next();
+ children.addAll(abstractSmooksGraphicalModel.getChildren());
+ }
if (model != null) {
AbstractSmooksGraphicalModel parentGraph = null;
for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
Modified:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/SmooksRootEditPart.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/SmooksRootEditPart.java 2010-06-07
02:12:01 UTC (rev 22593)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/editparts/SmooksRootEditPart.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -11,6 +11,7 @@
package org.jboss.tools.smooks.graphical.editors.editparts;
import org.eclipse.gef.DefaultEditDomain;
+import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.ui.IEditorPart;
@@ -34,7 +35,14 @@
*/
@Override
protected void createEditPolicies() {
- this.installEditPolicy(EditPolicy.LAYOUT_ROLE, new
SmooksRootEditPartLayoutEditPolicy());
+ this.installEditPolicy(EditPolicy.LAYOUT_ROLE, new
SmooksRootEditPartLayoutEditPolicy(){
+
+ @Override
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ return null;
+ }
+
+ });
}
protected IEditorPart getEditorPart() {
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputSourceContainerModel.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputSourceContainerModel.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputSourceContainerModel.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -0,0 +1,11 @@
+package org.jboss.tools.smooks.graphical.editors.model;
+
+import org.jboss.tools.smooks.gef.common.RootModel;
+
+public class InputSourceContainerModel extends RootModel{
+
+ public InputSourceContainerModel() {
+ super();
+ }
+
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputSourceContainerModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/OutputTargetModel.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/OutputTargetModel.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/OutputTargetModel.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -0,0 +1,18 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.graphical.editors.model;
+
+import org.jboss.tools.smooks.gef.common.RootModel;
+
+/**
+ * @author Dart
+ *
+ */
+public class OutputTargetModel extends RootModel{
+
+ public OutputTargetModel() {
+ super();
+ }
+
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/OutputTargetModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/ContainerBorder.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/ContainerBorder.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/ContainerBorder.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -0,0 +1,54 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.graphical.figures;
+
+import org.eclipse.draw2d.AbstractBorder;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
+
+/**
+ * @author Dart
+ *
+ */
+public class ContainerBorder extends AbstractBorder {
+ protected static Insets insets = new Insets(2,2,2,2);
+ /* (non-Javadoc)
+ * @see org.eclipse.draw2d.Border#getInsets(org.eclipse.draw2d.IFigure)
+ */
+ public Insets getInsets(IFigure figure) {
+ return insets;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.draw2d.Border#paint(org.eclipse.draw2d.IFigure,
org.eclipse.draw2d.Graphics, org.eclipse.draw2d.geometry.Insets)
+ */
+ public void paint(IFigure figure, Graphics g, Insets insets) {
+ Rectangle r = figure.getBounds().getCropped(insets);
+
+ g.setForegroundColor(GraphicsConstants.TB_BG_CORLOR);
+ g.setBackgroundColor(GraphicsConstants.TB_BG_CORLOR);
+
+ //Draw the sides of the border
+ g.fillRectangle(r.x, r.y + 2, r.width, 6);
+ g.fillRectangle(r.x, r.bottom() - 8, r.width, 6);
+ g.fillRectangle(r.x, r.y + 2, 6, r.height - 4);
+ g.fillRectangle(r.right() - 6, r.y + 2, 6, r.height - 4);
+
+// //Outline the border
+// g.setForegroundColor(ColorConstants.red);
+// g.drawLine(r.x, r.y + 2, r.right() - 1, r.y + 2);
+// g.drawLine(r.x, r.bottom() - 3, r.right() - 1, r.bottom() - 3);
+// g.drawLine(r.x, r.y + 2, r.x, r.bottom() - 3);
+// g.drawLine(r.right() - 1, r.bottom() - 3, r.right() - 1, r.y + 2);
+//
+// r.crop(new Insets(1, 1, 0, 0));
+// r.expand(1, 1);
+// r.crop(getInsets(figure));
+ }
+
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/ContainerBorder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/ContainerFigure.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/ContainerFigure.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/ContainerFigure.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -0,0 +1,59 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.graphical.figures;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FreeformLayer;
+import org.eclipse.draw2d.FreeformLayout;
+import org.eclipse.draw2d.FreeformViewport;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ScrollPane;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * @author Dart
+ *
+ */
+public class ContainerFigure extends Figure {
+
+ private FreeformLayer pane;
+
+
+
+ public ContainerFigure() {
+ super();
+ this.setBorder(new ContainerBorder());
+ ScrollPane scrollpane = new ScrollPane();
+ pane = new FreeformLayer();
+ pane.setLayoutManager(new FreeformLayout());
+ setLayoutManager(new StackLayout());
+ add(scrollpane);
+ scrollpane.setViewport(new FreeformViewport());
+ scrollpane.setContents(pane);
+
+ setBackgroundColor(ColorConstants.listBackground);
+ setOpaque(true);
+ }
+
+ public IFigure getContentsPane(){
+ return pane;
+ }
+
+ @Override
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ return new Dimension(400,500);
+ }
+
+ protected void paintFigure(Graphics graphics) {
+ Rectangle rect = getBounds().getCopy();
+ rect.crop(new Insets(2,0,2,0));
+ graphics.fillRectangle(rect);
+ }
+
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/ContainerFigure.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/FillLayout.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/FillLayout.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/FillLayout.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -0,0 +1,66 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.graphical.figures;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.AbstractLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author Dart
+ *
+ */
+public class FillLayout extends AbstractLayout {
+
+ private Control canvas;
+
+ public FillLayout(Control canvas) {
+ this.canvas = canvas;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.draw2d.AbstractLayout#calculatePreferredSize(org.eclipse.
+ * draw2d.IFigure, int, int)
+ */
+ @Override
+ protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint) {
+ return container.getPreferredSize(wHint, hHint);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.draw2d.LayoutManager#layout(org.eclipse.draw2d.IFigure)
+ */
+ public void layout(IFigure container) {
+ List<?> children = container.getChildren();
+ for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
+ IFigure child = (IFigure) iterator.next();
+
+ Rectangle rect = container.getBounds();// getClientArea(Rectangle.SINGLETON);
+ if (canvas != null) {
+ rect = new Rectangle(canvas.getBounds().x, canvas.getBounds().y,
canvas.getBounds().width, canvas.getBounds().height);
+ }
+ int cw = rect.width / 3 ;
+ int ch = rect.height - 60 ;
+ cw = Math.min(cw, 800);
+ ch = Math.min(ch, 800);
+ int x = 30;
+ int y = 30;
+ if (child instanceof TargetContainerFigure) {
+ x = cw*2 - 30;
+ }
+ child.setBounds(new Rectangle(x, y, cw, ch));
+ }
+ }
+
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/FillLayout.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/SourceContainerFigure.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/SourceContainerFigure.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/SourceContainerFigure.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -0,0 +1,12 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.graphical.figures;
+
+/**
+ * @author Dart
+ *
+ */
+public class SourceContainerFigure extends ContainerFigure {
+
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/SourceContainerFigure.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/TargetContainerFigure.java
===================================================================
---
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/TargetContainerFigure.java
(rev 0)
+++
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/TargetContainerFigure.java 2010-06-07
07:46:49 UTC (rev 22594)
@@ -0,0 +1,12 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.graphical.figures;
+
+/**
+ * @author Dart
+ *
+ */
+public class TargetContainerFigure extends ContainerFigure {
+
+}
Property changes on:
workspace/smooks-dmb/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/figures/TargetContainerFigure.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain