0

HOW TO: Sclass and/or <style></style> in pure JAVA ?

asked 2010-07-15 14:06:41 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-07-15 14:22:23 +0800

Hi all,

for some Dialogs that are written in pure JAVA i need style declaration like the zul-code above.
Some styles work directly on the window other like '.GridLayoutNoBorder' i'm declaring in zul with the attribut sclass=".GridLayoutNoBorder".

1. HOW can i do this in pure java ?
2. What is a propper way if i need such style declarations often more.
3. Does someone works in that way to load at application startup such an additional css ?


	<window 	border="none" width="100%">

		<style dynamic="true">
			body { padding: 0 0; /* 0 padding on top and bottom and 0
			padding on right and left */ }

			<!--  remove white strips between the toolbars	-->
			.hboxRemoveWhiteStrips td.z-hbox-sep {width: 0; padding:0;}

			<!-- cut the vertical borders in the rows of the GRID -->
			tr.z-row td.z-row-inner { border-right: 0px #CCC; }

			<!-- Make Plain Grid + smaller comps Padding -->
			<!-- !!!"overflow:hidden;" not working in Chrome/Safari   -->
			.GridLayoutNoBorder tr.z-row td.z-row-inner, tr.z-row,
			div.z-grid-body .z-cell,div.z-grid { border: none; zoom: 1;
			background: white; border-top: none; border-left: none;
			border-right: none; border-bottom: none; padding: 1px;}

			<!-- Title in bold letters -->
			.z-groupbox-hl .z-groupbox-header { color: #000000;
			font-weight: bold; }

			<!-- Disabled datebox should have black font -->
			.z-datebox { font: #000000;}

		</style>

                  .  .  .
                //  comps are here

thanks
Stephan

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2010-07-15 19:37:27 +0800

samchuang gravatar image samchuang
4084 4

Hi

if you wanna add CSS file when application startup, you could define it at lang-addon.xml, then it will load for every page

lang-addon.xml

<stylesheet href="~./xxx/css/xxx.css.dsp" type="text/css"/>

link publish delete flag offensive edit

answered 2010-07-16 01:57:14 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-07-16 01:58:15 +0800

Hi samchuang,

thanks, please complete your statement with a sample for the corresponding lang-addon.xml entry.

thx
Stephan

link publish delete flag offensive edit

answered 2010-07-16 02:13:36 +0800

samchuang gravatar image samchuang
4084 4

Hi, Stephan

in lang-addon, we can define CSS file, java script to load for each page

<language-addon>
	<addon-name>addon</addon-name>
	<depends>zul</depends>
	<language-name>xul/html</language-name>
	<!-- Note: JavaScript/CSS that are listed here will be loaded no matter
		what language is used. --!>


	<javascript src="~./js/zul.wpd" charset="UTF-8"/>
	<stylesheet href="~./zul/css/zk.wcs" type="text/css"/>
</language-addon>

link publish delete flag offensive edit

answered 2010-07-16 03:38:46 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-07-16 03:39:53 +0800

OK, thanks,
i have played with the path, now it works ok.

<language-addon>

    .  .  .

	<stylesheet href="/zul/css/myCSS.css" type="text/css" />

</language-addon>


where the path is:
maven-project:
.../webapp/zul/css/myCSS.css

ant-project:
.../WebContent/zul/css/myCSS.css

best
Stephan

link publish delete flag offensive edit

answered 2010-12-10 05:47:00 +0800

sandeepa gravatar image sandeepa
93 2

updated 2010-12-10 05:48:17 +0800

styles defined in wcs file can't be applied.
All .ZUL files are placed in WebContent(root) folder

lang-addon.xml(placed in WebContent folder)

<?xml version="1.0" encoding="UTF-8"?>

<language-addon> 
	<addon-name>addon</addon-name> 
	<depends>zul,zkex,zkmax</depends> 
	<language-name>xul/html</language-name> 
	<stylesheet href="~./prod.wcs" type="text/css"/> 
	
</language-addon> 


prod.wcs(placed in WebContent folder)

.headtoolbar
{
background: green;
}
.alignright
{
position:absolute;
left:665px
}
.whitebutton
{
border:1px solid #666666;
background-color:#ffffff;
background-repeat:repeat-x;
background-position:top left;
font-family:arial;
font-weight:bold;
text-decoration:none;
font-size:13px;
color:#000;
padding-top:2px;
padding-bottom:2px;
padding-left:2px;
padding-right:2px;
}
.blackadd
{
border:1px solid #666666;
background-color:#000000;
background-repeat:repeat-x;
background-position:top left;
font-family:arial;
font-weight:bold;
text-decoration:none;
font-size:13px;
color:#f;
padding-top:2px;
padding-bottom:2px;
padding-left:2px;
padding-right:2px;
}

link publish delete flag offensive edit

answered 2010-12-10 19:40:10 +0800

samchuang gravatar image samchuang
4084 4

Hi

the style href is wrong, you should not use ~./

link publish delete flag offensive edit

answered 2010-12-12 22:53:08 +0800

sandeepa gravatar image sandeepa
93 2

Hi Samchuang thanks for responding,
My Understanding-
The styles in .wcs file will be applied to all .zul files in WebContent(root) folder.

Tested all combination of ~./ ,tested also with .css extension, restarted server for each XML change. But the styles are not applied.
or Do i need to declare any in .zul file.

index.zul (see above for other files)


<toolbar mold="panel" align="end">
					   <hbox >
					   <div class="whitebutton">
					    <button label="Save" width="60px" />
					     <button label="Continue"  />
					  </div>
					  </hbox>
				</toolbar>
</window>
</zk>

link publish delete flag offensive edit

answered 2010-12-13 04:07:51 +0800

sandeepa gravatar image sandeepa
93 2

Problem Solved
........................
Specify the language addon in WEB-INF/zk.xml:


<language-config>
<addon-uri>/WEB-INF/lang-addon.xml</addon-uri>
</language-config>

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-07-15 14:06:41 +0800

Seen: 348 times

Last updated: Dec 13 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More