private void addSubordinate ( ) { // Set up subordinate (to make mandatory/optional) WComponentGroup < SubordinateTarget > inputs = new WComponentGroup <> ( ) ; add ( inputs ) ; inputs . addToGroup ( checkBoxSelect ) ; inputs . addToGroup ( multiDropdown ) ; inputs . addToGroup ( multiSelect ) ; inputs . addToGroup ( multiSelectPair ) ; inputs . addToGroup ( dropdown ) ; inputs . addToGroup ( radioButtonSelect ) ; inputs . addToGroup ( singleSelect ) ; inputs . addToGroup ( checkBox ) ; inputs . addToGroup ( dateField ) ; inputs . addToGroup ( emailField ) ; inputs . addToGroup ( fileWidget ) ; inputs . addToGroup ( multiFileWidget ) ; inputs . addToGroup ( multiTextField ) ; inputs . addToGroup ( numberField ) ; inputs . addToGroup ( partialDateField ) ; inputs . addToGroup ( phoneNumberField ) ; inputs . addToGroup ( radioButton ) ; inputs . addToGroup ( shuffler ) ; inputs . addToGroup ( textField ) ; inputs . addToGroup ( textArea ) ; inputs . addToGroup ( radioButton1 ) ; inputs . addToGroup ( radioButton2 ) ; inputs . addToGroup ( radioButton3 ) ; WSubordinateControl control = new WSubordinateControl ( ) ; add ( control ) ; // Mandatory Rule rule = new Rule ( ) ; rule . setCondition ( new Equal ( mandatory , "true" ) ) ; rule . addActionOnTrue ( new Mandatory ( inputs ) ) ; rule . addActionOnFalse ( new Optional ( inputs ) ) ; control . addRule ( rule ) ; // Disabled rule = new Rule ( ) ; rule . setCondition ( new Equal ( disabled , "true" ) ) ; rule . addActionOnTrue ( new Disable ( inputs ) ) ; rule . addActionOnFalse ( new Enable ( inputs ) ) ; control . addRule ( rule ) ; }
Setup the subordinate control .