Java Code Examples for org.apache.wicket.markup.html.WebPage

The following are top voted examples for showing how to use org.apache.wicket.markup.html.WebPage. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: openNaEF   File: LocationViewPage.java   View source code 6 votes vote down vote up
private void createAddNodeLink() {
    final WebPage page;
    if (LocationUtil.isNodeAssignable(current)) {
        page = new NodeEditPage(LocationViewPage.this, null, current);
    } else {
        page = null;
    }
    Link<Void> link = new Link<Void>("addNode") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick() {
            setResponsePage(page);
        }
    };
    boolean editable = LocationUtil.isNodeAssignable(current);
    link.setEnabled(editable);
    link.setVisible(editable);
    add(link);
}
 
Example 2
Project: openNaEF   File: VportEditPage.java   View source code 6 votes vote down vote up
public VportEditPage(final WebPage backPage) {
    try {
        AAAWebUtil.checkAAA(this, OPERATION_NAME);
        this.backPage = backPage;

        Link<Void> backLink = new Link<Void>("back") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClick() {
                setResponsePage(getBackPage());
            }
        };
        add(backLink);
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 3
Project: openNaEF   File: AAAWebUtil.java   View source code 5 votes vote down vote up
public static String getIpAddress(WebPage page) {
    if (page == null) {
        return "null-page";
    }
    Request request = page.getRequest();
    if (request instanceof WebRequest) {
        WebRequest webreq = (WebRequest) request;
        return webreq.getHttpServletRequest().getRemoteAddr();
    }
    return null;
}
 
Example 4
Project: openNaEF   File: TransactionExecutionResultPage.java   View source code 5 votes vote down vote up
public TransactionExecutionResultPage(final CustomTransaction transaction) {
    try {
        AAAWebUtil.checkAAA(this, OPERATION_NAME);
        add(UrlUtil.getTopLink("top"));
        Label titleLabel = new Label("title", transaction.getTitle());
        add(titleLabel);
        Label headLabel = new Label("head", transaction.getHead());
        add(headLabel);

        final String msg;
        final WebPage nextPage;
        if (transaction.isSuccess()) {
            msg = transaction.getSuccessResultMessage();
            nextPage = transaction.getForwardPage();
        } else {
            msg = transaction.getFailResultMessage();
            nextPage = transaction.getBackPage();
        }
        Label messageLabel = new Label("resultMessage", msg);
        add(messageLabel);
        Link<Void> backLink = new Link<Void>("back") {
            private static final long serialVersionUID = 1L;

            public void onClick() {
                setResponsePage(nextPage);
            }
        };
        backLink.setEnabled(nextPage != null);
        backLink.setVisible(nextPage != null);
        add(backLink);
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 5
Project: openNaEF   File: PseudoWirePageUtil.java   View source code 5 votes vote down vote up
public static Link<Void> createPwEditLink(final String id, final WebPage backPage, final PseudowireDto pw) {
    Link<Void> link = new Link<Void>(id) {
        private static final long serialVersionUID = 1L;

        public void onClick() {
            PseudoWireEditPage page = new PseudoWireEditPage(backPage, pw);
            setResponsePage(page);
        }
    };
    link.setEnabled(pw != null);
    return link;
}
 
Example 6
Project: openNaEF   File: VplsListPage.java   View source code 5 votes vote down vote up
public VplsListPage(WebPage backPage, PageParameters param) {
    this.backPage = backPage;

    try {
        long prev = System.currentTimeMillis();
        this.editorName = AAAWebUtil.checkAAA(this, OPERATION_NAME);

        long time = System.currentTimeMillis();
        PerfLog.info(prev, time, "build header component");
        prev = time;
        String nodeName = param.getString(KEY_NODE_NAME);
        String vplsId = param.getString(KEY_VPLS_ID);

        this.vplsModel = new VplsModel(nodeName, vplsId);

        time = System.currentTimeMillis();
        PerfLog.info(prev, time, "build portsModel");
        prev = time;

        VplsIfPanel vplsIfPanel = new VplsIfPanel("vplsIfPanel", null, vplsModel, editorName);
        add(vplsIfPanel);

        Link<Void> editLink = new Link<Void>("back") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClick() {
                setResponsePage(getBackPage());
            }
        };
        add(editLink);

        time = System.currentTimeMillis();
        PerfLog.info(prev, time, "NodeDetailPage() - end");
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 7
Project: openNaEF   File: NodePageUtil.java   View source code 5 votes vote down vote up
public static Link<Void> createNeighborEditLink(final WebPage backPage, final String id, final PortDto basePort) {
    Link<Void> link = new Link<Void>(id) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick() {
            LinkEditPage page = new LinkEditPage(backPage, basePort);
            setResponsePage(page);
        }
    };
    return link;
}
 
Example 8
Project: openNaEF   File: VlanUtil.java   View source code 5 votes vote down vote up
public static Link<Void> createVlanEditLink(final String id, final WebPage backPage, final VlanDto vlan) {
    Link<Void> link = new Link<Void>(id) {
        private static final long serialVersionUID = 1L;

        public void onClick() {
            throw new IllegalStateException("not supported.");
        }
    };
    link.setEnabled(vlan != null);
    return link;
}
 
Example 9
Project: karate   File: WicketApplication.java   View source code 4 votes vote down vote up
@Override
public Class<? extends WebPage> getHomePage() {
	return HomePage.class;
}
 
Example 10
Project: ansible-docker-talk   File: WicketApplication.java   View source code 4 votes vote down vote up
/**
 * @see org.apache.wicket.Application#getHomePage()
 */
@Override
public Class<? extends WebPage> getHomePage() {
    return HomePage.class;
}
 
Example 11
Project: openNaEF   File: DiscoveryTypeEditPage.java   View source code 4 votes vote down vote up
public DiscoveryTypeEditPage(WebPage backPage, final FromToValueHolder fromToValueHolder, final List<FromToValueHolder> allHolders) {
    this.backPage = backPage;
    if (fromToValueHolder != null) {
        this.from = fromToValueHolder.from;
        this.to = fromToValueHolder.to;
    }

    Form<Void> form = new Form<Void>("edit");
    add(form);

    this.fromField = new TextField<String>("from", new PropertyModel<String>(this, "from"), String.class);
    form.add(fromField);
    this.toField = new TextField<String>("to", new PropertyModel<String>(this, "to"), String.class);
    form.add(toField);

    Button applyButton = new Button("apply") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit() {
            if (getFrom() == null || getFrom().equals("")) {
                throw new IllegalArgumentException("From is mandatory.");
            }
            if (getTo() == null || getTo().equals("")) {
                throw new IllegalArgumentException("To is mandatory.");
            }
            try {


                FromToValueHolder newHolder = new FromToValueHolder();
                newHolder.from = getFrom();
                newHolder.to = getTo();
                List<FromToValueHolder> holders = new ArrayList<FromToValueHolder>();
                if (fromToValueHolder != null) {
                    for (FromToValueHolder hol : allHolders) {
                        if (hol.from.equals(fromToValueHolder.from) && hol.to.equals(fromToValueHolder.to)) {
                            holders.add(newHolder);
                        } else {
                            holders.add(hol);
                        }
                    }
                } else {
                    holders.addAll(allHolders);
                    holders.add(newHolder);
                }

                MplsNmsDiffConfiguration con = MplsNmsDiffConfiguration.getInstance();
                con.setDiscoveryTypeMappings(holders);
                con.saveConfiguration();
                con.reloadConfiguration();
                ConfigUtil.getInstance().reload();
                getBackPage().modelChanged();
                PageUtil.setModelChanged(getBackPage());
                setResponsePage(getBackPage());
            } catch (Exception e) {
                e.printStackTrace();
                throw ExceptionUtils.throwAsRuntime(e);
            }
        }
    };
    form.add(applyButton);

    Button backButton = new Button("back") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit() {
            setResponsePage(getBackPage());
        }
    };
    form.add(backButton);

}
 
Example 12
Project: openNaEF   File: DiscoveryTypeEditPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return backPage;
}
 
