how to call navigator to hsplit.setSecondComponent()

Hi all,
my testcase as link below:
https://vaadin.com/wiki/-/wiki/Main/Creating%20a%20simple%20login%20view

and I added in mainview extends CustomComponent as:
Panel hpanel component
Tree tree componet
HorizontalSplitPanel hsplit component

Now I would like you to help me how to call dealerview extends CustomComponent in hsplit.setSecondComponent(new dealer());
using navigator as link above.

below my mainview code and dealer code reference:

public class main extends CustomComponent implements ItemClickListener, View {
public static HorizontalSplitPanel hsplit =null;
Tree t = null;
public static final String NAME = “”;
Label lblUserId = new Label();
private void master(){
t.addItem(NbisUI.c.getProperty(“mnuItemWorkWithDealer”));
t.setParent(NbisUI.c.getProperty(“mnuItemWorkWithDealer”),NbisUI.c.getProperty(“mnuMaster”));
}
@SuppressWarnings(“deprecation”)
public main() {
Panel hpanel = new Panel();
hpanel.setHeight(“600px”);
hpanel.setWidth(“1280px”);
hsplit = new HorizontalSplitPanel();
hsplit.setFirstComponent(new Label(“”));
hsplit.setSecondComponent(new Label(“”));
hsplit.setSplitPosition(20, Sizeable.UNITS_PERCENTAGE);
hsplit.setLocked(false);
hpanel.setContent(hsplit);
t = new Tree(“Menu”);
t.addItem(NbisUI.c.getProperty(“mnuMaster”));
master();
t.addListener(this);
t.setImmediate(true);
hsplit.setFirstComponent(t);
Button cmdLogout = new Button(NbisUI.c.getProperty(“cmdLogout”), new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
getSession().setAttribute(“user”, null);
getUI().getNavigator().navigateTo(NAME);
}
});
setCompositionRoot(new CssLayout(lblUserId,hpanel,cmdLogout));
}
@Override
public void enter(ViewChangeEvent event) {
String sUserId=String.valueOf(getSession().getAttribute(“user”));
lblUserId.setValue(NbisUI.c.getProperty(“lblLogging”)+": " + sUserId + " - " +validate.GetCurrentDateTime());
if(event.getParameters().equals(“main”)){
hsplit.setSecondComponent(new dealer());
}
}
@Override
public void itemClick(ItemClickEvent event) {
Object itemId = event.getItemId();
if(itemId.equals(NbisUI.c.getProperty(“mnuItemWorkWithDealer”))){
getSession().setAttribute(“user”,String.valueOf(getSession().getAttribute(“user”)));
getUI().getNavigator().navigateTo(dealer.NAME);
}
if (t.isRoot(itemId)){
t.expandItemsRecursively(itemId);
}else {
Object parentItemId = t.getParent(itemId);
t.collapseItemsRecursively(parentItemId);
}
}

}

