[英]My Custom Vaadin 6 Theme Not Working
我使用的是Vaadin 6.8.13,并且我只是为了设计单个按钮而创建了自己的主题。 我正在使用Eclipse Luna和Vaadin插件,还将vaadin应用程序部署为Liferay上的portlet。 但是我的主题不起作用...
我已经完成了本书的所有工作,实际上,我使用了Eclipse中的vaadin主题向导来为我做所有事情。 例如创建
的WebContent / VAADIN /主题/ mytheme的/ Styles.css中
并添加this.setTheme("mytheme");
在应用程序类中。 但无济于事,我的styles.css文件看起来像这样:
@import url(../liferay/styles.css);
.v-button-wrap {
background: #b20000 !important; /* Old browsers */
background: -moz-linear-gradient(top, #b20000 0%, #e50000 50%, #b20000 100%) !important; /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b20000), color-stop(50%,#e50000), color-stop(100%,#b20000)) !important; /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #b20000 0%,#e50000 50%,#b20000 100%) !important; /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #b20000 0%,#e50000 50%,#b20000 100%) !important; /* Opera 11.10+ */
background: -ms-linear-gradient(top, #b20000 0%,#e50000 50%,#b20000 100%) !important; /* IE10+ */
background: linear-gradient(to bottom, #b20000 0%,#e50000 50%,#b20000 100%) !important; /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b20000', endColorstr='#b20000',GradientType=0 ) !important; /* IE6-9 */
color: #ffffff;
text-shadow: none;
}
.v-button-wrap:hover {
border: 1px solid #990000 !important;
}
我的Application类如下所示:
import com.vaadin.Application;
import com.vaadin.ui.*;
/**
* Main application class.
*/
@SuppressWarnings("serial")
public class CheckroutesportletApplication extends Application {
@Override
public void init() {
// Initializes the container and sets the main_screen
Window container = new Window("Check Routes");
container.addComponent(new MainScreen());
setMainWindow(container);
this.setTheme("mytheme");
}
}
有人知道为什么会发生这种情况吗? 人们可能犯的常见错误?
我认为您的问题是,在vaadin进行任何布局之前,需要将setTheme作为init的第一项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.