/**********************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * Copyright (c) 2011, 2012 Ericsson.
- *
+ * Copyright (c) 2005, 2012 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
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ * Bernd Hufmann - Updated for TMF
**********************************************************************/
+
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
/**
* <p>
* This draw a cross on the lifeline. The stop y coordinate depend on the event occurrence when it appears.
* A stop is never drawn it is assigned to a lifeline.
* </p>
- *
+ *
* @version 1.0
* @author sveyrier
*/
* The graphNode ID
*/
public static final String STOP = "STOP"; //$NON-NLS-1$
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
/**
* The owning lifeline on which the stop appears
*/
- protected Lifeline lifeline = null;
+ protected Lifeline fLifeline = null;
/**
* This basically represents the time when the stop occurs on the owning Lifeline
- *
+ *
* @see Lifeline Lifeline for more event occurence details
*/
- protected int eventOccurrence = 0;
+ protected int fEventOccurrence = 0;
// ------------------------------------------------------------------------
// Methods
*/
@Override
public int getX() {
- if (lifeline == null) {
+ if (fLifeline == null) {
return 0;
}
- return lifeline.getX() + Metrics.getLifelineWidth() / 2 - Metrics.STOP_WIDTH / 2;
+ return fLifeline.getX() + Metrics.getLifelineWidth() / 2 - Metrics.STOP_WIDTH / 2;
}
/*
*/
@Override
public int getY() {
- if (lifeline == null) {
+ if (fLifeline == null) {
return 0;
}
- return lifeline.getY() + lifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * eventOccurrence - Metrics.STOP_WIDTH / 2;
+ return fLifeline.getY() + fLifeline.getHeight() + (Metrics.getMessageFontHeigth() + Metrics.getMessagesSpacing()) * fEventOccurrence - Metrics.STOP_WIDTH / 2;
}
/*
*/
@Override
public int getWidth() {
- if (lifeline == null) {
+ if (fLifeline == null) {
return 0;
}
return Metrics.STOP_WIDTH;
*/
@Override
public int getHeight() {
- if (lifeline == null) {
+ if (fLifeline == null) {
return 0;
}
return Metrics.STOP_WIDTH;
/**
* Set the lifeline on which the stop must be draw
- *
+ *
* @param theLifeline The the stop owing lifeline
*/
public void setLifeline(Lifeline theLifeline) {
- lifeline = theLifeline;
+ fLifeline = theLifeline;
}
/**
* Set the event occurrence when this stop appears
- *
+ *
* @param occurrence the eventOccurence to assign to the stop
*/
public void setEventOccurrence(int occurrence) {
- eventOccurrence = occurrence;
+ fEventOccurrence = occurrence;
}
/*
*/
@Override
public void draw(IGC context) {
+
+ ISDPreferences pref = SDViewPref.getInstance();
+
// Set the appropriate color depending if the graph node if selected or not
- if (lifeline.isSelected()) {
- context.setForeground(Frame.getUserPref().getBackGroundColorSelection());
+ if (fLifeline.isSelected()) {
+ context.setForeground(pref.getBackGroundColorSelection());
context.setLineWidth(Metrics.SELECTION_LINE_WIDTH);
int lastWidth = context.getLineWidth();
context.setLineWidth(9);
context.drawLine(getX() + getWidth(), getY(), getX(), getY() + getHeight());
// restore the context
context.setLineWidth(lastWidth);
- context.setBackground(Frame.getUserPref().getBackGroundColorSelection());
- context.setForeground(Frame.getUserPref().getForeGroundColorSelection());
+ context.setBackground(pref.getBackGroundColorSelection());
+ context.setForeground(pref.getForeGroundColorSelection());
} else {
- context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_LIFELINE));
- context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_LIFELINE));
+ context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_LIFELINE));
+ context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_LIFELINE));
}
int lastWidth = context.getLineWidth();
context.setLineWidth(3);