OpenKeyWord  Build Tag: jenkins-DoxyGen_EN-107, Build ID: 2015-03-08_20-51-06
 All Classes Namespaces Functions Variables Properties Pages
OKW.FrameObjectDictionary Class Reference
Collaboration diagram for OKW.FrameObjectDictionary:

Public Member Functions

 FrameObjectDictionary ()
 
object GetObjectByName (string fpsFunctionalnameOfWindow)
 The method delivers the frame object of the given window object. More...
 
object GetObjectByName (string fps_ParentObject, string fps_ChildObject)
 The method delivers the object of the given Childobjecttest. More...
 
void Init ()
 
List< Type > GetListOfOKWGuiClasses ()
 
void Scanfields (Type fpType, object fpsWindowAsObject, string fpsWindowName)
 

Public Attributes

Dictionary< string, object > __FrameObjectDictionary = new Dictionary<string, object>()
 

Private Member Functions

void AddFrameInstancesToDictionary (List< Type > fpListOfOKWGuiTypes)
 
string GetFunktionlanameFromObjekt (object fpObject)
 List dasAttribute Funktionalname das übergeben Objektes aus. More...
 
object CreateInstanceByType (Type fpParentType)
 The method generates an instance of the frame class with the name given in 'fps_ParentClassName'. More...
 
object __CreateInstanceByObjectName (string fps_ParentObject, string fps_ChildObject)
 Generates an instance of the OKW-Frame-Object. More...
 
object GetChildObjectByName (object fpo_ParentObject, string fps_ChildName)
 

Private Attributes

LogMessenger LM = null
 

Detailed Description

Todo:
TODO: JN Übersetzung/Review
Author
Zoltan Hrabovszki
Date
2014.10.10

Constructor & Destructor Documentation

OKW.FrameObjectDictionary.FrameObjectDictionary ( )
Author
Zoltan Hrabovszki
Date
2014.10.10
107  {
108  Logger.Instance.LogFunctionStartDebug("FrameObjectDictionary.FrameObjectDictionary");
109 
110  this.Init();
111 
112  Logger.Instance.LogFunctionEndDebug();
113  }

Member Function Documentation

object OKW.FrameObjectDictionary.__CreateInstanceByObjectName ( string  fps_ParentObject,
string  fps_ChildObject 
)
private

Generates an instance of the OKW-Frame-Object.

Returns
The instance of OKW-Frame-Object.
Parameters
fps_ParentNamename of parent window.
fps_ChildNameName of child object via fps_ParentObject given parent object.
Author
Zoltan Hrabovszki
Date
2014-10-10 FIXME: Prüfen, ob diese Methoden namentlich ok sind. Wird das Eltern Obejkt angelegt?
543  {
544  Logger.Instance.LogFunctionStartDebug("FrameObjectDictionary.CreateInstanceByObjectName", "fps_ParentObject", fps_ParentObject, "fps_ChildObject", fps_ChildObject);
545 
546  object myParentObject = null;
547  object myChildObject = null;
548  bool bOK = false;
549 
550  try
551  {
552  // PerentObject holen und ggf. als instanz anlegen
553  myParentObject = this.GetObjectByName(fps_ParentObject);
554 
555  // Kindobjekt aufrufen...
556  // aber nur wenn Paretobjekt gefunden worden ist.
557  if (myParentObject != null)
558  {
559  // FIXME: was ist wenn das myChildObject = null ist??Checken
560  myChildObject = this.GetChildObjectByName(myParentObject, fps_ChildObject);
561  }
562  else
563  {
564  // LANGUAGE: Log Schreiben..
565  throw new OKWFrameObjectWindowNotFoundException("Frame Objekt des Fensters");
566  }
567 
568  bOK = true;
569  }
570  finally
571  {
572  if (bOK)
573  {
574  // Wir sind ohne Exception durchgekommen und wir nehmen an,
575  // dass lvo_Obj != null
576  // -> wir geben den Namen des Objektes zurück...
577  Logger.Instance.LogFunctionEndDebug(myChildObject.GetType().FullName);
578  }
579  else
580  {
581  // Irgend etwas ist faul wir rufen nur LogFunctionEndDebug auf...
582  Logger.Instance.LogFunctionEndDebug();
583  }
584  }
585 
586  return myChildObject;
587  }
void OKW.FrameObjectDictionary.AddFrameInstancesToDictionary ( List< Type >  fpListOfOKWGuiTypes)
private
Parameters
fps_ParentClassNameName of the class
Author
Zoltan Hrabovszki
Date
2015.01.28
343  {
344  object lvTypeInstanceAsObject = null;
345 
346  Logger.Instance.LogFunctionStartDebug("FrameObjectDictionary.AddFrameInstancesToDictionary");
347 
348  try
349  {
350  // Für jede Klasse...
351  foreach( Type lvOKWGuiClass in fpListOfOKWGuiTypes )
352  {
353  lvTypeInstanceAsObject = CreateInstanceByType( lvOKWGuiClass );
354 
355  // Funktionalenname der Klasse aus dem Attribute OKWGUI auslesen.
356  string lvFunktionalname = this.GetFunktionlanameFromObjekt(lvTypeInstanceAsObject);
357 
358  // Wenn Attribute vorhanden (!=null) und nicht Leer dann ins Dictionary einfügen.
359  if (!string.IsNullOrEmpty(lvFunktionalname))
360  {
361  string lvsKey = lvFunktionalname;
362  System.Console.WriteLine( "\n Window Frame: >>" + lvsKey + "<<" );
363  System.Console.WriteLine( " Technisches Objekt: >>" + lvTypeInstanceAsObject.GetType().FullName + "<<" );
364 
365  this.__FrameObjectDictionary.Add(lvFunktionalname, lvTypeInstanceAsObject);
366 
367  Logger.Instance.LogPrintDebug(this.LM.GetMessage("CreateInstanceByObjectName", "InstanceWasCreated", lvTypeInstanceAsObject.GetType().FullName));
368 
369  //nun Rekursive die Kinder (=Felder) des Frames durgehen und ins einlesen.
370  Scanfields(lvOKWGuiClass, lvTypeInstanceAsObject, lvFunktionalname);
371  }
372  }
373  }
374  finally
375  {
376  Logger.Instance.LogFunctionEndDebug();
377  }
378 
379  return;
380  }
object CreateInstanceByType(Type fpParentType)
The method generates an instance of the frame class with the name given in 'fps_ParentClassName'.
Definition: FrameObjectDictionary.cs:480

