Example #1
0
        /// <summary>
        /// 선택된 ViewKind를 화면에 표시
        /// </summary>
        /// <param name="viewKind"></param>
        private void OpenView(ViewKind viewKind)
        {
            switch (viewKind)
            {
            case ViewKind.None:
                this.dicViews[ViewKind.None].BringToFront();
                break;

            case ViewKind.OrderView19201080:
                this.dicViews[ViewKind.OrderView19201080].BringToFront();
                this.btnOrderMenu.CheckedValue = true;
                break;

            case ViewKind.ResultView:
                this.dicViews[ViewKind.ResultView].BringToFront();
                this.btnOrderResultMenu.CheckedValue = true;
                break;

            case ViewKind.DevMonView:
                this.dicViews[ViewKind.DevMonView].BringToFront();
                this.btnDevMonMenu.CheckedValue = true;
                break;

            default:
                break;
            }
        }
Example #2
0
        /// <summary>
        /// ViewKind 화면을 숨긴다
        /// </summary>
        /// <param name="viewKind"></param>
        private void CloseView(ViewKind viewKind)
        {
            switch (viewKind)
            {
            case ViewKind.None:
                this.dicViews[ViewKind.None].SendToBack();
                break;

            case ViewKind.OrderView19201080:
                this.dicViews[ViewKind.OrderView19201080].SendToBack();
                this.btnOrderMenu.CheckedValue = false;
                break;

            case ViewKind.ResultView:
                this.dicViews[ViewKind.ResultView].SendToBack();
                this.btnOrderResultMenu.CheckedValue = false;
                break;

            case ViewKind.DevMonView:
                this.dicViews[ViewKind.DevMonView].SendToBack();
                this.btnDevMonMenu.CheckedValue = false;
                break;

            default:
                break;
            }
        }
Example #3
0
    private void ShowBasicFunctions()
    {
        if (GUI.Button(GetMiddleRect1(), "ShowNotice"))
        {
            message = string.Empty;
            Didomi.GetInstance().Reset();
            Didomi.GetInstance().ShowNotice();
            message += "ShowNotice";
        }

        if (GUI.Button(GetMiddleRect2(), "ShowPreferences"))
        {
            message = string.Empty;
            Didomi.GetInstance().Reset();
            Didomi.GetInstance().ShowPreferences();
            message += "showPreferences";
        }

        if (GUI.Button(GetMiddleRect3(), "Reset"))
        {
            message = string.Empty;
            Didomi.GetInstance().Reset();
            message += "Reset called";
        }

        if (GUI.Button(GetMiddleRect4(), "More Functions"))
        {
            uiStyle = ViewKind.Detailed;
        }
    }
Example #4
0
 protected ViewTestBase(ViewKind viewKind)
 {
     this.workbook = new Workbook(new TestDatabaseContext(), new TestSettings());
     this.folder   = this.workbook.AddFolder("f1");
     this.view     = ViewFactory.BuildView(this.Workbook, new SystemView {
         ViewKind = viewKind
     });
 }
Example #5
0
        /// <summary>
        /// cover 메뉴 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void topLeftNameLabel_MouseDown(object sender, MouseEventArgs e)
        {
            if (this.currentViewKind == ViewKind.None)
            {
                return;
            }

            btnOrderMenu.CheckedValue       = false;
            btnOrderResultMenu.CheckedValue = false;
            btnDevMonMenu.CheckedValue      = false;
            this.OpenView(ViewKind.None);
            this.currentViewKind = ViewKind.None;
        }
Example #6
0
        public ViewGenerationOptions([NotNull] string className, [NotNull] string baseClassName, ViewKind kind)
        {
            if (string.IsNullOrWhiteSpace(className))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(className));
            }
            if (string.IsNullOrWhiteSpace(baseClassName))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(baseClassName));
            }

            ClassName     = className;
            BaseClassName = baseClassName;
            LifecycleMethodAccessModifier = kind == ViewKind.Activity ? "protected" : "public";
            ParametersSourceName          = kind == ViewKind.Activity ? "Intent" : "Arguments";
            ResultCodeTypeName            = kind == ViewKind.Activity ? "Android.App.Result" : "int";
            Kind = kind;
        }
        public ActionData(ActionData refAction, ClassData classData, string viewID, ViewKind viewKind, string sequence)
        {
            ID = refAction.ID + "_" + viewKind.ToString().ToLower();
            Parent = classData;

            Data = new Dictionary<string, object>();

            Data["model"] = "ir.actions.act_window.view";
            Data["name"] = "";
            Data["view_id"] = viewID;
            Data["domain"] = "";
            Data["context"] = "";
            Data["sequence"] = sequence;
            Data["view_id"] = "";
            Data["res_model"] = "";
            Data["view_type"] = "";
            Data["target"] = "";
            Data["view_mode"] = viewKind.ToString().ToLower();
            Data["search_view_id"] = "";
            Data["act_window_id"] = refAction.ID;
        }
        public ActionData(ActionData refAction, ClassData classData, string viewID, ViewKind viewKind, string sequence)
        {
            ID     = refAction.ID + "_" + viewKind.ToString().ToLower();
            Parent = classData;

            Data = new Dictionary <string, object>();

            Data["model"]          = "ir.actions.act_window.view";
            Data["name"]           = "";
            Data["view_id"]        = viewID;
            Data["domain"]         = "";
            Data["context"]        = "";
            Data["sequence"]       = sequence;
            Data["view_id"]        = "";
            Data["res_model"]      = "";
            Data["view_type"]      = "";
            Data["target"]         = "";
            Data["view_mode"]      = viewKind.ToString().ToLower();
            Data["search_view_id"] = "";
            Data["act_window_id"]  = refAction.ID;
        }
