我可以在代码或页面中向 HtmlPanelGrid 添加圆角吗?如果是的话 - 怎么办?
我有一个任务 - 向 HtmlPanelGrid 添加圆角。现在我尝试用 css 来实现(每个角使用 4 个图像 - css 创建我们的设计器)。我加载 css 并尝试在我的代码中执行此操作:
this.grid = new HtmlPanelGrid();
this.grid.setStyleClass("toplist,toplist-top");
但我在页面中看不到任何更改。
我尝试加载 css 并将其与标签一起使用,但它也不起作用并产生了另一个问题 - 我的 jsf 没有重新加载和重新显示:
<div class="toplist">
<div class="toplist-top"><h2>Top 10 List</h2></div>
<div class="toplist-bg">
<div class="toplist-cont">
<rich:tab label="Top-List" id="screenTop">
<h:panelGrid id="topListTable" binding="#{chartBean.topListTable}" />
</rich:tab>
<a4j:support event="onclick" reRender="menuSection" actionListener="#{chartBean.doChangeTab}" />
</div>
</div>
<div class="toplist-bottom"></div>
</div>
我对在代码中向 topListTable 添加圆角感兴趣。我该怎么做呢?
我将我的 css 加载为:
<link href="#{facesContext.externalContext.requestContextPath}/css/stylesheet.css" rel="styleSheet" type="text/css"/>
如果有人知道,我如何向 panelGrid 添加角点。
抱歉问了愚蠢的问题,但我是 jsf 和 richfaces 的新生,我想正确解决这个任务
更新:
任务已更改(((设计师决定,圆角将用图像完成,并给我 css 文件与选择器,他认为,与我的 HtmlPanelGrid 周围的组件一起使用,
但有一个问题 - HtmlPanelGrid 是 myfaces.Div 的子级,所以我有几个 myfaces.Div,每个都有一个 HtmlPanelGrid 作为其子级。 Div 和 HtmlPanelGrid 都是在代码中生成的:
public TopListChartWrapper(Iterator<Entry> treeIt) {
this.grid = new HtmlPanelGrid();
this.grid.setColumns(2);
this.grid.setBorder(0);
this.grid.setCellpadding("0");
this.grid.setCellspacing("0");
this.grid.setWidth("100%");
this.grid.setRowClasses("list-row-even,list-row-odd");
this.grid.setStyleClass("toplist-top");
this.grid.setStyle("margin: 50px");
//this.grid.setFooterClass("toplist-top");
this.treeIterator = treeIt;
this.prepareGrid();
}
private Div getDiv() {
Div div = new Div();
div.setId(DIV + RANDOM.nextInt(10000));
HtmlDropSupport dropSupport = new HtmlDropSupport();
ChartBean chartBean = ChartBean.getInstance();
dropSupport.setAcceptedTypes(UNIT + chartBean.getChartValue());
dropSupport.setDropValue(UNIT + chartBean.getChartValue());
dropSupport.addDropListener(new DropListenerImpl());
dropSupport.setReRender(this.getName());
div.getChildren().add(dropSupport);
div.setStyleClass(this.getDivStyle());
return div;
}
所以我需要为它们设置一个 styleClasses,但问题在于 - 我只能为 Div 设置一个 styleClass,但我需要在页脚和页眉中使用不同的样式设置 Div 的样式也许
有人有同样的任务?并且可以帮助我!如何在 myfaces.Div 中设置差异样式(一个图像 - 头部和脚部)? 或者也许有更好的方法来使用 Div?
I have a task - add round corners to HtmlPanelGrid. Now I am trying to do it with css (using 4 images for each corner - that css create our designer). I load css and try to do this in my code:
this.grid = new HtmlPanelGrid();
this.grid.setStyleClass("toplist,toplist-top");
But no changes I could see in my page.
I tried to load css and use it with tags, but it also didnt work and created one more problem - my jsf didn't reload and redisplay:
<div class="toplist">
<div class="toplist-top"><h2>Top 10 List</h2></div>
<div class="toplist-bg">
<div class="toplist-cont">
<rich:tab label="Top-List" id="screenTop">
<h:panelGrid id="topListTable" binding="#{chartBean.topListTable}" />
</rich:tab>
<a4j:support event="onclick" reRender="menuSection" actionListener="#{chartBean.doChangeTab}" />
</div>
</div>
<div class="toplist-bottom"></div>
</div>
I am interesting of adding round corners to topListTable in the code. How can I do it?
I load my css as:
<link href="#{facesContext.externalContext.requestContextPath}/css/stylesheet.css" rel="styleSheet" type="text/css"/>
If anybody knows, how can I add corners to the panelGrid.
Sorry for stupid question, but I am newborn in jsf and richfaces, and I want to solve this task right
Update:
The task has been changed((( The designer decided, that the rounded corners will be done with images and give me css files with selectors, which, he suppose, work with component, which surronds my HtmlPanelGrid.
But there is a problem - HtmlPanelGrid is a children of myfaces.Div. So I have a several myfaces.Divs, each of that have a HtmlPanelGrid as its child. Both Div and HtmlPanelGrid are generated in the code:
public TopListChartWrapper(Iterator<Entry> treeIt) {
this.grid = new HtmlPanelGrid();
this.grid.setColumns(2);
this.grid.setBorder(0);
this.grid.setCellpadding("0");
this.grid.setCellspacing("0");
this.grid.setWidth("100%");
this.grid.setRowClasses("list-row-even,list-row-odd");
this.grid.setStyleClass("toplist-top");
this.grid.setStyle("margin: 50px");
//this.grid.setFooterClass("toplist-top");
this.treeIterator = treeIt;
this.prepareGrid();
}
private Div getDiv() {
Div div = new Div();
div.setId(DIV + RANDOM.nextInt(10000));
HtmlDropSupport dropSupport = new HtmlDropSupport();
ChartBean chartBean = ChartBean.getInstance();
dropSupport.setAcceptedTypes(UNIT + chartBean.getChartValue());
dropSupport.setDropValue(UNIT + chartBean.getChartValue());
dropSupport.addDropListener(new DropListenerImpl());
dropSupport.setReRender(this.getName());
div.getChildren().add(dropSupport);
div.setStyleClass(this.getDivStyle());
return div;
}
So I need to set them a styleClasses, but the problem in that - I can set up only one styleClass for Div, but I need to style Div in footer and in header with different styles.
Maybe somebody has the same task? and could help me! How I can set diff styles in myfaces.Div (one image - in head and another image in foot)?
Or maybe there is a better way to work with Div?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为 jQuery 是一个很好的方法。 (请参阅链接教程)
与 richfaces 一起使用时会出现一些复杂情况,因此请检查
及其文档。I think jQuery is a good way to go. (see linked tutorial)
There are some complications when using with richfaces, so check
<rich:jQuery>
and its documentation.为此考虑使用弯曲的角。谷歌一下就可以知道它的全部内容。
另一件需要考虑的事情是浏览器不兼容。例如,以下将圆角应用于 rich:modalPanel 组件的 css 在 Safari 中完美运行,但在 IE 中则不然。
您可以考虑在圆角中使用图像来避免这种不兼容。
请参阅
http://www.webdevelopersnotes.com/tips/html/complex_advanced_rounded_corners_html_tables.php3
供进一步参考。
Consider using curvycorners for this. Google it to find out what it is all about.
Another thing to consider are browser incompatibilities. For example, the following css which applies round corners to rich:modalPanel components works perfectly in Safari, but no in IE
You might consider using images for your corners to avoid this kind of incompatibility.
See
http://www.webdevelopersnotes.com/tips/html/complex_advanced_rounded_corners_html_tables.php3
for further reference.
感谢大家的帮助!我找出了我的问题 - 我在代码中添加了几个 HtmlPanelGroups,并将我的表添加到其中之一!一切都如我所愿!
再次感谢大家!
此致!
PS:如何设置这个问题的答案?
Thank all for help! I figure out my problem - I add a several HtmlPanelGroups to my code, and add my table to one of these! Everything works as I want!
Thanks once more to everybody!
Best regards!
P.S.: How can I set this question is answered?