Package com.dmissoh.biologic.gef

Source Code of com.dmissoh.biologic.gef.EventPart

package com.dmissoh.biologic.gef;

import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;

import com.dmissoh.biologic.models.Event;

public class EventPart extends AbstractGraphicalEditPart {

  @Override
  protected IFigure createFigure() {
    Event model = (Event) getModel();
    IFigure figure = null;
    if (model.isPunctual()) {
      figure = new PunctualEventFigure(model.getFamily(), model.getBegin());
    } else {
      figure = new EventFigure(model.getFamily(), model.getBegin(), model.getEnd());
    }
    return figure;
  }

  @Override
  protected void createEditPolicies() {
    // TODO Auto-generated method stub

  }

  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.gef.editparts.AbstractGraphicalEditPart#registerVisuals()
   */
  @Override
  protected void registerVisuals() {
    Event model = (Event) getModel();
    if (model.isPunctual()) {
      PunctualEventFigure figure = (PunctualEventFigure) getFigure();
      figure.setLayout(model.getLayout());
      figure.setBackgroundColor(model.getColor());
    } else {
      EventFigure figure = (EventFigure) getFigure();
      figure.setLayout(model.getLayout());
      figure.setBackgroundColor(model.getColor());
    }

  }

}
TOP

Related Classes of com.dmissoh.biologic.gef.EventPart

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.