Below is the code for CreateRuleBean... 

package org.apache.myfaces.trinidaddemo.PEM.backingBean;

import java.util.Arrays;
import java.util.List;

import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;

import org.apache.myfaces.trinidad.component.core.input.CoreInputFile;
import org.apache.myfaces.trinidad.component.core.input.CoreInputText;
import 
org.apache.myfaces.trinidad.component.core.input.CoreSelectBooleanCheckbox;
import org.apache.myfaces.trinidad.component.core.input.CoreSelectOneChoice;
import org.apache.myfaces.trinidad.component.core.nav.CoreCommandButton;
import org.apache.myfaces.trinidad.component.core.output.CoreOutputLabel;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.*;

@Name("dataRestoreBean")
@Scope(ScopeType.SESSION)
/**
 * 
 * Backing bean for the createRule page
 *
 */
public class CreateRuleBean 
{
        private CoreOutputLabel label01;
        private CoreSelectOneChoice listBox02;
        private CoreOutputLabel label02;
        private CoreInputFile inputFile01;
        private CoreSelectOneChoice listBox03;
        private CoreSelectOneChoice listBox04;
        private CoreCommandButton btn01;
        private CoreCommandButton btn02;
        private CoreCommandButton btn03;
        private CoreCommandButton btn04;
        private CoreInputText inputText03;
        private CoreInputText inputText04;
        private String rule;
        private String fileName;
        private String propertyValue;
        private String dataSet;
        private String dataSetName;
        private List tableNames;
        private List properties;
        private List equalityOperators;
        private String equalityOperator;
        
        private CoreSelectBooleanCheckbox chkBox1;
        public CoreSelectBooleanCheckbox getChkBox1() {
                return chkBox1;
        }
        public void setChkBox1(CoreSelectBooleanCheckbox chkBox1) {
                this.chkBox1 = chkBox1;
        }
        public String getPropertyValue() {
                return propertyValue;
        }
        public void setPropertyValue(String propertyValue) {
                this.propertyValue = propertyValue;
        }
        public String getFileName() {
                return fileName;
        }
        public void setFileName(String fileName) {
                this.fileName = fileName;
        }
        public String getRule() {
                return rule;
        }
        public void setRule(String rule) {
                this.rule = rule;
        }
        public CoreOutputLabel getLabel01() {
                return label01;
        }
        public void setLabel01(CoreOutputLabel label01) {
                this.label01 = label01;
        }
        public CoreSelectOneChoice getListBox02() {
                return listBox02;
        }
        public void setListBox02(CoreSelectOneChoice listBox02) {
                this.listBox02 = listBox02;
        }
        public CoreOutputLabel getLabel02() {
                return label02;
        }
        public void setLabel02(CoreOutputLabel label02) {
                this.label02 = label02;
        }
        public CoreInputFile getInputFile01() {
                return inputFile01;
        }
        public void setInputFile01(CoreInputFile inputFile01) {
                this.inputFile01 = inputFile01;
        }
        public CoreSelectOneChoice getListBox03() {
                return listBox03;
        }
        public void setListBox03(CoreSelectOneChoice listBox03) {
                this.listBox03 = listBox03;
        }
        
        public List getTableNames() {
                return tableNames;
        }
        public void setTableNames(List tableNames) {
                this.tableNames = tableNames;
        }
        public CoreCommandButton getBtn01() {
                return btn01;
        }
        public void setBtn01(CoreCommandButton btn01) {
                this.btn01 = btn01;
        }
        public CoreCommandButton getBtn02() {
                return btn02;
        }
        public void setBtn02(CoreCommandButton btn02) {
                this.btn02 = btn02;
        }
        public CoreCommandButton getBtn03() {
                return btn03;
        }
        public void setBtn03(CoreCommandButton btn03) {
                this.btn03 = btn03;
        }
        public CoreCommandButton getBtn04() {
                return btn04;
        }
        public void setBtn04(CoreCommandButton btn04) {
                this.btn04 = btn04;
        }
        
        public List getProperties() {
                return properties;
        }
        public void setProperties(List properties) {
                this.properties = properties;
        }
        