Here is the call graph for this function:

object OKW.FrameObjectDictionary.CreateInstanceByType ( Type  fpParentType)
private

The method generates an instance of the frame class with the name given in 'fps_ParentClassName'.

Note
IMPORTANT: the class is forced to be exactly, as specified. Here is no 'frame prefix' added.
Returns
Delivers the instance of the class
Parameters
fps_ParentClassNameName of the class
Author
Zoltan Hrabovszki
Date
2014.10.10
481  {
482  object lvo_Obj = null;
483  bool bOK = false;
484 
485  Logger.Instance.LogFunctionStartDebug("FrameObjectDictionary.CreateInstanceByObjectName", "fpParentClass", fpParentType.FullName);
486 
487  try
488  {
489  lvo_Obj = Activator.CreateInstance(fpParentType, null);
490 
491  Logger.Instance.LogPrintDebug(this.LM.GetMessage("CreateInstanceByObjectName", "InstanceWasCreated", lvo_Obj.GetType().FullName));
492  bOK = true;
493  }
494  catch (TargetInvocationException e)
495  {
496  // EXCEPTION: Pürfen was hier genau passiert. Exception weitergeben
497  throw new OKWFrameObjectWindowNotFoundException(this.LM.GetMessage("CreateInstanceByObjectName", "InstanceWasCreated", fpParentType.FullName), e);
498  }
499  finally
500  {
501  if (bOK)
502  {
503  // Wir sind ohne Exception durchgekommen und wir nehmen an,
504  // dass lvo_Obj != null
505  // -> wir geben den Namen des Objektes zurück...
506  Logger.Instance.LogFunctionEndDebug(lvo_Obj.GetType().FullName);
507  }
508  else
509  {
510  // Irgend etwas ist faul wir rufen nur LogFunctionEndDebug auf...
511  Logger.Instance.LogFunctionEndDebug();
512  }
513  }
514 
515  return lvo_Obj;
516  }
string GetMessage(string MethodName, string TextKey)
Definition: LogMessenger.cs:145

Here is the call graph for this function:

Here is the caller graph for this function:

object OKW.FrameObjectDictionary.GetChildObjectByName ( object  fpo_ParentObject,
string  fps_ChildName 
)
private

Gets a public field value given its name

