Struts2 s:checkbox label not showing up - java

In the most bizarre of circumstances, the label for my checkbox do not show up in my Struts2 JSP. I have a series of checkboxes, all following the same format, but none of the labels appear. Here is a sample declaration:
<s:checkbox name="chronCheck1" label="New Sales"/>
This is among the most basic of tasks, but something is obviously missing. I am running Struts2 version 2.2.1 via Weblogic 10. Not really sure what else is necessary to help troubleshoot.

You are probably using simple theme in your JSP. With simple theme you must create labels for inputs by yourself.
About simple theme from documentation:
For example, the textfield tag renders the HTML tag without a label, validation, error reporting, or any other formatting or functionality.
See http://struts.apache.org/2.x/docs/themes-and-templates.html.

It is not very clear from the official documentation for the s:checkbox, but in my experiment, if you don't specify the theme, the default theme does not support label. When I change the theme to either xhtml or css_xhtml it successfully showed the label. However these themes also add additional markup and css classes, so you probably need extra css styling and specifying labelposition (top, left, right or bottom) to achieve your desired look and feel. Another option is to create your own theme and apply it. Please refer to this documentation:
https://struts.apache.org/docs/struts-2-themes.html

Related

How to change JavaFX slider thumb color without CSS

I'm using ScalaFX, which is currently proving itself to be thoroughly useless and bugging out anytime I try to use css. Is there any way to change the fill color of a Slider without using css, or at least without separate css files?
I've managed to change the track color with slider.setStyle("-fx-control-inner-background: #f08080;"), but can't get the thumb working.
You could use the -fx-base property, which sets the component colors palette according to the value you specify.
Example:
slider.setStyle("-fx-base: #f08080;");
Result:
However why don't you consider using a CSS file? It simplifies everything and allows you to make a lot more customizations. Take a look at the Slider JavaFX CSS reference, I think you will find what you're looking for.

What is the default styling for html in components like JLabel

Swing has a nice feature where some components allow text to be specified using html. For example, the JLabel component can use html formatting simply using:
JLabel jl = new JLabel("<html><body><h1>Hello World</h1></body></html>");
I find this feature to be really convenient and I am using it in several places in my app.
I would like to know what the default styling is when I use this feature. I know that I can easily override these by adding my own style attributes, but I would like to know what the starting set is, because it is different than most browser defaults.
Where can I find out the default styling (font, line spacing, etc)? I have not seen anything in the documentation. I tried to browse through the source code, but I was unable to see where the tag gets parsed and the styling gets applied.
Can someone give me a pointer as to where to look for this information, possibly in the OpenJDK source?
The default style sheet is default.css, which can be found in resources.jar under the directory javax/swing/text/html/default.css.
You can also obtain the styles programmatically:
StyleSheet sheet = new HTMLEditorKit().getStyleSheet();
I believe the first answer is correct but incomplete.
Check out SwingUtilities2.displayPropertiesToCSS().
It adds a rule to the document stylesheet based on the component's font and foreground color. It is used by BasicHTML.BasicDocument.

how to write plugin that change the color scheme for control panel theme?

after setting a theme as main theme for Control Panel (control panel->configuration->portal settings->display settings->look and feel), there is no option to select any of my color schemes that come with the theme,
how can i write plugin to make it possible to choose a color scheme?
Thanks guys i was able to solve this by adding JavaScript Code (JQuery), in the main.js file of the theme that execute on page load and detect the Control panel and change the class of <body> to the Color defined in the main.js.
One of the approach to solve this scenario would be using Theme Setting API of Liferay.
You can provide color options in liferay-look-and-feel.xml of corresponding theme and read this value in vm templates and apply color to appropriate HTML element via portal_normal.vm
Here are few links for your reference :
https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/designing-a-look-and-feel-liferay-portal-6-2-dev-guide-09-en
https://www.liferay.com/web/raymond.auge/blog/-/blogs/theme-settings-and-new-advanced-controls
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/settin-4
Hope this helps.

GWT - fancy Google-style buttons?

I'm curious, is there a way to style buttons in my GWT application to make them look the same way they do in GMail?
Are these "buttons" at all? What's the easiest way to get the same?
They're just divs with fancy styles! Check them out with Firebug!
The current version are divs styles with CSS3 properties like gradient and border-radius. Prior to this version GMail had a button also created by divs but not using CSS3 styles. The button was much more complex (several nested divs). That latter button is available for GWT in the library cobogw:
See demo and cobogw on google code.
There is a new Theme called clean. Check it out:

The default look of Icefaces and how to customize it

I have a question about styling Icefaces. I have a minimal application that can use Icefaces components, but when I use them and view the page, the components are not styled (for example the buttons have the default look and tabs have no look at all, no images, nothing). I was wondering why that is and what I should do so I would get the default Icefaces look to work.
Next thing I don't get is how do I customize the look by changing some default css style classes that get applied to the components automatically, so every component I use gets the changed style.
Thank you for your answers!
I suggest that you take one of the existing style-sheets, which are included within the ICEfaces package (check the resources folder of the downloaded ICEfaces-1.8.1-bin.zip):
rime
royale
xp
You can preview them in the ICEfaces showcase
Include it within your *.xhtml file via the <ice:outputStyle> tag:
(portlet)
<ice:outputStyle href="/xmlhttp/css/rime/rime-portlet.css"/>
(servlet)
<ice:outputStyle href="./css/demo_template.css"/>
Starting from here, feel free to either manipulate the chosen stylesheets or - which I favor - include your own stylesheets after ICEfaces' ones and overwrite the needed styles.
Regarding your second question:
Basically every ICEfaces component has its own style class. Just browse around the showcase and inspect the components with Firebug. I've not found many classes, which have been reused between different components. Therefore, you'll have to customize each and every component on your own - or apply your own common style class to every component you use via the styleClass property.
<ice:panelGrid styleClass="myCommonStyleClass">
<ice:inputField styleClass="myCommonStyleClass">
There are three predefined ICEfaces style sheets included:
(1) xp.css
(2) royale.css
(3) rime.css
Developers may also create their own custom style sheet based on a predefined ICEfaces style sheet. If the style class names match those defined in the ICEfaces style sheets, the ICEfaces components will use the specified styles by default, without the need to specify the style class names explicitly on each component.
(1) Where to find CSS class names ?
IMPORTANT : The default CSS class names associated with each component are listed in the component's TLD (taglib) description.
(2) How To use a predefined style :
<link rel="stylesheet" type="text/css" href="./xmlhttp/css/xp/xp.css" />
OR
<ice:outputStyle href="./xmlhttp/css/xp/xp.css" rel="stylesheet" type="text/css" />
(3) Is there any Advantages of using ICEFaces OutputStyle ?
The ice:outputStyle component has the following advantages over the HTML link tag:
- Automatically includes browser-specific variants of the main style sheet in the page to adapt the theme styling to account for differences in each browsers' CSS support. See the TLD (taglib) documentation for the ice:outputStyle component for details.
- Provides the ability to dynamically change the theme style sheet at runtime via a value binding on the component's `href` attribute.
(4) What is meant by xmlhttp ?
The xmlhttp->css->xp path is automatically resolved by ICEfaces and all needed resources are loaded from the ICEfaces.jar
Hope this helps..!! :)

Categories