Package com.cburch.logisim.data

Examples of com.cburch.logisim.data.AttributeSet


    }
  }

  private void removeAttributeListeners(Tool tool) {
    for (AttributeListener l : toolListeners) {
      AttributeSet attrs = tool.getAttributeSet();
      if (attrs != null) attrs.removeAttributeListener(l);
    }
  }
View Full Code Here


      KeyEvent e = event.getKeyEvent();
      int digit = Character.digit(e.getKeyChar(), radix);
      if (digit >= 0 && e.getModifiersEx() == modsEx) {
        long now = System.currentTimeMillis();
        long sinceLast = now - whenTyped;
        AttributeSet attrs = event.getAttributeSet();
        int min = getMinimumValue(attrs);
        int max = getMaximumValue(attrs);
        int val = 0;
        if (sinceLast < MAX_TIME_KEY_LASTS) {
          val = radix * curValue;
 
View Full Code Here

    proj.addCircuitListener(myProjectListener);
    proj.getSimulator().addSimulatorListener(tickCounter);
    selection.addListener(myProjectListener);
    LocaleManager.addLocaleListener(this);

    AttributeSet options = proj.getOptions().getAttributeSet();
    options.addAttributeListener(myProjectListener);
    AppPreferences.COMPONENT_TIPS.addPropertyChangeListener(myListener);
    AppPreferences.GATE_SHAPE.addPropertyChangeListener(myListener);
    AppPreferences.SHOW_TICK_RATE.addPropertyChangeListener(myListener);
    loadOptions(options);
    paintThread.start();
View Full Code Here

    return c == null ? attrs : c.getAttributeSet();
  }
 
  public <E> E getAttributeValue(Attribute<E> attr) {
    InstanceComponent c = comp;
    AttributeSet as = c == null ? attrs : c.getAttributeSet();
    return as.getValue(attr);
  }
View Full Code Here

    if (ret != null || sourceLoadAttempted) {
      return ret;
    } else {
      ret = description.getFactory(descriptionBase);
      if (ret != null) {
        AttributeSet base = getBaseAttributes();
        Boolean value = (Boolean) ret.getFeature(ComponentFactory.SHOULD_SNAP, base);
        shouldSnap = value == null ? true : value.booleanValue();
      }
      factory = ret;
      sourceLoadAttempted = true;
View Full Code Here

      source.drawGhost(context, Color.BLACK, x, y, getBaseAttributes());
    }
  }
 
  private AttributeSet getBaseAttributes() {
    AttributeSet ret = attrs;
    if (ret instanceof FactoryAttributes) {
      ret = ((FactoryAttributes) ret).getBase();
    }
    return ret;
  }
View Full Code Here

      if (!canvas.getProject().getLogisimFile().contains(circ)) return;
      if (shouldSnap) Canvas.snapToGrid(e);
      moveTo(canvas, g, e.getX(), e.getY());

      Location loc = Location.create(e.getX(), e.getY());
      AttributeSet attrsCopy = (AttributeSet) attrs.clone();
      ComponentFactory source = getFactory();
      if (source == null) return;
      Component c = source.createComponent(loc, attrsCopy);
     
      if (circ.hasConflict(c)) {
View Full Code Here

      newOpts.copyFrom(src.getOptions(), dst);
    }
   
    private void copyToolAttributes(Library srcLib, Library dstLib) {
      for (Tool srcTool : srcLib.getTools()) {
        AttributeSet srcAttrs = srcTool.getAttributeSet();
        Tool dstTool = dstLib.getTool(srcTool.getName());
        if (srcAttrs != null && dstTool != null) {
          AttributeSet dstAttrs = dstTool.getAttributeSet();
          for (Attribute<?> attrBase : srcAttrs.getAttributes()) {
            @SuppressWarnings("unchecked")
            Attribute<Object> attr = (Attribute<Object>) attrBase;
            Object srcValue = srcAttrs.getValue(attr);
            Object dstValue = dstAttrs.getValue(attr);
            if (!dstValue.equals(srcValue)) {
              dstAttrs.setValue(attr, srcValue);
              attrValues.add(new RevertAttributeValue(dstAttrs, attr, dstValue));
            }
          }
        }
      }
View Full Code Here

 
  private void processKeyEvent(Canvas canvas, KeyEvent event, int type) {
    KeyConfigurator handler = keyHandler;
    if (!keyHandlerTried) {
      ComponentFactory source = getFactory();
      AttributeSet baseAttrs = getBaseAttributes();
      handler = (KeyConfigurator) source.getFeature(KeyConfigurator.class, baseAttrs);
      keyHandler = handler;
      keyHandlerTried = true;
    }

    if (handler != null) {
      AttributeSet baseAttrs = getBaseAttributes();
      KeyConfigurationEvent e = new KeyConfigurationEvent(type, baseAttrs, event, this);
      KeyConfigurationResult r = handler.keyEventReceived(e);
      if (r != null) {
        Action act = ToolAttributeAction.create(r);
        canvas.getProject().doAction(act);
View Full Code Here

  }
 
  private void setFacing(Canvas canvas, Direction facing) {
    ComponentFactory source = getFactory();
    if (source == null) return;
    AttributeSet base = getBaseAttributes();
    Object feature = source.getFeature(ComponentFactory.FACING_ATTRIBUTE_KEY, base);
    @SuppressWarnings("unchecked")
    Attribute<Direction> attr = (Attribute<Direction>) feature;
    if (attr != null) {
      Action act = ToolAttributeAction.create(this, attr, facing);
View Full Code Here

TOP

Related Classes of com.cburch.logisim.data.AttributeSet

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.