1

i often used rich-faces for makes a user interface, recently i passed at vaadin. Now i'm looking for a vertical menù in vaadin, is there this kind of compontent?

Rich-faces has the followed:

http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=panelMenu&skin=blueSky

4

2 回答 2

1

如果您使用的是 vaadin 6.2+,则可以使用此插件:

https://vaadin.com/directory#addon/melodion

但我想你正在使用 vaadin 7,所以你可以通过以下方式获得相同的结果

于 2013-06-14T07:36:25.447 回答
1

不幸的是,vaadin 只提供了一个菜单栏。

如果您有 html 和 css 方面的经验,您可以创建自己的垂直菜单,然后使用 vaadin CustomLayout 将其嵌入到面板中。

例如,您可以尝试这样的事情。

您应该创建一个 html 文件:

<table width="100%" height="100%">
  <tr height="100%">
    <td>
      <table align="center">
        <tr>
          <td align="left">Menu 1</td>
          <td><div location="menu1"></div></td>
        </tr>
        <tr>
          <td align="right">Menu2</td>
          <td><div location="menu2"></div></td>
        </tr>
      </table>
    </td>
  </tr>
</table>

然后你应该以这种方式将它嵌入到 vaadin 中:

// Have a Panel where to put the custom layout.
Panel panel = new Panel("Menu");
panel.setSizeUndefined();
main.addComponent(panel);

// Create custom layout from "yourfile.html" template.
CustomLayout custom = new CustomLayout("layoutname");

//the style name refers the one you should define in css
custom.addStyleName("customlayoutexample");

// Use it as the layout of the Panel.
panel.setContent(custom);

// Create a few components and bind them to the location tags
// in the custom layout.
TextField menu1 = new TextField();
custom.addComponent(menu1, "menu1");


TextField menu2 = new TextField();
custom.addComponent(menu2, "menu2");

注意将位置名称与组件名称绑定。

如果您想向 xml 添加一些 javascript(用于打开/关闭菜单元素),您应该直接在 tag 属性中编写它。

于 2013-06-14T12:23:21.677 回答