How to change the Label of a extended featureContainer [message #1692456] |
Wed, 15 April 2015 17:49  |
Eclipse User |
|
|
|
Hi,
I played around with my extension of a CustomShapeFeatureContainer for a IntermediateCatchEventFeatureContainer.
What I try to do is to change the label displayed for the Event. This is normally the name of the business object.
So I override the method createFeatureContainer and added a getUpdateFeature where I added a UpdateLabelFeature. So my code looks like this:
public class ImixsFeatureContainerEvent extends CustomShapeFeatureContainer {
....
@Override
protected IntermediateCatchEventFeatureContainer createFeatureContainer(
IFeatureProvider fp) {
return new IntermediateCatchEventFeatureContainer() {
....
@Override
public IUpdateFeature getUpdateFeature(IFeatureProvider fp) {
MultiUpdateFeature multiUpdate = new MultiUpdateFeature(fp);
multiUpdate.addFeature(new UpdateIntermediateCatchEventFeature(
fp) {
@Override
public boolean update(IUpdateContext context) {
super.update(context);
setFillColor((ContainerShape) context
.getPictogramElement());
return true;
}
});
multiUpdate.addFeature(new UpdateLabelFeature(fp) {
@Override
protected String getLabelString(BaseElement element) {
String l = super.getLabelString(element);
// change the label string here!
return l + " some extra information";
}
});
return multiUpdate;
}
....
};
}
}
This works!.
But in the moment when I change the label string the color of the label becomes 'red'.
I guess this should be a warning to the user that the label has now exceed a precomputed length or something?
I tried a lot to change the forgroundColor of the label shape, but which no success.
So my question is: what's the right way to overwrite the label of a feature container?
===
Ralph
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05148 seconds