Esempio n. 1
0
 // labels
 public void initLabels() {
   int w = 90;
   int h = 20;
   for (int i = 0; i < labels.length; i++) {
     if (i == 0) {
       labels[i] = new JLabel(labels_text[i]);
       labels[i].setBounds(0, 20, w, h);
       haut.add(labels[i]);
     } else if (i < 2) {
       labels[i] = new JLabel(labels_text[i]);
       labels[i].setBounds(0, labels[i - 1].getY() + 30, w, h);
       haut.add(labels[i]);
     } else {
       if (i == 2) {
         labels[i] = new JLabel(labels_text[i]);
         labels[i].setBounds(milieu.getX() - 10, milieu.getY() - 70, w, h);
       } else if (i == 7) {
         labels[i] = new JLabel(labels_text[i]);
         labels[i].setBounds(labels[i - 1].getX(), labels[i - 1].getY() + 75, w, h);
       } else {
         labels[i] = new JLabel(labels_text[i]);
         labels[i].setBounds(labels[i - 1].getX(), labels[i - 1].getY() + 30, w, h);
       }
       milieu.add(labels[i]);
     }
   }
 }
Esempio n. 2
0
 /**
  * A paraméterül adott koordinátákat korlátozhatjuk a játéktéren belülre.
  *
  * <p><strong>Note:</strong><br>
  * Ez a metódus az objektumot {@link Settings#GO_SELECTION_RADIUS}-nyi szélességűnek és
  * magasságúnak tekinti.
  *
  * @param x Az objektum x pozíciója.
  * @param y Az objektum y pozíciója.
  * @return A limitált pozíció.
  */
 public static Point2D limitGOPositionToCurrentGameArea(double x, double y) {
   double r = Settings.GO_SELECTION_RADIUS;
   x = Math.max(x, gameArea.getX() + r);
   x = Math.min(x, gameArea.getWidth() - r);
   y = Math.max(y, gameArea.getY() + r);
   y = Math.min(y, gameArea.getHeight() - r);
   return new Point2D(x, y);
 }
Esempio n. 3
0
 // initialize panneau du millieu
 public void initPanneauMillieu() {
   final int X = PADDING_X + 10;
   final int LARG_PANNEAU_MILLEU = LARG_FENETRE - (2 * X);
   final int HAUT_PANNEAU_MILLEU = 300;
   milieu.setLayout(null);
   milieu.setBounds(X, haut.getY() + haut.getHeight(), LARG_PANNEAU_MILLEU, HAUT_PANNEAU_MILLEU);
   milieu.setBorder(new LineBorder(GRIS_FONCE, 2));
 }
Esempio n. 4
0
  // initialize panneau du bas
  public void initPanneauBas() {
    final int X = PADDING_X + 10;
    final int LARG_PANNEAU_BAS = LARG_FENETRE - (2 * X);
    final int HAUT_PANNEAU_BAS =
        HAUT_FENETRE - haut.getHeight() - milieu.getHeight() - PADDING_Y - 50;
    final int VGAP = HAUT_PANNEAU_BAS / 2;

    FlowLayout flowlayout = new FlowLayout();
    flowlayout.setVgap(VGAP);

    bas.setLayout(flowlayout);
    bas.setBounds(X, milieu.getY() + milieu.getHeight(), LARG_PANNEAU_BAS, HAUT_PANNEAU_BAS);
  }
        /** Draws the selected annotation. */
        private void draw(
            final ExecutionUnit process,
            final Graphics2D g2,
            final ProcessRendererModel rendererModel,
            final boolean printing) {
          if (!visualizer.isActive()) {
            return;
          }

          // paint the selected annotation
          WorkflowAnnotation selected = model.getSelected();
          if (selected != null) {
            // only draw in correct execution unit
            if (selected.getProcess().equals(process)) {
              // only paint annotation if not editing
              if (editPane == null) {
                // paint the annotation itself
                Graphics2D g2P = (Graphics2D) g2.create();
                drawer.drawAnnotation(selected, g2P, printing);
                g2P.dispose();
              } else {
                // only paint shadow
                Rectangle2D loc = selected.getLocation();
                g2.draw(
                    new Rectangle2D.Double(
                        loc.getX() - 1,
                        loc.getY() - 1,
                        editPane.getBounds().getWidth() + 1,
                        editPane.getBounds().getHeight() + 1));
                Rectangle2D shadowFrameEditor =
                    new Rectangle2D.Double(
                        loc.getX(),
                        loc.getY(),
                        editPane.getBounds().getWidth() + 1,
                        editPane.getBounds().getHeight() + 1);
                ProcessDrawUtils.drawShadow(shadowFrameEditor, g2);
                if (editPanel != null) {
                  Point absolute = new Point(editPanel.getX(), editPanel.getY());
                  Point relative =
                      ProcessDrawUtils.convertToRelativePoint(
                          absolute, rendererModel.getProcessIndex(process), rendererModel);
                  Rectangle2D shadowFramePanel =
                      new Rectangle2D.Double(
                          relative.getX(), relative.getY(), EDIT_PANEL_WIDTH, EDIT_PANEL_HEIGHT);
                  ProcessDrawUtils.drawShadow(shadowFramePanel, g2);
                }
              }
            }
          }
        }
