Friday, April 8, 2016

UPLOADING FILE TO DROPBOX USING DROPBOX ANDROID API



UPLOADING FILE TO DROPBOX USING DROPBOX ANDROID API


MainActivity.java

 

package app.sample.com;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import com.dropbox.client2.DropboxAPI;
import com.dropbox.client2.DropboxAPI.UploadRequest;
import com.dropbox.client2.android.AndroidAuthSession;
import com.dropbox.client2.android.AuthActivity;
import com.dropbox.client2.exception.DropboxException;
import com.dropbox.client2.exception.DropboxFileSizeException;
import com.dropbox.client2.exception.DropboxIOException;
import com.dropbox.client2.exception.DropboxParseException;
import com.dropbox.client2.exception.DropboxPartialFileException;
import com.dropbox.client2.exception.DropboxServerException;
import com.dropbox.client2.exception.DropboxUnlinkedException;
import com.dropbox.client2.session.AccessTokenPair;
import com.dropbox.client2.session.AppKeyPair;
import com.dropbox.client2.session.TokenPair;
import com.dropbox.client2.session.Session.AccessType;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity {
final String APP_KEY = "vzjha5o4swtoi53";
    final String APP_SECRET = "cnb9z972bolzst7";
private DropboxAPI<AndroidAuthSession> mDBApi;
final static private String ACCOUNT_PREFS_NAME = "prefs";
final static private String ACCESS_KEY_NAME = "ACCESS_KEY";
final static private String ACCESS_SECRET_NAME = "ACCESS_SECRET";
final static private AccessType ACCESS_TYPE = AccessType.APP_FOLDER;
private Button btn_linkDropbox;
private boolean mLoggedIn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
      
        AndroidAuthSession session = buildSession();
    
     mDBApi = new DropboxAPI<AndroidAuthSession>(session);
     checkAppKeySetup();   
     setLoggedIn(mDBApi.getSession().isLinked());
    
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) 
    {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
        
    }

