You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ch...@apache.org on 2006/02/22 00:40:29 UTC
svn commit: r379627 [30/34] - in /incubator/servicemix/trunk: ./ etc/
sandbox/servicemix-wsn-1.2/src/sa/META-INF/
sandbox/servicemix-wsn-1.2/src/su/META-INF/ servicemix-assembly/
servicemix-assembly/src/main/assembly/ servicemix-assembly/src/main/relea...
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyDescriptorInjector.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyDescriptorInjector.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyDescriptorInjector.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyDescriptorInjector.java Tue Feb 21 15:40:05 2006
@@ -1,54 +1,54 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.engine;
-
-import java.io.StringWriter;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.apache.servicemix.packaging.model.ModelElement;
-import org.apache.servicemix.packaging.model.ServiceAssembly;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class ServiceAssemblyDescriptorInjector implements PackagingInjector {
-
- private ServiceAssembly serviceAssembly;
-
- public boolean canInject(ModelElement modelElement) {
- if (modelElement instanceof ServiceAssembly) {
- serviceAssembly = (ServiceAssembly) modelElement;
- return true;
- }
- return false;
- }
-
- public void inject(IProgressMonitor monitor, IProject project,
- ZipOutputStream outputStream) {
- try {
- StringWriter stringWriter = new StringWriter();
- ServiceAssemblyDescriptorWriter writer = new ServiceAssemblyDescriptorWriter();
- writer.write(stringWriter, serviceAssembly);
- outputStream.putNextEntry(new ZipEntry("META-INF/jbi.xml"));
- outputStream.write(stringWriter.toString().getBytes());
- outputStream.closeEntry();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- }
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.engine;
+
+import java.io.StringWriter;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.servicemix.packaging.model.ModelElement;
+import org.apache.servicemix.packaging.model.ServiceAssembly;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class ServiceAssemblyDescriptorInjector implements PackagingInjector {
+
+ private ServiceAssembly serviceAssembly;
+
+ public boolean canInject(ModelElement modelElement) {
+ if (modelElement instanceof ServiceAssembly) {
+ serviceAssembly = (ServiceAssembly) modelElement;
+ return true;
+ }
+ return false;
+ }
+
+ public void inject(IProgressMonitor monitor, IProject project,
+ ZipOutputStream outputStream) {
+ try {
+ StringWriter stringWriter = new StringWriter();
+ ServiceAssemblyDescriptorWriter writer = new ServiceAssemblyDescriptorWriter();
+ writer.write(stringWriter, serviceAssembly);
+ outputStream.putNextEntry(new ZipEntry("META-INF/jbi.xml"));
+ outputStream.write(stringWriter.toString().getBytes());
+ outputStream.closeEntry();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyDescriptorInjector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyDescriptorWriter.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyDescriptorWriter.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyDescriptorWriter.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyDescriptorWriter.java Tue Feb 21 15:40:05 2006
@@ -1,81 +1,81 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.engine;
-
-import java.io.Writer;
-
-import org.apache.servicemix.packaging.model.ServiceAssembly;
-import org.apache.servicemix.packaging.model.ServiceUnit;
-import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
-import org.codehaus.plexus.util.xml.XMLWriter;
-
-/**
- * The Service Assembly descriptor writer
- *
- * @author <a href="mailto:costello.tony@gmail.com">Tony Costello </a>
- *
- */
-public class ServiceAssemblyDescriptorWriter {
-
- public void write(Writer w, ServiceAssembly assembly) {
- XMLWriter writer = new PrettyPrintXMLWriter(w, "UTF-8", null);
- writer.startElement("jbi");
- writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
-
- writer.addAttribute("version", "1.0");
-
- writer.startElement("service-assembly");
- writer.startElement("identification");
-
- writer.startElement("name");
- writer.writeText(assembly.getName());
- writer.endElement();
-
- writer.startElement("description");
- // writer.writeText(assembly.getDescription());
- writer.endElement();
-
- writer.endElement();
-
- for (ServiceUnit unit : assembly.getServiceUnit()) {
- writer.startElement("service-unit");
- writer.startElement("identification");
- writer.startElement("name");
- writer.writeText(unit.getServiceUnitName());
- writer.endElement();
- writer.startElement("description");
- // writer.writeText(unit.getDescription());
- writer.endElement();
- writer.endElement();
-
- writer.startElement("target");
- writer.startElement("artifacts-zip");
- writer.writeText(unit.getServiceUnitName() + ".zip");
- writer.endElement();
-
- writer.startElement("component-name");
- writer.writeText(assembly.getComponentArtifact()
- .getComponentDefinitionByName(assembly.getComponentName())
- .getName());
- writer.endElement();
-
- writer.endElement();
- writer.endElement();
- }
- writer.endElement();
- writer.endElement();
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.engine;
+
+import java.io.Writer;
+
+import org.apache.servicemix.packaging.model.ServiceAssembly;
+import org.apache.servicemix.packaging.model.ServiceUnit;
+import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
+import org.codehaus.plexus.util.xml.XMLWriter;
+
+/**
+ * The Service Assembly descriptor writer
+ *
+ * @author <a href="mailto:costello.tony@gmail.com">Tony Costello </a>
+ *
+ */
+public class ServiceAssemblyDescriptorWriter {
+
+ public void write(Writer w, ServiceAssembly assembly) {
+ XMLWriter writer = new PrettyPrintXMLWriter(w, "UTF-8", null);
+ writer.startElement("jbi");
+ writer.addAttribute("xmlns", "http://java.sun.com/xml/ns/jbi");
+
+ writer.addAttribute("version", "1.0");
+
+ writer.startElement("service-assembly");
+ writer.startElement("identification");
+
+ writer.startElement("name");
+ writer.writeText(assembly.getName());
+ writer.endElement();
+
+ writer.startElement("description");
+ // writer.writeText(assembly.getDescription());
+ writer.endElement();
+
+ writer.endElement();
+
+ for (ServiceUnit unit : assembly.getServiceUnit()) {
+ writer.startElement("service-unit");
+ writer.startElement("identification");
+ writer.startElement("name");
+ writer.writeText(unit.getServiceUnitName());
+ writer.endElement();
+ writer.startElement("description");
+ // writer.writeText(unit.getDescription());
+ writer.endElement();
+ writer.endElement();
+
+ writer.startElement("target");
+ writer.startElement("artifacts-zip");
+ writer.writeText(unit.getServiceUnitName() + ".zip");
+ writer.endElement();
+
+ writer.startElement("component-name");
+ writer.writeText(assembly.getComponentArtifact()
+ .getComponentDefinitionByName(assembly.getComponentName())
+ .getName());
+ writer.endElement();
+
+ writer.endElement();
+ writer.endElement();
+ }
+ writer.endElement();
+ writer.endElement();
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyDescriptorWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyPackagingEngine.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyPackagingEngine.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyPackagingEngine.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyPackagingEngine.java Tue Feb 21 15:40:05 2006
@@ -1,72 +1,72 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.engine;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.zip.ZipOutputStream;
-
-import org.apache.servicemix.packaging.model.ModelElement;
-import org.apache.servicemix.packaging.model.ServiceAssembly;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class ServiceAssemblyPackagingEngine extends AbstractPackagingEngine {
-
- private ServiceAssembly serviceAssembly;
-
- public boolean canDeploy(ModelElement modelElement) {
- if (modelElement instanceof ServiceAssembly) {
- serviceAssembly = (ServiceAssembly) modelElement;
- setArtifact(serviceAssembly.getComponentArtifact());
- return true;
- }
- return false;
- }
-
- public void deploy(IProgressMonitor monitor, IProject project) {
- ZipOutputStream out = null;
- try {
- String fileName = "/" + serviceAssembly.getName() + "-sa.zip";
- out = new ZipOutputStream(new FileOutputStream(
- getDeploymentDir(serviceAssembly) + fileName));
-
- for (PackagingInjector injector : getInjectors()) {
- if (injector.canInject(serviceAssembly)) {
- injector.inject(monitor, project, out);
- }
- }
-
- out.close();
- } catch (Throwable e) {
- throw new RuntimeException(e);
- } finally {
- if (out != null)
- try {
- out.close();
- } catch (IOException e) {
- // Ignore?
- }
- }
-
- }
-
- public void undeploy(IProgressMonitor monitor, IProject project) {
- // TODO Needs implementing
-
- }
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.engine;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.servicemix.packaging.model.ModelElement;
+import org.apache.servicemix.packaging.model.ServiceAssembly;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class ServiceAssemblyPackagingEngine extends AbstractPackagingEngine {
+
+ private ServiceAssembly serviceAssembly;
+
+ public boolean canDeploy(ModelElement modelElement) {
+ if (modelElement instanceof ServiceAssembly) {
+ serviceAssembly = (ServiceAssembly) modelElement;
+ setArtifact(serviceAssembly.getComponentArtifact());
+ return true;
+ }
+ return false;
+ }
+
+ public void deploy(IProgressMonitor monitor, IProject project) {
+ ZipOutputStream out = null;
+ try {
+ String fileName = "/" + serviceAssembly.getName() + "-sa.zip";
+ out = new ZipOutputStream(new FileOutputStream(
+ getDeploymentDir(serviceAssembly) + fileName));
+
+ for (PackagingInjector injector : getInjectors()) {
+ if (injector.canInject(serviceAssembly)) {
+ injector.inject(monitor, project, out);
+ }
+ }
+
+ out.close();
+ } catch (Throwable e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (out != null)
+ try {
+ out.close();
+ } catch (IOException e) {
+ // Ignore?
+ }
+ }
+
+ }
+
+ public void undeploy(IProgressMonitor monitor, IProject project) {
+ // TODO Needs implementing
+
+ }
+
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceAssemblyPackagingEngine.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceUnitZipInjector.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceUnitZipInjector.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceUnitZipInjector.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceUnitZipInjector.java Tue Feb 21 15:40:05 2006
@@ -1,82 +1,82 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.engine;
-
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.apache.servicemix.packaging.model.ModelElement;
-import org.apache.servicemix.packaging.model.ServiceAssembly;
-import org.apache.servicemix.packaging.model.ServiceUnit;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class ServiceUnitZipInjector implements PackagingInjector {
-
- private ServiceAssembly serviceAssembly;
-
- private List<PackagingInjector> serviceUnitInjectors = new ArrayList<PackagingInjector>();
-
- public boolean canInject(ModelElement modelElement) {
- if (modelElement instanceof ServiceAssembly) {
- serviceAssembly = (ServiceAssembly) modelElement;
- return true;
- }
- return false;
- }
-
- public void inject(IProgressMonitor monitor, IProject project,
- ZipOutputStream outputStream) {
- try {
- ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
-
- for (ServiceUnit unit : serviceAssembly.getServiceUnit()) {
- boolean empty = true;
- ZipOutputStream suZip = new ZipOutputStream(bytesOut);
-
- for (PackagingInjector injector : serviceUnitInjectors) {
- if (injector.canInject(unit)) {
- injector.inject(monitor, project, suZip);
- empty = false;
- }
- }
-
- suZip.close();
-
- outputStream.putNextEntry(new ZipEntry(unit
- .getServiceUnitName()
- + ".zip"));
- outputStream.write(bytesOut.toByteArray());
- outputStream.closeEntry();
-
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public List<PackagingInjector> getServiceUnitInjectors() {
- return serviceUnitInjectors;
- }
-
- public void setServiceUnitInjectors(
- List<PackagingInjector> serviceUnitInjectors) {
- this.serviceUnitInjectors = serviceUnitInjectors;
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.engine;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.servicemix.packaging.model.ModelElement;
+import org.apache.servicemix.packaging.model.ServiceAssembly;
+import org.apache.servicemix.packaging.model.ServiceUnit;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class ServiceUnitZipInjector implements PackagingInjector {
+
+ private ServiceAssembly serviceAssembly;
+
+ private List<PackagingInjector> serviceUnitInjectors = new ArrayList<PackagingInjector>();
+
+ public boolean canInject(ModelElement modelElement) {
+ if (modelElement instanceof ServiceAssembly) {
+ serviceAssembly = (ServiceAssembly) modelElement;
+ return true;
+ }
+ return false;
+ }
+
+ public void inject(IProgressMonitor monitor, IProject project,
+ ZipOutputStream outputStream) {
+ try {
+ ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
+
+ for (ServiceUnit unit : serviceAssembly.getServiceUnit()) {
+ boolean empty = true;
+ ZipOutputStream suZip = new ZipOutputStream(bytesOut);
+
+ for (PackagingInjector injector : serviceUnitInjectors) {
+ if (injector.canInject(unit)) {
+ injector.inject(monitor, project, suZip);
+ empty = false;
+ }
+ }
+
+ suZip.close();
+
+ outputStream.putNextEntry(new ZipEntry(unit
+ .getServiceUnitName()
+ + ".zip"));
+ outputStream.write(bytesOut.toByteArray());
+ outputStream.closeEntry();
+
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public List<PackagingInjector> getServiceUnitInjectors() {
+ return serviceUnitInjectors;
+ }
+
+ public void setServiceUnitInjectors(
+ List<PackagingInjector> serviceUnitInjectors) {
+ this.serviceUnitInjectors = serviceUnitInjectors;
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ServiceUnitZipInjector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/BindingComponentFigure.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/BindingComponentFigure.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/BindingComponentFigure.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/BindingComponentFigure.java Tue Feb 21 15:40:05 2006
@@ -1,62 +1,62 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.figure;
-
-import org.apache.servicemix.packaging.model.BindingComponent;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.RoundedRectangle;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gef.internal.ui.palette.editparts.ColumnsLayout;
-
-/**
- * The GEF figure for a binding component
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class BindingComponentFigure extends RoundedRectangle {
-
- static final MarginBorder MARGIN_BORDER = new MarginBorder(8, 8, 8, 13);
-
- private ServiceNameFigure serviceName;
-
- private ComponentImage componentImage;
-
- public BindingComponentFigure(BindingComponent component) {
- setBorder(MARGIN_BORDER);
- ColumnsLayout columnsLayout = new ColumnsLayout();
- columnsLayout.setMinorAlignment(ColumnsLayout.ALIGN_CENTER);
- setLayoutManager(columnsLayout);
- serviceName = new ServiceNameFigure(component);
- componentImage = new ComponentImage(component);
- add(componentImage);
- add(serviceName);
- }
-
- public void refresh() {
- serviceName.refresh();
- }
-
- public Dimension getPreferredSize(int wHint, int hHint) {
- Dimension dim = new Dimension();
- dim.width = serviceName.getPreferredSize().width;
- dim.width += getInsets().getWidth();
- dim.width += componentImage.getPreferredSize().width;
- dim.height = componentImage.getPreferredSize().height;
- dim.height += getInsets().getHeight();
- return dim;
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.figure;
+
+import org.apache.servicemix.packaging.model.BindingComponent;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.RoundedRectangle;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.gef.internal.ui.palette.editparts.ColumnsLayout;
+
+/**
+ * The GEF figure for a binding component
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class BindingComponentFigure extends RoundedRectangle {
+
+ static final MarginBorder MARGIN_BORDER = new MarginBorder(8, 8, 8, 13);
+
+ private ServiceNameFigure serviceName;
+
+ private ComponentImage componentImage;
+
+ public BindingComponentFigure(BindingComponent component) {
+ setBorder(MARGIN_BORDER);
+ ColumnsLayout columnsLayout = new ColumnsLayout();
+ columnsLayout.setMinorAlignment(ColumnsLayout.ALIGN_CENTER);
+ setLayoutManager(columnsLayout);
+ serviceName = new ServiceNameFigure(component);
+ componentImage = new ComponentImage(component);
+ add(componentImage);
+ add(serviceName);
+ }
+
+ public void refresh() {
+ serviceName.refresh();
+ }
+
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ Dimension dim = new Dimension();
+ dim.width = serviceName.getPreferredSize().width;
+ dim.width += getInsets().getWidth();
+ dim.width += componentImage.getPreferredSize().width;
+ dim.height = componentImage.getPreferredSize().height;
+ dim.height += getInsets().getHeight();
+ return dim;
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/BindingComponentFigure.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ComponentImage.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ComponentImage.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ComponentImage.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ComponentImage.java Tue Feb 21 15:40:05 2006
@@ -1,45 +1,45 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.figure;
-
-import org.apache.servicemix.packaging.model.AbstractConnectableService;
-import org.apache.servicemix.packaging.model.ComponentBased;
-import org.eclipse.draw2d.ImageFigure;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * The component's image
- *
- * TODO need to implement the ability to set the state (sync'd from JMX?)
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class ComponentImage extends ImageFigure {
-
- public ComponentImage(AbstractConnectableService component) {
- ToolbarLayout toolbarLayout = new ToolbarLayout();
- toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
- setLayoutManager(toolbarLayout);
- if (component instanceof ComponentBased) {
- Image image = ((ComponentBased) component).getComponentArtifact()
- .getStoppedImage(
- ((ComponentBased) component).getComponentName());
- setImage(image);
- }
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.figure;
+
+import org.apache.servicemix.packaging.model.AbstractConnectableService;
+import org.apache.servicemix.packaging.model.ComponentBased;
+import org.eclipse.draw2d.ImageFigure;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * The component's image
+ *
+ * TODO need to implement the ability to set the state (sync'd from JMX?)
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class ComponentImage extends ImageFigure {
+
+ public ComponentImage(AbstractConnectableService component) {
+ ToolbarLayout toolbarLayout = new ToolbarLayout();
+ toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
+ setLayoutManager(toolbarLayout);
+ if (component instanceof ComponentBased) {
+ Image image = ((ComponentBased) component).getComponentArtifact()
+ .getStoppedImage(
+ ((ComponentBased) component).getComponentName());
+ setImage(image);
+ }
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ComponentImage.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ContentFigure.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ContentFigure.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ContentFigure.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ContentFigure.java Tue Feb 21 15:40:05 2006
@@ -1,60 +1,60 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.figure;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-
-/**
- * The Eclipse figure for the content for a Service Assembly
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class ContentFigure extends Figure {
-
- static final MarginBorder MARGIN_BORDER = new MarginBorder(5, 0, 0, 0);
-
- private static final int SPACING = 5;
-
- public ContentFigure() {
- setBorder(MARGIN_BORDER);
- ToolbarLayout toolbarLayout = new ToolbarLayout();
- toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
- setLayoutManager(toolbarLayout);
- toolbarLayout.setSpacing(SPACING);
- }
-
- public Dimension getPreferredSize(int wHint, int hHint) {
- Dimension dim = new Dimension();
- int maxWidth = getInsets().getWidth();
- for (Object object : getChildren()) {
- if (object instanceof IFigure) {
- dim.height += ((IFigure) object).getPreferredSize().height
- + SPACING;
- if (((IFigure) object).getPreferredSize().width > maxWidth)
- maxWidth = ((IFigure) object).getPreferredSize().width;
- }
- }
- dim.width = maxWidth;
- dim.height += getInsets().getHeight();
-
- return dim;
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.figure;
+
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+
+/**
+ * The Eclipse figure for the content for a Service Assembly
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class ContentFigure extends Figure {
+
+ static final MarginBorder MARGIN_BORDER = new MarginBorder(5, 0, 0, 0);
+
+ private static final int SPACING = 5;
+
+ public ContentFigure() {
+ setBorder(MARGIN_BORDER);
+ ToolbarLayout toolbarLayout = new ToolbarLayout();
+ toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
+ setLayoutManager(toolbarLayout);
+ toolbarLayout.setSpacing(SPACING);
+ }
+
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ Dimension dim = new Dimension();
+ int maxWidth = getInsets().getWidth();
+ for (Object object : getChildren()) {
+ if (object instanceof IFigure) {
+ dim.height += ((IFigure) object).getPreferredSize().height
+ + SPACING;
+ if (((IFigure) object).getPreferredSize().width > maxWidth)
+ maxWidth = ((IFigure) object).getPreferredSize().width;
+ }
+ }
+ dim.width = maxWidth;
+ dim.height += getInsets().getHeight();
+
+ return dim;
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ContentFigure.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/DummyLayout.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/DummyLayout.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/DummyLayout.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/DummyLayout.java Tue Feb 21 15:40:05 2006
@@ -1,46 +1,46 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.figure;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-
-/**
- * A dummy layout
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class DummyLayout extends AbstractLayout {
-
- /**
- * @see org.eclipse.draw2d.AbstractLayout#calculatePreferredSize(org.eclipse.draw2d.IFigure,
- * int, int)
- */
- protected Dimension calculatePreferredSize(IFigure container, int wHint,
- int hHint) {
- return null;
- }
-
- /**
- * @see org.eclipse.draw2d.LayoutManager#layout(org.eclipse.draw2d.IFigure)
- */
- public void layout(IFigure container) {
-
- }
-
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.figure;
+
+import org.eclipse.draw2d.AbstractLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+
+/**
+ * A dummy layout
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class DummyLayout extends AbstractLayout {
+
+ /**
+ * @see org.eclipse.draw2d.AbstractLayout#calculatePreferredSize(org.eclipse.draw2d.IFigure,
+ * int, int)
+ */
+ protected Dimension calculatePreferredSize(IFigure container, int wHint,
+ int hHint) {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.draw2d.LayoutManager#layout(org.eclipse.draw2d.IFigure)
+ */
+ public void layout(IFigure container) {
+
+ }
+
}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/DummyLayout.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyControlsFigure.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyControlsFigure.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyControlsFigure.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyControlsFigure.java Tue Feb 21 15:40:05 2006
@@ -1,64 +1,64 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.figure;
-
-import org.apache.servicemix.packaging.model.ServiceAssembly;
-import org.eclipse.draw2d.ActionListener;
-import org.eclipse.draw2d.Button;
-import org.eclipse.draw2d.ButtonModel;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gef.internal.ui.palette.editparts.ColumnsLayout;
-
-/**
- * The add/remove controls for service units in a service assembly
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class ServiceAssemblyControlsFigure extends Figure {
-
- private Button addButton;
-
- private ButtonModel buttonModel;
-
- private ServiceAssembly serviceAssembly;
-
- public ServiceAssemblyControlsFigure(ServiceAssembly serviceAssembly,
- ActionListener actionListener) {
- this.serviceAssembly = serviceAssembly;
- ColumnsLayout columnsLayout = new ColumnsLayout();
- columnsLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
- setLayoutManager(columnsLayout);
- addButton = new Button("+");
- addButton.setToolTip(new Label("Create a new service unit"));
- add(addButton);
- buttonModel = new ButtonModel();
- buttonModel.addActionListener(actionListener);
- addButton.setModel(buttonModel);
- }
-
- public Dimension getPreferredSize(int wHint, int hHint) {
- Dimension dim = new Dimension();
- dim.width = addButton.getPreferredSize().width;
- dim.width += getInsets().getWidth();
- dim.height = addButton.getPreferredSize().height;
- dim.height += getInsets().getHeight();
- return dim;
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.figure;
+
+import org.apache.servicemix.packaging.model.ServiceAssembly;
+import org.eclipse.draw2d.ActionListener;
+import org.eclipse.draw2d.Button;
+import org.eclipse.draw2d.ButtonModel;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.gef.internal.ui.palette.editparts.ColumnsLayout;
+
+/**
+ * The add/remove controls for service units in a service assembly
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class ServiceAssemblyControlsFigure extends Figure {
+
+ private Button addButton;
+
+ private ButtonModel buttonModel;
+
+ private ServiceAssembly serviceAssembly;
+
+ public ServiceAssemblyControlsFigure(ServiceAssembly serviceAssembly,
+ ActionListener actionListener) {
+ this.serviceAssembly = serviceAssembly;
+ ColumnsLayout columnsLayout = new ColumnsLayout();
+ columnsLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
+ setLayoutManager(columnsLayout);
+ addButton = new Button("+");
+ addButton.setToolTip(new Label("Create a new service unit"));
+ add(addButton);
+ buttonModel = new ButtonModel();
+ buttonModel.addActionListener(actionListener);
+ addButton.setModel(buttonModel);
+ }
+
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ Dimension dim = new Dimension();
+ dim.width = addButton.getPreferredSize().width;
+ dim.width += getInsets().getWidth();
+ dim.height = addButton.getPreferredSize().height;
+ dim.height += getInsets().getHeight();
+ return dim;
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyControlsFigure.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyFigure.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyFigure.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyFigure.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyFigure.java Tue Feb 21 15:40:05 2006
@@ -1,80 +1,80 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.figure;
-
-import org.apache.servicemix.packaging.model.ServiceAssembly;
-import org.eclipse.draw2d.ActionListener;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.RoundedRectangle;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-
-/**
- * The GEF figure for a Service Assembly
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class ServiceAssemblyFigure extends RoundedRectangle {
-
- static final MarginBorder MARGIN_BORDER = new MarginBorder(8, 8, 8, 13);
-
- private ServiceAssemblyNameFigure serviceAssemblyName;
-
- private ServiceAssemblyControlsFigure serviceAssemblyControls;
-
- private ContentFigure contentPane;
-
- public ServiceAssemblyFigure(ServiceAssembly serviceAssembly,
- ActionListener actionListener) {
- setBorder(MARGIN_BORDER);
- ToolbarLayout toolbarLayout = new ToolbarLayout();
- toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
- toolbarLayout.setObserveVisibility(true);
- setLayoutManager(toolbarLayout);
- serviceAssemblyName = new ServiceAssemblyNameFigure(serviceAssembly);
- serviceAssemblyControls = new ServiceAssemblyControlsFigure(
- serviceAssembly, actionListener);
- contentPane = new ContentFigure();
-
- add(serviceAssemblyName);
- add(serviceAssemblyControls);
- add(contentPane);
- }
-
- public ContentFigure getContentPaneFigure() {
- return contentPane;
- }
-
- public Dimension getPreferredSize(int wHint, int hHint) {
- Dimension dim = new Dimension();
- dim.width = serviceAssemblyName.getPreferredSize().width > contentPane
- .getPreferredSize().width ? serviceAssemblyName
- .getPreferredSize().width
- : contentPane.getPreferredSize().width;
- dim.width += getInsets().getWidth();
- dim.height = serviceAssemblyName.getPreferredSize().height
- + serviceAssemblyControls.getPreferredSize().height
- + contentPane.getPreferredSize().height;
- dim.height += getInsets().getHeight();
-
- return dim;
- }
-
- public void refresh() {
- serviceAssemblyName.refresh();
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.figure;
+
+import org.apache.servicemix.packaging.model.ServiceAssembly;
+import org.eclipse.draw2d.ActionListener;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.RoundedRectangle;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+
+/**
+ * The GEF figure for a Service Assembly
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class ServiceAssemblyFigure extends RoundedRectangle {
+
+ static final MarginBorder MARGIN_BORDER = new MarginBorder(8, 8, 8, 13);
+
+ private ServiceAssemblyNameFigure serviceAssemblyName;
+
+ private ServiceAssemblyControlsFigure serviceAssemblyControls;
+
+ private ContentFigure contentPane;
+
+ public ServiceAssemblyFigure(ServiceAssembly serviceAssembly,
+ ActionListener actionListener) {
+ setBorder(MARGIN_BORDER);
+ ToolbarLayout toolbarLayout = new ToolbarLayout();
+ toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
+ toolbarLayout.setObserveVisibility(true);
+ setLayoutManager(toolbarLayout);
+ serviceAssemblyName = new ServiceAssemblyNameFigure(serviceAssembly);
+ serviceAssemblyControls = new ServiceAssemblyControlsFigure(
+ serviceAssembly, actionListener);
+ contentPane = new ContentFigure();
+
+ add(serviceAssemblyName);
+ add(serviceAssemblyControls);
+ add(contentPane);
+ }
+
+ public ContentFigure getContentPaneFigure() {
+ return contentPane;
+ }
+
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ Dimension dim = new Dimension();
+ dim.width = serviceAssemblyName.getPreferredSize().width > contentPane
+ .getPreferredSize().width ? serviceAssemblyName
+ .getPreferredSize().width
+ : contentPane.getPreferredSize().width;
+ dim.width += getInsets().getWidth();
+ dim.height = serviceAssemblyName.getPreferredSize().height
+ + serviceAssemblyControls.getPreferredSize().height
+ + contentPane.getPreferredSize().height;
+ dim.height += getInsets().getHeight();
+
+ return dim;
+ }
+
+ public void refresh() {
+ serviceAssemblyName.refresh();
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyFigure.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyNameFigure.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyNameFigure.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyNameFigure.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyNameFigure.java Tue Feb 21 15:40:05 2006
@@ -1,92 +1,92 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.figure;
-
-import org.apache.servicemix.packaging.model.ComponentBased;
-import org.apache.servicemix.packaging.model.ServiceAssembly;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * The GEF figure for a Service Assembly Name
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class ServiceAssemblyNameFigure extends Figure {
-
- private Label name;
-
- private ServiceAssembly serviceAssembly;
-
- private Label componentName;
-
- public ServiceAssemblyNameFigure(ServiceAssembly service) {
- this.serviceAssembly = service;
- ToolbarLayout toolbarLayout = new ToolbarLayout();
- toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
- setLayoutManager(toolbarLayout);
-
- name = new Label();
- name.setLabelAlignment(PositionConstants.LEFT);
- name.setFont(new Font(null, "Arial", 12, SWT.NORMAL));
- name.setForegroundColor(Display.getCurrent().getSystemColor(
- SWT.COLOR_BLACK));
-
- componentName = new Label();
- componentName.setLabelAlignment(PositionConstants.LEFT);
- componentName.setForegroundColor(Display.getCurrent().getSystemColor(
- SWT.COLOR_GRAY));
-
- add(name);
- add(componentName);
- }
-
- public void refresh() {
- name.setText(serviceAssembly.getName());
- StringBuffer description = new StringBuffer();
- if (serviceAssembly instanceof ComponentBased) {
- ComponentBased componentBase = (ComponentBased) serviceAssembly;
- description.append(componentBase.getComponentArtifact()
- .getComponentDefinitionByName(
- componentBase.getComponentName()).getDescription());
- description.append(" (");
- description.append(componentBase.getComponentArtifact()
- .getComponentDefinitionByName(
- componentBase.getComponentName()).getType());
- description.append(")");
-
- componentName.setText(description.toString());
- }
- }
-
- public Dimension getPreferredSize(int wHint, int hHint) {
- Dimension dim = new Dimension();
- dim.width = name.getPreferredSize().width;
- dim.width = dim.width > componentName.getPreferredSize().width ? dim.width
- : componentName.getPreferredSize().width;
- dim.width += getInsets().getWidth();
- dim.height = name.getPreferredSize().height
- + componentName.getPreferredSize().height;
- return dim;
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.figure;
+
+import org.apache.servicemix.packaging.model.ComponentBased;
+import org.apache.servicemix.packaging.model.ServiceAssembly;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * The GEF figure for a Service Assembly Name
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class ServiceAssemblyNameFigure extends Figure {
+
+ private Label name;
+
+ private ServiceAssembly serviceAssembly;
+
+ private Label componentName;
+
+ public ServiceAssemblyNameFigure(ServiceAssembly service) {
+ this.serviceAssembly = service;
+ ToolbarLayout toolbarLayout = new ToolbarLayout();
+ toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+ setLayoutManager(toolbarLayout);
+
+ name = new Label();
+ name.setLabelAlignment(PositionConstants.LEFT);
+ name.setFont(new Font(null, "Arial", 12, SWT.NORMAL));
+ name.setForegroundColor(Display.getCurrent().getSystemColor(
+ SWT.COLOR_BLACK));
+
+ componentName = new Label();
+ componentName.setLabelAlignment(PositionConstants.LEFT);
+ componentName.setForegroundColor(Display.getCurrent().getSystemColor(
+ SWT.COLOR_GRAY));
+
+ add(name);
+ add(componentName);
+ }
+
+ public void refresh() {
+ name.setText(serviceAssembly.getName());
+ StringBuffer description = new StringBuffer();
+ if (serviceAssembly instanceof ComponentBased) {
+ ComponentBased componentBase = (ComponentBased) serviceAssembly;
+ description.append(componentBase.getComponentArtifact()
+ .getComponentDefinitionByName(
+ componentBase.getComponentName()).getDescription());
+ description.append(" (");
+ description.append(componentBase.getComponentArtifact()
+ .getComponentDefinitionByName(
+ componentBase.getComponentName()).getType());
+ description.append(")");
+
+ componentName.setText(description.toString());
+ }
+ }
+
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ Dimension dim = new Dimension();
+ dim.width = name.getPreferredSize().width;
+ dim.width = dim.width > componentName.getPreferredSize().width ? dim.width
+ : componentName.getPreferredSize().width;
+ dim.width += getInsets().getWidth();
+ dim.height = name.getPreferredSize().height
+ + componentName.getPreferredSize().height;
+ return dim;
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceAssemblyNameFigure.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceNameFigure.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceNameFigure.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceNameFigure.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceNameFigure.java Tue Feb 21 15:40:05 2006
@@ -1,184 +1,184 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.figure;
-
-import org.apache.servicemix.descriptors.packaging.assets.Assets;
-import org.apache.servicemix.descriptors.packaging.assets.Connection;
-import org.apache.servicemix.packaging.model.AbstractConnectableService;
-import org.apache.servicemix.packaging.model.BindingComponent;
-import org.apache.servicemix.packaging.model.ComponentBased;
-import org.apache.servicemix.packaging.model.ServiceUnit;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * The GEF figure for a Service Name
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class ServiceNameFigure extends Figure {
-
- private Label localName;
-
- private Label namespace;
-
- private AbstractConnectableService service;
-
- private Label componentName;
-
- public ServiceNameFigure(AbstractConnectableService service) {
- this.service = service;
-
- ToolbarLayout toolbarLayout = new ToolbarLayout();
- toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
- setLayoutManager(toolbarLayout);
-
- localName = new Label();
- localName.setLabelAlignment(PositionConstants.LEFT);
- localName.setFont(new Font(null, "Arial", 12, SWT.NORMAL));
- localName.setForegroundColor(Display.getCurrent().getSystemColor(
- SWT.COLOR_BLACK));
-
- namespace = new Label();
- namespace.setLabelAlignment(PositionConstants.LEFT);
- namespace.setForegroundColor(Display.getCurrent().getSystemColor(
- SWT.COLOR_DARK_GRAY));
-
- componentName = new Label();
- componentName.setLabelAlignment(PositionConstants.LEFT);
- componentName.setForegroundColor(Display.getCurrent().getSystemColor(
- SWT.COLOR_GRAY));
-
- add(localName);
- add(namespace);
- add(componentName);
- }
-
- public void refresh() {
- StringBuffer description = new StringBuffer();
- if (service instanceof BindingComponent) {
- ComponentBased componentBase = (ComponentBased) service;
- description.append(componentBase.getComponentArtifact()
- .getComponentDefinitionByName(
- componentBase.getComponentName()).getName());
- description.append(" (");
- description.append(componentBase.getComponentArtifact()
- .getComponentDefinitionByName(
- componentBase.getComponentName()).getType());
- description.append(")");
-
- componentName.setText(description.toString());
- } else if (service instanceof ServiceUnit) {
- description.append(((ServiceUnit) service).getServiceUnitName());
- componentName.setText(((ServiceUnit) service).getServiceUnitName());
- }
-
- if (canHaveServiceName()) {
- if (service.getServiceName() != null) {
- localName.setText(service.getServiceName().getLocalPart());
- namespace.setText(service.getServiceName().getNamespaceURI());
- componentName.setText(description.toString());
- } else {
- localName.setText(description.toString());
- namespace.setText("Missing '"+getMissingConnectionName()+"' connection");
- componentName
- .setText("Check your properties and set up your connections");
- }
- } else {
- localName.setText(description.toString());
- namespace.setText("No connections available");
- componentName.setText("");
- }
-
- }
-
- private boolean canHaveServiceName() {
- if (service instanceof ServiceUnit) {
- ServiceUnit serviceUnit = (ServiceUnit) service;
- Assets assets = serviceUnit.getComponentArtifact()
- .getComponentDefinitionByName(
- serviceUnit.getComponentName()).getAssets();
- if ((assets != null) && (assets.getConnection() != null))
- for (Connection connection : assets.getConnection()) {
- if ("provides".equals(connection.getType())) {
- return true;
- }
- }
- } else if (service instanceof BindingComponent) {
- BindingComponent bindingComponent = (BindingComponent) service;
- Assets assets = bindingComponent.getComponentArtifact()
- .getComponentDefinitionByName(
- bindingComponent.getComponentName()).getAssets();
- if ((assets != null) && (assets.getConnection() != null))
- for (Connection connection : assets.getConnection()) {
- if ("provides".equals(connection.getType())) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- private String getMissingConnectionName() {
- if (service instanceof ServiceUnit) {
- ServiceUnit serviceUnit = (ServiceUnit) service;
- Assets assets = serviceUnit.getComponentArtifact()
- .getComponentDefinitionByName(
- serviceUnit.getComponentName()).getAssets();
- if ((assets != null) && (assets.getConnection() != null))
- for (Connection connection : assets.getConnection()) {
- if ("provides".equals(connection.getType())) {
- return connection.getDescription();
- }
- }
- } else if (service instanceof BindingComponent) {
- BindingComponent bindingComponent = (BindingComponent) service;
- Assets assets = bindingComponent.getComponentArtifact()
- .getComponentDefinitionByName(
- bindingComponent.getComponentName()).getAssets();
- if ((assets != null) && (assets.getConnection() != null))
- for (Connection connection : assets.getConnection()) {
- if ("provides".equals(connection.getType())) {
- return connection.getDescription();
- }
- }
- }
-
- return null;
- }
-
- public Dimension getPreferredSize(int wHint, int hHint) {
- Dimension dim = new Dimension();
- dim.width = localName.getPreferredSize().width > namespace
- .getPreferredSize().width ? localName.getPreferredSize().width
- : namespace.getPreferredSize().width;
- dim.width = dim.width > componentName.getPreferredSize().width ? dim.width
- : componentName.getPreferredSize().width;
- dim.width += getInsets().getWidth();
- dim.height = localName.getPreferredSize().height
- + namespace.getPreferredSize().height
- + componentName.getPreferredSize().height;
- return dim;
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.figure;
+
+import org.apache.servicemix.descriptors.packaging.assets.Assets;
+import org.apache.servicemix.descriptors.packaging.assets.Connection;
+import org.apache.servicemix.packaging.model.AbstractConnectableService;
+import org.apache.servicemix.packaging.model.BindingComponent;
+import org.apache.servicemix.packaging.model.ComponentBased;
+import org.apache.servicemix.packaging.model.ServiceUnit;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * The GEF figure for a Service Name
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class ServiceNameFigure extends Figure {
+
+ private Label localName;
+
+ private Label namespace;
+
+ private AbstractConnectableService service;
+
+ private Label componentName;
+
+ public ServiceNameFigure(AbstractConnectableService service) {
+ this.service = service;
+
+ ToolbarLayout toolbarLayout = new ToolbarLayout();
+ toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+ setLayoutManager(toolbarLayout);
+
+ localName = new Label();
+ localName.setLabelAlignment(PositionConstants.LEFT);
+ localName.setFont(new Font(null, "Arial", 12, SWT.NORMAL));
+ localName.setForegroundColor(Display.getCurrent().getSystemColor(
+ SWT.COLOR_BLACK));
+
+ namespace = new Label();
+ namespace.setLabelAlignment(PositionConstants.LEFT);
+ namespace.setForegroundColor(Display.getCurrent().getSystemColor(
+ SWT.COLOR_DARK_GRAY));
+
+ componentName = new Label();
+ componentName.setLabelAlignment(PositionConstants.LEFT);
+ componentName.setForegroundColor(Display.getCurrent().getSystemColor(
+ SWT.COLOR_GRAY));
+
+ add(localName);
+ add(namespace);
+ add(componentName);
+ }
+
+ public void refresh() {
+ StringBuffer description = new StringBuffer();
+ if (service instanceof BindingComponent) {
+ ComponentBased componentBase = (ComponentBased) service;
+ description.append(componentBase.getComponentArtifact()
+ .getComponentDefinitionByName(
+ componentBase.getComponentName()).getName());
+ description.append(" (");
+ description.append(componentBase.getComponentArtifact()
+ .getComponentDefinitionByName(
+ componentBase.getComponentName()).getType());
+ description.append(")");
+
+ componentName.setText(description.toString());
+ } else if (service instanceof ServiceUnit) {
+ description.append(((ServiceUnit) service).getServiceUnitName());
+ componentName.setText(((ServiceUnit) service).getServiceUnitName());
+ }
+
+ if (canHaveServiceName()) {
+ if (service.getServiceName() != null) {
+ localName.setText(service.getServiceName().getLocalPart());
+ namespace.setText(service.getServiceName().getNamespaceURI());
+ componentName.setText(description.toString());
+ } else {
+ localName.setText(description.toString());
+ namespace.setText("Missing '"+getMissingConnectionName()+"' connection");
+ componentName
+ .setText("Check your properties and set up your connections");
+ }
+ } else {
+ localName.setText(description.toString());
+ namespace.setText("No connections available");
+ componentName.setText("");
+ }
+
+ }
+
+ private boolean canHaveServiceName() {
+ if (service instanceof ServiceUnit) {
+ ServiceUnit serviceUnit = (ServiceUnit) service;
+ Assets assets = serviceUnit.getComponentArtifact()
+ .getComponentDefinitionByName(
+ serviceUnit.getComponentName()).getAssets();
+ if ((assets != null) && (assets.getConnection() != null))
+ for (Connection connection : assets.getConnection()) {
+ if ("provides".equals(connection.getType())) {
+ return true;
+ }
+ }
+ } else if (service instanceof BindingComponent) {
+ BindingComponent bindingComponent = (BindingComponent) service;
+ Assets assets = bindingComponent.getComponentArtifact()
+ .getComponentDefinitionByName(
+ bindingComponent.getComponentName()).getAssets();
+ if ((assets != null) && (assets.getConnection() != null))
+ for (Connection connection : assets.getConnection()) {
+ if ("provides".equals(connection.getType())) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private String getMissingConnectionName() {
+ if (service instanceof ServiceUnit) {
+ ServiceUnit serviceUnit = (ServiceUnit) service;
+ Assets assets = serviceUnit.getComponentArtifact()
+ .getComponentDefinitionByName(
+ serviceUnit.getComponentName()).getAssets();
+ if ((assets != null) && (assets.getConnection() != null))
+ for (Connection connection : assets.getConnection()) {
+ if ("provides".equals(connection.getType())) {
+ return connection.getDescription();
+ }
+ }
+ } else if (service instanceof BindingComponent) {
+ BindingComponent bindingComponent = (BindingComponent) service;
+ Assets assets = bindingComponent.getComponentArtifact()
+ .getComponentDefinitionByName(
+ bindingComponent.getComponentName()).getAssets();
+ if ((assets != null) && (assets.getConnection() != null))
+ for (Connection connection : assets.getConnection()) {
+ if ("provides".equals(connection.getType())) {
+ return connection.getDescription();
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ Dimension dim = new Dimension();
+ dim.width = localName.getPreferredSize().width > namespace
+ .getPreferredSize().width ? localName.getPreferredSize().width
+ : namespace.getPreferredSize().width;
+ dim.width = dim.width > componentName.getPreferredSize().width ? dim.width
+ : componentName.getPreferredSize().width;
+ dim.width += getInsets().getWidth();
+ dim.height = localName.getPreferredSize().height
+ + namespace.getPreferredSize().height
+ + componentName.getPreferredSize().height;
+ return dim;
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceNameFigure.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceUnitFigure.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceUnitFigure.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceUnitFigure.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceUnitFigure.java Tue Feb 21 15:40:05 2006
@@ -1,67 +1,67 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.figure;
-
-import org.apache.servicemix.packaging.model.ServiceUnit;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gef.internal.ui.palette.editparts.ColumnsLayout;
-
-/**
- * The GEF figure for a Service Unit
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class ServiceUnitFigure extends Figure {
-
- static final MarginBorder MARGIN_BORDER = new MarginBorder(8, 8, 8, 13);
-
- private ServiceNameFigure serviceName;
-
- private ComponentImage componentImage;
-
- public ComponentImage getComponentImage() {
- return componentImage;
- }
-
- public ServiceUnitFigure(ServiceUnit component) {
- setBorder(MARGIN_BORDER);
- ColumnsLayout columnsLayout = new ColumnsLayout();
- columnsLayout.setMinorAlignment(ColumnsLayout.ALIGN_LEFTTOP);
- setLayoutManager(columnsLayout);
- serviceName = new ServiceNameFigure(component);
- componentImage = new ComponentImage(component);
- add(componentImage);
- add(serviceName);
- refresh();
- }
-
- public void refresh() {
- serviceName.refresh();
- }
-
- public Dimension getPreferredSize(int wHint, int hHint) {
- Dimension dim = new Dimension();
- dim.width = serviceName.getPreferredSize().width;
- dim.width += getInsets().getWidth();
- dim.width += componentImage.getPreferredSize().width;
- dim.height = componentImage.getPreferredSize().height;
- dim.height += getInsets().getHeight();
- return dim;
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.figure;
+
+import org.apache.servicemix.packaging.model.ServiceUnit;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.gef.internal.ui.palette.editparts.ColumnsLayout;
+
+/**
+ * The GEF figure for a Service Unit
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class ServiceUnitFigure extends Figure {
+
+ static final MarginBorder MARGIN_BORDER = new MarginBorder(8, 8, 8, 13);
+
+ private ServiceNameFigure serviceName;
+
+ private ComponentImage componentImage;
+
+ public ComponentImage getComponentImage() {
+ return componentImage;
+ }
+
+ public ServiceUnitFigure(ServiceUnit component) {
+ setBorder(MARGIN_BORDER);
+ ColumnsLayout columnsLayout = new ColumnsLayout();
+ columnsLayout.setMinorAlignment(ColumnsLayout.ALIGN_LEFTTOP);
+ setLayoutManager(columnsLayout);
+ serviceName = new ServiceNameFigure(component);
+ componentImage = new ComponentImage(component);
+ add(componentImage);
+ add(serviceName);
+ refresh();
+ }
+
+ public void refresh() {
+ serviceName.refresh();
+ }
+
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ Dimension dim = new Dimension();
+ dim.width = serviceName.getPreferredSize().width;
+ dim.width += getInsets().getWidth();
+ dim.width += componentImage.getPreferredSize().width;
+ dim.height = componentImage.getPreferredSize().height;
+ dim.height += getInsets().getHeight();
+ return dim;
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/figure/ServiceUnitFigure.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/model/AbstractComponent.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/model/AbstractComponent.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/model/AbstractComponent.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/model/AbstractComponent.java Tue Feb 21 15:40:05 2006
@@ -1,80 +1,80 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.packaging.model;
-
-import javax.xml.bind.annotation.XmlTransient;
-
-import org.apache.servicemix.descriptors.packaging.assets.Assets;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * An abstract JBI component
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class AbstractComponent extends ModelElement {
-
- public static final String LOCATION_PROP = "Component.Location";
-
- private static final long serialVersionUID = 1;
-
- public static final String SERVICENAME_PROP = "Component.Width";
-
- Point location = new Point(0, 0);
-
- private ModelElement parentModelElement;
-
- protected Assets bundledAssets = new Assets();
-
- public Image getIcon() {
- return null;
- }
-
- public Point getLocation() {
- return location.getCopy();
- }
-
- @XmlTransient
- public ModelElement getParentModelElement() {
- return parentModelElement;
- }
-
- public Assets getStoredAssets() {
- return bundledAssets;
- }
-
- public void setLocation(Point newLocation) {
- if (newLocation == null) {
- throw new IllegalArgumentException();
- }
- location.setLocation(newLocation);
- firePropertyChange(LOCATION_PROP, null, location);
- }
-
- public void setParentModelElement(ModelElement parentModelElement) {
- this.parentModelElement = parentModelElement;
- }
-
- public void setStoredAssets(Assets storedAssets) {
- this.bundledAssets = storedAssets;
- }
-
- public void updated() {
- firePropertyChange(SERVICENAME_PROP, null, null);
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.packaging.model;
+
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.apache.servicemix.descriptors.packaging.assets.Assets;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * An abstract JBI component
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class AbstractComponent extends ModelElement {
+
+ public static final String LOCATION_PROP = "Component.Location";
+
+ private static final long serialVersionUID = 1;
+
+ public static final String SERVICENAME_PROP = "Component.Width";
+
+ Point location = new Point(0, 0);
+
+ private ModelElement parentModelElement;
+
+ protected Assets bundledAssets = new Assets();
+
+ public Image getIcon() {
+ return null;
+ }
+
+ public Point getLocation() {
+ return location.getCopy();
+ }
+
+ @XmlTransient
+ public ModelElement getParentModelElement() {
+ return parentModelElement;
+ }
+
+ public Assets getStoredAssets() {
+ return bundledAssets;
+ }
+
+ public void setLocation(Point newLocation) {
+ if (newLocation == null) {
+ throw new IllegalArgumentException();
+ }
+ location.setLocation(newLocation);
+ firePropertyChange(LOCATION_PROP, null, location);
+ }
+
+ public void setParentModelElement(ModelElement parentModelElement) {
+ this.parentModelElement = parentModelElement;
+ }
+
+ public void setStoredAssets(Assets storedAssets) {
+ this.bundledAssets = storedAssets;
+ }
+
+ public void updated() {
+ firePropertyChange(SERVICENAME_PROP, null, null);
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/model/AbstractComponent.java
------------------------------------------------------------------------------
svn:eol-style = native