I need a TreeView
Hi all,
I need a TreeView component for an upcoming project, but unfortunately it seems like JavaFX has not yet provided one. Any tips on how I should go about it? Should I use a ListView, and create my own cutomized Nodes that has the functionality of collapsing/expanding the list of children nodes?
Hi Carl,
you could use a JTree wraped in Javafx.
Code:
package controlcenter_v4;
import javafx.ext.swing.*;
import javax.swing.*;
import javax.swing.tree.*;
import java.lang.Object;
class MyTreeCell {
public var text: String;
public var cells: MyTreeCell[];
public var value: Object;
override function toString ():String {
return text;
class MyTree extends SwingComponent{
var tree: JTree;
var model: DefaultTreeModel;
public var selectedValue: java.lang.Object;
public var action: function(obj:Object);
public var root: MyTreeCell on replace{
if (root != null){
model.setRoot(getCell(root));
var obj = model.getRoot();
var tp = new TreePath(obj);
override function createJComponent(): JComponent {
tree = new JTree();
model = tree.getModel() as DefaultTreeModel;
var mouseListener = java.awt.event.MouseAdapter {
override function mousePressed(e: java.awt.event.MouseEvent) {
var selRow = tree.getRowForLocation(e.getX(), e.getY());
var selPath = tree.getPathForLocation(e.getX(), e.getY());
var lastPath = selPath.getPathComponent(selPath.getPathCount() - 1);
var obj = (lastPath as DefaultMutableTreeNode).getUserObject();
if(action != null ){
action(obj);
if(selRow != - 1) {
if(e.getClickCount() == 1) {
selectedValue = obj;
else if(e.getClickCount() == 2) {
getJComponent().repaint();
tree.addMouseListener(mouseListener);
tree.setRootVisible(false);
var scrollPane = new JScrollPane(tree);
return scrollPane;
function getCell(cell: MyTreeCell): MutableTreeNode {
var node = new DefaultMutableTreeNode(cell);
for (c in cell.cells ){
node.<<insert>>(getCell(c),node.getChildCount());
return node;
}Here is some example code how to use it:
Example:
Scene {
content: [
MyTree{
root: MyTreeCell{
text: "Root"
cells: [
MyTreeCell{
text: "Letters"
cells:[
MyTreeCell{
text: "a"
MyTreeCell{
text: "b"
MyTreeCell{
text: "Digits"
cells: for( i in [0..9]) MyTreeCell{ text: "{i}"}
action: function(obj:Object){
println("Selected object: {obj}");
}source: [http://jfx.wikia.com/wiki/SwingComponents|http://jfx.wikia.com/wiki/SwingComponents]
Edited by: Jazzor on Jun 24, 2009 12:16 AM
Similar Messages
-
Need help with e4x syntax for children in ADG TreeView column
I would like to display Hierarchical XML data as a treeView
in a ADG control. I can bind the first (parent) level of my XML to
the ADG using a HierarchicalData Dataprovider, but I can't figure
out the syntax to get the children.
The attached code shows the function where the XML is
received, and evaluated one level deep. The var "eventdefs" is the
..Group nodes of the XML, and the declaration of the ADG. The ADG
binds the eventdefs as hierarchical data, and specifies one column
with the datafield as @eventgroup. This works fine and shows the
top level nodes.
I have specified Event as the childrenfield, but I don't see
anything in the data grid - nor do I understand how to specify a
different value of datafield for the second level of nodes.
I want to show the value of the attribute "eventgroup" on
parent nodes, and show the value of the attribute "description"
next to the child nodes. Can this be specified in the mxml? Or do I
need a label function, or something else?
TIA!
Here is my XML document:
<list>
<Group eventgroup="">
<Event uniqueid="63" description="Error:enter valid Email
Address " displayorderingroup="60" displayorder="86" />
<Event uniqueid="64" description="Error:unable to find
account for email address " displayorderingroup="61"
displayorder="87" />
</Group>
<Group eventgroup="CEP Events">
<Event uniqueid="244" description="CEP:EveryHit; "
displayorderingroup="242" displayorder="253" />
</Group>
</list>
<mx:Script>
<![CDATA[
[Bindable("eventDefsChanged")]
private var _eventDefs:Object;
public function set eventDefs(m:Object):void
// We expect m to be a XML document, with "Group" as the
name of the highest level (parent) nodes
_eventDefs = m..Group;
adg_es.dataProvider = eventDefs;
adg_es.validateNow();
dispatchEvent( new Event( "eventDefsChanged" ) );
public function get eventDefs():Object
return _eventDefs;
]]>
</mx:Script>
<mx:AdvancedDataGrid id = "adg_es"
displayItemsExpanded="true">
<mx:dataProvider>
<mx:HierarchicalData id ="hd" source = "{new
HierarchicalData(eventDefs)}" childrenField="Event"/>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="@eventgroup"/>
</mx:columns>
</mx:AdvancedDataGrid>Use TAKE function
int numberOfrecords=10; // read from user
listOfItems.OrderByDescending(x => x.CreatedDate).Take(numberOfrecords) -
Foreign domain ou-structure to treeview object...expertise needed
Here is my simple script which works fine on my own domain (first one: TreeViewOwnDomain.ps1). Now I want to read foreign domain and use treeview as same way.
Here is also another script which connect foreign domain and read user data (second one: ForeignDomainUserData.ps1).
Can anyone help me?
function Add-Node {
param ($selectedNode, $name)
$newNode = new-object System.Windows.Forms.TreeNode
$newNode.Name = $name
$newNode.Text = $name
$selectedNode.Nodes.Add($newNode) | Out-Null
return $newNode
function Get-NextLevel {
param ($selectedNode, $dn)
$OUs = Get-ADObject -Filter 'ObjectClass -eq "organizationalUnit" -or ObjectClass -eq "container"' -SearchScope OneLevel -SearchBase $dn
if ($OUs -eq $null) {
$node = Add-Node $selectedNode $dn
} else {
$node = Add-Node $selectedNode $dn
$OUs | % {
Get-NextLevel $node $_.distinguishedName
function Build-TreeViewNew {
param ($tNode, $tDomainDN, $tviewOU1)
# Tab 1
$tNode.text = "Active Directory Hierarchy"
$tNode.Name = "Active Directory Hierarchy"
$tNode.Tag = "root"
$tviewOU1.Nodes.Add($treeNode) | Out-Null
Get-NextLevel $treeNode $tDomainDN
Build-TreeViewNew $treeNode "DC=w12,DC=local" $treeviewOU1
$JobEncrypted = Get-Content "C:\Tools\PowershellScripts\Test\encrypted_password_PS.txt" | ConvertTo-SecureString
$JobCredential = New-Object System.Management.Automation.PsCredential($JobUsername, $JobEncrypted)
$SessionX = New-PSSEssion -ComputerName "192.168.xxx.xxx" -Credential $JobCredential -ErrorAction 'SilentlyContinue'
Enter-PSSession -Session $SessionX
$t = Invoke-Command -Session $SessionX -ScriptBlock {
$tmp = $null
$t1 = (Get-ADUser Administrator).distinguishedName; $tmp += $t1; $tmp += "`n"
$t2 = (Get-ADUser Administrator -Properties *).description; $tmp += $t2; $tmp += "`n"
$tmp
Exit-PSSession
$richtextboxOU1.Text = $tHi Jyrkis700,
If you want to add the other domain's information to TreeView, you can try the cmdlet "Get-ADUser -Server otherdoman.com -Credential otherdomain\Administrator" instead of "Invoke-Command" and "Enter-Pssession":
Get-ADUser ann –Server test.server.com -Credentail TEST\Administrator
Reference from:
Adding/removing members from another forest or domain to groups in Active Directory
In addition, to work with TreeView, this script may be helpful for you:
PowerShell help browser using Windows Forms and TreeView Control
If I have any misunderstanding, please let me know.
If you have any feedback on our support, please click here.
Best Regards,
Anna
TechNet Community Support -
I have a HTML page with an IFrame. Inside the Iframe there is a table with a tree view
<iframe>
<table>
<tr>
<td>
<treeview id="tv1"></treeview>
</td>
</tr>
</table>
</iframe>
In UIA, i am able to traverse till the tree view but not able to see it.
I have used the TreeWalker.RawViewWalker Field to traverse the node from the desktop Automation.RootElement.
I tried to use AutomationElement.FromPoint method to check whether i am able to get that element. Fortunately i was able to get the automation element.
i tried to get the path to root element from the node element using the TreeWalker.RawViewWalker. I was able to get the parent path to the root element.
But trying the reverse way like navigating from root element to tree node, was not getting the element for me.
Please help me with suggestions or inputs to resolve this issue.Thanks Bernard,
It works fine with JInitiator but not working with
the JPI. For JPI what settings I need to do ??hi TKARIM and Bernard, i am having similar problem even with the Bernard's recommended setup. could you post the webutiljini.htm (i presume you are using config=test) ?
i am actually using jinitiator 1.3.1.28 with Oracle HTTP Server of OAS 10gR2) calling Forms Server 6i (f60cgi). After setting up according to Bernard's recommended setup steps, the java console showed that it loaded the icon jar file when it could not read the form, but it skipped the loading of the icon jar file once it read and started the form. How do we specify in the form to pick up the icon from the jar file instead from a directory ? Or do we need to specify ? Any ideas ?
Thx and Regards
dkklau -
How to get all checked items from TreeView in VC++ mfc
void CPDlg::OnTreeClk(NMHDR *pNMHDR, LRESULT *pResult)
NMTREEVIEW& nm = *(LPNMTREEVIEW)pNMHDR;
// which item was selected?
HTREEITEM hItem = m_columnTree.GetTreeCtrl().GetSelectedItem();
temp = m_columnTree.GetItemText(hItem, 0);
MessageBox(temp);
if (!hItem) return;
// the rest of processing code..
I'm new in VC++ .
this code gives only current selected item . but i need to get all checked items from treeView.
kindly help me..no not unchecked .. the all check box's gone from tree view. which means Treeview without check box.
finally i tried SetCheck
void CPracticesDlg::OnSelchangedTreectrl(NMHDR* pNMHDR, LRESULT* pResult)
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
// TODO: Add your control notification handler code here
tree_state = 1;//changed
HTREEITEM hItem = m_columnTree.GetTreeCtrl().GetSelectedItem();
BOOL chk = m_columnTree.GetTreeCtrl().GetCheck(hItem);
if (chk == TRUE)
HTREEITEM hmyItem = m_columnTree.GetTreeCtrl().GetSelectedItem();
// Check all of the children of hmyItem.
if (m_columnTree.GetTreeCtrl().ItemHasChildren(hmyItem))
HTREEITEM hNextItem;
HTREEITEM hChildItem = m_columnTree.GetTreeCtrl().GetChildItem(hmyItem);
while (hChildItem != NULL)
hNextItem = m_columnTree.GetTreeCtrl().GetNextItem(hChildItem, TVGN_NEXT);
m_columnTree.GetTreeCtrl().SetCheck(hChildItem, 1);
hChildItem = hNextItem;
else
HTREEITEM hmyItem = m_columnTree.GetTreeCtrl().GetSelectedItem();
// Uncheck all of the children of hmyItem.
if (m_columnTree.GetTreeCtrl().ItemHasChildren(hmyItem))
HTREEITEM hNextItem;
HTREEITEM hChildItem = m_columnTree.GetTreeCtrl().GetChildItem(hmyItem);
while (hChildItem != NULL)
hNextItem = m_columnTree.GetTreeCtrl().GetNextItem(hChildItem, TVGN_NEXT);
m_columnTree.GetTreeCtrl().SetCheck(hChildItem, 0);
hChildItem = hNextItem;
code works good . but here is i think small problem . i cant find it.
when i click the root node it goes to checked state but not child node. again i click same root node it goes to unchecked state but all child's are goes to checked state.
help me. here what is the problem? -
The Treeview navigation seems to have broken my intranet .
Hmmmmmmm sometimes issues with SharePoint are like buses - earlier I found that could not open any word documents until installed Office 2010 SP2 32-bit but that is not why I am here :-( .
I am developing a new intranet for a client and am testing out a load of OOTB features to see which ones will best meet requirements we have defined, ahead of a live deployment. This led me to the Treeview widget to see if it will help with navigation.
I enabled it on the top level home site which worked but showed way too much information for my users. Hence, I went over to a member of the team to see what there view looks like ( without SC admin / site owner privileges).
He got this error ( see below) - turns our everyone does now include me ( after a refresh) ! Ouch. Now
this maybe due to our thin client environment . However this very strange. The only person who has ever changed the master page is me earlier this week when I enabled the breadcrumb but we have all been using this for days - have never
touched the control shown in error. I will see if anybody in the IT team hasn't been fiddling with the farm but I suspect I am the cause of this disaster ......
Now, I need to remove the treeview feature via settings but I don't seem to be able to navigate to / _settings.
I can access the site via SharePoint designer
I created a replica site albeit unpopulated on my laptop so I can copy untouched master pages if needed.
I just need to get this fixed asap!!!!
DanielHi skcooke
As in Ribbon bar -> admin page button - doh! Done and home site is now accessible - thanks. I will try that next time rather than going directly to the browser and then _settings.aspx. Hmmm will try the treeview again but not when in a hurry
to leave the office lol.. -
I want to list all of the connectors on a board on a vi front panel (e.g. J1, J2, etc...). If the user clicks on e.g. J1, all of the pins on J1 will be displayed, like when using a treeview. The user will then be able to select multiple pins from J1 (e.g. he/she clicks on J1-1 and J1-3). Whatever pins are selected I will set high. I thought I'd be able to put multiple treeviews on my vi, one for each connector, but it seems that with a treeview no more than one selection can be made. Basically I need a control that is expandable and multiple selections can be made. Is there a control that does this?
Thanks and regardsCould you please draw us a picture (text is fine) of approximately what you are looking for.
It sounds to me, if I read your question correctly, that a text indicator will do the trick.
For example:
Before:
J1
J2
J3
J4
After J2 selected:
J1
J2
Pin 1 -
Pin 2 -
Pin 3 -
Pin 4 -
etc...
J3
J4
This can be done with a bit of work using a simple string indicator, a table, a list, etc.
For a string indicator, you would detect the selection by either polling the selection and an "Okay" button, or using a mouse up event on the control then checking the property corresponding with selection.
List indicators may be easier to work with programmatically, but I don't know if they are any cleaner looking. I suspect they are
probably the same. I can whip up a simple example if you wish...
I hope this helps
-Mike Du'Lyea
Advanced Test Engineering
http://advancedtestengineering.com -
Tree (TreeView) in Applet
Hello,
could you please give a hint how I can use TreeView in applets?
Actually I need a code example of how to add a TreeView component to an applet.Let me be your google agent. Rather than have you waste your time typing in a web search query, you can just click on this link:
http://www.google.com/search?hl=en&q=applet+TreeView+example -
Treeview Add Child to Parent Node Without Creating a New Parent
I have a treeview setup with a HierarchicalDataTemplate in my XAML as follows:
<TreeView Grid.Column="1" Grid.Row="0" ItemsSource="{Binding treeViewObsCollection}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding mainNodes}">
<TextBlock Text="{Binding topNodeName}"/>
<HierarchicalDataTemplate.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding subItemName}"></TextBlock>
</DataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
Here is the ViewModel which is set as the Data Context for the XAML File.
class AdvancedErrorCalculationViewModel : ViewModelBase
static ObservableCollection<TreeViewClass> _treeViewObsCollection = new ObservableCollection<TreeViewClass>();
public static ObservableCollection<TreeViewClass> treeViewObsCollection { get { return _treeViewObsCollection; } }
public class TreeViewClass : ViewModelBase
public TreeViewClass(string passedTopNodeName)
topNodeName = passedTopNodeName;
mainNodes = new ObservableCollection<TreeViewSubItems>();
public string topNodeName
get { return this.GetValue<string>(); }
set { this.SetValue(value); }
public ObservableCollection<TreeViewSubItems> mainNodes { get; private set; }
public class TreeViewSubItems : ViewModelBase
public TreeViewSubItems(string passedSubItemName, string passedSubItemJobStatus)
subItemName = passedSubItemName;
subItemJobStatus = passedSubItemJobStatus;
public string subItemName
get { return this.GetValue<string>(); }
set { this.SetValue(value); }
public string subItemJobStatus
get { return this.GetValue<string>(); }
set { this.SetValue(value); }
public static void AddTreeViewItems(string passedTopNodeName, string passedChildItemName, string passedChildItemJobStatus)
treeViewObsCollection.Add(new TreeViewClass(passedTopNodeName)
mainNodes =
new TreeViewSubItems(passedChildItemName, passedChildItemJobStatus)
The problem lies with the AddTreeViewItems method
seen above. Currently, if I call the method by let's say:
AdvancedErrorCalculationViewModel.AddTreeViewItems("Parent","Child 1", "Completed");
it creates the parent and child nodes just fine. No issues there.
However, if I call the method again with the same Parent name but a different Child; for example:
AdvancedErrorCalculationViewModel.AddTreeViewItems("Parent","Child 2", "Completed");
It creates a new Parent node with a child node Child 2 instead. Thus, I have something like this:
- Parent
- Child 1
- Parent
- Child 2
I would like to modify this function so that if the parent name is the same, the child node should belong under the previous Parent instead
of under a new Parent node. Something like this:
- Parent
- Child 1
- Child 2
Could anyone help me modify my code to detect if the Parent node exists in the observablecollection already and if so, place the child node under the existing parent? The main problem I am facing is trying to add items to a previously created observable collection
with an existing hierarchy because I don't know how to access the previous observable collection anymore. Help me with this please.
Thanks in advance. :)You need to try and find an existing entry and if it's there add the child to that instead.
I notice you're a student and I guess this is probably an assignment.
By the way.
I suggest you work on the name of your collections and classes there.
EG A class should be singular but way more meaningfull than treeviewsubitem.
Anyhow, finding the top node could be done using linq. Since you can get none, SingleOrDefault is the method to use.
Thus something like:
TreeViewClass tvc = treeViewObsCollection.Where
(x=>x.Title == passedTopNodeName).SingleOrDefault();
Will give you tvc null or the qualifying entry.
If it's null, do what you have now.
If it's not then add the child item to tvc.
tvc is a reference to the TreeViewClass you have in that collection.
Please don't forget to upvote posts which you like and mark those which answer your question.
My latest Technet article - Dynamic XAML -
Hi Everyone!
I have been a lurker here, learning from reading other's posts. I am in serious need of help, as I have been struggling with this issue for over a week and I can't move forward to other things until I get it resolved...
Here's what's up: I am creating a single-page website as a landing page for a product I offer. (These are very common now in product marketing). The page is here: http://www.howtogetamazingrelationships.com.
The page that is there is about the 4th iteration of the page in the quest for a faster-loading page. Everytime I test it - no matter what I do - it ends up being about a 24 second load time. Here's a sample test for review: http://tools.pingdom.com/?url=howtogetamazingrelationships.com&treeview=0&column =objectID&order=1&type=0&save=true
Here are the things I have done to try to speed this baby up:
1. Took my youtube video off auto-play.
2. Optimized the site using Web Site Maestro. 27% decrease in size; no load time difference.
3. Took out shapes and graphics.
4. Rebuilt the site on a blank template - now it is actually a little worse!
5. Took out the website.js file - totally messed things up.
6. Eliminated the navigation.
Nothing is even showing the least bit of difference in speed...and it is driving me crazy.
Here's the thing - I have also contacted Web Site Maestro's support for help, and they said that the problem was the size of the site and the length of the page. But here's the thing - I checked the load speed of a page that is about double my page size and length, and it loads in like 4 seconds: http://tools.pingdom.com/?url=http://www.wealthbeyondreason.com/page2.php&treevi ew=0&column=objectID&order=1&type=0&save=true
Anyone have help/advice for me? I am so frustrated with this, as the iWeb is crazy-easy to build, but I can't have a simple one-page product page load that slow. No one is going to stay around for 24 seconds!
I just am at the end up my rope and don't know anything else to do. I really don't want to rebuild the site again and still not see results, so any help would be hugely appreciated.
Thanks so much in advance, and I hope you are all having a beautiful day -
:o) TaraOkay, more info -
I checked my site on a different web analyzer, and it does seem to be loading quickly - 15.66 seconds for a 56 k, but only 3.6 for T1. So that is good -
One thing I noticed in the recommendations is that there are 6 scripts that are running, that can slow things down. I don't really know how to change that (I am pretty web-savvy, but far from a developer) Here's what they recommended on the page -
Analysis and Recommendations from webanalyzer.com:
TOTAL_OBJECTS - Caution. You have 18 total objects on this page. From 12 to 20 objects per page, the latency due to object overhead makes up from 75% to 80% of the delay of the average web page. See Figure II-3: Relative distribution of latency components showing that object overhead dominates web page latency in Website Optimization Secrets for more details. Consider reducing, eliminating, and combining external objects (graphics, CSS, JavaScript, iFrames and XHTML) to reduce the total number of objects, and thus separate HTTP requests. Consider using CSS sprites to help consolidate decorative images.
TOTAL_IMAGES - Caution. You have a moderate amount of images on this page (10 ). Consider using fewer images on the site or try reusing the same image in multiple pages to take advantage of caching. Using CSS techniques such as colored backgrounds, borders, or spacing instead of graphic techniques can help reduce HTTP requests.
TOTAL_SCRIPT - Warning! The total number of external script files on this page is 6 , consider reducing this to a more reasonable number. Combine, refactor, and minify to optimize your JavaScript files. Ideally you should have one (or even embed scripts for high-traffic pages) on your pages. Consider suturing JavaScript files together at the server to minimize HTTP requests. Placing external JavaScript files at the bottom of your BODY, and CSS files in the HEAD enables progressive display in XHTML web pages.
HTML_SIZE - Caution. The total size of this HTML file is 60492 bytes, which is above 50K but below 100K. With 50K of images and multimedia this means that your page will load in about 20 seconds. Consider optimizing your HTML and eliminating unnecessary features. To give your users feedback, consider layering your page or using positioning to display useful content within the first two seconds. -
How to get the SelectionProxy "Selection Square/Dot" into my own TreeView?
Hi!
I have built my own TreeView in a panel plugin. This TreeView contains document objects, just like the Layers Panel does. In the Layers Panel each treenode (e.g. a layer, an <rectangle>, any node item) has a "SelectionProxy" on the right side (the little square/dot that gets colored in the layer's color if you click it). I want to add such a SelectionProxy to my TreeView Node Items. I have found in the "open" folder that there's apparently (part of) the source code of the layers panel. However I can't find documentation of any sorts that would be helpful to what I'm trying to do.
I've gotten so far that I know that I need to add 2 boss classes, kLayerPanelSelectionProxyBoss and kPageItemSelectionProxyBoss.
Class
kLayerPanelSelectionProxyBoss,
kBaseWidgetBoss,
IID_ISELECTIONPROXYDRAWDATA, kSelectionProxyDrawDataImpl,
IID_ICONTROLVIEW, kSelectionProxyViewImpl,
IID_IDRAGDROPSOURCE, kProxyViewDragDropSourceImpl,
IID_IEVENTHANDLER, kLayerProxyDragDropSourceEHImpl,
IID_ITIP, kProxyWidgetTipImpl,
Class
kPageItemSelectionProxyBoss,
kLayerPanelSelectionProxyBoss,
IID_IDRAGDROPSOURCE, kLayerZOrderDragDropSourceImpl,
However I can't find anything on IID_ISELECTIONPROXYDRAWDATA. Maybe someone has done this already and can guide me a little bit. I'm grateful for any help!soo... turns out i forgot to declare the interface in the *ID.h file. *facepalm*.
-
Which form to show in treeview - c#
Hello,
I have created several forms.
In the afterselect event of a treeview control, I have placed the name of the forms.
depending on which name I click in the treeview, I would like the correct form to be loaded.
How do I modify the below code to get to what I need please?
Thanks
private
void tvLayouts_AfterSelect(object
sender, TreeViewEventArgs e)
string s = e.Node.Text;
Form1 frm;
if (s.ToLower() ==
"Form1")
frm =
new Form1();
else
if (s.ToLower() ==
"Form2")
frm = new
Form2();
frm.Show();Hi,
Use this code.
string s = e.Node.Text.ToLower();
Form frm;
if (s ==
"form1")
frm = new
Form1();
else
if (s ==
"form2")
frm = new
Form2();
else
if (s ==
"form3")
frm = new
Form3();
if(frm != null)
frm.Show();
Regards,
Selva Ganapathy K
the compiler gives an error for the frm != null and it underlines frm
it says: use of unassigned local variable 'frm'
string s = e.Node.Text.ToLower();
Form frm;
if (s ==
"form1")
frm = new
Form1();
else
if (s ==
"form2")
frm = new
Form2();
else
if (s ==
"form3")
frm = new
Form3();
if(frm != null)
frm.Show(); -
TreeViewer with JFace and SWT ...help!
Hi Guys;
My question is for those familiar with the eclipse platform developement..
I'm trying to implement a File Explorer under The Eclipse platform using the jface and SWT tools...
when i Run the code below it gives me a run time exception:
NoClassDefFound exception...
it seems that the problem resides at the line:
tv.setInput(new File("C:\\"));
if i remove the argument to File "C:\\" i get a blank view with no files..
here is the Code:
Any helpfull ideas would be very welcomed indeed...
import org.eclipse.jface.window.*;
import org.eclipse.swt.widgets.*;
import java.io.*;
import java.util.*;
import org.eclipse.jface.viewers.*;
import org.eclipse.jface.viewers.*;
import org.eclipse.jface.window.*;
import org.eclipse.swt.*;
class FileTreeContentProvider implements ITreeContentProvider
public Object[] getChildren(Object element)
Object[] kids = ((File) element).listFiles();
return kids == null ? new Object[0] : kids;
public Object[] getElements(Object element)
return getChildren(element);
public boolean hasChildren(Object element)
return getChildren(element).length > 0;
public Object getParent(Object element)
return ((File)element).getParent();
public void dispose()
public void inputChanged(Viewer viewer, Object old_input, Object new_input)
class FileTreeLabelProvider extends LabelProvider
public String getText(Object element)
return ((File) element).getName();
public class Standalone extends ApplicationWindow
public Standalone()
super(null);
protected Control createContents(Composite parent)
TreeViewer tv = new TreeViewer(parent);
tv.setContentProvider(new FileTreeContentProvider());
tv.setLabelProvider(new FileTreeLabelProvider());
tv.setInput(new File(" C:\\ "));
return tv.getTree();
public static void main(String[] args)
Standalone w = new Standalone();
w.setBlockOnOpen(true);
w.open();
Display.getCurrent().dispose();This is an old post... but in case anyone wants to know... This tutorial is located at http://www-106.ibm.com/developerworks/opensource/library/os-ecgui1/ and I HIGHLY recommend it for people using Eclipse and wanting to learn how to create a File Explorer with JFace/SWT.
Most likely the error that othmanSilent was getting was the following:
java.lang.NoClassDefFoundError:
org/eclipse/core/internal/boot/DelegatingURLClassLoader
It was pointed out in the eclipse.swt newsgroups quite a few times. The author of the article forgot to also mention that you need to include the following jar file in your Java Build Path: eclipse.core.boot_<eclipse-version>/boot.jar -
How drag and drop a node in a TreeView ?
Hi,
I want drag and drop a node in a treeview but i don't know how to get this result. I can drag a page item in a treeview or drag a node in a page item but not a node in another.
Can you help me ?
Regards,
Damien FontaineYour implementation of DoAddDragContent() is a little thin looking.
If you look at the example in the SDK (BscDNDCustomDragSource.cpp) you might need to add at least:
// we get the data object that represents the drag
InterfacePtr<IPMDataObject> item(DNDController->AddDragItem(1));
// no flavor flags
PMFlavorFlags flavorFlags = 0;
// we set the type (flavour) in the drag object
item->PromiseFlavor(customFlavor, flavorFlags);
Also, check that DoAddDragContent() is actually being called. -
Perhaps this isn't advanced enough to be here, if its not let
me know and I will post elsewhere.
I am fairly new to coldfusion but am learning quickly. I have
a coldfusion page I want to add a treeview to. I'm not sure if
cftree has the power I need. This tree will be dynamically
generated based on an xml document I plan on returning using
cfquery pointing to an sql server database. I was wondering if
anyone had any experience, examples, or advice on how to approach
this.
Any feedback would be greatly appreciated.Hi Steve!
1. If your Schema has a minoccurance and maxoccurance (e.g. maxoccurance=unbound)represented in the element, the LCD should make it work by itself.
2. If you didn't fulfill point one, try to add [*] at the end of the binding. e.g. default binding = PurchaseItem[*]
good luck!
Håkon
Maybe you are looking for
-
hai all, here is the error i got while publishing a webtemplate on portal.. HELP ME PLEASE... while publishing the web template on the portal (WAD)...I get the bi exception error as described below.. some times report is opening fi
-
Laptop will not load Vista OS. BIOS works ok and all internal diags passed ( harddrive and memory ). The screen stays black with the cursor blinking. I tried booting off on the dvd drive with a Vista and Windows 2008 server boot disk but got a CDB
-
Ecatt vs. Manually entered transactions
Hello We are currently performance testing and we are thus creating a lot of transactions using eCATT - e.g VA01. My question is now: why is there a difference in response time when creating one VA01 with the eCATT and creating one VA01 manually (wit
-
I was under the impression that you could combine different AIR help files and access them through the AIR help viewer. Is that correct? Can anyone point me to any information about how to do that?
-
hai, i have a web application and i use bean to do the database operations...i like to use a configuration file where i can store the database connection parameters like hostname, username and password so that i can change them without recompiling th