示例#1
0
 public void createContents() {
   if (!contentCreated) {
     Control sashForm = createSashForm();
     item.setControl(sashForm);
     initColors();
     createExampleControls(exmplComp);
     createStyleControls(styleComp);
     exmplComp.layout();
     styleComp.layout();
     contentCreated = true;
   }
 }
示例#2
0
 public void setEnabled(boolean isEnabled) {
   if (this.isEnabled != isEnabled) {
     this.isEnabled = isEnabled;
     avatarsPanel.setEnabled(isEnabled);
     avatarsPanel.layout(true);
   }
 }
  private void parseSampleURL(DBPDriver driver) {
    metaURL = null;

    if (!CommonUtils.isEmpty(driver.getSampleURL())) {
      isCustom = false;
      try {
        metaURL = DriverDescriptor.parseSampleURL(driver.getSampleURL());
      } catch (DBException e) {
        setErrorMessage(e.getMessage());
      }
      final Set<String> properties = metaURL.getAvailableProperties();
      urlText.setEditable(false);
      // urlText.setBackground(urlText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

      showControlGroup(GROUP_HOST, properties.contains(DriverDescriptor.PROP_HOST));
      showControlGroup(GROUP_SERVER, properties.contains(DriverDescriptor.PROP_SERVER));
      showControlGroup(GROUP_DB, properties.contains(DriverDescriptor.PROP_DATABASE));
      showControlGroup(
          GROUP_PATH,
          properties.contains(DriverDescriptor.PROP_FOLDER)
              || properties.contains(DriverDescriptor.PROP_FILE));
    } else {
      isCustom = true;
      showControlGroup(GROUP_HOST, false);
      showControlGroup(GROUP_SERVER, false);
      showControlGroup(GROUP_DB, false);
      showControlGroup(GROUP_PATH, false);
      urlText.setEditable(true);
      urlText.setBackground(null);
    }
    showControlGroup(GROUP_LOGIN, !driver.isAnonymousAccess());
    updateCreateButton(driver);

    settingsGroup.layout();
  }
示例#4
0
 private void updateFont() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setFont(font);
   }
   // Force layout
   if (controls.size() > 0) {
     Composite parent = ((Control) controls.get(0)).getParent();
     parent.layout(true, true);
   }
 }
示例#5
0
  private void fillBuddies(Composite composite) {

    List buddies = getBuddies();

    showNoBuddiesPanel(buddies.size() == 0);

    for (Iterator iterator = buddies.iterator(); iterator.hasNext(); ) {
      VuzeBuddySWT vuzeBuddy = (VuzeBuddySWT) iterator.next();
      createBuddyControls(composite, vuzeBuddy);
    }
    composite.layout();
    Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    composite.setSize(size);
  }
示例#6
0
 protected void createNew() {
   controls.clear();
   destroyExampleControls();
   createExampleControls(exmplComp);
   updateVisible();
   updateEnabled();
   if (fgColorChooser != null) {
     updateFgColor();
   }
   if (bgColorChooser != null) {
     updateBgColor();
   }
   updateBgImage();
   updateBgGradient();
   if (fontChooser != null) {
     // Control control = ( Control )controls.get( 0 );
     // font = control.getFont();
     // if( font != null ) {
     //   fontChooser.setFont( font );
     // }
     updateFont();
   }
   exmplComp.layout();
 }
示例#7
0
  public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) {
    skin = skinObject.getSkin();

    SWTSkinProperties properties = skin.getSkinProperties();
    colorFileDragBorder = properties.getColor("color.buddy.filedrag.bg.border");
    colorFileDragBG = properties.getColor("color.buddy.filedrag.bg");

    soNoBuddies = skin.getSkinObject("buddies-viewer-nobuddies-panel");

    SWTSkinObject viewer = skin.getSkinObject(SkinConstants.VIEWID_BUDDIES_VIEWER);

    if (null != viewer) {

      parent = (Composite) skinObject.getControl();
      parent.setBackgroundMode(SWT.INHERIT_FORCE);
      scrollable = new ScrolledComposite(parent, SWT.V_SCROLL);
      scrollable.setExpandHorizontal(true);
      scrollable.setExpandVertical(true);
      scrollable.setBackgroundMode(SWT.INHERIT_FORCE);
      scrollable.getVerticalBar().setIncrement(10);
      scrollable.getVerticalBar().setPageIncrement(65);

      FormData fd = new FormData();
      fd.top = new FormAttachment(0, 0);
      fd.bottom = new FormAttachment(100, 0);
      fd.left = new FormAttachment(0, 0);
      fd.right = new FormAttachment(100, 0);
      scrollable.setLayoutData(fd);

      avatarsPanel = new Composite(scrollable, SWT.NONE);
      avatarsPanel.setBackgroundMode(SWT.INHERIT_FORCE);
      scrollable.setContent(avatarsPanel);

      scrollable.addListener(
          SWT.Resize,
          new Listener() {

            public void handleEvent(Event event) {
              Rectangle r = scrollable.getClientArea();
              scrollable.setMinHeight(avatarsPanel.computeSize(r.width, SWT.DEFAULT).y);
            }
          });

      /*
       * Specify avatar dimensions and attributes before creating the avatars
       */
      textColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
      selectedTextColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
      textLinkColor = properties.getColor("color.links.hover");
      imageBorderColor = properties.getColor("color.buddy.bg.border");
      selectedColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION);
      highlightedColor = parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);

      avatarHightLightBorder = 0;
      avatarImageBorder = 1;
      hSpacing = 1;
      avatarImageSize = new Point(40, 40);
      avatarNameSize = new Point(60, 30);
      avatarSize = new Point(0, 0);
      avatarSize.x =
          Math.max(avatarNameSize.x, avatarImageSize.x)
              + (2 * (avatarHightLightBorder + avatarImageBorder));
      avatarSize.y =
          avatarNameSize.y
              + avatarImageSize.y
              + (2 * (avatarHightLightBorder + avatarImageBorder) + 6);

      fillBuddies(avatarsPanel);

      /* UNCOMMENT THIS SECTION TO REVERT TO A ROW LAYOUT*/
      //			RowLayout rLayout = new RowLayout(SWT.HORIZONTAL);
      //			rLayout.wrap = true;
      //			rLayout.spacing = hSpacing;
      //			avatarsPanel.setLayout(rLayout);

      // COMMENT THIS SECTION TO REVERT TO A ROW LAYOUT
      SimpleReorderableListLayout rLayout = new SimpleReorderableListLayout();
      rLayout.margin = hSpacing;
      rLayout.wrap = true;
      rLayout.center = true;
      avatarsPanel.setLayout(rLayout);

      avatarsPanel.pack();

      avatarsPanel.addMouseListener(
          new MouseAdapter() {
            public void mouseDown(MouseEvent e) {
              select(null, false, false);
            }
          });

      avatarsPanel.addMouseListener(
          new MouseAdapter() {
            public void mouseDown(MouseEvent e) {
              select(null, false, false);
            }
          });

      parent.layout();

      hookFAQLink();

      hookImageAction();
    }

    return null;
  }