Example #9
0
    private void Update()
    {
        if (_CurrentView == ViewKind.Begin || _CurrentView == ViewKind.Space)
        {
            return;
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (introAnim.state == PlayState.Playing)
            {
                if (introAnim.time < 33)
                {
                    introAnim.time = 33.3;
                }
                return;
            }


            CurrentView = CurrentView == ViewKind.Science ? ViewKind.Turret : CurrentView == ViewKind.Bridge ? ViewKind.Science : ViewKind.Bridge;
        }
    }
Example #10
0
        /// <summary>
        /// Top 메뉴 클릭 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOrderMenu_MouseDown(object sender, MouseEventArgs e)
        {
            NCasButton btnSelect      = sender as NCasButton;
            ViewKind   selectViewKind = (ViewKind)btnSelect.Tag;

            btnOrderMenu.CheckedValue       = false;
            btnOrderResultMenu.CheckedValue = false;
            btnDevMonMenu.CheckedValue      = false;

            if (selectViewKind == this.currentViewKind)
            {
                if (btnSelect.CheckedValue == false)
                {
                    btnSelect.CheckedValue = true;
                }

                return;
            }

            this.OpenView(selectViewKind);
            this.currentViewKind = selectViewKind;
        }
        public static string addFormGroup(ClassData classData, GroupData groupData, string decalage, bool first, ViewKind viewKind)
        {
            string render = "";

            if (classData != null)
            {
                if ((first) && (classData.StateWorkflow))
                {
                    render = "\t\t\t\t" + decalage + "<h1 colspan=\"" + classData.Columns + "\" col=\"" + classData.Columns + "\">\r\n";

                    foreach (KeyValuePair<string, string> state in classData.StateProperty.SelectionData.ListOfValues)
                    {
                        Program.ProjectData.addTraduction(classData, state.Value);
                        Program.ProjectData.addTraduction(classData, classData.Alias + " : " + state.Value);

                        render += "\t\t\t\t\t" + decalage + "<label string=\"" + Utils.ReplaceSpecialChar(classData.Alias + " : " + state.Value) + "\" attrs=\"{'invisible':[('state', 'not in', ['" + state.Key + "'])]}\"/>\r\n";
                    }

                    render += "\t\t\t\t" + decalage + "</h1>\r\n";
                }
            }

            render += "\t\t\t\t" + decalage + "<group colspan=\"" + groupData.ClassData.Columns + "\" col=\"" + groupData.ClassData.Columns + "\">\r\n";

            if (!groupData.Label.Equals("default"))
            {
                if (!first) render += "\t\t\t\t" + decalage + "<newline/>\r\n";
                render += "\t\t\t\t" + decalage + "<separator string=\"" + groupData.Label + "\" colspan=\"" + groupData.ClassData.Columns + "\"/>\r\n";
            }

            render += addGroupProperties(groupData, decalage + "\t", viewKind);

            int columns = int.Parse(groupData.ClassData.Columns);
            if ((groupData.ListOfProperties.Count < 3) && (columns >= 4))
            {
                int n = columns - groupData.ListOfProperties.Count * 2;
                render += "\t\t\t\t" + decalage + "<label colspan=\"" + n.ToString() + "\" string=\"\"/>\r\n";
            }

            render += "\t\t\t\t" + decalage + "</group>\r\n";

            render += addGroupPages(groupData.ListOfPages, decalage, viewKind);

            /*if ((!groupData.Report) && (groupData.Root))
            {
                render += addWidgetFormGroup(classData, groupData, decalage + "\t");
            }*/

            return render;
        }
 public static string addFormGroup(GroupData groupData, string decalage, bool first, ViewKind viewKind)
 {
     return addFormGroup(null, groupData, decalage, first, viewKind);
 }
Example #13
0
 public static void ChangeView(ViewKind view)
 {
     CurrentView = view;
 }
