I have been trying to center my tabs in a vaadin tabsheet so that they are in the middle, does anyone have any CSS examples of how to do this.
#centeredmenu {
float:left;
width:100%;
background:#fff;
border-bottom:4px solid #000;
overflow:hidden;
position:relative;
}
#centeredmenu ul {
clear:left;
float:left;
list-style:none;
margin:0;
padding:0;
position:relative;
left:50%;
text-align:center;
}
#centeredmenu ul li {
display:block;
float:left;
list-style:none;
margin:0;
padding:0;
position:relative;
right:50%;
}
#centeredmenu ul li a {
display:block;
margin:0 0 0 1px;
padding:3px 10px;
background:#ddd;
color:#000;
text-decoration:none;
line-height:1.3em;
}
#centeredmenu ul li a:hover {
background:#369;
color:#fff;
}
#centeredmenu ul li a.active,
#centeredmenu ul li a.active:hover {
color:#fff;
background:#000;
font-weight:bold;
}
Without looking right now at the tabsheet code and your css, I rembed that I have tried to theme the tabsheet but it has so much defined widths and such that doing something as dramatic as moving them to the middle might not be possible.
What I have usually done when I needed more out of a tabsheet is to replace it with a HorizontalLayout filled with buttons and a Panel below it, and simulate the tabsheet trough that. Then you can do pretty much what ever you like and it isn’t that hard either.
I like that suggestion alot better as i am having so much difficulty styling the tabsheet.
One question about the “horizontal layout” with buttons method, how can i then insert different custom component views dynamically into a single panel and then wire them up on button click events?
—To clarify, lets say i add
Home Administration Security
buttons in a tab layout and want to create three custom component classes, how then can i change a single v-panel to switch between these views on button clicks?
Since i decided to use a CssLayout for my navigation “tabsheet”, i am having difficulty implementing the selected styling of each native button or in my case “tab”.
The problems:
When a button is clicked(), i want to show the user which tab there currently in by displaying a background image behind the button and if the user decides to select another native button in my Csslayout, i want to remove the background image of the previous selected button and display it on the newly selected button? Is this possible?
I have tried something like this: Not working and i fear of performance issues
Button button1, button2
button1.addListener(new ClickEvent()){
button.checkState(); // if there are no other button selected then i want to set the background image for this button ?
}
What are some other ways to implement a tabsheet where all button are essentially in synch?
I’ll do it by adding a style name to a button when it is clicked, and removing the style name from the one that was clicked before it. Have a class variable called Button currentTab = null, then do this is in the click listener