Package org.objectstyle.wolips.eomodeler.core.model

Examples of org.objectstyle.wolips.eomodeler.core.model.EOAttribute


  public void setBlankText(String blankText) {
    _blankText = blankText;
  }

  public Image getColumnImage(Object _element, String _property) {
    EOAttribute attribute = (EOAttribute) _element;
    Image image = null;
    if (EOAttribute.PRIMARY_KEY.equals(_property)) {
      image = yesNoImage(attribute.isPrimaryKey(), Activator.getDefault().getImageRegistry().get(Activator.PRIMARY_KEY_ICON), null, null);
    } else if (EOAttribute.USED_FOR_LOCKING.equals(_property)) {
      image = yesNoImage(attribute.isUsedForLocking(), Activator.getDefault().getImageRegistry().get(Activator.LOCKING_ICON), null, null);
    } else if (EOAttribute.CLASS_PROPERTY.equals(_property)) {
      image = yesNoImage(attribute.isClassProperty(), Activator.getDefault().getImageRegistry().get(Activator.CLASS_PROPERTY_ICON), null, null);
    } else if (AbstractEOArgument.ALLOWS_NULL.equals(_property)) {
      image = yesNoImage(attribute.isAllowsNull(), Activator.getDefault().getImageRegistry().get(Activator.ALLOW_NULL_ICON), null, null);
    }
    return image;
  }
