Finished version 1.0

- added relation navigation
- improved about dialog
This commit is contained in:
2015-11-15 22:15:37 +01:00
parent c4fc4e20a6
commit 89fb6629d0
47 changed files with 1201 additions and 590 deletions

View File

@@ -1,28 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* 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:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.sqlite;
import java.util.HashMap;
import com.minres.scviewer.database.RelationType;
class RelationTypeFactory {
HashMap<String, RelationType> registry=new HashMap<String, RelationType>();
public RelationType getRelationType(String name) {
if(registry.containsKey(name)) return registry.get(name);
RelationType rt = new RelationType(name);
registry.put(name, rt);
return rt;
}
}

View File

@@ -16,12 +16,14 @@ import java.io.FileInputStream;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.sqlite.db.IDatabase;
import com.minres.scviewer.database.sqlite.db.SQLiteDatabase;
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
@@ -33,7 +35,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
protected IDatabase database;
private RelationTypeFactory rtf = new RelationTypeFactory();
private List<RelationType> usedRelationsList = new ArrayList<>();
private IWaveformDb db;
@@ -64,7 +66,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
try {
for(ScvStream scvStream:handler.selectObjects()){
TxStream stream = new TxStream(database, db, scvStream);
stream.setRelationTypeFactory(rtf);
stream.setRelationTypeList(usedRelationsList);
streams.add(stream);
}
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
@@ -102,4 +104,10 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
}
return false;
}
@Override
public Collection<RelationType> getAllRelationTypes(){
return usedRelationsList;
}
}

View File

@@ -55,7 +55,7 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
private TreeMap<Long, List<ITxEvent>> events;
private RelationTypeFactory relationMap;
private List<RelationType> usedRelationsList;
public TxStream(IDatabase database, IWaveformDb waveformDb, ScvStream scvStream) {
super(scvStream.getName());
@@ -181,14 +181,14 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
return getEvents().get(time);
}
public void setRelationTypeFactory(RelationTypeFactory rtf) {
this.relationMap=rtf;
public void setRelationTypeList(List<RelationType> usedRelationsList){
this.usedRelationsList=usedRelationsList;
}
public RelationType getRelationType(String name) {
if(relationMap!=null) return relationMap.getRelationType(name);
return null;
RelationType relType=RelationType.create(name);
if(!usedRelationsList.contains(relType)) usedRelationsList.add(relType);
return relType;
}
@Override