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

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

Introduction

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

Prototype

@Override
public final Component get(String path) 

Source Link

Document

Get a child component by looking it up with the given path.

Usage

From source file:gr.interamerican.wicket.bo2.utils.SelfDrawnUtils.java

License:Open Source License

/**
 * Returns the label of a SelfDrawnPanel for the specific repeater wicketId.
 * /*from  ww  w.  jav a 2  s .  c  om*/
 * @param selfDrawnPanel 
 *        Self drawn panel.
 * 
 * @param fieldId
 *        The wicketId of the repeater that has this component.
 * 
 * @return Label in the repeater that has the specified wicket id.
 */
public static Component getLabelFromSelfDrawnPanel(Panel selfDrawnPanel, String fieldId) {
    if (selfDrawnPanel == null) {
        return null;
    }
    String labelWicketId = SelfDrawnPanel.labelWicketIdWithPropertyName(fieldId);
    return selfDrawnPanel.get(labelWicketId);
}

From source file:gr.interamerican.wicket.markup.html.panel.crud.picker.CrudPickerPanel.java

License:Open Source License

/**
 * Optionally hides the buttons of the {@link SingleBeanPanel}.
 * /*from w ww.j a va2s .  co  m*/
 * @param panel SingleBeanPanel
 */
private void checkSingleBeanPanelButtonsState(Panel panel) {
    if (getDefinition().getHideSingleBeanPanelButtons()) {
        String pathExecute = WicketUtils.wicketPath(SingleBeanPanel.FORM_ID, SingleBeanPanel.EXEC_BUTTON_ID);
        String cancelExecute = WicketUtils.wicketPath(SingleBeanPanel.FORM_ID, SingleBeanPanel.BACK_BUTTON_ID);
        Component[] cmpArray = new Component[] { panel.get(pathExecute), panel.get(cancelExecute) };
        WicketUtils.setVisible(false, cmpArray);
    }
}

From source file:gr.interamerican.wicket.markup.html.panel.TestCheckBoxPanel.java

License:Open Source License

@Test
public void testCheckBoxPanel() {
    wicketTester.startPage(WicketPage.class);
    wicketTester.assertRenderedPage(WicketPage.class);
    Panel panel = (Panel) wicketTester.getComponentFromLastRenderedPage("checkBoxPanel");
    CheckBox checkBox = (CheckBox) panel.get("checkboxId");
    Assert.assertEquals(checkBox.getDefaultModelObject(), true);
}

From source file:org.apache.jetspeed.portlets.prm.portlet.SecurityPanel.java

License:Apache License

public SecurityPanel(String id, final PortletApplicationNodeBean paNodeBean) {
    super(id);// www  . j  a  va2s  .  c o  m
    this.paNodeBean = paNodeBean;
    Panel panel = initLayout();

    jetspeedSecurityContraintNames = new ArrayList<String>(Arrays.asList(""));
    PageManager pageManager = ((AbstractAdminWebApplication) getApplication()).getServiceLocator()
            .getPageManager();
    try {
        for (Object secConstDefObj : pageManager.getPageSecurity().getSecurityConstraintsDefs()) {
            SecurityConstraintsDef secConstDef = (SecurityConstraintsDef) secConstDefObj;
            jetspeedSecurityContraintNames.add(secConstDef.getName());
        }
    } catch (Exception e) {
        logger.error("Failed to retrieve jetspeed security constraint defs from page manager.", e);
    }

    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator()
            .getPortletRegistry();
    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
    PortletDefinition def = PortletApplicationUtils.getPortletOrClone(app, paNodeBean.getName());
    jetspeedSecurityConstraint = def.getJetspeedSecurityConstraint();

    Form form = (Form) panel.get("form");
    form.add(new DropDownChoice<String>("jetspeedConstraint",
            new PropertyModel<String>(this, "jetspeedSecurityConstraint"), jetspeedSecurityContraintNames));
    form.add(new Button("jsecSave", new ResourceModel("pam.details.action.save")) {
        @Override
        public void onSubmit() {
            FeedbackPanel feed = (FeedbackPanel) getPage().get("feedback");

            try {
                PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator()
                        .getPortletRegistry();
                PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                PortletDefinition def = PortletApplicationUtils.getPortletOrClone(app, paNodeBean.getName());
                def.setJetspeedSecurityConstraint(
                        "".equals(jetspeedSecurityConstraint) ? null : jetspeedSecurityConstraint);
                registry.savePortletDefinition(def);
                StringResourceModel resModel = new StringResourceModel(
                        "pam.details.action.status.portlet.saveOK", this, null,
                        new Object[] { paNodeBean.getName() });
                feed.info(resModel.getString());
            } catch (FailedToStorePortletDefinitionException e) {
                logger.error("Failed to retrieve jetspeed security constraint defs of portlet definition.", e);
                StringResourceModel resModel = new StringResourceModel(
                        "pam.details.action.status.portlet.saveFailure", this, null,
                        new Object[] { paNodeBean.getName(), e.getMessage() });
                feed.info(resModel.getString());
            }
        }
    });
}