Example #14
0
        public FolderItemViewModel(IWorkbook workbook, IAbstractFolder folder)
        {
            if (workbook == null)
            {
                throw new ArgumentNullException(nameof(workbook));
            }
            if (folder == null)
            {
                throw new ArgumentNullException(nameof(folder));
            }

            this.workbook             = workbook;
            this.settings             = workbook.Settings;
            this.settings.KeyChanged += this.OnSettingsKeyChanged;
            this.folder = folder;

            this.setTargetGroupCommand = new RelayCommand <string>(taskGroup => this.SelectedTaskGroup = TaskGroupConverter.FromName(taskGroup));
            this.contextualCommand     = new RelayCommand(this.ContextualCommandExecute);

            this.showFutureStartDates = this.workbook.Settings.GetValue <bool>(CoreSettings.ShowFutureStartDates);
            this.isDatesGrouped       = this.workbook.Settings.GetValue <bool>(CoreSettings.UseGroupedDates);
            this.hideCompletedTasks   = this.workbook.Settings.GetValue <CompletedTaskMode>(CoreSettings.CompletedTasksMode) == CompletedTaskMode.Hide;

            ISystemView view = this.folder as ISystemView;

            if (view != null)
            {
                this.viewKind = view.ViewKind;
            }
            else if (this.folder is ViewSearch)
            {
                this.viewKind = ViewKind.Search;
            }
            else
            {
                this.viewKind = ViewKind.None;
            }

            this.trackedTasks = new List <ITask>();

            this.folder.TaskAdded   += (s, e) => this.AddTask(e.Item);
            this.folder.TaskRemoved += (s, e) => this.RemoveTask(e.Item);

            this.folder.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "Name")
                {
                    this.RaisePropertyChanged("Name");
                }
                else if (e.PropertyName == "TaskCount" && this.folder.HasCustomCommand)
                {
                    this.RaisePropertyChanged("HasContextualCommand");
                }
            };

            this.folder.GroupingChanged += (s, e) =>
            {
                this.smartCollection.GroupBuilder = GroupBuilderFactory.GetGroupBuilder(this.folder, this.settings);
                this.RaisePropertyChanged("DisplayFolder");
                this.RaisePropertyChanged("DisplayDue");
            };

            // the last parameter is a function which returns the folder associated with a task
            // when we group by folder, it's the folder of the task
            // otherwise (most of the time), it's the folder of this ViewModel
            this.smartCollection = new SmartCollection <ITask>(
                this.folder.Tasks,
                GroupBuilderFactory.GetGroupBuilder(this.folder, this.workbook.Settings),
                this.TaskFilter,
                this,
                task => this.folder);

            foreach (var task in this.folder.Tasks)
            {
                this.StartTrackingTask(task);
            }
        }
