<commit_before>/*
 * Copyright 2011 Corpuslinguistic working group Humboldt University Berlin.
 *
 * 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 annis.gui;

import annis.libgui.Helper;
import annis.gui.beans.CorpusBrowserEntry;
import annis.gui.model.Query;
import annis.service.objects.AnnisAttribute;
import annis.service.objects.AnnisCorpus;
import com.sun.jersey.api.client.ClientHandlerException;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.UniformInterfaceException;
import com.sun.jersey.api.client.WebResource;
import com.vaadin.data.Item;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.data.util.DefaultItemSorter;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Accordion;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;
import org.slf4j.LoggerFactory;

/**
 *
 * @author thomas
 */
public class CorpusBrowserPanel extends Panel
{

  private static final org.slf4j.Logger log = LoggerFactory.getLogger(
    CorpusBrowserPanel.class);

  /**
   *
   */
  private static final long serialVersionUID = -1029743017413951838L;

  private AnnisCorpus corpus;

  private Table tblNodeAnno;

  private BeanItemContainer<CorpusBrowserEntry> containerNodeAnno;

  private Table tblEdgeTypes;

  private BeanItemContainer<CorpusBrowserEntry> containerEdgeType;

  private Table tblEdgeAnno;

  private BeanItemContainer<CorpusBrowserEntry> containerEdgeAnno;

  private Table tblMetaAnno;

  private BeanItemContainer<CorpusBrowserEntry> containerMetaAnno;

  private CitationLinkGenerator citationGenerator;

  private QueryController controller;

