/**********************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation, Ericsson
+ * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
/**
* The lifeline which send the message
*/
- protected Lifeline fStartLifeline = null;
+ private Lifeline fStartLifeline = null;
/**
* The lifeline which receive the message
*/
- protected Lifeline fEndLifeline = null;
+ private Lifeline fEndLifeline = null;
/**
* The visiblitiy flag.
*/
- protected boolean fVisible = true;
+ private boolean fVisible = true;
// ------------------------------------------------------------------------
// Methods
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getX()
- */
+
@Override
public int getX() {
// returns the exact x coordinate
return getX(false);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getY()
- */
@Override
public int getY() {
/*
/*
* Regular message, both ends are attached to a lifeline
*/
- return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence;
+ return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * getEndOccurrence();
}
/*
* UML2 lost message kind
*/
if (fStartLifeline != null) {
- return fStartLifeline.getY() + fStartLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence;
+ return fStartLifeline.getY() + fStartLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * getEndOccurrence();
}
/*
* UML2 found message kind
*/
if (fEndLifeline != null) {
- return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEndEventOccurrence;
+ return fEndLifeline.getY() + fEndLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * getEndOccurrence();
}
// return 0 by default
return 0;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getWidth()
- */
@Override
public int getWidth() {
// Returns the exact width
return getWidth(false);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#getHeight()
- */
@Override
public int getHeight() {
return 0;
activationWidth = -activationWidth;
}
- if (isMessageStartInActivation(fEndEventOccurrence)) {
+ if (isMessageStartInActivation(getEndOccurrence())) {
x = x + activationWidth;
}
activationWidth = -activationWidth;
}
- if (isMessageStartInActivation(fEndEventOccurrence)) {
+ if (isMessageStartInActivation(getEndOccurrence())) {
width = width - activationWidth;
}
- if (isMessageEndInActivation(fEndEventOccurrence)) {
+ if (isMessageEndInActivation(getEndOccurrence())) {
width = width - activationWidth;
}
return width;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#isVisible(int, int, int, int)
- */
@Override
public boolean isVisible(int x, int y, int width, int height) {
// ***Common*** syncMessages visibility
* @see Lifeline Lifeline for more event occurence details
*/
protected void setEventOccurrence(int occurrence) {
- fEndEventOccurrence = occurrence;
+ setEndOccurrence(occurrence);
}
/**
* @see Lifeline Lifeline for more event occurence details
*/
public int getEventOccurrence() {
- return fEndEventOccurrence;
+ return getEndOccurrence();
}
/**
int thisY = getY();
for (int i = 0; i < fStartLifeline.getExecutions().size(); i++) {
BasicExecutionOccurrence toDraw = (BasicExecutionOccurrence) fStartLifeline.getExecutions().get(i);
- if ((event >= toDraw.fStartEventOccurrence) && (event <= toDraw.fEndEventOccurrence)) {
+ if ((event >= toDraw.getStartOccurrence()) && (event <= toDraw.getEndOccurrence())) {
inActivation = true;
}
// if we are outside the visible area we stop right now
// for drawing speed reason with only search on the visivle subset
for (int i = 0; i < fEndLifeline.getExecutions().size(); i++) {
BasicExecutionOccurrence toDraw = (BasicExecutionOccurrence) fEndLifeline.getExecutions().get(i);
- if ((event >= toDraw.fStartEventOccurrence) && (event <= toDraw.fEndEventOccurrence)) {
+ if ((event >= toDraw.getStartOccurrence()) && (event <= toDraw.getEndOccurrence())) {
inActivation = true;
}
// if we are outside the visible area we stop right now
return inActivation;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#contains(int, int)
- */
@Override
public boolean contains(int xValue, int yValue) {
int x = getX();
* @param context A graphical context to draw in.
*/
protected void drawMessage(IGC context) {
- int fX, fY, fW, fH;
- fX = fY = fW = fH = 0;
+ int fX = 0;
+ int fY = 0;
+ int fW = 0;
+ int fH = 0;
// temporary store the coordinates to avoid more methods calls
int x = getX();
// The label is truncated if it cannot fit between the two message end
// 2*Metrics.MESSAGES_NAME_SPACING = space above the label + space below the label
IColor temp = context.getForeground();
- context.setForeground(pref.getFontColor(fPrefId));
+ context.setForeground(pref.getFontColor(getColorPrefId()));
context.drawTextTruncatedCentred(getName(), x, y - Metrics.getMessageFontHeigth() - 2 * Metrics.MESSAGES_NAME_SPACING, width, 2 * Metrics.MESSAGES_NAME_SPACING + Metrics.getMessageFontHeigth(), !isSelected());
context.setForeground(temp);
int margin = 0;
context.fillOval(x + width - ray, y + height - ray, ray * 2, ray * 2);
}
context.setBackground(storedColor);
- context.setForeground(pref.getFontColor(fPrefId));
+ context.setForeground(pref.getFontColor(getColorPrefId()));
fX = x;
fY = y - yt.intValue();
fW = width;
// 2*Metrics.MESSAGES_NAME_SPACING = space above the label + space below the label
// the space available for the text is sorter if are drawing internal message on the last lifeline
- context.setForeground(pref.getFontColor(fPrefId));
+ context.setForeground(pref.getFontColor(getColorPrefId()));
if (fStartLifeline.getIndex() == fStartLifeline.getFrame().getHorizontalIndex()) {
context.drawTextTruncated(getName(), x + width + Metrics.INTERNAL_MESSAGE_V_MARGIN / 2, y, Metrics.swimmingLaneWidth() / 2 - Metrics.EXECUTION_OCCURRENCE_WIDTH + -Metrics.INTERNAL_MESSAGE_WIDTH, +Metrics.MESSAGES_NAME_SPACING
- Metrics.getMessageFontHeigth(), !isSelected());
// Draw the message label above the message and centered
// The label is truncated if it cannot fit between the two message end
// 2*Metrics.MESSAGES_NAME_SPACING = space above the label + space below the label
- context.setForeground(pref.getFontColor(fPrefId));
+ context.setForeground(pref.getFontColor(getColorPrefId()));
if (spaceBTWStartEnd > 0) {
context.drawTextTruncatedCentred(getName(), x, y + height / 2 - (2 * Metrics.MESSAGES_NAME_SPACING + Metrics.getMessageFontHeigth()), width, 2 * Metrics.MESSAGES_NAME_SPACING + Metrics.getMessageFontHeigth(), !isSelected());
} else {
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNodee#draw(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC)
- */
@Override
public void draw(IGC context) {
if (!isVisible()) {
context.drawPolygon(points);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#drawFocus(org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC)
- */
@Override
public void drawFocus(IGC context) {
ISDPreferences pref = SDViewPref.getInstance();
- if ((fStartLifeline != fEndLifeline) && (fStartEventOccurrence == fEndEventOccurrence)) {
+ if ((fStartLifeline != fEndLifeline) && (getStartOccurrence() == getEndOccurrence())) {
context.setLineStyle(context.getLineDotStyle());
context.setLineWidth(Metrics.NORMAL_LINE_WIDTH);
context.setBackground(pref.getBackGroundColorSelection());
context.setForeground(pref.getForeGroundColorSelection());
context.drawFocus(getX(), getY() - 3, getWidth(), getHeight() + 6);
- } else if ((fStartLifeline == fEndLifeline) && (fStartEventOccurrence == fEndEventOccurrence)) {
+ } else if ((fStartLifeline == fEndLifeline) && (getStartOccurrence() == getEndOccurrence())) {
context.drawFocus(getX(), getY() - 3, getWidth(), Metrics.SYNC_INTERNAL_MESSAGE_HEIGHT + 6);
- } else if ((fStartLifeline != fEndLifeline) && (fStartEventOccurrence != fEndEventOccurrence)) {
+ } else if ((fStartLifeline != fEndLifeline) && (getStartOccurrence() != getEndOccurrence())) {
context.setLineStyle(context.getLineDotStyle());
context.setLineWidth(Metrics.NORMAL_LINE_WIDTH);
context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE_HEADER));