Ejemplo n.º 1
0
            /// <summary>
            /// Adds a child widget to the parent
            /// </summary>
            /// <param name="dw">Widget to add</param>
            public void AddChild(DataWidget dw)
            {
                if (children == null)
                {
                    children = new List <DataWidget>();
                }

                children.Add(dw);
                SetupChildWidget(dw);
            }
Ejemplo n.º 2
0
    private void Start()
    {
        wid     = widgetobj.GetComponent <DataWidget>();
        handler = widgetparent.GetComponent <DataWidgetHandler>();

        handDraggable = widgetobj.GetComponent <HandDraggable>();

        // Dragging is off by default
        handDraggable.enabled = isDraggable;

        // When finished dragging, handDraggable should be disabled
        handDraggable.StoppedDragging += StopDragging;
    }
Ejemplo n.º 3
0
        public static DataBlock CreateDataBlock(ZBlockDescribe zBlockDescribe)
        {
            DataBlock dataBlock = new DataBlock();

            dataBlock.Title     = zBlockDescribe.BlockName;
            dataBlock.TitleTips = "0x" + zBlockDescribe.BlockWord.ToString("X");
            for (int i = 0; i < zBlockDescribe.ZParts.Length; i++)
            {
                DataWidget dataWidget = new DataWidget();
                dataWidget.Title      = zBlockDescribe.ZParts[i].Name;
                dataWidget.TitleTips  = zBlockDescribe.ZParts[i].DataType.ToString();
                dataWidget.TextTips   = zBlockDescribe.ZParts[i].ShowType.ToString();
                dataWidget.DataString = "0";
                dataBlock.AddDataWidget(dataWidget);
            }
            dataBlock.SetPartsWidth(100);
            return(dataBlock);
        }
Ejemplo n.º 4
0
        public StreamResponseAction ExportHtmlModel(string id)
        {
            try
            {
                _iD = id;
                InitObject();

                _datasetRenderer = new HtmlRenderer2(_dataStream.codemap, false);

                DataWidget.GetDownloadStream(_datasetRenderer, _dataStream, _textWriter);

                return(ExportFlush());
            }
            catch (Exception ex)
            {
                return(new StreamResponseAction(ex.Message));
            }
        }
Ejemplo n.º 5
0
        public StreamResponseAction ExportPdfModel(string id, string size, bool landscape)
        {
            try
            {
                _iD = id;
                InitObject();

                _datasetRenderer = new PdfRenderer(size, landscape, _dataStream.codemap);

                DataWidget.GetDownloadStream(_datasetRenderer, _dataStream, _memoryStream);

                return(ExportFlush());
            }
            catch (Exception ex)
            {
                return(new StreamResponseAction(ex.Message));
            }
        }
Ejemplo n.º 6
0
        public StreamResponseAction ExportXLS(string id, string separator)
        {
            try
            {
                _iD = id;
                InitObject();

                _datasetRenderer = new XlsRenderer(_dataStream.codemap, separator);

                DataWidget.GetDownloadStream(_datasetRenderer, _dataStream, _textWriter);

                return(ExportFlush());
            }
            catch (Exception ex)
            {
                return(new StreamResponseAction(ex.Message));
            }
        }
Ejemplo n.º 7
0
        public StreamResponseAction ExportCsvTabular(string id, string separator, bool withQuotation)
        {
            try
            {
                _iD = id;
                InitObject();

                _datasetRenderer = new CsvRenderer(separator, withQuotation);

                DataWidget.GetDownloadStream(_datasetRenderer, _dataStream, _textWriter);

                return(ExportFlush());
            }
            catch (Exception ex)
            {
                return(new StreamResponseAction(ex.Message));
            }
        }
            /// <summary>
            /// Builds a child widget for each label
            /// </summary>
            /// <param name="labels">List of all types to build</param>
            public void BuildChildren(string[] labels)
            {
                children = new List <DataWidgetHandler>();
                for (int i = 0; i < labels.Length; i++)
                {
                    //Vector3 position = new Vector3();
                    GameObject go = Instantiate(GenericDataWidgetObj, currentChild[i].transform);
                    go.transform.localPosition = Vector3.zero;
                    DataWidget        toAdd  = go.GetComponent <DataWidget>();
                    DataWidgetHandler toAdd2 = go.GetComponent <DataWidgetHandler>();
                    toAdd2.SetWidgetObjDistance(Random.Range(4f, 8f));

                    toAdd.SetLabel(labels[i]);

                    // TODO: remove this
                    toAdd2.graph.sprite = setGraph(labels[i]);

                    reader.AddChild(toAdd);
                    children.Add(toAdd2);
                    toAdd2.EnableWidget(false);
                }
            }
Ejemplo n.º 9
0
 /// <summary>
 /// Sets given child data widget to use the same Influx server info as its parent
 /// </summary>
 /// <param name="child">DataWidget child</param>
 private void SetupChildWidget(DataWidget child)
 {
     child.SetDBVals(measure, building, room);
 }