  public CorpusBrowserPanel(final AnnisCorpus corpus,
    QueryController controller)
  {
    super("Available annotations");
    this.corpus = corpus;
    this.controller = controller;

    setSizeFull();

    Accordion accordion = new Accordion();
    setContent(accordion);
    accordion.setSizeFull();

    containerNodeAnno = new BeanItemContainer<CorpusBrowserEntry>(
      CorpusBrowserEntry.class);
    containerNodeAnno.setItemSorter(new ExampleSorter());

    containerEdgeType = new BeanItemContainer<CorpusBrowserEntry>(
      CorpusBrowserEntry.class);
    containerEdgeType.setItemSorter(new ExampleSorter());

    containerEdgeAnno = new BeanItemContainer<CorpusBrowserEntry>(
      CorpusBrowserEntry.class);
    containerEdgeAnno.setItemSorter(new ExampleSorter());

    containerMetaAnno = new BeanItemContainer<CorpusBrowserEntry>(
      CorpusBrowserEntry.class);
    containerMetaAnno.setItemSorter(new ExampleSorter());

    citationGenerator = new CitationLinkGenerator();

    tblNodeAnno = new ExampleTable(citationGenerator, containerNodeAnno);
    tblNodeAnno.addValueChangeListener(new ExampleListener());

    tblEdgeTypes = new ExampleTable(citationGenerator, containerEdgeType);
    tblEdgeTypes.addValueChangeListener(new ExampleListener());

    tblEdgeAnno = new ExampleTable(citationGenerator, containerEdgeAnno);
    tblEdgeAnno.addValueChangeListener(new ExampleListener());

    tblMetaAnno = new ExampleTable(citationGenerator, containerMetaAnno);
    tblMetaAnno.addValueChangeListener(new ExampleListener());

    accordion.addTab(tblNodeAnno, "Node annotations", null);
    accordion.addTab(tblEdgeTypes, "Edge types", null);
    accordion.addTab(tblEdgeAnno, "Edge annotations", null);
    accordion.addTab(tblMetaAnno, "Meta annotations", null);

    boolean stripNodeAnno = true;
    boolean stripEdgeName = true;
    boolean stripEdgeAnno = true;
    HashSet<String> nodeAnnoNames = new HashSet<String>();
    HashSet<String> edgeAnnoNames = new HashSet<String>();
    HashSet<String> edgeNames = new HashSet<String>();
    HashSet<String> fullEdgeNames = new HashSet<String>();
    boolean hasDominance = false;

    List<AnnisAttribute> attributes = fetchAnnos(corpus.getName());

    // do some preparations first
    for (AnnisAttribute a : attributes)
    {<commit_msg>Rename the labels of metadata accordion panels.<commit_after>/*
 * Copyright 2011 Corpuslinguistic working group Humboldt University Berlin.
 *
 * 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 annis.gui;

import annis.libgui.Helper;
import annis.gui.beans.CorpusBrowserEntry;
import annis.gui.model.Query;
import annis.service.objects.AnnisAttribute;
import annis.service.objects.AnnisCorpus;
import com.sun.jersey.api.client.ClientHandlerException;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.UniformInterfaceException;
import com.sun.jersey.api.client.WebResource;
import com.vaadin.data.Item;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.data.util.DefaultItemSorter;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Accordion;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;
import org.slf4j.LoggerFactory;

/**
 *
 * @author thomas
 */
public class CorpusBrowserPanel extends Panel
{

  private static final org.slf4j.Logger log = LoggerFactory.getLogger(
    CorpusBrowserPanel.class);

  /**
   *
   */
  private static final long serialVersionUID = -1029743017413951838L;

  private AnnisCorpus corpus;

  private Table tblNodeAnno;

  private BeanItemContainer<CorpusBrowserEntry> containerNodeAnno;

  private Table tblEdgeTypes;

  private BeanItemContainer<CorpusBrowserEntry> containerEdgeType;

  private Table tblEdgeAnno;

  private BeanItemContainer<CorpusBrowserEntry> containerEdgeAnno;

  private Table tblMetaAnno;

  private BeanItemContainer<CorpusBrowserEntry> containerMetaAnno;

  private CitationLinkGenerator citationGenerator;

  private QueryController controller;

  public CorpusBrowserPanel(final AnnisCorpus corpus,
    QueryController controller)
  {
    super("Available annotations");
    this.corpus = corpus;
    this.controller = controller;

    setSizeFull();

    Accordion accordion = new Accordion();
    setContent(accordion);
    accordion.setSizeFull();

    containerNodeAnno = new BeanItemContainer<CorpusBrowserEntry>(
      CorpusBrowserEntry.class);
    containerNodeAnno.setItemSorter(new ExampleSorter());

    containerEdgeType = new BeanItemContainer<CorpusBrowserEntry>(
      CorpusBrowserEntry.class);
    containerEdgeType.setItemSorter(new ExampleSorter());

    containerEdgeAnno = new BeanItemContainer<CorpusBrowserEntry>(
      CorpusBrowserEntry.class);
    containerEdgeAnno.setItemSorter(new ExampleSorter());

    containerMetaAnno = new BeanItemContainer<CorpusBrowserEntry>(
      CorpusBrowserEntry.class);
    containerMetaAnno.setItemSorter(new ExampleSorter());

    citationGenerator = new CitationLinkGenerator();

    tblNodeAnno = new ExampleTable(citationGenerator, containerNodeAnno);
    tblNodeAnno.addValueChangeListener(new ExampleListener());

    tblEdgeTypes = new ExampleTable(citationGenerator, containerEdgeType);
    tblEdgeTypes.addValueChangeListener(new ExampleListener());

    tblEdgeAnno = new ExampleTable(citationGenerator, containerEdgeAnno);
    tblEdgeAnno.addValueChangeListener(new ExampleListener());

    tblMetaAnno = new ExampleTable(citationGenerator, containerMetaAnno);
    tblMetaAnno.addValueChangeListener(new ExampleListener());

    accordion.addTab(tblNodeAnno, "Node Annotations", null);
    accordion.addTab(tblEdgeTypes, "Edge Types", null);
    accordion.addTab(tblEdgeAnno, "Edge Annotations", null);
    accordion.addTab(tblMetaAnno, "Meta Annotations", null);

    boolean stripNodeAnno = true;
    boolean stripEdgeName = true;
    boolean stripEdgeAnno = true;
    HashSet<String> nodeAnnoNames = new HashSet<String>();
    HashSet<String> edgeAnnoNames = new HashSet<String>();
    HashSet<String> edgeNames = new HashSet<String>();
    HashSet<String> fullEdgeNames = new HashSet<String>();
    boolean hasDominance = false;

    List<AnnisAttribute> attributes = fetchAnnos(corpus.getName());

    // do some preparations first
    for (AnnisAttribute a : attributes)
    {
{'fraction_non_alphanumeric': 0.08733670459334177, 'fraction_numerical': 0.006110408765276022, 'mean_word_length': 5.100899742930591, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6537957', 'n_tokens_mistral': 2827, 'n_tokens_neox': 2651, 'n_words': 636}