/// <summary> /// Renders the client component. /// </summary> /// <param name="config">Dynamic configuration object.</param> protected override void OnWebRender(dynamic config) { base.OnWebRender((object)config); IWisejComponent me = this; config.className = "wisej.web.ribbonBar.RibbonGroup"; config.showButton = this.ShowButton; config.visible = this.Visible; config.enabled = this.Enabled; config.label = TextUtils.EscapeText(this.Text, false, false, false); if (me.DesignMode) { if (me.IsNew || me.IsDirty) { config.controls = this.Items.Render(); } } else { if (me.IsNew || this.Items.IsDirty) { config.controls = this.Items.Render(); } config.wiredEvents = new WiredEvents(); config.wiredEvents.Add("buttonClick"); } }
/// <summary> /// Renders the client component. /// </summary> /// <param name="config">Dynamic configuration object.</param> protected override void OnWebRender(dynamic config) { base.OnWebRender((object)config); IWisejComponent me = this; config.className = "wisej.web.ribbonBar.RibbonPage"; config.enabled = this.Enabled; config.hidden = !this.Visible; config.tabTextColor = this.TabForeColor; config.tabBackgroundColor = this.TabBackColor; config.label = TextUtils.EscapeText(this.Text, false, this.UseMnemonic, false); config.mnemonic = this.UseMnemonic ? TextUtils.GeMnemonic(this.Text) : null; if (me.DesignMode) { if (me.IsNew || me.IsDirty) { config.controls = this.Groups.Render(); } } else { if (me.IsNew || this.Groups.IsDirty) { config.controls = this.Groups.Render(); } } }
/// <summary> /// Renders the client component. /// </summary> /// <param name="config">Dynamic configuration object.</param> protected override void OnWebRender(dynamic config) { base.OnWebRender((object)config); IWisejComponent me = this; config.className = "wisej.web.ribbonBar.ItemButton"; config.orientation = this.Orientation; config.pushed = this.Pushed; if (me.DesignMode) { config.showArrow = this.HasMenuItems; } else { if (this.HasMenuItems) { config.buttonMenu = ((IWisejComponent)this._menu).Id; config.wiredEvents.Add("itemClick(Item)"); } else { config.buttonMenu = null; config.wiredEvents.Add("execute"); } } }
/// <summary> /// Renders the client component. /// </summary> /// <param name="config">Dynamic configuration object.</param> protected override void OnWebRender(dynamic config) { base.OnWebRender((object)config); IWisejComponent me = this; // change the widget class name. config.className = "wisej.web.ext.SmoothieChart"; // render our new properties. config.fontSize = this.FontSize; config.borderStyle = this.BorderStyle; config.updateDelay = this.UpdateDelay; config.dataFrequency = this.DataFrequency; config.scrollSpeed = this.ScrollSpeed; config.verticalSections = this.VerticalSections; config.timeLineSpacing = this.TimeLineSpacing; config.showMinMaxLabels = this.ShowMinMaxLabels; config.showTimeStamps = this.ShowTimeStamps; config.interpolation = this.Interpolation; config.gridLineColor = this.GridLineColor; config.gridLineSize = this.GidLineSize; config.minValue = this.MinValue.HasValue ? (object)this.MinValue.Value : null; config.maxValue = this.MaxValue.HasValue ? (object)this.MaxValue.Value : null; if (me.IsNew || this.TimeSeries.IsDirty) { config.timeSeries = this.TimeSeries.Render(); } // register the web methods in the control. // wisej does it automatically only for top level controls: Page, Form, Desktop. config.webMethods = new[] { "GetData" }; }
/// <summary> /// Renders the additional properties for the specified component. /// </summary> /// <param name="component"></param> /// <returns></returns> dynamic IWisejExtenderProvider.RenderDesignMode(IWisejComponent component) { // don't do anything, implementing IWisejExtenderProvider is enough // to have this extender called at design time and add the icon control // to the column headers. return(null); }
/// <summary> /// Renders the client component. /// </summary> /// <param name="config">Dynamic configuration object.</param> protected override void OnWebRender(dynamic config) { IWisejComponent me = this; base.OnWebRender((object)config); config.className = "wisej.web.ext.PolymerComponent"; config.imports = this.Imports; }
/// <summary> /// Renders the list to the json definition for the client. /// </summary> /// <returns></returns> internal object Render() { lock (this) { object config = null; IWisejComponent owner = this.Owner; if (!owner.DesignMode) { // render the full list? bool isNew = (this.IsNew || owner.IsNew); if (!isNew && !this.IsDirty) { return(null); } } // reset the state of the list. this.IsNew = false; this.IsDirty = false; if (owner.DesignMode) { // in design mode we render the child components (the items) // directly into the parent's configuration package to render // them in one shot on the designer surface. List <dynamic> list = new List <dynamic>(); foreach (IWisejComponent item in this.items) { dynamic itemConfig = new DynamicObject(); item.DesignMode = true; item.Render(itemConfig); list.Add(itemConfig); } config = list; } else { // at runtime, we only render the ids of the items. // each button is a component by itself. List <string> list = new List <string>(); foreach (IWisejComponent item in this.items) { list.Add(item.Id); } config = list; } return(config); } }
/// <summary> /// Causes the control to update the corresponding client side widget. /// When in design mode, causes the rendered control to update its /// entire surface in the designer. /// </summary> public override void Update() { // when updating and refreshing (IsNew = true) // resend the focused cell and update the row selection. IWisejComponent me = this; if (me.IsNew) { Call("setText", TextUtils.EscapeText(this.Text, true)); } base.Update(); }
// Finds the child component, at any level, containing the specified coordinate. private IWisejComponent FindDesignChildComponent(Point location) { IWisejComponent target = null; var page = this.SelectedPage; if (page != null) { foreach (IWisejComponent group in page.Groups) { Rectangle groupRect = group.DesignRect; if (groupRect.Contains(location)) { target = group; // drill down to the items; foreach (IWisejComponent item in ((RibbonBarGroup)group).Items) { Rectangle itemRect = item.DesignRect; itemRect.Offset(groupRect.Left, 0); if (itemRect.Contains(location)) { target = item; if (item is RibbonBarItemButtonGroup) { foreach (IWisejComponent button in ((RibbonBarItemButtonGroup)item).Buttons) { Rectangle buttonRect = button.DesignRect; buttonRect.Offset(itemRect.Left, 0); if (buttonRect.Contains(location)) { target = button; break; } } } break; } } break; } } } return(target); }
private void OnDesignComponentSelectionChanged(object server, EventArgs e) { IWisejComponent target = this.DesignItem; if (target != null && this.Site != null) { var selectionService = (ISelectionService)this.Site.GetService(typeof(ISelectionService)); if (selectionService != null) { if (selectionService.GetComponentSelected(this)) { selectionService.SetSelectedComponents(new[] { target }); } } } }
/// <summary> /// Renders the client component. /// </summary> /// <param name="config">Dynamic configuration object.</param> protected override void OnWebRender(dynamic config) { IWisejComponent me = this; base.OnWebRender((object)config); config.className = "wisej.ext.WebWorker"; if (!me.DesignMode) { config.sourceUrl = this.GetPostbackURL() + "&v=" + this.version; WiredEvents events = new WiredEvents(); events.Add("postMessage(Data)"); config.wiredEvents = events; } }
/// <summary> /// Renders the client component. /// </summary> /// <param name="config">Dynamic configuration object.</param> protected override void OnWebRender(dynamic config) { base.OnWebRender((object)config); IWisejComponent me = this; config.className = "wisej.web.RibbonBar"; config.selectedIndex = this.SelectedPageIndex; // Tools. if (this._tools != null) { config.tools = this._tools.Render(); } if (me.DesignMode) { if (this._appButton != null) { dynamic appButtonConfig = new DynamicObject(); ((IWisejComponent)this._appButton).Render(appButtonConfig); config.appButton = appButtonConfig; } if (me.IsNew || me.IsDirty) { config.pages = this.Pages.Render(); } config.designItem = this.UserData.DesignItem; } else { config.appButton = ((IWisejComponent)this._appButton)?.Id; if (me.IsNew || this.Pages.IsDirty) { config.pages = this.Pages.Render(); } config.wiredEvents.Add("changePage(Page)", "toolClick(Tool)", "resize(Size)"); } }
/// <summary> /// Renders the client component. /// </summary> /// <param name="config">Dynamic configuration object.</param> protected override void OnWebRender(dynamic config) { base.OnWebRender((object)config); IWisejComponent me = this; config.className = "wisej.web.ribbonBar.ItemButtonGroup"; if (me.DesignMode) { if (me.IsNew || me.IsDirty) { config.buttons = this.Buttons.Render(); } } else { if (me.IsNew || this.Buttons.IsDirty) { config.buttons = this.Buttons.Render(); } } }
/// <summary> /// Sets the design-time metrics used by the designer to adapt the /// control on the screen to the HTML metrics used by the renderer. /// </summary> /// <param name="metrics">Design metrics from the renderer.</param> void IWisejControl.SetDesignMetrics(dynamic metrics) { if (metrics != null) { // retrieve the rectangles of the tab buttons. if (metrics.tabRects != null) { dynamic[] rects = metrics.tabRects; var tabRects = new Rectangle[rects.Length]; for (int i = 0; i < rects.Length; i++) { dynamic rect = rects[i]; tabRects[i] = new Rectangle(rect.left, rect.top, rect.width, rect.height); } this.UserData.DesignTabRects = tabRects; } // retrieve the rectangles of all the visible items. if (metrics.itemMetrics != null) { dynamic[] itemMetrics = metrics.itemMetrics; for (int i = 0; i < itemMetrics.Length; i++) { dynamic item = itemMetrics[i]; var id = item.id; var rect = item.rect; // find the ribbon item. IWisejComponent component = FindDesignChildComponent(id); if (component != null) { var designRect = new Rectangle(rect.left, rect.top, rect.width, rect.height); component.DesignRect = designRect; } } } } }
/// <summary> /// Renders the client component. /// </summary> /// <param name="config">Dynamic configuration object.</param> protected override void OnWebRender(dynamic config) { base.OnWebRender((object)config); IWisejComponent me = this; config.className = "wisej.web.ribbonBar.AppButton"; config.visible = this.Visible; config.label = TextUtils.EscapeText(this.Text, false, false, false); config.toolTipText = this.ToolTipText; config.textColor = this.ForeColor; config.backgroundColor = this.BackColor; if (this._imageSettings != null) { config.icon = this._imageSettings.GetSource("Image"); } if (!me.DesignMode) { config.wiredEvents = new WiredEvents(); config.wiredEvents.Add("execute"); } }
/// <summary> /// Renders the client component. /// </summary> /// <param name="config">Dynamic configuration object.</param> protected override void OnWebRender(dynamic config) { base.OnWebRender((object)config); IWisejComponent me = this; config.className = "wisej.web.ribbonBar.ItemControl"; config.orientation = this.Orientation; if (me.DesignMode) { if (this.Control != null) { dynamic controlConfig = new DynamicObject(); ((IWisejComponent)this.Control).Render(controlConfig); config.control = controlConfig; } } else { config.control = ((IWisejControl)this.Control)?.Id; config.wiredEvents.Add("controlResize(Size)"); } }
// Selects the RibbonBarGroup or RibbonBarItem at the coordinates specified in lParam. private bool SelectClickedItem(int lParam) { Point mouseLoc = new Point( (short)(lParam & 65535), (short)(lParam >> 16 & 65535)); // find clicks on a child item. var target = FindDesignChildComponent(mouseLoc); if (target != null && this.Site != null) { var selectionService = (ISelectionService)this.Site.GetService(typeof(ISelectionService)); if (selectionService != null) { selectionService.SelectionChanged -= this.OnDesignComponentSelectionChanged; selectionService.SelectionChanged += this.OnDesignComponentSelectionChanged; selectionService.SetSelectedComponents(new[] { target }); this.DesignItem = target; return(true); } } return(false); }