Parameters
srcObjobject to inspect
fieldNameName of the field to retrieve the value from
Returns
property value
Author
Zoltan Hrabovszki
Date
2014-10-10
609  {
610  object lvo_Return = null;
611 
612  Logger.Instance.LogFunctionStartDebug("FrameObjectDictionary.GetChildObjectByName", "fpo_ParentObject", fpo_ParentObject.ToString(), "fps_ChildName", fps_ChildName);
613 
614  try
615  {
616  FieldInfo fieldInfoObj = fpo_ParentObject.GetType().GetField(fps_ChildName);
617 
618  // Existiert es das Kindobjekt >>{0:}<< im Objekt >>{1:}<<?
619  Logger.Instance.LogPrintDebug(this.LM.GetMessage("GetChildObjectByName", "M1", fps_ChildName, fpo_ParentObject.GetType().Name));
620  if (fieldInfoObj == null)
621  {
622  // Nein -> Exception auslösen und alles beenden!
623  Logger.Instance.LogPrintDebug(this.LM.GetMessage("GetChildObjectByName", "M3"));
624  throw new OKWFrameObjectChildNotFoundException(this.LM.GetMessage("GetChildObjectByName", "ChildIsNotDefined_Exception", fps_ChildName, fpo_ParentObject.GetType().Name));
625  }
626  else
627  {
628  // Ja, das Objekt existiert.
629  Logger.Instance.LogPrintDebug(this.LM.GetMessage("GetChildObjectByName", "M2"));
630 
631  // Get the value from property.
632  lvo_Return = fpo_ParentObject.GetType().InvokeMember(
633  fieldInfoObj.Name,
634  BindingFlags.GetField,
635  null,
636  fpo_ParentObject,
637  null);
638  }
639  }
640  finally
641  {
642  Logger.Instance.LogFunctionEndDebug();
643  }
644 
645  return lvo_Return;
646  }
string GetMessage(string MethodName, string TextKey)
Definition: LogMessenger.cs:145

Here is the call graph for this function:

string OKW.FrameObjectDictionary.GetFunktionlanameFromObjekt ( object  fpObject)
private

List dasAttribute Funktionalname das übergeben Objektes aus.

Parameters
fpObject
Returns
Wert aus Funtionalname
435  {
436  string lvsReturn = "";
437 
438  Attribute[] attrs = System.Attribute.GetCustomAttributes(fpObject.GetType()); // Reflection.
439 
440  // Displaying output.
441  foreach (System.Attribute attr in attrs)
442  {
443  if (attr is OKWGUIAttribute)
444  {
445  OKWGUIAttribute a = (OKWGUIAttribute)attr;
446  lvsReturn = a.FunctionalName;
447  }
448  }
449 
450  return lvsReturn;
451  }
Definition: OKWGUIAttribute.cs:56
List<Type> OKW.FrameObjectDictionary.GetListOfOKWGuiClasses ( )
Note
IMPORTANT: the class is forced to be exactly, as specified. Here is no 'frame prefix' added.
Returns
Author
Zoltan Hrabovszki
Date
2014.10.10
305  {
306  string @namespace = "OKW.Frames";
307  List<Type> lvLsReturn = new List<Type>();
308 
309  Type[] myTypes = Assembly.GetExecutingAssembly().GetTypes();
310 
311  var q = from t in myTypes
312  where t.IsClass && t.Namespace == @namespace
313  select t;
314 
315  foreach(Type t in q)
316  {
317  if (t.GetCustomAttributes(typeof(OKWGUIAttribute), true).Length > 0)
318  {
319  lvLsReturn.Add(t);
320  }
321  }
322 
323  return lvLsReturn;
324  }
Definition: OKWGUIAttribute.cs:56

Here is the caller graph for this function:

object OKW.FrameObjectDictionary.GetObjectByName ( string  fpsFunctionalnameOfWindow)

The method delivers the frame object of the given window object.

Here the object can already be instantiated, in this case the reference will be taken from the Dictionary OKW_FrameObjectDictionary.cv_FrameObjectDictionary or the object is not yet instantiated, then an instance is to be laid and a reference to the object is stored.

