コード例 #1
0
    boolean moveInConstructionList(int fromIndex, int toIndex) {
      // kernel.detach(this);
      boolean changed = kernel.moveInConstructionList(fromIndex, toIndex);
      // kernel.attach(this);

      // reorder rows in this view
      ConstructionElement ce = kernel.getConstructionElement(toIndex);
      GeoElement[] geos = ce.getGeoElements();
      for (int i = 0; i < geos.length; ++i) {
        remove(geos[i]);
        add(geos[i]);
      }
      return changed;
    }
コード例 #2
0
    @Override
    public void keyPressed(KeyEvent event) {
      // SPECIAL KEYS
      int keyCode = event.getKeyCode();
      switch (keyCode) {
        case KeyEvent.VK_DELETE:
          ConstructionElement ce = kernel.getConstructionElement(kernel.getConstructionStep());
          if (ce != null) {
            ce.remove();
            app.storeUndoInfo();
          }
          break;

        case KeyEvent.VK_UP:
        case KeyEvent.VK_RIGHT:
          previousStep();
          scrollToConstructionStep();
          break;

        case KeyEvent.VK_DOWN:
        case KeyEvent.VK_LEFT:
          nextStep();
          scrollToConstructionStep();
          break;

        case KeyEvent.VK_HOME:
        case KeyEvent.VK_PAGE_UP:
          setConstructionStep(-1);
          scrollToConstructionStep();
          break;

        case KeyEvent.VK_END:
        case KeyEvent.VK_PAGE_DOWN:
          setConstructionStep(kernel.getLastConstructionStep());
          scrollToConstructionStep();
          break;
      }
    }