<commit_before>/**
 * Manage a display
 * 
 * @param {Display} display
 * @param {Application} display
 */
function DisplayManager(display, application){
  this.display = display;
  this.application = application;
};

/**
 * Draw the display manager
 * 
 * @param {jQuery} canvas
 */
DisplayManager.prototype.init = function(canvas){
  var container = $('<div>').addClass('yui-g');
  var left = $('<div>').addClass('yui-u first').attr('id', 'chooser');
  var right = $('<div>').addClass('yui-u').attr('id', 'chosen');
  container.append(left);
  container.append(right);
  canvas.append(container);
  this.drawChooser();
  this.drawChosen();
};

/**
 * Draw the chooser
 * 
 * @param {jQuery} canvas
 */
DisplayManager.prototype.drawChooser = function(){
  var self = this;
  var div = $('<div>');
  div.append($('<h3>').html('Available Elements'));
  div.append(this.shrinkButton('Applicant', this.applicantBox()));
  
  $.each(this.application.listApplicationPages(), function(){
    div.append(self.shrinkButton(this.title, self.pageBox(this)));
  });
  
  $('.shrink_button', div).click(function() {
    $(this).next().toggle('slow');
    return false;
  }).next().hide();

  $('#chooser').empty().append(div);
};

/**
 * Draw the displayed
 * 
 */
DisplayManager.prototype.drawChosen = function(){
  var div = $('<div>');
  div.append($('<h3>').html('Selected Items for ' + this.display.getName() + ' Display'));
  var self = this;
  var list = $('<ol>').addClass('block_list');
  $.each(this.display.listElements(),function(){<commit_msg>Add Select All/None to display manager for elements.<commit_after>/**
 * Manage a display
 * 
 * @param {Display} display
 * @param {Application} display
 */
function DisplayManager(display, application){
  this.display = display;
  this.application = application;
};

/**
 * Draw the display manager
 * 
 * @param {jQuery} canvas
 */
DisplayManager.prototype.init = function(canvas){
  var container = $('<div>').addClass('yui-g');
  var left = $('<div>').addClass('yui-u first').attr('id', 'chooser');
  var right = $('<div>').addClass('yui-u').attr('id', 'chosen');
  container.append(left);
  container.append(right);
  canvas.append(container);
  this.drawChooser();
  this.drawChosen();
};

/**
 * Draw the chooser
 * 
 * @param {jQuery} canvas
 */
DisplayManager.prototype.drawChooser = function(){
  var self = this;
  var div = $('<div>');
  div.append($('<h3>').html('Available Elements'));
  var button = $('<button>').html('Select All').button();
  button.click(function(e){
    var startWeight = self.nextWeight();
    $('ul.block_list li.item', div).not('.selected').each(function(i){
      var element = $(this).data('element');
      element.weight = startWeight +i;
      self.display.addElement(element);
    });
    self.drawChosen();
    self.drawChooser();
    return false;
  });
  $('h3',div).append(button);
  var button = $('<button>').html('Deselect All').button();
  button.click(function(e){
    var startWeight = self.nextWeight();
    $('ul.block_list li.item.selected', div).each(function(i){
      var element = $(this).data('element');
      self.display.removeElement(element);
    });
    self.drawChosen();
    self.drawChooser();
    return false;
  });
  $('h3',div).append(button);
  div.append(this.shrinkButton('Applicant', this.applicantBox()));
  
  $.each(this.application.listApplicationPages(), function(){
    div.append(self.shrinkButton(this.title, self.pageBox(this)));
  });
  
  $('.shrink_button', div).click(function() {
    $(this).next().toggle('slow');
    return false;
  }).next().hide();

  $('#chooser').empty().append(div);
};

/**
 * Draw the displayed
 * 
 */
DisplayManager.prototype.drawChosen = function(){
  var div = $('<div>');
  div.append($('<h3>').html('Selected Items for ' + this.display.getName() + ' Display'));
  var self = this;
  var list = $('<ol>').addClass('block_list');
  $.each(this.display.listElements(),function(){
{'fraction_non_alphanumeric': 0.2135799341271852, 'fraction_numerical': 0.0015201418799087915, 'mean_word_length': 4.2922252010723865, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '2263089', 'n_tokens_mistral': 1282, 'n_tokens_neox': 1254, 'n_words': 233}