Example #15
0
    private void ShowGroupButtons()
    {
        if (GUI.Button(GetGoBackRect(), "Go to Basic Functions View"))
        {
            uiStyle = ViewKind.Basic;
        }

        if (GUI.Button(GetLeftRect1(), "Notice"))
        {
            functionCategory = FunctionCategory.Notice;
        }

        if (GUI.Button(GetMiddleRect1(), "Preferences"))
        {
            functionCategory = FunctionCategory.Preferences;
        }

        if (GUI.Button(GetRightRect1(), "Purpose-1"))
        {
            functionCategory = FunctionCategory.Purpose_1;
        }

        if (GUI.Button(GetLeftRect2(), "Purpose-2"))
        {
            functionCategory = FunctionCategory.Purpose_2;
        }

        if (GUI.Button(GetMiddleRect2(), "Vendor-1"))
        {
            functionCategory = FunctionCategory.Vendor_1;
        }

        if (GUI.Button(GetRightRect2(), "Vendor-2"))
        {
            functionCategory = FunctionCategory.Vendor_2;
        }

        if (GUI.Button(GetLeftRect3(), "Consent-1"))
        {
            functionCategory = FunctionCategory.Consent_1;
        }

        if (GUI.Button(GetMiddleRect3(), "Consent-2"))
        {
            functionCategory = FunctionCategory.Consent_2;
        }

        if (GUI.Button(GetRightRect3(), "Consent-3"))
        {
            functionCategory = FunctionCategory.Consent_3;
        }

        if (GUI.Button(GetLeftRect4(), "Language"))
        {
            functionCategory = FunctionCategory.Language;
        }

        if (GUI.Button(GetMiddleRect4(), "Initialization"))
        {
            functionCategory = FunctionCategory.Initialization;
        }

        if (GUI.Button(GetRightRect4(), "Events"))
        {
            functionCategory = FunctionCategory.Events;
        }

        if (GUI.Button(GetLeftRect5(), "Legitimate"))
        {
            functionCategory = FunctionCategory.Legitimate;
        }

        if (GUI.Button(GetMiddleRect5(), "GetUserStatus"))
        {
            functionCategory = FunctionCategory.GetUserStatus;
        }

        if (GUI.Button(GetRightRect5(), "Tests"))
        {
            functionCategory = FunctionCategory.Tests;
        }
    }
        private static string addGroupPages(Dictionary<string, PageData> pages, string decalage, ViewKind viewKind)
        {
            string render = "";

            if (pages.Count > 0)
            {
                string Columns = "6";

                ClassData classData = null;
                foreach (KeyValuePair<string, PageData> page in pages)
                {
                    foreach (KeyValuePair<string, GroupData> group in page.Value.ListOfGroups)
                    {
                        classData = group.Value.ClassData;

                        if (classData != null) break;
                    }

                    if (classData != null) break;
                }

                if (classData != null) Columns = classData.Columns;

                render += "\t\t\t\t" + decalage + "<notebook colspan=\"" + Columns + "\">\r\n";

                foreach (KeyValuePair<string, PageData> page in pages)
                {
                    render += "\t\t\t\t" + decalage + "\t" + "<page string=\"" + Utils.ReplaceSpecialChar(page.Value.Label) + "\">\r\n";

                    bool first = true;
                    foreach (KeyValuePair<string, GroupData> groupData in page.Value.ListOfGroups)
                    {
                        render += addFormGroup(groupData.Value, decalage + "\t\t", first, viewKind);
                        first = false;
                    }

                    render += "\t\t\t\t" + decalage + "\t" + "</page>\r\n";
                }

                render += "\t\t\t\t" + decalage + "</notebook>\r\n";
            }

            return render;
        }
        private static string addGroupProperties(GroupData groupData, string decalage, ViewKind viewKind)
        {
            string render = "";
            List<PropertyData> properties = groupData.ListOfProperties;
            List<PropertyData> oe_properties = new List<PropertyData>();

            if ((groupData.Root) && (!groupData.Report))
            {
                List<PropertyData> no_oe_properties = new List<PropertyData>();
                foreach (PropertyData propertyData in properties)
                {
                    if (!propertyData.ShowInView)
                    {
                        continue;
                    }

                    if (propertyData.OEtitle > 0)
                    {
                        oe_properties.Add(propertyData);
                    }
                    else
                    {
                        no_oe_properties.Add(propertyData);
                    }
                }

                if (oe_properties.Count > 0)
                {
                    List<PropertyData> oe = new List<PropertyData>(oe_properties.Count);
                    foreach (PropertyData propertyData in oe_properties)
                    {
                        oe.Add(null);
                    }

                    foreach (PropertyData propertyData in oe_properties)
                    {
                        oe[propertyData.OEtitle - 1] = propertyData;
                    }
                    oe_properties = oe;

                    render += "\t\t\t\t" + decalage + "<group colspan=\"" + groupData.ClassData.Columns + "\" col=\"1\">\r\n";
                    render += "\t\t\t\t\t" + decalage + "<div class=\"oe_title\">\r\n";
                    render += "\t\t\t\t\t\t" + decalage + "<div class=\"oe_edit_only\">\r\n";

                    render += "\t\t\t\t\t\t\t" + decalage;

                    string suite = ", ";
                    for (int i = 0; i < oe_properties.Count; i++)
                    {
                        if (i == oe_properties.Count - 2)
                        {
                            suite = " et ";
                        }

                        if (i == oe_properties.Count - 1)
                        {
                            suite = "";
                        }

                        //render += "\t\t\t\t\t\t\t" + decalage + "<label for=\"" + oe_properties[i].Name + "\"/>" + suite + "\r\n";
                        render += "<b>" + oe_properties[i].Alias + "</b>" + suite;
                    }

                    render += "\r\n";

                    render += "\t\t\t\t\t\t" + decalage + "</div>\r\n";
                    render += "\t\t\t\t\t\t" + decalage + "<h1>\r\n";
                    render += "\t\t\t\t\t\t\t" + decalage + "<field name=\"" + oe_properties[0].Name + "\" default_focus=\"1\" placeholder=\"" +  Utils.ReplaceSpecialChar(oe_properties[0].Alias) + "\"/>\r\n";
                    render += "\t\t\t\t\t\t" + decalage + "</h1>\r\n";

                    for (int i = 1; i < oe_properties.Count; i++)
                    {
                        PropertyData propertyData = oe_properties[i];

                        if (!propertyData.Typage.Equals("many2many") && !propertyData.Typage.Equals("one2many"))
                        {
                            string nolabel = /*(propertyData.ShowLabel) ? "" :*/ " nolabel=\"1\"";

                            string colspan = "";
                            string unwritable = "";
                            string onchange = "";
                            string states = "";

                            if (!viewKind.Equals(ViewKind.ReportFilter))
                            {
                                //colspan = (propertyData.ColSpan.Equals("")) ? " colspan=\"2\"" : " colspan=\"" + propertyData.ColSpan + "\"";
                                unwritable = (propertyData.Readonly.Equals("")) ? "" : " readonly=\"" + propertyData.Readonly + "\"";
                                onchange = (propertyData.OnChange.Equals("")) ? "" : " on_change=\"" + propertyData.OnChange + "\"";
                                states = (propertyData.States.Equals("")) ? "" : " states=\"" + propertyData.States + "\"";
                            }

                            string select = (propertyData.Select.Equals("")) ? "" : " select=\"" + propertyData.Select + "\"";

                            string default_focus = "";
                            if (propertyData.Name.Equals("name"))
                            {
                                default_focus = " default_focus=\"1\"";
                            }

                            //render += "\t\t\t\t\t" + decalage + "<label for=\"" + propertyData.Name + "\"/>\r\n";
                            render += "\t\t\t\t\t" + decalage + "<field name=\"" + propertyData.Name + "\" placeholder=\"" + Utils.ReplaceSpecialChar(propertyData.Alias) + "\" " + nolabel + select + colspan + unwritable + onchange + states + default_focus + "/>\r\n";

                            if (propertyData.Name.Equals("code"))
                            {
                                //render += "\t\t\t\t" + decalage + "<label colspan=\"4\"/>\r\n";
                                //render += "\t\t\t\t" + decalage + "<separator colspan=\"" + classData.Columns + "\"/>\r\n";
                                //render += "\t\t\t\t" + decalage + "<newline/>\r\n";
                            }
                        }
                    }

                    render += "\t\t\t\t\t" + decalage + "</div>\r\n";
                    render += "\t\t\t\t\t" + decalage + "<div style='border:1'></div>\r\n";
                    render += "\t\t\t\t" + decalage + "</group>\r\n";
                    render += "\t\t\t\t" + decalage + "<separator colspan=\"" + groupData.ClassData.Columns + "\" style=\"border-top: 1px solid gainsboro;\"/>\r\n";

                    properties = no_oe_properties;
                }
            }

            List<PropertyData> maxuse_properties = new List<PropertyData>();
            foreach (PropertyData propertyData in properties)
            {
                if (!propertyData.MaxUse.Equals(""))
                {
                    maxuse_properties.Add(propertyData);
                }
            }

            foreach (PropertyData propertyData in properties)
            {
                if (!propertyData.Typage.Equals("many2many") && !propertyData.Typage.Equals("one2many"))
                {
                    string nolabel = (propertyData.ShowLabel) ? "" : " nolabel=\"1\"";

                    string colspan = "";
                    string unwritable = "";
                    string onchange = "";
                    string states = "";

                    if (!viewKind.Equals(ViewKind.ReportFilter))
                    {
                        colspan = (propertyData.ColSpan.Equals("")) ? " colspan=\"2\"" : " colspan=\"" + propertyData.ColSpan + "\"";
                        unwritable = (propertyData.Readonly.Equals("")) ? "" : " readonly=\"" + propertyData.Readonly + "\"";
                        onchange = (propertyData.OnChange.Equals("")) ? "" : " on_change=\"" + propertyData.OnChange + "\"";
                        states = (propertyData.States.Equals("")) ? "" : " states=\"" + propertyData.States + "\"";
                    }

                    string select = (propertyData.Select.Equals("")) ? "" : " select=\"" + propertyData.Select + "\"";

                    string default_focus = "";
                    if (propertyData.Name.Equals("name"))
                    {
                        default_focus = " default_focus=\"1\"";
                    }

                    if (!propertyData.MaxUse.Equals(""))
                    {
                        string[] maxuse = propertyData.MaxUse.Split(new char[] { '.' });

                        onchange = " on_change=\"onchange_" + propertyData.Name + "(" + maxuse[0] + "_id, " + propertyData.Name + ")\"";

                        render += "\t\t\t\t" + decalage + "<label for=\"" + propertyData.Name + "\"/>\r\n";
                        render += "\t\t\t\t" + decalage + "<div>\r\n";
                        render += "\t\t\t\t\t" + decalage + "<field name=\"" + propertyData.Name + "\"" + nolabel + select + unwritable + onchange + states + default_focus + "/>\r\n";
                        render += "\t\t\t\t\t" + decalage + "<field name=\"" + propertyData.Name + "_label\"/>\r\n"; //string=\"Valeur maximum autorisee : \"/>\r\n";
                        render += "\t\t\t\t" + decalage + "</div>\r\n";
                    }
                    else
                    {
                        if (propertyData.Typage.Equals("many2one"))
                        {
                            foreach (PropertyData propData in maxuse_properties)
                            {
                                string[] maxuse = propData.MaxUse.Split(new char[] { '.' });
                                string[] linkmanyclass = propertyData.LinkManyClass.Split(new char[] { '.' });

                                if (maxuse[0].Equals(linkmanyclass[1]))
                                {
                                    onchange = " on_change=\"onchange_" + propertyData.Name + "(" + propertyData.Name + ", " + propData.Name + ")\"";
                                }
                            }
                        }

                        render += "\t\t\t\t" + decalage + "<field name=\"" + propertyData.Name + "\"" + nolabel + select + colspan + unwritable + onchange + states + default_focus + "/>\r\n";
                    }
                    
                    if (propertyData.Name.Equals("code"))
                    {
                        //render += "\t\t\t\t" + decalage + "<label colspan=\"4\"/>\r\n";
                        //render += "\t\t\t\t" + decalage + "<separator colspan=\"" + classData.Columns + "\"/>\r\n";
                        //render += "\t\t\t\t" + decalage + "<newline/>\r\n";
                    }
                }
            }

            foreach (KeyValuePair<string, GroupData> group in groupData.ListOfGroups)
            {
                render += addFormGroup(group.Value, "\t\t", false, viewKind);
            }

            foreach (PropertyData propertyData in properties)
            {
                if (propertyData.Typage.Equals("many2many"))
                {
                    string colspan = (propertyData.ColSpan.Equals("")) ? " colspan=\"" + groupData.ClassData.Columns + "\"" : " colspan=\"" + propertyData.ColSpan + "\"";
                    string unwritable = (propertyData.Readonly.Equals("")) ? "" : " readonly=\"" + propertyData.Readonly + "\"";
                    string onchange = (propertyData.OnChange.Equals("")) ? "" : " on_change=\"" + propertyData.OnChange + "\"";
                    string select = (propertyData.Select.Equals("")) ? "" : " select=\"" + propertyData.Select + "\"";
                    string states = (propertyData.States.Equals("")) ? "" : " states=\"" + propertyData.States + "\"";

                    if (propertyData.ShowLabel)
                    {
                        render += "\t\t\t\t" + decalage + "<newline/>\r\n";
                        render += "\t\t\t\t" + decalage + "<separator string=\"" + Utils.ReplaceSpecialChar(propertyData.Alias) + "\"" + colspan + "/>\r\n";
                    }

                    //render += "\t\t\t\t" + decalage + "<field name=\"" + propertyData.Name + "\"" + colspan + unwritable + onchange + " nolabel=\"1\"/>\r\n";

                    render += "\t\t\t\t" + decalage + "<field" + colspan + " name=\"" + propertyData.Name + "\" nolabel=\"1\" widget=\"one2many_list\"" + select + states + unwritable + onchange +">\r\n";

                    if (propertyData.ClassLink != null)
                    {
                        if (!propertyData.ClassLink.Parent.Native)
                        {
                            render += "\t\t\t\t\t" + decalage + "<form string=\"" + Utils.ReplaceSpecialChar(propertyData.Alias) + "\">\r\n";

                            foreach (PropertyData prop in propertyData.ClassLink.ListOfProperties)
                            {
                                if (!prop.Name.Equals(propertyData.ClassLink.Name + "_id"))
                                {
                                    if (prop.ShowInTree)
                                    {
                                        render += "\t\t\t\t\t\t" + decalage + "<field name=\"" + prop.Name + "\"/>\r\n";
                                    }
                                }
                            }

                            render += "\t\t\t\t\t" + decalage + "</form>\r\n";
                        }
                    }

                    render += "\t\t\t\t" + decalage + "</field>\r\n";
                }
            }

            foreach (PropertyData propertyData in properties)
            {
                if (propertyData.Typage.Equals("one2many"))
                {
                    string colspan = (propertyData.ColSpan.Equals("")) ? " colspan=\"" + groupData.ClassData.Columns + "\"" : " colspan=\"" + propertyData.ColSpan + "\"";
                    string unwritable = (propertyData.Readonly.Equals("")) ? "" : " readonly=\"" + propertyData.Readonly + "\"";
                    string onchange = (propertyData.OnChange.Equals("")) ? "" : " on_change=\"" + propertyData.OnChange + "\"";
                    string select = (propertyData.Select.Equals("")) ? "" : " select=\"" + propertyData.Select + "\"";
                    string states = (propertyData.States.Equals("")) ? "" : " states=\"" + propertyData.States + "\"";

                    if (propertyData.ShowLabel)
                    {
                        render += "\t\t\t\t" + decalage + "<newline/>\r\n";
                        render += "\t\t\t\t" + decalage + "<separator string=\"" + Utils.ReplaceSpecialChar(propertyData.Alias) + "\"" + colspan + "/>\r\n";
                    }

                    //render += "\t\t\t\t" + decalage + "<field name=\"" + propertyData.Name + "\"" + colspan + " nolabel=\"1\"/>\r\n";

                    if ((propertyData.ClassLink != null) && (!propertyData.ClassLink.Parent.Native))
                    {
                        if (!states.Equals(""))
                        {
                            states = "";

                            if (!propertyData.Readonly.Equals("1"))
                            {
                                string[] sts = propertyData.States.Split(new char[] { ',' });
                                string st = "";
                                for (int i = 0; i < sts.Length; i++)
                                {
                                    st = "'" + sts[i].Trim() + "'" + ((i == sts.Length - 1)? "":",");
                                }

                                unwritable = " attrs=\"{'readonly':[('state', 'not in', (" + st + "))]}\"";
                            }
                        }
                    }

                    render += "\t\t\t\t" + decalage + "<field" + colspan + " name=\"" + propertyData.Name + "\" nolabel=\"1\" widget=\"one2many_list\"" + select + states + unwritable + onchange + ">\r\n";

                    if (propertyData.ClassLink != null)
                    {
                        if (!propertyData.ClassLink.Parent.Native)
                        {
                            string editable = "";

                            if (propertyData.TreeEditable)
                            {
                                editable = " editable=\"top\"";
                            }

                            render += "\t\t\t\t\t" + decalage + "<tree string=\"" + Utils.ReplaceSpecialChar(propertyData.Alias) + "\"" + editable + ">\r\n";

                            foreach (PropertyData prop in propertyData.ClassLink.ListOfProperties)
                            {
                                if ((!prop.Name.Equals(propertyData.ClassLink.Name + "_id")) && (!prop.Name.Equals(propertyData.Parent.Name + "_id")))
                                {
                                    if (prop.ShowInTree)
                                    {
                                        render += "\t\t\t\t\t\t" + decalage + "<field name=\"" + prop.Name + "\"/>\r\n";
                                    }
                                }
                            }

                            render += "\t\t\t\t\t" + decalage + "</tree>\r\n";
                        }
                    }

                    render += "\t\t\t\t" + decalage + "</field>\r\n";
                }
            }

            return render;
        }
        public static void RenderPropertyPy(ClassData classData, PropertyData propertyData, ref string fields, ref string defaults, ViewKind viewKind)
        {
            if (!propertyData.Name.Equals(classData.Name + "_id"))
            {
                fields += (fields.Equals(string.Empty)) ? "" : "\r\n\t\t";

                string fieldName = propertyData.Name;
                string fieldTypage = propertyData.Typage;
                string fieldSelection = (!propertyData.Selection.Equals(string.Empty)) ? propertyData.Selection + ", " : "";
                string fieldAlias = "\"" + propertyData.Alias + "\"";

                string fieldSize = (!propertyData.Size.Equals(string.Empty)) ? ", size=" + propertyData.Size : "";
                fieldSize = ((fieldSize.Equals(string.Empty)) && (fieldTypage.Equals("char"))) ? ", size=64" : fieldSize;
                fieldSize = (!(fieldSize.Equals(string.Empty)) && (fieldTypage.Equals("reference"))) ? ", " + propertyData.Size : fieldSize;

                string fieldRequired = "";
                string fieldOndelete = "";
                string fieldTranslate = "";
                string fieldReadonly = "";
                string fieldMemory = "";
                string fieldDomain = "";

                string fieldFunction = "";

                if (!viewKind.Equals(ViewKind.ReportFilter))
                {
                    if (classData.Inherit == null)
                    {
                        fieldRequired = (!propertyData.Required.Equals(string.Empty)) ? ", required=" + propertyData.Required : "";
                    }

                    fieldOndelete = (!propertyData.Ondelete.Equals(string.Empty)) ? ", ondelete='" + propertyData.Ondelete + "'" : "";
                    fieldTranslate = (!propertyData.Translate.Equals(string.Empty)) ? ", translate=" + propertyData.Required : "";
                    fieldReadonly = (!propertyData.Readonly.Equals(string.Empty)) ? ", readonly=" + propertyData.Readonly : "";
                    fieldMemory = (!propertyData.Memory.Equals(string.Empty)) ? ", store=" + ((propertyData.Memory.Equals("True")) ? "False" : "True") : "";

                    if (!propertyData.Domain.Equals(string.Empty))
                    {
                        string[] domains = propertyData.Domain.Split(new char[]{','});

                        string domain = "[";

                        for (int i = 0; i < domains.Length; i++)
                        {
                            string[] parts = Regex.Split(domains[i], "(=|!=)");

                            domain += "(";
                            domain += "'" + parts[0] + "',";
                            domain += "'" + parts[1] + "',";
                            domain += "'" + parts[2] + "'";
                            domain += ")";

                            if (i < domains.Length - 1)
                            {
                                domain += ",";
                            }
                        }

                        domain += "]";

                        fieldDomain = ", domain=" + domain;
                    }

                    if (!propertyData.Function.Equals(string.Empty))
                    {
                        string fieldFunctionType = Utils.GetFunctionName(propertyData.Function);
                        fieldFunction = "fields.function(_" + fieldName + "_" + fieldFunctionType + ", type='" + fieldTypage + "', string=" + Utils.ReplaceSpecialChar(fieldAlias) + ", method=True)";
                    }
                }

                string fieldDocumentation = (!propertyData.Documentation.Equals(string.Empty)) ? ", help=\"" + propertyData.Documentation.Trim().Replace("\n", "").Replace("\r", "") + "\"" : "";

                string fieldLink = "";
                if ((new List<string>(new string[] { "many2one", "one2many", "many2many" })).IndexOf(propertyData.Typage) >= 0)
                {
                    switch (propertyData.Typage)
                    {
                        case "many2one":
                        {
                            fieldLink = "'" + propertyData.LinkManyClass + "', ";
                            break;
                        }

                        case "one2many":
                        {
                            fieldLink = "'" + propertyData.LinkManyClass + "', '" + propertyData.LinkManyId1 + "', ";
                            break;
                        }

                        case "many2many":
                        {
                            fieldLink = "'" + propertyData.LinkManyClass + "', '" + propertyData.LinkManyRel + "', '" + propertyData.LinkManyId1 + "', '" + propertyData.LinkManyId2 + "', ";
                            break;
                        }
                    }
                }

                if (fieldFunction.Equals(string.Empty))
                {
                    fields += "'" + fieldName + "' : fields." + fieldTypage + "(" + fieldLink + fieldSelection + fieldAlias + fieldSize + fieldRequired + fieldTranslate + fieldReadonly + fieldOndelete + fieldDomain + fieldMemory + fieldDocumentation + "),";
                }
                else
                {
                    fields += "'" + fieldName + "' : " + fieldFunction + ",";
                }

                if ((fieldName.Equals("code")) && (classData.CodeProperty != null))
                {
                    defaults += (defaults.Equals(string.Empty)) ? "" : "\r\n\t\t";
                    defaults += "'" + fieldName + "': lambda self, cr, uid, context = {} : self.pool.get('ir.sequence').get(cr, uid, 'code." + classData.Name + "'),";
                }
                else if (propertyData.Default != null) 
                {
                    defaults += (defaults.Equals(string.Empty)) ? "" : "\r\n\t\t";
                    defaults += "'" + fieldName + "': " + CorrectTypeFormat(propertyData.Default, propertyData.Typage) + ",";
                }

                if (!propertyData.MaxUse.Equals(""))
                {
                    fields += "\r\n\t\t" + "'" + fieldName + "_label': fields.function(_" + fieldName + "_label, method=True, type='text', store=False),";

                    defaults += (defaults.Equals(string.Empty)) ? "" : "\r\n\t\t";
                    defaults += "'" + fieldName + "_label': _" + fieldName + "_label_init,";
                }
            }
        }