Example 13
Project: openNaEF   File: ValueConvertEntryEditPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return backPage;
}
 
Example 14
Project: openNaEF   File: DiffListPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return this.backPage;
}
 
Example 15
Project: openNaEF   File: VrfCreationPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return this.backPage;
}
 
Example 16
Project: openNaEF   File: VrfListPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return backPage;
}
 
Example 17
Project: openNaEF   File: VrfListPage.java   View source code 4 votes vote down vote up
public VrfListPage(WebPage backPage, PageParameters param) {
    this.backPage = backPage;

    try {
        long prev = System.currentTimeMillis();
        this.editorName = AAAWebUtil.checkAAA(this, OPERATION_NAME);

        long time = System.currentTimeMillis();
        PerfLog.info(prev, time, "build header component");
        prev = time;
        String nodeName = param.getString(KEY_NODE_NAME);
        String VrfId = param.getString(KEY_Vrf_ID);

        this.VrfModel = new VrfModel(nodeName, VrfId);

        time = System.currentTimeMillis();
        PerfLog.info(prev, time, "build vrf Model");
        prev = time;

        VrfIfPanel VrfIfPanel = new VrfIfPanel("vrfIfPanel", null, VrfModel, editorName);
        add(VrfIfPanel);

        Link<Void> editLink = new Link<Void>("back") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClick() {
                if (getBackPage() == null) {
                    return;
                }
                setResponsePage(getBackPage());
            }
        };
        editLink.setEnabled(getBackPage() != null);
        add(editLink);

        time = System.currentTimeMillis();
        PerfLog.info(prev, time, "VrfListPage() - end");
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 18
Project: openNaEF   File: NodeVrfPortSelectionPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return this.backPage;
}
 
