/**
   * Constructor for TabbedPropertyTitle.
   *
   * @param parent the parent composite.
   * @param factory the widget factory for the tabbed property sheet
   */
  public TabbedPropertyTitle(Composite parent, FormWidgetFactory factory) {
    super(parent, SWT.NONE);
    this.factory = factory;

    bg = factory.getColors().getColor(FormColors.TB_BG);
    gbg = factory.getColors().getColor(FormColors.TB_GBG);
    border = factory.getColors().getColor(FormColors.TB_BORDER);

    this.addPaintListener(
        new PaintListener() {

          public void paintControl(PaintEvent e) {
            if (image == null && (text == null || text.equals(BLANK))) {
              label.setVisible(false);
            } else {
              label.setVisible(true);
              drawTitleBackground(e);
            }
          }
        });

    this.addFocusListener(
        new FocusListener() {

          public void focusGained(FocusEvent e) {
            if (toolbar != null) {
              toolbar.setFocus();

            } else getParent().setFocus();
          }

          public void focusLost(FocusEvent e) {
            // TODO Auto-generated method stub

          }
        });

    factory.getColors().initializeSectionToolBarColors();
    setBackground(factory.getColors().getBackground());
    setForeground(factory.getColors().getForeground());

    FormLayout layout = new FormLayout();
    layout.marginWidth = ITabbedPropertyConstants.HSPACE + 6;
    layout.marginHeight = 5;
    setLayout(layout);

    label =
        new CLabel(this, SWT.NONE) {

          public Point computeSize(int wHint, int hHint, boolean changed) {
            Point p = super.computeSize(wHint, hHint, changed);
            p.y = p.y + 2;
            return p;
          }
        };
    label.setBackground(parent.getBackground());
    label.setText(BLANK);
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    label.setLayout(gl);

    // resetButton = new Button( label, SWT.FLAT );
    //		resetButton.setText( Messages.getString( "TabbedPropertyTitle.Button.Default.Text" ) );
    // //$NON-NLS-1$
    // GridData gd = new GridData( );
    // gd.grabExcessHorizontalSpace = true;
    // gd.horizontalAlignment = SWT.END;
    // gd.grabExcessVerticalSpace = true;
    // gd.verticalAlignment = SWT.CENTER;
    // resetButton.setLayoutData( gd );
    // resetButton.setVisible( false );
    // resetButton.addSelectionListener( new SelectionAdapter( ) {
    //
    // public void widgetSelected( SelectionEvent e )
    // {
    // Event event = new Event( );
    // event.widget = resetButton;
    // TabbedPropertyTitle.this.notifyListeners( SWT.SELECTED, event );
    // }
    //
    // } );
    //		resetButton.setToolTipText( Messages.getString(
    // "TabbedPropertyTitle.Button.Default.TooltipText" ) ); //$NON-NLS-1$

    label.setBackground(
        new Color[] {
          factory.getColors().getColor(FormColors.TB_BG),
          factory.getColors().getColor(FormColors.TB_GBG)
        },
        new int[] {100},
        true);
    label.setFont(JFaceResources.getBannerFont());
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    label.setLayoutData(data);

    /*
     * setImage(PlatformUI.getWorkbench().getSharedImages().getImage(
     * ISharedImages.IMG_OBJ_ELEMENT));
     */
  }