private void AddPropertiesToParts(UimlDocument doc) { ArrayList styles = doc.UInterface.UStyle; // TODO: support multiple structures Structure structure = (Structure) doc.UInterface.UStructure[0]; foreach (LayoutProperty lp in m_properties.Values) { Part part = structure.SearchPart(lp.PartName); Property prop; // remove existing, absolute layout properties // check for inline properties prop = part.GetProperty(lp.Name); if (prop != null) part.RemoveProperty(prop); // // check for properties in style section foreach (Style s in styles) { prop = s.SearchProperty(lp.PartName, lp.Name); if (prop != null) s.RemoveProperty(prop); } // add the layout property part.AddProperty(lp); } }
public override IRenderedInstance PreRender(UimlDocument uimlDoc) { try { m_topWindow = new WxRenderedInstance("Uiml container"); Structure uiStruct = (Structure)uimlDoc.UInterface.UStructure[0]; Style uiStyle = (Style)uimlDoc.UInterface.UStyle[0]; Behavior uiBehavior = null; try{ uiBehavior = (Behavior)uimlDoc.UInterface.UBehavior[0]; }catch(Exception e){ /* no behavior specified */ } Top = uiStruct.Top; Voc = uimlDoc.SearchPeers(NAME).GetVocabulary(); Console.WriteLine("Calling TopFrame..."); Console.WriteLine("In Render; TopFrame is {0}", m_topWindow.TopFrame); Window c = Render(uiStruct.Top, uiStyle, m_topWindow.TopFrame); //Render has filled the part-tree with the concrete object references //to the individual widgets, now attach the behavior //c.Reparent((Window)m_topWindow.TopFrame); return m_topWindow; } catch(NullReferenceException nrfe) { Console.WriteLine("The Rendering Engine says: Check the input documents, they seem to be invalid"); Console.WriteLine(nrfe); throw nrfe; } }
public static int Main (string[] args) { UimlDocument uimlDoc = new UimlDocument("check.uiml"); CheckTest ct = new CheckTest(); uimlDoc.Connect(ct); IRenderer renderer = (new BackendFactory()).CreateRenderer(uimlDoc.Vocabulary); IRenderedInstance ri = renderer.Render(uimlDoc); ri.ShowIt(); return 0; }
public void InitializeProperties(UimlDocument doc, IRenderer r) { AddPropertiesToParts(doc); foreach (LayoutProperty lp in m_properties.Values) { int renderedValue = (int) lp.GetCurrentValue(r.PropertySetter, null); // will be converted to string automatically by LayoutProperty class! lp.InitializeVariable((double) renderedValue); } }
public void Insert(string pattern, UimlDocument doc) { //TODO: maintain order of pattern while inserting //TODO: replace "<!-- pattern -->" with template Uiml.Part parent = workingDoc.SearchPart(pattern); parent.AddChild( ((Structure)doc.UInterface.UStructure[0]).Top); ArrayList properties = ((Style)doc.UInterface.UStyle[0]).Children; IEnumerator enumProps = properties.GetEnumerator(); while(enumProps.MoveNext()) { ((Style)workingDoc.UInterface.UStyle[0]).Children.Add((Property)enumProps.Current); } }
private void LoadFrontEnd() { try //try to load a GUI as front-end { UimlDocument feUimlDoc = new UimlDocument(m_frontendFile); renderer = (new BackendFactory()).CreateRenderer(feUimlDoc.Vocabulary); IRenderedInstance instance = renderer.Render(feUimlDoc); ExternalLibraries.Instance.Add(m_frontendLib); feUimlDoc.Connect(this); // add to the list renderedUIs.Add(m_frontendFile, instance); instance.ShowIt(); } catch(Exception e) { //no interface available, use command-line options! throw new NoGuiAvailableException(e); } }
public override IRenderedInstance PreRender(UimlDocument uimlDoc) { try { m_topWindow = new CompactSWFRenderedInstance(); m_topWindow.Title = uimlDoc.Title; Structure uiStruct = (Structure)uimlDoc.UInterface.UStructure[0]; Style uiStyle = (Style)uimlDoc.UInterface.UStyle[0]; Behavior uiBehavior = null; try{ uiBehavior = (Behavior)uimlDoc.UInterface.UBehavior[0]; }catch(Exception e){ /* no behavior specified */ } Top = uiStruct.Top; Voc = uimlDoc.SearchPeers(NAME).GetVocabulary(); Control c = Render(uiStruct.Top, uiStyle); //Render has filled the part-tree with the concrete object references //to the individual widgets, now attach the behavior //CompactSWFEventLinker sel = new CompactSWFEventLinker(this); EventLinker sel = new EventLinker(this); sel.Link(uiStruct, uiBehavior); m_topWindow.Add(c); return m_topWindow; } catch(NullReferenceException nrfe) { Console.WriteLine("The Rendering Engine says: Check the input documents, they seem to be invalid"); throw nrfe; } catch(Exception e) { Console.WriteLine("Unexpected failure ({0}) while processing {1}:", e.GetType(), uimlDoc); Console.WriteLine(e.ToString()); Console.WriteLine("Please contact the uiml.net maintainer with the above output."); throw e; } }
public void Reset() { workingDoc = (UimlDocument)topDoc.Clone(); }
public UimlContainerDocument(UimlDocument doc) { topDoc = doc; //TODO: workingDoc = (UimlDocument)topDoc.Clone(); workingDoc = topDoc; }
public RenderedInstance PreRender(UimlDocument uimlDoc) { m_topWindow = new QtRenderedInstance(); }
virtual public IRenderedInstance Render(UimlDocument uimlDoc) { return PreRender(uimlDoc); }
abstract public IRenderedInstance PreRender(UimlDocument uimlDoc);
public override IRenderedInstance Render(UimlDocument uimlDoc) { IRenderedInstance instance = PreRender(uimlDoc); uimlDoc.SolveLayoutProperties(this); // of course only if there's a layout specified if (uimlDoc.HasLayout) { // render again instance = PreRender(uimlDoc); // now do reordering Structure uiStruct = (Structure)uimlDoc.UInterface.UStructure[0]; Console.Write("Trying to reorder the interface... "); SWFReorderer reorderer = new SWFReorderer(uiStruct.Top); reorderer.Execute(); Console.WriteLine("Done!"); // we need to render any possible added widgets instance = PreRender(uimlDoc); // then the constraints must be solved uimlDoc.SolveLayoutProperties(this); // and we must render once again to apply these instance = PreRender(uimlDoc); } return instance; }
private void Render(string file) { try { UimlDoc = new UimlDocument(file); Console.WriteLine("render [" + uimlDoc.Vocabulary + "]-[" + file + "]"); IRenderer renderer = (new BackendFactory()).CreateRenderer(uimlDoc.Vocabulary); IRenderedInstance instance = renderer.Render(uimlDoc); // connect the frontend to the document, to allow communication at runtime UimlDoc.Connect(this); // connect the rendered instance to the document UimlDoc.Instance = instance; // add to the list renderedUIs.Add(FileToDictionaryKey(file), instance); // connect close event instance.CloseWindow += new EventHandler(UimlDocument_Closed); // connect activate event instance.ActivateWindow += new EventHandler(UimlDocument_Activated); instance.ShowIt(); } catch (NoRendererAvailableException rue) { Console.WriteLine("No suitable renderer found:"); Console.WriteLine(" Please check if the rendering backend corresponding to the vocabulary is available"); } catch (Exception e) { Console.WriteLine(e); #if !COMPACT Console.WriteLine(e.StackTrace); #endif Console.WriteLine("Could not create GUI for {0} with uiml.net", UimlFileName); } }
public UimlComposite(UimlDocument acontainer) { container = new UimlContainerDocument(acontainer); leaves = new Hashtable(); }