 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
philip Guest
|
Posted: Sat Jun 10, 2006 10:12 pm Post subject: how to use jbdtree? |
|
|
how to use jbdtree?
Is the setting of dataset and columnName enough? Is there any ebook for how
to use it? |
|
| Back to top |
|
 |
kei Guest
|
Posted: Sat Jun 10, 2006 11:15 pm Post subject: Re: how to use jbdtree? |
|
|
I also want to know this answer (any ebook.....and JDBnavTree also), but
seems no one answer!
"philip" <j.f21 (AT) 163 (DOT) com> wrote in message
news:448afd9c (AT) newsgroups (DOT) borland.com...
| Quote: | how to use jbdtree?
Is the setting of dataset and columnName enough? Is there any ebook for
how
to use it?
|
|
|
| Back to top |
|
 |
philip Guest
|
Posted: Sun Jun 11, 2006 8:12 am Post subject: Re: how to use jbdtree? |
|
|
This is what I find in the support.borland.com.
It seems to say that we cant't just use a dataset and fieldname to fill the
jdbtree
Why can't I fill a JdbTree with data from a dataset by setting
properties? ? Back to Search Results
Ideally, a tree, like a list, would be data-aware in two ways:
- it would be filled with data from one dataset
- its selection would be synchronized with the current row of a
dataset (probably a different dataset)
But there is no single, obviously correct way to map data from a
dataset to a tree. The problem is that a dataset is tabular while a tree is
inherently hierarchical. So dbSwing currently doesn't provide support to
fill a tree from a dataset, though we're thinking about what we might do
here in the future.
To fill the tree, you have to write code that understands your
representation of hierarchical data. JdbTree is still considered a
data-aware component because selection in the tree writes to the current row
of the bound-to dataset and navigation in the dataset changes selection in
the tree. Its dataSet and columnName properties specify this binding.
How do I fill a JdbTree with data? ? Back to Search Results
Create a tree node that will be the root of your JdbTree and
pass it to the constructor of a tree model. Then create other nodes and
attach them as the root's children, create still more nodes and make them
children of the root's children, and so on. Finally, set a JdbTree's model
property to the tree model. This is not hard, but there are a number of
inter-related decisions you have to make:
a.. Where does the data to fill the tree come from? In some
cases, you might decide to hard-code it in your application. In others, it
might come from a dataset.
b.. If the data comes from a dataset, how is the tree's
hierarchy represented? Presumably each row in the dataset will become a node
in the tree. You might have a column whose values represent the path to the
node. Or you might store only the node's parent in this column, and follow
parent links recursively to determine the node's position in the tree. If
the tree is not deep, you could also use a different dataset for each level
of the tree.
c.. In what order will the data be loaded into the tree? For a
very large tree, finding the parent as each new node is added might be slow.
d.. What data will be stored in each node of the tree? If the
"user data object" in each node is not a String, you have to provide a cell
renderer and define equality between the user data and the values in the
bound-to dataset column.
e.. What data will be stored in the column of the dataset that
the tree is bound to? If the value is an Object instead of a String, you may
have to provide a cell renderer and override the default read and write
operations.
The HtmlViewer sample in
samplescomborlandsamplesdbswinghtmlviewer has sample code to build a
JdbTree. The content of its tree is a simple help system that discusses
these issues in more detail.
"kei" <kei (AT) omc (DOT) com.hk> 写入消息 news:448b0c41 (AT) newsgroups (DOT) borland.com...
| Quote: | I also want to know this answer (any ebook.....and JDBnavTree also), but
seems no one answer!
"philip" <j.f21 (AT) 163 (DOT) com> wrote in message
news:448afd9c (AT) newsgroups (DOT) borland.com...
how to use jbdtree?
Is the setting of dataset and columnName enough? Is there any ebook for
how
to use it?
|
|
|
| Back to top |
|
 |
philip Guest
|
Posted: Sun Jun 11, 2006 8:12 am Post subject: Re: how to use jbdtree? |
|
|
This is what I found last night~
It seems to say that we can't fill a jdbtree by dataset and fieldname~~
Why can't I fill a JdbTree with data from a dataset by setting
properties?
Ideally, a tree, like a list, would be data-aware in two ways:
- it would be filled with data from one dataset
- its selection would be synchronized with the current row of a
dataset (probably a different dataset)
But there is no single, obviously correct way to map data from a
dataset to a tree. The problem is that a dataset is tabular while a tree is
inherently hierarchical. So dbSwing currently doesn't provide support to
fill a tree from a dataset, though we're thinking about what we might do
here in the future.
To fill the tree, you have to write code that understands your
representation of hierarchical data. JdbTree is still considered a
data-aware component because selection in the tree writes to the current row
of the bound-to dataset and navigation in the dataset changes selection in
the tree. Its dataSet and columnName properties specify this binding.
How do I fill a JdbTree with data?
Create a tree node that will be the root of your JdbTree and pass it
to the constructor of a tree model. Then create other nodes and attach them
as the root's children, create still more nodes and make them children of
the root's children, and so on. Finally, set a JdbTree's model property to
the tree model. This is not hard, but there are a number of inter-related
decisions you have to make:
a.. Where does the data to fill the tree come from? In some cases,
you might decide to hard-code it in your application. In others, it might
come from a dataset.
b.. If the data comes from a dataset, how is the tree's hierarchy
represented? Presumably each row in the dataset will become a node in the
tree. You might have a column whose values represent the path to the node.
Or you might store only the node's parent in this column, and follow parent
links recursively to determine the node's position in the tree. If the tree
is not deep, you could also use a different dataset for each level of the
tree.
c.. In what order will the data be loaded into the tree? For a very
large tree, finding the parent as each new node is added might be slow.
d.. What data will be stored in each node of the tree? If the "user
data object" in each node is not a String, you have to provide a cell
renderer and define equality between the user data and the values in the
bound-to dataset column.
e.. What data will be stored in the column of the dataset that the
tree is bound to? If the value is an Object instead of a String, you may
have to provide a cell renderer and override the default read and write
operations.
The HtmlViewer sample in samplescomborlandsamplesdbswinghtmlviewer has
sample code to build a JdbTree. The content of its tree is a simple help
system that discusses these issues in more detail.
"philip" <j.f21 (AT) 163 (DOT) com> 写入消息 news:448afd9c (AT) newsgroups (DOT) borland.com...
| Quote: | how to use jbdtree?
Is the setting of dataset and columnName enough? Is there any ebook for
how
to use it?
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|