You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by ayouB __ <ay...@hotmail.fr> on 2012/05/03 15:51:32 UTC
Is it possible to modify the (x,y) position of a graphical
component ?
hi every body,
I want to know please if there's a possibility to modify the (x,y) position of a JavaServer Faces graphical component (e.g : Button, inputText, Calendar ...) during the execution of the web application.
PS : I'm using JSF 2.0 (Apache MyFaces) and JBoss Richfaces 4.
Thanks in advance :)
Re: Is it possible to modify the (x,y) position of a graphical
component ?
Posted by Max Goltzsche <ma...@googlemail.com>.
Hey ayouB,
as I understand you this is a matter of HTML/CSS/Javascript. Each HTML
element has several attributes which you can also specify on a JSF
component. Using CSS is always the best way: Set the styleClass attribute
of your JSF component and modify its positions with CSS. If your component
does not have a styleClass attribute (like a ui:repeat) you can simply wrap
it into a HTML-DIV element and declare the used style class there.
E.g.:
<h:inputText styleClass="mystyle" .../>
Results in HTML;
<input class="mystyle" .../>
Which could be styled within a CSS file included in that HTML/JSF page like
this:
.mystyle {
position: absolute; /* makes left,top usable; depends on parent
absolute element; also see position: relative */
left: 0px; /* x */
top: 0px; /* y */
}
Of course, you can also modify your HTML elements with JavaScript at
browser runtime:
<input id="myinput" .../>
JavaScript to set style class:
document.getElementById("myinput").class = "mystyle";
If your x,y position is varying and dependent of some server-side
calculation you could also define it directly in the style attribute of the
HTML element but in general this is bad style:
<input style="position:absolute;left:0px;top:0px" .../>
Hope this helps.
regards,
Max
2012/5/3 ayouB __ <ay...@hotmail.fr>
>
> hi every body,
>
> I want to know please if there's a possibility to modify the (x,y)
> position of a JavaServer Faces graphical component (e.g : Button,
> inputText, Calendar ...) during the execution of the web application.
>
> PS : I'm using JSF 2.0 (Apache MyFaces) and JBoss Richfaces 4.
>
> Thanks in advance :)
Re: Is it possible to modify the (x,y) position of a graphical
component ?
Posted by Max Goltzsche <ma...@googlemail.com>.
Hey ayouB,
as I understand you this is a matter of HTML/CSS/Javascript. Each HTML
element has several attributes which you can also specify on a JSF
component. Using CSS is always the best way: Set the styleClass attribute
of your JSF component and modify its positions with CSS. If your component
does not have a styleClass attribute (like a ui:repeat) you can simply wrap
it into a HTML-DIV element and declare the used style class there.
E.g. (the HTML-tag chars are replaced by the | char in the text below to
let Spam Assassin not filter this mail):
|h:inputText styleClass="mystyle" .../|
Results in HTML;
|input class="mystyle" .../|
Which could be styled within a CSS file included in that HTML/JSF page like
this:
mystyle {
position: absolute; /* makes left,top usable; depends on parent
absolute element; also see position: relative */
left: 0px; /* x */
top: 0px; /* y */
}
Of course, you can also modify your HTML elements with JavaScript at
browser runtime:
|input id="myinput" .../|
JavaScript to set style class:
document.getElementById("myinput").class = "mystyle";
If your x,y position is varying and dependent of some server-side
calculation you could also define it directly in the style attribute of the
HTML element but in general this is bad style:
|input style="position:absolute;left:0px;top:0px" .../|
Hope this helps.
regards,
Max
2012/5/3 ayouB __ <ay...@hotmail.fr>
>
> hi every body,
>
> I want to know please if there's a possibility to modify the (x,y)
> position of a JavaServer Faces graphical component (e.g : Button,
> inputText, Calendar ...) during the execution of the web application.
>
> PS : I'm using JSF 2.0 (Apache MyFaces) and JBoss Richfaces 4.
>
> Thanks in advance :)
Re: Is it possible to modify the (x,y) position of a graphical component
?
Posted by Werner Punz <we...@gmail.com>.
Am 03.05.12 15:51, schrieb ayouB __:
> hi every body,
>
> I want to know please if there's a possibility to modify the (x,y) position of a JavaServer Faces graphical component (e.g : Button, inputText, Calendar ...) during the execution of the web application.
>
> PS : I'm using JSF 2.0 (Apache MyFaces) and JBoss Richfaces 4.
>
> Thanks in advance:)
Hi Ayoub you have to use html + css + javascript for that.