Package org.mbhcare.client.ui

Source Code of org.mbhcare.client.ui.DiagnosisLabel$uiBinder

/**
*
*/
package org.mbhcare.client.ui;

import org.mbhcare.client.event.DiagnosisEventBus;
import org.mbhcare.client.i18n.DiagnosisConstants;
import org.mbhcare.shared.entity.DiagnosisDescription;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.Widget;

/**
* @author MCOSTA
*
*/
public class DiagnosisLabel extends Composite implements HasValue<DiagnosisDescription> {
 
  //@UiTemplate("DiagnosisPanel.ui.xml")
  interface uiBinder extends UiBinder<Widget, DiagnosisLabel> {}
  private static uiBinder uiBinder = GWT.create(uiBinder.class);
   
  @UiField Label title;
  String titleText = "";
  Boolean state;
  @UiField Label statelabel;
  @UiField Label description;
  @UiField HorizontalPanel descPanel;
 
  private DiagnosisConstants constants = DiagnosisEventBus.getConstants();
 
  /* (non-Javadoc)
   * @see com.google.gwt.user.client.ui.UIObject#setVisible(boolean)
   */
  @Override
  public void setVisible(boolean visible) {
    super.setVisible(visible);
  }
 
  @Override
  public void setTitle(String title){
    super.setTitle(title);
    this.title.setText(title+":");
    titleText = title;
  }
  /**
   *
   */
  public DiagnosisLabel() {
    initWidget(uiBinder.createAndBindUi(this))
  }
 
 
  @Override
  public DiagnosisDescription getValue() {
    // TODO Auto-generated method stub   
    return new DiagnosisDescription(state, description.getText());
  }

  @Override
  public void setValue(DiagnosisDescription value) {
    // TODO Auto-generated method stub
    state = value.getState();
    if (value.getState()){
      this.statelabel.setText(constants.formNormalState());   
    }
    else {
      this.statelabel.setText(constants.formAbnormalState());     
    }
    description.setText(value.getDescription());
    //Window.alert(title + "/" +value.getDescription() + "/" + String.valueOf(value.getDescription().length()));
    if (value.getDescription().length()==0){
      descPanel.setVisible(false);
    } else {
      descPanel.setVisible(false);
      statelabel.setVisible(false);
      if (titleText.equals(""))
        this.title.setText(description.getText());
      else
        this.title.setText(titleText + ": " +  description.getText());
    }
  }

  @Override
  public void setValue(DiagnosisDescription value, boolean fireEvents) {
    // TODO Auto-generated method stub
    // TODO Auto-generated method stub
    state = value.getState();
    if (value.getState()){
      this.statelabel.setText(constants.formNormalState());   
    }
    else {
      this.statelabel.setText(constants.formAbnormalState());     
    }
    description.setText(value.getDescription());
  }

  @Override
  public HandlerRegistration addValueChangeHandler(
      ValueChangeHandler<DiagnosisDescription> handler) {
    // TODO Auto-generated method stub
    return null;
  }
  public void setDescheight(String height) {
    description.setHeight(height);   
  }
}
TOP

Related Classes of org.mbhcare.client.ui.DiagnosisLabel$uiBinder

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.