Skip to content
Snippets Groups Projects
Commit 3861ab6b authored by Florian Hölzl's avatar Florian Hölzl
Browse files

bugfix #108: added transparent label figure to base implementations.

parent 0c7a350a
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,7 @@ import org.fortiss.tooling.base.model.element.IHierarchicElement; ...@@ -40,6 +40,7 @@ import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.Point; import org.fortiss.tooling.base.model.layout.Point;
import org.fortiss.tooling.base.ui.editpart.figure.AntiAliasedEllipse; import org.fortiss.tooling.base.ui.editpart.figure.AntiAliasedEllipse;
import org.fortiss.tooling.base.ui.editpart.figure.TransparentLabel;
import org.fortiss.tooling.base.ui.editpart.policy.ConnectionGraphicalNodeEditPolicy; import org.fortiss.tooling.base.ui.editpart.policy.ConnectionGraphicalNodeEditPolicy;
import org.fortiss.tooling.base.ui.editpart.policy.RemoveEditPolicy; import org.fortiss.tooling.base.ui.editpart.policy.RemoveEditPolicy;
import org.fortiss.tooling.base.ui.layout.constants.DefaultLayoutConstants; import org.fortiss.tooling.base.ui.layout.constants.DefaultLayoutConstants;
...@@ -95,7 +96,7 @@ public abstract class ConnectorEditPartBase<T extends ILayoutedModelElement & IC ...@@ -95,7 +96,7 @@ public abstract class ConnectorEditPartBase<T extends ILayoutedModelElement & IC
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected Label createLabelFigure() { protected Label createLabelFigure() {
Label nameLabel = new Label(); Label nameLabel = new TransparentLabel();
nameLabel.setForegroundColor(getForegroundColor()); nameLabel.setForegroundColor(getForegroundColor());
nameLabel.setTextAlignment(PositionConstants.LEFT nameLabel.setTextAlignment(PositionConstants.LEFT
| PositionConstants.TOP); | PositionConstants.TOP);
......
...@@ -28,6 +28,7 @@ import org.eclipse.gef.Request; ...@@ -28,6 +28,7 @@ import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants; import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.SnapToHelper; import org.eclipse.gef.SnapToHelper;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement; import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.ui.editpart.figure.TransparentLabel;
import org.fortiss.tooling.base.ui.editpart.policy.ConnectionGraphicalNodeEditPolicy; import org.fortiss.tooling.base.ui.editpart.policy.ConnectionGraphicalNodeEditPolicy;
import org.fortiss.tooling.base.ui.editpart.policy.ElementLayoutEditPolicy; import org.fortiss.tooling.base.ui.editpart.policy.ElementLayoutEditPolicy;
import org.fortiss.tooling.base.ui.editpart.policy.RemoveEditPolicy; import org.fortiss.tooling.base.ui.editpart.policy.RemoveEditPolicy;
...@@ -62,7 +63,7 @@ public abstract class ElementEditPartBase<T extends ILayoutedModelElement & INam ...@@ -62,7 +63,7 @@ public abstract class ElementEditPartBase<T extends ILayoutedModelElement & INam
/** Creates the label figure. */ /** Creates the label figure. */
@Override @Override
public Label createLabelFigure() { public Label createLabelFigure() {
Label nameLabel = new Label(); Label nameLabel = new TransparentLabel();
nameLabel.setForegroundColor(getForegroundColor()); nameLabel.setForegroundColor(getForegroundColor());
nameLabel.setFont(DefaultLayoutConstants.TITLE_FONT); nameLabel.setFont(DefaultLayoutConstants.TITLE_FONT);
nameLabel.setTextAlignment(PositionConstants.LEFT nameLabel.setTextAlignment(PositionConstants.LEFT
......
...@@ -19,7 +19,6 @@ package org.fortiss.tooling.base.ui.editpart; ...@@ -19,7 +19,6 @@ package org.fortiss.tooling.base.ui.editpart;
import org.eclipse.draw2d.ColorConstants; import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.FreeformLayer; import org.eclipse.draw2d.FreeformLayer;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Layer; import org.eclipse.draw2d.Layer;
import org.eclipse.draw2d.LayeredPane; import org.eclipse.draw2d.LayeredPane;
...@@ -126,21 +125,7 @@ public class ExtendedLayerRootEditPart extends ScalableRootEditPart { ...@@ -126,21 +125,7 @@ public class ExtendedLayerRootEditPart extends ScalableRootEditPart {
/** Creates the default layer with XYLayout. */ /** Creates the default layer with XYLayout. */
private Layer createDefaultLayer() { private Layer createDefaultLayer() {
Layer l = new FreeformLayer() { Layer l = new FreeformLayer();
/** {@inheritDoc} */
@Override
public void paint(Graphics graphics) {
// TODO Auto-generated method stub
super.paint(graphics);
}
/** {@inheritDoc} */
@Override
protected void paintChildren(Graphics graphics) {
// TODO Auto-generated method stub
super.paintChildren(graphics);
}
};
l.setOpaque(false); l.setOpaque(false);
l.setLayoutManager(new XYLayout()); l.setLayoutManager(new XYLayout());
l.setBackgroundColor(ColorConstants.white); l.setBackgroundColor(ColorConstants.white);
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2011 ForTISS GmbH |
| |
| 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.fortiss.tooling.base.ui.editpart.figure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.TreeSearch;
import org.eclipse.swt.graphics.Image;
/**
* A label that is transparent for the mouse location interpretation.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class TransparentLabel extends Label {
/** Constructor. */
public TransparentLabel() {
super();
}
/** Constructor. */
public TransparentLabel(String text) {
super(text);
}
/** Constructor. */
public TransparentLabel(Image image) {
super(image);
}
/** Constructor. */
public TransparentLabel(String text, Image image) {
super(text, image);
}
/** {@inheritDoc} */
@Override
public IFigure findFigureAt(int x, int y, TreeSearch search) {
// implements transparency
return null;
}
/** {@inheritDoc} */
@Override
public boolean isOpaque() {
// implements transparency
return false;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment