Example usage for com.vaadin.server ThemeResource ThemeResource

List of usage examples for com.vaadin.server ThemeResource ThemeResource

Introduction

In this page you can find the example usage for com.vaadin.server ThemeResource ThemeResource.

Prototype

public ThemeResource(String resourceId) 

Source Link

Document

Creates a resource.

Usage

From source file:com.foc.vaadin.gui.FVIconFactory.java

License:Apache License

public Resource getFVIcon(String iconName) {
    Resource resource = null;// w w w  .java2  s. co  m
    if (iconName.startsWith("../")) {
        resource = new ThemeResource(iconName);
    } else {
        resource = new ThemeResource("../" + THEME_DIR + "/icons/" + iconName);
    }

    return resource;
}

From source file:com.foc.vaadin.gui.FVIconFactory.java

License:Apache License

public Resource getFVIcon_Internal(String iconName, int size) {
    Resource resource = null;//from   w  ww .j  a  v  a 2s  .c  o m
    if (iconName.startsWith("../")) {
        resource = new ThemeResource(iconName);
    } else {
        if (size == SIZE_NONE) {
            resource = new ThemeResource("../" + THEME_DIR + "/icons/" + iconName);
        } else if (size == SIZE_SMALL) {
            resource = new ThemeResource("../" + THEME_DIR + "/icons/16x16/" + iconName);
        } else if (size == SIZE_24) {
            resource = new ThemeResource("../" + THEME_DIR + "/icons/24x24/" + iconName);
        } else if (size == SIZE_BIG) {
            resource = new ThemeResource("../" + THEME_DIR + "/icons/32x32/" + iconName);
        } else if (size == SIZE_48) {
            resource = new ThemeResource("../" + THEME_DIR + "/icons/48x48/" + iconName);
        }
    }

    return resource;
}

From source file:com.freebox.engeneering.application.web.layout.LeftSideBarController.java

License:Apache License

private void createFooterSideBar() {
    VerticalLayout verticalLayout = super.getView();

    sideBarFooter.setSizeUndefined();//  w  ww  . j  a  v a  2  s  .co  m
    sideBarFooter.addStyleName("user");
    Image profilePic = new Image(null, new ThemeResource("img/profile-pic.png"));
    profilePic.setWidth("34px");
    sideBarFooter.addComponent(profilePic);
    Label userName = new Label("MOHELLEBI ATAF");
    userName.setSizeUndefined();
    sideBarFooter.addComponent(userName);

    Command cmd = new Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    };
    MenuBar settings = new MenuBar();
    MenuItem settingsMenu = settings.addItem("", null);
    settingsMenu.setStyleName("icon-cog");
    settingsMenu.addItem("Settings", cmd);
    settingsMenu.addItem("Preferences", cmd);
    settingsMenu.addSeparator();
    settingsMenu.addItem("My Account", cmd);
    sideBarFooter.addComponent(settings);

    Button exit = new NativeButton("Exit");
    exit.addStyleName("icon-cancel");
    exit.setDescription("Sign Out");
    sideBarFooter.addComponent(exit);
    exit.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
        }
    });

    verticalLayout.addComponent(sideBarFooter);
}

From source file:com.gnts.pem.txn.sbi.SBIBuilding.java

