/// <summary> /// Factory method. Will make the appropriate class, based on the configurationNode. /// </summary> static public ChoiceBase Make(Mediator mediator, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) { if (XmlUtils.GetAttributeValue(configurationNode, "command", "") == "") { if (XmlUtils.GetAttributeValue(configurationNode, "boolProperty", "") != "") { return(new BoolPropertyChoice(mediator, configurationNode, adapter, parent)); } else if (XmlUtils.GetAttributeValue(configurationNode, "label", "") == "-") { return(new SeparatorChoice(mediator, configurationNode, adapter, parent)); } //the case where we want a choice based on a single member of the list //e.g. a single view in a list of views, to use on the toolbar. else if (XmlUtils.GetAttributeValue(configurationNode, "property", "") != "") { return(MakeListPropertyChoice(mediator, configurationNode, adapter, parent)); } else { throw new ConfigurationException("Don't know what to do with this item. At least give it a dummy 'boolProperty='foo''.", configurationNode); } } else { return(new CommandChoice(mediator, configurationNode, adapter, parent)); } }
public ChoiceRelatedClass(Mediator mediator, IUIAdapter adapter, XmlNode configurationNode) { m_adapter = adapter; m_mediator = mediator; m_configurationNode = configurationNode; m_defaultVisible = XmlUtils.GetOptionalBooleanAttributeValue(m_configurationNode, "defaultVisible", true); }
public ChoiceRelatedClass(Mediator mediator, IUIAdapter adapter, XmlNode configurationNode) { m_adapter = adapter; m_mediator = mediator; m_configurationNode = configurationNode; m_defaultVisible= XmlUtils.GetOptionalBooleanAttributeValue(m_configurationNode, "defaultVisible", true); }
/// <summary> /// /// </summary> /// <param name="mediator"></param> /// <param name="listSet"></param> /// <param name="configurationNode"></param> /// <param name="adapter"></param> /// <param name="parent"></param> public CommandChoice(Mediator mediator, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, configurationNode, adapter, parent) { m_idOfCorrespondingCommand = XmlUtils.GetAttributeValue(m_configurationNode, "command"); StringTable tbl = null; if (mediator != null && mediator.HasStringTable) { tbl = mediator.StringTbl; } m_defaultLabelOverride = XmlUtils.GetLocalizedAttributeValue(tbl, m_configurationNode, "label", null); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="ControlGroup"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public ChoiceGroup(Mediator mediator, IUIAdapter adapter, XmlNode configurationNode, ChoiceGroup parent) : base(mediator, adapter, configurationNode) { m_parent = parent; //allow for a command to be attached to a group (todo: should be for tree groups only) //as it doesn't make sense for some menus or command bars to have an associated command. //for now, leave it to the schema to prevent anything but the right element from having the command attribute. if (XmlUtils.GetAttributeValue(m_configurationNode,"command") != null) { m_treeGroupCommandChoice = new CommandChoice(mediator, configurationNode, adapter, this); } }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="ControlGroup"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public ChoiceGroup(Mediator mediator, IUIAdapter adapter, XmlNode configurationNode, ChoiceGroup parent) : base(mediator, adapter, configurationNode) { m_parent = parent; //allow for a command to be attached to a group (todo: should be for tree groups only) //as it doesn't make sense for some menus or command bars to have an associated command. //for now, leave it to the schema to prevent anything but the right element from having the command attribute. if (XmlUtils.GetAttributeValue(m_configurationNode, "command") != null) { m_treeGroupCommandChoice = new CommandChoice(mediator, configurationNode, adapter, this); } }
public Window() { InitializeComponent(); m_mainPaneText = new Label(); m_mainPaneText.Text = "No item was yet clicked."; m_mainPaneText.Dock = DockStyle.Right; string[] iconLabels = { "iconName" }; var imagelist = new ImageList(); var itemIcon = new Bitmap(32, 32); for (int x = 0; x < itemIcon.Width; ++x) { for (int y = 0; y < itemIcon.Height; ++y) { itemIcon.SetPixel(x, y, Color.Blue); } } imagelist.Images.Add(itemIcon); m_smallImages.AddList(imagelist, iconLabels); m_largeImages.AddList(imagelist, iconLabels); m_mediator = new Mediator(); m_mediator.StringTbl = new SIL.Utils.StringTable("../../DistFiles/Language Explorer/Configuration"); m_sidebarAdapter = new SidebarAdapter(); m_sidebar = m_sidebarAdapter.Init(this, m_smallImages, m_largeImages, m_mediator); m_sidebarChoiceGroupCollection = new MyChoiceGroupCollection(m_mediator, m_sidebarAdapter, null); m_sidebarChoiceGroupCollection.Init(); this.Controls.Add(m_sidebar); this.Controls.Add(m_mainPaneText); m_sidebarAdapter.FinishInit(); ((IUIAdapter)m_sidebarAdapter).OnIdle(); m_mediator.SendMessage("Idle", null); m_mediator.AddColleague(new MyCoreColleague(m_mainPaneText)); }
/// <summary> /// Factory method. Will make the appropriate class, based on the configurationNode. /// </summary> static public ChoiceBase Make( Mediator mediator, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) { if (XmlUtils.GetAttributeValue(configurationNode, "command","") == "") { if (XmlUtils.GetAttributeValue(configurationNode, "boolProperty", "") != "") return new BoolPropertyChoice( mediator, configurationNode, adapter, parent); else if (XmlUtils.GetAttributeValue(configurationNode, "label", "") == "-") return new SeparatorChoice( mediator, configurationNode, adapter, parent); //the case where we want a choice based on a single member of the list //e.g. a single view in a list of views, to use on the toolbar. else if (XmlUtils.GetAttributeValue(configurationNode, "property", "") != "") { return MakeListPropertyChoice(mediator, configurationNode, adapter, parent); } else throw new ConfigurationException("Don't know what to do with this item. At least give it a dummy 'boolProperty='foo''.", configurationNode); } else return new CommandChoice( mediator, configurationNode, adapter, parent); }
public MyChoiceGroup(Mediator mediator, IUIAdapter adapter, XmlNode configurationNode, ChoiceGroup parent, string name, string id) : base(mediator, adapter, configurationNode, parent) { var doc = new XmlDocument(); var config = doc.CreateElement("config"); config.SetAttribute("behavior", "command"); config.SetAttribute("id", id); config.SetAttribute("label", name); config.SetAttribute("icon", "iconName"); if (name == "Areas") { config.SetAttribute("message", "TabClick"); } else { config.SetAttribute("message", "ButtonClick"); } config.SetAttribute("list", name); m_configurationNode = config; }
public Window() { InitializeComponent(); m_mainPaneText = new Label(); m_mainPaneText.Text = "No item was yet clicked."; m_mainPaneText.Dock = DockStyle.Right; string[] iconLabels = { "iconName" }; var imagelist = new ImageList(); var itemIcon = new Bitmap(32, 32); for(int x = 0; x < itemIcon.Width; ++x) for (int y = 0; y < itemIcon.Height; ++y) itemIcon.SetPixel(x, y, Color.Blue); imagelist.Images.Add(itemIcon); m_smallImages.AddList(imagelist, iconLabels); m_largeImages.AddList(imagelist, iconLabels); m_mediator = new Mediator(); m_mediator.StringTbl = new SIL.Utils.StringTable("../../DistFiles/Language Explorer/Configuration"); m_sidebarAdapter = new SidebarAdapter(); m_sidebar = m_sidebarAdapter.Init(this, m_smallImages, m_largeImages, m_mediator); m_sidebarChoiceGroupCollection = new MyChoiceGroupCollection(m_mediator, m_sidebarAdapter, null); m_sidebarChoiceGroupCollection.Init(); this.Controls.Add(m_sidebar); this.Controls.Add(m_mainPaneText); m_sidebarAdapter.FinishInit(); ((IUIAdapter)m_sidebarAdapter).OnIdle(); m_mediator.SendMessage("Idle", null); m_mediator.AddColleague(new MyCoreColleague(m_mainPaneText)); }
public ChoiceBase( Mediator mediator, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, adapter,null) { m_parent = parent; }
public ChoiceBase(Mediator mediator, PropertyTable propertyTable, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, propertyTable, adapter, null) { m_parent = parent; }
public ChoiceBase( Mediator mediator, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, adapter,configurationNode) { m_parent = parent; }
protected ChoiceGroupCollection MakeGroupSet(XmlNode m_windowConfigurationNode, IUIAdapter adapter, string elementName) { XmlNode configurationNode = m_windowConfigurationNode.SelectSingleNode(elementName); if (configurationNode== null) return null; //the configuration did not specify anything for this user interface thatelement ChoiceGroupCollection groupset = new ChoiceGroupCollection (m_mediator, adapter,configurationNode); groupset.Init(); return groupset; }
/// <summary> /// /// </summary> /// <param name="mediator"></param> /// <param name="propertyTable"></param> /// <param name="configurationNode"></param> /// <param name="adapter"></param> /// <param name="parent"></param> public CommandChoice(Mediator mediator, PropertyTable propertyTable, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, propertyTable, configurationNode, adapter, parent) { m_idOfCorrespondingCommand = XmlUtils.GetAttributeValue(m_configurationNode, "command"); m_defaultLabelOverride = XmlUtils.GetLocalizedAttributeValue(m_configurationNode, "label", null); }
static bool m_fHandlingClick = false; // prevent multiple simultaneous OnClick operations. #endregion Fields #region Constructors public ListPropertyChoice( Mediator mediator, ListItem listItem, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, adapter, parent) { m_listItem = listItem; }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="ChoiceGroupCollection"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public ChoiceGroupCollection(Mediator mediator, IUIAdapter adapter, XmlNode configurationNode) : base(mediator, adapter, configurationNode) { }
/// <summary> /// Group made of multiple menus. /// </summary> /// <param name="mediator"></param> /// <param name="adapter"></param> /// <param name="configurationNodes"></param> /// <param name="parent"></param> public ChoiceGroup(Mediator mediator, IUIAdapter adapter, List <XmlNode> configurationNodes, ChoiceGroup parent) : base(mediator, adapter, configurationNodes[0]) //hack; just give it the first one { m_parent = parent; m_configurationNodes = configurationNodes; }
/// <summary> /// Group made of multiple menus. /// </summary> /// <param name="mediator"></param> /// <param name="adapter"></param> /// <param name="configurationNodes"></param> /// <param name="parent"></param> public ChoiceGroup(Mediator mediator, IUIAdapter adapter, List<XmlNode> configurationNodes, ChoiceGroup parent) : base(mediator, adapter, configurationNodes[0]) //hack; just give it the first one { m_parent = parent; m_configurationNodes = configurationNodes; }
/// <summary> /// sets up either the menubar, toolbar collection, or sidebar /// </summary> /// <param name="adaptorAssembly"></param> /// <param name="m_windowConfigurationNode"></param> /// <param name="elementName"></param> /// <param name="adapterClass"></param> /// <returns></returns> protected ChoiceGroupCollection MakeMajorUIPortion(Assembly adaptorAssembly, XmlNode m_windowConfigurationNode, string elementName, string adapterClass, out System.Windows.Forms.Control control, out IUIAdapter adapter) { adapter = null; //make the adapter try { adapter = (IUIAdapter)adaptorAssembly.CreateInstance(adapterClass); m_adapters.Add(adapter); } catch (Exception e) { ErrorReporter.ReportException(e, ApplicationRegistryKey, m_mediator.FeedbackInfoProvider.SupportEmailAddress); } Trace.Assert(adapter != null, "XCore could not create the adapter for " + adapterClass); control = adapter.Init(this, m_smallImages, m_largeImages, m_mediator); if (control != null) { control.Tag = adapter; // add an AccessibilityName if (control.AccessibleName == null) control.AccessibleName = elementName; } return MakeGroupSet(m_windowConfigurationNode, adapter, elementName); }
static bool m_fHandlingClick = false; // prevent multiple simultaneous OnClick operations. #endregion public ListPropertyChoice(Mediator mediator, ListItem listItem, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, adapter, parent) { m_listItem = listItem; }
public ChoiceBase(Mediator mediator, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, adapter, null) { m_parent = parent; }
public ChoiceBase(Mediator mediator, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, adapter, configurationNode) { m_parent = parent; }
/// <summary> /// find the matching list and list item referred to buy this note, and create a ListPropertyChoice /// to access that item. This is used in the special case where we want a toolbar button or two /// instead of showing every item in the list. /// </summary> /// <param name="mediator"></param> /// <param name="configurationNode"></param> /// <param name="adapter"></param> /// <returns></returns> static public StringPropertyChoice MakeListPropertyChoice(Mediator mediator, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) { //string listId=XmlUtils.GetAttributeValue(configurationNode, "list", ""); // ListItem item = new ListItem(); // item.label = "xxxxxx"; // item.value = XmlUtils.GetAttributeValue(configurationNode, "value", ""); // item.imageName = XmlUtils.GetAttributeValue(configurationNode, "icon", "default"); //item.parameterNode = parameterNode; return(new StringPropertyChoice(mediator, configurationNode, adapter, parent)); // if(li!=null) // return new ListPropertyChoice( mediator, li, adapter, parent); // else // throw new ConfigurationException ("Could not find the list item for '"+val+"' in a list with the id '"+listId+"'.",configurationNode); }
/// <summary> /// find the matching list and list item referred to buy this note, and create a ListPropertyChoice /// to access that item. This is used in the special case where we want a toolbar button or two /// instead of showing every item in the list. /// </summary> /// <param name="mediator"></param> /// <param name="configurationNode"></param> /// <param name="adapter"></param> /// <returns></returns> public static StringPropertyChoice MakeListPropertyChoice(Mediator mediator, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) { //string listId=XmlUtils.GetAttributeValue(configurationNode, "list", ""); // ListItem item = new ListItem(); // item.label = "xxxxxx"; // item.value = XmlUtils.GetAttributeValue(configurationNode, "value", ""); // item.imageName = XmlUtils.GetAttributeValue(configurationNode, "icon", "default"); //item.parameterNode = parameterNode; return new StringPropertyChoice(mediator,configurationNode, adapter, parent); // if(li!=null) // return new ListPropertyChoice( mediator, li, adapter, parent); // else // throw new ConfigurationException ("Could not find the list item for '"+val+"' in a list with the id '"+listId+"'.",configurationNode); }
//hack; just give it the first one /// <summary> /// Group made of multiple menus. /// </summary> /// <param name="mediator"></param> /// <param name="adapter"></param> /// <param name="configurationNodes"></param> /// <param name="parent"></param> public ChoiceGroup(Mediator mediator, IUIAdapter adapter, List<XmlNode> configurationNodes, ChoiceGroup parent) : base(mediator, adapter, configurationNodes[0]) { m_parent = parent; m_configurationNodes = configurationNodes; }
/// <summary> /// /// </summary> /// <param name="mediator"></param> /// <param name="listSet"></param> /// <param name="configurationNode"></param> /// <param name="adapter"></param> /// <param name="parent"></param> public CommandChoice( Mediator mediator, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, configurationNode, adapter, parent) { m_idOfCorrespondingCommand = XmlUtils.GetAttributeValue(m_configurationNode, "command"); StringTable tbl = null; if (mediator != null && mediator.HasStringTable) tbl = mediator.StringTbl; m_defaultLabelOverride = XmlUtils.GetLocalizedAttributeValue(tbl, m_configurationNode, "label", null); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="ChoiceGroupCollection"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public ChoiceGroupCollection(Mediator mediator,IUIAdapter adapter, XmlNode configurationNode) : base(mediator, adapter, configurationNode) { }
public StringPropertyChoice( Mediator mediator, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, configurationNode, adapter, parent) { }
public StringPropertyChoice(Mediator mediator, PropertyTable propertyTable, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, propertyTable, configurationNode, adapter, parent) { }
/// <summary> /// Start the window almost from scratch. /// This is needed to fix the full refresh behavior of wiping out everything in the caches. /// </summary> protected void WarmBootPart1() { SaveSettings(); // Disable the mediator from processing messages. if (m_mediator != null) { m_mediator.MainWindow = null; m_mediator.ProcessMessages = false; m_mediator.RemoveColleague(this); } // m_mainSplitContainer is the only control created and added to this.Controls in // InitializeComponents(). Get rid of all the other collected controls -- they'll be // recreated by LoadUIFromXmlDocument(). this.SuspendLayout(); List<Control> toRemove = new List<Control>(); foreach (Control ctrl in Controls) { if (ctrl != m_mainSplitContainer) toRemove.Add(ctrl); } foreach (Control ctrl in toRemove) { Controls.Remove(ctrl); ctrl.Dispose(); } // close all dialogs owned by the main window foreach (Form f in OwnedForms) { // Don't close the import wizard just because creating a custom field // causes a full refresh. See LT-10193. if (f.Name != "LexImportWizard") f.Close(); } // Clear all the controls created in LoadUIFromXmlDocument(). m_rebarAdapter = null; m_sidebarAdapter = null; m_menuBarAdapter = null; m_adapters.Clear(); m_sidebar = null; m_menusChoiceGroupCollection.Clear(); m_menusChoiceGroupCollection = null; m_sidebarChoiceGroupCollection.Clear(); m_sidebarChoiceGroupCollection = null; m_toolbarsChoiceGroupCollection.Clear(); m_toolbarsChoiceGroupCollection = null; m_statusPanels.Clear(); // Refresh refills the status panels. // This is a patch - much like the one below on the mediator where it's checked for null. // If we (I) knew why this was getting called 'n' times and the value was null, I'd have fixed // it differently. if (m_mainContentControl != null) { m_mainContentControl.Dispose(); m_mainContentControl = null; } // Finish destroying the old mediator, and create a new one. if (m_mediator != null) { // First, we need to get rid of any existing DotNetBarManager object! (See LT-6481) if (m_mediator.PropertyTable.PropertyExists("DotNetBarManager")) { m_mediator.PropertyTable.SetPropertyDispose("DotNetBarManager", true); } m_mediator.Dispose(); } m_mediator = new Mediator(); // No broadcasting until it has our handle (see OnHandleCreated) m_mediator.SpecificToOneMainWindow = true; this.ResumeLayout(); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="ChoiceGroupCollection"/> class. /// </summary> /// ----------------------------------------------------------------------------------- public ChoiceGroupCollection(Mediator mediator, PropertyTable propertyTable, IUIAdapter adapter, XmlNode configurationNode) : base(mediator, propertyTable, adapter, configurationNode) { }
public SeparatorChoice(Mediator mediator, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent) : base(mediator, configurationNode, adapter, parent) { }