Showing posts with label UI. Show all posts
Showing posts with label UI. Show all posts

Wednesday 27 August 2014

Programmatic validation UI side

1.Class implements Validator{
2.    @Override
    public void validate(FacesContext facesContext, UIComponent uIComponent,Object newValue) throws ValidatorException {
       String val = String.valueOf(newValue);     
        if (val != null) {
            if (!getMethodResult(val)) {
                throw new ValidatorException(new FacesMessage("Name " + val + " already exists."));
            }
        }
    }

    public boolean getMethodResult(String name) {
        ViewObjectImpl vo = this.getAm().getVo1();
        RowQualifier rowQualifier = new RowQualifier(vo);
                rowQualifier.setWhereClause("Name='"+name+"'");
                Row[] rowsList = vo.getFilteredRows(rowQualifier);
                if(rowsList.length>0){
                        return false;
                    }
                return true;
    }

3. in jsff validator="#{backingBeanScope.myManagedBean.validate}"

Tuesday 30 April 2013

How to Stretch an ADF Table to occupy maximum width

ADF Table can be stretched to occupy the maximum width available by using AFStretchWidth Style Class.
Table can be embedded inside PanelStretchLayout or PanelCollection component

For PanelStretchLayout component the Table must be embedded inside the center facet, and the Style Class of both the Table and Layout component must be set to AFStretchWidth.
        <af:panelStretchLayout id="psl1">
          <f:facet name="bottom"/>
          <f:facet name="center">
            <af:table inlineStyle="AFStretchWidth" ...>
               ....
           </af:table>
          </f:facet>
          <f:facet name="start"/>
          <f:facet name="end"/>
          <f:facet name="top"/>
        </af:panelStretchLayout>

instead of using AFStretchWidth, you can decide which column will get stretched using the attribute columnStretching for example:
columnStretching="last"

  
 <af:table ... columnStretching="columnId_that_you_want_to_stretch" ...>