        public List getEqualityOperators() {
                return equalityOperators;
        }
        public void setEqualityOperators(List equalityOperators) {
                this.equalityOperators = equalityOperators;
        }
        public void dataSetChangeEvent(ValueChangeEvent changeEvent) 
        {
                String newValue = (String)changeEvent.getNewValue();
                if(newValue == null)
                {                       
                        inputFile01.setStyleClass("displayNone");               
        
                        listBox02.setStyleClass("displayBox");
                        setTableNames(null);
                        setProperties(null);
                        setEqualityOperators(null);                     
                }
                else
                {
                        if(newValue.equalsIgnoreCase("Table"))
                        {                       
                                        List tableNames = Arrays.asList(new 
SelectItem[]{new SelectItem("Table01","Table01"),
                                                                                
new SelectItem("Table02","Table02"),new SelectItem("Table03","Table03")});
                                        List properties = Arrays.asList(new 
SelectItem[]{new SelectItem("column1","column1"),new 
SelectItem("column2","column2")});
                                        setProperties(properties);
                                        setTableNames(tableNames);              
                        
                                        
inputFile01.setStyleClass("displayNone");                                       
                                        listBox02.setStyleClass("displayBox");
                                        /*List equalityOperators = 
Arrays.asList(new SelectItem[]{new SelectItem("opr1","=")});
                                        
setEqualityOperators(equalityOperators);*/
                                        
                        }
                        else if(newValue.equalsIgnoreCase("File"))
                        {                               
                                inputFile01.setStyleClass("displayBox");        
                        
                                listBox02.setStyleClass("displayNone");
                                List properties = Arrays.asList(new 
SelectItem[]{new SelectItem("Size","Size"),
                                                                new 
SelectItem("Age","Age")});                          
                                setProperties(properties);
                                /*List equalityOperators = Arrays.asList(new 
SelectItem[]{new SelectItem("opr2",">")});
                                setEqualityOperators(equalityOperators);*/
                        }                       
                }
                clear();
        }
        public void propertyValueChangeEvent(ValueChangeEvent changeEvent) 
        {
                String newValue = (String)changeEvent.getNewValue();
                if(newValue == null)
                {
                                                
                }
                else
                {
                        if(!listBox04.isDisabled() && listBox04.getValue() != 
null)
                        {
                                setText(inputText04, 
listBox04.getValue().toString());                          
                        }
                        setText(inputText04, newValue);
                        inputText03.setDisabled(true);
                        listBox04.setDisabled(true);
                        //inputText03.setValue(null);
                        btn01.setDisabled(false);
                        btn02.setDisabled(false);
                        
                }
        }
        public void andOperatorPressed() 
        {
                setText(inputText04,"&&");
                btn01.setDisabled(true);
                btn02.setDisabled(true);
                btn03.setDisabled(false);
                //btn04.setDisabled(true);
                listBox03.setDisabled(false);           
                
        }
        public void orOperatorPressed() 
        {
                setText(inputText04,"||");
                btn01.setDisabled(true);
                btn02.setDisabled(true);
                btn03.setDisabled(false);
                //btn04.setDisabled(true);
                listBox03.setDisabled(false);                   
        }
        /*public void leftBracketPressed() 
        {
                btn01.setDisabled(true);
                btn02.setDisabled(true);
                btn03.setDisabled(true);
                btn04.setDisabled(false);
                listBox03.setDisabled(false);           
                inputText04.setValue(inputText04.getValue().toString()+"(");
        }*/
        public void bracketPressed() 
        {
                setText(inputText04,"()");
                btn01.setDisabled(true);
                btn02.setDisabled(true);
                btn03.setDisabled(true);
                //btn04.setDisabled(false);
                listBox03.setDisabled(false);
                chkBox1.setDisabled(false);
                
        }
        /*public void rightBracketPressed() 
        {
                btn01.setDisabled(true);
                btn02.setDisabled(true);
                btn03.setDisabled(true);
                btn04.setDisabled(true);
                listBox03.setDisabled(false);           
                inputText04.setValue(inputText04.getValue().toString()+")");
        }*/
        public void propertyChangeEvent(ValueChangeEvent changeEvent) 
        {
                String newValue = (String)changeEvent.getNewValue();
                if(newValue == null)
                {
                        setEqualityOperators(null);
                        listBox04.setDisabled(false);
                }
                else
                {       
                        List equalityOperators = Arrays.asList(new 
SelectItem[]{new SelectItem("=","="),new SelectItem(">",">")});
                        setEqualityOperators(equalityOperators);                
                
                                                
                        /*if(inputText04.getValue() == null)
                        {
                                setText(inputText04,newValue);  
                        }
                        else
                        {
                                
inputText04.setValue(inputText04.getValue().toString()+newValue);
                        }*/
                        setText(inputText04, newValue);
                        listBox03.setDisabled(true);
                        listBox04.setDisabled(false);
                        if(listBox04.getValue() != null)
                        {
                                inputText03.setDisabled(false);
                        }
                        if(!btn01.isDisabled() || !btn02.isDisabled() || 
!btn03.isDisabled() || !btn04.isDisabled())
                        {
                                btn01.setDisabled(true);
                                btn02.setDisabled(true);
                                btn03.setDisabled(true);
                                btn04.setDisabled(true);
                        }
                }       
        }
        public void equalityChangeEvent(ValueChangeEvent changeEvent) 
        {
                String newValue = (String)changeEvent.getNewValue();
                if(newValue == null)
                {
                                                
                }
                else
                {
                        setText(inputText04, newValue);                 
                        listBox04.setDisabled(true);
                        inputText03.setDisabled(false);                 
                }
        }
        public CoreInputText getInputText04() {
                return inputText04;
        }
        public void setInputText04(CoreInputText inputText04) {
                this.inputText04 = inputText04;
        }
        public CoreSelectOneChoice getListBox04() {
                return listBox04;
        }
        public void setListBox04(CoreSelectOneChoice listBox04) {
                this.listBox04 = listBox04;
        }
        public CoreInputText getInputText03() {
                return inputText03;
        }
        public void setInputText03(CoreInputText inputText03) {
                this.inputText03 = inputText03;
        }
        