Example 19
Project: openNaEF   File: VrfEditPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return backPage;
}
 
Example 20
Project: openNaEF   File: CustomerResourceEditPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return this.backPage;
}
 
Example 21
Project: openNaEF   File: CustomerInfoEditPage.java   View source code 4 votes vote down vote up
public CustomerInfoEditPage(WebPage backPage, CustomerInfoDto user) {
    try {
        this.editorName = AAAWebUtil.checkAAA(this, OPERATION_NAME);
        if (backPage == null) {
            throw new IllegalArgumentException();
        }
        if (user != null) {
            user.renew();
        }
        this.backPage = backPage;
        this.user = user;
        String nameCaption = null;
        CustomerInfoRenderer renderer = new CustomerInfoRenderer(this.user);
        this.name = renderer.getName();
        if (this.user == null) {
            nameCaption = "New Customer";
        } else {
            nameCaption = this.name;
        }
        this.companyID = renderer.getCompanyID();
        this.active = renderer.isActive();
        this.portalUser = renderer.getPortalUser();
        this.portalPassword = renderer.getPortalPass();

        Link<Void> backLink = new Link<Void>("back") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClick() {
                setResponsePage(getBackPage());
            }
        };
        add(backLink);
        add(new FeedbackPanel("feedback"));

        Label userNameLabel = new Label("customerInfo", nameCaption);
        add(userNameLabel);

        Form<Void> form = new Form<Void>("form") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit() {
                processUpdate();
                PageUtil.setModelChanged(getBackPage());
                setResponsePage(getBackPage());
            }
        };
        add(form);

        TextField<String> nameField = new TextField<String>("name",
                new PropertyModel<String>(this, "name"), String.class);
        nameField.setEnabled(this.name.isEmpty());
        form.add(nameField);

        TextField<String> companyIDField = new TextField<String>("companyID",
                new PropertyModel<String>(this, "companyID"), String.class);
        form.add(companyIDField);

        CheckBox activeBox = new CheckBox("active", new PropertyModel<Boolean>(this, "active"));
        form.add(activeBox);

        TextField<String> portalUserField = new TextField<String>("portalUser",
                new PropertyModel<String>(this, "portalUser"), String.class);
        form.add(portalUserField);

        TextField<String> portalPasswordField = new TextField<String>("portalPassword",
                new PropertyModel<String>(this, "portalPassword"), String.class);
        form.add(portalPasswordField);

    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 22
Project: openNaEF   File: CustomerInfoEditPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return this.backPage;
}
 
Example 23
Project: openNaEF   File: PortSelectionPanel.java   View source code 4 votes vote down vote up
public PortSelectionPanel(String id, WebPage parent, String nodeName, PortDto selectedInterface) {
    this(id, parent, nodeName, selectedInterface, new SimplePortFilter());
}
 
Example 24
Project: openNaEF   File: PortSelectionPanel.java   View source code 4 votes vote down vote up
public PortSelectionPanel(String id, WebPage parent, String nodeName, PortDto selectedInterface,
                          PortFilter filter) {
    this(id, parent, nodeName, selectedInterface, filter, new SimplePortFilter());
}
 
Example 25
Project: openNaEF   File: PortSelectionPanel.java   View source code 4 votes vote down vote up
public WebPage getParentPage() {
    return this.parentPage;
}
 
Example 26
Project: openNaEF   File: VirtualNodeEditPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return this.backPage;
}
 