View Full Code Here


  protected String yesNoText(EOAttribute _attribute, Boolean _bool) {
    return yesNoText(_bool, !_attribute.getEntity().isPrototype());
  }

  public String getColumnText(Object _element, String _property) {
    EOAttribute attribute = (EOAttribute) _element;
    String text = null;
    if (EOAttribute.PRIMARY_KEY.equals(_property)) {
      // DO NOTHING
    } else if (EOAttribute.USED_FOR_LOCKING.equals(_property)) {
      // DO NOTHING
    } else if (EOAttribute.CLASS_PROPERTY.equals(_property)) {
      // DO NOTHING
    } else if (AbstractEOArgument.ALLOWS_NULL.equals(_property)) {
      // DO NOTHING
    } else if (EOAttribute.PROTOTYPE.equals(_property)) {
      EOAttribute prototype = attribute.getPrototype();
      if (prototype != null) {
        text = prototype.getName();
      }
    } else {
      text = super.getColumnText(_element, _property);
      if (text == null) {
        text = _blankText;
View Full Code Here

  }

  public Font getFont(Object _element, int _columnIndex) {
    Font font = null;
    if (_tableViewer != null) {
      EOAttribute attribute = (EOAttribute) _element;
      boolean inherited = attribute.isInherited();
      boolean flattened = attribute.isFlattened();
      if (flattened && inherited) {
        if (_flattenedInheritedFont == null) {
          Font originalFont = _tableViewer.getTable().getFont();
          FontData[] fontData = _tableViewer.getTable().getFont().getFontData();
          _flattenedInheritedFont = new Font(originalFont.getDevice(), fontData[0].getName(), fontData[0].getHeight(), SWT.BOLD | SWT.ITALIC);
View Full Code Here

    return null;
  }

  public Color getForeground(Object _element, int _columnIndex) {
    Color color = null;
    EOAttribute attribute = (EOAttribute) _element;
    if (attribute != null) {
      String property = getColumnProperty(_columnIndex);
      boolean isAttributePrototyped = attribute.isPrototyped(property);
      boolean isClassProperty = attribute.isClassProperty() != null && attribute.isClassProperty().booleanValue();
      if (isAttributePrototyped) {
        color = Display.getCurrent().getSystemColor(SWT.COLOR_DARK_RED);
      }
      else if (!isClassProperty) {
        color = Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY);
View Full Code Here

    GridData prototypeComboLayoutData = new GridData(GridData.FILL_HORIZONTAL);
    prototypeCombo.setLayoutData(prototypeComboLayoutData);
  }

  protected void _argumentChanged(AbstractEOArgument argument) {
    EOAttribute attribute = (EOAttribute) argument;
    if (attribute != null) {
      _prototypeComboViewer.setInput(attribute);
      _prototypeBinding = new ComboViewerBinding(_prototypeComboViewer, attribute, EOAttribute.PROTOTYPE, attribute.getEntity().getModel(), EOModel.ENTITIES, EOEntityListContentProvider.BLANK_ENTITY);

      getBindingContext().bindValue(SWTObservables.observeSelection(_primaryKeyButton), BeansObservables.observeValue(attribute, EOAttribute.PRIMARY_KEY), null, new BooleanUpdateValueStrategy());
      getBindingContext().bindValue(SWTObservables.observeSelection(_classPropertyButton), BeansObservables.observeValue(attribute, EOAttribute.CLASS_PROPERTY), null, new BooleanUpdateValueStrategy());
      getBindingContext().bindValue(SWTObservables.observeSelection(_lockingButton), BeansObservables.observeValue(attribute, EOAttribute.USED_FOR_LOCKING), null, new BooleanUpdateValueStrategy());
    }
View Full Code Here

    }
    return canModify;
  }

  public Object getValue(Object _element, String _property) {
    EOAttribute attribute = (EOAttribute) _element;
    Object value = null;
    if (EOAttribute.PROTOTYPE.equals(_property)) {
      EOAttribute prototype = attribute.getPrototype();
      String prototypeName;
      if (prototype == null) {
        prototypeName = EOAttributesCellModifier.NO_PROTOYPE_VALUE;
      } else {
        prototypeName = prototype.getName();
      }
      value = new Integer(myPrototypeNames.indexOf(prototypeName));
    } else if (AbstractEOArgument.ALLOWS_NULL.equals(_property) || EOAttribute.CLASS_PROPERTY.equals(_property) || EOAttribute.CLIENT_CLASS_PROPERTY.equals(_property) || EOAttribute.INDEXED.equals(_property) || EOAttribute.PRIMARY_KEY.equals(_property) || EOAttribute.READ_ONLY.equals(_property) || EOAttribute.USED_FOR_LOCKING.equals(_property)) {
      value = super.getValue(_element, _property);
      if (value == null && !attribute.getEntity().isPrototype()) {
View Full Code Here

    return value;
  }

  protected boolean _modify(Object _element, String _property, Object _value) throws Throwable {
    boolean modified = false;
    EOAttribute attribute = (EOAttribute) _element;
    if (EOAttribute.PROTOTYPE.equals(_property)) {
      Integer prototypeIndex = (Integer) _value;
      int prototypeIndexInt = prototypeIndex.intValue();
      String prototypeName = (prototypeIndexInt == -1) ? null : (String) myPrototypeNames.get(prototypeIndexInt);
      if (EOAttributesCellModifier.NO_PROTOYPE_VALUE.equals(prototypeName)) {
        attribute.setPrototype(null, true);
      } else {
        EOAttribute prototype = attribute.getEntity().getModel().getPrototypeAttributeNamed(prototypeName);
        attribute.setPrototype(prototype, true);
      }
      modified = true;
    }
    return modified;
View Full Code Here

    super.disposeBindings();
  }

  public void setInput(IWorkbenchPart part, ISelection selection) {
    if (!ComparisonUtils.equals(selection, getSelection())) {
      EOAttribute attribute = null;
      Object selectedObject = ((IStructuredSelection) selection).getFirstElement();
      super.setInput(part, selection);
      if (selectedObject instanceof EOAttribute) {
        attribute = (EOAttribute) selectedObject;
      } else if (selectedObject instanceof EOAttributePath) {
View Full Code Here

    Object[] selectedAttributes = ((IStructuredSelection) _entityIndexListViewer.getSelection()).toArray();
    if (selectedAttributes.length > 0) {
      boolean confirmed = MessageDialog.openConfirm(getShell(), Messages.getString("EOEntityIndexBasicEditorSection.removeAttributesTitle"), Messages.getString("EOEntityIndexBasicEditorSection.removeAttributesMessage"));
      if (confirmed) {
        for (int attributeNum = 0; attributeNum < selectedAttributes.length; attributeNum++) {
          EOAttribute attribute = (EOAttribute) selectedAttributes[attributeNum];
          _entityIndex.removeAttribute(attribute, true);
        }
        updateAttributes();
      }
    }
View Full Code Here

  public EOAttributesViewerSorter(String tableName) {
    super(tableName);
  }

  public Object getComparisonValue(Object obj, String property) {
    EOAttribute attribute = (EOAttribute) obj;
    Object value = null;
    if (EOAttribute.PROTOTYPE.equals(property)) {
      EOAttribute prototype = attribute.getPrototype();
      if (prototype != null) {
        value = prototype.getName();
      }
    /*
    } else if (AbstractEOArgument.NAME.equals(property)) {
      String sortPrefix;
      Boolean primaryKey = attribute.isPrimaryKey();
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.eomodeler.core.model.EOAttribute

Copyright © 2018 www.massapicom. 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.