@SuppressWarnings("deprecation")
void populateAndConfig(boolean search) {
    try {/*  w ww  . j  a  v  a2  s  .  co  m*/
        tblEvalDetails.removeAllItems();
        tblEvalDetails.setImmediate(true);
        List<TPemCmEvalDetails> evalList = null;
        evalList = new ArrayList<TPemCmEvalDetails>();
        if (search) {
            String evalno = tfSearchEvalNumber.getValue();
            String customer = tfSearchCustomer.getValue();
            String bankbranch = (String) slSearchBankbranch.getValue();
            evalList = beanEvaluation.getSearchEvalDetailnList(null, evalno, null, customer, bankbranch,
                    selectedBankid, selectCompanyid, null);
            total = evalList.size();

            if (total == 0) {
                lblNotificationIcon.setIcon(new ThemeResource("img/msg_info.png"));
                lblSaveNotification.setValue("No Records found");
            } else {
                lblNotificationIcon.setIcon(null);
                lblSaveNotification.setValue("");
            }
        } else {

            evalList = beanEvaluation.getSearchEvalDetailnList(selectedFormName, null, null, null, null,
                    selectedBankid, selectCompanyid, null);
            total = evalList.size();
        }
        lblNoofRecords.setValue(
                "<font size=\"2\" color=\"black\">No.of Records:</font> <font size=\"2\" color=\"#1E90FF\"> "
                        + total + "</font>");

        beans = new BeanItemContainer<TPemCmEvalDetails>(TPemCmEvalDetails.class);
        beans.addAll(evalList);
        btnEdit.setEnabled(false);
        tblEvalDetails.setContainerDataSource(beans);
        tblEvalDetails.setSelectable(true);
        tblEvalDetails.setColumnFooter("lastUpdateDt", "No. of Records:" + total);
        tblEvalDetails.setVisibleColumns(new Object[] { "evalNo", "docDate", "bankBranch", "custName",
                "docStatus", "lastUpdtedBy", "lastUpdateDt" });
        tblEvalDetails.setColumnHeaders(new String[] { "Evaluation Number", "Evaluation Date", "Bank Branch",
                "Customer Name", "Status", "Last Updated By", "Last Updated Date" });
        tblEvalDetails.addValueChangeListener(new Property.ValueChangeListener() {
            /**
            * 
            */
            private static final long serialVersionUID = 3729824796823933688L;

            @Override
            public void valueChange(ValueChangeEvent event) {
                StreamResource sr = getPDFStream();

                if (sr != null) {

                    if (filedownloader == null) {
                        filedownloader = new FileDownloader(getPDFStream());
                        filedownloader.extend(btnView);
                    } else {
                        filedownloader.setFileDownloadResource(sr);
                    }
                } else {
                    lblNotificationIcon.setIcon(new ThemeResource("img/msg_info.png"));
                    lblSaveNotification.setValue("No document is there");
                    //   notif.show(Page.getCurrent());
                    if (filedownloader != null) {
                        filedownloader.setFileDownloadResource(null); // reset
                    }

                }

                TPemCmEvalDetails syncList = (TPemCmEvalDetails) event.getProperty().getValue();
                if (syncList != null) {

                    if (syncList.getDocStatus().equals("Draft") || syncList.getDocStatus().equals("Rejected")) {
                        btnEdit.setEnabled(true);
                        btnView.setEnabled(false);
                    } else {
                        btnEdit.setEnabled(false);
                        btnView.setEnabled(true);

                    }
                    btnAdd.setEnabled(false);
                } else {
                    btnEdit.setEnabled(false);
                    btnAdd.setEnabled(true);
                }
            }

        });
        tblEvalDetails.setImmediate(true);
        tblEvalDetails.addItemClickListener(new ItemClickListener() {

            @Override
            public void itemClick(ItemClickEvent event) {
                // TODO Auto-generated method stub
                if (tblEvalDetails.isSelected(event.getItemId())) {

                    btnView.setEnabled(false);
                } else {

                    btnView.setEnabled(true);
                }
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
        logger.info("Error-->" + e);
    }
    getExportTableDetails();
}

From source file:com.gnts.pem.txn.sbi.SBIBuilding.java

private void updateEvaluationDetails() {
    try {/*from   www . j  av a  2s  .  c o m*/
        boolean valid = false;
        TPemCmEvalDetails evalobj = new TPemCmEvalDetails();
        evalNumber = tfEvaluationNumber.getValue();
        customer = tfCustomerName.getValue();
        propertyType = "BUILDING";
        String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();

        File file = new File(
                basepath + "/WEB-INF/PEM-DOCS/" + evalNumber + "_" + customer + "_" + propertyType + ".doc");
        FileInputStream fin = new FileInputStream(file);
        byte fileContent[] = new byte[(int) file.length()];
        fin.read(fileContent);
        fin.close();
        evalobj.setDocId(headerid);
        evalobj.setEvalDoc(fileContent);
        evalobj.setDocStatus(Common.DOC_PENDING);
        evalobj.setDocDate(dfDateofValuation.getValue());
        evalobj.setEvalNo(tfEvaluationNumber.getValue());
        evalobj.setEvalDate(dfDateofValuation.getValue());
        evalobj.setValuationBy(tfValuatedBy.getValue());
        MPemCmBank bankid = new MPemCmBank();
        bankid.setBankId(selectedBankid);
        evalobj.setBankId(bankid);
        evalobj.setDoctype(screenName);
        evalobj.setCompanyId(selectCompanyid);
        evalobj.setBankBranch((String) slBankBranch.getValue());
        evalobj.setEvalPurpose(tfEvaluationPurpose.getValue());
        evalobj.setEvalDate(dfDateofValuation.getValue());
        evalobj.setCheckedBy(tfVerifiedBy.getValue());
        evalobj.setCheckedDt(dfVerifiedDate.getValue());
        evalobj.setInspectionDt(dfDateofValuation.getValue());
        evalobj.setInspectionBy(tfValuatedBy.getValue());
        evalobj.setLastUpdateDt(new Date());
        evalobj.setLastUpdtedBy(loginusername);
        evalobj.setCustName(tfCustomerName.getValue());

        if (tfDynamicEvaluation1.getValue() != null && tfDynamicEvaluation1.getValue().trim().length() > 0) {
            evalobj.setCustomLbl1(tfDynamicEvaluation1.getCaption());
            evalobj.setCustomValue1(tfDynamicEvaluation1.getValue());
        }
        if (tfDynamicEvaluation2.getValue() != null && tfDynamicEvaluation2.getValue().trim().length() > 0) {
            evalobj.setCustomValue2(tfDynamicEvaluation2.getCaption());
            evalobj.setCustomValue2(tfDynamicEvaluation2.getValue());
        }
        beanEvaluation.saveorUpdateEvalDetails(evalobj);
        uiflowdata.setEvalDtls(evalobj);

        try {
            BigDecimal totalAbstract = new BigDecimal(0.00);
            BigDecimal test = new BigDecimal("0.00");
            BigDecimal test1 = new BigDecimal("0.00");
            BigDecimal test2 = new BigDecimal("0.00");
            BigDecimal test3 = new BigDecimal("0.00");
            BigDecimal test4 = new BigDecimal("0.00");
            BigDecimal test5 = new BigDecimal("0.00");
            try {
                test = new BigDecimal(
                        uiflowdata.getTotalExtraItem().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));

            } catch (Exception e) {
                test = new BigDecimal("0.00");
            }
            try {
                test1 = new BigDecimal(
                        tfFairMarketRate.getValue().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test1 = new BigDecimal("0.00");
            }
            try {
                test2 = new BigDecimal(
                        uiflowdata.getTotalAdditional().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test2 = new BigDecimal("0.00");
            }
            try {
                test3 = new BigDecimal(
                        uiflowdata.getTotalMiscellaneous().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));

            } catch (Exception e) {
                test3 = new BigDecimal("0.00");
            }
            try {
                test4 = new BigDecimal(
                        uiflowdata.getTotalServices().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test4 = new BigDecimal("0.00");
            }
            try {
                test5 = new BigDecimal(
                        uiflowdata.getTotalValuation().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test5 = new BigDecimal("0.00");
            }
            totalAbstract = totalAbstract.add(test).add(test1).add(test2).add(test3).add(test4).add(test5);

            uiflowdata.setTotalAbstractvalue(XMLUtil.IndianFormat(new BigDecimal(totalAbstract.toString())));
            String numberOnly = totalAbstract.toString().replaceAll("[^\\d.]", "");
            if (numberOnly.trim().length() == 0) {
                numberOnly = "0";
            }
            uiflowdata.setAmountInWords(beanEvaluation.getAmountInWords(numberOnly));
            evalobj.setPropertyValue(Double.valueOf(numberOnly));
            //beanEvaluation.saveorUpdateEvalDetails(evalobj);
            uiflowdata.setEvalDtls(evalobj);
            if (tfEvaluationNumber.isValid() && slBankBranch.isValid() && tfEvaluationPurpose.isValid()
                    && dfDateofValuation.isValid() && tfCustomerName.isValid()
                    && tfAdopetdMarketRate.isValid()) {

                if (count == 0) {
                    beanEvaluation.saveorUpdateEvalDetails(evalobj);

                    valid = true;
                }
                lblNotificationIcon.setIcon(new ThemeResource("img/success_small.png"));
                lblSaveNotification.setValue("Successfully Submitted");
            }

            if (valid) {
                /*populateAndConfig(false);
                resetAllFieldsFields();*/
                btnSubmit.setEnabled(false);
            } else {
                btnSubmit.setComponentError(new UserError("Form is invalid"));
            }

        } catch (Exception e) {

        }

    } catch (Exception e) {
        lblNotificationIcon.setIcon(new ThemeResource("img/failure.png"));
        lblSaveNotification.setValue("Submit failed, please check the data and try again ");
        logger.info("Error on SaveApproveReject Status function--->" + e);
    }
}

From source file:com.gnts.pem.txn.sbi.SBIBuilding.java

void setComponentError() {
    tfEvaluationNumber.setComponentError(null);
    dfDateofValuation.setComponentError(null);
    tfEvaluationPurpose.setComponentError(null);
    slBankBranch.setComponentError(null);
    tfCustomerName.setComponentError(null);
    tfAdopetdMarketRate.setComponentError(null);
    String Error = "Enter";
    if (tfEvaluationNumber.getValue() == null || tfEvaluationNumber.getValue().trim().length() == 0) {
        tfEvaluationNumber.setComponentError(new UserError("Enter Evaluation Number"));
        Error = Error + " " + "Evaluation number";
    }//from   ww w  . ja v  a  2 s. c  o m
    if (dfDateofValuation.getValue() == null) {
        dfDateofValuation.setComponentError(new UserError("Select Evaluation Date"));
        Error = Error + " " + "Evaluation Date";
    }
    if (tfEvaluationPurpose.getValue() == null || tfEvaluationPurpose.getValue().trim().length() == 0) {
        tfEvaluationPurpose.setComponentError(new UserError("Select Evaluation Date"));
        Error = Error + " " + "Evaluation Purpose";
    }
    if (slBankBranch.getValue() == null) {
        slBankBranch.setComponentError(new UserError("Select Bank Branch"));
        Error = Error + " " + "Bank Branch";
    }
    if (tfCustomerName == null || tfCustomerName.getValue().trim().length() == 0) {
        tfCustomerName.setComponentError(new UserError("Enter Customer Name"));
        Error = Error + " " + "Customer Name";
    }
    if (tfAdopetdMarketRate == null || tfAdopetdMarketRate.getValue().trim().length() == 0) {
        tfAdopetdMarketRate.setComponentError(new UserError("Enter Market Rate"));
        Error = Error + " " + "Market Rate";
    }
    lblNotificationIcon.setIcon(new ThemeResource("img/failure.png"));
    lblSaveNotification.setValue(Error);

}

From source file:com.gnts.pem.txn.sbi.SBIBuilding.java

private void saveEvaluationDetails() {
    // TODO Auto-generated method stub
    uiflowdata = new UIFlowData();
    // for save evaluation details
    boolean valid = false;
    try {/*from  w  ww.ja v  a 2 s.co  m*/
        TPemCmEvalDetails evalobj = new TPemCmEvalDetails();

        evalobj.setDocId(headerid);
        evalobj.setEvalNo(tfEvaluationNumber.getValue());
        evalobj.setDocDate(dfDateofValuation.getValue());
        evalobj.setValuationBy(tfValuatedBy.getValue());
        MPemCmBank bankid = new MPemCmBank();
        bankid.setBankId(selectedBankid);
        evalobj.setBankId(bankid);
        evalobj.setDoctype(screenName);
        evalobj.setCompanyId(selectCompanyid);
        evalobj.setBankBranch((String) slBankBranch.getValue());
        evalobj.setEvalPurpose(tfEvaluationPurpose.getValue());
        evalobj.setEvalDate(dfDateofValuation.getValue());
        evalobj.setCheckedBy(tfVerifiedBy.getValue());
        evalobj.setCheckedDt(dfVerifiedDate.getValue());
        evalobj.setInspectionDt(dfDateofValuation.getValue());
        evalobj.setInspectionBy(tfValuatedBy.getValue());
        evalobj.setDocStatus(Common.DOC_DRAFT);
        evalobj.setLastUpdateDt(new Date());
        evalobj.setLastUpdtedBy(loginusername);
        evalobj.setCustName(tfCustomerName.getValue());

        if (tfDynamicEvaluation1.getValue() != null && tfDynamicEvaluation1.getValue().trim().length() > 0) {
            evalobj.setCustomLbl1(tfDynamicEvaluation1.getCaption());
            evalobj.setCustomValue1(tfDynamicEvaluation1.getValue());
        }
        if (tfDynamicEvaluation2.getValue() != null && tfDynamicEvaluation2.getValue().trim().length() > 0) {
            evalobj.setCustomValue2(tfDynamicEvaluation2.getCaption());
            evalobj.setCustomValue2(tfDynamicEvaluation2.getValue());
        }
        beanEvaluation.saveorUpdateEvalDetails(evalobj);
        uiflowdata.setEvalDtls(evalobj);

        try {
            saveOwnerDetails();
        } catch (Exception e) {
        }

        try {
            saveAssetDetails();
        } catch (Exception e) {
        }

        try {
            saveNormalDocuments();
        } catch (Exception e) {
        }

        try {
            saveLegalDocuments();
        } catch (Exception e) {
        }

        try {
            saveAdjoinPropertyDetails();
        } catch (Exception e) {
        }

        try {
            saveDimensionValues();
        } catch (Exception e) {
        }

        try {
            saveDescriptionDetails();
        } catch (Exception e) {
        }

        try {
            saveCharacterDetails();
        } catch (Exception e) {
        }

        try {
            savePlanApprovalDetails();
        } catch (Exception e) {
        }
        try {

            saveBuildSpecDetails();
        } catch (Exception e) {
        }

        try {
            savePlinthAreaDetails();
        } catch (Exception e) {
        }
        try {
            saveFloorDetails();
        } catch (Exception e) {

        }
        try {
            saveElectricalDetails();
        } catch (Exception e) {
        }
        try {
            savePlumbingDetails();
        } catch (Exception e) {
        }
        try {
            saveExtraItemsDetails();
        } catch (Exception e) {
        }
        try {
            saveAdditionalDetails();
        } catch (Exception e) {
        }
        try {
            saveMiscellaneousDetails();
        } catch (Exception e) {
        }
        try {
            saveServiceDetails();
        } catch (Exception e) {
        }
        try {
            saveValuationDetails();
        } catch (Exception e) {
        }
        try {
            saveGuidelineValue();
        } catch (Exception e) {
        }

        try {
            saveGuidelineReferenceDetails();
        } catch (Exception e) {
        }
        try {
            saveRoofHeightDetails();
        } catch (Exception e) {
        }
        try {
            saveConstValuationDetails();
        } catch (Exception e) {

        }
        try {
            uiflowdata.setPropertyAddress(tfPropertyAddress.getValue());
            uiflowdata.setBankBranch((String) slBankBranch.getValue());
            uiflowdata.setCustomername(tfCustomerName.getValue());
            uiflowdata.setEvalnumber(tfEvaluationNumber.getValue());
            if (dfDateofValuation.getValue() != null) {
                SimpleDateFormat dt1 = new SimpleDateFormat("dd-MMM-yyyy");
                uiflowdata.setInspectionDate(dt1.format(dfDateofValuation.getValue()));
            }
            BigDecimal site = new BigDecimal(0.00);
            BigDecimal fair = new BigDecimal(1.00);
            BigDecimal salbale = new BigDecimal(435.60);
            try {
                site = new BigDecimal(tfAreaofLand.getValue().replaceAll("[^\\d.]", ""));
            } catch (Exception e) {
                site = new BigDecimal("0.00");

            }
            try {
                site.divide(salbale, 2, RoundingMode.HALF_UP).toPlainString();
                fair.multiply(site.divide(salbale, 2, RoundingMode.HALF_UP))
                        .multiply(new BigDecimal(tfAdopetdMarketRate.getValue().replaceAll("[^\\d.]", "")));
                tfAreaofLand.setValue(site.toString() + " sft (or) "
                        + site.divide(salbale, 2, RoundingMode.HALF_UP).toPlainString() + " cents");
                tfFairMarketRate.setValue(XMLUtil.IndianFormat(new BigDecimal(fair
                        .multiply(site.divide(salbale, 2, RoundingMode.HALF_UP))
                        .multiply(new BigDecimal(tfAdopetdMarketRate.getValue().replaceAll("[^\\d.]", "")))
                        .toString())));
            } catch (Exception e) {

            }
            try {
                saveValuationofLandDetails();
            } catch (Exception e) {

            }
            uiflowdata.setPropDesc((String) slPropertyDesc.getValue());
            uiflowdata.setMarketValue(XMLUtil.IndianFormat(new BigDecimal(
                    tfFairMarketRate.getValue().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""))));
            uiflowdata.setGuidelinevalue(XMLUtil.IndianFormat(new BigDecimal(tfGuidelineRate.getValue())));
        } catch (Exception e) {
        }
        try {
            BigDecimal totalAbstract = new BigDecimal(0.00);
            BigDecimal test = new BigDecimal("0.00");
            BigDecimal test1 = new BigDecimal("0.00");
            BigDecimal test2 = new BigDecimal("0.00");
            BigDecimal test3 = new BigDecimal("0.00");
            BigDecimal test4 = new BigDecimal("0.00");
            BigDecimal test5 = new BigDecimal("0.00");
            try {
                test = new BigDecimal(
                        uiflowdata.getTotalExtraItem().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));

            } catch (Exception e) {
                test = new BigDecimal("0.00");
            }
            try {
                test1 = new BigDecimal(
                        tfFairMarketRate.getValue().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test1 = new BigDecimal("0.00");
            }
            try {
                test2 = new BigDecimal(
                        uiflowdata.getTotalAdditional().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test2 = new BigDecimal("0.00");
            }
            try {
                test3 = new BigDecimal(
                        uiflowdata.getTotalMiscellaneous().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));

            } catch (Exception e) {
                test3 = new BigDecimal("0.00");
            }
            try {
                test4 = new BigDecimal(
                        uiflowdata.getTotalServices().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test4 = new BigDecimal("0.00");
            }
            try {
                test5 = new BigDecimal(
                        uiflowdata.getTotalValuation().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test5 = new BigDecimal("0.00");
            }
            totalAbstract = totalAbstract.add(test).add(test1).add(test2).add(test3).add(test4).add(test5);

            uiflowdata.setTotalAbstractvalue(XMLUtil.IndianFormat(new BigDecimal(totalAbstract.toString())));
            String numberOnly = totalAbstract.toString().replaceAll("[^\\d.]", "");
            uiflowdata.setAmountInWords(beanEvaluation.getAmountInWords(numberOnly));
            String numberOnly1 = tfGuidelineRate.getValue().replaceAll("[^0-9]", "");
            uiflowdata.setAmountWordsGuideline(beanEvaluation.getAmountInWords(numberOnly1));
            //Bill

            BigDecimal realizable = new BigDecimal(0.00);
            BigDecimal distress = new BigDecimal(0.00);
            BigDecimal real = new BigDecimal("0.00");
            BigDecimal distre = new BigDecimal("0.00");

            try {
                real = new BigDecimal(
                        uiflowdata.getTotalAbstractvalue().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                real = new BigDecimal("0.00");

            }
            try {
                distre = new BigDecimal(
                        uiflowdata.getTotalAbstractvalue().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                distre = new BigDecimal("0.00");

            }
            try {
                realizable = real.multiply(new BigDecimal(95)).divide(new BigDecimal(100));
                realizable = realizable.subtract(realizable.remainder(new BigDecimal(1000)));
                tfRealziableRate.setValue(realizable.toString());
                uiflowdata.setRealizablevalue(XMLUtil.IndianFormat(new BigDecimal(realizable.toString())));

                distress = (distre.multiply(new BigDecimal(85))).divide(new BigDecimal(100));
                distress = distress.subtract(distress.remainder(new BigDecimal(1000)));
                tfDistressRate.setValue(distress.toString());
                uiflowdata.setDistressvalue(XMLUtil.IndianFormat(new BigDecimal(distress.toString())));
            } catch (Exception e) {

            }
        } catch (Exception e) {

        }
        try {
            savePropertyValueDetails();
        } catch (Exception e) {
        }
        evalNumber = tfEvaluationNumber.getValue();
        customer = tfCustomerName.getValue().replace("\\s+", " ").replaceAll("[-+/^:,]", "");
        ;
        propertyType = "BUILDING";
        ByteArrayOutputStream recvstram = XMLUtil.doMarshall(uiflowdata);
        XMLUtil.getWordDocument(recvstram, evalNumber + "_" + customer + "_" + propertyType, strXslFile);
        if (tfEvaluationNumber.isValid() && slBankBranch.isValid() && tfEvaluationPurpose.isValid()
                && dfDateofValuation.isValid() && tfCustomerName.isValid() && tfAdopetdMarketRate.isValid()) {
            if (count == 0) {
                beanEvaluation.saveorUpdateEvalDetails(evalobj);

                valid = true;
            }
            lblNotificationIcon.setIcon(new ThemeResource("img/success_small.png"));
            lblSaveNotification.setValue(ApplicationConstants.saveMsg);
        }

        if (valid) {
            /*populateAndConfig(false);
            resetAllFieldsFields();*/
            btnSave.setVisible(false);
        } else {
            btnSave.setComponentError(new UserError("Form is invalid"));
        }
    } catch (Exception e) {
        e.printStackTrace();
        lblNotificationIcon.setIcon(new ThemeResource("img/failure.png"));
        lblSaveNotification.setValue("Saved failed, please check the data and try again ");
        logger.info("Error on SaveApproveReject Status function--->" + e);

    }

}

From source file:com.gnts.pem.txn.sbi.SBIBuilding.java

private void setComponentStyle() {
    // TODO Auto-generated method stub
    tfEvaluationNumber.setWidth(strComponentWidth);
    slBankBranch.setWidth(strComponentWidth);
    tfEvaluationPurpose.setWidth(strComponentWidth);
    dfDateofValuation.setWidth("150px");
    tfValuatedBy.setWidth(strComponentWidth);
    dfVerifiedDate.setWidth("150px");
    tfVerifiedBy.setWidth(strComponentWidth);
    tfDynamicEvaluation1.setWidth(strComponentWidth);
    tfDynamicEvaluation2.setWidth(strComponentWidth);

    dfDateofValuation.setImmediate(true);

    dfVerifiedDate.setImmediate(true);/*from   ww w .j a v  a2s .  c  o  m*/

    dfDateofValuation.setDateFormat("dd-MMM-yyy");
    dfVerifiedDate.setDateFormat("dd-MMM-yyy");
    dfSearchEvalDate.setDateFormat("dd-MMM-yyy");

    // for dynamic
    btnAddValDtls.setIcon(new ThemeResource(Common.strAddIcon));
    btnAddValDtls.setStyleName(Runo.BUTTON_LINK);
    btnDynamicEvaluation1.setIcon(new ThemeResource(Common.strAddIcon));
    btnDynamicEvaluation1.setStyleName(Runo.BUTTON_LINK);
    btnDynamicForFlat.setIcon(new ThemeResource(Common.strAddIcon));
    btnDynamicForFlat.setStyleName(Runo.BUTTON_LINK);
    btnDynamicConstVal.setStyleName(Runo.BUTTON_LINK);
    btnDynamicConstVal.setIcon(new ThemeResource(Common.strAddIcon));
    btnDynamicExtra.setStyleName(Runo.BUTTON_LINK);
    btnDynamicExtra.setIcon(new ThemeResource(Common.strAddIcon));
    btnAddRoofHt.setIcon(new ThemeResource(Common.strAddIcon));
    btnAddRoofHt.setStyleName(Runo.BUTTON_LINK);
    btnDynamicAdditional.setStyleName(Runo.BUTTON_LINK);
    btnDynamicAdditional.setIcon(new ThemeResource(Common.strAddIcon));

    btnDynamicMiscell.setStyleName(Runo.BUTTON_LINK);
    btnDynamicMiscell.setIcon(new ThemeResource(Common.strAddIcon));

    btnDynamicServices.setStyleName(Runo.BUTTON_LINK);
    btnDynamicServices.setIcon(new ThemeResource(Common.strAddIcon));
    btnDynamicPlanApproval.setIcon(new ThemeResource(Common.strAddIcon));
    btnDynamicPlanApproval.setStyleName(Runo.BUTTON_LINK);
    btnDynamicDescProp.setIcon(new ThemeResource(Common.strAddIcon));
    btnDynamicDescProp.setStyleName(Runo.BUTTON_LINK);
    btnDynamicCharacter.setIcon(new ThemeResource(Common.strAddIcon));
    btnDynamicCharacter.setStyleName(Runo.BUTTON_LINK);
    btnDynamicElectrical.setIcon(new ThemeResource(Common.strAddIcon));
    btnDynamicElectrical.setStyleName(Runo.BUTTON_LINK);

    btnDynamicPlumbing.setIcon(new ThemeResource(Common.strAddIcon));
    btnDynamicPlumbing.setStyleName(Runo.BUTTON_LINK);

    btnAddBuildSpec.setStyleName(Runo.BUTTON_LINK);
    btnAddBuildSpec.setIcon(new ThemeResource(Common.strAddIcon));

    btnAddPlinth.setIcon(new ThemeResource(Common.strAddIcon));
    btnAddPlinth.setStyleName(Runo.BUTTON_LINK);

    btnAddGuideline.setStyleName(Runo.BUTTON_LINK);
    btnAddGuideline.setIcon(new ThemeResource(Common.strAddIcon));

    btnDynamicValuation.setIcon(new ThemeResource(Common.strAddIcon));
    btnDynamicValuation.setStyleName(Runo.BUTTON_LINK);
    // for default values
    tfCoverUnderStatCentral.setValue(Common.strNA);
    tfAnyConversionLand.setValue(Common.strNA);
    tfMonthlyRent.setValue(Common.strNA);
    tfElecServiceConnNo.setValue(Common.strNA);
    tfProTaxReceipt.setValue(Common.strNA);
    tfFlood.setValue(Common.strNil);
    tfGeneralRemarks.setValue(Common.strNil);

    // for owner/asset
    tfCustomerName.setWidth(strComponentWidth);
    slPropertyDesc.setWidth(strComponentWidth);
    tfCustomerAddr.setWidth(strComponentWidth);
    tfCustomerAddr.setHeight("130px");
    slPropertyDesc.setNullSelectionAllowed(false);

    tfLandMark.setWidth(strComponentWidth);
    tfPropertyAddress.setWidth(strComponentWidth);
    tfPropertyAddress.setHeight("130px");
    tfDynamicAsset1.setWidth(strComponentWidth);
    tfDynamicAsset2.setWidth(strComponentWidth);
    btnDynamicAsset.setIcon(new ThemeResource(Common.strAddIcon));
    btnDynamicAsset.setStyleName(Runo.BUTTON_LINK);
    btnAddOwner.setIcon(new ThemeResource(Common.strAddIcon));
    btnAddOwner.setStyleName(Runo.BUTTON_LINK);

    // for document
    btnAddLegalDoc.setIcon(new ThemeResource(Common.strAddIcon));
    btnAddNorDoc.setIcon(new ThemeResource(Common.strAddIcon));
    btnAddNorDoc.setStyleName(Runo.BUTTON_LINK);
    btnAddLegalDoc.setStyleName(Runo.BUTTON_LINK);

    ///for adjoin property and dimension
    btnAddAdjoinProperty.setIcon(new ThemeResource(Common.strAddIcon));
    btnAddAdjoinProperty.setStyleName(Runo.BUTTON_LINK);
    btnAddDimension.setIcon(new ThemeResource(Common.strAddIcon));
    btnAddDimension.setStyleName(Runo.BUTTON_LINK);

    //for description of the property
    tfPostalAddress.setWidth(strComponentWidth);
    tfSiteNumber.setWidth(strComponentWidth);
    tfSFNumber.setWidth(strComponentWidth);
    tfNewSFNumber.setWidth(strComponentWidth);
    tfVillage.setWidth(strComponentWidth);
    tfTaluk.setWidth(strComponentWidth);
    tfDistCorpPanc.setWidth(strComponentWidth);
    tfLocationSketch.setWidth(strComponentWidth);
    tfProTaxReceipt.setWidth(strComponentWidth);
    tfElecServiceConnNo.setWidth(strComponentWidth);
    tfElecConnecName.setWidth(strComponentWidth);
    slHighMiddPoor.setWidth(strComponentWidth);
    slUrbanSemiRural.setWidth(strComponentWidth);
    slResiIndustCommer.setWidth(strComponentWidth);
    slProOccupiedBy.setWidth(strComponentWidth);
    tfMonthlyRent.setWidth(strComponentWidth);
    tfCoverUnderStatCentral.setWidth(strComponentWidth);
    tfAnyConversionLand.setWidth(strComponentWidth);
    tfExtentSite.setWidth(strComponentWidth);
    tfYearAcquistion.setWidth(strComponentWidth);
    tfPurchaseValue.setWidth(strComponentWidth);
    tfPropLandmark.setWidth(strComponentWidth);
    tfDynamicDescProp1.setWidth(strComponentWidth);
    tfDynamicDescProp2.setWidth(strComponentWidth);
    //for Charcteristics of the site
    slLocalClass.setWidth(strComponentWidth);
    slSurroundDevelop.setWidth(strComponentWidth);
    tfFlood.setWidth(strComponentWidth);
    slFeasibility.setWidth(strComponentWidth);
    slLandLevel.setWidth(strComponentWidth);
    slLandShape.setWidth(strComponentWidth);
    slTypeUse.setWidth(strComponentWidth);
    tfUsageRestriction.setWidth(strComponentWidth);
    slIsPlot.setWidth(strComponentWidth);
    tfApprveNo.setWidth(strComponentWidth);
    tfNoReason.setWidth(strComponentWidth);
    tfSubdivide.setWidth(strComponentWidth);
    slDrawApproval.setWidth(strComponentWidth);
    slCornerInter.setWidth(strComponentWidth);
    slRoadFacility.setWidth(strComponentWidth);
    slTypeRoad.setWidth(strComponentWidth);
    slRoadWidth.setWidth(strComponentWidth);
    slLandLock.setWidth(strComponentWidth);
    slWaterPotential.setWidth(strComponentWidth);
    slUnderSewerage.setWidth(strComponentWidth);
    slPowerSupply.setWidth(strComponentWidth);
    tfAdvantageSite.setWidth(strComponentWidth);
    tfDisadvantageSite.setWidth(strComponentWidth);
    tfGeneralRemarks.setWidth(strComponentWidth);
    tfDynamicCharacter1.setWidth(strComponentWidth);
    tfDynamicCharacter2.setWidth(strComponentWidth);
    //for applicant Estimate
    tfNoofClosets.setWidth(strComponentWidth);
    tfNoofWashbin.setWidth(strComponentWidth);
    tfWatertaps.setWidth(strComponentWidth);
    tfAnyFixtures.setWidth(strComponentWidth);
    tfDynamicPlum1.setWidth(strComponentWidth);
    tfDynamicPlum2.setWidth(strComponentWidth);

    //for applicant Reasonable
    tfTypeofwiring.setWidth(strComponentWidth);
    tfClassFit.setWidth(strComponentWidth);
    tfNOofLight.setWidth(strComponentWidth);
    tfExhaustFan.setWidth(strComponentWidth);
    tfFan.setWidth(strComponentWidth);
    tfSpareplug.setWidth(strComponentWidth);
    tfDynamicElectrical1.setWidth(strComponentWidth);
    tfDynamicElectrical2.setWidth(strComponentWidth);

    //for land valuation
    tfAreaofLand.setWidth(strComponentWidth);
    tfNorthandSouth.setWidth(strComponentWidth);
    tfMarketRate.setWidth(strComponentWidth);
    tfGuiderate.setWidth(strComponentWidth);
    tfAdopetdMarketRate.setWidth(strComponentWidth);
    tfFairMarketRate.setWidth(strComponentWidth);
    tfGuidelineRate.setWidth(strComponentWidth);
    tfRealziableRate.setWidth(strComponentWidth);
    tfDistressRate.setWidth(strComponentWidth);
    tfDynamicValuation1.setWidth(strComponentWidth);
    tfDynamicValuation2.setWidth(strComponentWidth);

    tfZone.setWidth(strComponentWidth);
    tfSRO.setWidth(strComponentWidth);
    tfVillage1.setWidth(strComponentWidth);
    tfRevnueDist.setWidth(strComponentWidth);
    tfTalukName.setWidth(strComponentWidth);

    tfStreetName.setWidth(strComponentWidth);
    slStreetSerNo.setWidth(strComponentWidth);
    slStreetSerNo.setHeight("25");
    tfStreetName.setHeight("25");
    tfGuidelineValue.setWidth(strComponentWidth);
    tfGuidelineValueMatric.setWidth(strComponentWidth);
    slClassification.setWidth(strComponentWidth);
    // for details of plan approval
    tfLandandBuilding.setWidth(strComponentWidth);
    tfBuilding.setWidth(strComponentWidth);
    tfQuality.setWidth(strComponentWidth);
    tfReason.setWidth(strComponentWidth);
    tfPlanApprovedBy.setWidth(strComponentWidth);
    dfLicenseFrom.setWidth(strComponentWidth);
    tfDynamicPlanApproval1.setWidth(strComponentWidth);
    slIsLicenceForced.setWidth(strComponentWidth);
    slAllApprovalRecved.setWidth(strComponentWidth);
    slConstAsperAppPlan.setWidth(strComponentWidth);
    tfDynamicPlanApproval2.setWidth(strComponentWidth);

    tfLandMark.setWidth(strComponentWidth);
    tfPropertyAddress.setWidth(strComponentWidth);
    tfPropertyAddress.setHeight("130px");
    tfDynamicAsset1.setWidth(strComponentWidth);
    tfDynamicAsset2.setWidth(strComponentWidth);

    slUndivideShare.setWidth(strComponentWidth);
    tfUDSproportion.setWidth(strComponentWidth);
    tfUDSArea.setWidth(strComponentWidth);
    tfFlatsApproved.setWidth(strComponentWidth);
    tfFlatsWorkplan.setWidth(strComponentWidth);
    slUnderPermissable.setWidth(strComponentWidth);
    lblFloorIndex.setWidth(strComponentWidth);
    tfIndexPlan.setWidth(strComponentWidth);
    tfIndexSite.setWidth(strComponentWidth);
    tfIndexCalculation.setWidth(strComponentWidth);
    tfDynamicForFlat1.setWidth(strComponentWidth);
    tfDynamicForFlat2.setWidth(strComponentWidth);

    //for construction details
    slTypeProperty.setWidth(strComponentWidth);
    slTypeStructure.setWidth(strComponentWidth);
    tfYearConstruction.setWidth(strComponentWidth);
    tfNoFloors.setWidth(strComponentWidth);
    slExterior.setWidth(strComponentWidth);
    slInterior.setWidth(strComponentWidth);
    tfLifeAge.setWidth(strComponentWidth);
    tfFutureLife.setWidth(strComponentWidth);
    tfDetailsPlan.setWidth(strComponentWidth);
    slDeviation.setWidth(strComponentWidth);
    tfDtlsDeviation.setWidth(strComponentWidth);
    tfDynamicConstval1.setWidth(strComponentWidth);
    tfDynamicConstval2.setWidth(strComponentWidth);

    lblParticular.setWidth(strWidth);
    lblPlinthArea.setWidth(strLblWidth);
    lblRoofHt.setWidth(strLblWidth);
    lblBuildAge.setWidth(strWidth);
    lblRate.setWidth(strWidth);
    lblReplace.setWidth(strWidth);
    lblDepreciation.setWidth(strWidth);
    lblNetvalue.setWidth(strWidth);

    //set Null representation
    //for description of the property
    tfPostalAddress.setNullRepresentation("");
    tfSiteNumber.setNullRepresentation("");
    tfSFNumber.setNullRepresentation("");
    tfNewSFNumber.setNullRepresentation("");
    tfVillage.setNullRepresentation("");
    tfTaluk.setNullRepresentation("");
    tfDistCorpPanc.setNullRepresentation("");
    tfLocationSketch.setNullRepresentation("");
    tfProTaxReceipt.setNullRepresentation("");
    tfElecServiceConnNo.setNullRepresentation("");
    tfElecConnecName.setNullRepresentation("");
    slHighMiddPoor.setNullSelectionAllowed(false);
    slUrbanSemiRural.setNullSelectionAllowed(false);
    slResiIndustCommer.setNullSelectionAllowed(false);
    slProOccupiedBy.setNullSelectionAllowed(false);
    tfMonthlyRent.setNullRepresentation("");
    tfCoverUnderStatCentral.setNullRepresentation("");
    tfAnyConversionLand.setNullRepresentation("");
    tfExtentSite.setNullRepresentation("");
    tfYearAcquistion.setNullRepresentation("");
    tfPurchaseValue.setNullRepresentation("");
    tfPropLandmark.setNullRepresentation("");
    tfDynamicDescProp1.setNullRepresentation("");
    tfDynamicDescProp2.setNullRepresentation("");
    //for Charcteristics of the site
    slLocalClass.setNullSelectionAllowed(false);
    slSurroundDevelop.setNullSelectionAllowed(false);
    tfFlood.setNullRepresentation("");
    slFeasibility.setNullSelectionAllowed(false);
    slLandLevel.setNullSelectionAllowed(false);
    slLandShape.setNullSelectionAllowed(false);
    slTypeUse.setNullSelectionAllowed(false);
    tfUsageRestriction.setNullRepresentation("");
    slIsPlot.setNullSelectionAllowed(false);
    tfApprveNo.setNullRepresentation("");
    tfNoReason.setNullRepresentation("");
    tfSubdivide.setNullRepresentation("");
    slDrawApproval.setNullSelectionAllowed(false);
    slCornerInter.setNullSelectionAllowed(false);
    slRoadFacility.setNullSelectionAllowed(false);
    slTypeRoad.setNullSelectionAllowed(false);
    slRoadWidth.setNullSelectionAllowed(false);
    slLandLock.setNullSelectionAllowed(false);
    slWaterPotential.setNullSelectionAllowed(false);
    slUnderSewerage.setNullSelectionAllowed(false);
    slPowerSupply.setNullSelectionAllowed(false);
    tfAdvantageSite.setNullRepresentation("");
    tfDisadvantageSite.setNullRepresentation("");
    tfGeneralRemarks.setNullRepresentation("");
    tfDynamicCharacter1.setNullRepresentation("");
    tfDynamicCharacter2.setNullRepresentation("");

    tfTypeofwiring.setNullRepresentation("");
    tfClassFit.setNullRepresentation("");
    tfNOofLight.setNullRepresentation("");
    tfExhaustFan.setNullRepresentation("");
    tfFan.setNullRepresentation("");
    tfSpareplug.setNullRepresentation("");
    tfDynamicElectrical1.setNullRepresentation("");
    tfDynamicElectrical2.setNullRepresentation("");

    tfNoofClosets.setNullRepresentation("");
    tfNoofWashbin.setNullRepresentation("");
    tfWatertaps.setNullRepresentation("");
    tfAnyFixtures.setNullRepresentation("");
    tfDynamicPlum1.setNullRepresentation("");
    tfDynamicPlum2.setNullRepresentation("");

    //for land valuation
    tfAreaofLand.setNullRepresentation("");
    tfNorthandSouth.setNullRepresentation("");
    tfMarketRate.setNullRepresentation("");
    tfGuiderate.setNullRepresentation("");
    tfAdopetdMarketRate.setNullRepresentation("");
    tfFairMarketRate.setNullRepresentation("");
    tfGuidelineRate.setNullRepresentation("");
    tfRealziableRate.setNullRepresentation("");
    tfDistressRate.setNullRepresentation("");
    tfDynamicValuation1.setNullRepresentation("");
    tfDynamicValuation2.setNullRepresentation("");

    tfZone.setNullRepresentation("");
    tfSRO.setNullRepresentation("");
    tfVillage1.setNullRepresentation("");
    tfRevnueDist.setNullRepresentation("");
    tfTalukName.setNullRepresentation("");
    tfStreetName.setNullRepresentation("");
    slStreetSerNo.setNullSelectionAllowed(false);
    tfGuidelineValue.setNullRepresentation("");
    tfGuidelineValueMatric.setNullRepresentation("");
    slClassification.setNullRepresentation("");

    // for details of plan approval
    tfLandandBuilding.setNullRepresentation("");
    tfBuilding.setNullRepresentation("");
    tfQuality.setNullRepresentation("");
    tfReason.setNullRepresentation("");
    tfPlanApprovedBy.setNullRepresentation("");
    dfLicenseFrom.setNullRepresentation("");
    tfDynamicPlanApproval1.setNullRepresentation("");
    slIsLicenceForced.setNullSelectionAllowed(false);
    slAllApprovalRecved.setNullSelectionAllowed(false);
    slConstAsperAppPlan.setNullSelectionAllowed(false);
    tfDynamicPlanApproval2.setNullRepresentation("");

    tfLandMark.setNullRepresentation("");
    tfPropertyAddress.setNullRepresentation("");
    tfPropertyAddress.setHeight("130px");
    tfDynamicAsset1.setNullRepresentation("");
    tfDynamicAsset2.setNullRepresentation("");

    slUndivideShare.setNullSelectionAllowed(false);
    tfUDSproportion.setNullRepresentation("");
    tfUDSArea.setNullRepresentation("");
    tfFlatsApproved.setNullRepresentation("");
    tfFlatsWorkplan.setNullRepresentation("");
    slUnderPermissable.setNullSelectionAllowed(false);
    tfIndexPlan.setNullRepresentation("");
    tfIndexSite.setNullRepresentation("");
    tfIndexCalculation.setNullRepresentation("");
    tfDynamicForFlat1.setNullRepresentation("");
    tfDynamicForFlat2.setNullRepresentation("");

    //for construction details
    slTypeProperty.setNullSelectionAllowed(false);
    slTypeStructure.setNullSelectionAllowed(false);
    tfYearConstruction.setNullRepresentation("");
    tfNoFloors.setNullRepresentation("");
    slExterior.setNullSelectionAllowed(false);
    slInterior.setNullSelectionAllowed(false);
    tfLifeAge.setNullRepresentation("");
    tfFutureLife.setNullRepresentation("");
    tfDetailsPlan.setNullRepresentation("");
    slDeviation.setNullRepresentation("");
    tfDtlsDeviation.setNullRepresentation("");
    tfDynamicConstval1.setNullRepresentation("");
    tfDynamicConstval2.setNullRepresentation("");

}

From source file:com.gnts.pem.txn.sbi.SBIBuilding.java

@Override
public void buttonClick(ClickEvent event) {
    notifications.close();//from   w  w w. j  a  v a2  s . c o m
    if (btnAdd == event.getButton()) {
        btnSave.setVisible(true);
        btnCancel.setVisible(true);
        btnSubmit.setVisible(true);
        tablePanel.setVisible(false);
        searchPanel.setVisible(false);

        mainPanel.setVisible(true);
        headerid = beanEvaluation.getNextSequnceId("seq_pem_evaldtls_docid");
        resetAllFieldsFields();
        lblAddEdit.setValue("&nbsp;>&nbsp;Add New");
        lblAddEdit.setVisible(true);
        lblFormTittle.setVisible(false);
        hlBreadCrumbs.setVisible(true);

    } else if (btnEdit == event.getButton()) {
        btnSave.setVisible(true);
        btnCancel.setVisible(true);
        btnSubmit.setVisible(true);
        tablePanel.setVisible(false);
        searchPanel.setVisible(false);
        mainPanel.setVisible(true);
        resetAllFieldsFields();
        editDetails();
        lblAddEdit.setValue("&nbsp;>&nbsp;Modify");
        lblAddEdit.setVisible(true);
        lblFormTittle.setVisible(false);
        hlBreadCrumbs.setVisible(true);

    }
    if (btnSave == event.getButton()) {
        setComponentError();
        if (tfEvaluationNumber.isValid() && slBankBranch.isValid() && tfEvaluationPurpose.isValid()
                && dfDateofValuation.isValid() && tfCustomerName.isValid() && tfAdopetdMarketRate.isValid()) {

            saveEvaluationDetails();
        }
        //btnSave.setVisible(false);
    }
    if (btnSubmit == event.getButton()) {
        setComponentError();
        if (tfEvaluationNumber.isValid() && slBankBranch.isValid() && tfEvaluationPurpose.isValid()
                && dfDateofValuation.isValid() && tfCustomerName.isValid() && tfAdopetdMarketRate.isValid()) {
            saveEvaluationDetails();
            updateEvaluationDetails();
            btnSubmit.setEnabled(false);
            btnSave.setEnabled(false);
        }
        //   saveExcel.setVisible(true);

    }
    if (btnCancel == event.getButton()) {
        btnSave.setVisible(false);
        btnCancel.setVisible(false);
        btnSubmit.setVisible(false);
        //   saveExcel.setVisible(false);
        btnSave.setEnabled(true);
        btnSubmit.setEnabled(true);
        tablePanel.setVisible(true);
        searchPanel.setVisible(true);
        mainPanel.setVisible(false);
        btnEdit.setEnabled(false);
        btnAdd.setEnabled(true);
        populateAndConfig(false);
        lblFormTittle.setValue("&nbsp;&nbsp;<b>" + screenName + "</b>&nbsp;::&nbsp;Search");
        lblNotificationIcon.setIcon(null);
        lblSaveNotification.setValue("");
        lblFormTittle.setVisible(true);
        hlBreadCrumbs.setVisible(false);
        lblAddEdit.setVisible(false);
        btnView.setEnabled(false);

        hlFileDownloadLayout.removeAllComponents();
        hlFileDownloadLayout.addComponent(btnDownload);
        getExportTableDetails();

    } else if (btnBack == event.getButton()) {
        resetAllFieldsFields();
        btnSave.setVisible(false);
        btnCancel.setVisible(false);
        btnSubmit.setVisible(false);
        //saveExcel.setVisible(false);
        tablePanel.setVisible(true);
        searchPanel.setVisible(true);
        mainPanel.setVisible(false);
        btnEdit.setEnabled(false);
        btnAdd.setEnabled(true);
        populateAndConfig(false);
        lblFormTittle.setValue("&nbsp;&nbsp;<b>" + screenName + "</b>&nbsp;::&nbsp;Search");
        lblNotificationIcon.setIcon(null);
        lblSaveNotification.setValue("");
        lblFormTittle.setVisible(true);
        hlBreadCrumbs.setVisible(false);
        lblAddEdit.setVisible(false);
        btnView.setEnabled(false);
    }

    else if (btnSearch == event.getButton()) {
        populateAndConfig(true);
        if (total == 0) {
            lblNotificationIcon.setIcon(new ThemeResource("img/msg_info.png"));
            lblSaveNotification.setValue("No Records found");
        } else {
            lblNotificationIcon.setIcon(null);
            lblSaveNotification.setValue("");
        }
        hlFileDownloadLayout.removeAllComponents();
        hlFileDownloadLayout.addComponent(btnDownload);
        getExportTableDetails();
    } else if (btnReset == event.getButton()) {
        tfSearchEvalNumber.setValue("");
        dfSearchEvalDate.setValue(null);
        tfSearchCustomer.setValue("");
        slSearchBankbranch.setValue("");
        populateAndConfig(false);
    }

    if (btnAddAdjoinProperty == event.getButton()) {

        panelAdjoinProperties.addComponent(new ComponentIteratorAdjoinProperty(null, true, true, false));
    }

    if (btnAddDimension == event.getButton()) {
        panelDimension.addComponent(new ComponentIterDimensionofPlot(null, true, true, false));
    }

    else if (btnAddNorDoc == event.getButton()) {

        panelNormalDocumentDetails.addComponent(new ComponentIteratorNormlDoc(null, null, "", ""));
    }

    else if (btnAddLegalDoc == event.getButton()) {

        panelLegalDocumentDetails.addComponent(new ComponentIteratorLegalDoc("", "", null));
    }

    else if (btnAddOwner == event.getButton()) {

        layoutOwnerDetails1.addComponent(new ComponentIterOwnerDetails("", ""));
    }
    if (btnAddRoofHt == event.getButton()) {
        layoutRoofHeight.addComponent(new ComponentIterRoofHeight("", ""));
    }

    if (btnAddGuideline == event.getButton()) {

        layoutGuideline.addComponent(new ComponentIterGuideline("", "", "", ""));
    }
    if (btnDynamicExtra == event.getButton()) {
        layoutExtraItems.addComponent(new ComponentIterExtraItems(null, ""));
    }
    if (btnDynamicAdditional == event.getButton()) {

        layoutAdditionItem.addComponent(new ComponentIterAdditionalItems(null, ""));
    }
    if (btnDynamicMiscell == event.getButton()) {

        layoutMiscellaneous.addComponent(new ComponentIterMiscellaneous(null, ""));
    }
    if (btnDynamicServices == event.getButton()) {

        layoutServices.addComponent(new ComponentIerServices(null, ""));
    }
    if (btnAddValDtls == event.getButton()) {

        ValuationDetailsList obj = new ValuationDetailsList();
        layoutValuationDetails.addComponent(new ComponenetIterValuationDetails(obj));
    } else if (btnDynamicEvaluation1 == event.getButton()) {

        strSelectedPanel = "1";
        showSubWindow();

    }
    if (btnAddPlinth == event.getButton()) {

        layoutPlintharea.addComponent(new ComponentIterPlinthArea("", "", ""));
    }
    if (btnDynamicAsset == event.getButton()) {
        strSelectedPanel = "3";
        showSubWindow();

    }
    if (btnAddBuildSpec == event.getButton()) {
        panelBuildSpecfication.addComponent(new ComponentIterBuildingSpecfication(null, true, true, true));
    }

    if (btnDynamicPlanApproval == event.getButton()) {
        strSelectedPanel = "6";
        showSubWindow();

    }
    if (btnDynamicValuation == event.getButton()) {
        strSelectedPanel = "7";
        showSubWindow();

    }

    if (btnDynamicDescProp == event.getButton()) {
        strSelectedPanel = "8";
        showSubWindow();

    }
    if (btnDynamicCharacter == event.getButton()) {
        strSelectedPanel = "9";
        showSubWindow();

    }
    if (btnDynamicElectrical == event.getButton()) {
        strSelectedPanel = "10";
        showSubWindow();

    }
    if (btnDynamicPlumbing == event.getButton()) {
        strSelectedPanel = "11";
        showSubWindow();

    }
    if (btnDynamicConstVal == event.getButton()) {
        strSelectedPanel = "12";
        showSubWindow();

    }
    if (btnDynamicForFlat == event.getButton()) {
        strSelectedPanel = "13";
        showSubWindow();

    } else if (myButton == event.getButton()) {
        if (tfCaption.getValue() != null && tfCaption.getValue().trim().length() > 0) {
            if (strSelectedPanel.equals("1")) {
                if (tfDynamicEvaluation1.isVisible()) {
                    tfDynamicEvaluation2.setCaption(tfCaption.getValue());
                    tfDynamicEvaluation2.setVisible(true);
                } else {
                    tfDynamicEvaluation1.setCaption(tfCaption.getValue());
                    tfDynamicEvaluation1.setVisible(true);
                }
            }

            else if (strSelectedPanel.equals("3")) {
                if (tfDynamicAsset1.isVisible()) {
                    tfDynamicAsset2.setCaption(tfCaption.getValue());
                    tfDynamicAsset2.setVisible(true);
                } else {
                    tfDynamicAsset1.setCaption(tfCaption.getValue());
                    tfDynamicAsset1.setVisible(true);
                }
            } else if (strSelectedPanel.equals("6")) {
                if (tfDynamicPlanApproval1.isVisible()) {
                    tfDynamicPlanApproval2.setCaption(tfCaption.getValue());
                    tfDynamicPlanApproval2.setVisible(true);
                } else {
                    tfDynamicPlanApproval1.setCaption(tfCaption.getValue());
                    tfDynamicPlanApproval1.setVisible(true);
                }
            } else if (strSelectedPanel.equals("7")) {
                if (tfDynamicValuation1.isVisible()) {
                    tfDynamicValuation2.setCaption(tfCaption.getValue());
                    tfDynamicValuation2.setVisible(true);
                } else {
                    tfDynamicValuation1.setCaption(tfCaption.getValue());
                    tfDynamicValuation1.setVisible(true);
                }
            } else if (strSelectedPanel.equals("8")) {
                if (tfDynamicDescProp1.isVisible()) {
                    tfDynamicDescProp2.setCaption(tfCaption.getValue());
                    tfDynamicDescProp2.setVisible(true);
                } else {
                    tfDynamicDescProp1.setCaption(tfCaption.getValue());
                    tfDynamicDescProp1.setVisible(true);
                }
            }

            else if (strSelectedPanel.equals("9")) {
                if (tfDynamicCharacter1.isVisible()) {
                    tfDynamicCharacter2.setCaption(tfCaption.getValue());
                    tfDynamicCharacter2.setVisible(true);
                } else {
                    tfDynamicCharacter1.setCaption(tfCaption.getValue());
                    tfDynamicCharacter1.setVisible(true);
                }
            } else if (strSelectedPanel.equals("10")) {
                if (tfDynamicElectrical1.isVisible()) {
                    tfDynamicElectrical2.setCaption(tfCaption.getValue());
                    tfDynamicElectrical2.setVisible(true);
                } else {
                    tfDynamicElectrical1.setCaption(tfCaption.getValue());
                    tfDynamicElectrical1.setVisible(true);
                }
            } else if (strSelectedPanel.equals("11")) {
                if (tfDynamicPlum1.isVisible()) {
                    tfDynamicPlum2.setCaption(tfCaption.getValue());
                    tfDynamicPlum2.setVisible(true);
                } else {
                    tfDynamicPlum1.setCaption(tfCaption.getValue());
                    tfDynamicPlum1.setVisible(true);
                }
            }

            else if (strSelectedPanel.equals("12")) {
                if (tfDynamicConstval1.isVisible()) {
                    tfDynamicConstval2.setCaption(tfCaption.getValue());
                    tfDynamicConstval2.setVisible(true);
                } else {
                    tfDynamicConstval1.setCaption(tfCaption.getValue());
                    tfDynamicConstval1.setVisible(true);
                }
            } else if (strSelectedPanel.equals("13")) {
                if (tfDynamicForFlat1.isVisible()) {
                    tfDynamicForFlat2.setCaption(tfCaption.getValue());
                    tfDynamicForFlat2.setVisible(true);
                } else {
                    tfDynamicForFlat1.setCaption(tfCaption.getValue());
                    tfDynamicForFlat1.setVisible(true);
                }
            }
        }
        mywindow.close();
    }
}

From source file:com.gnts.pem.txn.sbi.SBIConstruction.java

@SuppressWarnings("deprecation")
void populateAndConfig(boolean search) {
    try {//from w  ww .  ja  v a 2s  .  c o m
        tblEvalDetails.removeAllItems();
        tblEvalDetails.setImmediate(true);
        List<TPemCmEvalDetails> evalList = null;
        evalList = new ArrayList<TPemCmEvalDetails>();
        if (search) {
            String evalno = tfSearchEvalNumber.getValue();
            String customer = tfSearchCustomer.getValue();
            String bankbranch = (String) slSearchBankbranch.getValue();
            evalList = beanEvaluation.getSearchEvalDetailnList(null, evalno, null, customer, bankbranch,
                    selectedBankid, selectCompanyid, null);
            total = evalList.size();
            if (total == 0) {
                lblNotificationIcon.setIcon(new ThemeResource("img/msg_info.png"));
                lblSaveNotification.setValue("No Records found");
            } else {
                lblNotificationIcon.setIcon(null);
                lblSaveNotification.setValue("");
            }
        } else {

            evalList = beanEvaluation.getSearchEvalDetailnList(SelectedFormName, null, null, null, null,
                    selectedBankid, selectCompanyid, null);
            total = evalList.size();
        }
        lblNoofRecords.setValue(
                "<font size=\"2\" color=\"black\">No.of Records:</font> <font size=\"2\" color=\"#1E90FF\"> "
                        + total + "</font>");
        beans = new BeanItemContainer<TPemCmEvalDetails>(TPemCmEvalDetails.class);
        beans.addAll(evalList);
        btnEdit.setEnabled(false);
        tblEvalDetails.setContainerDataSource(beans);
        tblEvalDetails.setSelectable(true);
        tblEvalDetails.setColumnFooter("lastUpdateDt", "No. of Records:" + total);
        tblEvalDetails.setVisibleColumns(new Object[] { "evalNo", "docDate", "bankBranch", "custName",
                "docStatus", "lastUpdtedBy", "lastUpdateDt" });
        tblEvalDetails.setColumnHeaders(new String[] { "Evaluation Number", "Evaluation Date", "Bank Branch",
                "Customer Name", "Status", "Last Updated By", "Last Updated Date" });
        tblEvalDetails.addValueChangeListener(new Property.ValueChangeListener() {
            /**
            * 
            */
            private static final long serialVersionUID = 3729824796823933688L;

            @Override
            public void valueChange(ValueChangeEvent event) {

                StreamResource sr = getPDFStream();

                if (sr != null) {

                    if (filedownloader == null) {
                        filedownloader = new FileDownloader(getPDFStream());
                        filedownloader.extend(btnView);
                    } else {
                        filedownloader.setFileDownloadResource(sr);
                    }
                } else {
                    lblNotificationIcon.setIcon(new ThemeResource("img/msg_info.png"));
                    lblSaveNotification.setValue("No document is there");
                    //   notif.show(Page.getCurrent());
                    if (filedownloader != null) {
                        filedownloader.setFileDownloadResource(null); // reset
                    }

                }
                TPemCmEvalDetails syncList = (TPemCmEvalDetails) event.getProperty().getValue();
                if (syncList != null) {

                    if (syncList.getDocStatus().equals("Draft") || syncList.getDocStatus().equals("Rejected")) {
                        btnEdit.setEnabled(true);
                        btnView.setEnabled(false);
                    } else {
                        btnEdit.setEnabled(false);
                        btnView.setEnabled(true);

                    }
                    btnAdd.setEnabled(false);
                } else {
                    btnEdit.setEnabled(false);
                    btnAdd.setEnabled(true);
                }
            }

        });
        tblEvalDetails.setImmediate(true);
        tblEvalDetails.addItemClickListener(new ItemClickListener() {

            @Override
            public void itemClick(ItemClickEvent event) {
                // TODO Auto-generated method stub
                if (tblEvalDetails.isSelected(event.getItemId())) {

                    btnView.setEnabled(false);
                } else {

                    btnView.setEnabled(true);
                }
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
        logger.info("Error-->" + e);
    }
    getExportTableDetails();
}