Search in sources :

Example 1 with TraitPointsRegistry

use of delta.games.lotro.stats.traitPoints.TraitPointsRegistry in project lotro-companion by dmorcellet.

the class TraitPointsEditionPanelController method buildTables.

private void buildTables() {
    _tableControllers = new ArrayList<TraitPointsTableController>();
    _labels = new ArrayList<String>();
    CharacterClass characterClass = _summary.getCharacterClass();
    TraitPointsRegistry registry = TraitPoints.get().getRegistry();
    List<TraitPoint> points = registry.getPointsForClass(characterClass);
    Collections.sort(points, new TraitPointLabelComparator());
    TraitPointsStatusListener listener = new TraitPointsStatusListener() {

        @Override
        public void statusUpdated() {
            _summaryController.update();
        }
    };
    String[] categories = { "Class", "Epic", "Quests", "Deeds" };
    for (String category : categories) {
        TraitPointFilter filter = new TraitPointFilter();
        filter.setCategory(category);
        List<TraitPoint> selectedPoints = new ArrayList<TraitPoint>();
        for (TraitPoint point : points) {
            if (filter.accept(point)) {
                selectedPoints.add(point);
            }
        }
        TraitPointsTableController tableController = new TraitPointsTableController(_status, selectedPoints);
        _tableControllers.add(tableController);
        _labels.add(category);
        tableController.setListener(listener);
    }
}
Also used : TraitPointFilter(delta.games.lotro.stats.traitPoints.TraitPointFilter) TraitPoint(delta.games.lotro.stats.traitPoints.TraitPoint) ArrayList(java.util.ArrayList) CharacterClass(delta.games.lotro.common.CharacterClass) TraitPointsRegistry(delta.games.lotro.stats.traitPoints.TraitPointsRegistry) TraitPointLabelComparator(delta.games.lotro.stats.traitPoints.comparators.TraitPointLabelComparator)

Example 2 with TraitPointsRegistry

use of delta.games.lotro.stats.traitPoints.TraitPointsRegistry in project lotro-companion by dmorcellet.

the class TraitPointsRegistryXMLParser method parseXML.

/**
 * Parse the XML file.
 * @param source Source file.
 * @return Parsed registry or <code>null</code>.
 */
public TraitPointsRegistry parseXML(File source) {
    TraitPointsRegistry registry = null;
    Element root = DOMParsingTools.parse(source);
    if (root != null) {
        registry = parseRegistry(root);
    }
    return registry;
}
Also used : TraitPointsRegistry(delta.games.lotro.stats.traitPoints.TraitPointsRegistry) Element(org.w3c.dom.Element)

Example 3 with TraitPointsRegistry

use of delta.games.lotro.stats.traitPoints.TraitPointsRegistry in project lotro-companion by dmorcellet.

the class TraitPointsRegistryXMLParser method parseRegistry.

private TraitPointsRegistry parseRegistry(Element root) {
    TraitPointsRegistry registry = new TraitPointsRegistry();
    List<Element> pointTags = DOMParsingTools.getChildTagsByName(root, TraitPointsRegistryXMLConstants.TRAIT_POINT_TAG, false);
    for (Element pointTag : pointTags) {
        TraitPoint item = parsePoint(pointTag);
        registry.registerTraitPoint(item);
    }
    return registry;
}
Also used : TraitPoint(delta.games.lotro.stats.traitPoints.TraitPoint) TraitPointsRegistry(delta.games.lotro.stats.traitPoints.TraitPointsRegistry) Element(org.w3c.dom.Element)

Aggregations

TraitPointsRegistry (delta.games.lotro.stats.traitPoints.TraitPointsRegistry)3 TraitPoint (delta.games.lotro.stats.traitPoints.TraitPoint)2 Element (org.w3c.dom.Element)2 CharacterClass (delta.games.lotro.common.CharacterClass)1 TraitPointFilter (delta.games.lotro.stats.traitPoints.TraitPointFilter)1 TraitPointLabelComparator (delta.games.lotro.stats.traitPoints.comparators.TraitPointLabelComparator)1 ArrayList (java.util.ArrayList)1