<commit_before>package nl.mpi.kinnate.ui;

import java.net.URI;
import java.net.URISyntaxException;
import nl.mpi.arbil.data.ArbilDataNode;
import nl.mpi.arbil.data.ArbilDataNodeLoader;
import nl.mpi.arbil.data.ArbilNode;
import nl.mpi.arbil.ui.ArbilTableModel;
import nl.mpi.arbil.ui.ArbilTree;
import nl.mpi.arbil.ui.GuiHelper;
import nl.mpi.kinnate.data.KinTreeNode;
import nl.mpi.kinnate.svg.GraphPanel;
import nl.mpi.kinnate.uniqueidentifiers.UniqueIdentifier;

/**
 *  Document   : KinTree
 *  Created on : Aug 25, 2011, 11:44:11 AM
 *  Author     : <NAME>
 */
public class KinTree extends ArbilTree {

    GraphPanel graphPanel;

    public KinTree(GraphPanel graphPanel) {
        this.graphPanel = graphPanel;
    }

    @Override
    protected void putSelectionIntoPreviewTable() {
        // todo: in arbil the preview table only shows the lead selection, however in the kinship tree it might best to show the entire selection
        ArbilNode arbilNode = getLeadSelectionNode();
        if (arbilNode instanceof ArbilDataNode) {
            // clear the graph selection
            graphPanel.setSelectedIds(new UniqueIdentifier[]{});
            super.putSelectionIntoPreviewTable();
        } else if (arbilNode instanceof KinTreeNode) {
            final KinTreeNode kinTreeNode = (KinTreeNode) arbilNode;
            // set the graph selection
            if (kinTreeNode.entityData != null) {
                graphPanel.setSelectedIds(new UniqueIdentifier[]{kinTreeNode.entityData.getUniqueIdentifier()});
                final ArbilTableModel previewTableModel = customPreviewTable.getArbilTableModel();
                try {
                    final ArbilDataNode arbilDataNode = ArbilDataNodeLoader.getSingleInstance().getArbilDataNode(null, new URI(((KinTreeNode) arbilNode).entityData.getEntityPath()));
                    if (!(previewTableModel.getArbilDataNodeCount() == 1 && previewTableModel.containsArbilDataNode(arbilDataNode))) {
                        previewTableModel.removeAllArbilDataNodeRows();
                        previewTableModel.addSingleArbilDataNode(arbilDataNode);
                    }
                } catch (URISyntaxException urise) {
                    GuiHelper.linorgBugCatcher.logError(urise);
                }
            }
        }
    }
}<commit_msg>Added metadata panel to handle tree and graph selection by hiding and showing of the table, editors and linked archive data.<commit_after>package nl.mpi.kinnate.ui;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import nl.mpi.arbil.data.ArbilDataNode;
import nl.mpi.arbil.data.ArbilDataNodeLoader;
import nl.mpi.arbil.data.ArbilNode;
import nl.mpi.arbil.ui.ArbilTree;
import nl.mpi.arbil.ui.GuiHelper;
import nl.mpi.kinnate.data.KinTreeNode;
import nl.mpi.kinnate.svg.GraphPanel;
import nl.mpi.kinnate.uniqueidentifiers.UniqueIdentifier;

/**
 *  Document   : KinTree
 *  Created on : Aug 25, 2011, 11:44:11 AM
 *  Author     : <NAME>
 */
public class KinTree extends ArbilTree {

    GraphPanel graphPanel;

    public KinTree(GraphPanel graphPanel) {
        this.graphPanel = graphPanel;
    }

    @Override
    protected void putSelectionIntoPreviewTable() {
        // todo: in arbil the preview table only shows the lead selection, however in the kinship tree it might best to show the entire selection
        ArbilNode[] arbilNodeArray = getAllSelectedNodes(); //LeadSelectionNode();
        ArrayList<UniqueIdentifier> identifierList = new ArrayList<UniqueIdentifier>();
//        ArrayList<URI> uriList = new ArrayList<URI>();
        graphPanel.metadataPanel.removeAllArbilDataNodeRows();
        for (ArbilNode arbilNode : arbilNodeArray) {
            if (arbilNode instanceof ArbilDataNode) {
//                uriList.add(((ArbilDataNode) arbilNode).getURI());
                graphPanel.metadataPanel.addSingleArbilDataNode((ArbilDataNode) arbilNode);
            } else if (arbilNode instanceof KinTreeNode) {
                final KinTreeNode kinTreeNode = (KinTreeNode) arbilNode;
                // set the graph selection
                if (kinTreeNode.entityData != null) {
                    identifierList.add(kinTreeNode.entityData.getUniqueIdentifier());
                    try {
                        final ArbilDataNode arbilDataNode = ArbilDataNodeLoader.getSingleInstance().getArbilDataNode(null, new URI(((KinTreeNode) arbilNode).entityData.getEntityPath()));
                        graphPanel.metadataPanel.addSingleArbilDataNode(arbilDataNode);
                    } catch (URISyntaxException urise) {
                        GuiHelper.linorgBugCatcher.logError(urise);
                    }
                }
            }
        }
        // set the graph selection
        graphPanel.setSelectedIds(identifierList.toArray(new UniqueIdentifier[]{}));
        graphPanel.metadataPanel.updateEditorPane();
    }
}
{'fraction_non_alphanumeric': 0.0896312894683235, 'fraction_numerical': 0.005092686901609289, 'mean_word_length': 2.7624521072796937, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '367314', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1350, 'n_words': 288}