Esempio n. 6
0
File: Z.java Progetto: adamldavis/z
  @Override
  public void run() {
    if ((state == State.ANIMATING && aniCount.incrementAndGet() >= 100)
        || (state == State.TIME_TRAVEL && aniCount.addAndGet(1) >= 999)
        || (state == State.SELECTING && aniCount.addAndGet(2) >= 100)) {
      if (state == State.ANIMATING || state == State.TIME_TRAVEL) {
        state = State.NORMAL;
        links.clear();
      } else if (state == State.SELECTING) {
        if (edit.getEditors().isEmpty()) {
          state = State.NORMAL;
        } else {
          state = State.EDITING;
          updateEditorSize(edit.getEditors().get(0));
          edit.updatePaneSize();
        }
      }
    }
    count.incrementAndGet();
    if (count.get() >= 20) {
      count.set(0);
    }
    final float time = aniCount.get() / 100f;

    if (getState() == State.SELECTING) {
      Editor ed = edit.getEditors().get(0);
      ZNode editorNode = edit.getNode(ed);
      Editor previousEd = edit.getEditors().size() == 1 ? null : edit.getEditors().get(1);
      int y = 8;
      if (previousEd != null) {
        JPanel previousPanel = previousEd.getEditorPanel();
        y += previousPanel.getY() + previousPanel.getHeight();
      }
      ed.setScale(0.25f + 0.75f * time);
      final Point2D point =
          animator.animate(
              editorNode.getLocation(), new Point2D.Float(8, y), time, AnimationType.COSINE);
      ed.getEditorPanel().setLocation((int) point.getX(), (int) point.getY());
    } else if (getState() == State.ANIMATING)
      synchronized (zNodes) {
        for (ZNode node : zNodes) {
          if (pointMap.containsKey(node)) {
            node.getLocation()
                .setLocation(
                    animator.animate(
                        node.getLocation(), pointMap.get(node), time, AnimationType.COSINE));
          }
          if (sizeMap.containsKey(node)) {
            final Float size = sizeMap.get(node);
            final Float currentSize = node.getSize();
            node.setSize(
                (float)
                    animator
                        .animate(
                            new Point2D.Float(currentSize, 0),
                            new Point2D.Float(size, 0),
                            time,
                            AnimationType.COSINE)
                        .getX());
          }
        }
      }
    else if (getState() == State.TIME_TRAVEL
        && aniCount.get() * diffsMap.getLogSize() / 1000
            > (aniCount.get() - 1) * diffsMap.getLogSize() / 1000)
      synchronized (zNodes) {
        final Collection<ZNodeLink> nodeLinks =
            diffsMap.getNodeLinks(aniCount.get() * diffsMap.getLogSize() / 1000, zNodes);
        if (!nodeLinks.isEmpty()) {
          links.clear();
          links.addAll(nodeLinks);
        }
      }
    else if (getState() == State.TIME_TRAVEL) {
      if (diffsMap.author != null) {
        ZNode node = diffsMap.author;
        float t = aniCount.get() % 100 / 100f;

        node.getLocation()
            .setLocation(
                animator.animate(
                    node.getLocation(), diffsMap.authorLocation, t, AnimationType.COSINE));
      }
    }
  }
  public void content() {
    Font font00 = new Font("宋体", Font.BOLD, 20);
    Font font0 = new Font("宋体", Font.BOLD, 16);
    Font font = new Font("宋体", Font.BOLD, 15);
    line1 = new JLabel("————————————————————————");
    line1.setFont(font0);
    line1.setBounds(
        listpanel.getX() - panel.getWidth() / 15,
        listpanel.getY() - panel.getHeight() / 20,
        panel.getWidth() * 3 / 5,
        panel.getHeight() / 10);

    line2 = new JLabel("——————————————————————");
    line2.setFont(font0);
    line2.setForeground(Color.GRAY);
    line2.setBounds(
        listpanel.getX() - panel.getWidth() / 30,
        listpanel.getY() + panel.getHeight() / 36,
        panel.getWidth() * 3 / 5,
        panel.getHeight() / 10);

    line3 = new JLabel("——————————————————————");
    line3.setFont(font0);
    line3.setForeground(Color.GRAY);
    line3.setBounds(
        listpanel.getX() - panel.getWidth() / 30,
        listpanel.getY() + panel.getHeight() / 100 * 75,
        panel.getWidth() * 3 / 5,
        panel.getHeight() / 10);

    ok = new JButton("提交");
    ok.setFont(font);
    ok.setBounds(
        listpanel.getX() + panel.getWidth() * 2 / 5,
        listpanel.getY() + panel.getHeight() * 30 / 40,
        panel.getWidth() / 10,
        panel.getHeight() / 20);

    cancel = new JButton("取消");
    cancel.setFont(font);
    cancel.setBounds(
        ok.getX() - panel.getWidth() / 7, ok.getY(), panel.getWidth() / 10, panel.getHeight() / 20);

    outList = new JLabel("出库单");
    outList.setFont(font00);
    outList.setBounds(
        listpanel.getX() - panel.getWidth() / 15,
        listpanel.getY() - panel.getHeight() / 13,
        panel.getWidth() / 10,
        panel.getHeight() / 10);

    cargoinfo = new JLabel("货物信息");
    cargoinfo.setFont(font0);
    cargoinfo.setBounds(
        listpanel.getX() - panel.getWidth() / 30,
        listpanel.getY(),
        panel.getWidth() / 10,
        panel.getHeight() / 10);

    bar = new JLabel("订单号");
    bar.setFont(font);
    bar.setBounds(
        cargoinfo.getX(),
        cargoinfo.getY() + panel.getHeight() / 13,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    /*		code=new JLabel("出库单号:");
    	code.setFont(font);
    	code.setBounds(cargoinfo.getX(),bar.getY()+panel.getHeight()/13,panel.getWidth()/5, panel.getHeight()/10);
    */
    outDate = new JLabel("出库日期:");
    outDate.setFont(font);
    outDate.setBounds(
        cargoinfo.getX(),
        bar.getY() + panel.getHeight() / 14,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    distination = new JLabel("目的地:");
    distination.setFont(font);
    distination.setBounds(
        cargoinfo.getX(),
        outDate.getY() + panel.getHeight() / 13,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    damageCondition = new JLabel("损坏情况");
    damageCondition.setFont(font);
    damageCondition.setBounds(
        cargoinfo.getX(),
        distination.getY() + panel.getHeight() / 13,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    good = new JCheckBox("完好");
    good.setFont(font);
    good.setBounds(
        damageCondition.getX() + panel.getWidth() / 8,
        damageCondition.getY() + panel.getHeight() / 45,
        panel.getWidth() / 12,
        panel.getHeight() / 20);

    damage = new JCheckBox("损坏");
    damage.setFont(font);
    damage.setBounds(
        good.getX() + panel.getWidth() / 8,
        damageCondition.getY() + panel.getHeight() / 45,
        panel.getWidth() / 12,
        panel.getHeight() / 20);

    loadingtype = new JLabel("装运形式:");
    loadingtype.setFont(font);
    loadingtype.setBounds(
        damageCondition.getX(),
        damageCondition.getY() + panel.getHeight() / 13,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    tB = new JCheckBox("火车");
    tB.setFont(font);
    tB.setBounds(
        loadingtype.getX() + panel.getWidth() / 8,
        loadingtype.getY() + panel.getHeight() / 45,
        panel.getWidth() / 12,
        panel.getHeight() / 20);
    pB = new JCheckBox("飞机");
    pB.setFont(font);
    pB.setBounds(
        tB.getX() + panel.getWidth() / 8,
        loadingtype.getY() + panel.getHeight() / 45,
        panel.getWidth() / 12,
        panel.getHeight() / 20);
    bB = new JCheckBox("汽车");
    bB.setFont(font);
    bB.setBounds(
        pB.getX() + panel.getWidth() / 8,
        loadingtype.getY() + panel.getHeight() / 45,
        panel.getWidth() / 12,
        panel.getHeight() / 20);

    //		transfercode=new JLabel("中转单编号:");
    //		transfercode.setFont(font);
    //		transfercode.setBounds(cargoinfo.getX(),bB.getY()+panel.getHeight()/14,panel.getWidth()/5,
    // panel.getHeight()/10);

    //	codetext = new JTextField();
    //	codetext.setBounds(code.getX()+panel.getWidth()/8,code.getY()+panel.getWidth()/50,panel.getWidth()/6, panel.getHeight()/20);

    /*	tip1 = new JLabel("*请输入10位有效出库单号");
    tip1.setFont(new Font("宋体", Font.BOLD, 12));
    tip1.setForeground(Color.GRAY);
    tip1.setBounds(codetext.getX()+codetext.getWidth()+panel.getWidth()/50,code.getY(),panel.getWidth()/3, panel.getHeight()/10);
    */
    vehicleCode = new JLabel("汽运编号:");
    vehicleCode.setFont(font);
    vehicleCode.setBounds(
        cargoinfo.getX(),
        bB.getY() + panel.getHeight() / 14,
        panel.getWidth() / 5,
        panel.getHeight() / 10);

    bartext = new JTextField();
    bartext.setBounds(
        bar.getX() + panel.getWidth() / 8,
        bar.getY() + panel.getWidth() / 50,
        panel.getWidth() / 6,
        panel.getHeight() / 20);

    distext = new JTextField();
    distext.setBounds(
        distination.getX() + panel.getWidth() / 8,
        distination.getY() + panel.getWidth() / 50,
        panel.getWidth() / 6,
        panel.getHeight() / 20);

    //	transtext = new JTextField();
    //	transtext.setBounds(transfercode.getX()+panel.getWidth()/7,transfercode.getY()+panel.getWidth()/50,panel.getWidth()/6, panel.getHeight()/20);

    vehtext = new JTextField();
    vehtext.setBounds(
        distination.getX() + panel.getWidth() / 7,
        vehicleCode.getY() + panel.getWidth() / 50,
        panel.getWidth() / 6,
        panel.getHeight() / 20);

    /*		tip2 = new JLabel("*请输入14位有效中转单编号");
    	tip2.setFont(new Font("宋体", Font.BOLD, 12));
    	tip2.setForeground(Color.GRAY);
    	tip2.setBounds(transtext.getX()+transtext.getWidth()+panel.getWidth()/50,transfercode.getY(),panel.getWidth()/3, panel.getHeight()/10);
    */

    year = new JComboBox();
    month = new JComboBox();
    day = new JComboBox();
    String[] arr1 = new String[1000]; // 数组时个对象,对象在使用前要初始化
    for (int i = 0; i < 1000; i++) {
      arr1[i] = i + 2000 + "年";
    }

    year = new JComboBox(arr1);
    Calendar calendar = Calendar.getInstance();

    String y = String.valueOf(calendar.get(Calendar.YEAR)) + "年";
    for (String y1 : arr1) {
      if (y1.equals(y)) {
        year.setSelectedItem(y);
      }
    }
    year.setBounds(
        outDate.getX() + panel.getWidth() / 8,
        outDate.getY() + panel.getWidth() / 50,
        panel.getWidth() / 11,
        panel.getHeight() / 20);

    String[] arr2 = new String[12];
    for (int i = 0; i < 12; i++) {
      arr2[i] = i + 1 + "月";
    }

    month = new JComboBox(arr2);
    String m = String.valueOf(calendar.get(Calendar.MONTH) + 1) + "月";
    for (String m1 : arr2) {
      if (m1.equals(m)) {
        month.setSelectedItem(m1);
      }
    }

    month.setBounds(
        year.getX() + year.getWidth() + panel.getWidth() / 100,
        outDate.getY() + panel.getWidth() / 50,
        panel.getWidth() / 12,
        panel.getHeight() / 20);
    String[] arr30 = new String[31];
    for (int i = 0; i < 31; i++) {
      arr30[i] = i + 1 + "日";
    }

    day = new JComboBox(arr30);

    String d = String.valueOf(calendar.get(Calendar.DATE)) + "日";
    for (String d1 : arr30) {
      if (d1.equals(d)) {
        day.setSelectedItem(d1);
      }
    }
    day.setBounds(
        month.getX() + month.getWidth() + panel.getWidth() / 100,
        outDate.getY() + panel.getWidth() / 50,
        panel.getWidth() / 12,
        panel.getHeight() / 20);
    listpanel.add(day);

    month.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent arg0) {
            // TODO Auto-generated method stub
            listpanel.remove(day);
            switch (month.getSelectedItem().toString()) {
              case "1月":
              case "3月":
              case "5月":
              case "7月":
              case "8月":
              case "10月":
              case "12月":
                String[] arr31 = new String[31];
                for (int i = 0; i < 31; i++) {
                  arr31[i] = i + 1 + "日";
                }

                day = new JComboBox(arr31);
                day.setBounds(
                    month.getX() + month.getWidth() + panel.getWidth() / 100,
                    outDate.getY() + panel.getWidth() / 50,
                    panel.getWidth() / 12,
                    panel.getHeight() / 20);
                listpanel.add(day);
                break;
              case "4月":
              case "6月":
              case "9月":
              case "11月":
                String[] arr3 = new String[30];
                for (int i = 0; i < 30; i++) {
                  arr3[i] = i + 1 + "日";
                }

                day = new JComboBox(arr3);
                day.setBounds(
                    month.getX() + month.getWidth() + panel.getWidth() / 100,
                    outDate.getY() + panel.getWidth() / 50,
                    panel.getWidth() / 12,
                    panel.getHeight() / 20);
                listpanel.add(day);
                break;
              case "2月":
                if (isLeap(year.getSelectedItem().toString())) {
                  String[] arr33 = new String[29];
                  for (int i = 0; i < 29; i++) {
                    arr33[i] = i + 1 + "日";
                  }

                  day = new JComboBox(arr33);
                  day.setBounds(
                      month.getX() + month.getWidth() + panel.getWidth() / 100,
                      outDate.getY() + panel.getWidth() / 50,
                      panel.getWidth() / 12,
                      panel.getHeight() / 20);
                  listpanel.add(day);
                } else {
                  String[] arr333 = new String[28];
                  for (int i = 0; i < 28; i++) {
                    arr333[i] = i + 1 + "日";
                  }

                  day = new JComboBox(arr333);
                  day.setBounds(
                      month.getX() + month.getWidth() + panel.getWidth() / 100,
                      outDate.getY() + panel.getWidth() / 50,
                      panel.getWidth() / 12,
                      panel.getHeight() / 20);
                  listpanel.add(day);
                }
                break;
              default:
                break;
            }
          }
        });

    listpanel.add(year);
    listpanel.add(month);
    listpanel.add(day);
    listpanel.add(line1);
    listpanel.add(line2);
    listpanel.add(line3);
    //	listpanel.add(tip1);
    //	listpanel.add(tip2);
    listpanel.add(outList);
    listpanel.add(ok);
    listpanel.add(cancel);
    listpanel.add(bar);
    //	listpanel.add(code);
    listpanel.add(cargoinfo);
    listpanel.add(outDate);
    listpanel.add(distination);
    listpanel.add(loadingtype);
    listpanel.add(damageCondition);
    listpanel.add(good);
    listpanel.add(damage);
    listpanel.add(pB);
    listpanel.add(bB);
    listpanel.add(tB);
    //	listpanel.add(transfercode);
    listpanel.add(vehicleCode);
    listpanel.add(vehtext);
    listpanel.add(bartext);
    //	listpanel.add(codetext);
    listpanel.add(distext);
    //	listpanel.add(transtext);

    ok.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {

            String date =
                ((year.getSelectedIndex() + 2000) + "/")
                    + ((month.getSelectedIndex() + 1) + "/")
                    + ((day.getSelectedIndex() + 1 + ""));

            String damageCondition = null;
            if (good.isSelected()) {
              damageCondition = "完好";
            }
            if (damage.isSelected()) {
              damageCondition = "损坏";
            }

            TransType transtype = TransType.BUS;
            if (tB.isSelected()) {
              transtype = TransType.TRAIN;
            }
            if (bB.isSelected()) {
              transtype = TransType.BUS;
            }
            if (pB.isSelected()) {
              transtype = TransType.PLANE;
            }

            WarehouseMemory memory = (WarehouseMemory) ((WritePanel) panel).getMemory();
            String code = memory.getWarehouseOutCode();
            ReceiptCode cal = ConstructFactory.calculateCode();
            code = cal.calculCode(code, memory.getUserName());
            System.out.println(code);

            // code出库单号、bar为订单号

            WarehouseOutVO warehouseOutVO =
                new WarehouseOutVO(
                    bartext.getText(),
                    code,
                    distext.getText(),
                    date,
                    transtype,
                    ((WritePanel) panel).getBelong(),
                    vehtext.getText(),
                    damageCondition);

            WarehouseBLService service = ConstructFactory.WarehouseFactory();
            boolean key = service.WarehouseOut(warehouseOutVO);
            if (key) {
              WarehouseReceipt wr = ConstructFactory.WarehouseReceiptFactory();
              wr.saveWarehouseOutCode(code, memory.getUserName());
              memory.setWarehouseOutCode(memory.getWarehouseOutCode() + " " + code);
              memory.setWarehouseOutDate(memory.getWarehouseOutDate() + " " + date);
            }
          }
        });

    cancel.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            remove();
            panel.repaint();
          }
        });
  }
  /**
   * Handling docking complete events
   *
   * @param e the event
   * @see
   *     org.flexdock.docking.event.DockingListener#dockingCanceled(org.flexdock.docking.event.DockingEvent)
   */
  public void dockingComplete(DockingEvent e) {
    debug("dockingComplete");
    String newId = null;

    DockingListener[] newListeners = e.getNewDockingPort().getDockingListeners();
    SwingScilabTab dockedTab = (SwingScilabTab) e.getDockable();
    if (newListeners.length == 2) {
      /* This docking port has been created when the parent window were created */
      /* So this docking port has a sciDockingListener */
      newId = ((SciDockingListener) newListeners[1]).getAssociatedWindowId();
    } else {
        /* Docking port created by Flexdock itself */
      /* Retrieve the ID of the parent window */
      Set<Dockable> allDockables = e.getNewDockingPort().getDockables();
      /* Have to find an other dockable than the one we just docked */
      Iterator<Dockable> it = allDockables.iterator();
      Dockable dock = it.next();

      if (it.hasNext()) {
          /** More than one dockable --> already existing docking port */
        while (e.getDockable() == dock) {
          dock = it.next();
        }
        newId = ((SwingScilabTab) dock).getParentWindowId();
      } else {
          /** Create a new Window to display the tab inside it */

        DefaultDockingPort dockingPort = ((DefaultDockingPort) e.getOldDockingPort());
        JPanel parentPanel = (JPanel) dockingPort.getParent();
        JLayeredPane parentLayeredPane = (JLayeredPane) parentPanel.getParent();
        JRootPane parentRootPane = (JRootPane) parentLayeredPane.getParent();

        /* Computes new position for the created Window */
        int offsetX =
            dockingPort.getX()
                + parentPanel.getX()
                + parentLayeredPane.getX()
                + parentRootPane.getX();
        int offsetY =
            dockingPort.getY()
                + parentPanel.getY()
                + parentLayeredPane.getY()
                + parentRootPane.getY();
        int newX = -offsetX;
        int newY = -offsetY;
        if (e.getNewDockingPort() instanceof FloatingDockingPort) {
          newX +=
              ((FloatingDockingPort) e.getNewDockingPort())
                  .getParent()
                  .getParent()
                  .getParent()
                  .getX();
          newY +=
              ((FloatingDockingPort) e.getNewDockingPort())
                  .getParent()
                  .getParent()
                  .getParent()
                  .getY();
        } else {
          newX +=
              ((DefaultDockingPort) e.getNewDockingPort())
                  .getParent()
                  .getParent()
                  .getParent()
                  .getX();
          newY +=
              ((DefaultDockingPort) e.getNewDockingPort())
                  .getParent()
                  .getParent()
                  .getParent()
                  .getY();
        }

        SwingScilabWindow newWindow = new SwingScilabWindow();
        newWindow.setPosition(new Position(newX, newY));
        newWindow.setDims(
            SwingScilabWindow.allScilabWindows.get(associatedScilabWindowId).getDims());
        DockingManager.dock(dockedTab, newWindow.getDockingPort());
        newWindow.setVisible(true);
        newId = newWindow.getId();
      }
    }
    dockedTab.setParentWindowId(newId);
    dockedTab.requestFocus();
  }
