Example usage for org.apache.wicket.markup.html.panel Panel replaceWith

List of usage examples for org.apache.wicket.markup.html.panel Panel replaceWith

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.panel Panel replaceWith.

Prototype

public Component replaceWith(Component replacement) 

Source Link

Document

Replaces this component with another.

Usage

From source file:com.doculibre.constellio.wicket.panels.admin.tabs.AdminTopMenuPanel.java

License:Open Source License

public void replaceTabContent(Panel newTabContent) {
    Panel tabContentPanel = (Panel) get(TabbedPanel.TAB_PANEL_ID);
    tabContentPanel.replaceWith(newTabContent);
    setBreadCrumbs();// w  ww . j  a  v a 2 s  .c o  m
}

From source file:edu.tsinghua.software.pages.row.ShowAllData.java

License:Apache License

/**
 * ShowAllData Construct/* w ww .j  ava2  s  .c om*/
 * @param pageParameters
 * */
public ShowAllData(PageParameters pageParameters) {
    super();
    try {
        clusterManager = new ClusterManager(getConnection());
    } catch (Exception e1) {
        e1.printStackTrace();
    }

    //get and show data
    clusterName = pageParameters.get("clusterParam").toString();
    keyspace = pageParameters.get("keyspaceParam").toString();
    columnFamily = pageParameters.get("columnFamilyParam").toString();

    //add navigation
    add(new BookmarkablePageLink<Void>("clusterNavigation", ClusterView.class)
            .add(new Label("clusterName", clusterName)));
    add(new BookmarkablePageLink<Void>("keyspaceNavigation", KeyspacePage.class, pageParameters)
            .add(new Label("keyspaceName", keyspace)));
    add(new BookmarkablePageLink<Void>("columnFamilyNavigation", ColumnFamilyPage.class, pageParameters)
            .add(new Label("columnFamilyName", columnFamily)));
    final FeedbackPanel feedBack = new FeedbackPanel("feedback");
    feedBack.setOutputMarkupId(true);
    add(feedBack);

    //show Number of Keys (estimate)
    int number = clusterManager.getEstimateRowNumber(keyspace, columnFamily);
    Label numberOfKeysLabel = new Label("numberofKeysLabel", "Number of Keys (estimate): " + number);
    add(numberOfKeysLabel);

    try {

        final Map<String, Key> l = client.listKeyAndValues(keyspace, columnFamily, "", "", 50);
        Panel browsePanel = new BrowsePanel("browseDataPanel", l, "Key", "Columns") {
        };
        add(browsePanel);

        //search field
        final TextField keyField = new TextField<String>("key", new Model(""));

        Form keyForm = new Form<String>("keyForm") {
        };
        AjaxButton searchButton = new AjaxButton("searchButton") {
            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                Panel toReplacePanel = (Panel) ShowAllData.this.get("browseDataPanel"); //get current panel, which will be replaced based on key 

                if (keyField.getModelObject() == null) {
                    target.add(feedBack);
                    info("?");
                } else {
                    target.add(feedBack);
                    String keyValue = keyField.getModelObject().toString();
                    try {
                        Map<String, Key> searchResult = client.getKey(keyspace, columnFamily, "", keyValue);
                        Panel resultPanel = null;
                        if (searchResult.size() != 0) {
                            resultPanel = new ColumnValuePanel("browseDataPanel",
                                    searchResult.get(keyValue).getCells(), l, "Key", "Columns");
                        } else {
                            Map<String, Cell> noData = new HashMap<String, Cell>();
                            noData.put("No Data Found", new Cell());
                            resultPanel = new ColumnValuePanel("browseDataPanel", noData, l, "Key", "Columns");
                        }
                        resultPanel.setOutputMarkupId(true);
                        toReplacePanel.replaceWith(resultPanel);
                        target.add(resultPanel);
                        toReplacePanel = resultPanel;

                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }

            }

        };
        keyForm.add(searchButton);
        keyForm.add(keyField);
        add(keyForm);
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:org.artifactory.webapp.wicket.actionable.tree.ActionableItemsTree.java

License:Open Source License

public Panel refreshDisplayPanel() {
    ActionableItemTreeNode mutableTreeNode = (ActionableItemTreeNode) getSelectedNode();
    ActionableItem item = mutableTreeNode.getUserObject();
    Panel oldDisplayPanel = itemsProvider.getItemDisplayPanel();
    Panel newDisplayPanel = item.newItemDetailsPanel(oldDisplayPanel.getId());
    newDisplayPanel.setOutputMarkupId(true);
    oldDisplayPanel.replaceWith(newDisplayPanel);
    itemsProvider.setItemDisplayPanel(newDisplayPanel);
    return newDisplayPanel;
}