        private void setText(CoreInputText inputText, String value)
        {               
                boolean boxClicked = false;
                if(inputText.getValue() == null)
                {
                        inputText.setValue(value);
                }
                else
                {
                        String textVal = inputText.getValue().toString();
                        if(chkBox1.getValue() != null)
                        {       
                                boxClicked = 
((Boolean)chkBox1.getValue()).booleanValue();
                        }       
                        if(textVal.endsWith(")") && !boxClicked)
                        {                       
                                inputText.setValue(new 
StringBuffer(textVal.substring(0, 
textVal.length()-1)).append(value).append(")").toString());
                        }
                        else
                        {       
                                inputText.setValue(textVal+value);
                        }
                }       
        }
        
        /*public void outOfBracketEvent(ValueChangeEvent valueChangeEvent) 
        {
                boolean newValue = 
((Boolean)valueChangeEvent.getNewValue()).booleanValue();
                if(newValue)
                {
                        
                }
        }*/
        public String clear() 
        {
                listBox03.setDisabled(false);
                dataSet = null;
                equalityOperator = null;
                listBox04.setDisabled(true);            
                inputText03.setDisabled(true);
                propertyValue = null;           
                btn01.setDisabled(true);
                btn02.setDisabled(true);
                btn03.setDisabled(true);
                chkBox1.setDisabled(true);
                chkBox1.setValue(new Boolean(false));           
                inputText04.setDisabled(true);
                rule = null;
                return "clear";
        }
        public String getDataSet() {
                return dataSet;
        }
        public void setDataSet(String dataSet) {
                this.dataSet = dataSet;
        }
        public String getDataSetName() {
                return dataSetName;
        }
        public void setDataSetName(String dataSetName) {
                this.dataSetName = dataSetName;
        }
        public String getEqualityOperator() {
                return equalityOperator;
        }
        public void setEqualityOperator(String equalityOperator) {
                this.equalityOperator = equalityOperator;
        }
}


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115669#4115669

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115669
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to