Search in sources :

Example 6 with MobileSmartSource

use of com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource in project convertigo by convertigo.

the class MobilePickerComposite method getSmartSourceString.

public String getSmartSourceString() {
    try {
        Filter filter = getFilter();
        String projectName = currentMC.getProject().getName();
        MobileSmartSource cmss = MobileSmartSource.valueOf(currentSource);
        String input = cmss == null ? "" : cmss.getInput();
        String path = getModelPath();
        String searchPath = "root";
        int index = path.indexOf(searchPath);
        if (index != -1) {
            path = path.substring(index + searchPath.length());
        }
        SourceModel model = MobileSmartSource.emptyModel(filter);
        model.setCustom(t_custom.getText());
        model.setPrefix(t_prefix.getText());
        model.setSuffix(t_suffix.getText());
        model.setUseCustom(b_custom.getSelection());
        model.setSourceData(getModelData());
        model.setPath(path);
        JSONObject jsonModel = model.toJson();
        // System.out.println(jsonModel.toString(1));
        MobileSmartSource nmss = new MobileSmartSource(filter, projectName, input, jsonModel);
        // System.out.println(nmss.toJsonString(1));
        return nmss.toJsonString();
    } catch (Exception e) {
        return "";
    }
}
Also used : SourceModel(com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.SourceModel) MobileSmartSource(com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource) JSONObject(org.codehaus.jettison.json.JSONObject) Filter(com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.Filter) PartInitException(org.eclipse.ui.PartInitException) JSONException(org.codehaus.jettison.json.JSONException)

Aggregations

MobileSmartSource (com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource)6 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)3 TVObject (com.twinsoft.convertigo.eclipse.views.mobile.MobilePickerContentProvider.TVObject)3 MobileComponentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileComponentTreeObject)3 MobilePageComponentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePageComponentTreeObject)3 MobileUIComponentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject)3 JSONException (org.codehaus.jettison.json.JSONException)3 JSONObject (org.codehaus.jettison.json.JSONObject)3 PartInitException (org.eclipse.ui.PartInitException)3 MobileObject (com.twinsoft.convertigo.beans.core.MobileObject)2 RequestableObject (com.twinsoft.convertigo.beans.core.RequestableObject)2 DesignDocument (com.twinsoft.convertigo.beans.couchdb.DesignDocument)2 Filter (com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.Filter)2 MobileSmartSourceType (com.twinsoft.convertigo.beans.mobile.components.MobileSmartSourceType)2 UIActionStack (com.twinsoft.convertigo.beans.mobile.components.UIActionStack)2 UIComponent (com.twinsoft.convertigo.beans.mobile.components.UIComponent)2 UIDynamicAction (com.twinsoft.convertigo.beans.mobile.components.UIDynamicAction)2 UISharedComponent (com.twinsoft.convertigo.beans.mobile.components.UISharedComponent)2 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)2 ToolItem (org.eclipse.swt.widgets.ToolItem)2