Class: PageObject

PageObject(options)

new PageObject(options)

Parameters:
Name Type Description
options Object which are used to create page object

Methods

addImage(successCallback, errorCallback, properties)

This method adds an image object to the 'images' array property of the page. After the image is added, the currentImageIndex is updated to indicate that the most recent image is current.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
properties Object A JSON object contains the page and image ids.
Properties
Name Type Attributes Default Description
pageID String <optional>
null unique id which is used to get the page and perform the corresponding operations
imageID String <optional>
null id of the image which we want to add to page
See:
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
var pageObject = null, imageObject = null;
kfxCordova.kfxLibLogistics.createPageObject(function(pageObj){
      pageObject = pageObj;
},function(error){
       alert(JSON.stringify(error));
});
pageObject.addImage(function(success){
       alert(JSON.stringify(success));
},function(error){
       alert(JSON.stringify(error));
},{pageID:pageObject.pageID,imageID:imageObject.imgID});

delete(successCallback, errorCallback)

Delete the page object from the current document
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are JSONException,KmcRuntimeException,Exception.
Example
var pageObject = null;
kfxCordova.kfxLibLogistics.createPageObject(function(pageObj){
      pageObject = pageObj;
},function(error){
      alert(JSON.stringify(error));
});
pageObject.delete(function(success){
      alert(JSON.stringify(success));
},function(error){
      alert(JSON.stringify(error));
});

getProperties(successCallback, errorCallback)

Get the properties of the page
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back with page Object properties. errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
var pageObject = null;
kfxCordova.kfxLibLogistics.createPageObject(function(pageObj){
      pageObject = pageObj;
},function(error){
      alert(JSON.stringify(error));
});
pageObject.getProperties(function(properties){
      alert(JSON.stringify(properties));
},function(error){
      alert(JSON.stringify(error));
});

removeImage(successCallback, errorCallback, properties)

This method removes an image from the 'images' array property. The image to be removed is determined by matching the supplied imageID string to the contents of the images in the array. If the current image is removed, the currentImageIndex is set to 0. Otherwise, the currentImageIndex refers to the same image.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
properties Object A JSON object contains the page and image ids.
Properties
Name Type Attributes Default Description
pageID String <optional>
null unique id which is used to get the page and perform the corresponding operations
imageID String <optional>
null id of the image which we want to remove from page
See:
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
var pageObject = null, imageObject = null;
kfxCordova.kfxLibLogistics.createPageObject(function(pageObj){
      pageObject = pageObj;
},function(error){
      alert(JSON.stringify(error));
});
pageObject.removeImage(function(success){
      alert(JSON.stringify(success));
},function(error){
      alert(JSON.stringify(error));
},{pageID:pageObject.pageID,imageID:imageObject.imgID});

setProperties(successCallback, errorCallback, pageproperties)

Set the properties of the page
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
pageproperties Object A JSON object contains the properties of the page object.
Properties
Name Type Attributes Default Description
pageID String <optional>
null unique id which is used to get the page and perform the corresponding operations
side String <optional>
"FRONT" What side of the page i.e, either FRONT or BACK
Returns:
The return value is captured in the 'successCB' for a successful operation, and might return in 'errorCB' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCB : KMC_SUCCESS success call back errorCB : error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
var pageObject = null;
kfxCordova.kfxLibLogistics.createPageObject(function(pageObj){
      pageObject = pageObj;
},function(error){
      alert(JSON.stringify(error));
});
pageObject.setProperties(function(success){
      alert(JSON.stringify(success));
},function(error){
      alert(JSON.stringify(error));
},{pageID:pageObject.pageID,side:"FRONT"});// use side:"BACK" to set back side pageobject properties