Search in sources :

Example 1 with EnumQueryPage

use of org.wikipediacleaner.api.constants.EnumQueryPage in project wpcleaner by WPCleaner.

the class PageListWorker method constructQueryPage.

/**
 * Construct special list of pages.
 *
 * @param pages List of pages.
 * @throws APIException
 */
private void constructQueryPage(List<Page> pages) throws APIException {
    final API api = APIFactory.getAPI();
    EnumWikipedia wiki = getWikipedia();
    EnumQueryPage query = EnumQueryPage.findByCode(elementNames.get(0));
    List<Page> tmpPages = api.getQueryPages(wiki, query);
    if (tmpPages != null) {
        pages.addAll(tmpPages);
    }
}
Also used : EnumQueryPage(org.wikipediacleaner.api.constants.EnumQueryPage) EnumWikipedia(org.wikipediacleaner.api.constants.EnumWikipedia) API(org.wikipediacleaner.api.API) EnumQueryPage(org.wikipediacleaner.api.constants.EnumQueryPage) Page(org.wikipediacleaner.api.data.Page)

Example 2 with EnumQueryPage

use of org.wikipediacleaner.api.constants.EnumQueryPage in project wpcleaner by WPCleaner.

the class MainWindow method actionSpecialList.

/**
 * Action called to get a special list.
 *
 * @param code Query code.
 */
public void actionSpecialList(String code) {
    EnumWikipedia wikipedia = getWikipedia();
    if (wikipedia == null) {
        return;
    }
    EnumQueryPage query = EnumQueryPage.findByCode(code);
    if (query == null) {
        return;
    }
    new PageListWorker(wikipedia, this, null, Collections.singletonList(code), PageListWorker.Mode.QUERY_PAGE, false, query.getName()).start();
}
Also used : PageListWorker(org.wikipediacleaner.gui.swing.pagelist.PageListWorker) EnumQueryPage(org.wikipediacleaner.api.constants.EnumQueryPage) EnumWikipedia(org.wikipediacleaner.api.constants.EnumWikipedia)

Example 3 with EnumQueryPage

use of org.wikipediacleaner.api.constants.EnumQueryPage in project wpcleaner by WPCleaner.

the class MainWindow method actionSpecialLists.

/**
 * Action called when Special Lists button is pressed.
 */
public void actionSpecialLists() {
    // Create menu for special lists
    JPopupMenu menu = new JPopupMenu();
    for (EnumQueryPage query : EnumQueryPage.values()) {
        JMenuItem item = new JMenuItem(query.getName());
        item.setActionCommand(query.getCode());
        item.addActionListener(EventHandler.create(ActionListener.class, this, "actionSpecialList", "actionCommand"));
        menu.add(item);
    }
    menu.show(buttonSpecialLists, 0, buttonSpecialLists.getHeight());
}
Also used : ActionListener(java.awt.event.ActionListener) EnumQueryPage(org.wikipediacleaner.api.constants.EnumQueryPage) JMenuItem(javax.swing.JMenuItem) JPopupMenu(javax.swing.JPopupMenu)

Aggregations

EnumQueryPage (org.wikipediacleaner.api.constants.EnumQueryPage)3 EnumWikipedia (org.wikipediacleaner.api.constants.EnumWikipedia)2 ActionListener (java.awt.event.ActionListener)1 JMenuItem (javax.swing.JMenuItem)1 JPopupMenu (javax.swing.JPopupMenu)1 API (org.wikipediacleaner.api.API)1 Page (org.wikipediacleaner.api.data.Page)1 PageListWorker (org.wikipediacleaner.gui.swing.pagelist.PageListWorker)1