Package com.cburch.logisim.data

Examples of com.cburch.logisim.data.AttributeSet


    public void actionPerformed(ActionEvent event) {
      Object source = event.getSource();
      if (source == simLimit) {
        Integer opt = (Integer) simLimit.getSelectedItem();
        if (opt != null) {
          AttributeSet attrs = getOptions().getAttributeSet();
          getProject().doAction(OptionsActions.setAttribute(attrs,
              Options.sim_limit_attr, opt));
        }
      } else if (source == simRandomness) {
        AttributeSet attrs = getOptions().getAttributeSet();
        Object val = simRandomness.isSelected() ? Options.sim_rand_dflt
            : Integer.valueOf(0);
        getProject().doAction(OptionsActions.setAttribute(attrs,
            Options.sim_rand_attr, val));
      } else if (source == gateUndefined) {
        ComboOption opt = (ComboOption) gateUndefined.getSelectedItem();
        if (opt != null) {
          AttributeSet attrs = getOptions().getAttributeSet();
          getProject().doAction(OptionsActions.setAttribute(attrs,
              Options.ATTR_GATE_UNDEFINED, opt.getValue()));
        }
      }
    }
View Full Code Here


      }
    }
  }
 
  private Attribute<Direction> getFacingAttribute(Component comp) {
    AttributeSet attrs = comp.getAttributeSet();
    Object key = ComponentFactory.FACING_ATTRIBUTE_KEY;
    Attribute<?> a = (Attribute<?>) comp.getFactory().getFeature(key, attrs);
    @SuppressWarnings("unchecked")
    Attribute<Direction> ret = (Attribute<Direction>) a;
    return ret;
View Full Code Here

      dx = Canvas.snapXToGrid(dx);
      dy = Canvas.snapYToGrid(dy);
    }
    Graphics g = context.getGraphics();
    for (Component comp : unionSet) {
      AttributeSet attrs = comp.getAttributeSet();
      Location loc = comp.getLocation();
      int x = loc.getX() + dx;
      int y = loc.getY() + dy;
      context.setGraphics(g.create());
      comp.getFactory().drawGhost(context, Color.gray, x, y, attrs);
View Full Code Here

  public boolean isAllDefaultValues(AttributeSet attrs, LogisimVersion ver) {
    return false;
  }

  public Object getDefaultAttributeValue(Attribute<?> attr, LogisimVersion ver) {
    AttributeSet dfltSet = defaultSet;
    if (dfltSet == null) {
      dfltSet = (AttributeSet) createAttributeSet().clone();
      defaultSet = dfltSet;
    }
    return dfltSet.getValue(attr);
  }
View Full Code Here

        if (event.getSource() == curFile) {
          removeLibrary((Library) event.getData());
        }
      } else if (action == LibraryEvent.ADD_TOOL) {
        Tool tool = (Tool) event.getData();
        AttributeSet attrs = tool.getAttributeSet();
        if (attrs != null) attrs.addAttributeListener(this);
      } else if (action == LibraryEvent.REMOVE_TOOL) {
        Tool tool = (Tool) event.getData();
        AttributeSet attrs = tool.getAttributeSet();
        if (attrs != null) attrs.removeAttributeListener(this);
      }
      explorer.repaint();
    }
View Full Code Here

    private void addLibrary(Library lib) {
      if (lib instanceof LibraryEventSource) {
        ((LibraryEventSource) lib).addLibraryListener(this);
      }
      for (Tool tool : lib.getTools()) {
        AttributeSet attrs = tool.getAttributeSet();
        if (attrs != null) attrs.addAttributeListener(this);
      }
    }
View Full Code Here

    private void removeLibrary(Library lib) {
      if (lib instanceof LibraryEventSource) {
        ((LibraryEventSource) lib).removeLibraryListener(this);
      }
      for (Tool tool : lib.getTools()) {
        AttributeSet attrs = tool.getAttributeSet();
        if (attrs != null) attrs.removeAttributeListener(this);
      }
    }
View Full Code Here

        } else {
          Pokable p = (Pokable) c.getFeature(Pokable.class);
          if (p != null) {
            Caret caret = p.getPokeCaret(event);
            setPokedComponent(circ, c, caret);
            AttributeSet attrs = c.getAttributeSet();
            if (attrs != null && attrs.getAttributes().size() > 0) {
              Project proj = canvas.getProject();
              proj.getFrame().viewComponentAttributes(circ, c);
            }
          }
        }
View Full Code Here

     
      if (copyFactory == null) {
        replMap.put(comp, null);
      } else if (copyFactory != compFactory) {
        Location copyLoc = comp.getLocation();
        AttributeSet copyAttrs = (AttributeSet) comp.getAttributeSet().clone();
        Component copy = copyFactory.createComponent(copyLoc, copyAttrs);
        replMap.put(comp, copy);
      }
    }
   
View Full Code Here

   
    private void computeAttributeList(Set<AttributeSet> attrsSet) {
      Set<Attribute<?>> attrSet = new LinkedHashSet<Attribute<?>>();
      Iterator<AttributeSet> sit = attrsSet.iterator();
      if (sit.hasNext()) {
        AttributeSet first = sit.next();
        attrSet.addAll(first.getAttributes());
        while (sit.hasNext()) {
          AttributeSet next = sit.next();
          for (Iterator<Attribute<?>> ait = attrSet.iterator(); ait.hasNext(); ) {
            Attribute<?> attr = ait.next();
            if (!next.containsAttribute(attr)) {
              ait.remove();
            }
          }
        }
      }
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.