org.eclipse.jst.jsf.facesconfig.ui_1.2.2.v201103292152

rol(Composite parent)
  {
    if (fCombo == null)
    {
      fCombo = new Combo(parent, 8);
      for (int i = 0; i < fEntryNamesAndValues.length; i++) {
        fCombo.add(fEntryNamesAndValues[i][0], i);
      }
      fCombo.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent evt)
        {
          String oldValue = fValue;
          
          String name = fCombo.getText();
          
          fValue = getValueForName(name);
          
          setPresentsDefaultValue(false);
          
          fireValueChanged("field_editor_value", oldValue, fValue);
        }
      });
    }
    return fCombo;
  }
  
  protected String getValueForName(String name)
  {
    for (int i = 0; i < fEntryNamesAndValues.length; i++)
    {
      String[] entry = fEntryNamesAndValues[i];
      if (name.equals(entry[0])) {
        return entry[1];
      }
    }
    return fEntryNamesAndValues[0][0];
  }
  
  protected void updateComboForValue(String value)
  {
    fValue = value;
    for (int i = 0; i < fEntryNamesAndValues.length; i++) {
      if (value.equals(fEntryNamesAndValues[i][1]))
      {
        fCombo.setText(fEntryNamesAndValues[i][0]);
        
        return;
      }
    }
    if (fEntryNamesAndValues.length > 0) {
      fValue = fEntryNamesAndValues[0][1];
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.ComboFieldEditor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

abstract interface CompoundFigureListener
  extends WindowFigureListener
{
  public abstract void stateChanged(int paramInt1, int paramInt2);
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.CompoundFigureListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.draw2d.ActionEvent;
import org.eclipse.draw2d.ActionListener;

class CompoundNodeFigure$1
  implements ActionListener
{
  CompoundNodeFigure$1(CompoundNodeFigure paramCompoundNodeFigure) {}
  
  public void actionPerformed(ActionEvent event)
  {
    this$0.setState(1);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.CompoundNodeFigure.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.draw2d.ActionEvent;
import org.eclipse.draw2d.ActionListener;

class CompoundNodeFigure$2
  implements ActionListener
{
  CompoundNodeFigure$2(CompoundNodeFigure paramCompoundNodeFigure) {}
  
  public void actionPerformed(ActionEvent event)
  {
    this$0.setState(CompoundNodeFigure.access$0(this$0).getState() ? 3 : 
      2);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.CompoundNodeFigure.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import java.util.Iterator;
import org.eclipse.draw2d.ActionEvent;
import org.eclipse.draw2d.ActionListener;
import org.eclipse.draw2d.FreeformFigure;
import org.eclipse.draw2d.FreeformListener;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.Layer;
import org.eclipse.draw2d.LayoutManager;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;

class CompoundNodeFigure
  extends BaseNodeFigure
  implements FreeformFigure, IContainerFigure
{
  private static final String RESTORE_HILITE_IMAGE_FILE = "restore_hilite.gif";
  private static final String RESTORE_IMAGE_FILE = "restore.gif";
  private static final String MAXIMIZE_HILITE_IMAGE_FILE = "maximize_hilite.gif";
  private static final String MAXIMIZE_IMAGE_FILE = "maximize.gif";
  private static final String MINIMIZE_HILITE_IMAGE_FILE = "minimize_hilite.gif";
  private static final String MINIMIZE_IMAGE_FILE = "minimize.gif";
  private static final int MINIMIZED = 1;
  static final int RESTORED = 2;
  private static final int MAXIMIZED = 3;
  private int state = 2;
  private TitleBarButton minButton;
  private TitleBarButton maxButton;
  private IconFigure iconFigure;
  private WindowFigure windowFigure;
  private static String DEFAULT_NAME = "CompoundNode";
  private static String DEFAULT_ICON = "editor/CompoundNode.gif";
  private static Image minimizeImage = EditorPlugin.getDefault().getImage(
    "minimize.gif");
  private static Image minimizeHiliteImage = EditorPlugin.getDefault()
    .getImage("minimize_hilite.gif");
  private static Image maximizeImage = EditorPlugin.getDefault().getImage(
    "maximize.gif");
  private static Image maximizeHiliteImage = EditorPlugin.getDefault()
    .getImage("maximize_hilite.gif");
  private static Image restoreImage = EditorPlugin.getDefault().getImage(
    "restore.gif");
  private static Image restoreHiliteImage = EditorPlugin.getDefault()
    .getImage("restore_hilite.gif");
  
  public CompoundNodeFigure()
  {
    super(new IconFigure(DEFAULT_NAME, EditorPlugin.getDefault().getImage(DEFAULT_ICON)));
    iconFigure = ((IconFigure)getBaseFigure());
    
    windowFigure = new WindowFigure();
    windowFigure.setForegroundColor(IconFigure.defaultForegroundColor);
    windowFigure.setFont(IconFigure.defaultFont);
    
    minButton = new TitleBarButton(minimizeImage, minimizeHiliteImage, 
      null, null);
    maxButton = new TitleBarButton(maximizeImage, maximizeHiliteImage, 
      restoreImage, restoreHiliteImage);
    
    add(minButton);
    add(maxButton);
    
    minButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent event)
      {
        setState(1);
      }
    });
    maxButton.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent event)
      {
        setState(maxButton.getState() ? 3 : 
          2);
      }
    });
    showIcon();
  }
  
  public void setOpaque(boolean flag)
  {
    windowFigure.setOpaque(flag);
  }
  
  private void showIcon()
  {
    setVisible(false);
    minButton.setVisible(false);
    maxButton.setVisible(false);
    super.setBaseFigure(iconFigure);
    
    setAnchorsVisible(true);
    
    setVisible(true);
  }
  
  private void showWindow()
  {
    setVisible(false);
    if (state == 2)
    {
      super.setBaseFigure(windowFigure);
      
      minButton.setVisible(true);
      minButton.setState(false);
      minButton.setToolTip(new Label(PreferenceMessages.CompoundNodeFigure_MinimizeLabel));
      
      maxButton.setVisible(true);
      maxButton.setState(false);
      maxButton.setToolTip(new Label(PreferenceMessages.CompoundNodeFigure_MaximizeLabel));
      
      setAnchorsVisible(true);
    }
    else if (state == 3)
    {
      setAnchorsVisible(false);
      
      Rectangle constraint = new Rectangle(0, 0, -1, -1);
      IFigure parent = getParent();
      if (parent != null)
      {
        constraint = parent.getBounds().getCopy();
        width += x;
        height += y;
        x = 0;
        y = 0;
      }
      super.setBaseFigure(windowFigure, constraint);
      if ((parent != null) && (parent.getLayoutManager() != null)) {
        parent.getLayoutManager().setConstraint(this, constraint);
      }
      minButton.setVisible(false);
      
      maxButton.setVisible(true);
      maxButton.setState(true);
      maxButton.setToolTip(new Label(PreferenceMessages.CompoundNodeFigure_RestoreLabel));
    }
    setVisible(true);
  }
  
  public void addDecorator(BaseFigureDecorator decorator)
  {
    iconFigure.addDecorator(decorator);
  }
  
  public void removeDecorator()
  {
    iconFigure.removeDecorator();
  }
  
  public void removeDecorator(int position)
  {
    iconFigure.removeDecorator(position);
  }
  
  public void setHilight(boolean flag)
  {
    windowFigure.setHighlight(flag);
    if (flag) {
      moveToTop();
    }
  }
  
  public void setText(String name)
  {
    iconFigure.setText(name);
    windowFigure.setText(name);
  }
  
  public void setIcon(Image image)
  {
    iconFigure.setIcon(image);
  }
  
  public void setToolTipText(String text)
  {
    iconFigure.setToolTipText(text);
  }
  
  public void validate()
  {
    LayoutManager layout = getLayoutManager();
    if (state != 1) {
      if (state == 2)
      {
        Rectangle r = windowFigure.getBounds().getCopy();
        Insets i = windowFigure.getInsets();
        Dimension dm = maxButton.getSize();
        Insets p = windowFigure.getTabbedTitleBarBorder().getPadding();
        layout.setConstraint(maxButton, new Rectangle(x + width - 
          width - right - right, y + top + top - 
          height - bottom, -1, -1));
        layout.setConstraint(minButton, new Rectangle(x + width - 2 * 
          width - 2 * right - right, y + top + top - 
          height - bottom, -1, -1));
      }
      else if (state == 3)
      {
        if (getParent() == null) {
          return;
        }
        Rectangle r = getParent().getBounds().getCopy();
        Insets i = windowFigure.getInsets();
        Dimension dm = maxButton.getSize();
        Insets p = windowFigure.getTabbedTitleBarBorder().getPadding();
        layout.setConstraint(maxButton, new Rectangle(x + width - 
          width - right - right, y + top, -1, -1));
      }
    }
    super.validate();
  }
  
  public WindowFigure getWindowFigure()
  {
    return windowFigure;
  }
  
  public void setFont(Font f)
  {
    iconFigure.setFont(f);
    windowFigure.setFont(f);
  }
  
  public void setForegroundColor(Color c)
  {
    iconFigure.setForegroundColor(c);
    windowFigure.setForegroundColor(c);
  }
  
  public void setBackgroundColor(Color c)
  {
    iconFigure.setBackgroundColor(c);
    windowFigure.setBackgroundColor(c);
  }
  
  public int getState()
  {
    return state;
  }
  
  public void setState(int newState)
  {
    int oldState = state;
    state = newState;
    if (state == 1)
    {
      if ((getParent() != null) && (getParent().getLayoutManager() != null))
      {
        Rectangle constraint = (Rectangle)getParent()
          .getLayoutManager().getConstraint(this);
        width = -1;
        height = -1;
      }
      showIcon();
    }
    else if (state == 3)
    {
      if ((getParent() != null) && (getParent().getLayoutManager() != null))
      {
        Rectangle constraint = (Rectangle)getParent()
          .getLayoutManager().getConstraint(this);
        x = 0;
        y = 0;
        width = -1;
        height = -1;
      }
      showWindow();
    }
    else if (state == 2)
    {
      if ((getParent() != null) && (getParent().getLayoutManager() != null))
      {
        Rectangle constraint = (Rectangle)getParent()
          .getLayoutManager().getConstraint(this);
        constraint.setSize(windowFigure.getBounds().getSize());
      }
      showWindow();
    }
    fireStateChanged(oldState, newState);
  }
  
  private void fireStateChanged(int oldState, int newState)
  {
    Object[] l = windowFigure.getTabbedTitleBarBorder().getListeners();
    for (int i = 0; i < l.length; i++) {
      if ((l[i] instanceof CompoundFigureListener)) {
        ((CompoundFigureListener)l[i]).stateChanged(oldState, newState);
      }
    }
  }
  
  public Dimension getMinimumSize(int wHint, int hHint)
  {
    if (getState() == 2)
    {
      Dimension d = windowFigure.getMinimumSize(wHint, hHint); Dimension 
        tmp19_18 = d;
      
      1918width = (1918width + (minButton.getSize().width + maxButton.getSize().width + 2 * 
        windowFigure.getTabbedTitleBarBorder().getPadding()
        .getWidth()));
      return d;
    }
    if (getState() == 1) {
      return iconFigure.getMinimumSize(wHint, hHint);
    }
    return super.getMinimumSize(wHint, hHint);
  }
  
  private WindowFreeformHelper helper = new WindowFreeformHelper(this);
  
  public void addFreeformListener(FreeformListener listener)
  {
    addListener(FreeformListener.class, listener);
  }
  
  public void fireExtentChanged()
  {
    if (state == 3)
    {
      Iterator iter = getListeners(FreeformListener.class);
      while (iter.hasNext()) {
        ((FreeformListener)iter.next()).notifyFreeformExtentChanged();
      }
    }
  }
  
  public Rectangle getFreeformExtent()
  {
    if (state == 3) {
      return helper.getFreeformExtent();
    }
    return getBounds();
  }
  
  public void removeFreeformListener(FreeformListener listener)
  {
    removeListener(FreeformListener.class, listener);
  }
  
  public void setFreeformBounds(Rectangle bounds)
  {
    if (getState() == 3) {
      helper.setFreeformBounds(bounds);
    }
  }
  
  public Layer getLayer(Object key)
  {
    if ((windowFigure != null) && (windowFigure.isVisible())) {
      return windowFigure.getLayer(key);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.CompoundNodeFigure
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

class FigureConstants
{
  public static final int PORT_SIDE = 10;
  public static final int PORT_SPACING = 2;
  public static int INPUT_PORT = 0;
  public static int OUTPUT_PORT = 1;
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.FigureConstants
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;

class GEMPreferences$1
  extends AccessibleAdapter
{
  GEMPreferences$1(GEMPreferences paramGEMPreferences) {}
  
  public void getName(AccessibleEvent e)
  {
    result = PreferenceMessages.CanvasPreferenceTab_LABEL_BackgroundColor;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;

class GEMPreferences$2
  extends AccessibleAdapter
{
  GEMPreferences$2(GEMPreferences paramGEMPreferences) {}
  
  public void getName(AccessibleEvent e)
  {
    result = PreferenceMessages.CanvasPreferenceTab_LABEL_GridLineColor;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;

class GEMPreferences$3
  extends AccessibleAdapter
{
  GEMPreferences$3(GEMPreferences paramGEMPreferences) {}
  
  public void getName(AccessibleEvent e)
  {
    result = PreferenceMessages.CanvasPreferenceTab_LABEL_IconLabelFont;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;

class GEMPreferences$4
  extends AccessibleAdapter
{
  GEMPreferences$4(GEMPreferences paramGEMPreferences) {}
  
  public void getName(AccessibleEvent e)
  {
    result = PreferenceMessages.CanvasPreferenceTab_LABEL_LineLabelFont;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;

class GEMPreferences$5
  extends AccessibleAdapter
{
  GEMPreferences$5(GEMPreferences paramGEMPreferences) {}
  
  public void getName(AccessibleEvent e)
  {
    result = PreferenceMessages.CanvasPreferenceTab_LABEL_LineLabelColor;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences.5
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;

class GEMPreferences$6
  extends AccessibleAdapter
{
  GEMPreferences$6(GEMPreferences paramGEMPreferences) {}
  
  public void getName(AccessibleEvent e)
  {
    result = PreferenceMessages.CanvasPreferenceTab_LABEL_LineColor;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences.6
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.jface.preference.ColorFieldEditor;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class GEMPreferences$7
  extends SelectionAdapter
{
  GEMPreferences$7(GEMPreferences paramGEMPreferences) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    boolean userColorsValue_ = !GEMPreferences.access$0(this$0)
      .getBooleanValue();
    boolean showLineLabelsValue_ = GEMPreferences.access$1(this$0)
      .getBooleanValue();
    boolean snapToGridValue_ = GEMPreferences.access$2(this$0).getBooleanValue();
    
    GEMPreferences.access$3(this$0).setEnabled(userColorsValue_, GEMPreferences.access$4(this$0));
    GEMPreferences.access$5(this$0)
      .setEnabled((snapToGridValue_) && (userColorsValue_), 
      GEMPreferences.access$4(this$0));
    GEMPreferences.access$6(this$0).setEnabled(userColorsValue_, GEMPreferences.access$7(this$0));
    
    GEMPreferences.access$8(this$0).setEnabled(userColorsValue_, GEMPreferences.access$9(this$0));
    GEMPreferences.access$10(this$0).setEnabled((showLineLabelsValue_) && 
      (userColorsValue_), GEMPreferences.access$9(this$0));
    GEMPreferences.access$11(this$0).setEnabled((showLineLabelsValue_) && 
      (userColorsValue_), GEMPreferences.access$9(this$0));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences.7
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.jface.preference.ColorFieldEditor;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class GEMPreferences$8
  extends SelectionAdapter
{
  GEMPreferences$8(GEMPreferences paramGEMPreferences) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    boolean userColorsValue_ = !GEMPreferences.access$0(this$0).getBooleanValue();
    boolean showLineLabelsValue_ = GEMPreferences.access$1(this$0).getBooleanValue();
    GEMPreferences.access$10(this$0).setEnabled((showLineLabelsValue_) && 
      (userColorsValue_), GEMPreferences.access$9(this$0));
    GEMPreferences.access$11(this$0).setEnabled((showLineLabelsValue_) && (userColorsValue_), 
      GEMPreferences.access$9(this$0));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences.8
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.jface.preference.ColorFieldEditor;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class GEMPreferences$9
  extends SelectionAdapter
{
  GEMPreferences$9(GEMPreferences paramGEMPreferences) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    boolean userColorsValue_ = !GEMPreferences.access$0(this$0).getBooleanValue();
    boolean snapToGridValue_ = GEMPreferences.access$2(this$0).getBooleanValue();
    
    GEMPreferences.access$5(this$0).setEnabled((snapToGridValue_) && (userColorsValue_), 
      GEMPreferences.access$4(this$0));
    GEMPreferences.access$12(this$0).setEnabled(snapToGridValue_, GEMPreferences.access$4(this$0));
    GEMPreferences.access$13(this$0).setEnabled(snapToGridValue_, GEMPreferences.access$4(this$0));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences.9
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;

class GEMPreferences$BooleanField
  extends BooleanFieldEditor
{
  private Composite parent;
  
  public GEMPreferences$BooleanField(GEMPreferences paramGEMPreferences, String name, String label, Composite parent)
  {
    super(name, label, parent);
    this.parent = parent;
  }
  
  public Button getButton()
  {
    return getChangeControl(parent);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences.BooleanField
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ColorFieldEditor;
import org.eclipse.jface.preference.ColorSelector;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.swt.accessibility.Accessible;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

public final class GEMPreferences
  extends FieldEditorPreferencePage
  implements IWorkbenchPreferencePage
{
  public static final String SHOW_INTRO_EDITOR = "ShowIntroEditor";
  public static final String USE_SYSTEM_COLORS = "UseSystemColors";
  public static final String CANVAS_COLOR = "CanvasColor";
  public static final String FIGURE_LABEL_FONT = "FigureLabelFont";
  public static final String FIGURE_LABEL_FONT_COLOR = "FigureLabelFontColor";
  public static final String LABEL_PLACEMENT = "LabelPlacement";
  public static final String INPUT_PORT_COLOR = "InputPortColor";
  public static final String OUTPUT_PORT_COLOR = "OutputPortColor";
  public static final String SHOW_LINE_LABELS = "ShowLineLabels";
  public static final String LINE_LABEL_FONT = "LineLabelFont";
  public static final String LINE_LABEL_FONT_COLOR = "LineLabelFontColor";
  public static final String LINE_LABEL_COLOR = "LineLabelColor";
  public static final String LINE_WIDTH = "LineWidth";
  public static final String LINE_COLOR = "LineColor";
  public static final String LINE_ROUTING = "LineRouting";
  public static final String SNAP_TO_GRID = "SnapToGrid";
  public static final String SNAP_TO_GEOMETRY = "SnapToGeometry";
  public static final String GRID_WIDTH = "GridWidth";
  public static final String GRID_HEIGHT = "GridHeight";
  public static final String GRID_COLOR = "GridColor";
  public static final String LABEL_PLACEMENT_TOP = "Top";
  public static final String LABEL_PLACEMENT_BOTTOM = "Bottom";
  public static final String LABEL_PLACEMENT_LEFT = "Left";
  public static final String LABEL_PLACEMENT_RIGHT = "Right";
  public static final String LINE_ROUTING_MANHATTAN = "Manhattan";
  public static final String LINE_ROUTING_MANUAL = "Manaul";
  private static final String[][] m_lineRoutingLabels = {
  
    {
    PreferenceMessages.CanvasPreferences_LABEL_Manual, "Manaul" }, 
    {
    PreferenceMessages.CanvasPreferences_LABEL_Manhattan, "Manhattan" } };
  private static final String[][] m_labelPlacementLabels = {
    {
    PreferenceMessages.CanvasPreferences_LABEL_Top, "Top" }, 
    {
    PreferenceMessages.CanvasPreferences_LABEL_Bottom, "Bottom" }, 
    {
    PreferenceMessages.CanvasPreferences_LABEL_Left, "Left" }, 
    {
    PreferenceMessages.CanvasPreferences_LABEL_Right, "Right" } };
  private Group canvasGroup;
  private Group iconGroup;
  private Group lineGroup;
  private BooleanField useSystemColors;
  private ColorFieldEditor canvasColor;
  private BooleanField snapToGrid;
  private IntegerFieldEditor gridWidth;
  private IntegerFieldEditor gridHeight;
  private ColorFieldEditor gridColor;
  private BooleanField showLineLabels;
  private ColorFieldEditor lineLabelColor;
  private ColorFieldEditor lineColor;
  private ColorFontFieldEditor iconFont;
  private ColorFontFieldEditor lineFont;
  
  private class BooleanField
    extends BooleanFieldEditor
  {
    private Composite parent;
    
    public BooleanField(String name, String label, Composite parent)
    {
      super(label, parent);
      this.parent = parent;
    }
    
    public Button getButton()
    {
      return getChangeControl(parent);
    }
  }
  
  public GEMPreferences()
  {
    super(1);
    
    setPreferenceStore(EditorPlugin.getDefault().getPreferenceStore());
    setDescription(PreferenceMessages.GEMPreferences_description);
  }
  
  public static void initializeDefaults()
  {
    IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore();
    Font f = JFaceResources.getFontRegistry().get(
      "org.eclipse.jface.defaultfont");
    
    store.setDefault("ShowIntroEditor", true);
    store.setDefault("UseSystemColors", true);
    PreferenceConverter.setDefault(store, "CanvasColor", new RGB(255, 255, 
      255));
    PreferenceConverter.setDefault(store, "FigureLabelFont", f
      .getFontData());
    store.setDefault("LineWidth", 1);
    store.setDefault("LineRouting", getLineRoutingLabels()[0][1]);
    store.setDefault("ShowLineLabels", true);
    PreferenceConverter.setDefault(store, "LineColor", new RGB(0, 0, 0));
    PreferenceConverter.setDefault(store, "LineLabelColor", new RGB(255, 
      255, 255));
    PreferenceConverter.setDefault(store, "LineLabelFont", f.getFontData());
    store.setDefault("SnapToGeometry", true);
    store.setDefault("SnapToGrid", true);
    store.setDefault("GridWidth", 12);
    store.setDefault("GridHeight", 12);
    PreferenceConverter.setDefault(store, "GridColor", 
      new RGB(230, 230, 230));
    store.setDefault("LabelPlacement", "Bottom");
  }
  
  public void createFieldEditors()
  {
    addBooleanField(
      "ShowIntroEditor", 
      PreferenceMessages.EditorPreferences_LABEL_ShowIntroEditor, 
      getFieldEditorParent());
    
    useSystemColors = addBooleanField(
      "UseSystemColors", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_UseSystemColors, 
      getFieldEditorParent());
    
    canvasGroup = new Group(getFieldEditorParent(), 0);
    lineGroup = new Group(getFieldEditorParent(), 0);
    iconGroup = new Group(getFieldEditorParent(), 0);
    
    canvasGroup.setText(PreferenceMessages.CanvasPreferenceTab_LABEL_Canvas);
    canvasColor = addColorField(
      "CanvasColor", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_BackgroundColor, canvasGroup);
    
    canvasColor.getColorSelector().getButton().getAccessible().addAccessibleListener(
      new AccessibleAdapter()
      {
        public void getName(AccessibleEvent e)
        {
          result = PreferenceMessages.CanvasPreferenceTab_LABEL_BackgroundColor;
        }
      });
    addBooleanField(
      "SnapToGeometry", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_SnapToGeometry, canvasGroup);
    snapToGrid = addBooleanField(
      "SnapToGrid", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_SnapToGrid, canvasGroup);
    gridColor = addColorField(
      "GridColor", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_GridLineColor, canvasGroup);
    gridColor.getColorSelector().getButton().getAccessible().addAccessibleListener(
      new AccessibleAdapter()
      {
        public void getName(AccessibleEvent e)
        {
          result = PreferenceMessages.CanvasPreferenceTab_LABEL_GridLineColor;
        }
      });
    gridWidth = addIntegerField(
      "GridWidth", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_GridWidth, canvasGroup);
    gridHeight = addIntegerField(
      "GridHeight", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_GridHeight, canvasGroup);
    
    iconGroup.setText(PreferenceMessages.CanvasPreferenceTab_LABEL_IconGroup);
    iconFont = addFontField(
      "FigureLabelFont", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_IconLabelFont, iconGroup);
    iconFont.getChangeControl(iconGroup).getAccessible().addAccessibleListener(
      new AccessibleAdapter()
      {
        public void getName(AccessibleEvent e)
        {
          result = PreferenceMessages.CanvasPreferenceTab_LABEL_IconLabelFont;
        }
      });
    addComboField("LabelPlacement", PreferenceMessages.CanvasPreferenceTab_LABEL_LabelPlacement, 
      getLabelPlacementLabels(), iconGroup);
    
    lineGroup.setText(PreferenceMessages.CanvasPreferenceTab_LABEL_LineGroup);
    showLineLabels = addBooleanField("ShowLineLabels", PreferenceMessages.CanvasPreferenceTab_LABEL_ShowLineLabels, 
      lineGroup);
    lineFont = addFontField(
      "LineLabelFont", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_LineLabelFont, lineGroup);
    lineFont.getChangeControl(lineGroup).getAccessible().addAccessibleListener(
      new AccessibleAdapter()
      {
        public void getName(AccessibleEvent e)
        {
          result = PreferenceMessages.CanvasPreferenceTab_LABEL_LineLabelFont;
        }
      });
    lineLabelColor = addColorField(
      "LineLabelColor", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_LineLabelColor, lineGroup);
    lineLabelColor.getColorSelector().getButton().getAccessible().addAccessibleListener(
      new AccessibleAdapter()
      {
        public void getName(AccessibleEvent e)
        {
          result = PreferenceMessages.CanvasPreferenceTab_LABEL_LineLabelColor;
        }
      });
    lineColor = addColorField(
      "LineColor", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_LineColor, lineGroup);
    lineColor.getColorSelector().getButton().getAccessible().addAccessibleListener(
      new AccessibleAdapter()
      {
        public void getName(AccessibleEvent e)
        {
          result = PreferenceMessages.CanvasPreferenceTab_LABEL_LineColor;
        }
      });
    addIntegerField(
      "LineWidth", 
      PreferenceMessages.CanvasPreferenceTab_LABEL_LineWidth, lineGroup);
    addComboField("LineRouting", PreferenceMessages.CanvasPreferenceTab_LABEL_LineRouting, 
      getLineRoutingLabels(), lineGroup);
  }
  
  protected void initialize()
  {
    super.initialize();
    
    getFieldEditorParentgetLayoutnumColumns = 2;
    
    canvasGroup.setLayout(new GridLayout(3, false));
    canvasGroup.setLayoutData(new GridData(770));
    
    canvasColor.fillIntoGrid(canvasGroup, 3);
    gridColor.fillIntoGrid(canvasGroup, 3);
    
    iconGroup.setLayout(new GridLayout(3, false));
    iconGroup.setLayoutData(new GridData(770));
    
    iconFont.fillIntoGrid(iconGroup, 3);
    
    lineGroup.setLayout(new GridLayout(3, false));
    lineGroup.setLayoutData(new GridData(770));
    
    lineColor.fillIntoGrid(lineGroup, 3);
    lineLabelColor.fillIntoGrid(lineGroup, 3);
    lineFont.fillIntoGrid(lineGroup, 3);
    
    boolean userColorsValue = !useSystemColors.getBooleanValue();
    boolean showLineLabelsValue = showLineLabels.getBooleanValue();
    boolean snapToGridValue = snapToGrid.getBooleanValue();
    canvasColor.setEnabled(userColorsValue, canvasGroup);
    gridColor.setEnabled((snapToGridValue) && (userColorsValue), canvasGroup);
    iconFont.setEnabled(userColorsValue, iconGroup);
    
    lineColor.setEnabled(userColorsValue, lineGroup);
    lineLabelColor.setEnabled((showLineLabelsValue) && (userColorsValue), 
      lineGroup);
    lineFont.setEnabled((showLineLabelsValue) && (userColorsValue), lineGroup);
    gridWidth.setEnabled(snapToGridValue, canvasGroup);
    gridHeight.setEnabled(snapToGridValue, canvasGroup);
    
    useSystemColors.getButton().addSelectionListener(
      new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          boolean userColorsValue_ = !useSystemColors
            .getBooleanValue();
          boolean showLineLabelsValue_ = showLineLabels
            .getBooleanValue();
          boolean snapToGridValue_ = snapToGrid.getBooleanValue();
          
          canvasColor.setEnabled(userColorsValue_, canvasGroup);
          gridColor
            .setEnabled((snapToGridValue_) && (userColorsValue_), 
            canvasGroup);
          iconFont.setEnabled(userColorsValue_, iconGroup);
          
          lineColor.setEnabled(userColorsValue_, lineGroup);
          lineLabelColor.setEnabled((showLineLabelsValue_) && 
            (userColorsValue_), lineGroup);
          lineFont.setEnabled((showLineLabelsValue_) && 
            (userColorsValue_), lineGroup);
        }
      });
    showLineLabels.getButton().addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        boolean userColorsValue_ = !useSystemColors.getBooleanValue();
        boolean showLineLabelsValue_ = showLineLabels.getBooleanValue();
        lineLabelColor.setEnabled((showLineLabelsValue_) && 
          (userColorsValue_), lineGroup);
        lineFont.setEnabled((showLineLabelsValue_) && (userColorsValue_), 
          lineGroup);
      }
    });
    snapToGrid.getButton().addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        boolean userColorsValue_ = !useSystemColors.getBooleanValue();
        boolean snapToGridValue_ = snapToGrid.getBooleanValue();
        
        gridColor.setEnabled((snapToGridValue_) && (userColorsValue_), 
          canvasGroup);
        gridWidth.setEnabled(snapToGridValue_, canvasGroup);
        gridHeight.setEnabled(snapToGridValue_, canvasGroup);
      }
    });
  }
  
  public void init(IWorkbench workbench) {}
  
  private ColorFieldEditor addColorField(String name, String labelText, Composite parent)
  {
    ColorFieldEditor f = new ColorFieldEditor(name, labelText, parent);
    addField(f);
    return f;
  }
  
  private ComboFieldEditor addComboField(String name, String labelText, String[][] entryNamesAndValues, Composite parent)
  {
    ComboFieldEditor f = new ComboFieldEditor(name, labelText, 
      entryNamesAndValues, parent);
    addField(f);
    return f;
  }
  
  private IntegerFieldEditor addIntegerField(String name, String labelText, Composite parent)
  {
    IntegerFieldEditor f = new IntegerFieldEditor(name, labelText, parent);
    addField(f);
    return f;
  }
  
  private BooleanField addBooleanField(String name, String labelText, Composite parent)
  {
    BooleanField f = new BooleanField(name, labelText, parent);
    addField(f);
    return f;
  }
  
  private ColorFontFieldEditor addFontField(String name, String labelText, Composite parent)
  {
    ColorFontFieldEditor f = new ColorFontFieldEditor(name, labelText, 
      parent);
    addField(f);
    return f;
  }
  
  private static String[][] getLineRoutingLabels()
  {
    return m_lineRoutingLabels;
  }
  
  private static String[][] getLabelPlacementLabels()
  {
    return m_labelPlacementLabels;
  }
  
  public static boolean getShowIntroEditor()
  {
    IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore();
    return store.getBoolean("ShowIntroEditor");
  }
  
  public static Color getColor(IPreferenceStore store, String property)
  {
    boolean useSystemColors = store.getBoolean("UseSystemColors");
    
    Color c = ColorConstants.black;
    if (useSystemColors)
    {
      if ("GridColor".equals(property)) {
        c = ColorConstants.button;
      }
      if ("LineColor".equals(property)) {
        c = ColorConstants.listForeground;
      }
      if ("LineLabelFontColor".equals(property)) {
        c = ColorConstants.listForeground;
      }
      if ("LineLabelColor".equals(property)) {
        c = ColorConstants.listBackground;
      }
      if ("CanvasColor".equals(property)) {
        c = ColorConstants.listBackground;
      }
      if ("InputPortColor".equals(property)) {
        c = ColorConstants.listForeground;
      }
      if ("OutputPortColor".equals(property)) {
        c = ColorConstants.listForeground;
      }
      if ("FigureLabelFontColor".equals(property)) {
        c = ColorConstants.listForeground;
      }
    }
    else
    {
      RGB rgb = PreferenceConverter.getColor(store, property);
      ColorRegistry registry = JFaceResources.getColorRegistry();
      if (registry.get(rgb.toString()) != null) {
        return registry.get(rgb.toString());
      }
      registry.put(rgb.toString(), rgb);
      c = registry.get(rgb.toString());
    }
    return c;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import java.util.List;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Image;

abstract interface IBaseFigure
  extends IFigure
{
  public abstract void setText(String paramString);
  
  public abstract String getText();
  
  public abstract Rectangle getTextBounds();
  
  public abstract void setIcon(Image paramImage);
  
  public abstract Image getIcon();
  
  public abstract void setToolTipText(String paramString);
  
  public abstract String getToolTipText();
  
  public abstract void setHighlight(boolean paramBoolean);
  
  public abstract void addDecorator(BaseFigureDecorator paramBaseFigureDecorator);
  
  public abstract void removeDecorator();
  
  public abstract void removeDecorator(int paramInt);
  
  public abstract List getDecorators();
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.IBaseFigure
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.draw2d.Layer;

abstract interface IContainerFigure
  extends IBaseFigure
{
  public abstract Layer getLayer(Object paramObject);
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.preference.IContainerFigure
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.preference;

import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;

class IconFigure$IconLabel
  extends Label
{
  private IconFigure.LabelLocator locator;
  private IconFigure host;
  
  public IconFigure$IconLabel(IconFigure paramIconFigure1, IconFigure host, String text)
  {
    super(text);
    this.host = host;
    locator = new IconFigure.LabelLocator(paramIconFigure1, this);
  }
  
  public IconFigure getHost()
  {
    return host;
  }
  
  p
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd