Giter VIP home page Giter VIP logo

pstreegraph's People

Contributors

bitdeli-chef avatar epreston avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pstreegraph's Issues

How to add new objects to tree and refresh

Absolutely fantastic control! Forgive me for creating an issue, as I just really want to ask you a question.

How do I add a new item to the tree and refresh the tree to show the new item while the app is running.

  • (void)addButtonTapped:(id)sender
    {
    NSLog(@"addButtonTapped model root %@", treeGraphView.modelRoot);

    EntityModel *rootEntity = (EntityModel *)treeGraphView.modelRoot;
    EntityModel *newEntityModel = [[EntityModel alloc]initWithParentNode:rootEntity];

    [rootEntity addChildModelNode:newEntityModel];
    [newEntityModel release];
    }

Add Leaf node on second or third row

Hello Team,

I'll really appreciate the work you done in Tree Graph API. I'm looking for some customization in it.

For example: For root node , we have multiple childs lets say 18 childs in a row for single root node.
Can we show fixed 8 or 10 childs in row and then rest childs should be desing in second row of it. I have atttached screen shots of what i m looking for. also added present implementaion.

Also. Is this possible to add childs left and right side of connectingLine. Attached shot for it too.

Please help me in customizations like this. I'll really thankful to you.

presentimplementation
requiredimplementation
twotier_display

Animations for lines and nodes are approximate

When child nodes are expanded and collapsed, the animations for the lines connecting them are close but not exact. The animations are quick so it appears to be correct. Improvement can be made in this area.

Rendering issue: connecting lines not drawn

Hi,

I just did a simple test, with a larger object tree.

Doing that, the connecting lines between the root node and its first siblings will not be drawn.
If you move the tree in the iPhone simulator, the display will be cluttered. It seems to me, that there is a horizontal band, which is not redrawn correctly.

You can repeat this test very easily, by just replacing the line
[self setRootClassName:@"UIControl"];
with
[self setRootClassName:@"NSObject"];
in the PSHTreeGraphViewController.m file.

If you would do the same in the original Apple's TreeViewExample, the rendering is correct.
I saw this behaviour in the IOS Simulator for the iPhone and iPad as well.

Any ideas how to fix this?
Best wishes Johannes

toggleExpansion not triggered

Hi

Could you provide some documentation on the following?

I seem to have an issue with the events fired:
toggleExpansion of the SubtreeView is never called when pressing the icon.
I did correctly wire my model, and the root item implemented the required protocol methods.
The children also get rendered, but behind the rootModel. and I can't seem to interact at all, and every touch on the leaf view calls touchesBegan instead of toggleExpansion.
I'm guessing there is something I'm missing by looking at the example as a reference?

Any ideas as to what this is?

Kind regards,
0x

Keyboard navigation when flipped

The keyboard navigation might need to be updated when the view is flipped. The "a" and "d" keys should logically move left and right around the hierarchy to the nearest node to each side.

Node selection not working

Node selection does not change as items are pressed. The root node remains selected in the sample project. Multiple node selection not possible.

How to Extend this Implementation to work with nodes having multiple parents? (Flow Charts)

Hi,

I would like to use this awesome implementation of tree structure for my requirement (to draw a flowchart). Here I have a requirement where I need to draw a flow chart in a na iPad. The chart is similar to tree-structure this project, just that a node might have multiple parents.

I tried to start editing the code by first changing the - (id <PSTreeGraphModelNode> )parentModelNode; method in PSTreeGraphModelNode protocol to - (NSArray <PSTreeGraphModelNode> *)parentModelNode;

I met lot of roadblocks in #pragma mark - Model Tree Navigation implementations of PSBaseTreeGraphView.m. I would like to know if these implementations can be discarded because I do not need #pragma mark - Selection State methods as I intend to show all the nodes.

Any help is well appreciated.

Tip: toggle expand/collapse button with different icons

Hello,

this is just a little info.
If you want that the expand/collapse button of the provided example app shows the according icon of the tree state (collapsed/expanded), then you can achieve this behaviour with this code snippet.
Just connect the IBAction "toggleUIButtonImage" with the "Touch up inside" event in the IB of your xxxleaf.xib.

-(IBAction) toggleUIButtonImage:(id)sender{
if ([sender isSelected]) {
[sender setImage:[UIImage imageNamed:@"TreeViewSubtreeCollapsedButton.png"] forState:UIControlStateNormal];
[sender setSelected:NO];
}else {
[sender setImage:[UIImage imageNamed:@"TreeViewSubtreeExpandedButton.png"] forState:UIControlStateSelected];
[sender setSelected:YES];

}

}

HTH Johannes

Creating a data model

Hi again,

I seem to have a hit another snag. I'm trying to create a graph like this.

model

How can I create a custom model for something like this? What type of data structure should I use? In the example, I see you're using the NSObject and its descendants. How can I create a something similar for my graph too.

Many thanks.

Tip: toggle expand/collapse button with different icons

Hello,

this is just a little info.
If you want that the expand/collapse button of the provided example app shows the according icon of the tree state (collapsed/expanded), then you can achieve this behaviour with this code snippet.
Just connect the IBAction "toggleUIButtonImage" with the "Touch up inside" event in the IB of your xxxleaf.xib.

-(IBAction) toggleUIButtonImage:(id)sender{
if ([sender isSelected]) {
[sender setImage:[UIImage imageNamed:@"TreeViewSubtreeCollapsedButton.png"] forState:UIControlStateNormal];
[sender setSelected:NO];
}else {
[sender setImage:[UIImage imageNamed:@"TreeViewSubtreeExpandedButton.png"] forState:UIControlStateSelected];
[sender setSelected:YES];

}

}

HTH Johannes