Example #19
0
        public static void RenderPropertyPy(ClassData classData, PropertyData propertyData, ref string fields, ref string defaults, ViewKind viewKind)
        {
            if (!propertyData.Name.Equals(classData.Name + "_id"))
            {
                fields += (fields.Equals(string.Empty)) ? "" : "\r\n\t\t";

                string fieldName      = propertyData.Name;
                string fieldTypage    = propertyData.Typage;
                string fieldSelection = (!propertyData.Selection.Equals(string.Empty)) ? propertyData.Selection + ", " : "";
                string fieldAlias     = "\"" + propertyData.Alias + "\"";

                string fieldSize = (!propertyData.Size.Equals(string.Empty)) ? ", size=" + propertyData.Size : "";
                fieldSize = ((fieldSize.Equals(string.Empty)) && (fieldTypage.Equals("char"))) ? ", size=64" : fieldSize;
                fieldSize = (!(fieldSize.Equals(string.Empty)) && (fieldTypage.Equals("reference"))) ? ", " + propertyData.Size : fieldSize;

                string fieldRequired  = "";
                string fieldOndelete  = "";
                string fieldTranslate = "";
                string fieldReadonly  = "";
                string fieldMemory    = "";
                string fieldDomain    = "";

                string fieldFunction = "";

                if (!viewKind.Equals(ViewKind.ReportFilter))
                {
                    if (classData.Inherit == null)
                    {
                        fieldRequired = (!propertyData.Required.Equals(string.Empty)) ? ", required=" + propertyData.Required : "";
                    }

                    fieldOndelete  = (!propertyData.Ondelete.Equals(string.Empty)) ? ", ondelete='" + propertyData.Ondelete + "'" : "";
                    fieldTranslate = (!propertyData.Translate.Equals(string.Empty)) ? ", translate=" + propertyData.Required : "";
                    fieldReadonly  = (!propertyData.Readonly.Equals(string.Empty)) ? ", readonly=" + propertyData.Readonly : "";
                    fieldMemory    = (!propertyData.Memory.Equals(string.Empty)) ? ", store=" + ((propertyData.Memory.Equals("True")) ? "False" : "True") : "";

                    if (!propertyData.Domain.Equals(string.Empty))
                    {
                        string[] domains = propertyData.Domain.Split(new char[] { ',' });

                        string domain = "[";

                        for (int i = 0; i < domains.Length; i++)
                        {
                            string[] parts = Regex.Split(domains[i], "(=|!=)");

                            domain += "(";
                            domain += "'" + parts[0] + "',";
                            domain += "'" + parts[1] + "',";
                            domain += "'" + parts[2] + "'";
                            domain += ")";

                            if (i < domains.Length - 1)
                            {
                                domain += ",";
                            }
                        }

                        domain += "]";

                        fieldDomain = ", domain=" + domain;
                    }

                    if (!propertyData.Function.Equals(string.Empty))
                    {
                        string fieldFunctionType = Utils.GetFunctionName(propertyData.Function);
                        fieldFunction = "fields.function(_" + fieldName + "_" + fieldFunctionType + ", type='" + fieldTypage + "', string=" + Utils.ReplaceSpecialChar(fieldAlias) + ", method=True)";
                    }
                }

                string fieldDocumentation = (!propertyData.Documentation.Equals(string.Empty)) ? ", help=\"" + propertyData.Documentation.Trim().Replace("\n", "").Replace("\r", "") + "\"" : "";

                string fieldLink = "";
                if ((new List <string>(new string[] { "many2one", "one2many", "many2many" })).IndexOf(propertyData.Typage) >= 0)
                {
                    switch (propertyData.Typage)
                    {
                    case "many2one":
                    {
                        fieldLink = "'" + propertyData.LinkManyClass + "', ";
                        break;
                    }

                    case "one2many":
                    {
                        fieldLink = "'" + propertyData.LinkManyClass + "', '" + propertyData.LinkManyId1 + "', ";
                        break;
                    }

                    case "many2many":
                    {
                        fieldLink = "'" + propertyData.LinkManyClass + "', '" + propertyData.LinkManyRel + "', '" + propertyData.LinkManyId1 + "', '" + propertyData.LinkManyId2 + "', ";
                        break;
                    }
                    }
                }

                if (fieldFunction.Equals(string.Empty))
                {
                    fields += "'" + fieldName + "' : fields." + fieldTypage + "(" + fieldLink + fieldSelection + fieldAlias + fieldSize + fieldRequired + fieldTranslate + fieldReadonly + fieldOndelete + fieldDomain + fieldMemory + fieldDocumentation + "),";
                }
                else
                {
                    fields += "'" + fieldName + "' : " + fieldFunction + ",";
                }

                if ((fieldName.Equals("code")) && (classData.CodeProperty != null))
                {
                    defaults += (defaults.Equals(string.Empty)) ? "" : "\r\n\t\t";
                    defaults += "'" + fieldName + "': lambda self, cr, uid, context = {} : self.pool.get('ir.sequence').get(cr, uid, 'code." + classData.Name + "'),";
                }
                else if (propertyData.Default != null)
                {
                    defaults += (defaults.Equals(string.Empty)) ? "" : "\r\n\t\t";
                    defaults += "'" + fieldName + "': " + CorrectTypeFormat(propertyData.Default, propertyData.Typage) + ",";
                }

                if (!propertyData.MaxUse.Equals(""))
                {
                    fields += "\r\n\t\t" + "'" + fieldName + "_label': fields.function(_" + fieldName + "_label, method=True, type='text', store=False),";

                    defaults += (defaults.Equals(string.Empty)) ? "" : "\r\n\t\t";
                    defaults += "'" + fieldName + "_label': _" + fieldName + "_label_init,";
                }
            }
        }
 public ViewModelInfo(ViewKind kind)
 {
     ViewKind = kind;
 }
Example #21
0
 public void ChangeView(int view)
 {
     CurrentView = (ViewKind)view;
 }
Example #22
0
 private void showView(ViewKind kind)
 {
     view = kind;
     MangaView.Visibility = (kind == ViewKind.MangaView || kind == ViewKind.OptionView).toVisibility();
     OptionsPage.Visibility = (kind == ViewKind.OptionView).toVisibility();
     StartScreen.Visibility = (kind == ViewKind.StartupView).toVisibility();
     btnOptions.IsEnabled = kind == ViewKind.MangaView;
     btnBack.IsEnabled = kind == ViewKind.MangaView;
     btnTranslate.Visibility = (book != null && book.HasTranslation).toVisibility();
     btnTranslate.IsEnabled = (kind == ViewKind.MangaView && book != null && book.HasTranslation && currentMangaPage.HasTranslation);
 }