コード例 #1
0
ファイル: FailoverMonitorView.java プロジェクト: eclipse/cdo
    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;
      }
    }
コード例 #2
0
ファイル: FailoverMonitorView.java プロジェクト: eclipse/cdo
    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;
      }
    }
コード例 #3
0
ファイル: FailoverMonitorView.java プロジェクト: eclipse/cdo
    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);
        }
      }
    }