Hi Isomorphic,
I'm creating a 2nd SmartGWT project (a connector that will connect my system with different other systems).
In order to display some data from my system I'm using RestDataSource.
Here I have the problem that I get this warning in the Dev Mode Tab in Eclipse when using the same RestDataSource twice with new:
The DataSource I use is defined as below:
LeadtemperatureDS.java:
Now I use it twice like the following in a ListGridField:
ListGridField snippet:
I think that I need the setID() in my RestDataSource-subclass as otherwise it is not clear for the RESTHandler-servlet which DataSource to ask.
So my next thought is: Do I need to use a singleton for my RestDataSource-subclass?
Is this correct, and if so, is it documented somewhere?
Thank you & Best regards
Blama
I'm creating a 2nd SmartGWT project (a connector that will connect my system with different other systems).
In order to display some data from my system I'm using RestDataSource.
Here I have the problem that I get this warning in the Dev Mode Tab in Eclipse when using the same RestDataSource twice with new:
Code:
[ERROR] [connector] - 12:42:35.222:MUP0:WARN:Log:Specified ID: T_LEADTEMPERATURE collides with the ID for an existing SmartGWT component or object. The existing object will be destroyed and the ID bound to the new object.
LeadtemperatureDS.java:
Code:
package com.lmscompany.connector.client.datasources; import com.lmscompany.connector.shared.type.RestDatasourceEnum; import com.lmscompany.connector.shared.type.RestDatasourceFieldEnum; import com.smartgwt.client.data.fields.DataSourceBooleanField; import com.smartgwt.client.data.fields.DataSourceIntegerField; import com.smartgwt.client.data.fields.DataSourceTextField; public class LeadtemperatureDS extends LMSRestDataSource { public LeadtemperatureDS() { super(); setID(RestDatasourceEnum.T_LEADTEMPERATURE.getValue()); DataSourceIntegerField id = new DataSourceIntegerField(RestDatasourceFieldEnum.T_LEADTEMPERATURE__ID.getValue()); id.setPrimaryKey(true); id.setCanEdit(false); DataSourceTextField shortname = new DataSourceTextField(RestDatasourceFieldEnum.T_LEADTEMPERATURE__SHORTNAME.getValue()); DataSourceTextField name = new DataSourceTextField(RestDatasourceFieldEnum.T_LEADTEMPERATURE__NAME.getValue()); DataSourceTextField description = new DataSourceTextField(RestDatasourceFieldEnum.T_LEADTEMPERATURE__DESCRIPTION.getValue()); DataSourceIntegerField position = new DataSourceIntegerField(RestDatasourceFieldEnum.T_LEADTEMPERATURE__POSITION.getValue()); DataSourceBooleanField available = new DataSourceBooleanField(RestDatasourceFieldEnum.T_LEADTEMPERATURE__AVAILABLE.getValue()); setFields(id, shortname, name, description, position, available); } }
ListGridField snippet:
Code:
ListGridField leadtemperatureLGF = new ListGridField(DatasourceFieldEnum.T_LEADIMPORT_SETTINGS__LEADTEMPERATURE_ID.getValue()); [B]leadtemperatureLGF.setOptionDataSource(new LeadtemperatureDS());[/B] leadtemperatureLGF.setValueField(RestDatasourceFieldEnum.T_LEADTEMPERATURE__ID.getValue()); leadtemperatureLGF.setDisplayField(RestDatasourceFieldEnum.T_LEADTEMPERATURE__NAME.getValue()); SelectItem leadtemperatureSI = new SelectItem(); [B]leadtemperatureSI.setOptionDataSource(new LeadtemperatureDS());[/B] leadtemperatureSI.setOptionCriteria( new AdvancedCriteria(new Criterion(RestDatasourceFieldEnum.T_LEADTEMPERATURE__AVAILABLE.getValue(), OperatorId.EQUALS, true))); leadtemperatureSI.setValueField(RestDatasourceFieldEnum.T_LEADTEMPERATURE__ID.getValue()); leadtemperatureSI.setSortField(RestDatasourceFieldEnum.T_LEADTEMPERATURE__POSITION.getValue()); leadtemperatureSI.setDisplayField(RestDatasourceFieldEnum.T_LEADTEMPERATURE__NAME.getValue()); leadtemperatureLGF.setEditorProperties(leadtemperatureSI); usedFields.add(leadtemperatureLGF);
So my next thought is: Do I need to use a singleton for my RestDataSource-subclass?
Is this correct, and if so, is it documented somewhere?
Thank you & Best regards
Blama
Comment