Created
September 30, 2014 19:21
-
-
Save edubriguenti/27bdec23ccc7948d9761 to your computer and use it in GitHub Desktop.
Adicionar CSS em comopoenent no managedBean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void adicionarCss(final String id, final String css) { | |
final UIComponent component = getComponenteById(id); | |
if(component!=null){ | |
if(component instanceof HtmlInputText){ | |
final HtmlInputText input = ((HtmlInputText)component); | |
if(input.getStyleClass()==null){ | |
input.setStyleClass(css); | |
}else{ | |
input.setStyleClass(input.getStyleClass()+" "+css); | |
} | |
}else if(component instanceof HtmlSelectOneMenu){ | |
final HtmlSelectOneMenu select = ((HtmlSelectOneMenu)component); | |
if(select.getStyleClass()==null){ | |
select.setStyleClass(css); | |
}else{ | |
select.setStyleClass(select.getStyleClass()+" "+css); | |
} | |
}else if(component instanceof HtmlOutputText){ | |
final HtmlOutputText outputText = ((HtmlOutputText)component); | |
if(outputText.getStyleClass()==null){ | |
outputText.setStyleClass(css); | |
}else{ | |
outputText.setStyleClass(outputText.getStyleClass()+" "+css); | |
} | |
}else if(component instanceof HtmlPanelGroup){ | |
final HtmlPanelGroup panelGroup = ((HtmlPanelGroup)component); | |
if(panelGroup.getStyleClass()==null){ | |
panelGroup.setStyleClass(css); | |
}else{ | |
panelGroup.setStyleClass(panelGroup.getStyleClass()+" "+css); | |
} | |
}else if(component instanceof HtmlOutputLabel){ | |
final HtmlOutputLabel outputLabel = ((HtmlOutputLabel)component); | |
if(outputLabel.getStyleClass()==null){ | |
outputLabel.setStyleClass(css); | |
}else{ | |
outputLabel.setStyleClass(outputLabel.getStyleClass()+" "+css); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment