@Override public void setValueAt(Object value, int row, int col) { switch (col) { case COL_QTY: qty[row] = Integer.parseInt((String) value); fireTableCellUpdated(row, col); break; default: break; } } }
public void setData(Vector<EquipmentType> eq) { equipment = eq; qty = new int[eq.size()]; for (int i = 0; i < qty.length; i++) { qty[i] = 1; } fireTableDataChanged(); }
@Override public Class<?> getColumnClass(int c) { return getValueAt(0, c).getClass(); }
equipmentModel = new EquipmentTableModel(); tblEquipment = new MegamekTable(equipmentModel, EquipmentTableModel.COL_NAME);
/** * Creates collections for all of the possible <code>WeaponType</code>s and * <code>EquipmentType</code>s. These are used to populate the weapons * and equipment tables. */ private void populateWeaponsAndEquipmentChoices() { Vector<WeaponType> weapons = new Vector<WeaponType>(); Vector<EquipmentType> equipment = new Vector<EquipmentType>(); for (Enumeration<EquipmentType> e = EquipmentType.getAllTypes(); e.hasMoreElements();) { EquipmentType et = e.nextElement(); if ((et instanceof WeaponType)) { weapons.add((WeaponType)et); //Check for C3+Tag and C3 Master Booster if (et.hasFlag(WeaponType.F_C3M) || et.hasFlag(WeaponType.F_C3MBS)) { equipment.add(et); } } if ((et instanceof MiscType)) { equipment.add(et); } } weaponsModel.setData(weapons); equipmentModel.setData(equipment); }
@Override public boolean include(Entry<? extends EquipmentTableModel, ? extends Integer> entry) { EquipmentTableModel eqModel = entry.getModel(); EquipmentType eq = eqModel.getEquipmentTypeAt(entry.getIdentifier()); String currTechClass = TechConstants.getTechName(eq.getTechLevel(gameYear)); boolean techLvlMatch = matchTechLvl(techLevel,eq.getTechLevel(gameYear)); boolean techClassMatch = matchTechClass(techClass,currTechClass); boolean unitTypeMatch = matchUnitType(unitType,eq); if (techLvlMatch && techClassMatch && unitTypeMatch){ return true; }else{ return false; } } };