in my project i’ve faced a problem getting values of css attributes in wicket class, suppose we have some Panel
public final class ExamplePanel extends Panel {
public ExamplePanel(String id) {
super(id);
add(new Label("someText", "hello"));
}}
and html file for this file is
<html xmlns:wicket>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>ExamplePanel</title>
<wicket:head>
<link href="panel.css" rel="stylesheet"/>
<script src="jquery.min.js"></script>
<script src="jquery-ui.min.js"></script>
</wicket:head>
</head>
<body>
<wicket:panel>
<div id="container" wicket:id="hello">
</div>
</wicket:panel>
</body>
and the following css
#parentContainer{
width:500px;
height: 500px;
background:RGB(57,51,51);
position:relative;
}
i need to get values of css code, for example
public final class ExamplePanel extends Panel {
public ExamplePanel(String id) {
super(id);
Label label = new Label("someText", "hello");
add(label);
// draft code
//String height = label.getCssValue("height");
// String position = label.getcssvalue("position");
}}
Or any oher solution to get css values from this div?
As CSS is applied on the client side, your only chance would be to get the values by JavaScript (with the JQuery methods mentioned by Torr3nt being the easiest way that I know of) and post these values back to your App using Ajax.
There is a description on how to call wicket from JavaScript here.