Example #1
0
        internal override void InitButtons()
        {
            fConnectButton = new ConnectToolboxButton();
            //RegisterToolItem(fConnectButton);
            //fConnectButton.LoginWindowSettings.fOwner = this;

            fMDXQueryButton = new MDXQueryButton();
            //RegisterToolItem(fMDXQueryButton);

            fAddCalcMeasureButton = new AddCalculatedMeasureButton {
                NeedSeparator = true
            };
            RegisterToolItem(fAddCalcMeasureButton);

            fSaveLayoutButton = new SaveLayoutToolboxButton();
            //RegisterToolItem(fSaveLayoutButton);

            fLoadLayoutButton = new LoadLayoutButton {
                NeedSeparator = true
            };
            //RegisterToolItem(fLoadLayoutButton);
            //fLoadLayoutButton.fFile.ID = "olaptlw_loadfile_" + fLoadLayoutButton.GetGridID();
            //Controls.Add(fLoadLayoutButton.fFile);

            fClearLayoutButton = new ClearLayoutToolboxButton();
            RegisterToolItem(fClearLayoutButton);

            fAllAreasButton = new AllAreasToolboxButton();
            RegisterToolItem(fAllAreasButton);

            fPivotAreaButton = new PivotAreaToolboxButton();
            RegisterToolItem(fPivotAreaButton);

            fDataAreaButton = new DataAreaToolboxButton {
                NeedSeparator = true
            };
            RegisterToolItem(fDataAreaButton);

            fMeasurePlaceButton = new MeasurePlaceToolboxButton {
                NeedSeparator = true
            };
            RegisterToolItem(fMeasurePlaceButton);

            fZoomOutButton = new ScaleDecreaseButton();
            RegisterToolItem(fZoomOutButton);

            fZoomInButton = new ScaleIncreaseButton();
            RegisterToolItem(fZoomInButton);

            fResetZoomButton = new ScaleResetButton {
                NeedSeparator = true
            };
            RegisterToolItem(fResetZoomButton);

            FModeButton = new ModeButton {
                NeedSeparator = true
            };
            RegisterToolItem(FModeButton);

            fResizingButton = new ResizingButton {
                NeedSeparator = true
            };
            RegisterToolItem(fResizingButton);

            fDelayPivotingButton = new DelayPivotingButton();
            RegisterToolItem(fDelayPivotingButton);
        }
Example #2
0
        internal void RenderButtons(HtmlTextWriter writer)
        {
            var needSeparator          = false;
            var beginRenderAreaButtons = false;
            ClearLayoutToolboxButton clearLayoutButton = null;

            foreach (var button in fToolItems.Values)
            {
                if (button.Visible)
                {
                    if (button is AllAreasToolboxButton ||
                        button is PivotAreaToolboxButton ||
                        button is DataAreaToolboxButton ||
                        button is ClearLayoutToolboxButton)
                    {
                        if (button is ClearLayoutToolboxButton)
                        {
                            clearLayoutButton = button as ClearLayoutToolboxButton;
                        }

                        if (beginRenderAreaButtons == false)
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Style, "margin-right: 1px");
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "rs_layout_toolbox_button");
                            writer.AddAttribute(HtmlTextWriterAttribute.Title, RadarUtils.GetResStr("toolbox_Button_Layout"));
                            writer.RenderBeginTag(HtmlTextWriterTag.Button);

                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ui-icon-font ui-icon-font-template");
                            writer.RenderBeginTag(HtmlTextWriterTag.Span);
                            writer.RenderEndTag(); // span
                            writer.RenderEndTag(); // button

                            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
                            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
                            writer.AddStyleAttribute(HtmlTextWriterStyle.ZIndex, "1000");
                            writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "rs_layout_menu ui-widget-content");
                            writer.RenderBeginTag(HtmlTextWriterTag.Div);

                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "rs_layout_toolbox_menu");
                            writer.RenderBeginTag(HtmlTextWriterTag.Ul);
                            beginRenderAreaButtons = true;
                        }

                        if (button.NeedSeparator)
                        {
                            needSeparator = true;
                        }

                        if (button is ClearLayoutToolboxButton)
                        {
                            continue;
                        }

                        button.RenderContents(writer);

                        if (fToolItems.Values.Count - 1 != fToolItems.Keys.ToList().IndexOf(button.ButtonID))
                        {
                            continue;
                        }
                    }

                    if (beginRenderAreaButtons)
                    {
                        if (clearLayoutButton != null)
                        {
                            writer.RenderBeginTag("li");
                            writer.RenderEndTag();//li
                            clearLayoutButton.RenderContents(writer);
                        }

                        writer.RenderEndTag(); //ul
                        writer.RenderEndTag(); //div

                        if (needSeparator)
                        {
                            RenderSeparator(writer);
                        }

                        needSeparator          = false;
                        beginRenderAreaButtons = false;

                        if (fToolItems.Values.Count - 1 == fToolItems.Keys.ToList().IndexOf(button.ButtonID))
                        {
                            break;
                        }
                    }

                    if ((button is ConnectToolboxButton || button is MDXQueryButton) &&
                        MDCube == null)
                    {
                        continue;
                    }

                    if ((button == fZoomOutButton ||
                         button == fZoomInButton ||
                         button == fResetZoomButton) &&
                        OlapControl.AnalysisType != AnalysisType.Chart)
                    {
                        continue;
                    }

                    if (button == fResizingButton && OlapControl.AnalysisType == AnalysisType.Chart)
                    {
                        continue;
                    }

                    if (button == FModeButton && !(OlapControl is OlapAnalysis))
                    {
                        continue;
                    }

                    if (button is MeasurePlaceToolboxButton && OlapControl.AnalysisType == AnalysisType.Chart)
                    {
                        continue;
                    }

                    button.RenderContents(writer);
                    if (button.NeedSeparator)
                    {
                        RenderSeparator(writer);
                    }
                }
            }

            if (CustomButtons.Count > 0)
            {
                foreach (var cb in CustomButtons)
                {
                    cb.fOwner = this;
                    if (cb.Visible)
                    {
                        cb.RenderContents(writer);
                    }
                    if (cb.NeedSeparator)
                    {
                        RenderSeparator(writer);
                    }
                }
            }
        }