/** * Retrieves id by which this component is represented within the markup. This is either the id * attribute set explicitly via a call to {@link #setMarkupId(String)}, id attribute defined in * the markup, or an automatically generated id - in that order. * <p> * If no id is set and <code>createIfDoesNotExist</code> is false, this method will return null. * Otherwise it will generate an id value which by default will be unique in the page. This is * the preferred way as there is no chance of id collision. This will also enable * {@link #setOutputMarkupId(boolean)}. * <p> * * <p> * Note: This method should only be called after the component or its parent have been added to * the page. * * @param createIfDoesNotExist * When there is no existing markup id, determines whether it should be generated or * whether <code>null</code> should be returned. * * @return markup id of the component */ public String getMarkupId(boolean createIfDoesNotExist) { IMarkupIdGenerator markupIdGenerator = getApplication().getMarkupSettings().getMarkupIdGenerator(); String markupId = markupIdGenerator.generateMarkupId(this, createIfDoesNotExist); return markupId; }
/** * Retrieves id by which this component is represented within the markup. This is either the id * attribute set explicitly via a call to {@link #setMarkupId(String)}, id attribute defined in * the markup, or an automatically generated id - in that order. * <p> * If no id is set and <code>createIfDoesNotExist</code> is false, this method will return null. * Otherwise it will generate an id value which by default will be unique in the page. This is * the preferred way as there is no chance of id collision. This will also enable * {@link #setOutputMarkupId(boolean)}. * <p> * * <p> * Note: This method should only be called after the component or its parent have been added to * the page. * * @param createIfDoesNotExist * When there is no existing markup id, determines whether it should be generated or * whether <code>null</code> should be returned. * * @return markup id of the component */ public String getMarkupId(boolean createIfDoesNotExist) { IMarkupIdGenerator markupIdGenerator = getApplication().getMarkupSettings().getMarkupIdGenerator(); String markupId = markupIdGenerator.generateMarkupId(this, createIfDoesNotExist); return markupId; }