<commit_before>package org.pentaho.ui.xul.gwt.tags;

import org.pentaho.gwt.widgets.client.menuitem.PentahoMenuItem;
import org.pentaho.ui.xul.XulDomContainer;
import org.pentaho.ui.xul.components.XulMenuitem;
import org.pentaho.ui.xul.containers.XulMenupopup;
import org.pentaho.ui.xul.dom.Element;
import org.pentaho.ui.xul.gwt.AbstractGwtXulComponent;
import org.pentaho.ui.xul.gwt.GwtXulHandler;
import org.pentaho.ui.xul.gwt.GwtXulParser;
import org.pentaho.ui.xul.stereotype.Bindable;

import com.google.gwt.user.client.Command;

public class GwtMenuitem extends AbstractGwtXulComponent implements XulMenuitem {

  static final String ELEMENT_NAME = "menuitem"; //$NON-NLS-1$

  public static void register() {
    GwtXulParser.registerHandler(ELEMENT_NAME, new GwtXulHandler() {
      public Element newInstance() {
        return new GwtMenuitem();
      }
    });
  }

  private String image;
  private String jscommand;
  private String command;
  private PentahoMenuItem menuitem;
  private boolean isSelected;

  public GwtMenuitem() {
    super(ELEMENT_NAME);
    menuitem = new PentahoMenuItem("blank", (Command) null);
    setManagedObject(menuitem);
  }

  public GwtMenuitem(XulMenupopup popup) {
    this();

  }

  @Override
  public void init(com.google.gwt.xml.client.Element srcEle, XulDomContainer container) {
    super.init(srcEle, container);
    String type = srcEle.getAttribute("type");
    if ("checkbox".equalsIgnoreCase(type)) {
      boolean checked = "true".equals(srcEle.getAttribute("checked"));
      menuitem.setUseCheckUI(true);
      menuitem.setChecked(checked);
    }
    this.setLabel(srcEle.getAttribute("label"));
    this.setCommand(srcEle.getAttribute("command"));
    this.setJscommand(srcEle.getAttribute("js-command"));
    this.setDisabled("true".equals(srcEle.getAttribute("disabled")));
  }

  public String getAcceltext() {
    return null;
  }

  public String getAccesskey() {
    return null;
  }

  public boolean isDisabled() {
    return !menuitem.isEnabled();
  }

  public boolean isChecked() {
      return menuitem.isChecked();
  }

  @Bindable
  public void setVisible(boolean visible) {
    this.visible = visible;
    menuitem.getElement().getStyle().setProperty("display", (this.visible) ? "" : "none"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  }
  
  public String getLabel() {
    return menuitem.getText();
  }

  public void setAcceltext(String accel) {
    throw new RuntimeException("Not implemented");
  }

  public void setAccesskey(String accessKey) {
    throw new RuntimeException("Not implemented");
  }

  public void setDisabled(boolean disabled) {
    menuitem.setEnabled(!disabled);
  }

  public void setDisabled(String disabled) {
    menuitem.setEnabled("false".equals(disabled));
  }

  public void setChecked(boolean checked) {
    menuitem.setUseCheckUI(true);
    menuitem.setChecked(checked);
  }

  public void setChecked(String checked) {
    menuitem.setUseCheckUI(true);
    menuitem.setChecked("true".equals(checked));
  }

  public void setLabel(String label) {
    menuitem.setText(label);
  }

  public String getImage() {
    return image;
  }<commit_msg>BISERVER-7699 Fix PUC Browser Panel Expand/Collapse stability<commit_after>package org.pentaho.ui.xul.gwt.tags;

import org.pentaho.gwt.widgets.client.menuitem.PentahoMenuItem;
import org.pentaho.ui.xul.XulDomContainer;
import org.pentaho.ui.xul.components.XulMenuitem;
import org.pentaho.ui.xul.containers.XulMenupopup;
import org.pentaho.ui.xul.dom.Element;
import org.pentaho.ui.xul.gwt.AbstractGwtXulComponent;
import org.pentaho.ui.xul.gwt.GwtXulHandler;
import org.pentaho.ui.xul.gwt.GwtXulParser;
import org.pentaho.ui.xul.stereotype.Bindable;

import com.google.gwt.user.client.Command;

public class GwtMenuitem extends AbstractGwtXulComponent implements XulMenuitem {

  static final String ELEMENT_NAME = "menuitem"; //$NON-NLS-1$

  public static void register() {
    GwtXulParser.registerHandler(ELEMENT_NAME, new GwtXulHandler() {
      public Element newInstance() {
        return new GwtMenuitem();
      }
    });
  }

  private String image;
  private String jscommand;
  private String command;
  private PentahoMenuItem menuitem;
  private boolean isSelected;

  public GwtMenuitem() {
    super(ELEMENT_NAME);
    menuitem = new PentahoMenuItem("blank", (Command) null);
    setManagedObject(menuitem);
  }

  public GwtMenuitem(XulMenupopup popup) {
    this();

  }

  @Override
  public void init(com.google.gwt.xml.client.Element srcEle, XulDomContainer container) {
    super.init(srcEle, container);
    String type = srcEle.getAttribute("type");
    if ("checkbox".equalsIgnoreCase(type)) {
      boolean checked = "true".equals(srcEle.getAttribute("checked"));
      menuitem.setUseCheckUI(true);
      menuitem.setChecked(checked);
    }
    this.setLabel(srcEle.getAttribute("label"));
    this.setCommand(srcEle.getAttribute("command"));
    this.setJscommand(srcEle.getAttribute("js-command"));
    this.setDisabled("true".equals(srcEle.getAttribute("disabled")));
  }

  public String getAcceltext() {
    return null;
  }

  public String getAccesskey() {
    return null;
  }

  public boolean isDisabled() {
    return !menuitem.isEnabled();
  }

  @Bindable
  public boolean isChecked() {
      return menuitem.isChecked();
  }

  @Bindable
  public void setVisible(boolean visible) {
    this.visible = visible;
    menuitem.getElement().getStyle().setProperty("display", (this.visible) ? "" : "none"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  }
  
  public String getLabel() {
    return menuitem.getText();
  }

  public void setAcceltext(String accel) {
    throw new RuntimeException("Not implemented");
  }

  public void setAccesskey(String accessKey) {
    throw new RuntimeException("Not implemented");
  }

  public void setDisabled(boolean disabled) {
    menuitem.setEnabled(!disabled);
  }

  public void setDisabled(String disabled) {
    menuitem.setEnabled("false".equals(disabled));
  }

  @Bindable
  public void setChecked(boolean checked) {
    menuitem.setUseCheckUI(true);
    menuitem.setChecked(checked);
  }

  public void setChecked(String checked) {
    menuitem.setUseCheckUI(true);
    menuitem.setChecked("true".equals(checked));
  }

  public void setLabel(String label) {
    menuitem.setText(label);
  }

  public String getImage() {
    return image;
  }
{'fraction_non_alphanumeric': 0.12269170579029734, 'fraction_numerical': 0.0018779342723004694, 'mean_word_length': 4.060174188440222, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '828233', 'n_tokens_mistral': 2093, 'n_tokens_neox': 2090, 'n_words': 378}