smoothcontract / mediate

Automatically exported from code.google.com/p/mediate
0 stars 0 forks source link

sort items in designer treeview #182

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This can be implemented using a sorted property for TAHMUIObjectList class.
Some classes will not require sorting (e.g. containers, controls, actions)
as the order is critical. Will need to define a default value for sorting
(false) set in constructor and override as needed.

If sorting is set then the saveasxml method will need to override the
default behaviour to tweak the order when saving to avoid breaking any
inherited items. maybe we could add a sort method rather than a sorted
property? or both.

If sorted then we could use a binary search algorithm to lookup items which
would be quicker - in fact, this is already built in to the tstringlist
used internally, so is easy to implement.

Saving technique:
First pass:
  create a new tstringlist
  assign names & objects to new tstringlist

  pass through list, save and delete any objects with no ancestor.

  this solves simple case where we have a single inheritance chain.

  two dependent objects?

  a -> b -> c

  a has no ancestor. b inherits a. c inherits b.

  first pass writes a.

  So now we need to write either b or c. How do we determine order when
writing? Need to sort based on inheritance rather than name... then write
in that order. Can use a quick sort, just need a comparison method:

  if a.ancestor = nil and b.ancestor = nil then compare = equal
  else if a.ancestor = nil and b.ancestor <> nil then compare = less
  else if a.ancestor <> nil and b.ancestor = nil then compare = more
  else if a.inheritsfrom(b) then compare = more else compare = less.

  inheritsfrom method will need to walk up the inheritance tree until it
finds b or nil.

Original issue reported on code.google.com by aretman...@gmail.com on 4 Feb 2009 at 11:16

GoogleCodeExporter commented 9 years ago
Some of the designer forms require sorting too - this could use same technique 
above
with UIObject list sorting. Meta values should be sorted in designerlist form.
controls, containers and actions don't need sorting. Need to disable drag/drop 
too.
Note - available list should be sorted in all cases.

Original comment by aretman...@gmail.com on 4 Feb 2009 at 11:18

GoogleCodeExporter commented 9 years ago
Implemented in mediate designer v0.0.33

Original comment by aretman...@gmail.com on 22 Apr 2009 at 9:34