Example 27
Project: openNaEF   File: LinkEditPage.java   View source code 4 votes vote down vote up
public LinkEditPage(WebPage backPage, PortDto basePort) {
    try {
        this.editorName = AAAWebUtil.checkAAA(this, OPERATION_NAME);
        if (backPage == null) {
            throw new IllegalArgumentException();
        }
        this.backPage = backPage;
        if (basePort == null) {
            throw new IllegalArgumentException();
        }
        basePort.renew();
        this.basePort = basePort;
        this.l2Neighbor = NodeUtil.getLayer2Neighbor(basePort);
        this.model = new NeighborModel(basePort);

        Link<Void> backLink = new Link<Void>("back") {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClick() {
                setResponsePage(getBackPage());
            }
        };
        add(backLink);
        add(new FeedbackPanel("feedback"));

        Label baseLabel = new Label("baseName", new PropertyModel<String>(this.model, "baseName"));
        add(baseLabel);
        Label nodeLabel1 = new Label("node", new PropertyModel<String>(this.model, "hereNodeName"));
        add(nodeLabel1);
        Label ifNameLabel1 = new Label("ifName", new PropertyModel<String>(this.model, "hereIfName"));
        add(ifNameLabel1);
        BookmarkablePageLink<Void> neighborLink =
                new BookmarkablePageLink<Void>("neighborNode",
                        SimpleNodeDetailPage.class,
                        NodeUtil.getNodeParameters(this.model.getThere()));
        add(neighborLink);
        Label nodeLabel2 = new Label("nodeName", new PropertyModel<String>(this.model, "thereNodeName"));
        neighborLink.add(nodeLabel2);
        Label ifNameLabel2 = new Label("neighborIfName", new PropertyModel<String>(this.model, "thereIfName"));
        add(ifNameLabel2);

        linkL2Node = createLink("layer2NeighborNode", l2Neighbor);
        add(linkL2Node);
        Label linkL2Label = new Label("layer2NeighborIfName", new PropertyModel<String>(this, "l2NeighborIfName"));
        add(linkL2Label);
        Link<Void> editLayer2 = createEditor("createLink", basePort, l2Neighbor);
        editLayer2.setEnabled(l2Neighbor == null);
        editLayer2.setVisible(l2Neighbor == null);
        add(editLayer2);
        Link<Void> deleteLayer2 = createDeleteButton("deleteLink", false, basePort);
        deleteLayer2.setEnabled(l2Neighbor != null);
        deleteLayer2.setVisible(l2Neighbor != null);
        add(deleteLayer2);

    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 28
Project: openNaEF   File: LinkEditPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return this.backPage;
}
 
Example 29
Project: openNaEF   File: LinkNeighborPortSelectionPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return this.backPage;
}
 
Example 30
Project: openNaEF   File: LinkNeighborPortSelectionPage.java   View source code 4 votes vote down vote up
public WebPage getLinkPage() {
    return this.linkPage;
}
 
Example 31
Project: openNaEF   File: LinkNeighborPortSelectionPanel.java   View source code 4 votes vote down vote up
public LinkNeighborPortSelectionPanel(String id, WebPage parent, String nodeName, PortDto selectedInterface) {
    this(id, parent, nodeName, selectedInterface, new SimplePortFilter());
}
 
Example 32
Project: openNaEF   File: LinkNeighborPortSelectionPanel.java   View source code 4 votes vote down vote up
public LinkNeighborPortSelectionPanel(String id, WebPage parent, String nodeName, PortDto selectedInterface,
                                      PortFilter filter) {
    this(id, parent, nodeName, selectedInterface, filter, new SimplePortFilter());
}
 
Example 33
Project: openNaEF   File: LinkNeighborPortSelectionPanel.java   View source code 4 votes vote down vote up
public WebPage getParentPage() {
    return this.parentPage;
}
 
Example 34
Project: openNaEF   File: VrfIfRowPanel.java   View source code 4 votes vote down vote up
public WebPage createDestinationSelector(PortDto port) {
    DestinationSelectionPage page = new DestinationSelectionPage(getWebPage(), port);
    return page;
}
 
Example 35
Project: openNaEF   File: DestinationSelectionPage.java   View source code 4 votes vote down vote up
public WebPage getBackPage() {
    return this.backPage;
}
 
Example 36
Project: openNaEF   File: CommandExecutionConfirmationPage.java   View source code 4 votes vote down vote up
public CommandExecutionConfirmationPage(final WebPage backPage, final String message, final List<? extends CommandBuilder> builders) {
    this(backPage, backPage, message, builders);
}
 
Example 37
Project: openNaEF   File: PortRowPanel.java   View source code 4 votes vote down vote up
public WebPage createDestinationSelector(PortDto port) {
    DestinationSelectionPage page = new DestinationSelectionPage(getWebPage(), port);
    return page;
}
 
Example 38
Project: openNaEF   File: SinglePortSelectionPanel.java   View source code 4 votes vote down vote up
public SinglePortSelectionPanel(String id, WebPage parent, String nodeName, PortDto selectedInterface) {
    this(id, parent, nodeName, selectedInterface, new SimplePortFilter());
}
 
Example 39
Project: openNaEF   File: SinglePortSelectionPanel.java   View source code 4 votes vote down vote up
public SinglePortSelectionPanel(String id, WebPage parent, String nodeName, PortDto selectedInterface,
                                PortFilter filter) {
    this(id, parent, nodeName, selectedInterface, filter, new SimplePortFilter());
}
 
Example 40
Project: openNaEF   File: SinglePortSelectionPanel.java   View source code 4 votes vote down vote up
public WebPage getParentPage() {
    return this.parentPage;
}