Exemple #1
0
    public void controlResized(ControlEvent e) {
      try {
        resizing = true;
        Point size = getSize();
        width = size.x;
        height = size.y;

        int count = channelArray.length;
        if (count == 0) {
          return;
        }

        int oldChannelHeight = channelHeight;
        if (oldChannelHeight == 0) {
          oldChannelHeight = 1;
        }

        channelHeight = height / (2 * count);

        int y = channelHeight;
        for (Channel channel : channelArray) {
          channel.resize(y, oldChannelHeight);
          y += channelHeight + channelHeight;
        }
      } finally {
        resizing = false;
      }
    }
Exemple #2
0
    public Channel getChannel(String name) {
      synchronized (channels) {
        Channel channel = channels.get(name);
        if (channel == null) {
          boolean resize = false;

          channel = channels.remove(INITIAL);
          if (channel == null) {
            channel = new Channel(name);
            resize = true;
          } else {
            channel.setName(name);
          }

          channels.put(name, channel);
          channelArray = channels.values().toArray(new Channel[channels.size()]);

          if (resize) {
            getDisplay()
                .syncExec(
                    new Runnable() {
                      public void run() {
                        controlResized(null);
                      }
                    });
          }
        }

        return channel;
      }
    }
Exemple #3
0
    public void paintControl(PaintEvent e) {
      if (!resizing) {
        GC gc = e.gc;
        gc.setAdvanced(true);
        gc.setAntialias(SWT.ON);

        for (Channel channel : channelArray) {
          channel.paint(e.gc);
        }
      }
    }