- Define a class.
1. You should create your own class by using define class function: isc.ClassFactory.defineClass('className', ParentClass):
isc.ClassFactory.defineClass('SIMF_MassFollowupForm',isc.DynamicForm);
2. Addinitial properties for this new class: addProperties({})
isc.SIMF_MassFollowupForm.addProperties({
numCols: 16,
width: '100%',
height: '30%',
sampleTypeFieldProperties: null,
sampleTypeListAddForm: null,
//"initWidget()" is a function called when this instance created.
initWidget: function() {
this.Super("initWidget",arguments);
},
});
- Register in Openbravo.
For a normal screen, we could to create a layout or form, in which we can create the class we just mentioned in this layout "initWidgt()" function.
1.Create a Java Class extended class "org.openbravo.client.kernel.BaseComponentProvider".
package com.sim.fashion.erpCommon.actionHandler;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.openbravo.client.kernel.BaseComponentProvider;
import org.openbravo.client.kernel.Component;
public class MassOrderFollowupComponent extends BaseComponentProvider {
@Override
public Component getComponent(String componentId, Map<String, Object> parameters) {
throw new IllegalArgumentException("Component id " + componentId + " not supported.");
/*
* in this howto we only need to return static resources so there is no
* need to return anything here
*/
}
@Override
public List<ComponentResource> getGlobalComponentResources() {
final List<ComponentResource> globalResources = new ArrayList<ComponentResource>();
globalResources.add(createStaticResource("web/com.sim.fashion/js/mass-followup-grid.js", false));
globalResources.add(createStaticResource("web/com.sim.fashion/js/mass-followup-form.js", false));
globalResources.add(createStaticResource("web/com.sim.fashion/js/add-samples-view.js", false));
globalResources.add(createStaticResource("web/com.sim.fashion/js/modify-samples-view.js", false));
return globalResources;
}
@Override
public List<String> getTestResources() {
return Collections.emptyList();
}
}
After added class, you have to execute command “ant smartbuild” or ”ant compile.complete”
2. Log in as "System Administrator", create a new record in "Application Dictionary|| User Interface|| View Implementation"
图1
Name: className, only the displayed view(Layout or Form) need to create as a view implementation.
3.Create a menu to display:
图2
Action:choose “Open View in MDI”, then “View Implementation” shows.
ViewImplementation: choose the created view implementation you just created.
In Openbravo:
You can use openbravo created class as you want without importing or any reference.
-Openbravo JS Path:
org.openbravo.client.application\web\org.openbravo.client.application\js
-DataSource Path:
org.openbravo.service.datasource\web\org.openbravo.service.datasource\js