// Path: src/main/java/com/cathive/fx/guice/controllerlookup/IdentifiableController.java
// public interface IdentifiableController {
// 
//     /**
//      * @return The string ID that can be used to lookup this controller. This
//      *         could be hard coded or could return the ID set on the FXML for
//      *         this control in the {@link Parent}.
//      */
//     String getId();
// 
// }
// 
// Path: src/main/java/com/cathive/fx/guice/controllerlookup/ParentIDFinder.java
// public final class ParentIDFinder {
// 
//     /** Private constructor - should never be needed. */
//     private ParentIDFinder() {
//         // Intentionally left empty.
//         // No instance of this class should ever be needed.
//     }
// 
//     /**
//      * Find a non {@code null} ID on the given {@link Parent}. If the ID is
//      * {@code null} then search up the graph to find a node with the given ID.
//      * 
//      * @param node
//      *            The starting node.
//      * @return The ID of this node or the ID of the parent if this is
//      *         {@code null}, if this is also null then the parent's parent will
//      *         be returned if non-{@code null} and so on. If no parent's have an
//      *         ID set then {@code null} is returned.
//      */
//     public static String getParentId(final Node node) {
//         final String parentId;
//         if (node == null) {
//             parentId = null;
//         } else if (node.getId() != null) {
//             parentId = node.getId();
//         } else {
//             parentId = getParentId(node.getParent());
//         }
//         return parentId;
//     }
// 
// }


import javafx.fxml.FXML;
import javafx.scene.Parent;
import com.cathive.fx.guice.FXMLController;
import com.cathive.fx.guice.controllerlookup.IdentifiableController;
import com.cathive.fx.guice.controllerlookup.ParentIDFinder;
/*
 * Copyright (C) 2012 The Cat Hive Developers.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cathive.fx.guice.lookupexample;



@FXMLController
public class InnerLookupController implements IdentifiableController {

    @FXML
    private Parent root;
    
    @Override
    public String getId() {
// Path: src/main/java/com/cathive/fx/guice/controllerlookup/IdentifiableController.java
// public interface IdentifiableController {
// 
//     /**
//      * @return The string ID that can be used to lookup this controller. This
//      *         could be hard coded or could return the ID set on the FXML for
//      *         this control in the {@link Parent}.
//      */
//     String getId();
// 
// }
// 
// Path: src/main/java/com/cathive/fx/guice/controllerlookup/ParentIDFinder.java
// public final class ParentIDFinder {
// 
//     /** Private constructor - should never be needed. */
//     private ParentIDFinder() {
//         // Intentionally left empty.
//         // No instance of this class should ever be needed.
//     }
// 
//     /**
//      * Find a non {@code null} ID on the given {@link Parent}. If the ID is
//      * {@code null} then search up the graph to find a node with the given ID.
//      * 
//      * @param node
//      *            The starting node.
//      * @return The ID of this node or the ID of the parent if this is
//      *         {@code null}, if this is also null then the parent's parent will
//      *         be returned if non-{@code null} and so on. If no parent's have an
//      *         ID set then {@code null} is returned.
//      */
//     public static String getParentId(final Node node) {
//         final String parentId;
//         if (node == null) {
//             parentId = null;
//         } else if (node.getId() != null) {
//             parentId = node.getId();
//         } else {
//             parentId = getParentId(node.getParent());
//         }
//         return parentId;
//     }
// 
// }


// Path: src/test/java/com/cathive/fx/guice/lookupexample/InnerLookupController.java
import javafx.fxml.FXML;
import javafx.scene.Parent;
import com.cathive.fx.guice.FXMLController;
import com.cathive.fx.guice.controllerlookup.IdentifiableController;
import com.cathive.fx.guice.controllerlookup.ParentIDFinder;

/*
 * Copyright (C) 2012 The Cat Hive Developers.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cathive.fx.guice.lookupexample;



@FXMLController
public class InnerLookupController implements IdentifiableController {

    @FXML
    private Parent root;
    
    @Override
    public String getId() {
        return ParentIDFinder.getParentId(root);