Hi,
I have a class component to simulate steeper.
component (TextField and button spin with tabIndex -1):
package br.com.componentes;
import com.vaadin.server.FileResource;
import com.vaadin.server.ThemeResource;
import com.vaadin.server.VaadinService;
import com.vaadin.ui.*;
import com.vaadin.ui.themes.Reindeer;
import java.io.File;
public class Stepper extends CustomComponent {
private AbsoluteLayout mainLayout;
private TextField edit;
private Button btn;
public Stepper(String caption) {
init();
edit.setCaption(caption);
}
private void init(){
mainLayout = new AbsoluteLayout();
super.setCompositionRoot(mainLayout);
super.setHeight("40");
edit = buildEdit();
mainLayout.addComponent(edit,"top:13;left:0");
btn = buildButton();
mainLayout.addComponent(btn, "top:10;left:63");
reposicionar();
}
private TextField buildEdit(){
edit = new TextField();
edit.setWidth("60");
edit.setImmediate(true);
edit.setNullRepresentation("");
return edit;
}
private Button buildButton(){
btn = new Button();
btn.setTabIndex(-1);
btn.setStyleName(Reindeer.BUTTON_LINK);
btn.setIcon(new FileResource(new File(
VaadinService.getCurrent().getBaseDirectory().getAbsolutePath()
+"\\VAADIN\\themes\\printonline\\images\\spin_26x16.png")));
btn.setWidth("20");
btn.setHeight("26");
return btn;
}
public void reposicionar() {
mainLayout.getPosition(btn).setLeftValue(edit.getWidth()+3);
super.setWidth(String.valueOf(edit.getWidth()+btn.getWidth()+3));
mainLayout.setWidth(String.valueOf(super.getWidth()));
}
}
main:
import br.com.componentes.Stepper;
import com.vaadin.annotations.Theme;
import com.vaadin.server.;
import com.vaadin.ui.;
public class Main extends UI {
@Override
protected void init(VaadinRequest request) {
VerticalLayout vl = new VerticalLayout();
vl.addComponent(new Stepper("Stepper")); //===> WORKS, the button don´t receive a focus
setContent(vl);
Window w = new Window();
w.center();
VerticalLayout content = new VerticalLayout();
content.addComponent(new Stepper("Stepper")); //===> IN WINDOW DON´T WORKS, the button receive a focus
w.setContent(content);
addWindow(w);
}
}
when I insert the component in application the button don´t receive a focus.
When I insert the component in a window the button receives focus, even though the property tabindex -1.
This is a bug?
Thanks.