Search in sources :

Example 26 with DeedDescription

use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.

the class DeedsContainer method writeSortedDeeds.

/**
 * Write a XML file with a sorted list of deeds.
 * @param deeds Deeds to sort and write.
 * @param out Output file.
 */
public static void writeSortedDeeds(List<DeedDescription> deeds, File out) {
    List<Comparator<DeedDescription>> comparators = new ArrayList<Comparator<DeedDescription>>();
    comparators.add(new DeedNameComparator());
    comparators.add(new DeedDescriptionComparator());
    CompoundComparator<DeedDescription> comparator = new CompoundComparator<DeedDescription>(comparators);
    Collections.sort(deeds, comparator);
    DeedXMLWriter writer = new DeedXMLWriter();
    writer.writeDeeds(out, deeds, EncodingNames.UTF_8);
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) DeedNameComparator(delta.games.lotro.lore.deeds.comparators.DeedNameComparator) ArrayList(java.util.ArrayList) DeedDescriptionComparator(delta.games.lotro.lore.deeds.comparators.DeedDescriptionComparator) DeedXMLWriter(delta.games.lotro.lore.deeds.io.xml.DeedXMLWriter) CompoundComparator(delta.common.utils.collections.CompoundComparator) DeedDescriptionComparator(delta.games.lotro.lore.deeds.comparators.DeedDescriptionComparator) DeedNameComparator(delta.games.lotro.lore.deeds.comparators.DeedNameComparator) CompoundComparator(delta.common.utils.collections.CompoundComparator) Comparator(java.util.Comparator)

Example 27 with DeedDescription

use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.

the class DeedsFileBuilder method doIt.

private void doIt() {
    File loreDir = LotroCoreConfig.getInstance().getLoreDir();
    File deedsDir = new File(loreDir, "deeds");
    List<DeedDescription> deeds = new ArrayList<DeedDescription>();
    DeedXMLParser parser = new DeedXMLParser();
    for (File deedFile : deedsDir.listFiles()) {
        List<DeedDescription> newDeeds = parser.parseXML(deedFile);
        deeds.addAll(newDeeds);
    }
    File out = new File(loreDir, "deeds.xml");
    DeedXMLWriter writer = new DeedXMLWriter();
    writer.writeDeeds(out, deeds, EncodingNames.UTF_8);
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) ArrayList(java.util.ArrayList) DeedXMLWriter(delta.games.lotro.lore.deeds.io.xml.DeedXMLWriter) File(java.io.File) DeedXMLParser(delta.games.lotro.lore.deeds.io.xml.DeedXMLParser)

Example 28 with DeedDescription

use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-companion by dmorcellet.

the class DeedExplorerPanelController method build.

private JPanel build() {
    JPanel panel = GuiFactory.buildPanel(new BorderLayout());
    TitledBorder itemsFrameBorder = GuiFactory.buildTitledBorder("Items");
    panel.setBorder(itemsFrameBorder);
    // Table
    JTable table = _tableController.getTable();
    JScrollPane scroll = GuiFactory.buildScrollPane(table);
    panel.add(scroll, BorderLayout.CENTER);
    // Stats
    JPanel statsPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
    _statsLabel = GuiFactory.buildLabel("-");
    statsPanel.add(_statsLabel);
    JButton choose = GuiFactory.buildButton("Choose columns...");
    ActionListener al = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            TableColumnsChooserController<DeedDescription> chooser = new TableColumnsChooserController<DeedDescription>(_parent, _tableController.getTableController());
            chooser.editModal();
        }
    };
    choose.addActionListener(al);
    statsPanel.add(choose);
    panel.add(statsPanel, BorderLayout.NORTH);
    return panel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JTable(javax.swing.JTable) JButton(javax.swing.JButton) TableColumnsChooserController(delta.common.ui.swing.tables.TableColumnsChooserController) TitledBorder(javax.swing.border.TitledBorder)

Example 29 with DeedDescription

use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-companion by dmorcellet.

the class DeedsManagementController method actionPerformed.

/**
 * Action implementation.
 * @param event Source event.
 */
@Override
public void actionPerformed(ActionEvent event) {
    String action = event.getActionCommand();
    if (NEW_DEED_ID.equals(action)) {
        startNewDeed();
    } else if (REMOVE_DEED_ID.equals(action)) {
        deleteDeed();
    } else if (DeedsTableController.DOUBLE_CLICK.equals(action)) {
        DeedDescription deed = (DeedDescription) event.getSource();
        showToon(deed);
    }
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription)

Example 30 with DeedDescription

use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-companion by dmorcellet.

the class DeedsManagementController method deleteDeed.

private void deleteDeed() {
    GenericTableController<DeedDescription> controller = _deedsTable.getTableController();
    DeedDescription file = controller.getSelectedItem();
    if (file != null) {
    /*
      String serverName=file.getServerName();
      String toonName=file.getName();
      // Check deletion
      int result=GuiFactory.showQuestionDialog(_parentController.getWindow(),"Do you really want to delete " + toonName+"@"+ serverName + "?","Delete?",JOptionPane.YES_NO_OPTION);
      if (result==JOptionPane.OK_OPTION)
      {
        String id=CharacterFileWindowController.getIdentifier(serverName,toonName);
        WindowController windowController=_mainWindowsManager.getWindow(id);
        if (windowController!=null)
        {
          windowController.dispose();
        }
        CharactersManager manager=CharactersManager.getInstance();
        manager.removeToon(file);
      }
      */
    }
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription)

Aggregations

DeedDescription (delta.games.lotro.lore.deeds.DeedDescription)45 DeedProxy (delta.games.lotro.lore.deeds.DeedProxy)13 ArrayList (java.util.ArrayList)13 File (java.io.File)6 Rewards (delta.games.lotro.common.Rewards)5 DeedsManager (delta.games.lotro.lore.deeds.DeedsManager)4 HashSet (java.util.HashSet)4 DeedXMLParser (delta.games.lotro.lore.deeds.io.xml.DeedXMLParser)3 ActionEvent (java.awt.event.ActionEvent)3 ActionListener (java.awt.event.ActionListener)3 List (java.util.List)3 Title (delta.games.lotro.common.Title)2 Virtue (delta.games.lotro.common.Virtue)2 VirtueId (delta.games.lotro.common.VirtueId)2 ObjectItem (delta.games.lotro.common.objects.ObjectItem)2 ObjectsSet (delta.games.lotro.common.objects.ObjectsSet)2 DeedXMLWriter (delta.games.lotro.lore.deeds.io.xml.DeedXMLWriter)2 BorderLayout (java.awt.BorderLayout)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2