=================================================================
public class dealer extends CustomComponent implements View, Button.ClickListener {
public static final String NAME = “”;
AbsoluteLayout ab;
public static TextField txtMa;
public static TextField txtTen;
public static TextField txtDiachi;
public static TextField txtDiachi02;
public static TextField txtMasothue;
public static TextField txtMucnochophep;
public static TextField txtThanhtoan;
public static Button cmdNew;
public static Button cmdSave;
public static Button cmdSearch;
Label lblUserId = new Label();
String sUserid;
private dealerBE getBE(){
dealerBE be = new dealerBE();
be.setMa(txtMa.getValue().trim().toUpperCase());
be.setTen(txtTen.getValue().trim().toUpperCase());
be.setDiachi(txtDiachi.getValue().trim());
be.setDiachi02(txtDiachi02.getValue().trim());
be.setMasothue(txtMasothue.getValue().trim());
be.setMucnochophep(txtMucnochophep.getValue().trim());
be.setThanhtoan(txtThanhtoan.getValue().trim());
be.setNgaytao(validate.getCurrentDate());
be.setNguoitao(sUserid);
return be;
}
private void setValue(dealerBE be){
txtMa.setValue(be.getMa());
txtTen.setValue(be.getTen());
txtDiachi.setValue(be.getDiachi());
txtDiachi02.setValue(be.getDiachi02());
txtMasothue.setValue(be.getMasothue());
txtMucnochophep.setValue(be.getMucnochophep());
txtThanhtoan.setValue(be.getThanhtoan());
}
@Override
public void enter(ViewChangeEvent event) {
sUserid=String.valueOf(getSession().getAttribute(“user”));
lblUserId.setValue(sUserid);
txtMa.focus();
}
public dealer() {
setSizeFull();
setCompositionRoot(buildPanel());
}
public Panel buildPanel() {
Panel p = new Panel(" " + NbisUI.c.getProperty(“lblDealer”));
ab = new AbsoluteLayout();
ab.setHeight(“600px”);
p.setContent(ab);
Label lblMa = new Label(NbisUI.c.getProperty(“lblDealerCode”));
ab.addComponent(lblMa, “top:10.0px;left:50.0px;”);
txtMa = new TextField();
txtMa.setMaxLength(6);
txtMa.setRequired(true);
txtMa.setWidth(NbisUI.c.getProperty(“txtWidthShort”));
ab.addComponent(txtMa,“top:10.0px;left:150.0px;”);
Label lblTen = new Label(NbisUI.c.getProperty(“lblDealerName”));
ab.addComponent(lblTen, “top:45.0px;left:50.0px;”);
txtTen = new TextField();
txtTen.setRequired(true);
txtTen.setWidth(NbisUI.c.getProperty(“txtWidthLong”));
ab.addComponent(txtTen,“top:45.0px;left:150.0px;”);

        Label lblDiachi = new Label(NbisUI.c.getProperty("lblAdd01"));
        ab.addComponent(lblDiachi, "top:85.0px;left:50.0px;");    
        txtDiachi = new TextField();
        txtDiachi.setRequired(true);
        txtDiachi.setWidth(NbisUI.c.getProperty("txtWidthLong"));
        ab.addComponent(txtDiachi,"top:85.0px;left:150.0px;");    
        
        Label lblDiachi02 = new Label(NbisUI.c.getProperty("lblAdd02"));
        ab.addComponent(lblDiachi02, "top:120.0px;left:50.0px;");    
        txtDiachi02 = new TextField();    
        txtDiachi02.setWidth(NbisUI.c.getProperty("txtWidthLong"));
        ab.addComponent(txtDiachi02,"top:120.0px;left:150.0px;");    
        
        Label lblMasothue = new Label(NbisUI.c.getProperty("lblTaxCode"));
        ab.addComponent(lblMasothue, "top:155.0px;left:50.0px;");    
        txtMasothue= new TextField();    
        ab.addComponent(txtMasothue,"top:155.0px;left:150.0px;");
        
        Label lblMucnochophep = new Label(NbisUI.c.getProperty("lblDebt"));
        ab.addComponent(lblMucnochophep, "top:190.0px;left:50.0px;");    
        txtMucnochophep = new TextField();    
        ab.addComponent(txtMucnochophep,"top:190.0px;left:150.0px;");
        
        Label lblThanhtoan = new Label(NbisUI.c.getProperty("lblPayment"));
        ab.addComponent(lblThanhtoan, "top:225.0px;left:50.0px;");    
        txtThanhtoan = new TextField();    
        ab.addComponent(txtThanhtoan,"top:225.0px;left:150.0px;");            
        
        cmdNew = new Button(NbisUI.c.getProperty("cmdNew"),this) ;
        cmdNew.setWidth(NbisUI.c.getProperty("cmdWidth"));
        ab.addComponent(cmdNew ,"top:260.0px;left:50.0px;");                
        cmdSave = new Button(NbisUI.c.getProperty("cmdSave"),this) ;
        cmdSave.setWidth(NbisUI.c.getProperty("cmdWidth"));
        ab.addComponent(cmdSave ,"top:260.0px;left:135.0px;");            
        cmdSearch = new Button(NbisUI.c.getProperty("cmdSearch"),this);
        cmdSearch.setWidth(NbisUI.c.getProperty("cmdWidth"));
        ab.addComponent(cmdSearch ,"top:260.0px;left:220.0px;");
        
        ab.addComponent(initTable(" order by ma") ,"top:300.0px;left:5.0px;");
        return p;
}    
 @SuppressWarnings({ "unchecked", "deprecation" })
private Table initTable(String sWhere){        
    final Table tbl = new Table();
    tbl.setContainerDataSource(null);
    tbl.setSelectable(true);
    tbl.setColumnCollapsingAllowed(true);
    tbl.setImmediate(true);
       tbl.addContainerProperty(NbisUI.c.getProperty("lblDealerCode"), String.class, null);
    tbl.addContainerProperty(NbisUI.c.getProperty("lblDealerName"), String.class, null);
    tbl.addContainerProperty(NbisUI.c.getProperty("lblAdd01"), String.class, null);
    tbl.addContainerProperty(NbisUI.c.getProperty("lblAdd02"), String.class, null);
     tbl.addContainerProperty(NbisUI.c.getProperty("lblTaxCode"), String.class, null);
     tbl.addContainerProperty(NbisUI.c.getProperty("lblDebt"), String.class, null);
     tbl.addContainerProperty(NbisUI.c.getProperty("lblPayment"), String.class, null);
     try {
         tbl.setColumnCollapsed(NbisUI.c.getProperty("lblDealerCode"), true);
     } catch (IllegalStateException e) {
         System.err.println("Something horrible occurred");
     }
     tbl.setWidth("650px");
     
     
       Object newItemId = tbl.addItem();
    Item row1 = tbl.getItem(newItemId);
    List<?> sLst = dealerDA.idoListWhere(sWhere);        
    if(sLst!=null){    
        row1.getItemProperty(NbisUI.c.getProperty("lblDealerCode")).setValue(((dealerBE)sLst.get(0)).getMa());
        row1.getItemProperty(NbisUI.c.getProperty("lblDealerName")).setValue(((dealerBE)sLst.get(0)).getTen());
        row1.getItemProperty(NbisUI.c.getProperty("lblAdd01")).setValue(((dealerBE)sLst.get(0)).getDiachi());
        row1.getItemProperty(NbisUI.c.getProperty("lblAdd02")).setValue(((dealerBE)sLst.get(0)).getDiachi02());
        row1.getItemProperty(NbisUI.c.getProperty("lblTaxCode")).setValue(((dealerBE)sLst.get(0)).getMasothue());
        row1.getItemProperty(NbisUI.c.getProperty("lblDebt")).setValue(((dealerBE)sLst.get(0)).getMucnochophep());
        row1.getItemProperty(NbisUI.c.getProperty("lblPayment")).setValue(((dealerBE)sLst.get(0)).getThanhtoan());
        for(int i =0; i<sLst.size();i++){
            dealerBE be =( dealerBE)sLst.get(i);
            tbl.addItem(new Object[]{be.getMa(),be.getTen(),be.getDiachi(),be.getDiachi02(),be.getMasothue(),be.getMucnochophep(),be.getThanhtoan()},i+1);            }
    }else{
        tbl.setContainerDataSource(null);
        Notification.show(NbisUI.c.getProperty("msgDataNotFound"));
    }
    tbl.setPageLength(10);
    tbl.addListener(new Property.ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null){
                String sKey = validate.getKey(tbl.getItem(tbl.getValue()).toString(),0);
                List<?> sLst = dealerDA.idoListWhere(" where ma='" +sKey.trim()+ "'");
                if(sLst!=null){
                    for(int i =0; i<sLst.size();i++){
                        dealerBE be = (dealerBE)sLst.get(i);
                        txtMa.setEnabled(false);
                        setValue(be);
                    }
                }
            }else {}
        }
    });
    return  tbl;

}
@Override
public void buttonClick(ClickEvent event) {
if (event.getButton()==cmdNew){
dealerBE be = new dealerBE();
setValue(be);
txtMa.setEnabled(true);
txtMa.focus();
}else if(event.getButton()==cmdSave){
if(!validate.isEmpty(txtMa)){
txtMa.setComponentError(new UserError(NbisUI.c.getProperty(“msgCanNotEmpty”)));
txtMa.focus();
}else if(!validate.isEmpty(txtTen)){
txtTen.setComponentError(new UserError(NbisUI.c.getProperty(“msgCanNotEmpty”)));
txtTen.focus();
}else{
List<?> sLst = dealerDA.idoListWhere(" where " + dealerDA.D_COL_ma + “='” + txtMa.getValue().trim() +“'”);
if(sLst!=null){
dealerDA.idoUpdate(getBE(), txtMa.getValue().trim());
Notification.show(NbisUI.c.getProperty(“msgUpdated”));
}else{
dealerDA.idoInsert(getBE());
Notification.show(NbisUI.c.getProperty(“msgSaved”));
}
ab.addComponent(initTable(" order by ma") ,“top:300.0px;left:5.0px;”);
}
}else if(event.getButton()==cmdSearch){
if(txtMa.getValue().trim().length()==0 & txtTen.getValue().trim().length()==0){
ab.addComponent(initTable(" order by ma") ,“top:300.0px;left:5.0px;”);
}else if(txtMa.getValue().trim().length()> 0 && txtTen.getValue().trim().length()==0){
ab.addComponent(initTable(" where ma like ‘%" +txtMa.getValue().trim()+ "%’“) ,“top:300.0px;left:5.0px;”);
}else if(txtMa.getValue().trim().length()== 0 && txtTen.getValue().trim().length()>0){
ab.addComponent(initTable(” where ten like ‘%" + txtTen.getValue().trim() + "%’“) ,“top:300.0px;left:5.0px;”);
}else if(txtMa.getValue().trim().length()> 0 && txtTen.getValue().trim().length()>0){
ab.addComponent(initTable(” where ma = ‘" + txtMa.getValue().trim() + "’ and ten =‘" + txtTen.getValue().trim() + "’"), “top:300.0px;left:5.0px;”);
}
}
}
}

Thank you and best regards
Tuan Le Van

In short; you can’t do that directly. Add a CssLayout as a second component, and point your navigator to that instead.

Oh, sure you can; you just need to write your own ViewDisplay that invokes hsplit.setSecondComponent(theGivenView) :slight_smile:

Dear Sirs,
I would like to thank you for your quick reply, but my problems are:
02 users can not click the same item on listview (dealer.class).

for example:
for the first time user A clicked item on listview (working on FireFox browsers)
and for the next time user B clicked item on listview (working on IE browsers)
after that user A can not click item on listliew (working on FireFox browsers)

==> I dont know reason why user A can not do that if I dont press F5 to refesh browser.
So that, I would like you to help me how to fix this case.

Thank you for your times.
Tuan Le Van

Dear Sirs,
as my content above , I attached file for more information

I would like you to help me how to fix this case
Thanks and best regards
Tuan Le Van
13284.docx (381 KB)