protected void onResume()
{
try
{
super.onResume();
AndroidAuthSession session = mDBApi.getSession();

// The next part must be inserted in the onResume() method of the
// activity from which session.startAuthentication() was called, so
// that Dropbox authentication completes properly.
if (session.authenticationSuccessful()) 
{
//showToast("resume successfull..");
try {
// Mandatory call to complete the auth
session.finishAuthentication();
                  showToast("authentication finished succesfully");
// Store it locally in our app for later use
                  //String accessToken = mDBApi.getSession().getOAuth2AccessToken();
TokenPair tokens = session.getAccessTokenPair();
storeKeys(tokens.key, tokens.secret);
setLoggedIn(true);
catch (IllegalStateException e) {
showToast("Couldn't authenticate with Dropbox:" + e.getLocalizedMessage());
}
}
}
catch(Exception ex)
{
showToast("Resume ERROR .."+ex.getMessage());
}
}
private AndroidAuthSession buildSession() {
AppKeyPair appKeyPair = new AppKeyPair(APP_KEYAPP_SECRET);
AndroidAuthSession session;

String[] stored = getKeys();
if (stored != null)
{
AccessTokenPair accessToken = new AccessTokenPair(stored[0], stored[1]);
session = new AndroidAuthSession(appKeyPair, ACCESS_TYPE, accessToken);
//session= new AndroidAuthSession(appKeyPair, accessToken);
else
{
//session = new AndroidAuthSession(appKeyPair);
session = new AndroidAuthSession(appKeyPair, ACCESS_TYPE);
}

return session;
}
private String[] getKeys()
{
SharedPreferences prefs = getSharedPreferences(ACCOUNT_PREFS_NAME, 0);
String key = prefs.getString(ACCESS_KEY_NAMEnull);
String secret = prefs.getString(ACCESS_SECRET_NAMEnull);
if (key != null && secret != null) {
String[] ret = new String[2];
ret[0] = key;
ret[1] = secret;
return ret;
else {
return null;
}
}
private void setLoggedIn(boolean loggedIn) 
{
btn_linkDropbox=(Button) findViewById(R.id.app);

mLoggedIn = loggedIn;    
if (loggedIn) 
{
btn_linkDropbox.setText("Unlink from Dropbox");

else 
{
btn_linkDropbox.setText("Link with Dropbox");          

}
}
private void storeKeys(String key, String secret) {
// Save the access key for later
SharedPreferences prefs = getSharedPreferences(ACCOUNT_PREFS_NAME, 0);
Editor edit = prefs.edit();
edit.putString(ACCESS_KEY_NAME, key);
edit.putString(ACCESS_SECRET_NAME, secret);
edit.commit();
}

    public void uploaddata(View v) 
    {
     
    
     try
     {

     // And later in some initialization function:
    
    
    
     if(mDBApi.getSession().isLinked())
         {
     UploadFile uploadFile = new UploadFile(thismDBApi);
    
           uploadFile.execute();
           showToast("File uploded successfully..");

    
    
     }
     else
     {
     showToast("Authenticating..");
     //mDBApi.getSession().startOAuth2Authentication(MainActivity.this);
     mDBApi.getSession().startAuthentication(MainActivity.this);
     showToast("This app wasn't authenticated properly.Please link with dropbox to upload File");
     }
     }
     catch(IllegalStateException ex)
     {
     showToast("Illegal state Exception Arises.."+ex.getMessage());
     }
     catch(Exception ex)
     {
     Toast.makeText(this,"ER GEN.."+ex.getMessage(), Toast.LENGTH_LONG).show();
     Log.i("ER GEN..",ex.getMessage());
    
     }
   
    }

private void checkAppKeySetup() 
{
// Check to make sure that we have a valid app key
if (APP_KEY.startsWith("CHANGE") ||
APP_SECRET.startsWith("CHANGE")) 
{
showToast("You must apply for an app key and secret from developers.dropbox.com, and add them to the DBRoulette ap before trying it.");
finish();
return;
}

// Check if the app has set up its manifest properly.
Intent testIntent = new Intent(Intent.ACTION_VIEW);
String scheme = "db-" + APP_KEY;
String uri = scheme + "://" + AuthActivity.AUTH_VERSION + "/test";
testIntent.setData(Uri.parse(uri));
PackageManager pm = getPackageManager();
if (0 == pm.queryIntentActivities(testIntent, 0).size()) {
showToast("URL scheme in your app's " +
"manifest is not set up correctly. You should have a " +
"com.dropbox.client2.android.AuthActivity with the " +
"scheme: " + scheme);
Log.i("res","URL scheme in your app's " +
"manifest is not set up correctly. You should have a " +
"com.dropbox.client2.android.AuthActivity with the " +
"scheme: " + scheme);
finish();
}
}
private void showToast(String message)
{
Toast.makeText(this,message,Toast.LENGTH_LONG).show();
}

    
    
}


 

UploadFile.java


package app.sample.com;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import com.dropbox.client2.DropboxAPI;
import com.dropbox.client2.DropboxAPI.UploadRequest;
import com.dropbox.client2.android.AndroidAuthSession;
import com.dropbox.client2.android.AuthActivity;
import com.dropbox.client2.exception.DropboxException;
import com.dropbox.client2.exception.DropboxFileSizeException;
import com.dropbox.client2.exception.DropboxIOException;
import com.dropbox.client2.exception.DropboxParseException;
import com.dropbox.client2.exception.DropboxPartialFileException;
import com.dropbox.client2.exception.DropboxServerException;
import com.dropbox.client2.exception.DropboxUnlinkedException;
import com.dropbox.client2.session.AccessTokenPair;
import com.dropbox.client2.session.AppKeyPair;
import com.dropbox.client2.session.TokenPair;
import com.dropbox.client2.session.Session.AccessType;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity {
final String APP_KEY = "vzjha5o4swtoi53";
    final String APP_SECRET = "cnb9z972bolzst7";
private DropboxAPI<AndroidAuthSession> mDBApi;
final static private String ACCOUNT_PREFS_NAME = "prefs";
final static private String ACCESS_KEY_NAME = "ACCESS_KEY";
final static private String ACCESS_SECRET_NAME = "ACCESS_SECRET";
final static private AccessType ACCESS_TYPE = AccessType.APP_FOLDER;
private Button btn_linkDropbox;
private boolean mLoggedIn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
      
        AndroidAuthSession session = buildSession();
    
     mDBApi = new DropboxAPI<AndroidAuthSession>(session);
     checkAppKeySetup();   
     setLoggedIn(mDBApi.getSession().isLinked());
    
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) 
    {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
        
    }

protected void onResume()
{
try
{
super.onResume();
AndroidAuthSession session = mDBApi.getSession();

// The next part must be inserted in the onResume() method of the
// activity from which session.startAuthentication() was called, so
// that Dropbox authentication completes properly.
if (session.authenticationSuccessful()) 
{
//showToast("resume successfull..");
try {
// Mandatory call to complete the auth
session.finishAuthentication();
                  showToast("authentication finished succesfully");
// Store it locally in our app for later use
                  //String accessToken = mDBApi.getSession().getOAuth2AccessToken();
TokenPair tokens = session.getAccessTokenPair();
storeKeys(tokens.key, tokens.secret);
setLoggedIn(true);
catch (IllegalStateException e) {
showToast("Couldn't authenticate with Dropbox:" + e.getLocalizedMessage());
}
}
}
catch(Exception ex)
{
showToast("Resume ERROR .."+ex.getMessage());
}
}
private AndroidAuthSession buildSession() {
AppKeyPair appKeyPair = new AppKeyPair(APP_KEYAPP_SECRET);
AndroidAuthSession session;

String[] stored = getKeys();
if (stored != null)
{
AccessTokenPair accessToken = new AccessTokenPair(stored[0], stored[1]);
session = new AndroidAuthSession(appKeyPair, ACCESS_TYPE, accessToken);
//session= new AndroidAuthSession(appKeyPair, accessToken);
else
{
//session = new AndroidAuthSession(appKeyPair);
session = new AndroidAuthSession(appKeyPair, ACCESS_TYPE);
}

return session;
}
private String[] getKeys()
{
SharedPreferences prefs = getSharedPreferences(ACCOUNT_PREFS_NAME, 0);
String key = prefs.getString(ACCESS_KEY_NAMEnull);
String secret = prefs.getString(ACCESS_SECRET_NAMEnull);
if (key != null && secret != null) {
String[] ret = new String[2];
ret[0] = key;
ret[1] = secret;
return ret;
else {
return null;
}
}
private void setLoggedIn(boolean loggedIn) 
{
btn_linkDropbox=(Button) findViewById(R.id.app);

mLoggedIn = loggedIn;    
if (loggedIn) 
{
btn_linkDropbox.setText("Unlink from Dropbox");

else 
{
btn_linkDropbox.setText("Link with Dropbox");          

}
}
private void storeKeys(String key, String secret) {
// Save the access key for later
SharedPreferences prefs = getSharedPreferences(ACCOUNT_PREFS_NAME, 0);
Editor edit = prefs.edit();
edit.putString(ACCESS_KEY_NAME, key);
edit.putString(ACCESS_SECRET_NAME, secret);
edit.commit();
}

    public void uploaddata(View v) 
    {
     
    
     try
     {

     // And later in some initialization function:
    
    
    
     if(mDBApi.getSession().isLinked())
         {
     UploadFile uploadFile = new UploadFile(thismDBApi);
    
           uploadFile.execute();
           showToast("File uploded successfully..");

    
    
     }
     else
     {
     showToast("Authenticating..");
     //mDBApi.getSession().startOAuth2Authentication(MainActivity.this);
     mDBApi.getSession().startAuthentication(MainActivity.this);
     showToast("This app wasn't authenticated properly.Please link with dropbox to upload File");
     }
     }
     catch(IllegalStateException ex)
     {
     showToast("Illegal state Exception Arises.."+ex.getMessage());
     }
     catch(Exception ex)
     {
     Toast.makeText(this,"ER GEN.."+ex.getMessage(), Toast.LENGTH_LONG).show();
     Log.i("ER GEN..",ex.getMessage());
    
     }
   
    }

private void checkAppKeySetup() 
{
// Check to make sure that we have a valid app key
if (APP_KEY.startsWith("CHANGE") ||
APP_SECRET.startsWith("CHANGE")) 
{
showToast("You must apply for an app key and secret from developers.dropbox.com, and add them to the DBRoulette ap before trying it.");
finish();
return;
}

// Check if the app has set up its manifest properly.
Intent testIntent = new Intent(Intent.ACTION_VIEW);
String scheme = "db-" + APP_KEY;
String uri = scheme + "://" + AuthActivity.AUTH_VERSION + "/test";
testIntent.setData(Uri.parse(uri));
PackageManager pm = getPackageManager();
if (0 == pm.queryIntentActivities(testIntent, 0).size()) {
showToast("URL scheme in your app's " +
"manifest is not set up correctly. You should have a " +
"com.dropbox.client2.android.AuthActivity with the " +
"scheme: " + scheme);
Log.i("res","URL scheme in your app's " +
"manifest is not set up correctly. You should have a " +
"com.dropbox.client2.android.AuthActivity with the " +
"scheme: " + scheme);
finish();
}
}
private void showToast(String message)
{
Toast.makeText(this,message,Toast.LENGTH_LONG).show();
}

    
    
}


Thursday, April 7, 2016

UPLOAD FILE TO DROPBOX BY CALLING ITS WEBSERVICE IN JAVA



METHOD 1

USING ACCESS TOKEN GENERATED IN DROPBOX DEVELOPER WEBSITE


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Locale;

import com.dropbox.core.DbxAppInfo;
import com.dropbox.core.DbxAuthFinish;
import com.dropbox.core.DbxEntry;
import com.dropbox.core.DbxException;
import com.dropbox.core.DbxRequestConfig;
import com.dropbox.core.DbxClient;
import com.dropbox.core.DbxWebAuthNoRedirect;
import com.dropbox.core.DbxWriteMode;

public class Upload_Data
{
    private static final String ACCESS_TOKEN = "<ACCESS TOKEN>";

    public static void main(String args[]) throws DbxException, IOException {
        
        DbxRequestConfig config = new DbxRequestConfig(
            "JavaTutorial/1.0", Locale.getDefault().toString());
            
        //YOU CAN GET THIS ACCESS TOKEN FROM DROPBOX DEVELOPER WEBSITE     FOR YOUR APP       
       String accessToken="<aCCESSTOKEN>";

       DbxClient client = new DbxClient(config, accessToken);
        System.out.println("Linked account: " +client.getAccountInfo().displayName);
        File inputFile = new File("C:\\Users\\USER\\Desktop\\dat.txt");
        
        
        FileInputStream inputStream = new FileInputStream(inputFile);
        try 
        {
          client.delete("/dat.txt");
          System.out.println("DAT DELETED SUCCESSFULLY");
            DbxEntry.File uploadedFile = client.uploadFile("/dat.txt",
                DbxWriteMode.add(), inputFile.length(), inputStream);
            System.out.println("Uploaded: " + uploadedFile.toString());
        }   
        finally
        {
            inputStream.close();
            
        }
        FileOutputStream outputStream = new FileOutputStream("DAT.txt");
        try {
            DbxEntry.File downloadedFile = client.getFile("/DAT.txt", null,
                outputStream);
            
            System.out.println("Metadata: " + downloadedFile.toString());
        } 
        finally 
        {
            outputStream.close();
        }
      
        
    }
}

METHOD 2

USING ACCESS KEY AND SECRET KEY GENERATED IN DROPBOX DEVELOPER WEBSITE:


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Locale;

import com.dropbox.core.DbxAppInfo;
import com.dropbox.core.DbxAuthFinish;
import com.dropbox.core.DbxEntry;
import com.dropbox.core.DbxException;
import com.dropbox.core.DbxRequestConfig;
import com.dropbox.core.DbxClient;
import com.dropbox.core.DbxWebAuthNoRedirect;
import com.dropbox.core.DbxWriteMode;

public class Upload_Data
{
    private static final String ACCESS_TOKEN = "<ACCESS TOKEN>";

    public static void main(String args[]) throws DbxException, IOException {
        // Create Dropbox client
        //YOU CAN GET APP KEY AND SECRET KEY FOR YOUR APP IN DROPBOX   DEVELOPER.COM
     final String APP_KEY = "<APP KEY>";
        final String APP_SECRET = "SECRET KEY";
        DbxAppInfo appInfo = new DbxAppInfo(APP_KEY, APP_SECRET);
        DbxRequestConfig config = new DbxRequestConfig(
            "JavaTutorial/1.0", Locale.getDefault().toString());
       DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(config, appInfo);
       String authorizeUrl = webAuth.start();
      System.out.println("1. Go to: " + authorizeUrl);
       System.out.println("2. Click \"Allow\" (you might have to log in first)");
       System.out.println("3. Copy the authorization code.");
      String code = new BufferedReader(new InputStreamReader(System.in)).readLine().trim();
       System.out.println("Authen code.."+code);
       DbxAuthFinish authFinish = webAuth.finish(code);
        String accessToken = authFinish.accessToken;
             DbxClient client = new DbxClient(config, accessToken);
        System.out.println("Linked account: " +client.getAccountInfo().displayName);
        File inputFile = new File("C:\\Users\\USER\\Desktop\\dat.txt");
        
        
        FileInputStream inputStream = new FileInputStream(inputFile);
        try 
        {
          client.delete("/dat.txt");
          System.out.println("DAT DELETED SUCCESSFULLY");
            DbxEntry.File uploadedFile = client.uploadFile("/dat.txt",
                DbxWriteMode.add(), inputFile.length(), inputStream);
            System.out.println("Uploaded: " + uploadedFile.toString());
            
        }   
        finally
        {
            inputStream.close();
            
        }
        FileOutputStream outputStream = new FileOutputStream("DAT.txt");
        try {
            DbxEntry.File downloadedFile = client.getFile("/DAT.txt", null,
                outputStream);
            
            System.out.println("Metadata: " + downloadedFile.toString());
        } 
        finally 
        {
            outputStream.close();
        }
      
        
    }
}
 

TABLE VIEW IN JAVAFX


TABLE VIEW IN JAVAFX


import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;


public class CalculationView extends VBox
{
    private TableView table;
    private TableColumn sno,room_no,name,no_ofdays,extra,guest,penalty,test;
    private MainView mv;
    private Label title;
     private final ObservableList<Person> data =FXCollections.observableArrayList();
    public CalculationView()
    {
        //this.mv=main;
     instanceCreation();
     setdata();
     designform();
   
    }
    private void instanceCreation()
    {
        //MainTable
        table=new TableView();
         //table.setEditable(true);
       
        //Table Column
        sno=new TableColumn();
        sno.setMinWidth(100);
        sno.setCellValueFactory(
                new PropertyValueFactory<Person, String>("sNo"));
       
        room_no=new TableColumn();
        room_no.setMinWidth(100);
        room_no.setCellValueFactory(
                new PropertyValueFactory<Person, String>("roomNo"));
       
        name=new TableColumn();
        name.setMinWidth(200);
        name.setCellValueFactory(
                new PropertyValueFactory<Person, String>("fname"));
   
        no_ofdays=new TableColumn();
        no_ofdays.setMinWidth(180);
        no_ofdays.setCellValueFactory(new PropertyValueFactory<Person, TextField>("noDays"));
       
        extra=new TableColumn();
        extra.setMinWidth(150);
        extra.setCellValueFactory(new PropertyValueFactory<Person, TextField>("extraChrg"));
       
        guest=new TableColumn();
        guest.setMinWidth(150);
        guest.setCellValueFactory(new PropertyValueFactory<Person, TextField>("guestChrg"));
       
        penalty=new TableColumn();
        penalty.setMinWidth(150);
        penalty.setCellValueFactory(new PropertyValueFactory<Person, TextField>("penaltyChrg"));
       
        test=new TableColumn();
        test.setMinWidth(100);
        test.setCellValueFactory(new PropertyValueFactory<Person, String>("test"));
       
        title=new Label();   
    }
    private void setdata()
    {
          for(int i=0;i<100;i++){
              //  data.add(new Person(String.valueOf(i),"test"+i,""+i+i+"", "name"+i));
              data.add(new Person(String.valueOf(i),""+i+i+"","name"+i,"i","i","i","i","tset1"));
           
            }
        //columns data
        sno.setText("S.NO");
        room_no.setText("ROOM NO");
        name.setText("NAME");
        no_ofdays.setText("NO OF DAYS FOOD TAKEN");
        extra.setText("EXTRA MESS CHARGE");
        guest.setText("GUEST CHARGE");
        penalty.setText("PENALTY CHARGE");
        test.setText("Test col");
        //titles
        title.setText("CHARGES TABLE");
        title.setFont(new Font("Arialblack", 20));
       
    }
    private void designform()
    {       
        table.getColumns().addAll(sno,room_no,name,no_ofdays,extra,guest,penalty,test);
        this.setStyle("-fx-border-color: red");
        //this.setPadding(new Insets(0,0,0,99));
        this.getChildren().addAll(title,table);
        table.setItems(data);
   
    }
   

}

Person CLASS FOR TO RETRIVE TABLE DATA(GETTER AND SETTER METHODS)

 

 

import javafx.beans.property.SimpleStringProperty;
import javafx.scene.control.TextField;


public class Person
{
    private TextField noDays,extraChrg,guestChrg,penaltyChrg;
    private SimpleStringProperty sNo;
    private SimpleStringProperty roomNo;
    private SimpleStringProperty fname;
    private SimpleStringProperty test;
   
   
    public Person(String sNo,String roomno,String fname,String no,String ex,String gs,String pen,String test)
    {
        this.roomNo=new SimpleStringProperty(roomno);
        System.out.println(sNo);
        this.sNo= new SimpleStringProperty(sNo);
        this.fname=new SimpleStringProperty(fname);
        this.test=new SimpleStringProperty(test);
        this.noDays=new TextField(no);
        this.extraChrg=new TextField(ex);
        this.guestChrg=new TextField(gs);
        this.penaltyChrg=new TextField(pen);
      
      
    }
    public TextField getNoDays() {
        return noDays;
    }
    public void setNoDays(TextField noDays) {
        this.noDays = noDays;
    }
    public TextField getExtraChrg() {
        return extraChrg;
    }
    public void setExtraChrg(TextField extraChrg) {
        this.extraChrg = extraChrg;
    }
    public TextField getGuestChrg() {
        return guestChrg;
    }
    public void setGuestChrg(TextField guestChrg) {
        this.guestChrg = guestChrg;
    }
    public TextField getPenaltyChrg() {
        return penaltyChrg;
    }
    public void setPenaltyChrg(TextField penaltyChrg) {
        this.penaltyChrg = penaltyChrg;
    }


    public String getSNo() {
        return sNo.get();
    }
    public void setsNo(String sNo)
    {
        this.sNo.set(sNo);
    }
   


    public String getRoomNo() {
        return roomNo.get();
    }
    public String gettest()
    {
        return test.get();
    }
    public void settest(String testval)
    {
        test.set(testval);
    }

   
    public String getFname() {
        return fname.get();
    }
    
   

}

 


 
 


NOTE:


According to the PropertyValueFactorydocumentation..,
Make sure to type correct getter and setter method with respect to variable name.
If variable name is abc means,your methods should be like this getAbc(),setAbc().