<commit_before>// ==========================================================================
//                        DG.HierTableView
//
//  A wrapper view for multiple DG.CaseTableViews.
//
//  Author:   <NAME>
//
//  Copyright (c) 2014 by The Concord Consortium, Inc. All rights reserved.
//
//  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.
// ==========================================================================

sc_require('components/case_table/case_table_drop_target');
sc_require('components/case_table/case_table_view');
sc_require('components/case_table/relation_divider_view');

/** @class

  A HierTableView contains a multiple scrollable data grid views.

  The DG.HierTableView is the superview for the individual DG.CaseTableViews and the
  DG.RelationDividerViews that are used to divide them.
  Eventually, it will need to support an arbitrary number of collections, rather than
  being hard-coded at two as it is now.

  @extends SC.SplitView
*/
DG.HierTableView = SC.ScrollView.extend( (function() {
/** @scope DG.HierTableView.prototype */

  var /*kColumnHeaderBackgroundColor = '#E6E6E6',*/
      kDefaultColumnWidth = 60,
      kMinTableWidth = kDefaultColumnWidth;

  return {

    /**
     * We scroll horizontally. Vertical scrolling is within case tables.
     */
    hasHorizontalScroller: YES,
    hasVerticalScroller: NO,
    horizontalOverlay: NO, // default YES
    //horizontalFade: YES, // default YES, applies if horizontalOverlay is true
    autohidesHorizontalScroller: YES, // default YES
    horizontalAlign: SC.ALIGN_LEFT, // default SC.ALIGN_CENTER

    classNames: 'dg-hier-table-view',

    /**
     The data context for which the table is displaying data.
     @property   {DG.DataContext}
     */
    dataContext: null,

    layout: { left: 0, top: 0, right: 0, bottom: 8 },

    /**
     * Whether the component is ready.
     *
     * The component size will not be adjusted until it is ready.
     * @type {boolean}
     */
    isReady: false,

    /**
     * Observes when the component's selection state changes. We need to
     * remove header menus when the component goes out of selection.
     */
    isSelectedDidChange: function () {
      if (!this.getPath('parentView.parentView.isSelected')) {
        // DG.log('Hiding Header Menus');
        this.contentView.hideHeaderMenus();
      }
    }.observes('parentView.parentView.isSelected'),

    /**
     * The maximum width the DG.Component will permit by dragging.
     *
     * @type {number} pixels
     */
    containerMaxWidth: function () {
      return this.getPath('contentView.frame.width');
    }.property(),

    init: function() {
      sc_super();
      // Adjust the horizontal scrollbar so that the right scroll arrow can be hit.
      this.set('horizontalScrollerLayout', { left: 0, right: 18, top: 0, bottom: 8 });
    },<commit_msg>[#168019881] Bug fix: Case table scrolling misbehavior<commit_after>// ==========================================================================
//                        DG.HierTableView
//
//  A wrapper view for multiple DG.CaseTableViews.
//
//  Author:   <NAME>
//
//  Copyright (c) 2014 by The Concord Consortium, Inc. All rights reserved.
//
//  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.
// ==========================================================================

sc_require('components/case_table/case_table_drop_target');
sc_require('components/case_table/case_table_view');
sc_require('components/case_table/relation_divider_view');

/** @class

  A HierTableView contains a multiple scrollable data grid views.

  The DG.HierTableView is the superview for the individual DG.CaseTableViews and the
  DG.RelationDividerViews that are used to divide them.
  Eventually, it will need to support an arbitrary number of collections, rather than
  being hard-coded at two as it is now.

  @extends SC.SplitView
*/
DG.HierTableView = SC.ScrollView.extend( (function() {
/** @scope DG.HierTableView.prototype */

  var /*kColumnHeaderBackgroundColor = '#E6E6E6',*/
      kDefaultColumnWidth = 60,
      kMinTableWidth = kDefaultColumnWidth;

  return {

    isVisibleChanged: function() {
      console.log('isVisibleChanged');
    }.observes('isVisible'),

    /**
     * We scroll horizontally. Vertical scrolling is within case tables.
     */
    hasHorizontalScroller: YES,
    hasVerticalScroller: NO,
    horizontalOverlay: NO, // default YES
    //horizontalFade: YES, // default YES, applies if horizontalOverlay is true
    autohidesHorizontalScroller: YES, // default YES
    horizontalAlign: SC.ALIGN_LEFT, // default SC.ALIGN_CENTER

    classNames: 'dg-hier-table-view',

    /**
     The data context for which the table is displaying data.
     @property   {DG.DataContext}
     */
    dataContext: null,

    layout: { left: 0, top: 0, right: 0, bottom: 8 },

    /**
     * Whether the component is ready.
     *
     * The component size will not be adjusted until it is ready.
     * @type {boolean}
     */
    isReady: false,

    /**
     * Observes when the component's selection state changes. We need to
     * remove header menus when the component goes out of selection.
     */
    isSelectedDidChange: function () {
      if (!this.getPath('parentView.parentView.isSelected')) {
        // DG.log('Hiding Header Menus');
        this.contentView.hideHeaderMenus();
      }
      this.setPath('horizontalScrollerView.isVisible', false);
      this.invokeLater( function() {
        this.setPath('horizontalScrollerView.isVisible', true);
      }, 10);
    }.observes('parentView.parentView.isSelected'),

    /**
     * The maximum width the DG.Component will permit by dragging.
     *
     * @type {number} pixels
     */
    containerMaxWidth: function () {
      return this.getPath('contentView.frame.width');
    }.property(),

    init: function() {
      sc_super();
      // Adjust the horizontal scrollbar so that the right scroll arrow can be hit.
      this.set('horizontalScrollerLayout', { left: 0, right: 18, top: 0, bottom: 8 });
    },
{'fraction_non_alphanumeric': 0.14263522101398107, 'fraction_numerical': 0.007767264510662336, 'mean_word_length': 3.1055072463768116, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '363933', 'n_tokens_mistral': 2038, 'n_tokens_neox': 1893, 'n_words': 649}