/** * Generates the name (= id) of the editing component so that * the STable implementation knows to associate the input * value with the correct data row/columns * * Applies the unqique id/name for a component of the rows/column * to the cell component. * * @param component The edit component to rename * @param row Data row of this edit component * @param col Data column of this edit component */ protected void nameEditorComponent(final SComponent component, final int row, final int col) { nameBuffer.setLength(0); nameBuffer.append(this.getName()).append("_e_"); nameBuffer.append(row); nameBuffer.append('_').append(col); component.setNameRaw(nameBuffer.toString()); }
/** * Sets the name property of a component which must be <b>unique</b>! * <br/>Assigning the same name multiple times will cause strange results! * <p/> * <p>Valid names must begin with a letter ([A-Za-z]), underscores ("_") or dollars ("$") and may be followed by any number of * letters, digits ([0-9]), underscores ("_") and dollars ("$") * <p/> * <p>If no name is set, it is generated when necessary. * <p/> * <p><i>Explanation:</i> This property is an identifier which is used inside the generated HTML as an element identifier (id="") * and sometimes as a javascript function name. * * @param uniqueName A <b>unique</b> name to set. <b>Only valid identifier as described are allowed!</b> * @see Character */ public void setName(String uniqueName) { if (uniqueName != null) { char ch = uniqueName.charAt(0); if (uniqueName.length() == 0 || !(Character.isLetter(ch) || ch == '_' || ch == '$')) throw new IllegalArgumentException(uniqueName + " is not a valid identifier"); for (int i = 1; i < uniqueName.length(); i++) { ch = uniqueName.charAt(i); if (!(Character.isLetter(ch) || Character.isDigit(ch) || ch == '_' || ch == '$')) throw new IllegalArgumentException(uniqueName + " is not a valid identifier"); } } setNameRaw(uniqueName); }
/** * Generates the name (= id) of the editing component so that * the STable implementation knows to associate the input * value with the correct data row/columns * * Applies the unqique id/name for a component of the rows/column * to the cell component. * * @param component The edit component to rename * @param row Data row of this edit component * @param col Data column of this edit component */ protected void nameRendererComponent(final SComponent component, final int row, final int col) { nameBuffer.setLength(0); nameBuffer.append(this.getName()).append('_'); if (row == -1) nameBuffer.append('h'); else nameBuffer.append(row); nameBuffer.append('_').append(col); component.setNameRaw(nameBuffer.toString()); }
@Override public void setNameRaw(String uncheckedName) { super.setNameRaw(uncheckedName + "_panel"); editorComponent.setNameRaw(uncheckedName + "_ed"); ok.setNameRaw(uncheckedName + "_ok"); cancel.setNameRaw(uncheckedName + "_cl"); }