Tip: showsSubtreeFrames

Hi, just a little info.

There exists a flag named "showsSubtreeFrames", which might help you by visual inspecting your subtrees.
Setting this flag to YES and the corresponding subtrees are surrounded by a green rectangle.

HTH Johannes

Cannot find Documentation build target

Hi,
thanks for the great control. I cannot seem to find the 'Documentation' build target to generate the docs. I have successfully installed Doxygen.

Can you please tell me where to select the build targets in Xcode 5?

Thanks

Zoom

Is it possible to implement a zoom in zoom out feature?

IOS PSTreeGraphView , How to create two node One left side and one right side

Hello sir,
after first node , i have to create right side and left side add one node . so i am confuse How can i do this . please give me solution . same question i have post on stackoverflow . http://stackoverflow.com/questions/40631912/ios-pstreegraphview-how-to-create-two-node-one-left-side-and-one-right-side
on this stackoverflow i have add images this easy to undastanding my problem.
plase share with me you valuable knowledge .

Adopt instance variable hiding

Move instance variables to the class extension in the implementation file. Where possible, dependant headers will also be moved into the implementation file as well. These changes will clean up the header files greatly.

It is now possible to place the instance variables (specifically the ones that you want to be private) into the implementation section or into a class extension. I typically use a class extension in the implementation file for private interfaces, so it makes sense to group things there.

Some dependant header files are included in project header files just for these instance variables. Once the variables are moved into the implementation file, some dependant headers can be hidden in the implementation file as well.

Cleanup layout code

The layout code for horizontal and vertical rendering is all mixed together in single methods. This needs to be refactored into separate methods for clarity and future improvements.

Adopt the @autoreleasepool language extension

Replace the NSAutoreleasePool wrapper object usage with the new direct language construct. An example is found below.

    @autoreleasepool {
        // code for nested auto-release pool here
    }

This syntax requires Xcode 4.2

Drawing a PSTreeGrap bottom-up

Hi, I really love your PSTreeGraph! Thank you for your time spent on this, I think.
I just want to know if it is possible to place a root on the bottom of the screen and draw a tree bottom-up? Thank you

Use json in PSTreeGraph

Hello,
First of all thanks for creating PSTreeGraph it is very good But I am having one issue i.e. I trying to customize the PSTreeGraph and use json as datasource, I already referred the issue that MR. johannes has posted (URL : #9).

Can you please share more detail for same, It would be very help-full for me because I have wasted 3 days on same

customizing the leaf view

Thanks for the great work you've put into this. I have a couple observations.

In my leaf view subclass, I tried setting the fill color within initWithFrame but found that it wasn't being called. InitWithCoder is though. Additionally, although the fill color was being set, it was later being reset by configureDetaults in PSBaseLeafView.m because of a call from within awakeFromNib.

Fun with tap gesture: collapse / expand tree

Hi,

this is just a little hack to get a collapsing or expanding tree with a double tap gesture.
Thanks to the excellent design of PSTreeGraph, this feature is easy to realize.

First implement the tap gesture recognizer:

  • (void) initTapGestureRecognition {
    UITapGestureRecognizer *tapDoubleGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
    tapDoubleGesture.numberOfTapsRequired = 2;
    [self addGestureRecognizer:tapDoubleGesture];
    [tapDoubleGesture release];
    }

With a double tap on the view, the "handleDoubleTap" function is called:

-(void)handleDoubleTap:(UITapGestureRecognizer*)gestureRecognizer {

if (gestureRecognizer.state == UIGestureRecognizerStateEnded)
{
    NSLog(@"See a tap double gesture");
    ruleOutsTreeView = [gestureRecognizer view];
    if (isCollapsed) {
        [ruleOutsTreeView expandRoot];
        isCollapsed = false;
    }
    else if (!isCollapsed) {
        [ruleOutsTreeView collapseRoot];
        isCollapsed = true;
    }
}

}

"isCollapsed" is just a local, private variable, which holds the state of the tree.
"ruleOutsTreeView" represents the "PSBaseTreeGraphView".

You can register the tap gesture recognizer in your custom tree view class, e.g. PSHTreeGraphView

  • (id) initWithCoder:(NSCoder *)decoder
    {
    self = [super initWithCoder:decoder];
    if (self) {

        // Initialization code when loaded from XIB (this example)
        // init gesture recognizer
    [self initTapGestureRecognition];
    bool isCollapsed = false;
    

    }
    return self;
    }

To get the tree collapsed or expanded, I modified the functions "expandRoot()" and "collapseRoot()" of PSBaseTreeGraphView.m
E.g.:

  • (void) collapseRoot
    {
    [UIView beginAnimations:@"TreeNodeExpansion" context:nil];
    [UIView setAnimationDuration:2.0];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    [[self rootSubtreeView] setExpanded:NO];
    [[[self rootSubtreeView] enclosingTreeGraph] layoutGraphIfNeeded];

    [UIView commitAnimations];
    }

  • (void) expandRoot
    {
    [UIView beginAnimations:@"TreeNodeExpansion" context:nil];
    [UIView setAnimationDuration:2.0];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    [[self rootSubtreeView] setExpanded:NO]; // if not set, a collapsed subtree node will not expand
    [[self rootSubtreeView] setExpanded:YES];
    [[[self rootSubtreeView] enclosingTreeGraph] layoutGraphIfNeeded];

    [UIView commitAnimations];

}

That's all, now you have a tree collapsing or expanding with a double tap.

Have fun
Johannes

Q: showing only the next layer and not the whole tree

Hello,

i would like to start with a collapsed tree and with pressing the expand button, only the next layer of the subtree should be shown.
Actually the whole subtree is displayed.
Has anybody realized such a feature?

Yours Johannes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.