Openbravo Smartclient 使用总结(1) - Summary

- 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值