Example #1
0
  void initializeInherit() {
    try {
      if (mIniParser.hasKey("Type", "Inherit")) {
        String inheritName = mIniParser.getData("Type", "Inherit");
        if (inheritName != null && !inheritName.equals("")) {
          String[] inheritNames = inheritName.split(",");
          for (String name : inheritNames) {
            Element inheritParentComponent = new Element(sdk, name);

            for (Property property : inheritParentComponent.properties.getValues()) {
              property.parent = this;
              properties.put(property.name, property);
            }

            for (Point point : inheritParentComponent.points.getValues()) {
              point.parent = this;
              points.put(point.name, point);
            }
          }
        }
        ;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Example #2
0
 void initializePoints() {
   String[] iniMethods = mIniParser.getKeys("Methods");
   if (iniMethods != null)
     for (String method : iniMethods) {
       Point point = new Point(method, mIniParser.getData("Methods", method), this);
       points.put(point.name, point);
     }
 }
Example #3
0
 void initializeProperties() {
   description = mIniParser.getData("Type", "Info");
   String[] iniProperties = mIniParser.getKeys("Property");
   if (iniProperties != null)
     for (String propertyName : iniProperties) {
       Property property =
           new Property(propertyName, mIniParser.getData("Property", propertyName), this);
       properties.put(property.name, property);
     }
 }
Example #4
0
  void elementHandler(int x, int y, int action) {
    for (Point point : points.getValues()) if (point.getRegion().contains(x, y)) return;

    switch (action) {
      case MotionEvent.ACTION_DOWN:
        mHandler.sendMessageDelayed(
            Message.obtain(mHandler, CODE_ELEMENT_LONGCLICK),
            ViewConfiguration.getLongPressTimeout());

        fX = x - getScVal(this.x);
        fY = y - getScVal(this.y);
        break;
      case MotionEvent.ACTION_MOVE:
        if (mMoovingPermitted) {
          dX = getGridCoord((x - fX) / getScaleFactor());
          dY = getGridCoord((y - fY) / getScaleFactor());

          if (this.x != dX | this.y != dY) {
            this.x = dX;
            this.y = dY;

            for (Link link : links) link.measure();

            onUpdate();
            getSdk().getSdkFragment().update();
            isPossibleToRemoving =
                getSdk().getSdkFragment().getRemovingElementView().checkRemoving(this);
          }
        }
        break;
      case MotionEvent.ACTION_UP:
        if (mMoovingPermitted) {
          mMoovingPermitted = false;
          getSdk().getSdkFragment().lockScroll(false);
          getSdk().getSdkFragment().setRemovingViewState(false);
          MainActivity.mainFragment.showTabs();
        } else if (mLinkCreationToggle) {
          mLinkCreationToggle = false;
        } else {
          if (!isSelected()) sdk.setSelectedElement(this);
        }

        if (mHandler.hasMessages(CODE_ELEMENT_LONGCLICK))
          mHandler.removeMessages(CODE_ELEMENT_LONGCLICK);

        if (isPossibleToRemoving) getSdk().getSdkFragment().getRemovingElementView().remove(this);
        break;
      case MotionEvent.ACTION_CANCEL:
        if (mHandler.hasMessages(CODE_ELEMENT_LONGCLICK))
          mHandler.removeMessages(CODE_ELEMENT_LONGCLICK);
        break;
    }
  }
Example #5
0
 public void measurePoints() {
   for (Point point : points.getValues()) point.measure();
 }