Esempio n. 9
0
  private void initializeComponents() {
    this.setTitle("Synchro - Kopierassistent");
    this.setBounds(0, 0, 550, 600);

    this.setResizable(true);
    this.setLayout(null);
    this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    this.addWindowListener(this);

    mainPanel = new JPanel();
    mainPanel.setBounds(0, 0, this.getWidth() - 20, 25);
    // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    mainPanel.setLayout(null);

    btnBackup = new JButton("Backup");
    btnBackup.setBounds(this.getWidth() / 2, 0, this.getWidth() / 2 - 20, mainPanel.getHeight());
    btnBackup.addActionListener(this);
    mainPanel.add(btnBackup);

    this.add(mainPanel);

    fcPanel = new JPanel();
    fcPanel.setBounds(10, 40, this.getWidth(), 260);
    // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    fcPanel.setLayout(null);

    quellLabel = new JLabel("Bitte Quellverzeichnis auswählen");
    quellLabel.setBounds(10, 5, 320, 20);
    fcPanel.add(quellLabel);

    quellListModel = new DefaultListModel<>();
    quellJList = new JList<ListItem>(quellListModel);
    quellJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    quellJList.setLayoutOrientation(JList.VERTICAL);
    quellJList.addListSelectionListener(this);

    listBoxScroller = new JScrollPane(quellJList);
    listBoxScroller.setBounds(0, 30, 315, 100);
    fcPanel.add(listBoxScroller);

    btnQAuswahl = new JButton("Quellverz. hinzufügen");
    btnQAuswahl.setBounds(320, 30, 200, 25);
    btnQAuswahl.addActionListener(this);
    fcPanel.add(btnQAuswahl);
    btnQEntfernen = new JButton("Quellverz. entfernen");
    btnQEntfernen.setBounds(320, 60, 200, 25);
    btnQEntfernen.addActionListener(this);
    fcPanel.add(btnQEntfernen);

    zielLabel = new JLabel("Bitte Zielverzeichnis auswählen");
    zielLabel.setBounds(10, 135, 320, 20);
    fcPanel.add(zielLabel);

    zielListModel = new DefaultListModel<>();
    zielJList = new JList<ListItem>(zielListModel);
    zielJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    zielJList.setLayoutOrientation(JList.VERTICAL);
    zielJList.addListSelectionListener(this);

    listBoxScroller2 = new JScrollPane(zielJList);
    listBoxScroller2.setBounds(0, 160, 315, 100);
    fcPanel.add(listBoxScroller2);

    btnZAuswahl = new JButton("Zielverz. hinzufügen");
    btnZAuswahl.setBounds(320, 160, 200, 25);
    btnZAuswahl.addActionListener(this);
    fcPanel.add(btnZAuswahl);
    btnZEntfernen = new JButton("Zielverz. entfernen");
    btnZEntfernen.setBounds(320, 190, 200, 25);
    btnZEntfernen.addActionListener(this);
    fcPanel.add(btnZEntfernen);
    this.add(fcPanel);

    ButtonGroup bGrp = new ButtonGroup();

    optionPanel = new JPanel();
    optionPanel.setBounds(10, 300 + 10, this.getWidth() - 40, 90);
    optionPanel.setPreferredSize(new Dimension(this.getWidth() - 40, 90));
    // optionPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    optionPanel.setLayout(new GridLayout(3, 1));

    nUebSchr = new JRadioButton("Keine Dateien überschreiben");
    nUebSchr.addItemListener(this);
    bGrp.add(nUebSchr);
    optionPanel.add(nUebSchr);

    ueSchr = new JRadioButton("Neuere Dateien überschreiben");
    ueSchr.addItemListener(this);
    bGrp.add(ueSchr);
    optionPanel.add(ueSchr);

    aUeSchr = new JRadioButton("Alle Dateien überschreiben");
    aUeSchr.addItemListener(this);
    bGrp.add(aUeSchr);
    optionPanel.add(aUeSchr);

    this.add(optionPanel);

    syncPanel = new JPanel();
    syncPanel.setBounds(
        10, optionPanel.getY() + optionPanel.getHeight() + 10, this.getWidth() - 30, 25);
    // syncPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    syncPanel.setLayout(new BorderLayout());

    btnSync = new JButton("Sync it!");
    btnSync.setBounds(0, 0, 150, (syncPanel.getHeight() / 3));
    btnSync.addActionListener(this);
    btnSync.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3)));
    btnSync.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3)));
    syncPanel.add(btnSync, BorderLayout.LINE_START);

    btnAbbruch = new JButton("Abbrechen");
    btnAbbruch.setBounds(0, 0, 150, (syncPanel.getHeight() / 3));
    btnAbbruch.addActionListener(this);
    btnAbbruch.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3)));
    btnAbbruch.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3)));
    btnAbbruch.setVisible(false);
    syncPanel.add(btnAbbruch, BorderLayout.LINE_END);

    progressBar = new JProgressBar(JProgressBar.HORIZONTAL);
    progressBar.setBorderPainted(true);
    progressBar.setPreferredSize(new Dimension(300, (syncPanel.getHeight() / 3)));
    progressBar.setForeground(Color.RED);
    progressBar.setStringPainted(true);
    progressBar.setVisible(true);
    syncPanel.add(progressBar, BorderLayout.CENTER);
    this.add(syncPanel);

    logPanel = new JPanel();
    logPanel.setBounds(
        10, syncPanel.getY() + syncPanel.getHeight() + 10, this.getWidth() - 30, 105);
    logPanel.setLayout(new BorderLayout());

    textArea = new JTextArea();
    textArea.setMargin(new Insets(3, 3, 3, 3));
    textArea.setBackground(Color.black);
    textArea.setForeground(Color.LIGHT_GRAY);
    textArea.setAutoscrolls(true);
    textArea.setFocusable(false);
    textAreaScroller = new JScrollPane(textArea);
    DefaultCaret caret = (DefaultCaret) textArea.getCaret();
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    textAreaScroller.setBounds(0, 0, syncPanel.getWidth(), 50);

    logPanel.add(textAreaScroller, BorderLayout.CENTER);
    this.add(logPanel, BorderLayout.SOUTH);
  }