refactor class names
This commit is contained in:
		| @@ -12,15 +12,15 @@ package com.minres.scviewer.database.swt; | ||||
| 
 | ||||
| import org.eclipse.swt.widgets.Composite; | ||||
| 
 | ||||
| import com.minres.scviewer.database.swt.internal.WaveformViewer; | ||||
| import com.minres.scviewer.database.ui.IWaveformViewer; | ||||
| import com.minres.scviewer.database.ui.IWaveformViewerFactory; | ||||
| import com.minres.scviewer.database.swt.internal.WaveformView; | ||||
| import com.minres.scviewer.database.ui.IWaveformView; | ||||
| import com.minres.scviewer.database.ui.IWaveformViewFactory; | ||||
| 
 | ||||
| public class WaveformViewerFactory implements IWaveformViewerFactory { | ||||
| public class WaveformViewFactory implements IWaveformViewFactory { | ||||
| 
 | ||||
| 	@Override | ||||
| 	public IWaveformViewer createPanel(Composite parent) { | ||||
| 		return new WaveformViewer(parent); | ||||
| 	public IWaveformView createPanel(Composite parent) { | ||||
| 		return new WaveformView(parent); | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| @@ -25,6 +25,7 @@ import org.eclipse.swt.events.SelectionAdapter; | ||||
| import org.eclipse.swt.events.SelectionEvent; | ||||
| import org.eclipse.swt.graphics.Color; | ||||
| import org.eclipse.swt.graphics.GC; | ||||
| import org.eclipse.swt.graphics.Image; | ||||
| import org.eclipse.swt.graphics.Point; | ||||
| import org.eclipse.swt.graphics.RGB; | ||||
| import org.eclipse.swt.graphics.Rectangle; | ||||
| @@ -40,7 +41,7 @@ import com.minres.scviewer.database.ITx; | ||||
| import com.minres.scviewer.database.IWaveform; | ||||
| import com.minres.scviewer.database.RelationType; | ||||
| import com.minres.scviewer.database.swt.Constants; | ||||
| import com.minres.scviewer.database.ui.IWaveformViewer; | ||||
| import com.minres.scviewer.database.ui.IWaveformView; | ||||
| import com.minres.scviewer.database.ui.TrackEntry; | ||||
| import com.minres.scviewer.database.ui.WaveformColors; | ||||
|  | ||||
| @@ -48,6 +49,8 @@ public class WaveformCanvas extends Canvas { | ||||
| 	 | ||||
|     Color[] colors = new Color[WaveformColors.values().length]; | ||||
|  | ||||
|     private boolean doubleBuffering = true; | ||||
|     	 | ||||
|     private int trackHeight = 50; | ||||
|      | ||||
|     private long scaleFactor = 1000000L; // 1ns | ||||
| @@ -110,7 +113,7 @@ public class WaveformCanvas extends Canvas { | ||||
|         painterList.add(trackAreaPainter); | ||||
|         rulerPainter=new RulerPainter(this); | ||||
|         painterList.add(rulerPainter); | ||||
|         arrowPainter=new ArrowPainter(this, IWaveformViewer.NEXT_PREV_IN_STREAM); | ||||
|         arrowPainter=new ArrowPainter(this, IWaveformView.NEXT_PREV_IN_STREAM); | ||||
|         painterList.add(arrowPainter); | ||||
| 		CursorPainter cp = new CursorPainter(this, scaleFactor * 10, cursorPainters.size()-1); | ||||
| 		painterList.add(cp); | ||||
| @@ -398,7 +401,18 @@ public class WaveformCanvas extends Canvas { | ||||
|     /* Paint function */ | ||||
|     private void paint(GC gc) { | ||||
|         Rectangle clientRect = getClientArea(); /* Canvas' painting area */ | ||||
|         Projection p = new Projection(gc); | ||||
|         GC thisGc = gc; | ||||
|         Image d_backingImg = null; | ||||
|         if(doubleBuffering) { | ||||
|             Point p = getSize(); | ||||
|             d_backingImg = new Image(getDisplay(), p.x, p.y); | ||||
|             thisGc = new GC(d_backingImg); | ||||
|             thisGc.setBackground(gc.getBackground()); | ||||
|             thisGc.setForeground(gc.getForeground()); | ||||
|             thisGc.setFont(gc.getFont()); | ||||
|              | ||||
|         } | ||||
|         Projection p = new Projection(thisGc); | ||||
|         p.setTranslation(origin); | ||||
|         if (painterList.size() > 0 ) { | ||||
|             for (IPainter painter : painterList) | ||||
| @@ -407,6 +421,11 @@ public class WaveformCanvas extends Canvas { | ||||
|             gc.fillRectangle(clientRect); | ||||
|             initScrollBars(); | ||||
|         } | ||||
|         if(doubleBuffering) { | ||||
|             gc.drawImage(d_backingImg, 0, 0); | ||||
|             d_backingImg.dispose(); | ||||
|             thisGc.dispose(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public List<Object> getElementsAt(Point point) { | ||||
|   | ||||
| @@ -89,11 +89,11 @@ import com.minres.scviewer.database.RelationType; | ||||
| import com.minres.scviewer.database.swt.Constants; | ||||
| import com.minres.scviewer.database.ui.GotoDirection; | ||||
| import com.minres.scviewer.database.ui.ICursor; | ||||
| import com.minres.scviewer.database.ui.IWaveformViewer; | ||||
| import com.minres.scviewer.database.ui.IWaveformView; | ||||
| import com.minres.scviewer.database.ui.TrackEntry; | ||||
| import com.minres.scviewer.database.ui.WaveformColors; | ||||
| 
 | ||||
| public class WaveformViewer implements IWaveformViewer  { | ||||
| public class WaveformView implements IWaveformView  { | ||||
| 
 | ||||
| 	private ListenerList<ISelectionChangedListener> selectionChangedListeners = new ListenerList<ISelectionChangedListener>(); | ||||
| 
 | ||||
| @@ -185,8 +185,7 @@ public class WaveformViewer implements IWaveformViewer  { | ||||
| 	            gc.setAlpha(128); | ||||
| 	            int minX = Math.min(start.x, end.x); | ||||
| 	            int width = Math.max(start.x, end.x) - minX; | ||||
| 	            Point origin = waveformCanvas.getOrigin(); | ||||
| 	            int y_top = waveformCanvas.getRulerHeight()- origin.y; | ||||
| 	            int y_top = waveformCanvas.getRulerHeight(); | ||||
| 	            int y_bottom = waveformCanvas.getSize().y; | ||||
| 	            gc.fillRectangle(minX, y_top, width,y_bottom); | ||||
| 			} | ||||
| @@ -288,7 +287,7 @@ public class WaveformViewer implements IWaveformViewer  { | ||||
| 	}; | ||||
| 	protected WaveformMouseListener waveformMouseListener = new WaveformMouseListener(); | ||||
| 
 | ||||
| 	public WaveformViewer(Composite parent) { | ||||
| 	public WaveformView(Composite parent) { | ||||
| 		pcs=new PropertyChangeSupport(this); | ||||
| 
 | ||||
| 		trackVerticalOffset = new TreeMap<Integer, TrackEntry>(); | ||||
| @@ -755,7 +754,7 @@ public class WaveformViewer implements IWaveformViewer  { | ||||
| 	@Override | ||||
| 	public void moveSelection(GotoDirection direction, RelationType relationType) { | ||||
| 		if (currentWaveformSelection!=null && currentWaveformSelection.isStream() && currentTxSelection!=null) { | ||||
| 			if(relationType.equals(IWaveformViewer.NEXT_PREV_IN_STREAM)){ | ||||
| 			if(relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)){ | ||||
| 				ITxStream<? extends ITxEvent> stream = currentWaveformSelection.getStream(); | ||||
| 				ITx transaction = null; | ||||
| 				if (direction == GotoDirection.NEXT) { | ||||
| @@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Control; | ||||
| import com.minres.scviewer.database.IWaveform; | ||||
| import com.minres.scviewer.database.RelationType; | ||||
| 
 | ||||
| public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvider{ | ||||
| public interface IWaveformView extends PropertyChangeListener, ISelectionProvider{ | ||||
| 
 | ||||
| 	String CURSOR_PROPERTY = "cursor_time"; | ||||
| 	 | ||||
| @@ -12,6 +12,6 @@ package com.minres.scviewer.database.ui; | ||||
| 
 | ||||
| import org.eclipse.swt.widgets.Composite; | ||||
| 
 | ||||
| public interface IWaveformViewerFactory { | ||||
| 	public IWaveformViewer createPanel(Composite parent); | ||||
| public interface IWaveformViewFactory { | ||||
| 	public IWaveformView createPanel(Composite parent); | ||||
| } | ||||
| @@ -93,10 +93,10 @@ import com.minres.scviewer.database.RelationType; | ||||
| import com.minres.scviewer.database.swt.Constants; | ||||
| import com.minres.scviewer.database.swt.ToolTipContentProvider; | ||||
| import com.minres.scviewer.database.swt.ToolTipHelpTextProvider; | ||||
| import com.minres.scviewer.database.swt.WaveformViewerFactory; | ||||
| import com.minres.scviewer.database.swt.WaveformViewFactory; | ||||
| import com.minres.scviewer.database.ui.GotoDirection; | ||||
| import com.minres.scviewer.database.ui.ICursor; | ||||
| import com.minres.scviewer.database.ui.IWaveformViewer; | ||||
| import com.minres.scviewer.database.ui.IWaveformView; | ||||
| import com.minres.scviewer.database.ui.TrackEntry; | ||||
| import com.minres.scviewer.database.ui.TrackEntry.ValueDisplay; | ||||
| import com.minres.scviewer.database.ui.TrackEntry.WaveDisplay; | ||||
| @@ -164,10 +164,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis | ||||
| 	private static int disposeListenerNumber = 0; | ||||
| 	 | ||||
| 	/** The factory. */ | ||||
| 	WaveformViewerFactory factory = new WaveformViewerFactory(); | ||||
| 	WaveformViewFactory factory = new WaveformViewFactory(); | ||||
|  | ||||
| 	/** The waveform pane. */ | ||||
| 	private IWaveformViewer waveformPane; | ||||
| 	private IWaveformView waveformPane; | ||||
|  | ||||
| 	/** get UISynchronize injected as field */ | ||||
| 	@Inject UISynchronize sync; | ||||
| @@ -217,7 +217,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis | ||||
| 	private Object detailsSettings; | ||||
|  | ||||
| 	/** The navigation relation type. */ | ||||
| 	private RelationType navigationRelationType=IWaveformViewer.NEXT_PREV_IN_STREAM ; | ||||
| 	private RelationType navigationRelationType=IWaveformView.NEXT_PREV_IN_STREAM ; | ||||
|  | ||||
| 	/** The file monitor. */ | ||||
| 	FileMonitor fileMonitor = new FileMonitor(); | ||||
| @@ -262,7 +262,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis | ||||
| 		//set selection to empty selection when opening a new waveformPane | ||||
| 		selectionService.setSelection(new StructuredSelection()); | ||||
| 		 | ||||
| 		waveformPane.addPropertyChangeListener(IWaveformViewer.CURSOR_PROPERTY, new PropertyChangeListener() { | ||||
| 		waveformPane.addPropertyChangeListener(IWaveformView.CURSOR_PROPERTY, new PropertyChangeListener() { | ||||
| 			@Override | ||||
| 			public void propertyChange(PropertyChangeEvent evt) { | ||||
| 				Long time = (Long) evt.getNewValue(); | ||||
| @@ -272,7 +272,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis | ||||
|  | ||||
| 			} | ||||
| 		}); | ||||
| 		waveformPane.addPropertyChangeListener(IWaveformViewer.MARKER_PROPERTY, new PropertyChangeListener() { | ||||
| 		waveformPane.addPropertyChangeListener(IWaveformView.MARKER_PROPERTY, new PropertyChangeListener() { | ||||
| 			@Override | ||||
| 			public void propertyChange(PropertyChangeEvent evt) { | ||||
| 				Long time = (Long) evt.getNewValue(); | ||||
| @@ -1215,7 +1215,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis | ||||
| 	 */ | ||||
| 	public List<RelationType> getAllRelationTypes() { | ||||
| 		List<RelationType> res =new ArrayList<>(); | ||||
| 		res.add(IWaveformViewer.NEXT_PREV_IN_STREAM); | ||||
| 		res.add(IWaveformView.NEXT_PREV_IN_STREAM); | ||||
| 		res.addAll(database.getAllRelationTypes()); | ||||
| 		return res; | ||||
| 	} | ||||
| @@ -1227,7 +1227,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis | ||||
| 	 */ | ||||
| 	public List<RelationType> getSelectionRelationTypes() { | ||||
| 		List<RelationType> res =new ArrayList<>(); | ||||
| 		res.add(IWaveformViewer.NEXT_PREV_IN_STREAM); | ||||
| 		res.add(IWaveformView.NEXT_PREV_IN_STREAM); | ||||
| 		ISelection selection = waveformPane.getSelection(); | ||||
| 		if(selection instanceof IStructuredSelection && !selection.isEmpty()){ | ||||
| 			IStructuredSelection sel=(IStructuredSelection) selection; | ||||
|   | ||||
| @@ -48,9 +48,9 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; | ||||
| import com.minres.scviewer.database.IWaveform; | ||||
| import com.minres.scviewer.database.IWaveformDb; | ||||
| import com.minres.scviewer.database.IWaveformDbFactory; | ||||
| import com.minres.scviewer.database.swt.WaveformViewerFactory; | ||||
| import com.minres.scviewer.database.swt.WaveformViewFactory; | ||||
| import com.minres.scviewer.database.ui.GotoDirection; | ||||
| import com.minres.scviewer.database.ui.IWaveformViewer; | ||||
| import com.minres.scviewer.database.ui.IWaveformView; | ||||
| import com.minres.scviewer.database.ui.TrackEntry; | ||||
| import com.minres.scviewer.ui.views.TxOutlinePage; | ||||
|  | ||||
| @@ -78,7 +78,7 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage | ||||
|  | ||||
| 	public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave"; | ||||
|  | ||||
| 	private IWaveformViewer txDisplay; | ||||
| 	private IWaveformView txDisplay; | ||||
|  | ||||
| 	/** This is the root of the editor's model. */ | ||||
| 	private IWaveformDb database; | ||||
| @@ -112,10 +112,10 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage | ||||
| 				}		 | ||||
| 			} | ||||
| 		}); | ||||
| 		WaveformViewerFactory factory = new WaveformViewerFactory(); | ||||
| 		WaveformViewFactory factory = new WaveformViewFactory(); | ||||
| 		txDisplay = factory.createPanel(parent); | ||||
| 		txDisplay.setMaxTime(0); | ||||
| 		txDisplay.addPropertyChangeListener(IWaveformViewer.CURSOR_PROPERTY, new PropertyChangeListener() { | ||||
| 		txDisplay.addPropertyChangeListener(IWaveformView.CURSOR_PROPERTY, new PropertyChangeListener() { | ||||
|             @Override | ||||
|             public void propertyChange(PropertyChangeEvent evt) { | ||||
|                 Long time = (Long) evt.getNewValue(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user