private void AddWindow() { Window window = new Window(); window.ID = "SystemCodeAdd"; window.Title = "字典信息管理"; window.Width = Unit.Pixel(400); window.Height = Unit.Pixel(280); window.Modal = true; window.Collapsible = true; window.Maximizable = false; window.Resizable = false; window.Hidden = true; window.AutoLoad.Mode = LoadMode.Merge; FormPanel tabs = new FormPanel(); tabs.ID = "TabPanel1"; tabs.IDMode = IDMode.Explicit; tabs.Border = false; tabs.Width = Unit.Pixel(400); tabs.Closable = true; tabs.DefaultAnchor = "100%"; Ext.Net.Panel tab = new Ext.Net.Panel(); tab.Title = "代码表"; tab.Padding = 5; tabs.Add(tab); TextField tx = CommonExt.AddTextField("txtECodeType", "代码类型"); tx.Text = Session["CodeId"] as string; tab.Items.Add(tx); tx.ReadOnly = true; tab.Items.Add(CommonExt.AddTextField("txtECodeId", "代码值")); tab.Items.Add(CommonExt.AddTextField("txtECodeDesc", "代码描述")); tab.Items.Add(CommonExt.AddTextField("txtECodeRemark", "备注")); tab.Items.Add(CommonExt.AddCheckbox("chkEIsUse", "是否启用")); Toolbar toolbar = new Ext.Net.Toolbar(); ToolbarFill toolbarFill = new ToolbarFill(); toolbar.Add(toolbarFill); window.BottomBar.Add(toolbar); CommonExt.AddButton(toolbar, "butSaveEdit", "保存", "Disk", "SystemCode.InfoSave()"); CommonExt.AddButton(toolbar, "butCancelEdit", "取消", "Cancel", window.ClientID + ".hide()"); window.Items.Add(tabs); window.Render(this.Form); window.Show(); }
public void AddWindow(string popMsg) { try { Window window = new Window(); window.ID = "ChartShow"; window.Title = "统计信息详细信息"; window.Width = Unit.Pixel(820); window.Height = Unit.Pixel(600); window.Modal = true; window.Collapsible = true; window.Maximizable = false; window.Resizable = false; window.Hidden = true; window.AutoLoad.Mode = LoadMode.Merge; Ext.Net.Panel tabs = new Ext.Net.Panel(); tabs.ID = "TabPanel1"; tabs.IDMode = IDMode.Explicit; tabs.Border = false; Ext.Net.Panel tab = new Ext.Net.Panel(); tab.Title = "统计信息"; tab.Padding = 5; tab.AnchorHorizontal = "100%"; tabs.Add(tab); string[] strs = popMsg.Split(','); double[] data = GetRowData(int.Parse(strs[1])); ChartDirector.WebChartViewer webChartViewer = new ChartDirector.WebChartViewer(); Bll.Common.CreateCurvelineChart(webChartViewer, data, "小时", "识别率%", strs[0] + " - 识别率曲线"); webChartViewer.Visible = true; tab.ContentControls.Add(webChartViewer); Toolbar toolbar = new Ext.Net.Toolbar(); ToolbarFill toolbarFill = new ToolbarFill(); toolbar.Add(toolbarFill); window.BottomBar.Add(toolbar); CommonExt.AddButton(toolbar, "butCancel", "退出", "Cancel", window.ClientID + ".hide()"); window.Items.Add(tabs); window.Render(this.Form); window.Show(); } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("PassCarOcrCount.aspx-AddWindow", ex.Message + ";" + ex.StackTrace, "AddWindow has an exception"); } }
protected override void OnInit(EventArgs e) { this._panel = new Panel(); this._panel.ID = "_panelImages"; this._panel.AutoScroll = true; this._panel.BodyPadding = 8; Toolbar item = new Toolbar(); Ext.Net.Button component = new Ext.Net.Button { Text = "选择文件", ID = "_btnSelectFile" }; item.Add(component); Ext.Net.Button button2 = new Ext.Net.Button { ID = "_btnRemoveFileFromAll", Text = "清空" }; Ext.Net.Button button3 = new Ext.Net.Button { Text = "上传", ID = "_btnStartUpload", Handler = "window.startUpload();" }; button2.Handler = "window.btnRemoveAll_click();"; item.Add(button2); item.Add(button3); this._panel.TopBar.Add(item); this.Items.Add(this._panel); this._hdn.Style.Add("display", "none"); this._hdn.Listeners.Change.Fn = "window.updateFileUrl"; this._hdn.Value = string.Join(",", new string[] { this.Files }); this.Items.Add(this._hdn); this.FieldLabel = "图片"; this.Layout = "fit"; this._panel.Layout = "column"; if (!Ext.Net.X.IsAjaxRequest) { this.AddScript(Resource .uploader.Replace("{uploadUrl}", this.UploadUrl).Replace("{fieldName}", this._hdn.ID)); } this.ID = null; base.OnInit(e); }
public override void ModifyTree(TreePanel treePanel, IMainInterface mainInterface) { if (!Context.Current.Resolve<GlobalizationSection>().Enabled) return; // Setup tree bottom toolbar. Toolbar bottomToolbar = new Toolbar(); treePanel.BottomBar.Add(bottomToolbar); ToolbarTextItem textItem = new ToolbarTextItem { Text = "Language: " }; bottomToolbar.Items.Add(textItem); IconCombo comboBox = new IconCombo { EmptyText = "Select...", Width = Unit.Pixel(100), Editable = false }; comboBox.Listeners.Select.Handler = string.Format(@" Ext.net.DirectMethods.LanguageChooser.ChangeLanguage(record.get('value'), {{ url: '{0}', success: function(result) {{ stbStatusBar.setStatus({{ text: 'Changed language', iconCls: '', clear: true }}); }} }});", Context.AdminManager.GetAdminDefaultUrl()); foreach (Language language in Context.Current.Resolve<ILanguageManager>().GetAvailableLanguages()) { IconComboListItem listItem = new IconComboListItem(language.Title, language.Name, language.IconUrl); comboBox.Items.Add(listItem); if (language.Name == Context.AdminManager.CurrentAdminLanguageBranch) { comboBox.SelectedItem.Text = listItem.Text; comboBox.SelectedItem.Value = listItem.Value; } } bottomToolbar.Items.Add(comboBox); }
/// <summary> /// 显示修改窗体 /// </summary> private void AddWindowModify() { Window window = new Window(); window.ID = "UserModify"; window.Title = "密码修改"; window.Width = Unit.Pixel(400); window.Height = Unit.Pixel(200); window.Modal = true; window.Collapsible = true; window.Maximizable = false; window.Resizable = false; window.Hidden = true; window.AutoLoad.Mode = LoadMode.Merge; Ext.Net.Panel tabs = new Ext.Net.Panel(); tabs.ID = "TabPanel1"; tabs.IDMode = IDMode.Explicit; tabs.Border = false; Ext.Net.Panel tab = new Ext.Net.Panel(); tab.Title = ""; tab.Padding = 5; tab.Height = 120; tabs.Add(tab); tab.Items.Add(CommonExt.AddTextFieldPassword("txtMFirstPassWord", "初始密码", false)); tab.Items.Add(CommonExt.AddTextFieldPassword("txtMPassWord", "新密码", false)); tab.Items.Add(CommonExt.AddTextFieldPassword_Confirm("txtMConfirmPassWord", "重复密码", false, "txtMPassWord")); Toolbar toolbar = new Ext.Net.Toolbar(); ToolbarFill toolbarFill = new ToolbarFill(); toolbar.Add(toolbarFill); window.BottomBar.Add(toolbar); CommonExt.AddButton(toolbar, "butSaveEdit2", "保存", "Disk", "UserManager.UpdateData()"); CommonExt.AddButton(toolbar, "butCancelEdit2", "取消", "Cancel", window.ClientID + ".hide()"); window.Items.Add(tabs); window.Render(this.Form); window.Show(); }
private Toolbar GetTopBar() { Toolbar tb = new Toolbar(); tb.Plugins.Add(new BoxReorderer() { Listeners = { Drop = { Handler = "var p = container.ownerCt; p.down('dataview').store.sort(p.getSorters());" } } }); tb.Items.Add(new ToolbarTextItem() { Text = "Sort on these fields:", CustomConfig = { new ConfigItem("reordable", "false", ParameterMode.Raw) } }); tb.Items.Add(new SortButton() { Text = "Type", DataIndex = "type" }); tb.Items.Add(new SortButton() { Text = "Name", DataIndex = "name" }); return tb; }
public override void ModifyInterface(IMainInterface mainInterface) { // Add tree. TreePanel treePanel = new TreePanel { ID = "stpNavigation", Width = 200, Icon = Icon.SitemapColor, Title = "Site", AutoScroll = true, PathSeparator = "|", EnableDD = true, UseArrows = true, BodyStyle = "padding-top:5px", Region = Region.West, MinWidth = 175, MaxWidth = 400, Split = true, CollapseFirst = false }; mainInterface.Viewport.Items.Add(treePanel); // Setup tree top toolbar. Toolbar topToolbar = new Toolbar(); treePanel.TopBar.Add(topToolbar); TriggerField filterField = new TriggerField { EnableKeyEvents = true, Width = 100, EmptyText = "Filter..." }; filterField.Triggers.Add(new FieldTrigger { Icon = TriggerIcon.Clear, HideTrigger = true }); filterField.Listeners.KeyUp.Fn = "keyUp"; filterField.Listeners.KeyUp.Buffer = 100; filterField.Listeners.TriggerClick.Fn = "clearFilter"; topToolbar.Items.Add(filterField); topToolbar.Items.Add(new ToolbarFill()); Button refreshButton = new Button { Icon = Icon.Reload }; refreshButton.ToolTips.Add(new ToolTip { Html = "Refresh" }); refreshButton.Listeners.Click.Handler = string.Format("{0}.getLoader().load({0}.getRootNode());", treePanel.ClientID); topToolbar.Items.Add(refreshButton); Button expandAllButton = new Button { IconCls = "icon-expand-all" }; expandAllButton.ToolTips.Add(new ToolTip { Html = "Expand All" }); expandAllButton.Listeners.Click.Handler = string.Format("{0}.expandAll();", treePanel.ClientID); topToolbar.Items.Add(expandAllButton); Button collapseAllButton = new Button { IconCls = "icon-collapse-all" }; collapseAllButton.ToolTips.Add(new ToolTip { Html = "Collapse All" }); collapseAllButton.Listeners.Click.Handler = string.Format("{0}.collapseAll();", treePanel.ClientID); topToolbar.Items.Add(collapseAllButton); topToolbar.Items.Add(new ToolbarSeparator()); Window helpWindow = new Window { Modal = true, Icon = Icon.Help, Title = "Help", Hidden = true, Html = "This is the site tree. You can use this to view all the pages on your site. Right-click any item to edit or delete it, as well as create additional pages.<br /><br />The main branches of the root node tree are the main sections of the admin system. Each section is broken down into smaller sections, accessed by expanding the + sign. (Wherever you see a + sign, the section can be broken down into further sections).<br /><br />When you receive your admin system, you will notice the first main section (after the Root Node) will be divided into the main sections of your website. (Example sections may include: Homepage, About Us, News, Links and Contact pages.) To see these pages, as they appear on the website, simply click the relevant node – it will then appear in the right hand pane.", BodyStyle = "padding:5px", Width = 300, Height = 200, AutoScroll = true }; mainInterface.AddControl(helpWindow); Button helpButton = new Button(); helpButton.Icon = Icon.Help; helpButton.ToolTips.Add(new ToolTip { Html = "Help" }); helpButton.Listeners.Click.Handler = string.Format("{0}.show();", helpWindow.ClientID); topToolbar.Items.Add(helpButton); // Data loader. var treeLoader = new Ext.Net.TreeLoader { DataUrl = Context.Current.Resolve<IEmbeddedResourceManager>().GetServerResourceUrl(GetType().Assembly, "Zeus.Admin.Plugins.Tree.TreeLoader.ashx"), PreloadChildren = true }; treeLoader.Listeners.Load.Handler = "if (response.getResponseHeader['Content-Type'] == 'text/html; charset=utf-8') { Ext.Msg.alert('Timeout', 'Your session has timed out. Please refresh your browser to login again.'); }"; treePanel.Loader.Add(treeLoader); // Call tree modification plugins and load tree plugin user controls. foreach (ITreePlugin treePlugin in Context.Current.ResolveAll<ITreePlugin>()) { string[] requiredUserControls = treePlugin.RequiredUserControls; if (requiredUserControls != null) mainInterface.LoadUserControls(requiredUserControls); treePlugin.ModifyTree(treePanel, mainInterface); } if (!ExtNet.IsAjaxRequest) { TreeNodeBase treeNode = SiteTree.Between(Find.StartPage, Find.RootItem, true) .OpenTo(Find.StartPage) .Filter(items => items.Authorized(Context.Current.WebContext.User, Context.SecurityManager, Operations.Read)) .ToTreeNode(true); treePanel.Root.Add(treeNode); } }
public void OpenZonesPanel(int id) { ContentItem contentItem = Engine.Persister.Get(id); TreePanel treePanel = new TreePanel { ID = "trpManageZones", Icon = Icon.ApplicationSideBoxes, Title = contentItem.Title + " Zones", Region = Region.East, AutoScroll = true, UseArrows = true, RootVisible = false, BodyStyle="padding-top:5px", Split = true, MinWidth = 150, Width = 175, MaxWidth = 300, Collapsible = true, CloseAction = CloseAction.Close, EnableDD = true }; IMainInterface mainInterface = (IMainInterface) Page; mainInterface.Viewport.Items.Add(treePanel); treePanel.Tools.Add(new Tool(ToolType.Close, "panel.hide(); " + mainInterface.Viewport.ClientID + ".doLayout();", string.Empty)); // Setup tree top toolbar. var topToolbar = new Toolbar(); treePanel.TopBar.Add(topToolbar); var addButton = new Button { ID = "addButton", Icon = Icon.Add, Disabled = true }; addButton.ToolTips.Add(new ToolTip { Html = "Add New Widget" }); addButton.Listeners.Click.Fn = "function(button) { top.zeus.reloadContentPanel('New Widget', " + treePanel.ClientID + ".getSelectionModel().getSelectedNode().attributes['newItemUrl']); }"; topToolbar.Items.Add(addButton); treePanel.Listeners.Click.Handler = "Ext.getCmp('" + addButton.ClientID + "').setDisabled(node.isLeaf());"; if (Engine.SecurityManager.IsAuthorized(contentItem, Context.User, Operations.Delete)) { var deleteButton = new Button { ID = "deleteButton", Icon = Icon.Delete, Disabled = true }; deleteButton.ToolTips.Add(new ToolTip { Html = "Delete Widget" }); deleteButton.Listeners.Click.Fn = string.Format(@" function(button) {{ var node = {0}.getSelectionModel().getSelectedNode(); stbStatusBar.showBusy('Deleting...'); Ext.net.DirectMethods.ManageZones.DeleteWidget(node.id, {{ url : '{1}', success: function() {{ node.parentNode.removeChild(node); stbStatusBar.setStatus({{ text: 'Deleted Widget', iconCls: '', clear: true }}); top.zeus.reloadContentPanel('Preview', '{2}'); }} }}); }}", treePanel.ClientID, Engine.AdminManager.GetAdminDefaultUrl(), contentItem.Url); topToolbar.Items.Add(deleteButton); treePanel.Listeners.Click.Handler += "Ext.getCmp('" + deleteButton.ClientID + "').setDisabled(!node.isLeaf());"; } treePanel.Listeners.MoveNode.Handler = string.Format(@" {0}.showBusy(); Ext.net.DirectMethods.ManageZones.MoveWidget(node.id, newParent.id, index, {{ url: '{1}', success: function() {{ {0}.setStatus({{ text: 'Moved Widget', iconCls: '', clear: true }}); }} }})", mainInterface.StatusBar.ClientID, Engine.AdminManager.GetAdminDefaultUrl()); ContentType definition = Zeus.Context.ContentTypes.GetContentType(contentItem.GetType()); var rootNode = new TreeNode { Expanded = true }; foreach (var availableZone in definition.AvailableZones) { var zoneNode = new TreeNode { NodeID = availableZone.ZoneName, Expanded = true, IconFile = Utility.GetCooliteIconUrl(Icon.ApplicationSideList), Text = availableZone.Title, Leaf = false }; zoneNode.CustomAttributes.Add(new ConfigItem("newItemUrl", GetPageUrl(typeof(ManageZonesUserControl), "Zeus.Admin.Plugins.NewItem.Default.aspx") + "?selected=" + contentItem.Path + "&zoneName=" + availableZone.ZoneName, ParameterMode.Value)); rootNode.Nodes.Add(zoneNode); foreach (var widget in GetItemsInZone(contentItem, availableZone)) { var widgetNode = new TreeNode { NodeID = widget.ID.ToString(), Leaf = true, Text = widget.Title, IconFile = widget.IconUrl, Href = string.Format("javascript: top.zeus.reloadContentPanel('Edit', '{0}');", GetPageUrl(typeof(ManageZonesUserControl), "Zeus.Admin.Plugins.EditItem.Default.aspx") + "?selected=" + widget.Path) }; zoneNode.Nodes.Add(widgetNode); } } treePanel.Root.Add(rootNode); treePanel.Render(); }
private void CreateToolbar() { Toolbar topToolbar = new Toolbar(); Button addItemButton = new Button("Add Item") { ID = ID + "btnAdd", Icon = Icon.Add }; Menu addItemButtonMenu = new Menu(); IEnumerable<ContentType> allowedChildren = GetAllowedChildren(); foreach (ContentType definition in allowedChildren) { MenuItem menuItem = new MenuItem(definition.ContentTypeAttribute.Title) { IconUrl = definition.IconUrl }; menuItem.DirectEvents.Click.ExtraParams["Type"] = string.Format("{0},{1}", definition.ItemType.FullName, definition.ItemType.Assembly.FullName); menuItem.DirectEvents.Click.Event += OnAddItemClick; addItemButtonMenu.Items.Add(menuItem); } addItemButton.Menu.Add(addItemButtonMenu); topToolbar.Items.Add(addItemButton); _removeItemsButton = new Button("Remove Item(s)") { ID = ID + "btnRemoveItems", Icon = Icon.Delete, Disabled = true }; _removeItemsButton.DirectEvents.Click.ExtraParams.Add(new Parameter("DeletedItems", string.Format(@" (function() {{ var gridPanel = {0}; var selections = gridPanel.getSelectionModel().getSelections(); var selectedIndexes = []; for (var i = 0; i < selections.length; i++) selectedIndexes.push(gridPanel.getStore().indexOf(selections[i])); return selectedIndexes.join(','); }}).call(this)", ClientID), ParameterMode.Raw)); _removeItemsButton.DirectEvents.Click.Event += OnRemoveItemsClick; _removeItemsButton.DirectEvents.Click.Success = string.Format(@"flagRemovedItems({0});", ClientID); topToolbar.Items.Add(_removeItemsButton); TopBar.Add(topToolbar); }
protected void Page_Load(object sender, EventArgs e) { tree.ID = "TreePanel1"; tree.Width = Unit.Pixel(300); tree.Height = Unit.Pixel(450); tree.Icon = Icon.BookOpen; tree.AutoScroll = true; Ext.Net.Button btnExpand = new Ext.Net.Button(); btnExpand.Text = "Expand All"; btnExpand.Listeners.Click.Handler = tree.ClientID + ".expandAll();"; Ext.Net.Button btnCollapse = new Ext.Net.Button(); btnCollapse.Text = "Collapse All"; btnCollapse.Listeners.Click.Handler = tree.ClientID + ".collapseAll();"; Toolbar toolBar = new Toolbar(); toolBar.ID = "Toolbar1"; toolBar.Items.Add(btnExpand); toolBar.Items.Add(btnCollapse); tree.TopBar.Add(toolBar); StatusBar statusBar = new StatusBar(); statusBar.AutoClear = 1000; tree.BottomBar.Add(statusBar); tree.Listeners.Click.Handler = statusBar.ClientID + ".setStatus({text: 'Node Selected: <b>' + node.text + '</b>', clear: true});"; tree.Listeners.ExpandNode.Handler = statusBar.ClientID + ".setStatus({text: 'Node Expanded: <b>' + node.text + '</b>', clear: true});"; tree.Listeners.ExpandNode.Delay = 30; tree.Listeners.CollapseNode.Handler = statusBar.ClientID + ".setStatus({text: 'Node Collapsed: <b>' + node.text + '</b>', clear: true});"; Ext.Net.TreeNode root = new Ext.Net.TreeNode("Composers"); root.Expanded = true; tree.Root.Add(root); List<Composer> composers = this.GetData(); foreach (Composer composer in composers) { Ext.Net.TreeNode composerNode = new Ext.Net.TreeNode(composer.Name, Icon.UserGray); root.Nodes.Add(composerNode); foreach (Composition composition in composer.Compositions) { Ext.Net.TreeNode compositionNode = new Ext.Net.TreeNode(composition.Type.ToString()); composerNode.Nodes.Add(compositionNode); foreach (Piece piece in composition.Pieces) { Ext.Net.TreeNode pieceNode = new Ext.Net.TreeNode(piece.Title, Icon.Music); compositionNode.Nodes.Add(pieceNode); } } } }
private Panel CreatePanel(Control itemEditor, int id) { var panel = new Panel { ID = ID + "_panel_" + id, IDMode = IDMode.Legacy, Header = false, BodyStyle = "padding:5px", StyleSpec = "margin-bottom:10px;" }; var toolbar = new Toolbar(); panel.TopBar.Add(toolbar); //toolbar.Items.Add(new Button { Icon = Icon.ArrowNsew }); toolbar.Items.Add(new ToolbarFill()); var deleteButton = new Button { ID = ID + "_deleteButton_" + id, IDMode = IDMode.Legacy, Icon = Icon.Delete, Text = @"Delete " + ItemTitle, CausesValidation = false }; deleteButton.DirectEvents.Click.Event += OnDeleteButtonDirectClick; deleteButton.DirectEvents.Click.ExtraParams.Add(new Parameter("ID", id.ToString())); toolbar.Items.Add(deleteButton); panel.ContentControls.Add(itemEditor); return panel; }
protected override void OnLoad(EventArgs e) { if (this._nodeHelper == null) { _nodeHelper = new NodeHelper(Table); } TreeStore.Config config = new TreeStore.Config { NodeParam = "parentId" }; this._treeStore = new TreeStore(config); this._treeStore.ID = "_treeStore"; Model model = new Model { Fields = { new ModelField("Id", ModelFieldType.String), new ModelField("Name", ModelFieldType.String), new ModelField("ParentId", ModelFieldType.String) } }; model.Fields.AddRange(this._nodeHelper.CustomFields); this._treeStore.Model.Add(model); this._treeStore.Proxy.Add(new PageProxy()); this.Store.Add(this._treeStore); this._treeStore.ReadData += new TreeStoreBase.ReadDataEventHandler(this.treeStore_ReadData); base.RemoteRemove += new TreePanel.RemoteRemoveEventHandler(this.TreePanelEx_RemoteRemove); base.RemoteEdit += new TreePanel.RemoteEditEventHandler(this.TreePanelEx_RemoteEdit); base.RemoteMove += new TreePanel.RemoteMoveEventHandler(this.TreePanelEx_RemoteMove); Ext.Net.Button button = new Ext.Net.Button { Text = "刷新", Handler = "App." + this.ID + ".getStore().load();" }; Toolbar toolbar = new Toolbar(); toolbar.Items.Add(button); this.TopBar.Add(toolbar); if (!Ext.Net.X.IsAjaxRequest) { //base.Listeners.NodeDragOver.Handler = "var recs = dragData.records;var prev=-1;for(var i=0;i<recs.length;i++){var recData=recs[i].data;if(prev==-1){prev=recData.Level;}else{if(prev!=recData.Level){return false;}}}if(targetNode.data.Level>=" + this.Level + ")return false;return true;"; Parameter parameters = new Parameter { Name = "parentId", Value = "arguments[1].data.parentId", Mode = ParameterMode.Raw }; this.RemoteExtraParams.Add(parameters); this.On("beforeRemoteAction", new JFunction("Ext.net.Mask.show({ msg : '正在加载' });")); JFunction fn = new JFunction("Ext.net.Mask.hide();"); this.On("remoteActionRefusal", fn); this.On("remoteActionException", fn); this.On("remoteActionSuccess", fn); this.On("remoteEditRefusal", new JFunction("Ext.Msg.alert('失败了')")); this._treeStore.On("beforeload", new JFunction("Ext.net.Mask.show({ msg : '正在加载' });")); this._treeStore.On("load", new JFunction("Ext.net.Mask.hide();")); Ext.Net.Node node = new Ext.Net.Node(); node.CustomAttributes.Add(new ConfigItem("Id", "")); node.CustomAttributes.Add(new ConfigItem("Name", "根")); node.NodeID = "0"; node.Expanded = true; node.Text = "根"; this.Root.Add(node); Column column = new Column(); this.ColumnModel.Columns.Add(column); TreeColumn column2 = new TreeColumn(); this.ColumnModel.Columns.Add(column2); ActionColumn column3 = new ActionColumn(); if (this.EnableRemove) { ActionItem item2 = new ActionItem(); column3.Items.Add(item2); item2.Icon = Ext.Net.Icon.PageWhiteDelete; item2.Handler = "var record=arguments[5];var tree = App." + this.ID + ";var node = tree.getStore().getNodeById(record.data.Id) || tree.getStore().getNewRecords()[0];Ext.Msg.confirm(\"提示\", \"会删除相关的数据,无法恢复,确认删除?\", function (r) {if (r == \"yes\") {tree.removeNode(node);return;App.direct.RemoveNode(record.data.Id, {success: function (result) {if (result.Success) {node.remove();node.commit();} else {Ext.Msg.alert(\"错误\", result.Message);}},eventMask: {showMask: true,msg: \"正在删除\"}});}});"; item2.Tooltip = "删除"; } this.ColumnModel.Columns.Add(column3); column.ID = "col1"; column.DataIndex = "Id"; column.Width = 50; column.Text = "编号"; column2.ID = "col2"; column2.DataIndex = "Name"; column2.Width = 300; column2.Text = "名称"; column3.ID = "col3"; column3.Text = "操作"; column3.Width = 60; column3.Align = Alignment.Center; if (EnableEdit) { ActionItem item = new ActionItem(); column3.Items.Add(item); item.Icon = Ext.Net.Icon.PageWhiteAdd; item.Handler = "var record=arguments[5]; var tree = App." + this.ID + ";var ep = tree.editingPlugin;var node,store = tree.getStore();if (record.data.Id) {node = store.getNodeById(record.data.Id);}else{node = store.getRootNode();}node.expand(false, function () {node = node.appendChild({Name:'新节点'});setTimeout(function () {ep.startEdit(node, tree.columns[1]);}, 200);});"; item.Tooltip = "添加子节点"; CellEditing editing = new CellEditing(); editing.Listeners.CancelEdit.Handler = " if (e.record.data.Id) {e.record.reject();} else {e.record.remove(true);}"; this.Plugins.Add(editing); this.Editor.Add(new TextField()); TreeView view = new TreeView(); this.View.Add(view); TreeViewDragDrop drop = new TreeViewDragDrop { DragText = "移动到", AppendOnly = true }; view.Plugins.Add(drop); } this.Mode = TreePanelMode.Remote; } base.OnLoad(e); }
private void InitComponents() { #region Header #region Button btnSave = new Button { ID = "btnSave", Icon = Icon.Disk, Text = "Save", ToolTip = "Save" }; btnPost = new Button { ID = "btnPost", Icon = Icon.PackageAdd, Text = "Post Receive", ToolTip = "Post Receive" }; topBar = new Toolbar { ID = "topBar", Items = { btnSave, btnPost } }; #endregion Button #region Fields txtKey = new Hidden { DataIndex = "Key", Name = "Key", LabelWidth = 150, Anchor = "100%", FieldLabel = "Key", ID = "Key" }; txtNo = new TextField { LabelWidth = 150, Anchor = "100%", FieldLabel = "No.", DataIndex = "No", Name = "No", ID = "txtNo", ReadOnly = true }; txtBuy_from_Vendor_No = new TextField { LabelWidth = 150, Anchor = "100%", FieldLabel = "Buy-from Vendor No.", DataIndex = "Buy_from_Vendor_No", Name = "Buy_from_Vendor_No", ID = "txtBuy_from_Vendor_No", ReadOnly = true }; txtBuy_from_Vendor_Name = new TextField { LabelWidth = 150, Anchor = "100%", FieldLabel = "Buy-from Vendor Name", DataIndex = "Buy_from_Vendor_Name", Name = "Buy_from_Vendor_Name", ID = "txtBuy_from_Vendor_Name", ReadOnly = true }; txtOrder_Date = new DateField { LabelWidth = 150, FieldLabel = "Order Date", Anchor = "100%", Format = "dd/MM/yyyy", SubmitFormat = "dd/MM/yyyy", DataIndex = "Order_Date", Name = " Order_Date", SelectOnFocus = true, ID = "txtOrder_Date", ReadOnly = true }; txtDocument_Date = new DateField { LabelWidth = 150, FieldLabel = "Document Date", Anchor = "100%", Format = "dd/MM/yyyy", SubmitFormat = "dd/MM/yyyy", DataIndex = "Document_Date", Name = " Document_Date", SelectOnFocus = true, ID = "txtDocument_Date", ReadOnly = true }; txtPosting_Date = new DateField { LabelWidth = 150, FieldLabel = "Posting Date", Anchor = "100%", Format = "dd/MM/yyyy", SubmitFormat = "dd/MM/yyyy", DataIndex = "Posting_Date", Name = " Posting_Date", SelectOnFocus = true, ID = "txtPosting_Date", AllowBlank = false, MsgTarget = MessageTarget.Side }; txtVietnamese_Desc = new TextField { LabelWidth = 150, FieldLabel = "Vietnamese Description", Anchor = "100%", DataIndex = "Vietnamese_Description", Name = " Vietnamese_Description", SelectOnFocus = true, ID = "txtVietnamese_Desc", AllowBlank = false, MsgTarget = MessageTarget.Side }; txtVAT_Desc = new TextField { LabelWidth = 150, FieldLabel = "VAT Description", Anchor = "100%", DataIndex = "VAT_Description", Name = " VAT_Description", SelectOnFocus = true, ID = "txtVAT_Desc", AllowBlank = false, MsgTarget = MessageTarget.Side }; cboReceive = new Checkbox { LabelWidth = 150, FieldLabel = "Receive", Anchor = "100%", DataIndex = "Receive", Name = " Receive", ID = "cboReceive" }; #endregion Fields #region FormPanel frmHeader = new FormPanel { //Margins = "10 10 0 10", Region = Region.North, Icon = Ext.Net.Icon.ApplicationForm, Title = "General", Border = true, CollapseMode = CollapseMode.Header, Collapsible = true, ID = "frmHeader", TrackResetOnLoad = true, Layout = "Hbox", Items = { new Panel { Layout = "Anchor", Flex = 1, BodyPaddingSummary = "10 10 0 10", Border = false, Items = { txtKey, txtNo, txtBuy_from_Vendor_No, txtBuy_from_Vendor_Name, txtOrder_Date } }, new Panel { Layout = "Anchor", Flex = 1, BodyPaddingSummary = "10 10 0 10", Border = false, Items = { txtPosting_Date, txtVietnamese_Desc, txtVAT_Desc, cboReceive } } } }; #endregion FormPanel #endregion Header #region Line #region GridLine dataTemplateLine = BuilDataTemplateLine(); grdLine = new GridPanelEditBase { ID = "grdLine", Border = false, TitleAlign = Ext.Net.TitleAlign.Center, ProxyUrl = @"..//..//..//..//PurchaseOrder//SvcPurchaseOrder.asmx/GetPOLine", DocumentType = "", DocumentNo = DocumentNo, CurCompany = GlobalVariable.CompanyName, SCOPE = this.SCOPE, DataTemplate = dataTemplateLine, }; #endregion GridLine #region pnlLine pnlLine = new Panel { ID = "pnlLine", Region = Ext.Net.Region.Center, Layout = "Fit", Icon = Ext.Net.Icon.Group, Title = "Lines", Border = true, //Margins = "10 10 5 10", Split = true, Items = { grdLine } }; #endregion pnlLine #endregion Line #region Windows this.ID = "winCard"; this.Maximizable = false; this.Minimizable = false; this.CloseAction = CloseAction.Destroy; this.Icon = Icon.ApplicationEdit; this.TopBar.Add(topBar); this.Layout = "Border"; this.Items.AddRange(new ItemsCollection <Ext.Net.AbstractComponent> { this.frmHeader, this.pnlLine }); #endregion Windows }
/// <summary> /// metodo que carrega as pesquisas existentes /// </summary> private void CarregarPesquisas() { foreach (PesquisaOpiniaoVO p in Pesquisas) { FieldSet fds = new FieldSet() { AutoWidth = true, AutoHeight = true, Title = p.Pergunta, TitleCollapse = true, Collapsible = true, Collapsed = false, AnimCollapse = true }; Hidden hdf = new Hidden() { ID = "hdf_" + p.Id, Value = p.Id.ToString() }; Ext.Net.RadioGroup group = new RadioGroup() { AutoWidth=true, ColumnsNumber = 1, GroupName = "group_" + p.Id, ID="group_"+p.Id, InvalidText="Selecione uma resposta.", AllowBlank = !(p.Status == StatusPesquisa.Iniciada), MsgTarget = MessageTarget.Side }; foreach (RespostaVO r in p.Respostas) { Radio radio = new Radio() { BoxLabel = r.Descricao, HideLabel = true, AutoWidth = true, MinWidth = 150, ID = "radio_"+r.Id, Checked = r.Usuarios.Any(x=> x.Id == UsuarioLogado.Id) }; group.Items.Add(radio); } fds.Items.Add(hdf); fds.Items.Add(group); if (p.Status == StatusPesquisa.Finalizada && p.MostrarResultado) { Ext.Net.Button btnGrafico = new Ext.Net.Button("Resultado"); //btnGrafico.DirectEvents.Click.EventMask = new EventMask() { Msg = "Abrindo gráfico...", ShowMask = true, Target = MaskTarget.Page }; btnGrafico.ID = "btnGrafico" + p.Id; btnGrafico.Listeners.Click.Handler = "Ext.net.DirectMethods.VisualizarGrafico('" + p.Id + "');"; btnGrafico.Icon = Ext.Net.Icon.ChartBar; btnGrafico.Disabled = !hdfVisualizarGraficoResponderPesquisas.Value.ToInt32().ToBoolean(); Toolbar toolbar = new Toolbar(); toolbar.Add(btnGrafico); fds.TopBar.Add(toolbar); } group.Disabled = !(p.Status == StatusPesquisa.Iniciada); fds.AddTo(frmPesquisas); } }