vitalidze / traccar-web

Traccar Web UI mod
http://traccar.litvak.su/
151 stars 145 forks source link

Button Style #839

Open ghost opened 8 years ago

ghost commented 8 years ago

I want to change style of some buttons. buttonstyle I try to do something like this in xml. tryxml And i try to do something like this in java. tryjava But it's not work. Can anybody help me?

vitalidze commented 8 years ago

This is because <button> element is actually a container, and style is applied for it (in my case):

screen shot 2016-09-08 at 09 32 15

As you can see in the corners there is a purple background. If you want to change the style of the button you need to redefine it's appearance. Currently in the project it's done in Theme.gwt.xml file for some components. Then you can refer to the default appearances/styles from neptune theme Css3ButtonCellAppearance class. This is the blessed way to change style of the UI.

VdovinN commented 8 years ago

Vitalidze, thanks for your answer! I need to change style for some button which are in NavView class. Do you have any ideas about it?

vitalidze commented 8 years ago

You need to define a non-standard appearance for the button. Then you can set up a button to use that appearance. You can read about appearances here: https://docs.sencha.com/gxt-guides/3/concepts/appearance/Appearance_3.html

VdovinN commented 8 years ago

For example, I created CustomCss3ButtonAppearance which implement ButtonCellAppearance. So i change color, margins, padding how i need. But i can't understand how to add this "CustomCss3ButtonAppearance" to reports button . So if i change style in Theme.gwt.xml it changes style of all button :(

VdovinN commented 8 years ago

Also i tried to do something like this : http://stackoverflow.com/questions/10472098/styling-a-gwt-button-with-css (Second answer : Option 2: Selectively turning off theming for buttons)

vitalidze commented 8 years ago

For example, I created CustomCss3ButtonAppearance which implement ButtonCellAppearance. So i change color, margins, padding how i need. But i can't understand how to add this "CustomCss3ButtonAppearance" to reports button

You can manually create buttons with constructors. There is a signature with TextButtonCell, and then you can specify your appearance in TextButtonCell constructor. As an option you can define your own button class, which will have this appearance set by default. Then you should be able to use it in XML files.

Also i tried to do something like this : http://stackoverflow.com/questions/10472098/styling-a-gwt-button-with-css (Second answer : Option 2: Selectively turning off theming for buttons)

Project does not use GWT buttons. It mostly uses GXT components.