浏览代码

Datenbankmodell

master
gitsvn 12 年前
父节点
当前提交
f5e27962e8

+ 2
- 2
src/ch/spherIC/recurvebowsight/components/ArcerySetupArrayAdapter.java 查看文件

TextView textViewSub = (TextView) item.findViewById(R.id.chooseArcherySetupTxtSub); TextView textViewSub = (TextView) item.findViewById(R.id.chooseArcherySetupTxtSub);
if (getItem(position).getId() != -999) { if (getItem(position).getId() != -999) {
textViewMain.setText(getItem(position).getRiser().getManufacturer() + " / " + getItem(position).getSight().getManufacturer());
textViewSub.setText(getItem(position).getRiser().getManufacturer() + " / " + getItem(position).getSight().getManufacturer());
textViewMain.setText(getItem(position).getName());
textViewSub.setText(getItem(position).getRiser().toString() + " / " + getItem(position).getSight().toString());
} else { } else {
textViewMain.setText("[ ]"); textViewMain.setText("[ ]");
textViewSub.setText(getContext().getString(R.string.caption_NoSelection)); textViewSub.setText(getContext().getString(R.string.caption_NoSelection));

+ 1
- 1
src/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java 查看文件

} }
private IArcherySetup getArcherySetupMasterData() { private IArcherySetup getArcherySetupMasterData() {
return new ArcherySetup(0, null, null, 5.8, 3.10, 21d, 64.25, 1.30, 71d, 1.57, 14.8, 0.001, 0.1, 55d, 260d);
return new ArcherySetup(0, "FITA Indoor FS", null, null, 5.8, 3.10, 21d, 64.25, 1.30, 71d, 1.57, 14.8, 0.001, 0.1, 55d, 260d);
} }
} }

+ 7
- 7
src/ch/spherIC/recurvebowsight/database/dao/ArcherySetupDao.java 查看文件

@Override @Override
protected IArcherySetup cursorToEntity(final Cursor cursor) { protected IArcherySetup cursorToEntity(final Cursor cursor) {
ISight sight = SightDao.getInstance().loadById(cursor.getLong(1));
IRiser riser = RiserDao.getInstance().loadById(cursor.getLong(2));
ISight sight = SightDao.getInstance().loadById(cursor.getLong(2));
IRiser riser = RiserDao.getInstance().loadById(cursor.getLong(3));
IArcherySetup archerySetup = new ArcherySetup(cursor.getLong(0), sight, riser, cursor.getDouble(3), //
cursor.getDouble(4), cursor.getDouble(5), cursor.getDouble(6), cursor.getDouble(7),
cursor.getDouble(8), cursor.getDouble(9), cursor.getDouble(10), cursor.getDouble(11),
cursor.getDouble(12), cursor.getDouble(13), cursor.getDouble(14));
IArcherySetup archerySetup = new ArcherySetup(cursor.getLong(0), cursor.getString(1), sight, riser, cursor.getDouble(4), //
cursor.getDouble(5), cursor.getDouble(6), cursor.getDouble(7), cursor.getDouble(8),
cursor.getDouble(9), cursor.getDouble(10), cursor.getDouble(11), cursor.getDouble(12),
cursor.getDouble(13), cursor.getDouble(14), cursor.getDouble(15));
return archerySetup; return archerySetup;
} }
values.put(TblRBSArcherySetup.COL_ID, entity.getId()); values.put(TblRBSArcherySetup.COL_ID, entity.getId());
} }
values.put(TblRBSArcherySetup.COL_NAME, entity.getName() != null ? entity.getName() : "");
values.put(TblRBSArcherySetup.COL_SIGHT, entity.getSight() != null ? entity.getSight().getId() : 0); values.put(TblRBSArcherySetup.COL_SIGHT, entity.getSight() != null ? entity.getSight().getId() : 0);
values.put(TblRBSArcherySetup.COL_RISER, entity.getRiser() != null ? entity.getRiser().getId() : 0); values.put(TblRBSArcherySetup.COL_RISER, entity.getRiser() != null ? entity.getRiser().getId() : 0);
values.put(TblRBSArcherySetup.COL_ARROWDIAMETER, entity.getArrowDiameter() != null ? entity.getArrowDiameter() : 0d); values.put(TblRBSArcherySetup.COL_ARROWDIAMETER, entity.getArrowDiameter() != null ? entity.getArrowDiameter() : 0d);

+ 4
- 2
src/ch/spherIC/recurvebowsight/database/scheme/data/TblRBSArcherySetup.java 查看文件

