ms word - How to implement numbering sequence in java -


i working on swt application, have functionality implement ms word numbering sequence in application.

at time user can modify existing sequence, whole structure should adjust accordingly , should save in database.

please @ above screen shot.

i thinking string manipulation. seems not optimal one. please suggest me best way...

i able create tree structure, parent child relation. question how implement numbering sequence, if user changes level how adjust whole tree?

user has possibility change number sequence like

before increasing level

  1.    main chapter 1   1.1.  sub chapter1   1.2.  sub chapter 2   2.    main chapter 2 

status after increasing level

    1.  mian chapter 1     1.1.    sub chapter 2     2.  sub chapter 1     3.  main chapter 2 

similarly user can decrease level also.

given table of contents mimics tree structure, can linked list of node objects so,

class node {     int index;     string text;     node next;     node contents; } 

then, can have looks this:

head ->  [1|"main chapter 1"](1) -> [2|"main chapter 2"](2) -> ...                  ^                       ^                  |                       |                  |               [1|"sub chapter 2.1"](2.1) -> [2|"sub chapter 2.2"](2.2) -> ...                  |          [1|"sub chapter 1.1"](1.1) -> [2|"sub chapter 1.2"](1.2) -> ...                                           ^                                           |                                      [1|"sub chapter 1.2.1"](1.2.1) -> ... 

next used keep track of other nodes @ same level
contents used keep track of children nodes @ lower level


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -