Search in sources :

Example 1 with NutchInstance

use of org.apache.nutch.webui.model.NutchInstance in project nutch by apache.

the class AbstractBasePage method addInstancesMenuMenu.

protected Component addInstancesMenuMenu() {
    IModel<String> instanceName = PropertyModel.of(currentInstance, "name");
    DropDownButton instancesMenu = new NavbarDropDownButton(instanceName) {

        /**
         */
        private static final long serialVersionUID = 1L;

        @Override
        protected List<AbstractLink> newSubMenuButtons(String buttonMarkupId) {
            List<NutchInstance> instances = instanceService.getInstances();
            List<AbstractLink> subMenu = Lists.newArrayList();
            for (NutchInstance instance : instances) {
                subMenu.add(new Link<NutchInstance>(buttonMarkupId, Model.of(instance)) {

                    /**
                     */
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick() {
                        currentInstance.setObject(getModelObject());
                        setResponsePage(DashboardPage.class);
                    }
                }.setBody(Model.of(instance.getName())));
            }
            return subMenu;
        }
    }.setIconType(FontAwesomeIconType.gears);
    return instancesMenu;
}
Also used : NavbarDropDownButton(de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarDropDownButton) NutchInstance(org.apache.nutch.webui.model.NutchInstance) NavbarDropDownButton(de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarDropDownButton) DropDownButton(de.agilecoders.wicket.core.markup.html.bootstrap.button.dropdown.DropDownButton) List(java.util.List)

Example 2 with NutchInstance

use of org.apache.nutch.webui.model.NutchInstance in project nutch by apache.

the class InstancesPage method populateInstanceRow.

private void populateInstanceRow(final Item<NutchInstance> item) {
    item.add(new AjaxLink<NutchInstance>("editInstance") {

        @Override
        public void onClick(AjaxRequestTarget target) {
            instancePanel.setModel(item.getModel());
            target.add(instancePanel);
            instancePanel.appendShowDialogJavaScript(target);
        }
    }.add(new Label("name")));
    item.add(new Label("host"));
    item.add(new Label("username"));
    item.add(createStatusLabel());
    item.add(new AjaxLink<NutchInstance>("instanceDelete", item.getModel()) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            instanceService.removeInstance(getModelObject().getId());
            target.add(instancesTable);
        }
    });
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) NutchInstance(org.apache.nutch.webui.model.NutchInstance) ColorEnumLabel(org.apache.nutch.webui.pages.components.ColorEnumLabel) Label(org.apache.wicket.markup.html.basic.Label) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Aggregations

NutchInstance (org.apache.nutch.webui.model.NutchInstance)2 DropDownButton (de.agilecoders.wicket.core.markup.html.bootstrap.button.dropdown.DropDownButton)1 NavbarDropDownButton (de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarDropDownButton)1 List (java.util.List)1 ColorEnumLabel (org.apache.nutch.webui.pages.components.ColorEnumLabel)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)1 Label (org.apache.wicket.markup.html.basic.Label)1