Package ivasoft.mainwindow.teklif

Source Code of ivasoft.mainwindow.teklif.CompaniesUi

package ivasoft.mainwindow.teklif;


import javax.swing.ButtonModel;

import ivasoft.IvasoftApp;
import ivasoft.MainWindowUi;

import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.terminal.Sizeable;
import com.vaadin.ui.Button;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;

@SuppressWarnings("serial")
public class CompaniesUi extends VerticalLayout implements Button.ClickListener{


  boolean isBranch=false;
  Button companySelectButton;
  Button branchSelectButton;
  Table companiesTable;
  Table branchTable;
 
  public  CompaniesUi(){
//    final AnaEkranMetotlari anaEkranMetotlari = new AnaEkranMetotlari();

    VerticalLayout branchesLayout = new VerticalLayout();
    HorizontalLayout searchLayout = new HorizontalLayout();
    companiesTable = new Table();
    branchTable = new Table();
    companySelectButton = new Button("Firma Seçiniz",this);
    branchSelectButton = new Button("Şubeler Seçiniz",this);

 
    searchLayout.setSpacing(true);
    setSpacing(true);
   
    companiesTable.setWidth("100%");
    companiesTable.setHeight("200px");
    companiesTable.setSelectable(true);
    companiesTable.setImmediate(true);
    companiesTable.setNullSelectionAllowed(false);
   
    branchTable.setWidth("100%");
    branchTable.setHeight("200px");
    branchTable.setImmediate(true);
    branchTable.setNullSelectionAllowed(false);
    branchTable.setSelectable(true);
   
    branchesLayout.addComponent(companiesTable);

    // BURASI ÇOK ÇOK ÖNEMLİ SİLMEDE NAPARSAN YAP
    branchTable.addListener(new Property.ValueChangeListener() {
      public void valueChange(ValueChangeEvent event) {
    //  subelerAnaPOJO = teklifAna.getSubeFromTable(subelerTable);

      }
    });

    companiesTable.addListener(new Property.ValueChangeListener() {
            public void valueChange(ValueChangeEvent event) {

        Object id = companiesTable.getValue();
        Item item = companiesTable.getItem(id);
  //      firmalarAnaPojo = teklifAna.getFirmaFromTable(item);
        if (item != null) {
  //        if (teklifAna.subeSayisi(item.getItemProperty("id_firmalar_ana").getValue())) {
            addComponent(branchTable);
            removeComponent(companySelectButton);
            addComponent(branchSelectButton);
  //          teklifAna.subeListele(item.getItemProperty("id_firmalar_ana").getValue(), subelerTable);
            // firmalarAnaPojo =
            // teklifAna.getFirmaFromTable(subelerTable,
            // subelerTable.getValue());

            /*
             * anaLayout.removeAllComponents();
             * anaLayout.addComponent(firmalarTable);
             * anaLayout.addComponent(subelerTable);
             * anaLayout.addComponent(subeSecButton);
             * teklifAna.subeListele(firmalarTable.getValue(),
             * subelerTable);
             */
          } else {
            removeComponent(branchTable);
            removeComponent(branchSelectButton);
            addComponent(companySelectButton);

            /*
             * anaLayout.removeAllComponents();
             * anaLayout.addComponent(firmalarTable);
             * anaLayout.addComponent(firmaSecButton);
             */}
        }
     
    });

//    final TeklifEkleEkrani teklifEkleEkrani = new TeklifEkleEkrani();
    companySelectButton.addListener(new ClickListener() {
      public void buttonClick(ClickEvent event) {
        isBranch = false;
        Object id = companiesTable.getValue();
        Item item = companiesTable.getItem(id);

        if (item == null) {
//          deneme.mainWindow.showNotification("Lütfen Firma Seçiniz");
        } else {

//          anaEkranMetotlari.replacePanel(mainLayout, teklifEkleEkrani.firmaTeklifHazirlama());
//          teklifAna.getKontakKisiler(teklifAna.getMerkezSubeId(item.getItemProperty("id_firmalar_ana").getValue()),
//              teklifEkleEkrani.getOnlardanIlgili());

        }
      }
    });

    addComponent(branchesLayout);
    addComponent(companySelectButton);

  }

  public void buttonClick(ClickEvent event) {
    MainWindowUi mainWindowUi = new MainWindowUi();
   
    if (event.getSource().equals(companySelectButton)) {
      isBranch = true;
      if (companiesTable.getValue() == null) {
        IvasoftApp.showNotification("Lütfen Şube Seçiniz");
        IvasoftApp.replaceNewWindow(new NewTeklifUi());
      } else {
        IvasoftApp.replaceNewWindow(new NewTeklifUi());
//        teklifAna.getKontakKisiler(branchTable, teklifEkleEkrani.getOnlardanIlgili());
      }
    }
   
   
   
   
  }



}
TOP

Related Classes of ivasoft.mainwindow.teklif.CompaniesUi

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.