Okay,you now can simply import my code (a
ll of my app logic related was removed, it’s pure for UI layout to show my question
) below to your IDE environment/project, and add relevant servlet mapping item in web.xml, then you will see how my UI/layout looks as well as what my code is, then please help to check
how I can modify the code to let table view show all rows
by the Browser scrollbar
instead of table right-side scrollbar, and make sure the label in bottom area be displayed as well
// my code below, no any application logic, just pure UI layout to demonstrate my question and seek the help
package com.mytest;
import com.vaadin.Application;
import com.vaadin.ui.*;
import com.vaadin.ui.Button.ClickEvent;
@SuppressWarnings(“serial”)
public class MainAppTest extends Application
{
private Window mainWindow ;
private VerticalLayout topLayout = null;
private VerticalLayout centerLayout = null;
@Override
public void init()
{
mainWindow = new Window("My Main Window");
setMainWindow(mainWindow);
setTheme("runo");
VerticalLayout mainLayout = new VerticalLayout();
mainWindow.setContent(mainLayout);
mainLayout.setMargin(true);
mainLayout.setSizeFull();
// topLayout to be placed with a simple label
topLayout = new VerticalLayout ();
Panel productName_panel = new Panel();
String showLogo = "";
Label productNameLabel = new Label("<div align=bottom>" + showLogo + "<b>" + "My Product Name" + "</b> </div>",Label.CONTENT_XHTML);
productNameLabel.setSizeFull();
productName_panel.addComponent(productNameLabel);
topLayout.addComponent(productName_panel);
HorizontalLayout menuBarLayout = new HorizontalLayout();
MenuBar _menuBar = generateMenuBar();
menuBarLayout.addComponent(_menuBar);
_menuBar.setWidth("900px");
TextField tfSearchText = new TextField();
tfSearchText.setInputPrompt("Search data...");
Button buttonSearch = new Button("");
buttonSearch.setStyleName("link");
buttonSearch.addListener(new MyClickListener(tfSearchText));
menuBarLayout.addComponent(tfSearchText); // show search button in the menubar layout too
menuBarLayout.addComponent(buttonSearch);
mainWindow.addComponent(topLayout);
topLayout.addComponent(menuBarLayout); // add MenuBar into the topLayout also
centerLayout = new VerticalLayout(); // Center Layout to display main content (e.g. a table or a form) of this main window
centerLayout.addComponent(new MyTable());
mainWindow.addComponent(centerLayout);
// the bottom side will only display a text message (or plus a small icon) only
Panel botPanel = new Panel();
Label copyrightLabel = new Label("<div>" + "Company Name" + "Copyright Info"
+ " ",Label.CONTENT_XHTML);
copyrightLabel.setSizeFull();
botPanel.addComponent(copyrightLabel);
mainWindow.addComponent(botPanel);
} // end of init
final class MyClickListener implements Button.ClickListener
{
private TextField tfText = null;
MyClickListener(TextField searchText)
{
tfText = searchText;
}
public void buttonClick(ClickEvent event)
{
mainWindow.showNotification("Searching:" + tfText.getValue());
}
}
// test menubar
private MenuBar generateMenuBar()
{
MenuBar menubar = new MenuBar();
for(int i=0;i<6;i++)
{
MenuBar.MenuItem menuItem = menubar.addItem("Menu#" + i,null);
for(int k=0;k<5;k++)
menuItem.addItem("Sub-menu#"+k, null);
}
return menubar;
}
class MyTable extends Table
{
MyTable()
{
setTableColumns();
int dataRows = 60;
for (int i=0; i<dataRows; i++)
{
Object row[] = new Object[4]
;
Integer itemId = new Integer(i);
row[0]
= “Hello String”;
row[1]
= new Label(“Hello a Label”);
row[2]
= new Label(“Hello another Label”);
row[3]
= new Label(“Hello the 3rd Label”);
addItem(row, itemId);
}
//>> Question??: How to show all rows in a page by Browser right-side scrollbar instead of showing a scrollbar around the table right-border
// setPageLength(-1); // even I put this code, it doesn't work for what I expect
// setPageLength(60); // even I put this code line, it doesn't work for what I expect, and I won't see the right-bottom Copyright label any more
setFooterVisible(false);
}
private void setTableColumns()
{
addContainerProperty("String 1", String.class, null);
addContainerProperty("Label 1", Label.class,null);
addContainerProperty("Label 2",Label.class,null);
addContainerProperty("Label 3", Label.class,null);
setWidth("80%");
}
}
}