See also
For the child object another markedness ist existing.: FrameObjectDictionary.GetObjectByName(string,string)
Parameters
fps_ParentObjectFachlicher Name des Fenster Objektes = Elternobjekt
Returns
Todo:
TODO: ZH Rückgabewert beschreiben
Author
Zoltan Hrabovszki
Date
2014.10.10
155  {
156  object lvo_Return = null;
157 
158  Logger.Instance.LogFunctionStartDebug("FrameObjectDictionary.GetObjectByName", "fpsFunctionalnameOfWindow", fpsFunctionalnameOfWindow);
159  try
160  {
161  // Gibt es den Schlüssel im Dictinary? - D.h. Gibt es schon eine Instanz des Objektes im Speicher?
162  Logger.Instance.LogPrintDebug(this.LM.GetMessage("GetObjectByName", "M1", fpsFunctionalnameOfWindow));
163  if (this.__FrameObjectDictionary.ContainsKey(fpsFunctionalnameOfWindow))
164  {
165  // Ja, das Objekt existiert.
166  Logger.Instance.LogPrintDebug(this.LM.GetMessage("GetObjectByName", "M2"));
167  lvo_Return = this.__FrameObjectDictionary[fpsFunctionalnameOfWindow];
168  }
169  else
170  {
171  // Nein -> Frame zum Funtionalen NAme wurde nicht gefunden -> Exception auslösen...
172  // \todo TODO: Fehlermeldung einbauen...
173  Logger.Instance.LogPrintDebug(this.LM.GetMessage("GetObjectByName", "M3"));
174 
175  throw new OKWFrameObjectWindowNotFoundException( "Fensterobjekt wurde nicht gefunden: " + fpsFunctionalnameOfWindow );
176  }
177  }
178  finally
179  {
180  Logger.Instance.LogFunctionEndDebug();
181  }
182 
183  return lvo_Return;
184  }
Dictionary< string, object > __FrameObjectDictionary
Definition: FrameObjectDictionary.cs:87
object OKW.FrameObjectDictionary.GetObjectByName ( string  fps_ParentObject,
string  fps_ChildObject 
)

The method delivers the object of the given Childobjecttest.

See also
For the window object another markedness is existing. FrameObjectDictionary.GetObjectByName(string,string)
Parameters
fps_ParentObjectName des Fenster-Objektes = Elternobjekt.
fps_ChildObjectName des Kindobjektes-Objektes.
Returns
Todo:
TODO: JN Rückgabewert übersetzen/review
Author
Zoltan Hrabovszki
Date
2014.10.10
Todo:
TODO: Exception/Try/Except/Finaly einbauen
214  {
215  object lvo_Return = null;
216  string lvs_ObjectName = fps_ParentObject + "." + fps_ChildObject;
217 
218  Logger.Instance.LogFunctionStartDebug("FrameObjectDictionary.GetObjectByName", "fps_ParentObject", fps_ParentObject, "fps_ChildObject", fps_ChildObject);
219 
220  // Gibt es den Schlüssel im Dictinary?
221  Logger.Instance.LogPrintDebug(this.LM.GetMessage("GetObjectByName", "M1", lvs_ObjectName));
222 
223  if (this.__FrameObjectDictionary.ContainsKey(lvs_ObjectName))
224  {
225  // Ja, das Objekt existiert.
226  Logger.Instance.LogPrintDebug(this.LM.GetMessage("GetObjectByName", "M2"));
227  // Hole refarenc auf des Objekt im Dictionary
228  lvo_Return = this.__FrameObjectDictionary[lvs_ObjectName];
229  }
230  else
231  {
232  // Nein -> Frame zum Funtionalen NAme wurde nicht gefunden -> Exception auslösen...
233  // \todo TODO: Fehlermeldung einbauen...
234  Logger.Instance.LogPrintDebug(this.LM.GetMessage("GetObjectByName", "M3"));
235 
236  throw new OKWFrameObjectWindowNotFoundException( "FrameObjekt wurde nicht gefunden: >>" + lvs_ObjectName + "<<" );
237  }
238 
239  Logger.Instance.LogFunctionEndDebug();
240  return lvo_Return;
241  }
Dictionary< string, object > __FrameObjectDictionary
Definition: FrameObjectDictionary.cs:87
void OKW.FrameObjectDictionary.Init ( )
Todo:
TODO: JN Übersetzung/Review
Author
Zoltan Hrabovszki
Date
2014.10.10
261  {
262  Logger.Instance.LogFunctionStartDebug("FrameObjectDictionary.Init");
263 
264 
265  try
266  {
267  this.LM = new LogMessenger("FrameObjectDictionary");
268 
269  Logger.Instance.LogPrint(this.LM.GetMessage("Init", "InitClear", this.GetType().Name));
270  this.__FrameObjectDictionary.Clear();
271 
272  List<Type> lvOKWGuiClasses = GetListOfOKWGuiClasses();
273 
274  this.AddFrameInstancesToDictionary(lvOKWGuiClasses );
275  }
276  finally
277  {
278  Logger.Instance.LogFunctionEndDebug();
279  }
280  }
List< Type > GetListOfOKWGuiClasses()
Definition: FrameObjectDictionary.cs:304

Here is the call graph for this function:

Member Data Documentation

Dictionary<string, object> OKW.FrameObjectDictionary.__FrameObjectDictionary = new Dictionary<string, object>()
Todo:
TODO: JN Übersetzung/Review
Author
Zoltan Hrabovszki
Date
2014.10.10
Todo:
TODO: Bedingte Kompilierung einfügen für "Test" Feld muss Public sein, wenn unittets durchgeführt werden soll.

The documentation for this class was generated from the following file: