org.eclipse.e4.ui.css.swt_0.10.3.v20130123-162658

16:42:59.499 INFO  jd.cli.Main - Decompiling org.eclipse.e4.ui.css.swt_0.10.3.v20130123-162658.jar
package org.eclipse.e4.ui.css.swt;

public class CSSSWTConstants
{
  public static final String CSS_CLASS_NAME_KEY = "org.eclipse.e4.ui.css.CssClassName";
  public static final String CSS_ID_KEY = "org.eclipse.e4.ui.css.id";
  public static final String CSS_ENGINE_KEY = "org.eclipse.e4.ui.css.core.engine";
  public static final String MARGIN_WRAPPER_KEY = "org.eclipse.e4.ui.css.swt.marginWrapper";
  public static final String CONTROL_CSS2BORDER_KEY = "org.eclipse.e4.ui.core.css.swt.CONTROL_CSS2BORDER_KEY";
  public static final String TEXT_KEY = "org.eclipse.e4.ui.css.swt.TEXT_KEY";
  public static final String ACTIVE_LOST = "org.eclipse.e4.ui.css.swt.ACTIVE_LOST";
  public static final String ACTIVE_LISTENER = "org.eclipse.e4.ui.css.swt.ACTIVE_LISTENER";
  public static final String FOCUS_LOST = "org.eclipse.e4.ui.css.swt.FOCUS_LOST";
  public static final String FOCUS_LISTENER = "org.eclipse.e4.ui.css.swt.FOCUS_LISTENER";
  public static final String MOUSE_HOVER = "org.eclipse.e4.ui.css.swt.HOVER";
  public static final String MOUSE_HOVER_LOST = "org.eclipse.e4.ui.css.swt.HOVER_LOST";
  public static final String BUTTON_SELECTED_LISTENER = "org.eclipse.e4.ui.css.swt.BUTTON_SELECTED_LISTENER";
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.CSSSWTConstants
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Widget;

class ButtonElement$1
  extends SelectionAdapter
{
  ButtonElement$1(ButtonElement paramButtonElement) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    if (!widget.isDisposed())
    {
      ButtonElement.access$0(this$0, this$0.getButton().getSelection());
      ButtonElement.access$1(this$0);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.ButtonElement.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Widget;

public class ButtonElement
  extends ControlElement
{
  private boolean isSelected = false;
  private SelectionListener selectionListener = new SelectionAdapter()
  {
    public void widgetSelected(SelectionEvent e)
    {
      if (!widget.isDisposed())
      {
        isSelected = getButton().getSelection();
        doApplyStyles();
      }
    }
  };
  
  public ButtonElement(Button button, CSSEngine engine)
  {
    super(button, engine);
    isSelected = button.getSelection();
  }
  
  public void initialize()
  {
    super.initialize();
    if (!dynamicEnabled) {
      return;
    }
    Button button = getButton();
    button.addSelectionListener(selectionListener);
  }
  
  public void dispose()
  {
    super.dispose();
    if (!dynamicEnabled) {
      return;
    }
    Button button = getButton();
    if (!button.isDisposed()) {
      button.removeSelectionListener(selectionListener);
    }
  }
  
  public boolean isPseudoInstanceOf(String s)
  {
    if ("checked".equals(s)) {
      return isSelected;
    }
    return super.isPseudoInstanceOf(s);
  }
  
  protected Button getButton()
  {
    return (Button)getNativeWidget();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.ButtonElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Widget;
import org.w3c.dom.Node;

public class CTabFolderElement
  extends CompositeElement
{
  public CTabFolderElement(CTabFolder tabFolder, CSSEngine engine)
  {
    super(tabFolder, engine);
  }
  
  protected void computeStaticPseudoInstances()
  {
    super.computeStaticPseudoInstances();
    
    super.addStaticPseudoInstance("selected");
  }
  
  public Node item(int index)
  {
    Widget widget = getWidget();
    
    CTabFolder folder = (CTabFolder)widget;
    int length = folder.getChildren().length;
    if (index >= length)
    {
      Widget w = folder.getItem(index - length);
      return getElement(w);
    }
    Widget w = folder.getChildren()[index];
    return getElement(w);
  }
  
  public int getLength()
  {
    Widget widget = getWidget();
    int childCount = 0;
    if ((widget instanceof Composite))
    {
      childCount = ((Composite)widget).getChildren().length;
      if ((widget instanceof CTabFolder)) {
        childCount += ((CTabFolder)widget).getItemCount();
      }
    }
    return childCount;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.CTabFolderElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.widgets.Item;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class CTabItemElement
  extends ItemElement
{
  public CTabItemElement(Item item, CSSEngine engine)
  {
    super(item, engine);
  }
  
  protected void computeStaticPseudoInstances()
  {
    super.computeStaticPseudoInstances();
    
    super.addStaticPseudoInstance("selected");
  }
  
  public Node getParentNode()
  {
    CTabItem item = getItem();
    CTabFolder parent = item.getParent();
    if (parent != null)
    {
      Element element = getElement(parent);
      return element;
    }
    return null;
  }
  
  private CTabItem getItem()
  {
    return (CTabItem)getNativeWidget();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.CTabItemElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Widget;
import org.w3c.dom.Node;

public class CompositeElement
  extends ControlElement
{
  public CompositeElement(Composite composite, CSSEngine engine)
  {
    super(composite, engine);
  }
  
  public int getLength()
  {
    return getComposite().getChildren().length;
  }
  
  public Node item(int index)
  {
    Widget w = getComposite().getChildren()[index];
    return getElement(w);
  }
  
  protected Composite getComposite()
  {
    return (Composite)getNativeWidget();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.CompositeElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;

class ControlElement$1
  extends FocusAdapter
{
  ControlElement$1(ControlElement paramControlElement) {}
  
  public void focusGained(FocusEvent e)
  {
    this$0.hasFocus = true;
    ControlElement.access$0(this$0);
  }
  
  public void focusLost(FocusEvent e)
  {
    this$0.hasFocus = false;
    ControlElement.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.ControlElement.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackAdapter;

class ControlElement$2
  extends MouseTrackAdapter
{
  ControlElement$2(ControlElement paramControlElement) {}
  
  public void mouseEnter(MouseEvent e)
  {
    this$0.hasMouseHover = true;
    ControlElement.access$0(this$0);
  }
  
  public void mouseExit(MouseEvent e)
  {
    this$0.hasMouseHover = false;
    ControlElement.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.ControlElement.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class ControlElement
  extends WidgetElement
{
  protected boolean hasFocus = false;
  protected boolean hasMouseHover = false;
  private FocusListener focusListener = new FocusAdapter()
  {
    public void focusGained(FocusEvent e)
    {
      hasFocus = true;
      doApplyStyles();
    }
    
    public void focusLost(FocusEvent e)
    {
      hasFocus = false;
      doApplyStyles();
    }
  };
  private MouseTrackListener mouseHoverListener = new MouseTrackAdapter()
  {
    public void mouseEnter(MouseEvent e)
    {
      hasMouseHover = true;
      doApplyStyles();
    }
    
    public void mouseExit(MouseEvent e)
    {
      hasMouseHover = false;
      doApplyStyles();
    }
  };
  
  public ControlElement(Control control, CSSEngine engine)
  {
    super(control, engine);
  }
  
  public void initialize()
  {
    super.initialize();
    if (!dynamicEnabled) {
      return;
    }
    Control control = getControl();
    
    control.addFocusListener(focusListener);
    
    control.addMouseTrackListener(mouseHoverListener);
  }
  
  public void dispose()
  {
    super.dispose();
    if (!dynamicEnabled) {
      return;
    }
    Control control = getControl();
    if (!control.isDisposed())
    {
      control.removeFocusListener(focusListener);
      control.removeMouseTrackListener(mouseHoverListener);
    }
  }
  
  public boolean isPseudoInstanceOf(String s)
  {
    if ("focus".equals(s)) {
      return hasFocus;
    }
    if ("hover".equals(s)) {
      return hasMouseHover;
    }
    if ("enabled".equals(s)) {
      return getControl().getEnabled();
    }
    if ("disabled".equals(s)) {
      return getControl().getEnabled();
    }
    if ("visible".equals(s)) {
      return getControl().getVisible();
    }
    return super.isPseudoInstanceOf(s);
  }
  
  public Node getParentNode()
  {
    Control control = getControl();
    Composite parent = control.getParent();
    if (parent != null)
    {
      Element element = getElement(parent);
      return element;
    }
    return null;
  }
  
  protected Control getControl()
  {
    return (Control)getNativeWidget();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.ControlElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.widgets.Item;

public class ItemElement
  extends WidgetElement
{
  public ItemElement(Item item, CSSEngine engine)
  {
    super(item, engine);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.ItemElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.dom.CSSStylableElement;
import org.eclipse.e4.ui.css.core.dom.IElementProvider;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
import org.w3c.dom.Element;

public class SWTElementProvider
  implements IElementProvider
{
  public static final IElementProvider INSTANCE = new SWTElementProvider();
  
  public Element getElement(Object element, CSSEngine engine)
  {
    return createElement(element, engine);
  }
  
  public CSSStylableElement createElement(Object element, CSSEngine engine)
  {
    if ((element instanceof Text)) {
      return new TextElement((Text)element, engine);
    }
    if ((element instanceof Button)) {
      return new ButtonElement((Button)element, engine);
    }
    if ((element instanceof Scale)) {
      return new ScaleElement((Scale)element, engine);
    }
    if ((element instanceof Shell)) {
      return new ShellElement((Shell)element, engine);
    }
    if ((element instanceof CTabFolder)) {
      return new CTabFolderElement((CTabFolder)element, engine);
    }
    if ((element instanceof Composite)) {
      return new CompositeElement((Composite)element, engine);
    }
    if ((element instanceof Control)) {
      return new ControlElement((Control)element, engine);
    }
    if ((element instanceof CTabItem)) {
      return new CTabItemElement((CTabItem)element, engine);
    }
    if ((element instanceof TableItem)) {
      return new TableItemElement((TableItem)element, engine);
    }
    if ((element instanceof Item)) {
      return new ItemElement((Item)element, engine);
    }
    if ((element instanceof Widget)) {
      return new WidgetElement((Widget)element, engine);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.SWTElementProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ScaleElement$1
  extends SelectionAdapter
{
  ScaleElement$1(ScaleElement paramScaleElement) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    ScaleElement.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.ScaleElement.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Scale;

public class ScaleElement
  extends ControlElement
{
  private SelectionListener selectionListener = new SelectionAdapter()
  {
    public void widgetSelected(SelectionEvent e)
    {
      doApplyStyles();
    }
  };
  
  public ScaleElement(Scale scale, CSSEngine engine)
  {
    super(scale, engine);
  }
  
  public void initialize()
  {
    super.initialize();
    if (!dynamicEnabled) {
      return;
    }
    Scale scale = getScale();
    scale.addSelectionListener(selectionListener);
  }
  
  public void dispose()
  {
    super.dispose();
    if (!dynamicEnabled) {
      return;
    }
    Scale scale = getScale();
    if (!scale.isDisposed()) {
      scale.removeSelectionListener(selectionListener);
    }
  }
  
  public String getAttribute(String attr)
  {
    return super.getAttribute(attr);
  }
  
  protected Scale getScale()
  {
    return (Scale)getNativeWidget();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.ScaleElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.events.ShellListener;

class ShellElement$1
  implements ShellListener
{
  ShellElement$1(ShellElement paramShellElement) {}
  
  public void shellActivated(ShellEvent e)
  {
    this$0.isActive = true;
    ShellElement.access$0(this$0);
  }
  
  public void shellDeactivated(ShellEvent e)
  {
    this$0.isActive = false;
    ShellElement.access$0(this$0);
  }
  
  public void shellDeiconified(ShellEvent e) {}
  
  public void shellIconified(ShellEvent e) {}
  
  public void shellClosed(ShellEvent e)
  {
    this$0.dispose();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.ShellElement.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.w3c.dom.Node;

public class ShellElement
  extends CompositeElement
{
  protected boolean isActive;
  private ShellListener shellListener = new ShellListener()
  {
    public void shellActivated(ShellEvent e)
    {
      isActive = true;
      doApplyStyles();
    }
    
    public void shellDeactivated(ShellEvent e)
    {
      isActive = false;
      doApplyStyles();
    }
    
    public void shellDeiconified(ShellEvent e) {}
    
    public void shellIconified(ShellEvent e) {}
    
    public void shellClosed(ShellEvent e)
    {
      dispose();
    }
  };
  
  public ShellElement(Shell shell, CSSEngine engine)
  {
    super(shell, engine);
  }
  
  public void initialize()
  {
    super.initialize();
    
    Shell shell = getShell();
    if (!dynamicEnabled) {
      return;
    }
    shell.addShellListener(shellListener);
  }
  
  public Node getParentNode()
  {
    return null;
  }
  
  private Shell getShell()
  {
    return (Shell)getNativeWidget();
  }
  
  public void dispose()
  {
    super.dispose();
    if (!dynamicEnabled) {
      return;
    }
    Shell shell = getShell();
    if (!shell.isDisposed()) {
      shell.removeShellListener(shellListener);
    }
  }
  
  public boolean isPseudoInstanceOf(String s)
  {
    if ("active".equals(s)) {
      return isActive;
    }
    if ("swt-parented".equals(s)) {
      return getShell().getParent() != null;
    }
    if ("swt-unparented".equals(s)) {
      return getShell().getParent() == null;
    }
    return super.isPseudoInstanceOf(s);
  }
  
  public String getAttribute(String attr)
  {
    if ("title".equals(attr))
    {
      String title = getShell().getText();
      return title != null ? title : "";
    }
    if ("parentage".equals(attr))
    {
      Shell shell = getShell();
      Composite parent = shell.getParent();
      if (parent == null) {
        return "";
      }
      StringBuilder sb = new StringBuilder();
      do
      {
        String id = WidgetElement.getID(parent);
        if ((id != null) && (id.length() > 0)) {
          sb.append(id).append(' ');
        }
        parent = parent.getParent();
      } while (parent != null);
      return sb.toString().trim();
    }
    return super.getAttribute(attr);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.ShellElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;

public class TableItemElement
  extends ItemElement
{
  public TableItemElement(TableItem tableItem, CSSEngine engine)
  {
    super(tableItem, engine);
  }
  
  public boolean isPseudoInstanceOf(String s)
  {
    if ("odd".equals(s))
    {
      TableItem tableItem = getTableItem();
      int index = tableItem.getParent().indexOf(tableItem);
      return (index & 0x1) == 1;
    }
    if ("even".equals(s))
    {
      TableItem tableItem = getTableItem();
      int index = tableItem.getParent().indexOf(tableItem);
      return (index & 0x1) == 0;
    }
    return super.isPseudoInstanceOf(s);
  }
  
  protected TableItem getTableItem()
  {
    return (TableItem)getNativeWidget();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.TableItemElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

class TextElement$1
  implements ModifyListener
{
  TextElement$1(TextElement paramTextElement) {}
  
  public void modifyText(ModifyEvent e)
  {
    TextElement.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.TextElement.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Text;

public class TextElement
  extends ControlElement
{
  ModifyListener modifyListener = new ModifyListener()
  {
    public void modifyText(ModifyEvent e)
    {
      doApplyStyles();
    }
  };
  
  public TextElement(Text text, CSSEngine engine)
  {
    super(text, engine);
  }
  
  public void initialize()
  {
    super.initialize();
    if (!dynamicEnabled) {
      return;
    }
    Text text = getText();
    text.addModifyListener(modifyListener);
  }
  
  public void dispose()
  {
    super.dispose();
    if (!dynamicEnabled) {
      return;
    }
    Text text = getText();
    if (!text.isDisposed()) {
      text.removeModifyListener(modifyListener);
    }
  }
  
  protected Text getText()
  {
    return (Text)getNativeWidget();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.TextElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom;

import org.eclipse.e4.ui.css.core.dom.ElementAdapter;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.e4.ui.css.core.utils.ClassUtils;
import org.eclipse.e4.ui.css.swt.helpers.SWTStyleHelpers;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Widget;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class WidgetElement
  extends ElementAdapter
  implements NodeList
{
  boolean dynamicEnabled = Boolean.getBoolean("org.eclipse.e4.ui.css.dynamic");
  protected String localName;
  protected String namespaceURI;
  protected String swtStyles;
  
  public static String getCSSClass(Widget widget)
  {
    return (String)widget.getData("org.eclipse.e4.ui.css.CssClassName");
  }
  
  public static String getID(Widget widget)
  {
    return (String)widget.getData("org.eclipse.e4.ui.css.id");
  }
  
  public static void setCSSClass(Widget widget, String className)
  {
    widget.setData("org.eclipse.e4.ui.css.CssClassName", className);
  }
  
  public static void setID(Widget widget, String id)
  {
    widget.setData("org.eclipse.e4.ui.css.id", id);
  }
  
  public static CSSEngine getEngine(Widget widget)
  {
    return getEngine(widget.getDisplay());
  }
  
  public static CSSEngine getEngine(Display display)
  {
    return (CSSEngine)display.getData("org.eclipse.e4.ui.css.core.engine");
  }
  
  public static void setEngine(Display display, CSSEngine engine)
  {
    display.setData("org.eclipse.e4.ui.css.core.engine", engine);
  }
  
  public WidgetElement(Widget widget, CSSEngine engine)
  {
    super(widget, engine);
    localName = computeLocalName();
    namespaceURI = computeNamespaceURI();
    computeStaticPseudoInstances();
    swtStyles = computeAttributeSWTStyle();
  }
  
  protected String computeLocalName()
  {
    Widget widget = getWidget();
    Class clazz = widget.getClass();
    return ClassUtils.getSimpleName(clazz);
  }
  
  protected String computeNamespaceURI()
  {
    Widget widget = getWidget();
    Class clazz = widget.getClass();
    return ClassUtils.getPackageName(clazz);
  }
  
  protected void computeStaticPseudoInstances() {}
  
  protected String computeAttributeSWTStyle()
  {
    return SWTStyleHelpers.getSWTWidgetStyleAsString(getWidget());
  }
  
  public String getAttribute(String attr)
  {
    Widget widget = getWidget();
    if (attr.equals("style")) {
      return swtStyles;
    }
    if (attr.equals("class"))
    {
      String result = getCSSClass(widget);
      return result != null ? result : "";
    }
    if ("swt-data-class".equals(attr))
    {
      Object data = widget.getData();
      if (data == null) {
        return "";
      }
      StringBuilder sb = new StringBuilder();
      for (Class<?> clazz = data.getClass(); clazz != Object.class; sb
            .append(' '))
      {
        sb.append(clazz.getName());
        clazz = clazz.getSuperclass();
      }
      return sb.toString();
    }
    Object o = widget.getData(attr.toLowerCase());
    if (o != null) {
      return o.toString();
    }
    try
    {
      if (o != null) {
        return o.toString();
      }
    }
    catch (Exception localException) {}
    return "";
  }
  
  public String getLocalName()
  {
    return localName;
  }
  
  public String getNamespaceURI()
  {
    return namespaceURI;
  }
  
  public Node getParentNode()
  {
    return null;
  }
  
  public NodeList getChildNodes()
  {
    return this;
  }
  
  public int getLength()
  {
    return 0;
  }
  
  public Node item(int index)
  {
    return null;
  }
  
  protected Widget getWidget()
  {
    return (Widget)getNativeWidget();
  }
  
  public String getCSSId()
  {
    Widget widget = getWidget();
    Object id = getID(widget);
    if (id != null) {
      return id.toString();
    }
    return null;
  }
  
  public String getCSSClass()
  {
    Widget widget = getWidget();
    Object id = getCSSClass(widget);
    if (id != null) {
      return id.toString();
    }
    return null;
  }
  
  public String getCSSStyle()
  {
    Widget widget = getWidget();
    
    Object id = widget.getData("style");
    if (id != null) {
      return id.toString();
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.WidgetElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom.html;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.e4.ui.css.swt.dom.WidgetElement;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Scrollable;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.Widget;

public class SWTHTMLElement
  extends WidgetElement
{
  protected String attributeType;
  
  public SWTHTMLElement(Widget widget, CSSEngine engine)
  {
    super(widget, engine);
    attributeType = computeAttributeType();
  }
  
  public String getAttribute(String attr)
  {
    if ("type".equals(attr)) {
      return attributeType;
    }
    return super.getAttribute(attr);
  }
  
  protected String computeLocalName()
  {
    Widget widget = getWidget();
    if ((widget instanceof Text))
    {
      int style = widget.getStyle();
      if ((style | 0x2) == style) {
        return "textarea";
      }
      return "input";
    }
    if ((widget instanceof Button)) {
      return "input";
    }
    if ((widget instanceof Combo)) {
      return "select";
    }
    if ((widget instanceof CCombo)) {
      return "select";
    }
    if ((widget instanceof Label)) {
      return "label";
    }
    if ((widget instanceof Shell)) {
      return "body";
    }
    if ((widget instanceof Canvas)) {
      return "canvas";
    }
    if ((widget instanceof Scrollable)) {
      return "div";
    }
    if ((widget instanceof List)) {
      return "body";
    }
    if ((widget instanceof Group)) {
      return "div";
    }
    if ((widget instanceof Link)) {
      return "a";
    }
    if ((widget instanceof Composite)) {
      return "div";
    }
    if ((widget instanceof Tree)) {
      return "tree";
    }
    if ((widget instanceof Table)) {
      return "listbox";
    }
    return super.computeLocalName();
  }
  
  protected String computeAttributeType()
  {
    Widget widget = getWidget();
    if ((widget instanceof Button))
    {
      Button button = (Button)widget;
      int style = button.getStyle();
      if ((style | 0x10) == style) {
        return "radio";
      }
      if ((style | 0x20) == style) {
        return "checkbox";
      }
      return "button";
    }
    if ((widget instanceof Text))
    {
      Text text = (Text)widget;
      if ((text.getStyle() & 0x400000) != 0) {
        return "password";
      }
      if ((text.getStyle() & 0x2) != 0) {
        return "";
      }
      return "text";
    }
    return "";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.html.SWTHTMLElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.dom.html;

import org.eclipse.e4.ui.css.core.dom.IElementProvider;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.e4.ui.css.swt.dom.SWTElementProvider;
import org.eclipse.e4.ui.css.swt.helpers.SWTElementHelpers;
import org.eclipse.swt.widgets.Widget;
import org.w3c.dom.Element;

public class SWTHTMLElementProvider
  extends SWTElementProvider
{
  public static final IElementProvider INSTANCE = new SWTHTMLElementProvider();
  
  public Element getElement(Object element, CSSEngine engine)
  {
    if ((element instanceof Widget))
    {
      Widget widget = (Widget)element;
      return SWTElementHelpers.getHTMLElement(widget, engine);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.dom.html.SWTHTMLElementProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.engine;

import org.eclipse.e4.ui.css.core.impl.engine.CSSEngineImpl;
import org.eclipse.e4.ui.css.core.resources.IResourcesRegistry;
import org.eclipse.e4.ui.css.swt.properties.converters.CSSValueSWTColorConverterImpl;
import org.eclipse.e4.ui.css.swt.properties.converters.CSSValueSWTCursorConverterImpl;
import org.eclipse.e4.ui.css.swt.properties.converters.CSSValueSWTFontConverterImpl;
import org.eclipse.e4.ui.css.swt.properties.converters.CSSValueSWTFontDataConverterImpl;
import org.eclipse.e4.ui.css.swt.properties.converters.CSSValueSWTGradientConverterImpl;
import org.eclipse.e4.ui.css.swt.properties.converters.CSSValueSWTImageConverterImpl;
import org.eclipse.e4.ui.css.swt.properties.converters.CSSValueSWTRGBConverterImpl;
import org.eclipse.e4.ui.css.swt.resources.SWTResourcesRegistry;
import org.eclipse.swt.widgets.Display;

public abstract class AbstractCSSSWTEngineImpl
  extends CSSEngineImpl
{
  protected Display display;
  
  public AbstractCSSSWTEngineImpl(Display display)
  {
    this(display, false);
  }
  
  public AbstractCSSSWTEngineImpl(Display display, boolean lazyApplyingStyles)
  {
    this.display = display;
    
    super.registerCSSValueConverter(CSSValueSWTRGBConverterImpl.INSTANCE);
    
    super.registerCSSValueConverter(CSSValueSWTColorConverterImpl.INSTANCE);
    
    super.registerCSSValueConverter(CSSValueSWTGradientConverterImpl.INSTANCE);
    
    super.registerCSSValueConverter(CSSValueSWTCursorConverterImpl.INSTANCE);
    
    super.registerCSSValueConverter(CSSValueSWTFontConverterImpl.INSTANCE);
    
    super.registerCSSValueConverter(CSSValueSWTFontDataConverterImpl.INSTANCE);
    
    super.registerCSSValueConverter(CSSValueSWTImageConverterImpl.INSTANCE);
    if (lazyApplyingStyles) {
      new CSSSWTApplyStylesListener(display, this);
    }
    initializeCSSPropertyHandlers();
  }
  
  protected abstract void initializeCSSPropertyHandlers();
  
  public IResourcesRegistry getResourcesRegistry()
  {
    IResourcesRegistry resourcesRegistry = super.getResourcesRegistry();
    if (resourcesRegistry == null) {
      super.setResourcesRegistry(new SWTResourcesRegistry(display));
    }
    return super.getResourcesRegistry();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.engine.AbstractCSSSWTEngineImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.engine;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class CSSSWTApplyStylesListener$1
  implements Listener
{
  CSSSWTApplyStylesListener$1(CSSSWTApplyStylesListener paramCSSSWTApplyStylesListener, CSSEngine paramCSSEngine) {}
  
  public void handleEvent(Event event)
  {
    if (val$engine != null) {
      val$engine.applyStyles(widget, false);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.engine.CSSSWTApplyStylesListener.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.engine;

import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

public class CSSSWTApplyStylesListener
{
  CSSEngine engine;
  
  public CSSSWTApplyStylesListener(Display display, final CSSEngine engine)
  {
    this.engine = engine;
    display.addListener(45, new Listener()
    {
      public void handleEvent(Event event)
      {
        if (engine != null) {
          engine.applyStyles(widget, false);
        }
      }
    });
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.engine.CSSSWTApplyStylesListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.engine;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;

class CSSSWTEngineImpl$1
  implements DisposeListener
{
  CSSSWTEngineImpl$1(CSSSWTEngineImpl paramCSSSWTEngineImpl) {}
  
  public void widgetDisposed(DisposeEvent e)
  {
    CSSSWTEngineImpl.access$0(this$0, widget);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.engine.CSSSWTEngineImpl.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.engine;

import java.util.List;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.e4.ui.css.core.impl.engine.RegistryCSSPropertyHandlerProvider;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Widget;

public class CSSSWTEngineImpl
  extends AbstractCSSSWTEngineImpl
{
  private DisposeListener disposeListener;
  
  public CSSSWTEngineImpl(Display display)
  {
    super(display);
    init();
  }
  
  public CSSSWTEngineImpl(Display display, boolean lazyApplyingStyles)
  {
    super(display, lazyApplyingStyles);
    init();
  }
  
  private void init()
  {
    disposeListener = new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent e)
      {
        handleWidgetDisposed(widget);
      }
    };
  }
  
  protected void hookNativeWidget(Object widget)
  {
    Widget swtWidget = (Widget)widget;
    swtWidget.addDisposeListener(disposeListener);
  }
  
  protected void initializeCSSPropertyHandlers()
  {
    propertyHandlerProviders.add(new RegistryCSSPropertyHandlerProvider(
      RegistryFactory.getRegistry()));
  }
  
  /* Error */
  public void reapply()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 89	org/eclipse/e4/ui/css/swt/engine/CSSSWTEngineImpl:display	Lorg/eclipse/swt/widgets/Display;
    //   4: invokevirtual 99	org/eclipse/swt/widgets/Display:getShells	()[Lorg/eclipse/swt/widgets/Shell;
    //   7: astore_1
    //   8: aload_1
    //   9: dup
    //   10: astore 5
    //   12: arraylength
    //   13: istore 4
    //   15: iconst_0
    //   16: istore_3
    //   17: goto +60 -> 77
    //   20: aload 5
    //   22: iload_3
    //   23: aaload
    //   24: astore_2
    //   25: aload_2
    //   26: iconst_0
    //   27: invokevirtual 101	org/eclipse/swt/widgets/Shell:setRedraw	(Z)V
    //   30: aload_2
    //   31: iconst_1
    //   32: invokevirtual 100	org/eclipse/swt/widgets/Shell:reskin	(I)V
    //   35: aload_0
    //   36: aload_2
    //   37: iconst_1
    //   38: invokevirtual 97	org/eclipse/e4/ui/css/swt/engine/CSSSWTEngineImpl:applyStyles	(Ljava/lang/Object;Z)V
    //   41: goto +28 -> 69
    //   44: astore 6
    //   46: aload 6
    //   48: invokevirtual 90	java/lang/Exception:printStackTrace	()V
    //   51: aload_2
    //   52: iconst_1
    //   53: invokevirtual 101	org/eclipse/swt/widgets/Shell:setRedraw	(Z)V
    //   56: goto +18 -> 74
    //   59: astore 7
    //   61: aload_2
    //   62: iconst_1
    //   63: invokevirtual 101	org/eclipse/swt/widgets/Shell:setRedraw	(Z)V
    //   66: aload 7
    //   68: athrow
    //   69: aload_2
    //   70: iconst_1
    //   71: invokevirtual 101	org/eclipse/swt/widgets/Shell:setRedraw	(Z)V
    //   74: iinc 3 1
    //   77: iload_3
    //   78: iload 4
    //   80: if_icmplt -60 -> 20
    //   83: return
    // Line number table:
    //   Java source line #62	-> byte code offset #0
    //   Java source line #63	-> byte code offset #8
    //   Java source line #65	-> byte code offset #25
    //   Java source line #66	-> byte code offset #30
    //   Java source line #67	-> byte code offset #35
    //   Java source line #68	-> byte code offset #41
    //   Java source line #70	-> byte code offset #46
    //   Java source line #72	-> byte code offset #51
    //   Java source line #71	-> byte code offset #59
    //   Java source line #72	-> byte code offset #61
    //   Java source line #73	-> byte code offset #66
    //   Java source line #72	-> byte code offset #69
    //   Java source line #63	-> byte code offset #74
    //   Java source line #75	-> byte code offset #83
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	84	0	this	CSSSWTEngineImpl
    //   7	2	1	shells	org.eclipse.swt.widgets.Shell[]
    //   24	46	2	s	org.eclipse.swt.widgets.Shell
    //   16	65	3	i	int
    //   13	68	4	j	int
    //   10	11	5	arrayOfShell1	org.eclipse.swt.widgets.Shell[]
    //   44	3	6	e	Exception
    //   59	8	7	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   25	41	44	java/lang/Exception
    //   25	51	59	finally
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.engine.CSSSWTEngineImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.engine.html;

import org.eclipse.e4.ui.css.swt.dom.html.SWTHTMLElementProvider;
import org.eclipse.e4.ui.css.swt.engine.CSSSWTEngineImpl;
import org.eclipse.swt.widgets.Display;

public class CSSSWTHTMLEngineImpl
  extends CSSSWTEngineImpl
{
  public CSSSWTHTMLEngineImpl(Display display)
  {
    this(display, false);
  }
  
  public CSSSWTHTMLEngineImpl(Display display, boolean lazyApplyingStyles)
  {
    super(display, lazyApplyingStyles);
    
    super.setElementProvider(SWTHTMLElementProvider.INSTANCE);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.ui.css.swt.engine.html.CSSSWTHTMLEngineImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.ui.css.swt.helpers;

import java.util.List;
import org.eclipse.e4.ui.css.core.css2.CSS2ColorHelper;
import org.eclipse.e4.ui.css.core.css2.CSS2RGBColorImpl;
import org.eclipse.e4.ui.css.core.dom.properties.Gradient;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.e4.ui.css.core.resources.CSSResourcesHelpers;
import org.eclipse.e4.ui.css.core.resources.IResourcesRegistry;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
import org.w3c.dom.css.CSSPrimitiveValue;
import org.w3c.dom.css.CSSValue;
import org.w3c.dom.css.CSSValueList;
import org.w3c.dom.css.RGBColor;

public class CSSSWTColorHelper
{
  public static Color
1 2 3 4 5 6 7

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