public static final String NAME = "RBS_ARCHERYSETUP"; public static final String NAME = "RBS_ARCHERYSETUP";
public static final String COL_ID = "ARCHERYSETUP_ID"; public static final String COL_ID = "ARCHERYSETUP_ID";
public static final String COL_NAME = "ARCHERYSETUP_NAME";
public static final String COL_SIGHT = "ARCHERYSETUP_SIGHT"; public static final String COL_SIGHT = "ARCHERYSETUP_SIGHT";
public static final String COL_RISER = "ARCHERYSETUP_RISER"; public static final String COL_RISER = "ARCHERYSETUP_RISER";
public static final String COL_ARROWDIAMETER = "ARCHERYSETUP_ARROWDIAMETER"; public static final String COL_ARROWDIAMETER = "ARCHERYSETUP_ARROWDIAMETER";
public static final String COL_SIGHTHORSETTING = "ARCHERYSETUP_SIGHTHORSETTING"; public static final String COL_SIGHTHORSETTING = "ARCHERYSETUP_SIGHTHORSETTING";
private TblRBSArcherySetup() {
}
private TblRBSArcherySetup() { }
public static String getCreateStatement() { public static String getCreateStatement() {
return "create table " + NAME + "(" return "create table " + NAME + "("
+ COL_ID + " Integer primary key autoincrement, " + COL_ID + " Integer primary key autoincrement, "
+ COL_NAME + " Text NOT NULL, "
+ COL_SIGHT + " Integer NOT NULL REFERENCES RBS_SIGHT (" + TblRBSSight.COL_ID + "), " + COL_SIGHT + " Integer NOT NULL REFERENCES RBS_SIGHT (" + TblRBSSight.COL_ID + "), "
+ COL_RISER + " Integer NOT NULL REFERENCES RBS_RISER (" + TblRBSRiser.COL_ID + "), " + COL_RISER + " Integer NOT NULL REFERENCES RBS_RISER (" + TblRBSRiser.COL_ID + "), "
+ COL_ARROWDIAMETER + " Real NOT NULL, " + COL_ARROWDIAMETER + " Real NOT NULL, "
+ COL_CALCPRECISION + " Real NOT NULL, " + COL_CALCPRECISION + " Real NOT NULL, "
+ COL_SIGHTVERTSKALAMIDDLE + " Real NOT NULL, " + COL_SIGHTVERTSKALAMIDDLE + " Real NOT NULL, "
+ COL_SIGHTHORSETTING + " Real NOT NULL, " + COL_SIGHTHORSETTING + " Real NOT NULL, "
+ "constraint UNIQUE_ARCHERYSETUP_NAME UNIQUE (" + COL_NAME + "), "
+ "constraint UNIQUE_ARCHERYSETUP_SIGHT_RISER UNIQUE (" + COL_SIGHT + "," + COL_RISER + ")" + "constraint UNIQUE_ARCHERYSETUP_SIGHT_RISER UNIQUE (" + COL_SIGHT + "," + COL_RISER + ")"
+ ");"; + ");";
} }

+ 1
- 1
src/ch/spherIC/recurvebowsight/dialog/ChooseArcherySetupDlg.java 查看文件

final ListView listView = (ListView) findViewById(R.id.chooseArcerySetupItemsList); final ListView listView = (ListView) findViewById(R.id.chooseArcerySetupItemsList);
List<IArcherySetup> setups = new ArrayList<IArcherySetup>(); List<IArcherySetup> setups = new ArrayList<IArcherySetup>();
setups.add(new ArcherySetup(-999, null, null, null, null, null, null, null, null, null, null, null, null, null, null));
setups.add(new ArcherySetup(-999, "", null, null, null, null, null, null, null, null, null, null, null, null, null, null));
setups.addAll(ArcherySetupDao.getInstance().loadAll()); setups.addAll(ArcherySetupDao.getInstance().loadAll());
listView.setAdapter(new ArcerySetupArrayAdapter(getContext(), R.layout.rbs_archerysetup_item, setups)); listView.setAdapter(new ArcerySetupArrayAdapter(getContext(), R.layout.rbs_archerysetup_item, setups));

+ 36
- 1
src/ch/spherIC/recurvebowsight/model/ArcherySetup.java 查看文件

public class ArcherySetup implements IArcherySetup { public class ArcherySetup implements IArcherySetup {
private long id; private long id;
private String name;
private ISight sight; private ISight sight;
private IRiser riser; private IRiser riser;
private Double arrowDiameter; private Double arrowDiameter;
* @param sightVertSkalaMiddle * @param sightVertSkalaMiddle
* @param sightHorSetting * @param sightHorSetting
*/ */
public ArcherySetup(final long id, final ISight sight, final IRiser riser,
public ArcherySetup(final long id, final String name, final ISight sight, final IRiser riser,
final Double arrowDiameter, final Double arrowCw, final Double arrowWeight, final Double arrowDiameter, final Double arrowCw, final Double arrowWeight,
final Double arrowV0, final Double arrowCenterHeight, final Double bowPullout, final Double arrowV0, final Double arrowCenterHeight, final Double bowPullout,
final Double arrowNockHeight, final Double hNA, final Double deltaTime, final Double arrowNockHeight, final Double hNA, final Double deltaTime,
final Double sightHorSetting) { final Double sightHorSetting) {
super(); super();
this.id = id; this.id = id;
this.name = name;
this.sight = sight; this.sight = sight;
this.riser = riser; this.riser = riser;
this.arrowDiameter = arrowDiameter; this.arrowDiameter = arrowDiameter;
this.id = id; this.id = id;
} }
/**
* @return the name
*/
@Override
public String getName() {
return this.name;
}
/**
* @param name the name to set
*/
@Override
public void setName(final String name) {
this.name = name;
}
/** /**
* @return the sight * @return the sight
*/ */
this.sightHorSetting = sightHorSetting; this.sightHorSetting = sightHorSetting;
} }
/**
* @return the hNA
*/
@Override
public Double gethNA() {
return this.hNA;
}
/**
* @param hNA the hNA to set
*/
@Override
public void sethNA(final Double hNA) {
this.hNA = hNA;
}
} }

+ 8
- 0
src/ch/spherIC/recurvebowsight/model/IArcherySetup.java 查看文件

Double getSightHorSetting(); Double getSightHorSetting();
void setSightHorSetting(Double middle); void setSightHorSetting(Double middle);
String getName();
void setName(String name);
Double gethNA();
void sethNA(Double hNA);
} }

正在加载...
取消
保存