After a long vacation I'm back to work :)
This post is about changing look n feel of ADF Faces af:table component
I have seen many questions related to changing table column header style , selected row style, changing row banding styles etc
Blog about Oracle ADF, JDeveloper, PL/SQL, Java, JavaScript, jQuery and Other Web Technologies
af|button{ color:navy; font-weight:bold; }
af|query { -tr-button-type: old; } af|query::button { color: red; font-weight:bold; } af|query::button:hover { color: Orange; font-weight:bold; } af|query::button:focus { color: maroon; font-weight:bold; } af|button{ color:navy; font-weight:bold; }
af|query { -tr-button-type: old; } .mystyle1 af|query::button { color: red; font-weight:bold; } .mystyle2 af|query::button { color: darkgreen; font-weight:bold; }
af|button { width: 150px; text-align: center; vertical-align: bottom; color: blue; border: skyblue 2.0px solid; font-style: italic; font-family: cursive; }
af|button::link { border: skyblue 2.0px solid; background-color: #feffd5; }
af|button:hover::link { background-color: #c7660b; border: skyblue 2.0px solid; color: White; } af|button:disabled::link { background-color: Gray; border: skyblue 2.0px solid; color: White; }
af|button:depressed::link { background-color: maroon; border: skyblue 2.0px solid; color: White; }
af|button { width: 150px; text-align: center; vertical-align: bottom; color: blue; border: skyblue 2.0px solid; font-style: italic; font-family: cursive; border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; border-top-left-radius: 15px; border-top-right-radius: 15px; } af|button::link { border: skyblue 2.0px solid; background-color: #feffd5; border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; border-top-left-radius: 15px; border-top-right-radius: 15px; }
af|button { text-align: center; vertical-align: middle; color: blue; border: skyblue 2.0px solid; font-style: italic; font-family: cursive; height: 50px; width: 50px; } af|button::text { padding-top: 12px; } af|button::link { border: skyblue 2.0px solid; background-color: #feffd5; height: 43px; }
af|button { text-align: center; vertical-align: middle; color: blue; border: skyblue 2.0px solid; font-style: italic; font-family: cursive; height: 50px; width: 50px; border-bottom-left-radius: 5em 5em; border-bottom-right-radius: 5em 5em; border-top-left-radius: 5em; border-top-right-radius: 5em; } af|button::text { padding-top: 12px; } af|button::link { border: skyblue 2.0px solid; background-color: #feffd5; height: 43px; border-bottom-left-radius: 5em 5em; border-bottom-right-radius: 5em 5em; border-top-left-radius: 5em; border-top-right-radius: 5em; }
af|messages::info-icon { content: url("../../information.png"); } af|messages::warning-icon { content: url("../../warning.png"); } af|messages::error-icon { content: url("../../error.png"); }
Default Icon | Changed Icon |
<skin-family>skin1</skin-family>
<skin-family>skin2</skin-family>
/**Custom QueryOperationListener that hadles variois events raised by af:query * @param queryOperationEvent */ public void deptSeacrhQueryOperationList(QueryOperationEvent queryOperationEvent) { //Invoke default operation listener invokeEL("#{bindings.DepartmentsVOCriteriaQuery.processQueryOperation}", Object.class, QueryOperationEvent.class, queryOperationEvent); System.out.println("Query Event is-" + queryOperationEvent.getOperation().name()); //Check that current operation is RESET if (queryOperationEvent.getOperation().name().equalsIgnoreCase("RESET")) { DCIteratorBinding iter = (DCIteratorBinding) getBindings().get("Departments1Iterator"); ViewObjectImpl vo = (ViewObjectImpl) iter.getViewObject(); // Setting the value of bind variable vo.ensureVariableManager().setVariableValue("BindDeptNm", "Human Resource"); } }
/** * @param expr * @param returnType * @param argTypes * @param args * @return */ public Object invokeMethodExpression(String expr, Class returnType, Class[] argTypes, Object[] args) { FacesContext fc = FacesContext.getCurrentInstance(); ELContext elctx = fc.getELContext(); ExpressionFactory elFactory = fc.getApplication().getExpressionFactory(); MethodExpression methodExpr = elFactory.createMethodExpression(elctx, expr, returnType, argTypes); return methodExpr.invoke(elctx, args); } /** * @param expr * @param returnType * @param argType * @param argument * @return */ public Object invokeEL(String expr, Class returnType, Class argType, Object argument) { return invokeMethodExpression(expr, returnType, new Class[] { argType }, new Object[] { argument }); }
//Binding of af:query in managed bean private RichQuery queryPanelDept; public void setQueryPanelDept(RichQuery queryPanelDept) { this.queryPanelDept = queryPanelDept; } public RichQuery getQueryPanelDept() { return queryPanelDept; }
private String current_mode = "B"; /**Method Action to change mode of af:query * @param actionEvent */ public void changeModeAction(ActionEvent actionEvent) { if (current_mode == "B") { getQueryPanelDept().getValue().changeMode(QueryDescriptor.QueryMode.ADVANCED); current_mode = "A"; } else if (current_mode == "A") { getQueryPanelDept().getValue().changeMode(QueryDescriptor.QueryMode.BASIC); current_mode = "B"; } }
import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import oracle.adf.view.rich.event.DialogEvent; import oracle.adf.view.rich.event.PopupCanceledEvent; public class DialogListenerBean { public DialogListenerBean() { } public void dialogListener(DialogEvent dialogEvent) { FacesMessage msg = new FacesMessage("You have clicked- " + dialogEvent.getOutcome().name()); FacesContext.getCurrentInstance().addMessage(null, msg); } public void cancelListener(PopupCanceledEvent popupCanceledEvent) { FacesMessage msg = new FacesMessage("You have clicked- cancel"); FacesContext.getCurrentInstance().addMessage(null, msg); } }